Repository: evgeny-nadymov/telegram-wp Branch: master Commit: fd98ac6d1863 Files: 2758 Total size: 38.9 MB Directory structure: gitextract_6z4bjkut/ ├── Agents/ │ ├── AgentHost.cs │ ├── Agents.csproj │ ├── CallInProgressAgentImpl.cs │ ├── ForegroundLifetimeAgentImpl.cs │ ├── MTProtoUpdater.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── PushPayload.cs │ ├── PushPayload.xml │ ├── PushUtils.cs │ ├── RegistrationHelper.cs │ ├── ScheduledAgentImpl.cs │ ├── VideoMediaStreamSource.cs │ └── VideoRenderer.cs ├── BackEnd/ │ ├── ApiLock.cpp │ ├── ApiLock.h │ ├── BackEnd.vcxproj │ ├── BackEndAudio.cpp │ ├── BackEndAudio.h │ ├── BackEndCapture.cpp │ ├── BackEndCapture.h │ ├── BackEndNativeBuffer.h │ ├── BackEndTransport.cpp │ ├── BackEndTransport.h │ ├── BackgroundTask.cpp │ ├── BackgroundTask.h │ ├── CallController.cpp │ ├── CallController.h │ ├── Globals.cpp │ ├── Globals.h │ ├── ICallControllerStatusListener.h │ ├── IConfig.h │ ├── IMTProtoUpdater.h │ ├── IVideoRenderer.h │ └── Server.h ├── BackEndProxyStub/ │ ├── BackEndProxyStub.def │ ├── BackEndProxyStub.vcxproj │ ├── PhoneVoIPApp.BackEnd.OutOfProcess.h │ ├── PhoneVoIPApp.BackEnd.OutOfProcess_i.c │ ├── PhoneVoIPApp.BackEnd.OutOfProcess_p.c │ ├── PhoneVoIPApp.BackEnd.h │ ├── PhoneVoIPApp.BackEnd_i.c │ ├── PhoneVoIPApp.BackEnd_p.c │ └── dlldata.c ├── EmojiPanel/ │ └── EmojiPanel/ │ ├── App.xaml │ ├── App.xaml.cs │ ├── Controls/ │ │ ├── Emoji/ │ │ │ ├── EmojiControl.xaml │ │ │ ├── EmojiControl.xaml.cs │ │ │ ├── EmojiData.cs │ │ │ └── EmojiSpriteItem.cs │ │ └── Utilites/ │ │ ├── DelayedExecutor.cs │ │ ├── Helpers.cs │ │ ├── MyListItemBase.cs │ │ ├── MyVirtualizingPanel.cs │ │ ├── VListItemBase.cs │ │ └── VirtSegment.cs │ ├── EmojiPanel.csproj │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ └── Properties/ │ ├── AppManifest.xml │ ├── AssemblyInfo.cs │ └── WMAppManifest.xml ├── ExifLib/ │ ├── ExifIO.cs │ ├── ExifIds.cs │ ├── ExifLib.csproj │ ├── ExifReader.cs │ ├── ExifTag.cs │ ├── JpegInfo.cs │ └── Properties/ │ └── AssemblyInfo.cs ├── ExifLib.WP8/ │ ├── ExifLib.WP8.csproj │ └── Properties/ │ └── AssemblyInfo.cs ├── FFmpegInterop/ │ ├── Source/ │ │ ├── FFmpegInteropMSS.cpp │ │ ├── FFmpegInteropMSS.h │ │ ├── FFmpegReader.cpp │ │ ├── FFmpegReader.h │ │ ├── H264AVCSampleProvider.cpp │ │ ├── H264AVCSampleProvider.h │ │ ├── H264SampleProvider.cpp │ │ ├── H264SampleProvider.h │ │ ├── MediaSampleProvider.cpp │ │ ├── MediaSampleProvider.h │ │ ├── UncompressedAudioSampleProvider.cpp │ │ ├── UncompressedAudioSampleProvider.h │ │ ├── UncompressedVideoSampleProvider.cpp │ │ └── UncompressedVideoSampleProvider.h │ └── Win8.1/ │ ├── FFmpegInterop.Shared/ │ │ ├── FFmpegGifDecoder.cpp │ │ ├── FFmpegGifDecoder.h │ │ ├── FFmpegInterop.Shared.vcxitems │ │ ├── FFmpegInterop.Shared.vcxitems.filters │ │ ├── pch.cpp │ │ └── pch.h │ └── FFmpegInterop.WindowsPhone/ │ ├── FFmpegInterop.WindowsPhone.vcxproj │ └── FFmpegInterop.WindowsPhone.vcxproj.filters ├── LICENSE ├── OpenCVComponent/ │ ├── Assets/ │ │ ├── haarcascade_eye.xml │ │ ├── haarcascade_frontalface_alt.xml │ │ └── haarcascade_mouth.xml │ ├── OpenCVComponent.cpp │ ├── OpenCVComponent.h │ ├── OpenCVComponent.vcxproj │ ├── OpenCVComponent.vcxproj.filters │ ├── opencv.props │ ├── pch.cpp │ └── pch.h ├── README.md ├── Telegram.Api/ │ ├── Aggregator/ │ │ ├── EventAggregator.cs │ │ └── ExtensionMethods.cs │ ├── Compression/ │ │ ├── GZipDeflateStream.cs │ │ └── GZipWebClient.cs │ ├── Constants.cs │ ├── Extensions/ │ │ ├── ActionExtensions.cs │ │ ├── HttpWebRequestExtensions.cs │ │ ├── StreamExtensions.cs │ │ └── TLObjectExtensions.cs │ ├── Hash/ │ │ ├── CRC32/ │ │ │ └── CRC.cs │ │ └── MD5/ │ │ ├── MD5.cs │ │ ├── MD5CryptoServiceProvider.cs │ │ └── MD5Managed.cs │ ├── Helpers/ │ │ ├── AuthorizationHelper.cs │ │ ├── Execute.cs │ │ ├── FileUtils.cs │ │ ├── IAuthorizationHelper.cs │ │ ├── Notifications.cs │ │ ├── PhoneHelper.cs │ │ ├── RequestHelper.cs │ │ ├── SettingsHelper.cs │ │ └── Utils.cs │ ├── Logs/ │ │ └── Log.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Services/ │ │ ├── Cache/ │ │ │ ├── Context.cs │ │ │ ├── EventArgs/ │ │ │ │ ├── DialogAddedEventArgs.cs │ │ │ │ └── TopMessageUpdatedEventArgs.cs │ │ │ ├── ICacheService.cs │ │ │ ├── InMemoryCacheService.cs │ │ │ └── InMemoryDatabase.cs │ │ ├── Connection/ │ │ │ ├── ConnectionService.cs │ │ │ └── PublicConfigService.cs │ │ ├── DCOptionItem.cs │ │ ├── DelayedItem.cs │ │ ├── DeviceInfo/ │ │ │ ├── EmptyDeviceInfoService.cs │ │ │ └── IDeviceInfo.cs │ │ ├── FileManager/ │ │ │ ├── AudioFileManager.cs │ │ │ ├── DocumentFileManager.cs │ │ │ ├── DownloadableItem.cs │ │ │ ├── DownloadablePart.cs │ │ │ ├── DownloadingCanceledEventArgs.cs │ │ │ ├── EncryptedFileManager.cs │ │ │ ├── FileManager.cs │ │ │ ├── FileManagerBase.cs │ │ │ ├── IAudioFileManager.cs │ │ │ ├── IDocumentFileManager.cs │ │ │ ├── IEncryptedFileManager.cs │ │ │ ├── IFileManager.cs │ │ │ ├── IUploadAudioFileManager.cs │ │ │ ├── IUploadFileManager.cs │ │ │ ├── IUploadVideoFileManager.cs │ │ │ ├── IVideoFileManager.cs │ │ │ ├── ProgressChangedEventArgs.cs │ │ │ ├── UploadAudioFileManager.cs │ │ │ ├── UploadFileManager.cs │ │ │ ├── UploadVideoFileManager.cs │ │ │ ├── VideoFileManager.cs │ │ │ └── Worker.cs │ │ ├── HistoryItem.cs │ │ ├── IMTProtoService.cs │ │ ├── MTProtoService.Account.cs │ │ ├── MTProtoService.Auth.cs │ │ ├── MTProtoService.ByTransport.cs │ │ ├── MTProtoService.Channel.cs │ │ ├── MTProtoService.Config.cs │ │ ├── MTProtoService.Contacts.cs │ │ ├── MTProtoService.DHKeyExchange.cs │ │ ├── MTProtoService.Help.cs │ │ ├── MTProtoService.Helpers.cs │ │ ├── MTProtoService.HttpLongPoll.cs │ │ ├── MTProtoService.Langpack.cs │ │ ├── MTProtoService.Messages.cs │ │ ├── MTProtoService.Payments.cs │ │ ├── MTProtoService.Phone.cs │ │ ├── MTProtoService.Photos.cs │ │ ├── MTProtoService.SecretChats.cs │ │ ├── MTProtoService.SendingQueue.cs │ │ ├── MTProtoService.Stuff.cs │ │ ├── MTProtoService.Updates.cs │ │ ├── MTProtoService.Upload.cs │ │ ├── MTProtoService.Users.cs │ │ ├── MTProtoService.cs │ │ ├── Messages/ │ │ │ ├── ISenderService.cs │ │ │ └── SenderService.cs │ │ ├── ServiceBase.cs │ │ ├── Updates/ │ │ │ ├── IUpdatesService.cs │ │ │ ├── ReceiveUpdatesEventArgs.cs │ │ │ ├── UpdatesBySeqComparer.cs │ │ │ └── UpdatesService.cs │ │ └── VoIP/ │ │ ├── IVoIPService.cs │ │ └── VoIPService.cs │ ├── TL/ │ │ ├── Account/ │ │ │ ├── TLChangePhone.cs │ │ │ ├── TLCheckPassword.cs │ │ │ ├── TLConfirmPhone.cs │ │ │ ├── TLGetAuthorizations.cs │ │ │ ├── TLGetPassword.cs │ │ │ ├── TLGetPasswordSettings.cs │ │ │ ├── TLGetTmpPassword.cs │ │ │ ├── TLGetWallPapers.cs │ │ │ ├── TLRecoverPassword.cs │ │ │ ├── TLReportPeer.cs │ │ │ ├── TLRequestPasswordRecovery.cs │ │ │ ├── TLResetAuthorization.cs │ │ │ ├── TLResetPassword.cs │ │ │ ├── TLSendChangePhoneCode.cs │ │ │ ├── TLSendConfirmPhoneCode.cs │ │ │ ├── TLSetPassword.cs │ │ │ ├── TLUpdateDeviceLocked.cs │ │ │ └── TLUpdatePasswordSettings.cs │ │ ├── Enums.cs │ │ ├── Functions/ │ │ │ ├── Account/ │ │ │ │ ├── TLCheckUsername.cs │ │ │ │ ├── TLDeleteAccount.cs │ │ │ │ ├── TLGetAccountTTL.cs │ │ │ │ ├── TLGetNotifySettings.cs │ │ │ │ ├── TLGetPrivacy.cs │ │ │ │ ├── TLRegisterDevice.cs │ │ │ │ ├── TLResetNotifySettings.cs │ │ │ │ ├── TLSetPrivacy.cs │ │ │ │ ├── TLUnregisterDevice.cs │ │ │ │ ├── TLUpdateNotifySettings.cs │ │ │ │ ├── TLUpdateProfile.cs │ │ │ │ ├── TLUpdateStatus.cs │ │ │ │ └── TLUpdateUserName.cs │ │ │ ├── Auth/ │ │ │ │ ├── TLCancelCode.cs │ │ │ │ ├── TLCheckPhone.cs │ │ │ │ ├── TLExportAuthorization.cs │ │ │ │ ├── TLImportAuthorization.cs │ │ │ │ ├── TLLogOut.cs │ │ │ │ ├── TLResendCode.cs │ │ │ │ ├── TLResetAuthorizations.cs │ │ │ │ ├── TLSendCall.cs │ │ │ │ ├── TLSendCode.cs │ │ │ │ ├── TLSendInvites.cs │ │ │ │ ├── TLSendSms.cs │ │ │ │ ├── TLSignIn.cs │ │ │ │ └── TLSignUp.cs │ │ │ ├── Channels/ │ │ │ │ ├── TLCheckUsername.cs │ │ │ │ ├── TLCreateChannel.cs │ │ │ │ ├── TLDeleteChannel.cs │ │ │ │ ├── TLDeleteChannelMessages.cs │ │ │ │ ├── TLDeleteHistory.cs │ │ │ │ ├── TLDeleteUserHistory.cs │ │ │ │ ├── TLEditAbout.cs │ │ │ │ ├── TLEditAdmin.cs │ │ │ │ ├── TLEditMessage.cs │ │ │ │ ├── TLEditPhoto.cs │ │ │ │ ├── TLEditTitle.cs │ │ │ │ ├── TLExportInvite.cs │ │ │ │ ├── TLExportMessageLink.cs │ │ │ │ ├── TLGetAdminedPublicChannels.cs │ │ │ │ ├── TLGetChannels.cs │ │ │ │ ├── TLGetDialogs.cs │ │ │ │ ├── TLGetFullChannel.cs │ │ │ │ ├── TLGetImportantHistory.cs │ │ │ │ ├── TLGetMessageEditData.cs │ │ │ │ ├── TLGetMessages.cs │ │ │ │ ├── TLGetParticipant.cs │ │ │ │ ├── TLGetParticipants.cs │ │ │ │ ├── TLInviteToChannel.cs │ │ │ │ ├── TLJoinChannel.cs │ │ │ │ ├── TLKickFromChannel.cs │ │ │ │ ├── TLLeaveChannel.cs │ │ │ │ ├── TLReadHistory.cs │ │ │ │ ├── TLReadMessageContents.cs │ │ │ │ ├── TLReportSpam.cs │ │ │ │ ├── TLSetStickers.cs │ │ │ │ ├── TLToggleComments.cs │ │ │ │ ├── TLToggleInvites.cs │ │ │ │ ├── TLTogglePreHistoryHidden.cs │ │ │ │ ├── TLToggleSignatures.cs │ │ │ │ ├── TLUpdateChannelUsername.cs │ │ │ │ └── TLUpdatePinnedMessage.cs │ │ │ ├── Contacts/ │ │ │ │ ├── TLBlock.cs │ │ │ │ ├── TLDeleteContact.cs │ │ │ │ ├── TLDeleteContacts.cs │ │ │ │ ├── TLGetBlocked.cs │ │ │ │ ├── TLGetContacts.cs │ │ │ │ ├── TLGetStatuses.cs │ │ │ │ ├── TLGetTopPeers.cs │ │ │ │ ├── TLImportContacts.cs │ │ │ │ ├── TLResetSaved.cs │ │ │ │ ├── TLResetTopPeerRating.cs │ │ │ │ ├── TLResolveUsername.cs │ │ │ │ ├── TLSearch.cs │ │ │ │ └── TLUnblock.cs │ │ │ ├── DHKeyExchange/ │ │ │ │ ├── TLReqDHParams.cs │ │ │ │ ├── TLReqPQ.cs │ │ │ │ └── TLSetClientDHParams.cs │ │ │ ├── Help/ │ │ │ │ ├── TLGetAppChangelog.cs │ │ │ │ ├── TLGetCdnConfig.cs │ │ │ │ ├── TLGetConfig.cs │ │ │ │ ├── TLGetInviteText.cs │ │ │ │ ├── TLGetNearestDC.cs │ │ │ │ ├── TLGetRecentMeUrls.cs │ │ │ │ ├── TLGetSupport.cs │ │ │ │ ├── TLGetTermsOfService.cs │ │ │ │ ├── TLInvokeWithLayerN.cs │ │ │ │ └── TLInvokeWithoutUpdates.cs │ │ │ ├── Langpack/ │ │ │ │ ├── TLGetDifference.cs │ │ │ │ ├── TLGetLangPack.cs │ │ │ │ ├── TLGetLanguages.cs │ │ │ │ └── TLGetStrings.cs │ │ │ ├── Messages/ │ │ │ │ ├── TLAcceptEncryption.cs │ │ │ │ ├── TLAddChatUser.cs │ │ │ │ ├── TLBotGetCallbackAnswer.cs │ │ │ │ ├── TLCheckChatInvite.cs │ │ │ │ ├── TLClearRecentStickers.cs │ │ │ │ ├── TLCreateChat.cs │ │ │ │ ├── TLDeactivateChat.cs │ │ │ │ ├── TLDeleteChatUser.cs │ │ │ │ ├── TLDeleteHistory.cs │ │ │ │ ├── TLDeleteMessages.cs │ │ │ │ ├── TLDiscardEncryption.cs │ │ │ │ ├── TLEditChatAdmin.cs │ │ │ │ ├── TLEditChatPhoto.cs │ │ │ │ ├── TLEditChatTitle.cs │ │ │ │ ├── TLEditGeoLive.cs │ │ │ │ ├── TLExportChatInvite.cs │ │ │ │ ├── TLFaveSticker.cs │ │ │ │ ├── TLForwardMessage.cs │ │ │ │ ├── TLForwardMessages.cs │ │ │ │ ├── TLGetAllDrafts.cs │ │ │ │ ├── TLGetAllStickers.cs │ │ │ │ ├── TLGetArchivedStickers.cs │ │ │ │ ├── TLGetAttachedStickers.cs │ │ │ │ ├── TLGetChats.cs │ │ │ │ ├── TLGetCommonChats.cs │ │ │ │ ├── TLGetDHConfig.cs │ │ │ │ ├── TLGetDialogs.cs │ │ │ │ ├── TLGetDocumentByHash.cs │ │ │ │ ├── TLGetFavedStickers.cs │ │ │ │ ├── TLGetFeaturedStickers.cs │ │ │ │ ├── TLGetFullChat.cs │ │ │ │ ├── TLGetHistory.cs │ │ │ │ ├── TLGetInlineBotResults.cs │ │ │ │ ├── TLGetMaskStickers.cs │ │ │ │ ├── TLGetMessages.cs │ │ │ │ ├── TLGetPeerDialogs.cs │ │ │ │ ├── TLGetPeerSettings.cs │ │ │ │ ├── TLGetPinnedDialogs.cs │ │ │ │ ├── TLGetRecentLocations.cs │ │ │ │ ├── TLGetRecentStickers.cs │ │ │ │ ├── TLGetSavedGifs.cs │ │ │ │ ├── TLGetStickerSet.cs │ │ │ │ ├── TLGetStickers.cs │ │ │ │ ├── TLGetUnreadMentions.cs │ │ │ │ ├── TLGetUnusedStickers.cs │ │ │ │ ├── TLGetWebPage.cs │ │ │ │ ├── TLGetWebPagePreview.cs │ │ │ │ ├── TLHideReportSpam.cs │ │ │ │ ├── TLImportChatInvite.cs │ │ │ │ ├── TLInstallStickerSet.cs │ │ │ │ ├── TLMigrateChat.cs │ │ │ │ ├── TLReadEncryptedHistory.cs │ │ │ │ ├── TLReadFeaturedStickers.cs │ │ │ │ ├── TLReadHistory.cs │ │ │ │ ├── TLReadMentions.cs │ │ │ │ ├── TLReadMessageContents.cs │ │ │ │ ├── TLReceivedMessages.cs │ │ │ │ ├── TLReceivedQueue.cs │ │ │ │ ├── TLReorderPinnedDialogs.cs │ │ │ │ ├── TLReorderStickerSets.cs │ │ │ │ ├── TLReportSpam.cs │ │ │ │ ├── TLRequestEncryption.cs │ │ │ │ ├── TLRestoreMessages.cs │ │ │ │ ├── TLSaveDraft.cs │ │ │ │ ├── TLSaveGif.cs │ │ │ │ ├── TLSearch.cs │ │ │ │ ├── TLSearchGifs.cs │ │ │ │ ├── TLSendBroadcast.cs │ │ │ │ ├── TLSendEncrypted.cs │ │ │ │ ├── TLSendEncryptedFile.cs │ │ │ │ ├── TLSendEncryptedService.cs │ │ │ │ ├── TLSendInlineBotResult.cs │ │ │ │ ├── TLSendMedia.cs │ │ │ │ ├── TLSendMessage.cs │ │ │ │ ├── TLSendMultiMedia.cs │ │ │ │ ├── TLSetBotCallbackAnswer.cs │ │ │ │ ├── TLSetEncryptedTyping.cs │ │ │ │ ├── TLSetInlineBotResults.cs │ │ │ │ ├── TLSetTyping.cs │ │ │ │ ├── TLStartBot.cs │ │ │ │ ├── TLToggleChatAdmins.cs │ │ │ │ ├── TLToggleDialogPin.cs │ │ │ │ ├── TLUninstallStickerSet.cs │ │ │ │ └── TLUploadMedia.cs │ │ │ ├── Payments/ │ │ │ │ ├── TLClearSavedInfo.cs │ │ │ │ ├── TLGetPaymentForm.cs │ │ │ │ ├── TLGetPaymentReceipt.cs │ │ │ │ ├── TLGetSavedInfo.cs │ │ │ │ ├── TLSendPaymentForm.cs │ │ │ │ └── TLValidateRequestedInfo.cs │ │ │ ├── Phone/ │ │ │ │ ├── TLAcceptCall.cs │ │ │ │ ├── TLConfirmCall.cs │ │ │ │ ├── TLDiscardCall.cs │ │ │ │ ├── TLGetCallConfig.cs │ │ │ │ ├── TLReceivedCall.cs │ │ │ │ ├── TLRequestCall.cs │ │ │ │ ├── TLSaveCallDebug.cs │ │ │ │ └── TLSetCallRating.cs │ │ │ ├── Photos/ │ │ │ │ ├── TLGetUserPhotos.cs │ │ │ │ ├── TLUpdateProfilePhoto.cs │ │ │ │ └── TLUploadProfilePhoto.cs │ │ │ ├── Stuff/ │ │ │ │ ├── TLGetFutureSalts.cs │ │ │ │ ├── TLHttpWait.cs │ │ │ │ ├── TLMessageAcknowledgments.cs │ │ │ │ └── TLRPCDropAnswer.cs │ │ │ ├── Updates/ │ │ │ │ ├── TLGetChannelDifference.cs │ │ │ │ ├── TLGetDifference.cs │ │ │ │ └── TLGetState.cs │ │ │ ├── Upload/ │ │ │ │ ├── TLGetCdnFile.cs │ │ │ │ ├── TLGetFile.cs │ │ │ │ ├── TLReuploadCdnFile.cs │ │ │ │ └── TLSaveFilePart.cs │ │ │ └── Users/ │ │ │ ├── TLGetFullUser.cs │ │ │ └── TLGetUsers.cs │ │ ├── Interfaces/ │ │ │ ├── IBytes.cs │ │ │ ├── IFullName.cs │ │ │ ├── IInputPeer.cs │ │ │ ├── ISelectable.cs │ │ │ └── IVIsibility.cs │ │ ├── SignatureAttribute.cs │ │ ├── TLAccountAuthorization.cs │ │ ├── TLAccountAuthorizations.cs │ │ ├── TLAccountDaysTTL.cs │ │ ├── TLActionInfo.cs │ │ ├── TLAdminLogResults.cs │ │ ├── TLAffectedHistory.cs │ │ ├── TLAffectedMessages.cs │ │ ├── TLAllStrickers.cs │ │ ├── TLAppChangelogBase.cs │ │ ├── TLArchivedStickers.cs │ │ ├── TLAudio.cs │ │ ├── TLAuthorization.cs │ │ ├── TLBadMessageNotification.cs │ │ ├── TLBadServerSalt.cs │ │ ├── TLBool.cs │ │ ├── TLBotCallbackAnswer.cs │ │ ├── TLBotCommand.cs │ │ ├── TLBotInfo.cs │ │ ├── TLBotInlineMessage.cs │ │ ├── TLBotInlineResult.cs │ │ ├── TLBotResults.cs │ │ ├── TLCallsSecurity.cs │ │ ├── TLCameraSettings.cs │ │ ├── TLCdnConfig.cs │ │ ├── TLCdnFile.cs │ │ ├── TLCdnPublicKey.cs │ │ ├── TLChannelAdminLogEvent.cs │ │ ├── TLChannelAdminLogEventAction.cs │ │ ├── TLChannelAdminLogEventsFilter.cs │ │ ├── TLChannelAdminRights.cs │ │ ├── TLChannelBannedRights.cs │ │ ├── TLChannelDifference.cs │ │ ├── TLChannelMessagesFiler.cs │ │ ├── TLChannelParticipant.cs │ │ ├── TLChannelParticipantRole.cs │ │ ├── TLChannelParticipantsFilter.cs │ │ ├── TLChat.cs │ │ ├── TLChatFull.cs │ │ ├── TLChatInvite.cs │ │ ├── TLChatParticipant.cs │ │ ├── TLChatParticipants.cs │ │ ├── TLChatSettings.cs │ │ ├── TLChats.cs │ │ ├── TLChatsSlice.cs │ │ ├── TLCheckedPhone.cs │ │ ├── TLClientDHInnerData.cs │ │ ├── TLCodeType.cs │ │ ├── TLConfig.cs │ │ ├── TLConfigSimple.cs │ │ ├── TLContact.cs │ │ ├── TLContactBlocked.cs │ │ ├── TLContactFound.cs │ │ ├── TLContactLink.cs │ │ ├── TLContactStatus.cs │ │ ├── TLContacts.cs │ │ ├── TLContactsBlocked.cs │ │ ├── TLContactsFound.cs │ │ ├── TLContainerTransportMessage.cs │ │ ├── TLDCOption.cs │ │ ├── TLDHConfig.cs │ │ ├── TLDHGen.cs │ │ ├── TLDataJSON.cs │ │ ├── TLDecryptedMessage.cs │ │ ├── TLDecryptedMessageAction.cs │ │ ├── TLDecryptedMessageLayer.cs │ │ ├── TLDecryptedMessageMedia.cs │ │ ├── TLDialog.cs │ │ ├── TLDialogs.cs │ │ ├── TLDifference.cs │ │ ├── TLDisabledFeature.cs │ │ ├── TLDocument.cs │ │ ├── TLDocumentAttribute.cs │ │ ├── TLDouble.cs │ │ ├── TLDraftMessage.cs │ │ ├── TLEncryptedChat.cs │ │ ├── TLEncryptedFile.cs │ │ ├── TLEncryptedMessage.cs │ │ ├── TLExportedAuthorization.cs │ │ ├── TLExportedMessageLink.cs │ │ ├── TLFavedStickers.cs │ │ ├── TLFeaturedStickers.cs │ │ ├── TLFile.cs │ │ ├── TLFileLocation.cs │ │ ├── TLFileType.cs │ │ ├── TLForeignLink.cs │ │ ├── TLFoundGif.cs │ │ ├── TLFoundGifs.cs │ │ ├── TLFutureSalt.cs │ │ ├── TLGame.cs │ │ ├── TLGeoPoint.cs │ │ ├── TLGzipPacked.cs │ │ ├── TLHashtagItem.cs │ │ ├── TLHighScore.cs │ │ ├── TLHighScores.cs │ │ ├── TLImportedContact.cs │ │ ├── TLImportedContacts.cs │ │ ├── TLInitConnection.cs │ │ ├── TLInlineBotSwitchPM.cs │ │ ├── TLInputAudio.cs │ │ ├── TLInputBotInlineMessage.cs │ │ ├── TLInputBotInlineMessageId.cs │ │ ├── TLInputBotInlineResult.cs │ │ ├── TLInputChatBase.cs │ │ ├── TLInputChatPhoto.cs │ │ ├── TLInputContact.cs │ │ ├── TLInputDocument.cs │ │ ├── TLInputEncryptedChat.cs │ │ ├── TLInputEncryptedFile.cs │ │ ├── TLInputEncryptedFileBigUploaded.cs │ │ ├── TLInputEncryptedFileLocation.cs │ │ ├── TLInputFile.cs │ │ ├── TLInputFileBig.cs │ │ ├── TLInputFileLocation.cs │ │ ├── TLInputGame.cs │ │ ├── TLInputGeoPoint.cs │ │ ├── TLInputMedia.cs │ │ ├── TLInputMessageEntityMentionName.cs │ │ ├── TLInputMessagesFilter.cs │ │ ├── TLInputNotifyPeer.cs │ │ ├── TLInputPaymentCredentials.cs │ │ ├── TLInputPeer.cs │ │ ├── TLInputPeerBase.cs │ │ ├── TLInputPeerNotifyEvents.cs │ │ ├── TLInputPeerNotifySettings.cs │ │ ├── TLInputPhoneCall.cs │ │ ├── TLInputPhoto.cs │ │ ├── TLInputPhotoCrop.cs │ │ ├── TLInputPrivacyKey.cs │ │ ├── TLInputPrivacyRule.cs │ │ ├── TLInputReportReason.cs │ │ ├── TLInputSingleMedia.cs │ │ ├── TLInputStickerSet.cs │ │ ├── TLInputStickeredMedia.cs │ │ ├── TLInputUser.cs │ │ ├── TLInputVideo.cs │ │ ├── TLInputWebDocument.cs │ │ ├── TLInt.cs │ │ ├── TLInt128.cs │ │ ├── TLInt256.cs │ │ ├── TLInviteText.cs │ │ ├── TLInvoice.cs │ │ ├── TLInvokeAfterMsg.cs │ │ ├── TLIpPort.cs │ │ ├── TLKeyboardButton.cs │ │ ├── TLKeyboardButtonRow.cs │ │ ├── TLLabeledPrice.cs │ │ ├── TLLangPackDifference.cs │ │ ├── TLLangPackLanguage.cs │ │ ├── TLLangPackString.cs │ │ ├── TLLink.cs │ │ ├── TLLong.cs │ │ ├── TLMaskCoords.cs │ │ ├── TLMessage.Encrypted.cs │ │ ├── TLMessage.cs │ │ ├── TLMessageAction.cs │ │ ├── TLMessageContainer.cs │ │ ├── TLMessageEditData.cs │ │ ├── TLMessageEntity.cs │ │ ├── TLMessageFwdHeader.cs │ │ ├── TLMessageGroup.cs │ │ ├── TLMessageInfo.cs │ │ ├── TLMessageMedia.cs │ │ ├── TLMessageRange.cs │ │ ├── TLMessages.cs │ │ ├── TLMessagesAcknowledgment.cs │ │ ├── TLMessagesChannelParticipants.cs │ │ ├── TLMessagesChatFull.cs │ │ ├── TLMessagesStickerSet.cs │ │ ├── TLMyLink.cs │ │ ├── TLNearestDC.cs │ │ ├── TLNewSessionCreated.cs │ │ ├── TLNonEncryptedMessage.cs │ │ ├── TLNotifyPeer.cs │ │ ├── TLNull.cs │ │ ├── TLObject.cs │ │ ├── TLObjectGenerator.cs │ │ ├── TLPQInnerData.cs │ │ ├── TLPage.cs │ │ ├── TLPageBlock.cs │ │ ├── TLPasscodeParams.cs │ │ ├── TLPassword.cs │ │ ├── TLPasswordInputSettings.cs │ │ ├── TLPasswordRecovery.cs │ │ ├── TLPasswordSettings.cs │ │ ├── TLPaymentCharge.cs │ │ ├── TLPaymentForm.cs │ │ ├── TLPaymentReceipt.cs │ │ ├── TLPaymentRequestedInfo.cs │ │ ├── TLPaymentResult.cs │ │ ├── TLPaymentSavedCredentialsCard.cs │ │ ├── TLPeer.cs │ │ ├── TLPeerDialogs.cs │ │ ├── TLPeerNotifyEvents.cs │ │ ├── TLPeerNotifySettings.cs │ │ ├── TLPeerSettings.cs │ │ ├── TLPhoneCall.cs │ │ ├── TLPhoneCallDiscardReason.cs │ │ ├── TLPhoneCallProtocol.cs │ │ ├── TLPhoneConnection.cs │ │ ├── TLPhonePhoneCall.cs │ │ ├── TLPhoto.cs │ │ ├── TLPhotoPickerSettings.cs │ │ ├── TLPhotoSize.cs │ │ ├── TLPhotos.cs │ │ ├── TLPhotosPhoto.cs │ │ ├── TLPong.cs │ │ ├── TLPopularContact.cs │ │ ├── TLPostAddress.cs │ │ ├── TLPrivacyKey.cs │ │ ├── TLPrivacyRule.cs │ │ ├── TLPrivacyRules.cs │ │ ├── TLProxyConfig.cs │ │ ├── TLRPCDropAnswer.cs │ │ ├── TLRPCError.cs │ │ ├── TLRPCResult.cs │ │ ├── TLReceivedNotifyMessage.cs │ │ ├── TLRecentMeUrl.cs │ │ ├── TLRecentMeUrls.cs │ │ ├── TLRecentStickers.cs │ │ ├── TLRecentlyUsedSticker.cs │ │ ├── TLReplyKeyboardMarkup.cs │ │ ├── TLRequest.cs │ │ ├── TLResPQ.cs │ │ ├── TLResolvedPeer.cs │ │ ├── TLResponse.cs │ │ ├── TLResultInfo.cs │ │ ├── TLRichText.cs │ │ ├── TLSavedGifs.cs │ │ ├── TLSavedInfo.cs │ │ ├── TLSendMessageAction.cs │ │ ├── TLSentChangePhoneCode.cs │ │ ├── TLSentCode.cs │ │ ├── TLSentCodeType.cs │ │ ├── TLSentEncryptedFile.cs │ │ ├── TLSentEncryptedMessage.cs │ │ ├── TLSentMessage.cs │ │ ├── TLServerDHInnerData.cs │ │ ├── TLServerDHParams.cs │ │ ├── TLServerFile.cs │ │ ├── TLShippingOption.cs │ │ ├── TLSignatures.cs │ │ ├── TLState.cs │ │ ├── TLStatedMessage.cs │ │ ├── TLStatedMessages.cs │ │ ├── TLStickerPack.cs │ │ ├── TLStickerSet.cs │ │ ├── TLStickerSetCovered.cs │ │ ├── TLStickerSetInstallResult.cs │ │ ├── TLStickers.cs │ │ ├── TLString.cs │ │ ├── TLSupport.cs │ │ ├── TLTermsOfService.cs │ │ ├── TLTmpPassword.cs │ │ ├── TLTopPeer.cs │ │ ├── TLTopPeerCategory.cs │ │ ├── TLTopPeerCategoryPeers.cs │ │ ├── TLTopPeers.cs │ │ ├── TLUpdate.cs │ │ ├── TLUpdates.cs │ │ ├── TLUserBase.cs │ │ ├── TLUserFull.cs │ │ ├── TLUserStatus.cs │ │ ├── TLUtils.Log.cs │ │ ├── TLUtils.cs │ │ ├── TLValidatedRequestedInfo.cs │ │ ├── TLVector.cs │ │ ├── TLVideo.cs │ │ ├── TLWallpaperSolid.cs │ │ ├── TLWebDocument.cs │ │ ├── TLWebFile.cs │ │ └── TLWebPage.cs │ ├── Telegram.Api.csproj │ ├── Transport/ │ │ ├── DataEventArgs.cs │ │ ├── HttpTransport.cs │ │ ├── ITransport.cs │ │ ├── ITransportService.cs │ │ ├── SocksProxy.cs │ │ ├── TCPTransport.cs │ │ ├── TCPTransportBase.cs │ │ ├── TCPTransportResult.cs │ │ └── TransportService.cs │ ├── WindowsPhone/ │ │ ├── BigInteger.cs │ │ └── Tuple.cs │ └── packages.config ├── Telegram.Api.PCL/ │ ├── Hash/ │ │ └── CRC32/ │ │ └── CRC.WinRT.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Resources/ │ │ ├── AppResources.cs │ │ ├── de/ │ │ │ └── Resources.resw │ │ ├── en/ │ │ │ └── Resources.resw │ │ ├── es/ │ │ │ └── Resources.resw │ │ ├── it/ │ │ │ └── Resources.resw │ │ ├── nl/ │ │ │ └── Resources.resw │ │ ├── pt/ │ │ │ └── Resources.resw │ │ └── ru/ │ │ └── Resources.resw │ ├── Telegram.Api.PCL.csproj │ └── packages.config ├── Telegram.Api.WP8/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Resources/ │ │ ├── AppResources.Designer.cs │ │ ├── AppResources.de.Designer.cs │ │ ├── AppResources.de.resx │ │ ├── AppResources.es.Designer.cs │ │ ├── AppResources.es.resx │ │ ├── AppResources.it.Designer.cs │ │ ├── AppResources.it.resx │ │ ├── AppResources.nl.Designer.cs │ │ ├── AppResources.nl.resx │ │ ├── AppResources.pt.Designer.cs │ │ ├── AppResources.pt.resx │ │ ├── AppResources.resx │ │ ├── AppResources.ru.Designer.cs │ │ └── AppResources.ru.resx │ ├── Services/ │ │ ├── FileManager/ │ │ │ ├── IWebFileManager.cs │ │ │ └── WebFileManager.cs │ │ └── Location/ │ │ ├── ILiveLocationService.cs │ │ └── LiveLocationService.cs │ ├── TL/ │ │ ├── Functions/ │ │ │ ├── Account/ │ │ │ │ ├── TLAcceptAuthorization.cs │ │ │ │ ├── TLDeleteSecureValue.cs │ │ │ │ ├── TLGetAllSecureValues.cs │ │ │ │ ├── TLGetAuthorizationForm.cs │ │ │ │ ├── TLGetSecureValue.cs │ │ │ │ ├── TLGetWebAuthorizations.cs │ │ │ │ ├── TLInitTakeoutSession.cs │ │ │ │ ├── TLResetWebAuthorization.cs │ │ │ │ ├── TLResetWebAuthorizations.cs │ │ │ │ ├── TLSaveSecureValue.cs │ │ │ │ ├── TLSendVerifyEmailCode.cs │ │ │ │ ├── TLSendVerifyPhoneCode.cs │ │ │ │ ├── TLVerifyEmail.cs │ │ │ │ ├── TLVerifyEmailCode.cs │ │ │ │ └── TLVerifyPhone.cs │ │ │ ├── Auth/ │ │ │ │ └── TLBindTempAuthKey.cs │ │ │ ├── Channels/ │ │ │ │ ├── TLChangeFeedBroadcast.cs │ │ │ │ ├── TLGetFeed.cs │ │ │ │ ├── TLReadFeed.cs │ │ │ │ └── TLSetFeedBroadcasts.cs │ │ │ ├── Contacts/ │ │ │ │ └── TLGetSaved.cs │ │ │ ├── Help/ │ │ │ │ ├── TLGetDeepLinkInfo.cs │ │ │ │ ├── TLGetPassportConfig.cs │ │ │ │ └── TLGetProxyData.cs │ │ │ ├── Messages/ │ │ │ │ ├── TLClearAllDrafts.cs │ │ │ │ ├── TLGetDialogUnreadMarks.cs │ │ │ │ ├── TLMarkDialogUnread.cs │ │ │ │ ├── TLReport.cs │ │ │ │ ├── TLSearchStickerSets.cs │ │ │ │ └── TLToggleTopPeers.cs │ │ │ ├── Upload/ │ │ │ │ └── TLGetWebFile.cs │ │ │ └── Users/ │ │ │ └── TLSetSecureValueErrors.cs │ │ ├── TLAppUpdate.cs │ │ ├── TLAuthorizationForm.cs │ │ ├── TLContactsSettings.cs │ │ ├── TLDeepLinkInfo.cs │ │ ├── TLDialogPeer.cs │ │ ├── TLFeedBroadcasts.cs │ │ ├── TLFeedPosition.cs │ │ ├── TLFeedSources.cs │ │ ├── TLFoundStickerSets.cs │ │ ├── TLInputCheckPasswordSRP.cs │ │ ├── TLInputClientProxy.cs │ │ ├── TLInputDialogPeer.cs │ │ ├── TLInputMessage.cs │ │ ├── TLInputSecureFile.cs │ │ ├── TLInputSecureValue.cs │ │ ├── TLInvokeWithMessageRange.cs │ │ ├── TLInvokeWithTakeout.cs │ │ ├── TLPassportConfig.cs │ │ ├── TLPasswordKdfAlgo.cs │ │ ├── TLProxyData.cs │ │ ├── TLSavedPhoneContact.cs │ │ ├── TLSecureCredentialsEncrypted.cs │ │ ├── TLSecureData.cs │ │ ├── TLSecureFile.cs │ │ ├── TLSecurePasswordKdfAlgo.cs │ │ ├── TLSecureRequiredType.cs │ │ ├── TLSecureSecretSettings.cs │ │ ├── TLSecureValue.cs │ │ ├── TLSecureValueError.cs │ │ ├── TLSecureValueHash.cs │ │ ├── TLSecureValuePlainData.cs │ │ ├── TLSecureValueType.cs │ │ ├── TLSentEmailCode.cs │ │ ├── TLTakeout.cs │ │ ├── TLTermsOfServiceUpdate.cs │ │ ├── TLWebAuthorization.cs │ │ └── TLWebAuthorizations.cs │ ├── Telegram.Api.WP8.csproj │ ├── Transport/ │ │ ├── NativeTcpTransport.cs │ │ └── TCPTransportWinRT.cs │ └── packages.config ├── Telegram.Client.TileUpdated/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── ScheduledAgent.cs │ ├── Telegram.Client.TileUpdated.csproj │ └── packages.config ├── Telegram.Controls/ │ ├── AnimationMediator.cs │ ├── BindingListener.cs │ ├── Extensions/ │ │ ├── ScrollViewerExtensions.cs │ │ └── VisualTreeExtensions.cs │ ├── FlipCounter.xaml │ ├── FlipCounter.xaml.cs │ ├── FlipPanel.xaml │ ├── FlipPanel.xaml.cs │ ├── Helpers/ │ │ ├── DependencyPropertyChangedListener.cs │ │ └── DependencyPropertyValueChangedEventArgs.cs │ ├── HighlightingTextBlock.cs │ ├── IHighlightable.cs │ ├── LazyItemsControl.cs │ ├── LazyListBox.cs │ ├── LongListSelector/ │ │ ├── Common/ │ │ │ ├── MotionParameters.cs │ │ │ ├── SafeRaise.cs │ │ │ ├── TempaltedVisualTreeExtensions.cs │ │ │ └── VisualStates.cs │ │ ├── LongListSelector.cs │ │ ├── LongListSelectorEventArgs.cs │ │ ├── LongListSelectorGroup.cs │ │ ├── LongListSelectorItem.cs │ │ ├── LongListSelectorItemType.cs │ │ ├── LongListSelectorItemsControl.cs │ │ ├── TemplatedListBox.cs │ │ └── TemplatedListBoxItem.cs │ ├── MultiTemplateItemsControl.cs │ ├── MultiTemplateLazyListBox.cs │ ├── Notifications/ │ │ ├── DialogService.cs │ │ ├── PopUp.cs │ │ └── ToastPrompt.cs │ ├── Profiling/ │ │ ├── ApplicationSpace.cs │ │ └── MemoryCounter.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── README_FIRST.txt │ ├── RangeSlider.cs │ ├── ReorderListBox/ │ │ ├── ReorderListBox.cs │ │ └── ReorderListBoxItem.cs │ ├── ScrollableTextBlock.cs │ ├── SmoothProgressBar.xaml │ ├── SmoothProgressBar.xaml.cs │ ├── Telegram.Controls.csproj │ ├── Themes/ │ │ └── generic.xaml │ ├── Triggers/ │ │ └── CompressionTrigger.cs │ ├── UnreadCounter.xaml │ ├── UnreadCounter.xaml.cs │ ├── Utils/ │ │ └── Language.cs │ ├── ValidationTextBox.cs │ ├── WatermarkTextBox.cs │ └── packages.config ├── Telegram.Controls.WP8/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Telegram.Controls.WP8.csproj │ ├── Utils/ │ │ └── Currency.cs │ └── packages.config ├── Telegram.EmojiPanel/ │ ├── BrowserNavigationService.cs │ ├── Controls/ │ │ ├── Emoji/ │ │ │ ├── EmojiControl.xaml │ │ │ ├── EmojiControl.xaml.cs │ │ │ ├── EmojiData.cs │ │ │ ├── EmojiSpriteItem.cs │ │ │ └── StickerSpriteItem.cs │ │ └── Utilites/ │ │ ├── DelayedExecutor.cs │ │ ├── Helpers.cs │ │ ├── MyListItemBase.cs │ │ ├── MyVirtualizingPanel.cs │ │ ├── VListItemBase.cs │ │ └── VirtSegment.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Telegram.EmojiPanel.csproj │ ├── TelegramRichTextBox.cs │ ├── TestScrollableTextBlock.cs │ ├── Themes/ │ │ └── generic.xaml │ └── packages.config ├── Telegram.EmojiPanel.WP8/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── Telegram.EmojiPanel.WP8.csproj │ └── packages.config ├── TelegramClient/ │ ├── Analytics/ │ │ ├── AnalyticsProperties.cs │ │ ├── AnalyticsService.cs │ │ ├── AnalyticsTracker.cs │ │ └── ReviewRequester.cs │ ├── Animation/ │ │ ├── LinqToVisualTree.cs │ │ ├── MetroInMotion.cs │ │ └── Navigation/ │ │ ├── AnimatedBasePage.cs │ │ ├── AnimatorHelperBase.cs │ │ ├── ContinuumAnimator.cs │ │ ├── SlideAnimator.cs │ │ ├── Storyboards.cs │ │ ├── SwivelAnimator.cs │ │ ├── TurnstileAnimator.cs │ │ └── TurnstileFeatherAnimator.cs │ ├── App.xaml │ ├── App.xaml.cs │ ├── Behaviors/ │ │ ├── MarkTapAsHandledBehavior.cs │ │ ├── PanAndZoomBehavior.cs │ │ ├── ProgressBarSmoother.cs │ │ ├── SelectionBehavior.cs │ │ ├── ThemeToStateBehavior.cs │ │ ├── ToggleSwitchLocalizedContentBehavior.cs │ │ └── UpdateTextBindingBehavior.cs │ ├── Bootstrapper.cs │ ├── CapabilityPlaceholder.cs │ ├── Commands.cs │ ├── Constants.cs │ ├── Controls/ │ │ ├── BrowserNavigationService.cs │ │ ├── TelegramNavigationInTransition.cs │ │ ├── TelegramNavigationOutTransition.cs │ │ ├── TelegramNavigationTransition.cs │ │ ├── TelegramRichTextBox.cs │ │ ├── TelegramTransitionFrame.cs │ │ ├── TelegramTransitionService.cs │ │ ├── TelegramTurnstileTransition.cs │ │ ├── TestScrollableTextBlock.cs │ │ └── TransitionFrame.cs │ ├── Converters/ │ │ ├── BackgroundImageConverter.cs │ │ ├── BooleanToValueConverter.cs │ │ ├── BooleanToVisibilityConverter.cs │ │ ├── ChatForbiddenToVisibilityConverter.cs │ │ ├── ChatToMaxHeight.cs │ │ ├── ChatToVisibilityConverter.cs │ │ ├── CountToVisibilityConverter.cs │ │ ├── DebugVisibilityConverter.cs │ │ ├── DefaultPhotoConverter.cs │ │ ├── DialogCaptionConverter.cs │ │ ├── DialogDetailsBackgroundConverter.cs │ │ ├── DialogMessageFromConverter.cs │ │ ├── DistanceAwayConverter.cs │ │ ├── EmptyDialogMessageConverter.cs │ │ ├── EmptyPhotoToVisibilityConverter.cs │ │ ├── EmptyStringToVisibilityConverter.cs │ │ ├── ExistsToVisibilityConverter.cs │ │ ├── ExtendedImageConverter.cs │ │ ├── FileExtToColorConverter.cs │ │ ├── FileNameConverter.cs │ │ ├── FileSizeConverter.cs │ │ ├── ForwardedMessageConverter.cs │ │ ├── GeoLocationToVisibilityConverter.cs │ │ ├── GeoPointToStaticGoogleMapsConverter.cs │ │ ├── GroupToBackgroundBrushValueConverter.cs │ │ ├── GroupToForegroundBrushValueConverter.cs │ │ ├── IdToPlaceholderBackgroundConverter.cs │ │ ├── IntToVisibilityConverter.cs │ │ ├── InvertBooleanConverter.cs │ │ ├── IsSelectedToBackgroundConverter.cs │ │ ├── LowercaseConverter.cs │ │ ├── MaskConverter.cs │ │ ├── MediaContactToPhotoConverter.cs │ │ ├── MediaEmptyToVisibilityConverter.cs │ │ ├── MediaSizeConverter.cs │ │ ├── MergeBrushesConverter.cs │ │ ├── MessageStateToForegroundConverter.cs │ │ ├── MessageStatusConverter.cs │ │ ├── MessageToBriefInfoConverter.cs │ │ ├── MessageToFontFamilyConverter.cs │ │ ├── MuteUntilToStringConverter.cs │ │ ├── NotServiceMessageToVisibilityConverter.cs │ │ ├── NotifySettingsToVisibilityConverter.cs │ │ ├── OverlayAccentBrushConverter.cs │ │ ├── PhoneNumberConverter.cs │ │ ├── PhotoBytesToImageConverter.cs │ │ ├── PhotoToDimensionConverter.cs │ │ ├── PhotoToThumbConverter.cs │ │ ├── PlaceholderDefaultImageConverter.cs │ │ ├── PrivateBetaToVisibilityConverter.cs │ │ ├── ProgressToVisibilityConverter.cs │ │ ├── ReplyMarkupButtonVisibilityConverter.cs │ │ ├── SecretChatsAvailabilityConverter.cs │ │ ├── SecretChatsForegroundConverter.cs │ │ ├── ServiceMessageToTextConverter.cs │ │ ├── StatusToImageConverter.cs │ │ ├── StickerSetToCountStringConverter.cs │ │ ├── StringEqualsToVisibilityConverter.cs │ │ ├── StringFormatConverter.cs │ │ ├── TLIntToDateTimeConverter.cs │ │ ├── TestBindingConverter.cs │ │ ├── TextMessageToVisibilityConverter.cs │ │ ├── TextSizeToVisibilityConverter.cs │ │ ├── UnreadCountToVisibilityConverter.cs │ │ ├── UnreadMessageConverter.cs │ │ ├── UnregisteredUserIdToVisibilityConverter.cs │ │ ├── UppercaseConverter.cs │ │ ├── UserStatusToBrushConverter.cs │ │ ├── UserStatusToStringConverter.cs │ │ ├── UserStatusToVisibilityConverter.cs │ │ ├── UserToActionStringConverter.cs │ │ └── WP8VisibilityConverter.cs │ ├── EmojiKeyboardTemplateSelector.cs │ ├── EmojiPanel/ │ │ └── Controls/ │ │ ├── Emoji/ │ │ │ ├── EmojiControl.xaml │ │ │ ├── EmojiControl.xaml.cs │ │ │ ├── EmojiData.cs │ │ │ ├── EmojiSpriteItem.cs │ │ │ └── StickerSpriteItem.cs │ │ └── Utilities/ │ │ ├── DelayedExecutor.cs │ │ ├── Helpers.cs │ │ ├── MyListItemBase.cs │ │ ├── MyVirtualizingPanel.cs │ │ ├── VListItemBase.cs │ │ └── VirtSegment.cs │ ├── EventArgs/ │ │ └── UpdateChatTitleEventArgs.cs │ ├── Extensions/ │ │ ├── ApplicationExtensions.cs │ │ └── CollectionExtensions.cs │ ├── Helpers/ │ │ ├── Clip.cs │ │ ├── CollectionHelper.cs │ │ ├── Execute.cs │ │ ├── ImageUtils.cs │ │ ├── ItemsControlHelper.cs │ │ ├── PhoneHelper.cs │ │ ├── Property.cs │ │ └── TemplateSelectors/ │ │ ├── DocumentTemplateSelector.cs │ │ ├── EmptyDialogToDescriptionConverter.cs │ │ ├── ItemsPanelTemplateSelector.cs │ │ ├── LocationTemplateSelector.cs │ │ ├── MediaTemplateSelector.cs │ │ ├── MessageTemplateSelector.cs │ │ └── SearchContactsTemplateSelector.cs │ ├── Logs/ │ │ └── Log.cs │ ├── Models/ │ │ ├── AlphaKeyGroup.cs │ │ ├── ContactsByLastName.cs │ │ ├── Country.cs │ │ ├── InAppNotifications.cs │ │ ├── Settings.cs │ │ ├── UsersByFirstName.cs │ │ ├── UsersByLastName.cs │ │ └── UsersInGroup.cs │ ├── Properties/ │ │ ├── AppManifest.xml │ │ ├── AssemblyInfo.cs │ │ ├── WMAppManifest.Private.xml │ │ ├── WMAppManifest.Public.xml │ │ └── WMAppManifest.xml │ ├── Resources/ │ │ ├── AppResources.Designer.cs │ │ ├── AppResources.de.Designer.cs │ │ ├── AppResources.de.resx │ │ ├── AppResources.es.Designer.cs │ │ ├── AppResources.es.resx │ │ ├── AppResources.it.Designer.cs │ │ ├── AppResources.it.resx │ │ ├── AppResources.nl.Designer.cs │ │ ├── AppResources.nl.resx │ │ ├── AppResources.pt.Designer.cs │ │ ├── AppResources.pt.resx │ │ ├── AppResources.resx │ │ ├── AppResources.ru.Designer.cs │ │ ├── AppResources.ru.resx │ │ ├── LocalizationConverter.cs │ │ └── LocalizedStrings.cs │ ├── Services/ │ │ ├── CommonErrorHandler.cs │ │ ├── HttpDocumentFileManager.cs │ │ ├── ICommonErrorHandler.cs │ │ ├── IPushService.cs │ │ ├── IStateService.cs │ │ ├── IUploadService.cs │ │ ├── PhoneInfoService.cs │ │ ├── PushService.cs │ │ ├── PushServiceBase.cs │ │ ├── StateService.cs │ │ └── UploadService.cs │ ├── TelegramClient.csproj │ ├── Themes/ │ │ ├── Default/ │ │ │ ├── Button.xaml │ │ │ ├── CheckBox.xaml │ │ │ ├── ListBox.xaml │ │ │ ├── LongListSelector.xaml │ │ │ ├── ScrollViewer.xaml │ │ │ ├── Slider.xaml │ │ │ ├── Templates/ │ │ │ │ ├── DataTemplates.xaml │ │ │ │ ├── ItemsPanel.xaml │ │ │ │ ├── Media.xaml │ │ │ │ └── Media.xaml.cs │ │ │ ├── TextBlock.xaml │ │ │ ├── TextBox.xaml │ │ │ ├── Theme.xaml │ │ │ ├── ToggleButton.xaml │ │ │ ├── ToggleSwitch.xaml │ │ │ └── Transitions.xaml │ │ └── Generic.xaml │ ├── Utils/ │ │ ├── Color.cs │ │ ├── Language.cs │ │ └── TelegramUriMapper.cs │ ├── ViewModels/ │ │ ├── Additional/ │ │ │ ├── AboutViewModel.cs │ │ │ ├── AccountSelfDestructsViewModel.cs │ │ │ ├── AddChatParticipantConfirmationViewModel.cs │ │ │ ├── AllowUsersViewModel.cs │ │ │ ├── ArchivedStickersViewModel.cs │ │ │ ├── AskQuestionConfirmationViewModel.cs │ │ │ ├── BlockedContactsViewModel.cs │ │ │ ├── CacheViewModel.cs │ │ │ ├── ChangePasscodeViewModel.cs │ │ │ ├── ChangePasswordEmailViewModel.cs │ │ │ ├── ChangePasswordHintViewModel.cs │ │ │ ├── ChangePasswordViewModel.cs │ │ │ ├── ChangePhoneNumberViewModel.cs │ │ │ ├── ChannelBlockedContactsViewModel.cs │ │ │ ├── ChatInviteViewModel.cs │ │ │ ├── ChatSettingsViewModel.cs │ │ │ ├── ChooseAttachmentViewModel.cs │ │ │ ├── ChooseBackgroundViewModel.cs │ │ │ ├── ChooseCountryViewModel.cs │ │ │ ├── ChooseNotificationSpanViewModel.cs │ │ │ ├── ChooseTTLViewModel.cs │ │ │ ├── ClearCacheSettingsViewModel.cs │ │ │ ├── EditChatUsernameViewModel.cs │ │ │ ├── EditCurrentUserViewModel.cs │ │ │ ├── EditPhoneNumberViewModel.cs │ │ │ ├── EditUsernameViewModel.cs │ │ │ ├── EncryptionKeyViewModel.cs │ │ │ ├── EnterPasscodeViewModel.cs │ │ │ ├── EnterPasswordViewModel.cs │ │ │ ├── FeaturedStickersViewModel.cs │ │ │ ├── GroupsViewModel.cs │ │ │ ├── LastSeenViewModel.cs │ │ │ ├── LockscreenViewModel.cs │ │ │ ├── MasksViewModel.cs │ │ │ ├── MassDeleteReportSpamViewModel.cs │ │ │ ├── NotificationsViewModel.cs │ │ │ ├── PasscodeViewModel.cs │ │ │ ├── PasswordRecoveryViewModel.cs │ │ │ ├── PasswordViewModel.cs │ │ │ ├── PrivacySecureViewModel.cs │ │ │ ├── PrivacyStatementViewModel.cs │ │ │ ├── SecretChatsViewModel.cs │ │ │ ├── SelectMultipleUsersViewModel.cs │ │ │ ├── SessionsViewModel.cs │ │ │ ├── SettingsViewModel.cs │ │ │ ├── ShareViewModel.cs │ │ │ ├── SnapshotsViewModel.cs │ │ │ ├── SpecialThanksViewModel.cs │ │ │ ├── StartupViewModel.cs │ │ │ ├── StickersViewModel.cs │ │ │ └── WebViewModel.cs │ │ ├── Auth/ │ │ │ ├── CancelConfirmResetViewModel.cs │ │ │ ├── ConfirmPasswordViewModel.cs │ │ │ ├── ConfirmViewModel.cs │ │ │ ├── ResetAccountViewModel.cs │ │ │ ├── SignInViewModel.cs │ │ │ └── SignUpViewModel.cs │ │ ├── Chats/ │ │ │ ├── AddAdminsViewModel.cs │ │ │ ├── AddChannelManagerViewModel.cs │ │ │ ├── AddChatParticipantViewModel.cs │ │ │ ├── AddSecretChatParticipantViewModel.cs │ │ │ ├── ChannelAdministratorsViewModel.cs │ │ │ ├── ChannelIntroViewModel.cs │ │ │ ├── ChannelMembersViewModel.cs │ │ │ ├── Chat2ViewModel.cs │ │ │ ├── ChatDetailsViewModel.cs │ │ │ ├── ChatViewModel.cs │ │ │ ├── ConvertToSupergroupViewModel.cs │ │ │ ├── EditChatViewModel.cs │ │ │ ├── EditGroupTypeViewModel.cs │ │ │ ├── GroupsInCommonViewModel.cs │ │ │ └── InviteLinkViewModel.cs │ │ ├── Contacts/ │ │ │ ├── ContactDetailsViewModel.cs │ │ │ ├── ContactInfoViewModel.cs │ │ │ ├── ContactViewModel.cs │ │ │ ├── ContactsViewModel.cs │ │ │ ├── EditContactViewModel.cs │ │ │ ├── SecretContactDetailsViewModel.cs │ │ │ ├── SecretContactViewModel.cs │ │ │ └── ShareContactViewModel.cs │ │ ├── Debug/ │ │ │ ├── DebugViewModel.cs │ │ │ ├── LogViewModel.cs │ │ │ ├── LongPollViewModel.cs │ │ │ └── PerformanceViewModel.cs │ │ ├── Dialogs/ │ │ │ ├── ChooseDialogViewModel.cs │ │ │ ├── ChooseParticipantsViewModel.cs │ │ │ ├── CommandHintsViewModel.cs │ │ │ ├── CreateBroadcastViewModel.cs │ │ │ ├── CreateChannelStep1ViewModel.cs │ │ │ ├── CreateChannelStep2ViewModel.cs │ │ │ ├── CreateChannelStep3ViewModel.cs │ │ │ ├── CreateChannelViewModel.cs │ │ │ ├── CreateDialogViewModel.cs │ │ │ ├── DialogDetailsMode.cs │ │ │ ├── DialogDetailsViewModel.Actions.cs │ │ │ ├── DialogDetailsViewModel.Channel.cs │ │ │ ├── DialogDetailsViewModel.Contact.cs │ │ │ ├── DialogDetailsViewModel.Document.cs │ │ │ ├── DialogDetailsViewModel.Edit.cs │ │ │ ├── DialogDetailsViewModel.GeoPoint.cs │ │ │ ├── DialogDetailsViewModel.Handle.cs │ │ │ ├── DialogDetailsViewModel.InlineBots.cs │ │ │ ├── DialogDetailsViewModel.Mass.cs │ │ │ ├── DialogDetailsViewModel.Media.cs │ │ │ ├── DialogDetailsViewModel.Photo.cs │ │ │ ├── DialogDetailsViewModel.Reply.cs │ │ │ ├── DialogDetailsViewModel.Search.cs │ │ │ ├── DialogDetailsViewModel.Video.cs │ │ │ ├── DialogDetailsViewModel.cs │ │ │ ├── DialogSearchMessagesViewModel.cs │ │ │ ├── DialogsViewModel.Common.cs │ │ │ ├── DialogsViewModel.cs │ │ │ ├── FastDialogDetailsViewModel.cs │ │ │ ├── HashtagHintsViewModel.cs │ │ │ ├── InlineBotResultsViewModel.cs │ │ │ ├── MessageViewerViewModel.cs │ │ │ ├── PinnedMessageViewModel.cs │ │ │ ├── SecretChatDebugViewModel.cs │ │ │ ├── SecretDialogDetailsViewModel.Actions.cs │ │ │ ├── SecretDialogDetailsViewModel.Document.cs │ │ │ ├── SecretDialogDetailsViewModel.GeoPoint.cs │ │ │ ├── SecretDialogDetailsViewModel.Handle.cs │ │ │ ├── SecretDialogDetailsViewModel.InlineBots.cs │ │ │ ├── SecretDialogDetailsViewModel.Media.cs │ │ │ ├── SecretDialogDetailsViewModel.Photo.cs │ │ │ ├── SecretDialogDetailsViewModel.Reply.cs │ │ │ ├── SecretDialogDetailsViewModel.Text.cs │ │ │ ├── SecretDialogDetailsViewModel.Video.cs │ │ │ ├── SecretDialogDetailsViewModel.cs │ │ │ ├── StickerHintsViewModel.cs │ │ │ ├── UserActionViewModel.cs │ │ │ └── UsernameHintsViewModel.cs │ │ ├── ItemDetailsViewModelBase.cs │ │ ├── ItemsViewModelBase.cs │ │ ├── Media/ │ │ │ ├── AnimatedImageViewerViewModel.cs │ │ │ ├── DecryptedImageViewerViewModel.cs │ │ │ ├── FilesViewModel.cs │ │ │ ├── FullMediaViewModel.cs │ │ │ ├── ImageEditorViewModel.cs │ │ │ ├── ImageViewerViewModel.cs │ │ │ ├── LinksViewModel.cs │ │ │ ├── MapViewModel.cs │ │ │ ├── MediaViewModel.cs │ │ │ ├── MusicViewModel.cs │ │ │ ├── PivotImageViewerViewModel.cs │ │ │ ├── ProfilePhotoViewerViewModel.cs │ │ │ ├── SecretMediaViewModel.cs │ │ │ ├── VideoCaptureViewModel.cs │ │ │ └── VideoPlayerViewModel.cs │ │ ├── Search/ │ │ │ ├── ISearch.cs │ │ │ ├── SearchContactsViewModel.cs │ │ │ ├── SearchDialogsViewModel.cs │ │ │ ├── SearchFilesViewModel.cs │ │ │ ├── SearchItemsViewModelBase.cs │ │ │ ├── SearchLinksViewModel.cs │ │ │ ├── SearchMessagesViewModel.cs │ │ │ ├── SearchMusicViewModel.cs │ │ │ ├── SearchShellViewModel.cs │ │ │ ├── SearchVenuesViewModel.cs │ │ │ └── SearchViewModel.cs │ │ ├── ShellViewModel.cs │ │ └── ViewModelBase.cs │ ├── Views/ │ │ ├── Additional/ │ │ │ ├── AboutView.xaml │ │ │ ├── AboutView.xaml.cs │ │ │ ├── AccountSelfDestructsView.xaml │ │ │ ├── AccountSelfDestructsView.xaml.cs │ │ │ ├── AddChatParticipantConfirmationView.xaml │ │ │ ├── AddChatParticipantConfirmationView.xaml.cs │ │ │ ├── AllowUsersView.xaml │ │ │ ├── AllowUsersView.xaml.cs │ │ │ ├── ArchivedStickersView.xaml │ │ │ ├── ArchivedStickersView.xaml.cs │ │ │ ├── AskQuestionConfirmationView.xaml │ │ │ ├── AskQuestionConfirmationView.xaml.cs │ │ │ ├── BlockedContactsView.xaml │ │ │ ├── BlockedContactsView.xaml.cs │ │ │ ├── BubbleBackgroundControl.xaml │ │ │ ├── BubbleBackgroundControl.xaml.cs │ │ │ ├── CacheView.xaml │ │ │ ├── CacheView.xaml.cs │ │ │ ├── ChangePasscodeView.xaml │ │ │ ├── ChangePasscodeView.xaml.cs │ │ │ ├── ChangePasswordEmailView.xaml │ │ │ ├── ChangePasswordEmailView.xaml.cs │ │ │ ├── ChangePasswordHintView.xaml │ │ │ ├── ChangePasswordHintView.xaml.cs │ │ │ ├── ChangePasswordView.xaml │ │ │ ├── ChangePasswordView.xaml.cs │ │ │ ├── ChangePhoneNumberView.xaml │ │ │ ├── ChangePhoneNumberView.xaml.cs │ │ │ ├── ChannelBlockedContactsView.xaml │ │ │ ├── ChannelBlockedContactsView.xaml.cs │ │ │ ├── ChatSettingsView.xaml │ │ │ ├── ChatSettingsView.xaml.cs │ │ │ ├── ChooseAttachmentView.xaml │ │ │ ├── ChooseAttachmentView.xaml.cs │ │ │ ├── ChooseBackgroundView.xaml │ │ │ ├── ChooseBackgroundView.xaml.cs │ │ │ ├── ChooseCountryView.xaml │ │ │ ├── ChooseCountryView.xaml.cs │ │ │ ├── ChooseNotificationSpanView.xaml │ │ │ ├── ChooseNotificationSpanView.xaml.cs │ │ │ ├── ChooseTTLView.xaml │ │ │ ├── ChooseTTLView.xaml.cs │ │ │ ├── ClearCacheSettingsView.xaml │ │ │ ├── ClearCacheSettingsView.xaml.cs │ │ │ ├── EditChatUsernameView.xaml │ │ │ ├── EditChatUsernameView.xaml.cs │ │ │ ├── EditCurrentUserView.xaml │ │ │ ├── EditCurrentUserView.xaml.cs │ │ │ ├── EditPhoneNumberView.xaml │ │ │ ├── EditPhoneNumberView.xaml.cs │ │ │ ├── EditUsernameView.xaml │ │ │ ├── EditUsernameView.xaml.cs │ │ │ ├── EncryptionKeyView.xaml │ │ │ ├── EncryptionKeyView.xaml.cs │ │ │ ├── EnterPasscodeView.xaml │ │ │ ├── EnterPasscodeView.xaml.cs │ │ │ ├── EnterPasswordView.xaml │ │ │ ├── EnterPasswordView.xaml.cs │ │ │ ├── FallingSnowControl.xaml │ │ │ ├── FallingSnowControl.xaml.cs │ │ │ ├── FeaturedStickersView.xaml │ │ │ ├── FeaturedStickersView.xaml.cs │ │ │ ├── GroupsView.xaml │ │ │ ├── GroupsView.xaml.cs │ │ │ ├── InputMessageHint.xaml │ │ │ ├── InputMessageHint.xaml.cs │ │ │ ├── LastSeenView.xaml │ │ │ ├── LastSeenView.xaml.cs │ │ │ ├── LockscreenView.xaml │ │ │ ├── LockscreenView.xaml.cs │ │ │ ├── MasksView.xaml │ │ │ ├── MasksView.xaml.cs │ │ │ ├── MassDeleteReportSpamView.xaml │ │ │ ├── MassDeleteReportSpamView.xaml.cs │ │ │ ├── NotificationsView.xaml │ │ │ ├── NotificationsView.xaml.cs │ │ │ ├── NumericKeyboard.xaml │ │ │ ├── NumericKeyboard.xaml.cs │ │ │ ├── PasscodeView.xaml │ │ │ ├── PasscodeView.xaml.cs │ │ │ ├── PasswordRecoveryView.xaml │ │ │ ├── PasswordRecoveryView.xaml.cs │ │ │ ├── PasswordView.xaml │ │ │ ├── PasswordView.xaml.cs │ │ │ ├── PrivacySecurityView.xaml │ │ │ ├── PrivacySecurityView.xaml.cs │ │ │ ├── PrivacyStatementView.xaml │ │ │ ├── PrivacyStatementView.xaml.cs │ │ │ ├── SecretChatsView.xaml │ │ │ ├── SecretChatsView.xaml.cs │ │ │ ├── SelectMultipleUsersView.xaml │ │ │ ├── SelectMultipleUsersView.xaml.cs │ │ │ ├── SessionsView.xaml │ │ │ ├── SessionsView.xaml.cs │ │ │ ├── SettingsView.xaml │ │ │ ├── SettingsView.xaml.cs │ │ │ ├── ShareView.xaml │ │ │ ├── ShareView.xaml.cs │ │ │ ├── SnapshotsView.xaml │ │ │ ├── SnapshotsView.xaml.cs │ │ │ ├── SpecialThanksView.xaml │ │ │ ├── SpecialThanksView.xaml.cs │ │ │ ├── StartupView.xaml │ │ │ ├── StartupView.xaml.cs │ │ │ ├── StickersView.xaml │ │ │ ├── StickersView.xaml.cs │ │ │ ├── TelegramPasswordBox.xaml │ │ │ ├── TelegramPasswordBox.xaml.cs │ │ │ ├── WebView.xaml │ │ │ └── WebView.xaml.cs │ │ ├── Auth/ │ │ │ ├── CancelConfirmResetView.xaml │ │ │ ├── CancelConfirmResetView.xaml.cs │ │ │ ├── ConfirmPasswordView.xaml │ │ │ ├── ConfirmPasswordView.xaml.cs │ │ │ ├── ConfirmView.xaml │ │ │ ├── ConfirmView.xaml.cs │ │ │ ├── ResetAccountView.xaml │ │ │ ├── ResetAccountView.xaml.cs │ │ │ ├── SignInView.xaml │ │ │ ├── SignInView.xaml.cs │ │ │ ├── SignUpView.xaml │ │ │ └── SignUpView.xaml.cs │ │ ├── Chats/ │ │ │ ├── AddAdminsView.xaml │ │ │ ├── AddAdminsView.xaml.cs │ │ │ ├── AddChannelManagerView.xaml │ │ │ ├── AddChannelManagerView.xaml.cs │ │ │ ├── AddChatParticipantView.xaml │ │ │ ├── AddChatParticipantView.xaml.cs │ │ │ ├── AddSecretChatParticipantView.xaml │ │ │ ├── AddSecretChatParticipantView.xaml.cs │ │ │ ├── ChannelAdministratorsView.xaml │ │ │ ├── ChannelAdministratorsView.xaml.cs │ │ │ ├── ChannelIntroView.xaml │ │ │ ├── ChannelIntroView.xaml.cs │ │ │ ├── ChannelMembersView.xaml │ │ │ ├── ChannelMembersView.xaml.cs │ │ │ ├── Chat2View.xaml │ │ │ ├── Chat2View.xaml.cs │ │ │ ├── ChatDetailsView.xaml │ │ │ ├── ChatDetailsView.xaml.cs │ │ │ ├── ChatView.xaml │ │ │ ├── ChatView.xaml.cs │ │ │ ├── ConvertToSupergroupView.xaml │ │ │ ├── ConvertToSupergroupView.xaml.cs │ │ │ ├── EditChatView.xaml │ │ │ ├── EditChatView.xaml.cs │ │ │ ├── EditGroupTypeView.xaml │ │ │ ├── EditGroupTypeView.xaml.cs │ │ │ ├── GroupsInCommonView.xaml │ │ │ ├── GroupsInCommonView.xaml.cs │ │ │ ├── InviteLinkView.xaml │ │ │ └── InviteLinkView.xaml.cs │ │ ├── Contacts/ │ │ │ ├── ContactDetailsView.xaml │ │ │ ├── ContactDetailsView.xaml.cs │ │ │ ├── ContactInfoView.xaml │ │ │ ├── ContactInfoView.xaml.cs │ │ │ ├── ContactView.xaml │ │ │ ├── ContactView.xaml.cs │ │ │ ├── ContactsView.xaml │ │ │ ├── ContactsView.xaml.cs │ │ │ ├── EditContactView.xaml │ │ │ ├── EditContactView.xaml.cs │ │ │ ├── SecretContactDetailsView.xaml │ │ │ ├── SecretContactDetailsView.xaml.cs │ │ │ ├── SecretContactView.xaml │ │ │ ├── SecretContactView.xaml.cs │ │ │ ├── ShareContactView.xaml │ │ │ └── ShareContactView.xaml.cs │ │ ├── Controls/ │ │ │ ├── ChatInviteControl.xaml │ │ │ ├── ChatInviteControl.xaml.cs │ │ │ ├── ConversationTileControl.xaml │ │ │ ├── ConversationTileControl.xaml.cs │ │ │ ├── FeaturedStickerSetControl.xaml │ │ │ ├── FeaturedStickerSetControl.xaml.cs │ │ │ ├── MainTitleControl.xaml │ │ │ ├── MainTitleControl.xaml.cs │ │ │ ├── MessagePlayerControl.xaml │ │ │ ├── MessagePlayerControl.xaml.cs │ │ │ ├── MessageStatusControl.xaml │ │ │ ├── MessageStatusControl.xaml.cs │ │ │ ├── PieSlice.cs │ │ │ ├── SecretPhotoPlaceholder.xaml │ │ │ ├── SecretPhotoPlaceholder.xaml.cs │ │ │ ├── StickerSetControl.xaml │ │ │ ├── StickerSetControl.xaml.cs │ │ │ ├── UnreadCounter.xaml │ │ │ ├── UnreadCounter.xaml.cs │ │ │ ├── UserTileControl.xaml │ │ │ └── UserTileControl.xaml.cs │ │ ├── Debug/ │ │ │ ├── DebugView.xaml │ │ │ ├── DebugView.xaml.cs │ │ │ ├── LongPollView.xaml │ │ │ ├── LongPollView.xaml.cs │ │ │ ├── PerformanceView.xaml │ │ │ └── PerformanceView.xaml.cs │ │ ├── DialogDetailsView.xaml │ │ ├── DialogDetailsView.xaml.cs │ │ ├── Dialogs/ │ │ │ ├── ChooseDialogView.xaml │ │ │ ├── ChooseDialogView.xaml.cs │ │ │ ├── ChooseParticipantsView.xaml │ │ │ ├── ChooseParticipantsView.xaml.cs │ │ │ ├── CommandHintsView.xaml │ │ │ ├── CommandHintsView.xaml.cs │ │ │ ├── CommandsControl.xaml │ │ │ ├── CommandsControl.xaml.cs │ │ │ ├── CreateBroadcastView.xaml │ │ │ ├── CreateBroadcastView.xaml.cs │ │ │ ├── CreateChannelStep1View.xaml │ │ │ ├── CreateChannelStep1View.xaml.cs │ │ │ ├── CreateChannelStep2View.xaml │ │ │ ├── CreateChannelStep2View.xaml.cs │ │ │ ├── CreateChannelStep3View.xaml │ │ │ ├── CreateChannelStep3View.xaml.cs │ │ │ ├── CreateChannelView.xaml │ │ │ ├── CreateChannelView.xaml.cs │ │ │ ├── CreateDialogView.xaml │ │ │ ├── CreateDialogView.xaml.cs │ │ │ ├── DialogDetailsView.xaml │ │ │ ├── DialogDetailsView.xaml.cs │ │ │ ├── DialogSearchMessagesView.xaml │ │ │ ├── DialogSearchMessagesView.xaml.cs │ │ │ ├── DialogsView.xaml │ │ │ ├── DialogsView.xaml.cs │ │ │ ├── EmojiKeyboard.xaml │ │ │ ├── EmojiKeyboard.xaml.cs │ │ │ ├── EmojiKeyboardControl.xaml │ │ │ ├── EmojiKeyboardControl.xaml.cs │ │ │ ├── FastDialogDetailsView.xaml │ │ │ ├── FastDialogDetailsView.xaml.cs │ │ │ ├── HashtagHintsView.xaml │ │ │ ├── HashtagHintsView.xaml.cs │ │ │ ├── InlineBotResultsView.xaml │ │ │ ├── InlineBotResultsView.xaml.cs │ │ │ ├── MessageViewerView.xaml │ │ │ ├── MessageViewerView.xaml.cs │ │ │ ├── PinnedMessageView.xaml │ │ │ ├── PinnedMessageView.xaml.cs │ │ │ ├── SecretChatDebugView.xaml │ │ │ ├── SecretChatDebugView.xaml.cs │ │ │ ├── SecretDialogDetailsView.xaml │ │ │ ├── SecretDialogDetailsView.xaml.cs │ │ │ ├── StickerHintsView.xaml │ │ │ ├── StickerHintsView.xaml.cs │ │ │ ├── StickerPreviewMenu.xaml │ │ │ ├── StickerPreviewMenu.xaml.cs │ │ │ ├── UserActionView.xaml │ │ │ ├── UserActionView.xaml.cs │ │ │ ├── UsernameHintsView.xaml │ │ │ └── UsernameHintsView.xaml.cs │ │ ├── Media/ │ │ │ ├── AnimatedImageViewerView.xaml │ │ │ ├── AnimatedImageViewerView.xaml.cs │ │ │ ├── DecryptedImageViewerView.xaml │ │ │ ├── DecryptedImageViewerView.xaml.cs │ │ │ ├── FilesView.xaml │ │ │ ├── FilesView.xaml.cs │ │ │ ├── FullMediaView.xaml │ │ │ ├── FullMediaView.xaml.cs │ │ │ ├── ImageEditorView.xaml │ │ │ ├── ImageEditorView.xaml.cs │ │ │ ├── ImageViewerView.xaml │ │ │ ├── ImageViewerView.xaml.cs │ │ │ ├── LinksView.xaml │ │ │ ├── LinksView.xaml.cs │ │ │ ├── MapTileSources/ │ │ │ │ ├── GoogleMapsTileSource.cs │ │ │ │ ├── OpenAeralMapTileSource.cs │ │ │ │ └── OpenStreetMapTileSource.cs │ │ │ ├── MapView.xaml │ │ │ ├── MapView.xaml.cs │ │ │ ├── MediaView.xaml │ │ │ ├── MediaView.xaml.cs │ │ │ ├── MusicView.xaml │ │ │ ├── MusicView.xaml.cs │ │ │ ├── ProfilePhotoViewerView.xaml │ │ │ ├── ProfilePhotoViewerView.xaml.cs │ │ │ ├── SecretMediaView.xaml │ │ │ ├── SecretMediaView.xaml.cs │ │ │ ├── VideoCaptureView.xaml │ │ │ ├── VideoCaptureView.xaml.cs │ │ │ ├── VideoPlayerView.xaml │ │ │ └── VideoPlayerView.xaml.cs │ │ ├── Search/ │ │ │ ├── SearchContactsView.xaml │ │ │ ├── SearchContactsView.xaml.cs │ │ │ ├── SearchDialogsView.xaml │ │ │ ├── SearchDialogsView.xaml.cs │ │ │ ├── SearchFilesView.xaml │ │ │ ├── SearchFilesView.xaml.cs │ │ │ ├── SearchLinksView.xaml │ │ │ ├── SearchLinksView.xaml.cs │ │ │ ├── SearchMessagesView.xaml │ │ │ ├── SearchMessagesView.xaml.cs │ │ │ ├── SearchMusicView.xaml │ │ │ ├── SearchMusicView.xaml.cs │ │ │ ├── SearchShellView.xaml │ │ │ ├── SearchShellView.xaml.cs │ │ │ ├── SearchVenuesView.xaml │ │ │ ├── SearchVenuesView.xaml.cs │ │ │ ├── SearchView.xaml │ │ │ └── SearchView.xaml.cs │ │ ├── ShellView.xaml │ │ ├── ShellView.xaml.cs │ │ └── TelegramViewBase.cs │ └── packages.config ├── TelegramClient.Native/ │ ├── ConnectionSocket.cpp │ ├── ConnectionSocket.h │ ├── EmojiSuggestion.cpp │ ├── EmojiSuggestion.h │ ├── TelegramClient.Native.vcxproj │ ├── TelegramClient.Native.vcxproj.filters │ ├── emoji_suggestions.cpp │ ├── emoji_suggestions.h │ ├── emoji_suggestions_data.cpp │ ├── emoji_suggestions_data.h │ ├── pch.cpp │ └── pch.h ├── TelegramClient.Opus/ │ ├── COpusCodec.cpp │ ├── COpusCodec.h │ ├── TelegramClient.Opus.cpp │ ├── TelegramClient.Opus.h │ ├── TelegramClient.Opus.vcxproj │ ├── TelegramClient.Opus.vcxproj.filters │ ├── audio.c │ ├── opus/ │ │ ├── celt/ │ │ │ ├── _kiss_fft_guts.h │ │ │ ├── arch.h │ │ │ ├── arm/ │ │ │ │ ├── arm_celt_map.c │ │ │ │ ├── armcpu.c │ │ │ │ ├── armcpu.h │ │ │ │ ├── fixed_armv4.h │ │ │ │ ├── fixed_armv5e.h │ │ │ │ ├── kiss_fft_armv4.h │ │ │ │ ├── kiss_fft_armv5e.h │ │ │ │ └── pitch_arm.h │ │ │ ├── bands.c │ │ │ ├── bands.h │ │ │ ├── celt.c │ │ │ ├── celt.h │ │ │ ├── celt_decoder.c │ │ │ ├── celt_encoder.c │ │ │ ├── celt_lpc.c │ │ │ ├── celt_lpc.h │ │ │ ├── cpu_support.h │ │ │ ├── cwrs.c │ │ │ ├── cwrs.h │ │ │ ├── ecintrin.h │ │ │ ├── entcode.c │ │ │ ├── entcode.h │ │ │ ├── entdec.c │ │ │ ├── entdec.h │ │ │ ├── entenc.c │ │ │ ├── entenc.h │ │ │ ├── fixed_debug.h │ │ │ ├── fixed_generic.h │ │ │ ├── float_cast.h │ │ │ ├── kiss_fft.c │ │ │ ├── kiss_fft.h │ │ │ ├── laplace.c │ │ │ ├── laplace.h │ │ │ ├── mathops.c │ │ │ ├── mathops.h │ │ │ ├── mdct.c │ │ │ ├── mdct.h │ │ │ ├── mfrngcod.h │ │ │ ├── modes.c │ │ │ ├── modes.h │ │ │ ├── os_support.h │ │ │ ├── pitch.c │ │ │ ├── pitch.h │ │ │ ├── quant_bands.c │ │ │ ├── quant_bands.h │ │ │ ├── rate.c │ │ │ ├── rate.h │ │ │ ├── stack_alloc.h │ │ │ ├── static_modes_fixed.h │ │ │ ├── static_modes_float.h │ │ │ ├── vq.c │ │ │ ├── vq.h │ │ │ └── x86/ │ │ │ └── pitch_sse.h │ │ ├── include/ │ │ │ ├── opus.h │ │ │ ├── opus_custom.h │ │ │ ├── opus_defines.h │ │ │ ├── opus_multistream.h │ │ │ └── opus_types.h │ │ ├── ogg/ │ │ │ ├── bitwise.c │ │ │ ├── framing.c │ │ │ ├── ogg.h │ │ │ └── os_types.h │ │ ├── opusfile/ │ │ │ ├── info.c │ │ │ ├── internal.c │ │ │ ├── internal.h │ │ │ ├── opusfile.c │ │ │ ├── opusfile.h │ │ │ └── stream.c │ │ ├── silk/ │ │ │ ├── A2NLSF.c │ │ │ ├── API.h │ │ │ ├── CNG.c │ │ │ ├── HP_variable_cutoff.c │ │ │ ├── Inlines.h │ │ │ ├── LPC_analysis_filter.c │ │ │ ├── LPC_inv_pred_gain.c │ │ │ ├── LP_variable_cutoff.c │ │ │ ├── MacroCount.h │ │ │ ├── MacroDebug.h │ │ │ ├── NLSF2A.c │ │ │ ├── NLSF_VQ.c │ │ │ ├── NLSF_VQ_weights_laroia.c │ │ │ ├── NLSF_decode.c │ │ │ ├── NLSF_del_dec_quant.c │ │ │ ├── NLSF_encode.c │ │ │ ├── NLSF_stabilize.c │ │ │ ├── NLSF_unpack.c │ │ │ ├── NSQ.c │ │ │ ├── NSQ_del_dec.c │ │ │ ├── PLC.c │ │ │ ├── PLC.h │ │ │ ├── SigProc_FIX.h │ │ │ ├── VAD.c │ │ │ ├── VQ_WMat_EC.c │ │ │ ├── ana_filt_bank_1.c │ │ │ ├── arm/ │ │ │ │ ├── SigProc_FIX_armv4.h │ │ │ │ ├── SigProc_FIX_armv5e.h │ │ │ │ ├── macros_armv4.h │ │ │ │ └── macros_armv5e.h │ │ │ ├── biquad_alt.c │ │ │ ├── bwexpander.c │ │ │ ├── bwexpander_32.c │ │ │ ├── check_control_input.c │ │ │ ├── code_signs.c │ │ │ ├── control.h │ │ │ ├── control_SNR.c │ │ │ ├── control_audio_bandwidth.c │ │ │ ├── control_codec.c │ │ │ ├── debug.c │ │ │ ├── debug.h │ │ │ ├── dec_API.c │ │ │ ├── decode_core.c │ │ │ ├── decode_frame.c │ │ │ ├── decode_indices.c │ │ │ ├── decode_parameters.c │ │ │ ├── decode_pitch.c │ │ │ ├── decode_pulses.c │ │ │ ├── decoder_set_fs.c │ │ │ ├── define.h │ │ │ ├── enc_API.c │ │ │ ├── encode_indices.c │ │ │ ├── encode_pulses.c │ │ │ ├── errors.h │ │ │ ├── fixed/ │ │ │ │ ├── LTP_analysis_filter_FIX.c │ │ │ │ ├── LTP_scale_ctrl_FIX.c │ │ │ │ ├── apply_sine_window_FIX.c │ │ │ │ ├── autocorr_FIX.c │ │ │ │ ├── burg_modified_FIX.c │ │ │ │ ├── corrMatrix_FIX.c │ │ │ │ ├── encode_frame_FIX.c │ │ │ │ ├── find_LPC_FIX.c │ │ │ │ ├── find_LTP_FIX.c │ │ │ │ ├── find_pitch_lags_FIX.c │ │ │ │ ├── find_pred_coefs_FIX.c │ │ │ │ ├── k2a_FIX.c │ │ │ │ ├── k2a_Q16_FIX.c │ │ │ │ ├── main_FIX.h │ │ │ │ ├── noise_shape_analysis_FIX.c │ │ │ │ ├── pitch_analysis_core_FIX.c │ │ │ │ ├── prefilter_FIX.c │ │ │ │ ├── process_gains_FIX.c │ │ │ │ ├── regularize_correlations_FIX.c │ │ │ │ ├── residual_energy16_FIX.c │ │ │ │ ├── residual_energy_FIX.c │ │ │ │ ├── schur64_FIX.c │ │ │ │ ├── schur_FIX.c │ │ │ │ ├── solve_LS_FIX.c │ │ │ │ ├── structs_FIX.h │ │ │ │ ├── vector_ops_FIX.c │ │ │ │ └── warped_autocorrelation_FIX.c │ │ │ ├── gain_quant.c │ │ │ ├── init_decoder.c │ │ │ ├── init_encoder.c │ │ │ ├── inner_prod_aligned.c │ │ │ ├── interpolate.c │ │ │ ├── lin2log.c │ │ │ ├── log2lin.c │ │ │ ├── macros.h │ │ │ ├── main.h │ │ │ ├── pitch_est_defines.h │ │ │ ├── pitch_est_tables.c │ │ │ ├── process_NLSFs.c │ │ │ ├── quant_LTP_gains.c │ │ │ ├── resampler.c │ │ │ ├── resampler_down2.c │ │ │ ├── resampler_down2_3.c │ │ │ ├── resampler_private.h │ │ │ ├── resampler_private_AR2.c │ │ │ ├── resampler_private_IIR_FIR.c │ │ │ ├── resampler_private_down_FIR.c │ │ │ ├── resampler_private_up2_HQ.c │ │ │ ├── resampler_rom.c │ │ │ ├── resampler_rom.h │ │ │ ├── resampler_structs.h │ │ │ ├── shell_coder.c │ │ │ ├── sigm_Q15.c │ │ │ ├── sort.c │ │ │ ├── stereo_LR_to_MS.c │ │ │ ├── stereo_MS_to_LR.c │ │ │ ├── stereo_decode_pred.c │ │ │ ├── stereo_encode_pred.c │ │ │ ├── stereo_find_predictor.c │ │ │ ├── stereo_quant_pred.c │ │ │ ├── structs.h │ │ │ ├── sum_sqr_shift.c │ │ │ ├── table_LSF_cos.c │ │ │ ├── tables.h │ │ │ ├── tables_LTP.c │ │ │ ├── tables_NLSF_CB_NB_MB.c │ │ │ ├── tables_NLSF_CB_WB.c │ │ │ ├── tables_gain.c │ │ │ ├── tables_other.c │ │ │ ├── tables_pitch_lag.c │ │ │ ├── tables_pulses_per_block.c │ │ │ ├── tuning_parameters.h │ │ │ └── typedef.h │ │ └── src/ │ │ ├── analysis.c │ │ ├── analysis.h │ │ ├── mlp.c │ │ ├── mlp.h │ │ ├── mlp_data.c │ │ ├── opus.c │ │ ├── opus_decoder.c │ │ ├── opus_encoder.c │ │ ├── opus_multistream.c │ │ ├── opus_multistream_decoder.c │ │ ├── opus_multistream_encoder.c │ │ ├── opus_private.h │ │ ├── repacketizer.c │ │ ├── repacketizer_demo.c │ │ └── tansig_table.h │ ├── pch.cpp │ └── pch.h ├── TelegramClient.Player/ │ ├── AudioPlayer.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ └── TelegramClient.Player.csproj ├── TelegramClient.Player.WP8/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ └── TelegramClient.Player.WP8.csproj ├── TelegramClient.ScheduledTaskAgent/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── ScheduledAgent.cs │ └── TelegramClient.ScheduledTaskAgent.csproj ├── TelegramClient.ScheduledTaskAgent.WP8/ │ ├── Properties/ │ │ └── AssemblyInfo.cs │ └── TelegramClient.ScheduledTaskAgent.WP8.csproj ├── TelegramClient.Tasks/ │ ├── BackgroundDifferenceLoader.cs │ ├── InteractiveNotificationsBackgroundTask.cs │ ├── MessageSchedulerBackgroundTask.cs │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── PushNotificationsBackgroundTask.cs │ ├── PushUtils.cs │ ├── Resources/ │ │ ├── de/ │ │ │ └── Resources.resw │ │ ├── en/ │ │ │ └── Resources.resw │ │ ├── es/ │ │ │ └── Resources.resw │ │ ├── it/ │ │ │ └── Resources.resw │ │ ├── nl/ │ │ │ └── Resources.resw │ │ ├── pt/ │ │ │ └── Resources.resw │ │ └── ru/ │ │ └── Resources.resw │ └── TelegramClient.Tasks.csproj ├── TelegramClient.WP8/ │ ├── Behaviors/ │ │ └── InfiniteScrollingBehavior.cs │ ├── Controls/ │ │ └── StartView/ │ │ ├── DragEventArgs.cs │ │ ├── FlickEventArgs.cs │ │ ├── GestureEventArgs.cs │ │ ├── GestureHelper.cs │ │ ├── InputBaseArgs.cs │ │ ├── InputCompletedArgs.cs │ │ ├── InputDeltaArgs.cs │ │ ├── ManipulationGestureHelper.cs │ │ ├── SafeRaise.cs │ │ ├── StartView.cs │ │ ├── StartViewItem.cs │ │ ├── StartViewPanel.cs │ │ └── TransformAnimator.cs │ ├── LongListSelectorEx.cs │ ├── Properties/ │ │ ├── AppManifest.xml │ │ ├── AssemblyInfo.cs │ │ ├── WMAppManifest.Private.xml │ │ ├── WMAppManifest.Public.xml │ │ └── WMAppManifest.xml │ ├── TelegramClient.WP8.csproj │ ├── Themes/ │ │ ├── Default/ │ │ │ ├── LongListSelector.xaml │ │ │ └── ToggleSwitch.xaml │ │ └── Generic.xaml │ ├── ViewModels/ │ │ ├── Contacts/ │ │ │ └── ContactsViewModel.cs │ │ ├── Dialogs/ │ │ │ ├── DialogDetailsViewModel.Audio.cs │ │ │ ├── DialogsViewModel.cs │ │ │ └── SecretDialogDetailsViewModel.Audio.cs │ │ └── Media/ │ │ └── MultiImageEditorViewModel.cs │ ├── Views/ │ │ ├── Additional/ │ │ │ ├── StartupView.xaml │ │ │ └── StartupView.xaml.cs │ │ ├── Contacts/ │ │ │ ├── ContactsView.xaml │ │ │ └── ContactsView.xaml.cs │ │ ├── Controls/ │ │ │ ├── AudioRecorderControl.xaml │ │ │ └── AudioRecorderControl.xaml.cs │ │ ├── Dialogs/ │ │ │ ├── DialogDetailsView.xaml │ │ │ ├── DialogDetailsView.xaml.cs │ │ │ ├── DialogsView.xaml │ │ │ ├── DialogsView.xaml.cs │ │ │ ├── SecretDialogDetailsView.xaml │ │ │ └── SecretDialogDetailsView.xaml.cs │ │ └── Media/ │ │ ├── FilesView.xaml │ │ ├── FilesView.xaml.cs │ │ ├── LinksView.xaml │ │ ├── LinksView.xaml.cs │ │ ├── MediaView.xaml │ │ ├── MediaView.xaml.cs │ │ ├── MultiImageEditorView.xaml │ │ └── MultiImageEditorView.xaml.cs │ ├── app.config │ └── packages.config ├── TelegramClient.WP81/ │ ├── BackgroundProcess.cs │ ├── Behaviors/ │ │ ├── FocusNextElementOnEnterBehavior.cs │ │ └── InfiniteScrollingBehavior.cs │ ├── BugsenseWrapper.cs │ ├── Controls/ │ │ ├── GestureListener/ │ │ │ ├── GestureHelperEventArgs.cs │ │ │ ├── GestureListener.cs │ │ │ ├── GestureListenerStatic.cs │ │ │ ├── GestureService.cs │ │ │ ├── MathHelpers.cs │ │ │ └── SafeRaise.cs │ │ └── StartView/ │ │ ├── DragEventArgs.cs │ │ ├── FlickEventArgs.cs │ │ ├── GestureEventArgs.cs │ │ ├── GestureHelper.cs │ │ ├── InputBaseArgs.cs │ │ ├── InputCompletedArgs.cs │ │ ├── InputDeltaArgs.cs │ │ ├── ManipulationGestureHelper.cs │ │ ├── SafeRaise.cs │ │ ├── StartView.cs │ │ ├── StartViewItem.cs │ │ ├── StartViewPanel.cs │ │ └── TransformAnimator.cs │ ├── Converters/ │ │ ├── ChannelParticipantsCountConverter.cs │ │ ├── SecureFilePreviewConverter.cs │ │ ├── ShippingOptionToStringConverter.cs │ │ └── TTLMediaToVisibilityConverter.cs │ ├── FFMpegBuild.txt │ ├── Helpers/ │ │ ├── TemplateSelectors/ │ │ │ └── ImageViewerTemplateSelector.cs │ │ └── WeakEventListener.cs │ ├── Package.appxmanifest │ ├── Properties/ │ │ ├── AppManifest.xml │ │ ├── AssemblyInfo.cs │ │ ├── WMAppManifest.Private.xml │ │ ├── WMAppManifest.Public.xml │ │ └── WMAppManifest.xml │ ├── PushNotificationsBackgroundTask.cs │ ├── Services/ │ │ ├── Cache.cs │ │ ├── IProxyChecker.cs │ │ ├── IVoIPService.cs │ │ ├── IWindowsPhoneStoreUpdateService.cs │ │ ├── ProxyChecker.cs │ │ ├── VoIPService.cs │ │ ├── WNSPushService.cs │ │ └── WindowsPhoneStoreUpdateService.cs │ ├── TelegramClient.WP81.csproj │ ├── Themes/ │ │ ├── Default/ │ │ │ ├── ToggleSwitch.xaml │ │ │ ├── W10M.xaml │ │ │ └── W10MCommon.xaml │ │ └── SharedResourceDictionary.cs │ ├── Utils/ │ │ ├── Passport.cs │ │ ├── Password.cs │ │ └── SRP.cs │ ├── ViewModels/ │ │ ├── Additional/ │ │ │ ├── BioViewModel.cs │ │ │ ├── CallsPrivacyViewModel.cs │ │ │ ├── CallsSecurityViewModel.cs │ │ │ ├── CameraViewModel.cs │ │ │ ├── ChooseGeoLivePeriodViewModel.cs │ │ │ ├── ChooseVideoQualityViewModel.cs │ │ │ ├── ContactsSecurityViewModel.cs │ │ │ ├── LoggedInViewModel.cs │ │ │ ├── PassportSettingsViewModel.cs │ │ │ ├── PhotoPickerViewModel.cs │ │ │ ├── ProxyListViewModel.cs │ │ │ └── ProxyViewModel.cs │ │ ├── Calls/ │ │ │ ├── CallViewModel.cs │ │ │ └── CallsViewModel.cs │ │ ├── Chats/ │ │ │ └── GroupStickersViewModel.cs │ │ ├── Contacts/ │ │ │ └── ShareContactDetailsViewModel.cs │ │ ├── Dialogs/ │ │ │ ├── DialogDetailsViewModel.Mentions.cs │ │ │ ├── EmojiHintsViewModel.cs │ │ │ ├── LiveLocationBadgeViewModel.cs │ │ │ └── PlayerViewModel.cs │ │ ├── Feed/ │ │ │ └── FeedViewModel.cs │ │ ├── Media/ │ │ │ └── EditVideoViewModel.cs │ │ ├── Passport/ │ │ │ ├── EmailCodeViewModel.cs │ │ │ ├── EmailViewModel.cs │ │ │ ├── EnterPasswordViewModel.cs │ │ │ ├── PassportViewModel.cs │ │ │ ├── PasswordIntroViewModel.cs │ │ │ ├── PersonalDetailsViewModel.cs │ │ │ ├── PhoneNumberCodeViewModel.cs │ │ │ ├── PhoneNumberViewModel.cs │ │ │ └── ResidentialAddressViewModel.cs │ │ ├── Payments/ │ │ │ ├── CardInfoViewModel.cs │ │ │ ├── CheckoutViewModel.cs │ │ │ ├── PasswordEmailViewModel.cs │ │ │ ├── PaymentInfo.cs │ │ │ ├── PaymentViewModelBase.cs │ │ │ ├── ReceiptViewModel.cs │ │ │ ├── SavedCardInfoViewModel.cs │ │ │ ├── ShippingInfoViewModel.cs │ │ │ ├── ShippingMethodViewModel.cs │ │ │ ├── Stripe/ │ │ │ │ ├── Card.cs │ │ │ │ ├── CardUtils.cs │ │ │ │ ├── DateUtils.cs │ │ │ │ ├── JSON/ │ │ │ │ │ └── Response.cs │ │ │ │ ├── StripeClient.cs │ │ │ │ ├── StripeNetworkUtils.cs │ │ │ │ ├── StripeTextUtils.cs │ │ │ │ └── StripeToken.cs │ │ │ ├── WebCardInfoViewModel.cs │ │ │ └── WebVerificationViewModel.cs │ │ └── Search/ │ │ └── SearchSharedContactsViewModel.cs │ ├── Views/ │ │ ├── Additional/ │ │ │ ├── BioView.xaml │ │ │ ├── BioView.xaml.cs │ │ │ ├── CallsPrivacyView.xaml │ │ │ ├── CallsPrivacyView.xaml.cs │ │ │ ├── CallsSecurityView.xaml │ │ │ ├── CallsSecurityView.xaml.cs │ │ │ ├── CameraView.xaml │ │ │ ├── CameraView.xaml.cs │ │ │ ├── ChooseGeoLivePeriodView.xaml │ │ │ ├── ChooseGeoLivePeriodView.xaml.cs │ │ │ ├── ChooseVideoQualityView.xaml │ │ │ ├── ChooseVideoQualityView.xaml.cs │ │ │ ├── ContactsSecurityView.xaml │ │ │ ├── ContactsSecurityView.xaml.cs │ │ │ ├── GifPlayerControl.xaml │ │ │ ├── GifPlayerControl.xaml.cs │ │ │ ├── LoggedInView.xaml │ │ │ ├── LoggedInView.xaml.cs │ │ │ ├── PassportSettingsView.xaml │ │ │ ├── PassportSettingsView.xaml.cs │ │ │ ├── PhotoPickerView.xaml │ │ │ ├── PhotoPickerView.xaml.cs │ │ │ ├── ProxyListView.xaml │ │ │ ├── ProxyListView.xaml.cs │ │ │ ├── ProxyView.xaml │ │ │ ├── ProxyView.xaml.cs │ │ │ ├── StartupView.xaml │ │ │ └── StartupView.xaml.cs │ │ ├── Calls/ │ │ │ ├── CallDebugControl.xaml │ │ │ ├── CallDebugControl.xaml.cs │ │ │ ├── CallRatingControl.xaml │ │ │ ├── CallRatingControl.xaml.cs │ │ │ ├── CallView.xaml │ │ │ ├── CallView.xaml.cs │ │ │ ├── CallsView.xaml │ │ │ ├── CallsView.xaml.cs │ │ │ ├── ReturnToCallControl.xaml │ │ │ ├── ReturnToCallControl.xaml.cs │ │ │ ├── SignalBarsControl.xaml │ │ │ └── SignalBarsControl.xaml.cs │ │ ├── Chats/ │ │ │ ├── GroupStickersView.xaml │ │ │ └── GroupStickersView.xaml.cs │ │ ├── Contacts/ │ │ │ ├── ShareContactDetailsView.xaml │ │ │ └── ShareContactDetailsView.xaml.cs │ │ ├── Controls/ │ │ │ ├── CameraControl.xaml │ │ │ ├── CameraControl.xaml.cs │ │ │ ├── CardTextBox.cs │ │ │ ├── CropControl.xaml │ │ │ ├── CropControl.xaml.cs │ │ │ ├── DateTextBox.cs │ │ │ ├── DecryptedMessageControl.xaml │ │ │ ├── DecryptedMessageControl.xaml.cs │ │ │ ├── DialogControl.xaml │ │ │ ├── DialogControl.xaml.cs │ │ │ ├── GroupedMessageControl.xaml │ │ │ ├── GroupedMessageControl.xaml.cs │ │ │ ├── GroupedMessages.cs │ │ │ ├── InputBox.xaml │ │ │ ├── InputBox.xaml.cs │ │ │ ├── LabeledPasswordBox.xaml │ │ │ ├── LabeledPasswordBox.xaml.cs │ │ │ ├── LabeledTextBox.xaml │ │ │ ├── LabeledTextBox.xaml.cs │ │ │ ├── LiveLocationIcon.xaml │ │ │ ├── LiveLocationIcon.xaml.cs │ │ │ ├── LiveLocationProgress.xaml │ │ │ ├── LiveLocationProgress.xaml.cs │ │ │ ├── LiveLocationsControl.xaml │ │ │ ├── LiveLocationsControl.xaml.cs │ │ │ ├── MediaPhotoControl.xaml │ │ │ ├── MediaPhotoControl.xaml.cs │ │ │ ├── MediaVideoControl.xaml │ │ │ ├── MediaVideoControl.xaml.cs │ │ │ ├── MessageControl.xaml │ │ │ ├── MessageControl.xaml.cs │ │ │ ├── OpacityMaskBorder.xaml │ │ │ ├── OpacityMaskBorder.xaml.cs │ │ │ ├── OpenPhotoPicker.xaml │ │ │ ├── OpenPhotoPicker.xaml.cs │ │ │ ├── PhotoControl.xaml │ │ │ ├── PhotoControl.xaml.cs │ │ │ ├── Progress.xaml │ │ │ ├── Progress.xaml.cs │ │ │ ├── ProxyStatusControl.xaml │ │ │ ├── ProxyStatusControl.xaml.cs │ │ │ ├── RecordingControl.xaml │ │ │ ├── RecordingControl.xaml.cs │ │ │ ├── RibbonControl.xaml │ │ │ ├── RibbonControl.xaml.cs │ │ │ ├── RibbonImageControl.xaml │ │ │ ├── RibbonImageControl.xaml.cs │ │ │ ├── SelectionControl.xaml │ │ │ ├── SelectionControl.xaml.cs │ │ │ ├── ShareMessagePicker.xaml │ │ │ ├── ShareMessagePicker.xaml.cs │ │ │ ├── StatusControl.xaml │ │ │ ├── StatusControl.xaml.cs │ │ │ ├── TelegramAppBarButton.xaml │ │ │ ├── TelegramAppBarButton.xaml.cs │ │ │ ├── TelegramApplicationBar.xaml │ │ │ ├── TelegramApplicationBar.xaml.cs │ │ │ ├── TelegramDatePickerPage.xaml │ │ │ ├── TelegramDatePickerPage.xaml.cs │ │ │ ├── TelegramPopup.cs │ │ │ ├── TextingControl.xaml │ │ │ ├── TextingControl.xaml.cs │ │ │ ├── TypingControl.xaml │ │ │ ├── TypingControl.xaml.cs │ │ │ ├── UpdateAppControl.xaml │ │ │ ├── UpdateAppControl.xaml.cs │ │ │ ├── UploadingControl.xaml │ │ │ ├── UploadingControl.xaml.cs │ │ │ ├── VideoTimelineControl.xaml │ │ │ ├── VideoTimelineControl.xaml.cs │ │ │ └── WaveformSlider.cs │ │ ├── Dialogs/ │ │ │ ├── DocumentTileControl.xaml │ │ │ ├── DocumentTileControl.xaml.cs │ │ │ ├── EmojiHintsView.xaml │ │ │ ├── EmojiHintsView.xaml.cs │ │ │ ├── LiveLocationBadgeView.xaml │ │ │ ├── LiveLocationBadgeView.xaml.cs │ │ │ ├── PhotoTileControl.xaml │ │ │ ├── PhotoTileControl.xaml.cs │ │ │ ├── PlayerView.xaml │ │ │ ├── PlayerView.xaml.cs │ │ │ ├── SearchUserControl.xaml │ │ │ ├── SearchUserControl.xaml.cs │ │ │ ├── UnreadCounter.xaml │ │ │ └── UnreadCounter.xaml.cs │ │ ├── Feed/ │ │ │ ├── FeedView.xaml │ │ │ └── FeedView.xaml.cs │ │ ├── MainPage.xaml │ │ ├── MainPage.xaml.cs │ │ ├── Media/ │ │ │ ├── ColorPicker.xaml │ │ │ ├── ColorPicker.xaml.cs │ │ │ ├── EditVideoView.xaml │ │ │ ├── EditVideoView.xaml.cs │ │ │ ├── ExtendedImageEditor.xaml │ │ │ ├── ExtendedImageEditor.xaml.cs │ │ │ ├── MapUserTileControl.xaml │ │ │ ├── MapUserTileControl.xaml.cs │ │ │ ├── PhotoFace.cs │ │ │ ├── StaticMapControl.xaml │ │ │ ├── StaticMapControl.xaml.cs │ │ │ ├── Sticker.xaml │ │ │ ├── Sticker.xaml.cs │ │ │ ├── StickerPosition.cs │ │ │ ├── StickersControl.xaml │ │ │ ├── StickersControl.xaml.cs │ │ │ ├── TextLabel.xaml │ │ │ └── TextLabel.xaml.cs │ │ ├── Passport/ │ │ │ ├── EmailCodeView.xaml │ │ │ ├── EmailCodeView.xaml.cs │ │ │ ├── EmailView.xaml │ │ │ ├── EmailView.xaml.cs │ │ │ ├── EnterPasswordView.xaml │ │ │ ├── EnterPasswordView.xaml.cs │ │ │ ├── PassportView.xaml │ │ │ ├── PassportView.xaml.cs │ │ │ ├── PasswordIntroView.xaml │ │ │ ├── PasswordIntroView.xaml.cs │ │ │ ├── PersonalDetailsView.xaml │ │ │ ├── PersonalDetailsView.xaml.cs │ │ │ ├── PhoneNumberCodeView.xaml │ │ │ ├── PhoneNumberCodeView.xaml.cs │ │ │ ├── PhoneNumberView.xaml │ │ │ ├── PhoneNumberView.xaml.cs │ │ │ ├── ResidentialAddressView.xaml │ │ │ └── ResidentialAddressView.xaml.cs │ │ ├── Payments/ │ │ │ ├── CardInfoView.xaml │ │ │ ├── CardInfoView.xaml.cs │ │ │ ├── CheckoutView.xaml │ │ │ ├── CheckoutView.xaml.cs │ │ │ ├── PasswordEmailView.xaml │ │ │ ├── PasswordEmailView.xaml.cs │ │ │ ├── SavedCardInfoView.xaml │ │ │ ├── SavedCardInfoView.xaml.cs │ │ │ ├── ShippingInfoView.xaml │ │ │ ├── ShippingInfoView.xaml.cs │ │ │ ├── ShippingMethodView.xaml │ │ │ ├── ShippingMethodView.xaml.cs │ │ │ ├── WebCardInfoView.xaml │ │ │ ├── WebCardInfoView.xaml.cs │ │ │ ├── WebVerificationView.xaml │ │ │ └── WebVerificationView.xaml.cs │ │ └── Search/ │ │ ├── SearchSharedContactsView.xaml │ │ └── SearchSharedContactsView.xaml.cs │ ├── app.config │ └── packages.config ├── TelegramClient.WP81.sln ├── TelegramClient.WebP/ │ ├── ImageUtils.cpp │ ├── ImageUtils.h │ ├── TelegramClient.WebP.cpp │ ├── TelegramClient.WebP.h │ ├── TelegramClient.WebP.vcxproj │ ├── TelegramClient.WebP.vcxproj.filters │ ├── pch.cpp │ └── pch.h ├── TelegramClient.sln ├── VoipBackendServerHost/ │ ├── Package.appxmanifest │ ├── VoipBackendServerHost.vcxproj │ ├── VoipBackendServerHost.vcxproj.filters │ ├── app.cpp │ ├── app.h │ ├── pch.cpp │ └── pch.h ├── ffmpeg/ │ └── Build/ │ └── WindowsPhone8.1/ │ ├── ARM/ │ │ ├── bin/ │ │ │ ├── avcodec.lib │ │ │ ├── avdevice.lib │ │ │ ├── avfilter.lib │ │ │ ├── avformat.lib │ │ │ ├── avutil.lib │ │ │ ├── swresample.lib │ │ │ └── swscale.lib │ │ ├── include/ │ │ │ ├── libavcodec/ │ │ │ │ ├── avcodec.h │ │ │ │ ├── avdct.h │ │ │ │ ├── avfft.h │ │ │ │ ├── d3d11va.h │ │ │ │ ├── dirac.h │ │ │ │ ├── dv_profile.h │ │ │ │ ├── dxva2.h │ │ │ │ ├── qsv.h │ │ │ │ ├── vaapi.h │ │ │ │ ├── vda.h │ │ │ │ ├── vdpau.h │ │ │ │ ├── version.h │ │ │ │ ├── videotoolbox.h │ │ │ │ ├── vorbis_parser.h │ │ │ │ └── xvmc.h │ │ │ ├── libavdevice/ │ │ │ │ ├── avdevice.h │ │ │ │ └── version.h │ │ │ ├── libavfilter/ │ │ │ │ ├── avfilter.h │ │ │ │ ├── avfiltergraph.h │ │ │ │ ├── buffersink.h │ │ │ │ ├── buffersrc.h │ │ │ │ └── version.h │ │ │ ├── libavformat/ │ │ │ │ ├── avformat.h │ │ │ │ ├── avio.h │ │ │ │ └── version.h │ │ │ ├── libavutil/ │ │ │ │ ├── adler32.h │ │ │ │ ├── aes.h │ │ │ │ ├── aes_ctr.h │ │ │ │ ├── attributes.h │ │ │ │ ├── audio_fifo.h │ │ │ │ ├── avassert.h │ │ │ │ ├── avconfig.h │ │ │ │ ├── avstring.h │ │ │ │ ├── avutil.h │ │ │ │ ├── base64.h │ │ │ │ ├── blowfish.h │ │ │ │ ├── bprint.h │ │ │ │ ├── bswap.h │ │ │ │ ├── buffer.h │ │ │ │ ├── camellia.h │ │ │ │ ├── cast5.h │ │ │ │ ├── channel_layout.h │ │ │ │ ├── common.h │ │ │ │ ├── cpu.h │ │ │ │ ├── crc.h │ │ │ │ ├── des.h │ │ │ │ ├── dict.h │ │ │ │ ├── display.h │ │ │ │ ├── downmix_info.h │ │ │ │ ├── error.h │ │ │ │ ├── eval.h │ │ │ │ ├── ffversion.h │ │ │ │ ├── fifo.h │ │ │ │ ├── file.h │ │ │ │ ├── frame.h │ │ │ │ ├── hash.h │ │ │ │ ├── hmac.h │ │ │ │ ├── imgutils.h │ │ │ │ ├── intfloat.h │ │ │ │ ├── intreadwrite.h │ │ │ │ ├── lfg.h │ │ │ │ ├── log.h │ │ │ │ ├── lzo.h │ │ │ │ ├── macros.h │ │ │ │ ├── mathematics.h │ │ │ │ ├── md5.h │ │ │ │ ├── mem.h │ │ │ │ ├── motion_vector.h │ │ │ │ ├── murmur3.h │ │ │ │ ├── opt.h │ │ │ │ ├── parseutils.h │ │ │ │ ├── pixdesc.h │ │ │ │ ├── pixelutils.h │ │ │ │ ├── pixfmt.h │ │ │ │ ├── random_seed.h │ │ │ │ ├── rational.h │ │ │ │ ├── rc4.h │ │ │ │ ├── replaygain.h │ │ │ │ ├── ripemd.h │ │ │ │ ├── samplefmt.h │ │ │ │ ├── sha.h │ │ │ │ ├── sha512.h │ │ │ │ ├── stereo3d.h │ │ │ │ ├── tea.h │ │ │ │ ├── threadmessage.h │ │ │ │ ├── time.h │ │ │ │ ├── timecode.h │ │ │ │ ├── timestamp.h │ │ │ │ ├── tree.h │ │ │ │ ├── twofish.h │ │ │ │ ├── version.h │ │ │ │ └── xtea.h │ │ │ ├── libswresample/ │ │ │ │ ├── swresample.h │ │ │ │ └── version.h │ │ │ └── libswscale/ │ │ │ ├── swscale.h │ │ │ └── version.h │ │ └── lib/ │ │ ├── avcodec-57.def │ │ ├── avdevice-57.def │ │ ├── avfilter-6.def │ │ ├── avformat-57.def │ │ ├── avutil-55.def │ │ ├── pkgconfig/ │ │ │ ├── libavcodec.pc │ │ │ ├── libavdevice.pc │ │ │ ├── libavfilter.pc │ │ │ ├── libavformat.pc │ │ │ ├── libavutil.pc │ │ │ ├── libswresample.pc │ │ │ └── libswscale.pc │ │ ├── swresample-2.def │ │ └── swscale-4.def │ ├── bin/ │ │ ├── avcodec.lib │ │ ├── avformat.lib │ │ ├── avutil.lib │ │ ├── swresample.lib │ │ └── swscale.lib │ └── bin2/ │ ├── avcodec.lib │ ├── avdevice.lib │ ├── avfilter.lib │ ├── avformat.lib │ ├── avutil.lib │ ├── swresample.lib │ └── swscale.lib ├── libtgnet/ │ ├── BufferOutputStream.cpp │ ├── BufferOutputStream.h │ ├── ConnectionSocket.cpp │ ├── ConnectionSocket.h │ ├── ConnectionSocketWrapper.cpp │ ├── ConnectionSocketWrapper.h │ ├── MicrosoftCryptoImpl.cpp │ ├── MicrosoftCryptoImpl.h │ ├── libtgnet.vcxproj │ ├── libtgnet.vcxproj.filters │ ├── pch.cpp │ └── pch.h ├── libtgvoip-public/ │ ├── BlockingQueue.cpp │ ├── BlockingQueue.h │ ├── BufferInputStream.cpp │ ├── BufferInputStream.h │ ├── BufferOutputStream.cpp │ ├── BufferOutputStream.h │ ├── BufferPool.cpp │ ├── BufferPool.h │ ├── Buffers.cpp │ ├── Buffers.h │ ├── CongestionControl.cpp │ ├── CongestionControl.h │ ├── EchoCanceller.cpp │ ├── EchoCanceller.h │ ├── JitterBuffer.cpp │ ├── JitterBuffer.h │ ├── MediaStreamItf.cpp │ ├── MediaStreamItf.h │ ├── MessageThread.cpp │ ├── MessageThread.h │ ├── NetworkSocket.cpp │ ├── NetworkSocket.h │ ├── OpusDecoder.cpp │ ├── OpusDecoder.h │ ├── OpusEncoder.cpp │ ├── OpusEncoder.h │ ├── PacketReassembler.cpp │ ├── PacketReassembler.h │ ├── PrivateDefines.h │ ├── VoIPController.cpp │ ├── VoIPController.h │ ├── VoIPGroupController.cpp │ ├── VoIPServerConfig.cpp │ ├── VoIPServerConfig.h │ ├── audio/ │ │ ├── AudioIO.cpp │ │ ├── AudioIO.h │ │ ├── AudioInput.cpp │ │ ├── AudioInput.h │ │ ├── AudioOutput.cpp │ │ ├── AudioOutput.h │ │ ├── Resampler.cpp │ │ └── Resampler.h │ ├── libtgvoip.WP81.vcxproj │ ├── libtgvoip.WP81.vcxproj.filters │ ├── logging.cpp │ ├── logging.h │ ├── os/ │ │ └── windows/ │ │ ├── AudioInputWASAPI.cpp │ │ ├── AudioInputWASAPI.h │ │ ├── AudioOutputWASAPI.cpp │ │ ├── AudioOutputWASAPI.h │ │ ├── CXWrapper.cpp │ │ ├── CXWrapper.h │ │ ├── NetworkSocketWinsock.cpp │ │ ├── NetworkSocketWinsock.h │ │ ├── WindowsSandboxUtils.cpp │ │ └── WindowsSandboxUtils.h │ ├── threading.h │ ├── utils.h │ └── webrtc_dsp/ │ └── webrtc/ │ ├── base/ │ │ ├── array_view.h │ │ ├── atomicops.h │ │ ├── basictypes.h │ │ ├── checks.cc │ │ ├── checks.h │ │ ├── constructormagic.h │ │ ├── safe_compare.h │ │ ├── safe_conversions.h │ │ ├── safe_conversions_impl.h │ │ ├── sanitizer.h │ │ ├── stringutils.cc │ │ ├── stringutils.h │ │ └── type_traits.h │ ├── common_audio/ │ │ ├── audio_util.cc │ │ ├── channel_buffer.cc │ │ ├── channel_buffer.h │ │ ├── fft4g.c │ │ ├── fft4g.h │ │ ├── include/ │ │ │ └── audio_util.h │ │ ├── ring_buffer.c │ │ ├── ring_buffer.h │ │ ├── signal_processing/ │ │ │ ├── auto_corr_to_refl_coef.c │ │ │ ├── auto_correlation.c │ │ │ ├── complex_bit_reverse.c │ │ │ ├── complex_fft.c │ │ │ ├── complex_fft_tables.h │ │ │ ├── copy_set_operations.c │ │ │ ├── cross_correlation.c │ │ │ ├── cross_correlation_neon.c │ │ │ ├── division_operations.c │ │ │ ├── dot_product_with_scale.c │ │ │ ├── downsample_fast.c │ │ │ ├── downsample_fast_neon.c │ │ │ ├── energy.c │ │ │ ├── filter_ar.c │ │ │ ├── filter_ar_fast_q12.c │ │ │ ├── filter_ma_fast_q12.c │ │ │ ├── get_hanning_window.c │ │ │ ├── get_scaling_square.c │ │ │ ├── ilbc_specific_functions.c │ │ │ ├── include/ │ │ │ │ ├── real_fft.h │ │ │ │ ├── signal_processing_library.h │ │ │ │ ├── spl_inl.h │ │ │ │ ├── spl_inl_armv7.h │ │ │ │ └── spl_inl_mips.h │ │ │ ├── levinson_durbin.c │ │ │ ├── lpc_to_refl_coef.c │ │ │ ├── min_max_operations.c │ │ │ ├── min_max_operations_neon.c │ │ │ ├── randomization_functions.c │ │ │ ├── real_fft.c │ │ │ ├── refl_coef_to_lpc.c │ │ │ ├── resample.c │ │ │ ├── resample_48khz.c │ │ │ ├── resample_by_2.c │ │ │ ├── resample_by_2_internal.c │ │ │ ├── resample_by_2_internal.h │ │ │ ├── resample_fractional.c │ │ │ ├── spl_init.c │ │ │ ├── spl_inl.c │ │ │ ├── spl_sqrt.c │ │ │ ├── spl_sqrt_floor.c │ │ │ ├── splitting_filter_impl.c │ │ │ ├── sqrt_of_one_minus_x_squared.c │ │ │ └── vector_scaling_operations.c │ │ ├── sparse_fir_filter.cc │ │ ├── sparse_fir_filter.h │ │ ├── wav_file.cc │ │ ├── wav_file.h │ │ ├── wav_header.cc │ │ └── wav_header.h │ ├── modules/ │ │ └── audio_processing/ │ │ ├── aec/ │ │ │ ├── aec_common.h │ │ │ ├── aec_core.cc │ │ │ ├── aec_core.h │ │ │ ├── aec_core_neon.cc │ │ │ ├── aec_core_optimized_methods.h │ │ │ ├── aec_core_sse2.cc │ │ │ ├── aec_resampler.cc │ │ │ ├── aec_resampler.h │ │ │ ├── echo_cancellation.cc │ │ │ └── echo_cancellation.h │ │ ├── aecm/ │ │ │ ├── aecm_core.cc │ │ │ ├── aecm_core.h │ │ │ ├── aecm_core_c.cc │ │ │ ├── aecm_core_neon.cc │ │ │ ├── aecm_defines.h │ │ │ ├── echo_control_mobile.cc │ │ │ └── echo_control_mobile.h │ │ ├── agc/ │ │ │ └── legacy/ │ │ │ ├── analog_agc.c │ │ │ ├── analog_agc.h │ │ │ ├── digital_agc.c │ │ │ ├── digital_agc.h │ │ │ └── gain_control.h │ │ ├── logging/ │ │ │ ├── apm_data_dumper.cc │ │ │ └── apm_data_dumper.h │ │ ├── ns/ │ │ │ ├── defines.h │ │ │ ├── noise_suppression.c │ │ │ ├── noise_suppression.h │ │ │ ├── noise_suppression_x.c │ │ │ ├── noise_suppression_x.h │ │ │ ├── ns_core.c │ │ │ ├── ns_core.h │ │ │ ├── nsx_core.c │ │ │ ├── nsx_core.h │ │ │ ├── nsx_core_c.c │ │ │ ├── nsx_core_neon.c │ │ │ ├── nsx_defines.h │ │ │ └── windows_private.h │ │ ├── splitting_filter.cc │ │ ├── splitting_filter.h │ │ ├── three_band_filter_bank.cc │ │ ├── three_band_filter_bank.h │ │ └── utility/ │ │ ├── block_mean_calculator.cc │ │ ├── block_mean_calculator.h │ │ ├── delay_estimator.cc │ │ ├── delay_estimator.h │ │ ├── delay_estimator_internal.h │ │ ├── delay_estimator_wrapper.cc │ │ ├── delay_estimator_wrapper.h │ │ ├── ooura_fft.cc │ │ ├── ooura_fft.h │ │ ├── ooura_fft_neon.cc │ │ ├── ooura_fft_sse2.cc │ │ ├── ooura_fft_tables_common.h │ │ └── ooura_fft_tables_neon_sse2.h │ ├── system_wrappers/ │ │ ├── include/ │ │ │ ├── asm_defines.h │ │ │ ├── compile_assert_c.h │ │ │ ├── cpu_features_wrapper.h │ │ │ └── metrics.h │ │ └── source/ │ │ └── cpu_features.cc │ └── typedefs.h ├── libtgvoipProxyStub/ │ ├── dlldata.c │ ├── libtgvoip.h │ ├── libtgvoipProxyStub.def │ ├── libtgvoipProxyStub.vcxproj │ ├── libtgvoip_i.c │ └── libtgvoip_p.c └── opencv/ └── install/ └── WP/ └── 8.0/ └── ARM/ ├── ARM/ │ └── vc11/ │ └── lib/ │ ├── OpenCVConfig.cmake │ ├── OpenCVModules-debug.cmake │ ├── OpenCVModules-release.cmake │ ├── OpenCVModules.cmake │ ├── opencv_calib3d300.lib │ ├── opencv_calib3d300d.lib │ ├── opencv_core300.lib │ ├── opencv_core300d.lib │ ├── opencv_features2d300.lib │ ├── opencv_features2d300d.lib │ ├── opencv_flann300.lib │ ├── opencv_flann300d.lib │ ├── opencv_hal300.lib │ ├── opencv_hal300d.lib │ ├── opencv_imgcodecs300.lib │ ├── opencv_imgcodecs300d.lib │ ├── opencv_imgproc300.lib │ ├── opencv_imgproc300d.lib │ ├── opencv_ml300.lib │ ├── opencv_ml300d.lib │ ├── opencv_objdetect300.lib │ ├── opencv_objdetect300d.lib │ ├── opencv_photo300.lib │ ├── opencv_photo300d.lib │ ├── opencv_shape300.lib │ ├── opencv_shape300d.lib │ ├── opencv_stitching300.lib │ ├── opencv_stitching300d.lib │ ├── opencv_video300.lib │ ├── opencv_video300d.lib │ ├── opencv_videoio300.lib │ ├── opencv_videoio300d.lib │ ├── opencv_videostab300.lib │ └── opencv_videostab300d.lib ├── LICENSE ├── OpenCVConfig-version.cmake ├── OpenCVConfig.cmake ├── etc/ │ ├── haarcascades/ │ │ ├── haarcascade_eye.xml │ │ ├── haarcascade_eye_tree_eyeglasses.xml │ │ ├── haarcascade_frontalcatface.xml │ │ ├── haarcascade_frontalcatface_extended.xml │ │ ├── haarcascade_frontalface_alt.xml │ │ ├── haarcascade_frontalface_alt2.xml │ │ ├── haarcascade_frontalface_alt_tree.xml │ │ ├── haarcascade_frontalface_default.xml │ │ ├── haarcascade_fullbody.xml │ │ ├── haarcascade_lefteye_2splits.xml │ │ ├── haarcascade_licence_plate_rus_16stages.xml │ │ ├── haarcascade_lowerbody.xml │ │ ├── haarcascade_profileface.xml │ │ ├── haarcascade_righteye_2splits.xml │ │ ├── haarcascade_russian_plate_number.xml │ │ ├── haarcascade_smile.xml │ │ └── haarcascade_upperbody.xml │ └── lbpcascades/ │ ├── lbpcascade_frontalcatface.xml │ ├── lbpcascade_frontalface.xml │ ├── lbpcascade_profileface.xml │ └── lbpcascade_silverware.xml └── include/ ├── opencv/ │ ├── cv.h │ ├── cv.hpp │ ├── cvaux.h │ ├── cvaux.hpp │ ├── cvwimage.h │ ├── cxcore.h │ ├── cxcore.hpp │ ├── cxeigen.hpp │ ├── cxmisc.h │ ├── highgui.h │ └── ml.h └── opencv2/ ├── calib3d/ │ ├── calib3d.hpp │ └── calib3d_c.h ├── calib3d.hpp ├── core/ │ ├── affine.hpp │ ├── base.hpp │ ├── bufferpool.hpp │ ├── core.hpp │ ├── core_c.h │ ├── cuda/ │ │ ├── block.hpp │ │ ├── border_interpolate.hpp │ │ ├── color.hpp │ │ ├── common.hpp │ │ ├── datamov_utils.hpp │ │ ├── detail/ │ │ │ ├── color_detail.hpp │ │ │ ├── reduce.hpp │ │ │ ├── reduce_key_val.hpp │ │ │ ├── transform_detail.hpp │ │ │ ├── type_traits_detail.hpp │ │ │ └── vec_distance_detail.hpp │ │ ├── dynamic_smem.hpp │ │ ├── emulation.hpp │ │ ├── filters.hpp │ │ ├── funcattrib.hpp │ │ ├── functional.hpp │ │ ├── limits.hpp │ │ ├── reduce.hpp │ │ ├── saturate_cast.hpp │ │ ├── scan.hpp │ │ ├── simd_functions.hpp │ │ ├── transform.hpp │ │ ├── type_traits.hpp │ │ ├── utility.hpp │ │ ├── vec_distance.hpp │ │ ├── vec_math.hpp │ │ ├── vec_traits.hpp │ │ ├── warp.hpp │ │ ├── warp_reduce.hpp │ │ └── warp_shuffle.hpp │ ├── cuda.hpp │ ├── cuda.inl.hpp │ ├── cuda_stream_accessor.hpp │ ├── cuda_types.hpp │ ├── cvdef.h │ ├── cvstd.hpp │ ├── cvstd.inl.hpp │ ├── directx.hpp │ ├── eigen.hpp │ ├── ippasync.hpp │ ├── mat.hpp │ ├── mat.inl.hpp │ ├── matx.hpp │ ├── ocl.hpp │ ├── ocl_genbase.hpp │ ├── opengl.hpp │ ├── operations.hpp │ ├── optim.hpp │ ├── persistence.hpp │ ├── private.cuda.hpp │ ├── private.hpp │ ├── ptr.inl.hpp │ ├── sse_utils.hpp │ ├── traits.hpp │ ├── types.hpp │ ├── types_c.h │ ├── utility.hpp │ ├── version.hpp │ └── wimage.hpp ├── core.hpp ├── cvconfig.h ├── features2d/ │ └── features2d.hpp ├── features2d.hpp ├── flann/ │ ├── all_indices.h │ ├── allocator.h │ ├── any.h │ ├── autotuned_index.h │ ├── composite_index.h │ ├── config.h │ ├── defines.h │ ├── dist.h │ ├── dummy.h │ ├── dynamic_bitset.h │ ├── flann.hpp │ ├── flann_base.hpp │ ├── general.h │ ├── ground_truth.h │ ├── hdf5.h │ ├── heap.h │ ├── hierarchical_clustering_index.h │ ├── index_testing.h │ ├── kdtree_index.h │ ├── kdtree_single_index.h │ ├── kmeans_index.h │ ├── linear_index.h │ ├── logger.h │ ├── lsh_index.h │ ├── lsh_table.h │ ├── matrix.h │ ├── miniflann.hpp │ ├── nn_index.h │ ├── object_factory.h │ ├── params.h │ ├── random.h │ ├── result_set.h │ ├── sampling.h │ ├── saving.h │ ├── simplex_downhill.h │ └── timer.h ├── flann.hpp ├── hal/ │ ├── defs.h │ ├── intrin.hpp │ ├── intrin_cpp.hpp │ ├── intrin_neon.hpp │ └── intrin_sse.hpp ├── hal.hpp ├── imgcodecs/ │ ├── imgcodecs.hpp │ ├── imgcodecs_c.h │ └── ios.h ├── imgcodecs.hpp ├── imgproc/ │ ├── imgproc.hpp │ ├── imgproc_c.h │ └── types_c.h ├── imgproc.hpp ├── ml/ │ └── ml.hpp ├── ml.hpp ├── objdetect/ │ ├── detection_based_tracker.hpp │ ├── objdetect.hpp │ └── objdetect_c.h ├── objdetect.hpp ├── opencv.hpp ├── opencv_modules.hpp ├── photo/ │ ├── cuda.hpp │ ├── photo.hpp │ └── photo_c.h ├── photo.hpp ├── shape/ │ ├── emdL1.hpp │ ├── hist_cost.hpp │ ├── shape.hpp │ ├── shape_distance.hpp │ └── shape_transformer.hpp ├── shape.hpp ├── stitching/ │ ├── detail/ │ │ ├── autocalib.hpp │ │ ├── blenders.hpp │ │ ├── camera.hpp │ │ ├── exposure_compensate.hpp │ │ ├── matchers.hpp │ │ ├── motion_estimators.hpp │ │ ├── seam_finders.hpp │ │ ├── timelapsers.hpp │ │ ├── util.hpp │ │ ├── util_inl.hpp │ │ ├── warpers.hpp │ │ └── warpers_inl.hpp │ └── warpers.hpp ├── stitching.hpp ├── video/ │ ├── background_segm.hpp │ ├── tracking.hpp │ ├── tracking_c.h │ └── video.hpp ├── video.hpp ├── videoio/ │ ├── cap_ios.h │ ├── videoio.hpp │ └── videoio_c.h ├── videoio.hpp ├── videostab/ │ ├── deblurring.hpp │ ├── fast_marching.hpp │ ├── fast_marching_inl.hpp │ ├── frame_source.hpp │ ├── global_motion.hpp │ ├── inpainting.hpp │ ├── log.hpp │ ├── motion_core.hpp │ ├── motion_stabilizing.hpp │ ├── optical_flow.hpp │ ├── outlier_rejection.hpp │ ├── ring_buffer.hpp │ ├── stabilizer.hpp │ └── wobble_suppression.hpp └── videostab.hpp ================================================ FILE CONTENTS ================================================ ================================================ FILE: Agents/AgentHost.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Diagnostics; using System.Windows; using PhoneVoIPApp.BackEnd; using PhoneVoIPApp.BackEnd.OutOfProcess; namespace PhoneVoIPApp.Agents { /// /// A static class that does process-level initialization/deinitializations. /// public static class AgentHost { #region Methods /// /// Indicates that an agent started running. /// internal static void OnAgentStarted() { // Initialize the native code - this only needs to be done once per process,s // but the method below will effectively be a no-op if called more than once. BackEnd.Globals.Instance.StartServer(RegistrationHelper.OutOfProcServerClassNames); } #endregion #region Private members /// /// Class constructor /// static AgentHost() { // Subscribe to the unhandled exception event Deployment.Current.Dispatcher.BeginInvoke(delegate { Application.Current.UnhandledException += AgentHost.OnUnhandledException; }); // Create the singleton video renderer AgentHost.videoRenderer = new VideoRenderer(); AgentHost.mtProtoUpdater = new MTProtoUpdater(); // Store a pointer to the video renderer in the native Globals singleton, // so that the renderer can be used by native code in this process. Globals.Instance.VideoRenderer = AgentHost.videoRenderer; Globals.Instance.MTProtoUpdater = AgentHost.mtProtoUpdater; } /// /// Code to execute on unhandled exceptions. /// private static void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { Debug.WriteLine("[AgentHost] An unhandled exception of type {0} has occurred. Error code: 0x{1:X8}. Message: {2}", e.ExceptionObject.GetType(), e.ExceptionObject.HResult, e.ExceptionObject.Message); if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } } #endregion #region Private // The singleton video renderer static VideoRenderer videoRenderer; static MTProtoUpdater mtProtoUpdater; #endregion } } ================================================ FILE: Agents/Agents.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {820034C1-645D-4340-8813-D980C1EF77DE} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties PhoneVoIPApp.Agents PhoneVoIPApp.Agents WindowsPhone v8.1 false true 12.0 true en-US true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\x86\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\x86\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\ARM\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\ARM\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 {C8D75245-FFCF-4932-A228-C9CC8BB60B03} BackEnd {e79d5093-8038-4a5f-8a98-ca38c0d0886f} Telegram.Api.WP8 ================================================ FILE: Agents/CallInProgressAgentImpl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Microsoft.Phone.Networking.Voip; using PhoneVoIPApp.BackEnd; using Telegram.Api; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Connection; using Telegram.Api.Services.Updates; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Updates; using Telegram.Api.Transport; namespace PhoneVoIPApp.Agents { /// /// An agent that is launched when the first call becomes active and is canceled when the last call ends. /// public class CallInProgressAgentImpl : VoipCallInProgressAgent { public static bool Suppress { get; set; } private bool _logEnabled = true; private void Log(string message, Action callback = null) { if (!_logEnabled) return; Telegram.Logs.Log.Write(string.Format("[CallInProgressAgentImpl] {0} {1}", GetHashCode(), message), callback.SafeInvoke); #if DEBUG //PushUtils.AddToast("push", message, string.Empty, string.Empty, null, null); #endif } private readonly object _initConnectionSyncRoot = new object(); private TLInitConnection GetInitConnection() { return TLUtils.OpenObjectFromMTProtoFile(_initConnectionSyncRoot, Constants.InitConnectionFileName) ?? new TLInitConnection78 { Flags = new TLInt(0), DeviceModel = new TLString("unknown"), AppVersion = new TLString("background task"), SystemVersion = new TLString("8.10.0.0") }; } private static IMTProtoService _mtProtoService; private static IMTProtoService MTProtoService { get { return _mtProtoService; } set { _mtProtoService = value; } } private static ITransportService _transportService; private void InitializeServiceAsync(System.Action callback) { Debug.WriteLine("[CallInProgressAgentImpl {0}] _mtProtoService == null {1}", GetHashCode(), _mtProtoService == null); if (MTProtoService == null) { var deviceInfoService = new Telegram.Api.Services.DeviceInfo.DeviceInfoService(GetInitConnection(), true, "BackgroundDifferenceLoader", 1); var cacheService = new MockupCacheService(); var updatesService = new MockupUpdatesService(); _transportService = new TransportService(); var connectionService = new ConnectionService(deviceInfoService); var publicConfigService = new MockupPublicConfigService(); var mtProtoService = new MTProtoService(deviceInfoService, updatesService, cacheService, _transportService, connectionService, publicConfigService); mtProtoService.Initialized += (o, e) => { //Log(string.Format("[MTProtoUpdater {0}] Initialized", GetHashCode())); Thread.Sleep(1000); callback.SafeInvoke(); }; mtProtoService.InitializationFailed += (o, e) => { //Log(string.Format("[MTProtoUpdater {0}] InitializationFailed", GetHashCode())); }; mtProtoService.Initialize(); MTProtoService = mtProtoService; } else { callback.SafeInvoke(); } } /// /// Constructor /// public CallInProgressAgentImpl() : base() { _timer = new Timer(OnTimer); } private Timer _timer; private void OnTimer(object state) { Log(string.Format("OnTimer call_id={0} suppress={1}", Globals.Instance.CallController != null ? Globals.Instance.CallController.CallId.ToString() : "null", Suppress)); Debug.WriteLine("[CallInProgressAgentImpl {0}] OnTick.", GetHashCode()); //InitializeServiceAsync(() => //{ // var getStateAction = new TLGetState(); // var actions = new List { getStateAction }; // MTProtoService.SendActionsAsync(actions, (request, result) => // { // Log("[CallInProgressAgentImpl] getState result=" + result); // }, // error => // { // Log("[CallInProgressAgentImpl] getState error=" + error); // }); //}); } /// /// The first call has become active. /// protected override void OnFirstCallStarting() { Debug.WriteLine("[CallInProgressAgentImpl {0}] The first call has started.", GetHashCode()); Log("Start timer"); // Indicate that an agent has started running AgentHost.OnAgentStarted(); _timer.Change(TimeSpan.FromSeconds(5.0), TimeSpan.FromSeconds(5.0)); } /// /// The last call has ended. /// protected override void OnCancel() { Debug.WriteLine("[CallInProgressAgentImpl {0}] The last call has ended. Calling NotifyComplete", GetHashCode()); if (MTProtoService != null) MTProtoService.Stop(); Log("Stop timer"); _timer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); // This agent is done base.NotifyComplete(); } } } ================================================ FILE: Agents/ForegroundLifetimeAgentImpl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Microsoft.Phone.Networking.Voip; using System.Diagnostics; using System.Threading; using Microsoft.Phone.Scheduler; namespace PhoneVoIPApp.Agents { /// /// An agent that is invoked when the UI process calls Microsoft.Phone.Networking.Voip.VoipBackgroundProcess.Launched() /// and is canceled when the UI leaves the foreground. /// public sealed class ForegroundLifetimeAgentImpl : VoipForegroundLifetimeAgent { public ForegroundLifetimeAgentImpl() : base() { } /// /// A method that is called as a result of /// protected override void OnLaunched() { Debug.WriteLine("[ForegroundLifetimeAgentImpl] The UI has entered the foreground."); // Indicate that an agent has started running AgentHost.OnAgentStarted(); } protected override void OnCancel() { Debug.WriteLine("[ForegroundLifetimeAgentImpl] The UI is leaving the foreground"); // Make sure that this process has finished becoming ready before trying to complete this agent. // Otherwise, the process may exit without telling the UI that it is ready (and therefore make the UI unresponsive) uint currentProcessId = PhoneVoIPApp.BackEnd.Globals.GetCurrentProcessId(); string backgroundProcessReadyEventName = PhoneVoIPApp.BackEnd.Globals.GetBackgroundProcessReadyEventName(currentProcessId); using (EventWaitHandle backgroundProcessReadyEvent = new EventWaitHandle(initialState: false, mode: EventResetMode.ManualReset, name: backgroundProcessReadyEventName)) { backgroundProcessReadyEvent.WaitOne(); Debug.WriteLine("[ForegroundLifetimeAgentImpl] Background process {0} is ready", currentProcessId); } // This agent is done Debug.WriteLine("[ForegroundLifetimeAgentImpl] Calling NotifyComplete"); base.NotifyComplete(); } } } ================================================ FILE: Agents/MTProtoUpdater.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using PhoneVoIPApp.BackEnd; using Telegram.Api; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.TL; namespace PhoneVoIPApp.Agents { internal class MTProtoUpdater : IMTProtoUpdater, IHandle { private static bool _logEnabled = true; private static readonly int _id = new Random().Next(999); private static void Log(string message, Action callback = null) { if (!_logEnabled) return; Telegram.Logs.Log.Write(string.Format("::MTProtoUpdater {0} {1}", _id, message), callback.SafeInvoke); #if DEBUG //PushUtils.AddToast("push", message, string.Empty, string.Empty, null, null); #endif } private readonly object _initConnectionSyncRoot = new object(); private TLInitConnection GetInitConnection() { return TLUtils.OpenObjectFromMTProtoFile(_initConnectionSyncRoot, Constants.InitConnectionFileName) ?? new TLInitConnection { DeviceModel = new TLString("unknown"), AppVersion = new TLString("background task"), SystemVersion = new TLString("8.10.0.0") }; } public void Start(int pts, int date, int qts) { Log(string.Format("[MTProtoUpdater {0}] Start timer", GetHashCode())); CallInProgressAgentImpl.Suppress = true; } public void Stop() { Log(string.Format("[MTProtoUpdater {0}] Stop timer", GetHashCode())); CallInProgressAgentImpl.Suppress = false; } public void ReceivedCall(long id, long accessHash) { } public void DiscardCall(long id, long accessHash) { } public static void Handle(TLUpdateBase updateBase) { var updatePhoneCall = updateBase as TLUpdatePhoneCall; if (updatePhoneCall != null) { var phoneCallDiscarded = updatePhoneCall.PhoneCall as TLPhoneCallDiscarded61; //if (phoneCallDiscarded != null && Globals.Instance.CallController.CallId == phoneCallDiscarded.Id.Value) //{ // Globals.Instance.CallController.EndCall(); //} } //Globals.Instance.CallController.HandleUpdatePhoneCall(); } void IHandle.Handle(TLUpdateBase message) { Handle(message); } } } ================================================ FILE: Agents/Properties/AssemblyInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Agents")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Agents")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("77ef4b49-898d-4cfc-b8d7-ef7338a0da79")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Agents/PushPayload.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace PhoneVoIPApp.Agents { using System.Xml.Serialization; /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17613")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="WPNotification")] [System.Xml.Serialization.XmlRootAttribute(Namespace="WPNotification", IsNullable=false)] public partial class Notification { private string nameField; /// [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Name { get { return this.nameField; } set { this.nameField = value; } } private string numberField; /// [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Number { get { return this.numberField; } set { this.numberField = value; } } private string locKey; /// [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string LocKey { get { return this.locKey; } set { this.locKey = value; } } private string locArguments; /// [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string LocArguments { get { return this.locArguments; } set { this.locArguments = value; } } private string data; /// [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Data { get { return this.data; } set { this.data = value; } } } } ================================================ FILE: Agents/PushPayload.xml ================================================  Kim Abercrombie +1-555-555-1234 ================================================ FILE: Agents/PushUtils.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define INTERACTIVE_NOTIFICATIONS using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.Data.Xml.Dom; using Windows.Storage; #if WNS_PUSH_SERVICE using Windows.UI.Notifications; #endif using Telegram.Api.Helpers; namespace PhoneVoIPApp.Agents { public static class PushUtils2 { private static readonly Dictionary _locKeys = new Dictionary { {"PINNED_AUDIO", "pinned a voice message"}, {"PINNED_CONTACT", "pinned a contact"}, {"PINNED_DOC", "pinned a file"}, {"PINNED_GAME", "pinned a game"}, {"PINNED_GEO", "pinned a map"}, {"PINNED_GIF", "pinned a GIF"}, {"PINNED_INVOICE", "pinned an invoice"}, {"PINNED_NOTEXT", "pinned a message"}, {"PINNED_PHOTO", "pinned a photo"}, {"PINNED_STICKER", "pinned a sticker"}, {"PINNED_TEXT", "pinned \"{1}\""}, {"PINNED_VIDEO", "pinned a video"}, {"MESSAGE_FWDS", "forwarded you {1} messages"}, {"MESSAGE_TEXT", "{1}"}, {"MESSAGE_NOTEXT", "sent you a message"}, {"MESSAGE_PHOTO", "sent you a photo"}, {"MESSAGE_VIDEO", "sent you a video"}, {"MESSAGE_DOC", "sent you a document"}, {"MESSAGE_GIF", "sent you a GIF"}, {"MESSAGE_AUDIO", "sent you a voice message"}, {"MESSAGE_CONTACT", "shared a contact with you"}, {"MESSAGE_GEO", "sent you a map"}, {"MESSAGE_STICKER", "sent you a sticker"}, {"MESSAGE_GAME", "invited you to play {1}"}, {"MESSAGE_INVOICE", "sent you an invoice for {1}"}, {"CHAT_MESSAGE_FWDS", "{0} forwarded {2} messages to the group"}, {"CHAT_MESSAGE_TEXT", "{0}: {2}"}, {"CHAT_MESSAGE_NOTEXT", "{0} sent a message to the group"}, {"CHAT_MESSAGE_PHOTO", "{0} sent a photo to the group"}, {"CHAT_MESSAGE_VIDEO", "{0} sent a video to the group"}, {"CHAT_MESSAGE_DOC", "{0} sent a document to the group"}, {"CHAT_MESSAGE_GIF", "{0} sent a GIF to the group"}, {"CHAT_MESSAGE_AUDIO", "{0} sent a voice message to the group"}, {"CHAT_MESSAGE_CONTACT", "{0} shared a contact in the group"}, {"CHAT_MESSAGE_GEO", "{0} sent a map to the group"}, {"CHAT_MESSAGE_STICKER", "{0} sent a sticker to the group"}, {"CHAT_MESSAGE_GAME", "{0} invited the group to play {2}"}, {"CHAT_MESSAGE_INVOICE", "{0} sent an invoice for {2}"}, {"CHANNEL_MESSAGE_FWDS", "posted {1} forwarded messages"}, {"CHANNEL_MESSAGE_TEXT", "{1}"}, {"CHANNEL_MESSAGE_NOTEXT", "posted a message"}, {"CHANNEL_MESSAGE_PHOTO", "posted a photo"}, {"CHANNEL_MESSAGE_VIDEO", "posted a video"}, {"CHANNEL_MESSAGE_DOC", "posted a document"}, {"CHANNEL_MESSAGE_GIF", "posted a GIF"}, {"CHANNEL_MESSAGE_AUDIO", "posted a voice message"}, {"CHANNEL_MESSAGE_CONTACT", "posted a contact"}, {"CHANNEL_MESSAGE_GEO", "posted a map"}, {"CHANNEL_MESSAGE_STICKER", "posted a sticker"}, {"CHANNEL_MESSAGE_GAME", "invited you to play {1}"}, {"CHAT_CREATED", "{0} invited you to the group"}, {"CHAT_TITLE_EDITED", "{0} edited the group's name"}, {"CHAT_PHOTO_EDITED", "{0} edited the group's photo"}, {"CHAT_ADD_MEMBER", "{0} invited {2} to the group"}, {"CHAT_ADD_YOU", "{0} invited you to the group"}, {"CHAT_DELETE_MEMBER", "{0} kicked {2} from the group"}, {"CHAT_DELETE_YOU", "{0} kicked you from the group"}, {"CHAT_LEFT", "{0} has left the group"}, {"CHAT_RETURNED", "{0} has returned to the group"}, {"GEOCHAT_CHECKIN", "{0} has checked-in"}, {"CHAT_JOINED", "{0} has joined the group"}, {"CONTACT_JOINED", "{0} joined the App!"}, {"AUTH_UNKNOWN", "New login from unrecognized device {0}"}, {"AUTH_REGION", "New login from unrecognized device {0}, location: {1}"}, {"CONTACT_PHOTO", "updated profile photo"}, {"ENCRYPTION_REQUEST", "You have a new message"}, {"ENCRYPTION_ACCEPT", "You have a new message"}, {"ENCRYPTED_MESSAGE", "You have a new message"}, {"DC_UPDATE", "Open this notification to update app settings"}, {"LOCKED_MESSAGE", "You have a new message"} }; private static void AppendTile(XmlDocument toTile, XmlDocument fromTile) { var fromTileNode = toTile.ImportNode(fromTile.GetElementsByTagName("binding").Item(0), true); toTile.GetElementsByTagName("visual")[0].AppendChild(fromTileNode); } private static void UpdateTile(string caption, string message) { #if WNS_PUSH_SERVICE var tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication("xcee0f789y8059y4881y8883y347265c01f93x"); //tileUpdater.EnableNotificationQueue(false); tileUpdater.EnableNotificationQueue(true); tileUpdater.EnableNotificationQueueForSquare150x150(false); //tileUpdater.EnableNotificationQueueForWide310x150(true); var wideTileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150IconWithBadgeAndText); SetImage(wideTileXml, "IconicSmall110.png"); SetText(wideTileXml, caption, message); var squareTile150Xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150IconWithBadge); SetImage(squareTile150Xml, "IconicTileMedium202.png"); AppendTile(wideTileXml, squareTile150Xml); var squareTile71Xml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare71x71IconWithBadge); SetImage(squareTile71Xml, "IconicSmall110.png"); AppendTile(wideTileXml, squareTile71Xml); try { tileUpdater.Update(new TileNotification(wideTileXml)); } catch (Exception ex) { Telegram.Logs.Log.Write(ex.ToString()); } #endif } private static void UpdateBadge(int badgeNumber) { #if WNS_PUSH_SERVICE var badgeUpdater = BadgeUpdateManager.CreateBadgeUpdaterForApplication("xcee0f789y8059y4881y8883y347265c01f93x"); if (badgeNumber == 0) { badgeUpdater.Clear(); return; } var badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber); var badgeElement = (XmlElement)badgeXml.SelectSingleNode("/badge"); badgeElement.SetAttribute("value", badgeNumber.ToString()); try { badgeUpdater.Update(new BadgeNotification(badgeXml)); } catch (Exception ex) { Telegram.Logs.Log.Write(ex.ToString()); } #endif } private static bool IsMuted(Data data) { return data.mute == "1"; } private static bool IsServiceNotification(Data data) { return data.loc_key == "DC_UPDATE"; } private static void RemoveToastGroup(string groupname) { #if WNS_PUSH_SERVICE ToastNotificationManager.History.RemoveGroup(groupname); #endif } private static string GetCaption(Data data) { var locKey = data.loc_key; if (locKey == null) { return "locKey=null"; } if (locKey.StartsWith("CHAT") || locKey.StartsWith("GEOCHAT")) { return data.loc_args[1]; } if (locKey.StartsWith("MESSAGE")) { return data.loc_args[0]; } if (locKey.StartsWith("CHANNEL")) { return data.loc_args[0]; } if (locKey.StartsWith("PINNED")) { return data.loc_args[0]; } if (locKey.StartsWith("AUTH") || locKey.StartsWith("CONTACT") || locKey.StartsWith("ENCRYPTED") || locKey.StartsWith("ENCRYPTION") || locKey.StartsWith("PHONE")) { return "Telegram"; } #if DEBUG return locKey; #else return "Telegram"; #endif } private static string GetSound(Data data) { return data.sound; } private static string GetGroup(Data data) { return data.group; } private static string GetTag(Data data) { return data.tag; } private static string GetLaunch(Data data) { var locKey = data.loc_key; if (locKey == null) return null; var path = "/Views/ShellView.xaml"; if (locKey == "DC_UPDATE") { path = "/Views/Additional/SettingsView.xaml"; } var customParams = new List { "Action=" + locKey }; if (data.custom != null) { customParams.AddRange(data.custom.GetParams()); } return string.Format("{0}?{1}", path, string.Join("&", customParams)); } private static string GetMessage(Data data) { var locKey = data.loc_key; if (locKey == null) { Telegram.Logs.Log.Write("::PushNotificationsBackgroundTask locKey=null text=" + data.text); return string.Empty; } string locValue = ""; if (_locKeys.TryGetValue(locKey, out locValue)) { } //var resourceLoader = ResourceLoader.GetForViewIndependentUse("TelegramClient.Tasks/Resources"); //locValue = resourceLoader.GetString(locKey); if (locValue != "") { return string.Format(locValue, data.loc_args).Replace("\r\n", "\n").Replace("\n", " "); } var builder = new StringBuilder(); if (data.loc_args != null) { builder.AppendLine("loc_args"); foreach (var locArg in data.loc_args) { builder.AppendLine(locArg); } } Telegram.Logs.Log.Write(string.Format("::PushNotificationsBackgroundTask missing locKey={0} locArgs={1}", locKey, builder.ToString())); //if (locKey.StartsWith("CHAT") || locKey.StartsWith("GEOCHAT")) //{ // return data.text; //} //if (locKey.StartsWith("MESSAGE")) //{ // if (locKey == "MESSAGE_TEXT") // { // return data.loc_args[1]; // } // return data.text; //add localization string here //} #if DEBUG return data.text; #else return string.Empty; #endif } public static void UpdateToastAndTiles(RootObject rootObject) { if (rootObject == null) return; if (rootObject.data == null) return; if (rootObject.data.loc_key == null) { var groupname = GetGroup(rootObject.data); RemoveToastGroup(groupname); return; } var caption = GetCaption(rootObject.data); var message = GetMessage(rootObject.data); var sound = GetSound(rootObject.data); var launch = GetLaunch(rootObject.data); var tag = GetTag(rootObject.data); var group = GetGroup(rootObject.data); if (!IsMuted(rootObject.data) && !Notifications.IsDisabled) { AddToast(rootObject, caption, message, sound, launch, tag, group); } if (!IsServiceNotification(rootObject.data)) { UpdateTile(caption, message); } UpdateBadge(rootObject.data.badge); } private static void SetToastImage(XmlDocument document, string imageSource, bool isUserPlaceholder) { var imageElements = document.GetElementsByTagName("image"); if (imageSource == null) { ((XmlElement)imageElements[0]).SetAttribute("src", isUserPlaceholder ? "ms-appx:///Images/W10M/user_placeholder.png" : "ms-appx:///Images/W10M/group_placeholder.png"); } else { ((XmlElement)imageElements[0]).SetAttribute("src", "ms-appdata:///local/" + imageSource); } } private static void SetImage(XmlDocument document, string imageSource) { var imageElements = document.GetElementsByTagName("image"); ((XmlElement)imageElements[0]).SetAttribute("src", imageSource); } private static void SetSound(XmlDocument document, string soundSource) { //return; if (!Regex.IsMatch(soundSource, @"^sound[1-6]$", RegexOptions.IgnoreCase)) { return; } var toastNode = document.SelectSingleNode("/toast"); ((XmlElement)toastNode).SetAttribute("duration", "long"); var audioElement = document.CreateElement("audio"); audioElement.SetAttribute("src", "ms-appx:///Sounds/" + soundSource + ".wav"); audioElement.SetAttribute("loop", "false"); toastNode.AppendChild(audioElement); } private static void SetLaunch(RootObject rootObject, XmlDocument document, string launch) { if (string.IsNullOrEmpty(launch)) { return; } if (rootObject != null && rootObject.data != null && rootObject.data.system != null && rootObject.data.system.StartsWith("10")) //10.0.10572.0 or less { try { var currentVersion = new Version(rootObject.data.system); var minVersion = new Version("10.0.10572.0"); if (currentVersion < minVersion) { return; } } catch (Exception ex) { Telegram.Logs.Log.Write(ex.ToString()); } } //launch = "/Views/ShellView.xaml"; var toastNode = document.SelectSingleNode("/toast"); ((XmlElement)toastNode).SetAttribute("launch", launch); } private static void SetText(XmlDocument document, string caption, string message) { var toastTextElements = document.GetElementsByTagName("text"); toastTextElements[0].InnerText = caption ?? string.Empty; toastTextElements[1].InnerText = message ?? string.Empty; } private static string GetArguments(string peer, string peerId, bool needAccessHash, Custom custom) { string arguments = null; if (custom.mtpeer != null && custom.mtpeer.ah != null || !needAccessHash) { arguments = string.Format("{0}={1}", peer, peerId); if (custom.mtpeer != null && custom.mtpeer.ah != null) { arguments += string.Format(" access_hash={0}", custom.mtpeer.ah); } if (custom.msg_id != null) { arguments += string.Format(" msg_id={0}", custom.msg_id); } } return arguments; } private static void GetArgumentsAndImageSource(RootObject rootObject, out string arguments, out string imageSource) { arguments = null; imageSource = null; if (rootObject != null) { var data = rootObject.data; if (data != null) { var custom = data.custom; if (custom != null) { if (custom.from_id != null) { int fromId; if (Int32.TryParse(custom.from_id, out fromId)) { arguments = GetArguments("from_id", custom.from_id, true, custom); } } else if (custom.chat_id != null) { int chatId; if (Int32.TryParse(custom.chat_id, out chatId)) { arguments = GetArguments("chat_id", custom.chat_id, false, custom); } } else if (custom.channel_id != null) { int channelId; if (Int32.TryParse(custom.channel_id, out channelId)) { if (data.loc_key != null && data.loc_key.StartsWith("CHAT")) { arguments = GetArguments("channel_id", custom.channel_id, true, custom); } } } imageSource = GetImageSource(custom); } } } } private static void SetActions(XmlDocument document, string arguments) { if (arguments == null) return; //var resourceLoader = ResourceLoader.GetForViewIndependentUse("TelegramClient.Tasks/Resources"); //"" + //"" + //"" + //"" var toastNode = document.SelectSingleNode("/toast"); var actionsElement = document.CreateElement("actions"); var inputElement = document.CreateElement("input"); inputElement.SetAttribute("id", "message"); inputElement.SetAttribute("type", "text"); inputElement.SetAttribute("placeHolderContent", "Type reply"); //resourceLoader.GetString("TypeReply")); actionsElement.AppendChild(inputElement); var replyAction = document.CreateElement("action"); replyAction.SetAttribute("activationType", "background"); replyAction.SetAttribute("content", "Reply"); //resourceLoader.GetString("Reply")); replyAction.SetAttribute("arguments", "action=reply " + arguments); replyAction.SetAttribute("hint-inputId", "message"); replyAction.SetAttribute("imageUri", "Images/W10M/ic_send_2x.png"); actionsElement.AppendChild(replyAction); var muteAction = document.CreateElement("action"); muteAction.SetAttribute("activationType", "background"); muteAction.SetAttribute("content", "Mute 1 hour"); //resourceLoader.GetString("Mute1Hour")); muteAction.SetAttribute("arguments", "action=mute " + arguments); actionsElement.AppendChild(muteAction); var disableAction = document.CreateElement("action"); disableAction.SetAttribute("activationType", "background"); disableAction.SetAttribute("content", "Disable"); //resourceLoader.GetString("Disable")); disableAction.SetAttribute("arguments", "action=disable " + arguments); actionsElement.AppendChild(disableAction); toastNode.AppendChild(actionsElement); } public static void AddToast(RootObject rootObject, string caption, string message, string sound, string launch, string tag, string group) { #if WNS_PUSH_SERVICE #if INTERACTIVE_NOTIFICATIONS var toastNotifier = ToastNotificationManager.CreateToastNotifier("xcee0f789y8059y4881y8883y347265c01f93x"); //("xcee0f789y8059y4881y8883y347265c01f93x"); //toastNotifier.Setting = Version version = Environment.OSVersion.Version; if (rootObject.data.system != null && rootObject.data.system != null) { Version.TryParse(rootObject.data.system, out version); } var toastXml = new XmlDocument(); if (version != null && version.Major >= 10) { string arguments; string imageSource; GetArgumentsAndImageSource(rootObject, out arguments, out imageSource); var xml = "" + "" + "" + "" + "" + "" + "" + "" + ""; toastXml.LoadXml(xml); SetToastImage(toastXml, imageSource, arguments != null && arguments.StartsWith("from_id")); SetActions(toastXml, arguments); } else { toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); } SetText(toastXml, caption, message); SetLaunch(rootObject, toastXml, launch); if (!string.IsNullOrEmpty(sound) && !string.Equals(sound, "default", StringComparison.OrdinalIgnoreCase)) { SetSound(toastXml, sound); } try { var toast = new ToastNotification(toastXml); if (tag != null) toast.Tag = tag; if (group != null) toast.Group = group; //RemoveToastGroup(group); toastNotifier.Show(toast); } catch (Exception ex) { Telegram.Logs.Log.Write(ex.ToString()); } #else var toastNotifier = ToastNotificationManager.CreateToastNotifier(); var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); SetText(toastXml, caption, message); SetLaunch(toastXml, launch); if (!string.IsNullOrEmpty(sound) && !string.Equals(sound, "default", StringComparison.OrdinalIgnoreCase)) { SetSound(toastXml, sound); } try { var toast = new ToastNotification(toastXml); if (tag != null) toast.Tag = tag; if (group != null) toast.Group = group; //RemoveToastGroup(group); toastNotifier.Show(toast); } catch (Exception ex) { Telegram.Logs.Log.Write(ex.ToString()); } #endif #endif } public static T GetRootObject(string payload) where T : class { var serializer = new DataContractJsonSerializer(typeof(T)); T rootObject; using (var stream = new MemoryStream(Encoding.Unicode.GetBytes(payload))) { rootObject = serializer.ReadObject(stream) as T; } return rootObject; } private static async Task IsFileExists(string fileName) { bool fileExists = true; Stream fileStream = null; StorageFile file = null; try { file = await ApplicationData.Current.LocalFolder.GetFileAsync(fileName); fileStream = await file.OpenStreamForReadAsync(); fileStream.Dispose(); } catch (FileNotFoundException) { // If the file dosn't exits it throws an exception, make fileExists false in this case fileExists = false; } finally { if (fileStream != null) { fileStream.Dispose(); } } return fileExists; } private static string GetImageSource(Custom custom) { string imageSource = null; if (custom.mtpeer != null) { var location = custom.mtpeer.ph; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.volume_id, location.local_id, location.secret); if (IsFileExists(fileName).Result) { imageSource = fileName; } } } return imageSource; } public static string GetImageSource(MTPeer mtpeer) { string imageSource = null; if (mtpeer != null) { var location = mtpeer.ph; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.volume_id, location.local_id, location.secret); if (IsFileExists(fileName).Result) { imageSource = fileName; } } } return imageSource; } } public sealed class Photo { public string volume_id { get; set; } public string local_id { get; set; } public string secret { get; set; } public int dc_id { get; set; } } public sealed class MTPeer { public string ah { get; set; } public Photo ph { get; set; } } public sealed class Custom { public string msg_id { get; set; } public string from_id { get; set; } public string chat_id { get; set; } public string channel_id { get; set; } public MTPeer mtpeer { get; set; } public string call_id { get; set; } public string call_ah { get; set; } public string group { get { if (chat_id != null) return "c" + chat_id; if (channel_id != null) return "c" + chat_id; if (from_id != null) return "u" + from_id; return null; } } public string tag { get { return msg_id; } } public IEnumerable GetParams() { if (msg_id != null) yield return "msg_id=" + msg_id; if (from_id != null) yield return "from_id=" + from_id; if (chat_id != null) yield return "chat_id=" + chat_id; if (channel_id != null) yield return "channel_id=" + channel_id; } } public sealed class Data { public Custom custom { get; set; } public string sound { get; set; } public string mute { get; set; } public int badge { get; set; } public string loc_key { get; set; } public string[] loc_args { get; set; } public int random_id { get; set; } public int user_id { get; set; } public string text { get; set; } public string system { get; set; } public string group { get { return custom != null ? custom.group : null; } } public string tag { get { return custom != null ? custom.tag : null; } } } public sealed class RootObject { public int date { get; set; } public Data data { get; set; } } } ================================================ FILE: Agents/RegistrationHelper.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.34011 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace PhoneVoIPApp.BackEnd.OutOfProcess { internal sealed class RegistrationHelper { internal static string[] OutOfProcServerClassNames = new string[] { "PhoneVoIPApp.BackEnd.OutOfProcess.Server"}; } } ================================================ FILE: Agents/ScheduledAgentImpl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Net; using System.Text; using System.Threading; using System.Xml.Serialization; using Windows.Data.Xml.Dom; using Windows.UI.Notifications; using Microsoft.Phone.Networking.Voip; using Microsoft.Phone.Scheduler; using PhoneVoIPApp.BackEnd; using Telegram.Api; using Telegram.Api.Aggregator; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Connection; using Telegram.Api.Services.Location; using Telegram.Api.Services.Updates; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Phone; using Telegram.Api.Transport; namespace PhoneVoIPApp.Agents { public class ScheduledAgentImpl : ScheduledTaskAgent { private readonly Mutex _appOpenMutex = new Mutex(false, Constants.TelegramMessengerMutexName); private static bool _logEnabled = true; private static readonly int _id = new Random().Next(999); private static void Log(string message, Action callback = null) { if (!_logEnabled) return; Telegram.Logs.Log.WriteSync = true; Telegram.Logs.Log.Write(string.Format("::ScheduledAgentImpl {0} {1}", _id, message), callback); #if DEBUG //PushUtils.AddToast("push", message, string.Empty, string.Empty, null, null); #endif } public ScheduledAgentImpl() { } //private static void SetText(XmlDocument document, string caption, string message) //{ // var toastTextElements = document.GetElementsByTagName("text"); // toastTextElements[0].InnerText = caption ?? string.Empty; // toastTextElements[1].InnerText = message ?? string.Empty; //} private static void SetText(XmlDocument document, string caption, string message) { var toastTextElements = document.GetElementsByTagName("text"); toastTextElements[0].InnerText = caption ?? string.Empty; toastTextElements[1].InnerText = message ?? string.Empty; } protected override void OnInvoke(ScheduledTask task) { Debug.WriteLine("[ScheduledAgentImpl {0}] ScheduledAgentImpl has been invoked with argument of type {1}.", GetHashCode(), task.GetType()); // Indicate that an agent has started running AgentHost.OnAgentStarted(); Log(string.Format("start with argument of type {0}", task.GetType())); if (!_appOpenMutex.WaitOne(0)) { Log("cancel"); Complete(); return; } _appOpenMutex.ReleaseMutex(); var incomingCallTask = task as VoipHttpIncomingCallTask; if (incomingCallTask != null) { isIncomingCallAgent = true; var messageBody = HttpUtility.HtmlDecode(Encoding.UTF8.GetString(incomingCallTask.MessageBody, 0, incomingCallTask.MessageBody.Length)); Notification pushNotification = null; try { using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(messageBody ?? string.Empty))) { var xs = new XmlSerializer(typeof(Notification)); pushNotification = (Notification)xs.Deserialize(ms); } } catch (Exception ex) { Log(string.Format("cannot deserialize message_body={0}", messageBody)); #if DEBUG var toastNotifier = ToastNotificationManager.CreateToastNotifier(); var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); SetText(toastXml, "Notification Exception", string.Empty); try { var toast = new ToastNotification(toastXml); //RemoveToastGroup(group); toastNotifier.Show(toast); } catch (Exception ex2) { Telegram.Logs.Log.Write(ex.ToString()); } #endif } if (pushNotification != null) { var rootObject = PushUtils2.GetRootObject(pushNotification.Data); if (rootObject != null && rootObject.data != null) { if (rootObject.data.custom != null && rootObject.data.custom.from_id != null && rootObject.data.custom.call_id != null && rootObject.data.custom.call_ah != null) { var contactImage = PushUtils2.GetImageSource(rootObject.data.custom.mtpeer) ?? string.Empty; var contactName = rootObject.data.loc_args != null && rootObject.data.loc_args.Length > 0 ? rootObject.data.loc_args[0] : string.Empty; Debug.WriteLine("[{0}] Incoming call from caller {1}, id {2}", incomingCallAgentId, contactName, rootObject.data.custom.from_id); long contactId = 0; long callId = 0; long callAccessHash = 0; if (long.TryParse(rootObject.data.custom.from_id, out contactId) && long.TryParse(rootObject.data.custom.call_id, out callId) && long.TryParse(rootObject.data.custom.call_ah, out callAccessHash)) { if (string.Equals(rootObject.data.loc_key, "PHONE_CALL_REQUEST", StringComparison.OrdinalIgnoreCase)) { if (BackEnd.Globals.Instance.CallController.CallStatus == CallStatus.InProgress) { OnIncomingCallDialogDismissed(callId, callAccessHash, true); return; } // Initiate incoming call processing // If you want to pass in additional information such as pushNotification.Number, you can var incomingCallProcessingStarted = BackEnd.Globals.Instance.CallController.OnIncomingCallReceived(contactName, contactId, contactImage, callId, callAccessHash, OnIncomingCallDialogDismissed); if (incomingCallProcessingStarted) { // will Complete() at OnIncomingCallDialogDismissed return; } //PushUtils2.AddToast(rootObject, "Caption", "Message", "", "", "tag", "group"); } else if (string.Equals(rootObject.data.loc_key, "PHONE_CALL_DECLINE", StringComparison.OrdinalIgnoreCase)) { var currentCallId = BackEnd.Globals.Instance.CallController.CallId; if (currentCallId == callId) { Log(string.Format("PHONE_CALL_DECLINE CallController.EndCall call_id={0}", callId)); var result = BackEnd.Globals.Instance.CallController.EndCall(); Log(string.Format("PHONE_CALL_DECLINE CallController.EndCall call_id={0} result={1}", callId, result)); } } } } else if (string.Equals(rootObject.data.loc_key, "GEO_LIVE_PENDING")) { ProcessLiveLocations(); } else { //PushUtils2.UpdateToastAndTiles(rootObject); } } } Complete(); return; } else { VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask; if (keepAliveTask != null) { this.isIncomingCallAgent = false; // Refresh tokens, get new certs from server, etc. BackEnd.Globals.Instance.DoPeriodicKeepAlive(); this.Complete(); } else { throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType())); } } } // This is a request to complete this agent protected override void OnCancel() { Debug.WriteLine("[{0}] Cancel requested.", this.isIncomingCallAgent ? ScheduledAgentImpl.incomingCallAgentId : ScheduledAgentImpl.keepAliveAgentId); this.Complete(); } private readonly object _initConnectionSyncRoot = new object(); private TLInitConnection GetInitConnection() { return TLUtils.OpenObjectFromMTProtoFile(_initConnectionSyncRoot, Constants.InitConnectionFileName) ?? new TLInitConnection { DeviceModel = new TLString("unknown"), AppVersion = new TLString("background task"), SystemVersion = new TLString("8.10.0.0") }; } // This method is called when the incoming call processing is complete private void OnIncomingCallDialogDismissed(long callId, long callAccessHash, bool rejected) { Debug.WriteLine("[IncomingCallAgent] Incoming call processing is now complete."); if (rejected) { var deviceInfoService = new Telegram.Api.Services.DeviceInfo.DeviceInfoService(GetInitConnection(), true, "BackgroundDifferenceLoader", 1); var cacheService = new MockupCacheService(); var updatesService = new MockupUpdatesService(); var transportService = new TransportService(); var connectionService = new ConnectionService(deviceInfoService); var publicConfigService = new MockupPublicConfigService(); var manualResetEvent = new ManualResetEvent(false); var mtProtoService = new MTProtoService(deviceInfoService, updatesService, cacheService, transportService, connectionService, publicConfigService); mtProtoService.Initialized += (o, e) => { var peer = new TLInputPhoneCall { Id = new TLLong(callId), AccessHash = new TLLong(callAccessHash) }; var getStateAction = new TLDiscardCall { Peer = peer, Duration = new TLInt(0), Reason = new TLPhoneCallDiscardReasonBusy(), ConnectionId = new TLLong(0) }; var actions = new List { getStateAction }; mtProtoService.SendActionsAsync(actions, (request, result) => { manualResetEvent.Set(); }, error => { manualResetEvent.Set(); }); }; mtProtoService.InitializationFailed += (o, e) => { manualResetEvent.Set(); }; mtProtoService.Initialize(); #if DEBUG manualResetEvent.WaitOne(); #else manualResetEvent.WaitOne(TimeSpan.FromSeconds(10.0)); #endif mtProtoService.Stop(); } this.Complete(); } private void ProcessLiveLocations() { var deviceInfoService = new Telegram.Api.Services.DeviceInfo.DeviceInfoService(GetInitConnection(), true, "BackgroundDifferenceLoader", 1); var cacheService = new MockupCacheService(); var updatesService = new MockupUpdatesService(); var transportService = new TransportService(); var connectionService = new ConnectionService(deviceInfoService); var publicConfigService = new MockupPublicConfigService(); var manualResetEvent = new ManualResetEvent(false); var eventAggregator = new TelegramEventAggregator(); var mtProtoService = new MTProtoService(deviceInfoService, updatesService, cacheService, transportService, connectionService, publicConfigService); mtProtoService.Initialized += (o, e) => { var liveLocationsService = new LiveLocationService(mtProtoService, eventAggregator); liveLocationsService.Load(); liveLocationsService.UpdateAll(); manualResetEvent.Set(); }; mtProtoService.InitializationFailed += (o, e) => { manualResetEvent.Set(); }; mtProtoService.Initialize(); var timeout = #if DEBUG Timeout.InfiniteTimeSpan; #else TimeSpan.FromSeconds(30.0); #endif var result = manualResetEvent.WaitOne(timeout); } // Complete this agent. private void Complete() { Debug.WriteLine("[{0}] Calling NotifyComplete", this.isIncomingCallAgent ? ScheduledAgentImpl.incomingCallAgentId : ScheduledAgentImpl.keepAliveAgentId); Log(string.Format("[{0}] Calling NotifyComplete", this.isIncomingCallAgent ? ScheduledAgentImpl.incomingCallAgentId : ScheduledAgentImpl.keepAliveAgentId)); // This agent is done base.NotifyComplete(); } // Strings used in tracing private const string keepAliveAgentId = "KeepAliveAgent"; private const string incomingCallAgentId = "IncomingCallAgent"; // Indicates if this agent instance is handling an incoming call or not private bool isIncomingCallAgent; } } ================================================ FILE: Agents/VideoMediaStreamSource.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Windows.Media; using System.Threading; namespace PhoneVoIPApp.Agents { public class VideoMediaStreamSource : MediaStreamSource, IDisposable { public class VideoSample { public VideoSample(Windows.Storage.Streams.IBuffer _buffer, UInt64 _hnsPresentationTime, UInt64 _hnsSampleDuration) { buffer = _buffer; hnsPresentationTime = _hnsPresentationTime; hnsSampleDuration = _hnsSampleDuration; } public Windows.Storage.Streams.IBuffer buffer; public UInt64 hnsPresentationTime; public UInt64 hnsSampleDuration; } private const int maxQueueSize = 4; private int _frameWidth; private int _frameHeight; private bool isDisposed = false; private Queue _sampleQueue; private object lockObj = new object(); private ManualResetEvent shutdownEvent; private int _outstandingGetVideoSampleCount; private MediaStreamDescription _videoDesc; private Dictionary _emptySampleDict = new Dictionary(); public VideoMediaStreamSource(Stream audioStream, int frameWidth, int frameHeight) { _frameWidth = frameWidth; _frameHeight = frameHeight; shutdownEvent = new ManualResetEvent(false); _sampleQueue = new Queue(VideoMediaStreamSource.maxQueueSize); _outstandingGetVideoSampleCount = 0; BackEnd.Globals.Instance.TransportController.VideoMessageReceived += TransportController_VideoMessageReceived; } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } public void Shutdown() { shutdownEvent.Set(); lock (lockObj) { if (_outstandingGetVideoSampleCount > 0) { // ReportGetSampleCompleted must be called after GetSampleAsync to avoid memory leak. So, send // an empty MediaStreamSample here. MediaStreamSample msSamp = new MediaStreamSample( _videoDesc, null, 0, 0, 0, 0, _emptySampleDict); ReportGetSampleCompleted(msSamp); _outstandingGetVideoSampleCount = 0; } } } protected virtual void Dispose(bool disposing) { if (!this.isDisposed) { if (disposing) { BackEnd.Globals.Instance.TransportController.VideoMessageReceived -= TransportController_VideoMessageReceived; } isDisposed = true; } } void TransportController_VideoMessageReceived(Windows.Storage.Streams.IBuffer ibuffer, UInt64 hnsPresenationTime, UInt64 hnsSampleDuration) { lock (lockObj) { if (_sampleQueue.Count >= VideoMediaStreamSource.maxQueueSize) { // Dequeue and discard oldest _sampleQueue.Dequeue(); } _sampleQueue.Enqueue(new VideoSample(ibuffer, hnsPresenationTime, hnsSampleDuration)); SendSamples(); } } private void SendSamples() { while (_sampleQueue.Count() > 0 && _outstandingGetVideoSampleCount > 0) { if (!(shutdownEvent.WaitOne(0))) { VideoSample vs = _sampleQueue.Dequeue(); Stream s = System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeBufferExtensions.AsStream(vs.buffer); // Send out the next sample MediaStreamSample msSamp = new MediaStreamSample( _videoDesc, s, 0, s.Length, (long)vs.hnsPresentationTime, (long)vs.hnsSampleDuration, _emptySampleDict); ReportGetSampleCompleted(msSamp); _outstandingGetVideoSampleCount--; } else { // If video rendering is shutting down we should no longer deliver frames return; } } } private void PrepareVideo() { // Stream Description Dictionary streamAttributes = new Dictionary(); // Select the same encoding and dimensions as the video capture streamAttributes[MediaStreamAttributeKeys.VideoFourCC] = "H264"; streamAttributes[MediaStreamAttributeKeys.Height] = _frameHeight.ToString(); streamAttributes[MediaStreamAttributeKeys.Width] = _frameWidth.ToString(); MediaStreamDescription msd = new MediaStreamDescription(MediaStreamType.Video, streamAttributes); _videoDesc = msd; } private void PrepareAudio() { } protected override void OpenMediaAsync() { // Init Dictionary sourceAttributes = new Dictionary(); List availableStreams = new List(); PrepareVideo(); availableStreams.Add(_videoDesc); // a zero timespan is an infinite video sourceAttributes[MediaSourceAttributesKeys.Duration] = TimeSpan.FromSeconds(0).Ticks.ToString(CultureInfo.InvariantCulture); sourceAttributes[MediaSourceAttributesKeys.CanSeek] = false.ToString(); // tell Silverlight that we've prepared and opened our video ReportOpenMediaCompleted(sourceAttributes, availableStreams); } protected override void GetSampleAsync(MediaStreamType mediaStreamType) { if (mediaStreamType == MediaStreamType.Audio) { } else if (mediaStreamType == MediaStreamType.Video) { lock (lockObj) { _outstandingGetVideoSampleCount++; SendSamples(); } } } protected override void CloseMedia() { } protected override void GetDiagnosticAsync(MediaStreamSourceDiagnosticKind diagnosticKind) { throw new NotImplementedException(); } protected override void SwitchMediaStreamAsync(MediaStreamDescription mediaStreamDescription) { throw new NotImplementedException(); } protected override void SeekAsync(long seekToTime) { ReportSeekCompleted(seekToTime); } } } ================================================ FILE: Agents/VideoRenderer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Microsoft.Phone.Media; using PhoneVoIPApp.BackEnd; using System; using System.Diagnostics; using System.Windows; namespace PhoneVoIPApp.Agents { /// /// A class that renders video from the background process. /// Note, the MediaElement that actually displays the video is in the UI process - /// this class receives video from the remote party and writes it to a media streamer. /// The media streamer handles connecting the rendered video stream to the media element that /// displays it in the UI process. /// internal class VideoRenderer : IVideoRenderer { /// /// Constructor /// internal VideoRenderer() { } #region IVideoRenderer methods /// /// Start rendering video. /// Note, this method may be called multiple times in a row. /// public void Start() { if (this.isRendering) return; // Nothing more to be done Deployment.Current.Dispatcher.BeginInvoke(() => { try { Debug.WriteLine("[VideoRenderer::Start] Video rendering setup"); StartMediaStreamer(); this.isRendering = true; } catch (Exception err) { Debug.WriteLine("[VideoRenderer::Start] " + err.Message); } }); } private void StartMediaStreamer() { if (mediaStreamer == null) { mediaStreamer = MediaStreamerFactory.CreateMediaStreamer(123); } // Using default resolution of 640x480 mediaStreamSource = new VideoMediaStreamSource(null, 640, 480); mediaStreamer.SetSource(mediaStreamSource); } /// /// Stop rendering video. /// Note, this method may be called multiple times in a row. /// public void Stop() { Deployment.Current.Dispatcher.BeginInvoke(() => { if (!this.isRendering) return; // Nothing more to be done Debug.WriteLine("[VoIP Background Process] Video rendering stopped."); mediaStreamSource.Shutdown(); mediaStreamSource.Dispose(); mediaStreamSource = null; mediaStreamer.Dispose(); mediaStreamer = null; this.isRendering = false; }); } #endregion #region Private members // Indicates if rendering is already in progress or not private bool isRendering; private VideoMediaStreamSource mediaStreamSource; private MediaStreamer mediaStreamer; #endregion } } ================================================ FILE: BackEnd/ApiLock.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "ApiLock.h" namespace PhoneVoIPApp { namespace BackEnd { // A mutex used to protect objects accessible from the API surface exposed by this DLL std::recursive_mutex g_apiLock; } } ================================================ FILE: BackEnd/ApiLock.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include namespace PhoneVoIPApp { namespace BackEnd { // A mutex used to protect objects accessible from the API surface exposed by this DLL extern std::recursive_mutex g_apiLock; } } ================================================ FILE: BackEnd/BackEnd.vcxproj ================================================  Debug Win32 Debug ARM Release Win32 Release ARM {c8d75245-ffcf-4932-a228-c9cc8bb60b03} PhoneVoIPApp.BackEnd en-US $(VCTargetsPath11) 11.0 Windows Phone 8.0 true BackEnd Windows Phone Silverlight 8.1 DynamicLibrary true v120 win32 DynamicLibrary true v120 arm32 DynamicLibrary false true v120 win32 DynamicLibrary false true v120 arm32 false $(RootNamespace) PostBuildEvent $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ $(RootNamespace) PostBuildEvent $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ $(RootNamespace) PostBuildEvent $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ $(RootNamespace) PostBuildEvent $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ _WINRT_DLL;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) _WINRT_DLL;WIN32_LEAN_AND_MEAN;NDEBUG;%(PreprocessorDefinitions) _WINRT_DLL;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) _WINRT_DLL;WIN32_LEAN_AND_MEAN;NDEBUG;%(PreprocessorDefinitions) NotUsing $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) true true true true Console false windowsphonecore.lib;runtimeobject.lib;PhoneAudioSes.lib;%(AdditionalDependencies) ole32.lib;%(IgnoreSpecificDefaultLibraries) true true true true pushd "$(OutDir)" WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl" popd $(OutDir)$(RootNamespace).idl;$(OutDir)$(RootNamespace).OutOfProcess.idl;$(SolutionDir)$(ProjectName)ProxyStub\dlldata.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_p.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess.h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_p.c;%(Outputs) pushd "$(OutDir)" WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl" popd $(OutDir)$(RootNamespace).idl;$(OutDir)$(RootNamespace).OutOfProcess.idl;$(SolutionDir)$(ProjectName)ProxyStub\dlldata.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_p.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess.h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_p.c;%(Outputs) pushd "$(OutDir)" WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl" popd $(OutDir)$(RootNamespace).idl;$(OutDir)$(RootNamespace).OutOfProcess.idl;$(SolutionDir)$(ProjectName)ProxyStub\dlldata.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_p.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess.h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_p.c;%(Outputs) pushd "$(OutDir)" WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl" MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(TargetPlatformSdkMetadataLocation)" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl" popd $(OutDir)$(RootNamespace).idl;$(OutDir)$(RootNamespace).OutOfProcess.idl;$(SolutionDir)$(ProjectName)ProxyStub\dlldata.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace)_p.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess.h;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_i.c;$(SolutionDir)$(ProjectName)ProxyStub\$(RootNamespace).OutOfProcess_p.c;%(Outputs) true true false {21f10158-c078-4bd7-a82a-9c4aeb8e2f8e} ================================================ FILE: BackEnd/BackEndAudio.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "BackEndAudio.h" #include "ApiLock.h" #include "BackEndNativeBuffer.h" using namespace PhoneVoIPApp::BackEnd; using namespace Windows::System::Threading; // Begin of audio helpers //size_t inline GetWaveFormatSize(const WAVEFORMATEX& format) //{ // return (sizeof WAVEFORMATEX) + (format.wFormatTag == WAVE_FORMAT_PCM ? 0 : format.cbSize); //} // //void FillPcmFormat(WAVEFORMATEX& format, WORD wChannels, int nSampleRate, WORD wBits) //{ // format.wFormatTag = WAVE_FORMAT_PCM; // format.nChannels = wChannels; // format.nSamplesPerSec = nSampleRate; // format.wBitsPerSample = wBits; // format.nBlockAlign = format.nChannels * (format.wBitsPerSample / 8); // format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; // format.cbSize = 0; //} // //size_t BytesFromDuration(int nDurationInMs, const WAVEFORMATEX& format) //{ // return size_t(nDurationInMs * FLOAT(format.nAvgBytesPerSec) / 1000); //} // //size_t SamplesFromDuration(int nDurationInMs, const WAVEFORMATEX& format) //{ // return size_t(nDurationInMs * FLOAT(format.nSamplesPerSec) / 1000); //} //// End of audio helpers // //BOOL WaveFormatCompare(const WAVEFORMATEX& format1, const WAVEFORMATEX& format2) //{ // size_t cbSizeFormat1 = GetWaveFormatSize(format1); // size_t cbSizeFormat2 = GetWaveFormatSize(format2); // // return (cbSizeFormat1 == cbSizeFormat2) && (memcmp(&format1, &format2, cbSizeFormat1) == 0); //} // //BackEndAudio::BackEndAudio() : // m_pDefaultRenderDevice(NULL), // m_pRenderClient(NULL), // m_pClock(NULL), // m_pVolume(NULL), // m_nMaxFrameCount(0), // m_pwfx(NULL), // m_pDefaultCaptureDevice(NULL), // m_pCaptureClient(NULL), // m_sourceFrameSizeInBytes(0), // hCaptureEvent(NULL), // hShutdownEvent(NULL), // m_CaptureThread(nullptr), // transportController(nullptr), // started(false) //{ // this->onTransportMessageReceivedHandler = ref new MessageReceivedEventHandler(this, &BackEndAudio::OnTransportMessageReceived); //} // //void BackEndAudio::OnTransportMessageReceived(Windows::Storage::Streams::IBuffer^ stream, UINT64, UINT64) //{ // BYTE* pBuffer = NativeBuffer::GetBytesFromIBuffer(stream); // int size = stream->Length; // // while (m_pRenderClient && size && pBuffer) // { // HRESULT hr = E_FAIL; // unsigned int padding = 0; // // hr = m_pDefaultRenderDevice->GetCurrentPadding(&padding); // if (SUCCEEDED(hr)) // { // BYTE* pRenderBuffer = NULL; // unsigned int incomingFrameCount = size / m_sourceFrameSizeInBytes; // unsigned int framesToWrite = m_nMaxFrameCount - padding; // // if (framesToWrite > incomingFrameCount) // { // framesToWrite = incomingFrameCount; // } // // if (framesToWrite) // { // hr = m_pRenderClient->GetBuffer(framesToWrite, &pRenderBuffer); // // if (SUCCEEDED(hr)) // { // unsigned int bytesToBeWritten = framesToWrite * m_sourceFrameSizeInBytes; // // memcpy(pRenderBuffer, pBuffer, bytesToBeWritten); // // // Release the buffer // m_pRenderClient->ReleaseBuffer(framesToWrite, 0); // // pBuffer += bytesToBeWritten; // size -= bytesToBeWritten; // } // } // } // } //} // //void BackEndAudio::Start() //{ // // Make sure only one API call is in progress at a time // std::lock_guard lock(g_apiLock); // // if (started) // return; // // HRESULT hr = InitCapture(); // if (SUCCEEDED(hr)) // { // hr = InitRender(); // } // // if (SUCCEEDED(hr)) // { // hr = StartAudioThreads(); // } // // if (FAILED(hr)) // { // Stop(); // throw ref new Platform::COMException(hr, L"Unable to start audio"); // } // // started = true; //} // //void BackEndAudio::Stop() //{ // // Make sure only one API call is in progress at a time // std::lock_guard lock(g_apiLock); // // if (!started) // return; // // // Shutdown the threads // if (hShutdownEvent) // { // SetEvent(hShutdownEvent); // } // // if (m_CaptureThread != nullptr) // { // m_CaptureThread->Cancel(); // m_CaptureThread->Close(); // m_CaptureThread = nullptr; // } // // if (m_pDefaultRenderDevice) // { // m_pDefaultRenderDevice->Stop(); // } // // if (m_pDefaultCaptureDevice) // { // m_pDefaultCaptureDevice->Stop(); // } // // if (m_pVolume) // { // m_pVolume->Release(); // m_pVolume = NULL; // } // if (m_pClock) // { // m_pClock->Release(); // m_pClock = NULL; // } // // if (m_pRenderClient) // { // m_pRenderClient->Release(); // m_pRenderClient = NULL; // } // // // // if (m_pDefaultRenderDevice) // { // m_pDefaultRenderDevice->Release(); // m_pDefaultRenderDevice = NULL; // } // // if (m_pDefaultCaptureDevice) // { // m_pDefaultCaptureDevice->Release(); // m_pDefaultCaptureDevice = NULL; // } // // if (m_pCaptureClient) // { // m_pCaptureClient->Release(); // m_pCaptureClient = NULL; // } // // if (m_pwfx) // { // CoTaskMemFree((LPVOID)m_pwfx); // m_pwfx = NULL; // } // // if (hCaptureEvent) // { // CloseHandle(hCaptureEvent); // hCaptureEvent = NULL; // } // // if (hShutdownEvent) // { // CloseHandle(hShutdownEvent); // hShutdownEvent = NULL; // } // // started = false; //} // //void BackEndAudio::CaptureThread(Windows::Foundation::IAsyncAction^ operation) //{ // HRESULT hr = m_pDefaultCaptureDevice->Start(); // BYTE *pLocalBuffer = new BYTE[MAX_RAW_BUFFER_SIZE]; // HANDLE eventHandles[] = { // hCaptureEvent, // WAIT_OBJECT0 // hShutdownEvent // WAIT_OBJECT0 + 1 // }; // // if (SUCCEEDED(hr) && pLocalBuffer) // { // unsigned int uAccumulatedBytes = 0; // while (SUCCEEDED(hr)) // { // DWORD waitResult = WaitForMultipleObjectsEx(SIZEOF_ARRAY(eventHandles), eventHandles, FALSE, INFINITE, FALSE); // if (WAIT_OBJECT_0 == waitResult) // { // BYTE* pbData = nullptr; // UINT32 nFrames = 0; // DWORD dwFlags = 0; // if (SUCCEEDED(hr)) // { // hr = m_pCaptureClient->GetBuffer(&pbData, &nFrames, &dwFlags, nullptr, nullptr); // unsigned int incomingBufferSize = nFrames * m_sourceFrameSizeInBytes; // // if (MAX_RAW_BUFFER_SIZE - uAccumulatedBytes < incomingBufferSize) // { // // Send what has been accumulated // if (transportController) // { // transportController->WriteAudio(pLocalBuffer, uAccumulatedBytes); // } // // // Reset our counter // uAccumulatedBytes = 0; // } // // memcpy(pLocalBuffer + uAccumulatedBytes, pbData, incomingBufferSize); // uAccumulatedBytes += incomingBufferSize; // } // // if (SUCCEEDED(hr)) // { // hr = m_pCaptureClient->ReleaseBuffer(nFrames); // } // } // else if (WAIT_OBJECT_0 + 1 == waitResult) // { // // We're being asked to shutdown // break; // } // else // { // // Unknown return value // DbgRaiseAssertionFailure(); // } // } // } // delete[] pLocalBuffer; //} // //HRESULT BackEndAudio::StartAudioThreads() //{ // hShutdownEvent = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); // if (!hShutdownEvent) // { // return HRESULT_FROM_WIN32(GetLastError()); // } // // m_CaptureThread = ThreadPool::RunAsync(ref new WorkItemHandler(this, &BackEndAudio::CaptureThread), WorkItemPriority::High, WorkItemOptions::TimeSliced); // return S_OK; //} // //BackEndAudio::~BackEndAudio() //{ // if (transportController) // { // transportController->AudioMessageReceived -= onTransportMessageReceivedHandlerToken; // transportController = nullptr; // } //} // //HRESULT BackEndAudio::InitRender() //{ // HRESULT hr = E_FAIL; // // LPCWSTR pwstrRendererId = GetDefaultAudioRenderId(AudioDeviceRole::Communications); // // if (NULL == pwstrRendererId) // { // hr = E_FAIL; // } // // hr = ActivateAudioInterface(pwstrRendererId, __uuidof(IAudioClient2), (void**)&m_pDefaultRenderDevice); // // // Set the category through SetClientProperties // AudioClientProperties properties = {}; // if (SUCCEEDED(hr)) // { // properties.cbSize = sizeof AudioClientProperties; // properties.eCategory = AudioCategory_Communications; // hr = m_pDefaultRenderDevice->SetClientProperties(&properties); // } // // WAVEFORMATEX* pwfx = nullptr; // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->GetMixFormat(&pwfx); // } // // WAVEFORMATEX format = {}; // if (SUCCEEDED(hr)) // { // FillPcmFormat(format, pwfx->nChannels, pwfx->nSamplesPerSec, pwfx->wBitsPerSample); // hr = m_pDefaultRenderDevice->Initialize(AUDCLNT_SHAREMODE_SHARED, // 0, // 2000 * 10000, // Seconds in hns // 0, // periodicity // &format, // NULL); // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->GetService(__uuidof(IAudioRenderClient), (void**)&m_pRenderClient); // } // // // Check for other supported GetService interfaces as well // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->GetService(__uuidof(IAudioClock), (void**)&m_pClock); // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->GetService(__uuidof(ISimpleAudioVolume), (void**)&m_pVolume); // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->GetBufferSize(&m_nMaxFrameCount); // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultRenderDevice->Start(); // } // // if (pwstrRendererId) // { // CoTaskMemFree((LPVOID)pwstrRendererId); // } // // return hr; //} // //HRESULT BackEndAudio::InitCapture() //{ // HRESULT hr = E_FAIL; // // LPCWSTR pwstrCaptureId = GetDefaultAudioCaptureId(AudioDeviceRole::Communications); // // if (NULL == pwstrCaptureId) // { // hr = E_FAIL; // } // // hr = ActivateAudioInterface(pwstrCaptureId, __uuidof(IAudioClient2), (void**)&m_pDefaultCaptureDevice); // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultCaptureDevice->GetMixFormat(&m_pwfx); // } // // // Set the category through SetClientProperties // AudioClientProperties properties = {}; // if (SUCCEEDED(hr)) // { // properties.cbSize = sizeof AudioClientProperties; // properties.eCategory = AudioCategory_Communications; // hr = m_pDefaultCaptureDevice->SetClientProperties(&properties); // } // // if (SUCCEEDED(hr)) // { // WAVEFORMATEX format = {}; // if (SUCCEEDED(hr)) // { // // FillPcmFormat(format, m_pwfx->nChannels, m_pwfx->nSamplesPerSec, m_pwfx->wBitsPerSample); // // m_sourceFrameSizeInBytes = (format.wBitsPerSample / 8) * format.nChannels; // hr = m_pDefaultCaptureDevice->Initialize(AUDCLNT_SHAREMODE_SHARED, 0x88140000, 1000 * 10000, 0, &format, NULL); // } // } // // if (SUCCEEDED(hr)) // { // hCaptureEvent = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); // if (NULL == hCaptureEvent) // { // hr = HRESULT_FROM_WIN32(GetLastError()); // } // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultCaptureDevice->SetEventHandle(hCaptureEvent); // } // // if (SUCCEEDED(hr)) // { // hr = m_pDefaultCaptureDevice->GetService(__uuidof(IAudioCaptureClient), (void**)&m_pCaptureClient); // } // // if (pwstrCaptureId) // { // CoTaskMemFree((LPVOID)pwstrCaptureId); // } // return hr; //} // //void BackEndAudio::SetTransport(BackEndTransport^ transport) //{ // transportController = transport; // if (transportController != nullptr) // { // onTransportMessageReceivedHandlerToken = transportController->AudioMessageReceived += onTransportMessageReceivedHandler; // } //} ================================================ FILE: BackEnd/BackEndAudio.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include "windows.h" #define MAX_RAW_BUFFER_SIZE 1024*128 #include #include #include #include "BackEndTransport.h" namespace PhoneVoIPApp { namespace BackEnd { //public ref class BackEndAudio sealed //{ //public: // // Constructor // BackEndAudio(); // // Destructor // virtual ~BackEndAudio(); // void SetTransport(BackEndTransport^ transport); // // void Start(); // void Stop(); //private: // HRESULT InitRender(); // HRESULT InitCapture(); // HRESULT StartAudioThreads(); // void CaptureThread(Windows::Foundation::IAsyncAction^ operation); // void OnTransportMessageReceived(Windows::Storage::Streams::IBuffer^ stream, UINT64, UINT64); // // BackEndTransport^ transportController; // PhoneVoIPApp::BackEnd::MessageReceivedEventHandler^ onTransportMessageReceivedHandler; // Windows::Foundation::EventRegistrationToken onTransportMessageReceivedHandlerToken; // int m_sourceFrameSizeInBytes; // WAVEFORMATEX* m_pwfx; // // Devices // IAudioClient2* m_pDefaultRenderDevice; // IAudioClient2* m_pDefaultCaptureDevice; // // Actual render and capture objects // IAudioRenderClient* m_pRenderClient; // IAudioCaptureClient* m_pCaptureClient; // // Misc interfaces // IAudioClock* m_pClock; // ISimpleAudioVolume* m_pVolume; // // Audio buffer size // UINT32 m_nMaxFrameCount; // HANDLE hCaptureEvent; // // Event for stopping audio capture/render // HANDLE hShutdownEvent; // Windows::Foundation::IAsyncAction^ m_CaptureThread; // // Has audio started? // bool started; //}; } } ================================================ FILE: BackEnd/BackEndCapture.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "BackEndCapture.h" #include "ApiLock.h" #include using namespace PhoneVoIPApp::BackEnd; using namespace Windows::System::Threading; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Platform; using namespace Windows::Phone::Media::Capture; using namespace Windows::Storage::Streams; using namespace Concurrency; BackEndCapture::BackEndCapture() : started(false), videoOnlyDevice(nullptr), pVideoSink(NULL), pVideoDevice(NULL), cameraLocation(CameraSensorLocation::Front) { hStopCompleted = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); if (!hStopCompleted) { throw ref new Platform::Exception(HRESULT_FROM_WIN32(GetLastError()), L"Could not create shutdown event"); } hStartCompleted = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); if (!hStartCompleted) { throw ref new Platform::Exception(HRESULT_FROM_WIN32(GetLastError()), L"Could not create start event"); } } void BackEndCapture::Start(CameraLocation newCameraLocation) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (started) return; if(newCameraLocation == CameraLocation::Front) { cameraLocation = Windows::Phone::Media::Capture::CameraSensorLocation::Front; } else if(newCameraLocation == CameraLocation::Back) { cameraLocation = Windows::Phone::Media::Capture::CameraSensorLocation::Back; } InitCapture(); started = true; } void BackEndCapture::Stop() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); ::OutputDebugString(L"+[BackendCapture::Stop] => Trying to stop capture\n"); if (!started) { ::OutputDebugString(L"-[BackendCapture::Stop] => finished stopping capture\n"); return; } if (videoOnlyDevice) { OutputDebugString(L"Destroying VideoCaptureDevice\n"); try { videoOnlyDevice->StopRecordingAsync()->Completed = ref new AsyncActionCompletedHandler([this] (IAsyncAction ^action, Windows::Foundation::AsyncStatus status){ if(status == Windows::Foundation::AsyncStatus::Completed) { OutputDebugString(L"[BackendCapture::StopRecordingAsync] Video successfully stopped.\n"); } else { OutputDebugString(L"[BackEndCapture::StopRecordingAsync] Error occurred while stopping recording.\n"); } this->videoCaptureAction = nullptr; this->videoOnlyDevice = nullptr; started = false; SetEvent(hStopCompleted); }); } catch(...) { // A Platform::ObjectDisposedException can be raised if the app has had its access // to video revoked (most commonly when the app is going out of the foreground) OutputDebugString(L"Exception caught while destroying video capture\n"); this->videoCaptureAction = nullptr; this->videoOnlyDevice = nullptr; started = false; SetEvent(hStopCompleted); } if (pVideoDevice) { pVideoDevice->Release(); pVideoDevice = NULL; } if (pVideoSink) { pVideoSink->Release(); pVideoSink = NULL; } } ::OutputDebugString(L"-[BackendCapture::Stop] => finished stopping capture\n"); } BackEndCapture::~BackEndCapture() { if(m_ToggleThread) { m_ToggleThread->Cancel(); m_ToggleThread->Close(); m_ToggleThread = nullptr; } } void BackEndCapture::InitCapture() { ::OutputDebugString(L"+[BackendCapture::InitCapture] => Initializing Capture\n"); Windows::Foundation::Size dimensions; dimensions.Width = 640; dimensions.Height = 480; Collections::IVectorView ^availableSizes = AudioVideoCaptureDevice::GetAvailableCaptureResolutions(this->cameraLocation); Collections::IIterator ^availableSizesIterator = availableSizes->First(); IAsyncOperation ^openOperation = nullptr; while(!openOperation && availableSizesIterator->HasCurrent) { // TODO: You should select the appropriate resolution that's supported here, // TODO: and then setup your renderer with that selected res. // TODO: This shows how to iterate through all supported resolutions. We're assuming 640x480 support if(availableSizesIterator->Current.Height == 480 && availableSizesIterator->Current.Width == 640) { openOperation = AudioVideoCaptureDevice::OpenForVideoOnlyAsync(this->cameraLocation, dimensions); } availableSizesIterator->MoveNext(); } openOperation->Completed = ref new AsyncOperationCompletedHandler([this] (IAsyncOperation ^operation, Windows::Foundation::AsyncStatus status) { if(status == Windows::Foundation::AsyncStatus::Completed) { std::lock_guard lock(g_apiLock); ::OutputDebugString(L"+[BackendCapture::InitCapture] => OpenAsyncOperation started\n"); auto videoDevice = operation->GetResults(); this->videoOnlyDevice = videoDevice; IAudioVideoCaptureDeviceNative *pNativeDevice = NULL; HRESULT hr = reinterpret_cast(videoDevice)->QueryInterface(__uuidof(IAudioVideoCaptureDeviceNative), (void**) &pNativeDevice); if (NULL == pNativeDevice || FAILED(hr)) { throw ref new FailureException("Unable to QI IAudioVideoCaptureDeviceNative"); } // Save off the native device this->pVideoDevice = pNativeDevice; // Create the sink MakeAndInitialize(&(this->pVideoSink), transportController); this->pVideoSink->SetTransport(this->transportController); pNativeDevice->SetVideoSampleSink(this->pVideoSink); // Use the same encoding format as in VideoMediaStreamSource.cs videoDevice->VideoEncodingFormat = CameraCaptureVideoFormat::H264; SetEvent(hStartCompleted); // Start recording to our sink this->videoCaptureAction = videoDevice->StartRecordingToSinkAsync(); videoCaptureAction->Completed = ref new AsyncActionCompletedHandler([this] (IAsyncAction ^asyncInfo, Windows::Foundation::AsyncStatus status) { if(status == Windows::Foundation::AsyncStatus::Completed) { ::OutputDebugString(L"[BackendCapture::InitCapture] => StartRecordingToSinkAsync completed\n"); } else if(status == Windows::Foundation::AsyncStatus::Error || status == Windows::Foundation::AsyncStatus::Canceled) { ::OutputDebugString(L"[BackendCapture::InitCapture] => StartRecordingToSinkAsync did not complete\n"); } }); ::OutputDebugString(L"-[BackendCapture::InitCapture] => OpenAsyncOperation Completed\n"); } else if(status == Windows::Foundation::AsyncStatus::Canceled) { ::OutputDebugString(L"[BackendCapture::InitCapture] => OpenAsyncOperation Canceled\n"); } else if(status == Windows::Foundation::AsyncStatus::Error) { ::OutputDebugString(L"[BackendCapture::InitCapture] => OpenAsyncOperation encountered an error.\n"); } }); ::OutputDebugString(L"-[BackendCapture::InitCapture] => Initializing Capture\n"); } void BackEndCapture::ToggleCamera() { std::lock_guard lock(g_apiLock); if(m_ToggleThread) { m_ToggleThread->Cancel(); m_ToggleThread->Close(); m_ToggleThread = nullptr; } m_ToggleThread = ThreadPool::RunAsync(ref new WorkItemHandler(this, &BackEndCapture::ToggleCameraThread), WorkItemPriority::High, WorkItemOptions::TimeSliced); } void BackEndCapture::ToggleCameraThread(Windows::Foundation::IAsyncAction^ operation) { ::OutputDebugString(L"+[BackendCapture::ToggleCamera] => Toggling camera \n"); CameraLocation newCameraLocation; ResetEvent(hStopCompleted); Stop(); DWORD waitResult = WaitForSingleObjectEx(hStopCompleted, INFINITE, FALSE); if(waitResult == WAIT_OBJECT_0) { ResetEvent(hStartCompleted); if(cameraLocation == Windows::Phone::Media::Capture::CameraSensorLocation::Back) { newCameraLocation = CameraLocation::Front; } else { newCameraLocation = CameraLocation::Back; } Start(newCameraLocation); } else { throw ref new Platform::Exception(HRESULT_FROM_WIN32(waitResult), L"Error waiting for capture to stop when toggling cameras"); } waitResult = WaitForSingleObjectEx(hStartCompleted, INFINITE, FALSE); if(waitResult == WAIT_OBJECT_0) { CameraLocationChanged(newCameraLocation); } else { throw ref new Platform::Exception(HRESULT_FROM_WIN32(waitResult), L"Error waiting for capture to start when toggling cameras"); } ::OutputDebugString(L"-[BackendCapture::ToggleCamera] => Toggling camera \n"); } void BackEndCapture::SetTransport(BackEndTransport^ transport) { transportController = transport; } ================================================ FILE: BackEnd/BackEndCapture.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include "windows.h" #include "implements.h" #include "ICallControllerStatusListener.h" #include "BackEndTransport.h" #include #include namespace PhoneVoIPApp { namespace BackEnd { public delegate void CameraLocationChangedEventHandler(PhoneVoIPApp::BackEnd::CameraLocation); class CaptureSampleSink : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags, ICameraCaptureSampleSink> { DWORD m_dwSampleCount; BackEndTransport ^m_transport; public: STDMETHODIMP RuntimeClassInitialize(BackEndTransport ^transportController) { m_dwSampleCount = 0; m_transport = transportController; return S_OK; } DWORD GetSampleCount() { return m_dwSampleCount; } IFACEMETHODIMP_(void) OnSampleAvailable( ULONGLONG hnsPresentationTime, ULONGLONG hnsSampleDuration, DWORD cbSample, BYTE* pSample) { m_dwSampleCount++; if (m_transport) { m_transport->WriteVideo(pSample, cbSample, hnsPresentationTime, hnsSampleDuration); } } void SetTransport(BackEndTransport ^transport) { m_transport = transport; } }; public ref class BackEndCapture sealed { public: // Constructor BackEndCapture(); void SetTransport(BackEndTransport^ transport); void Start(CameraLocation cameraLocation); void Stop(); void ToggleCamera(); event CameraLocationChangedEventHandler^ CameraLocationChanged; private: // Destructor ~BackEndCapture(); void InitCapture(); void ToggleCameraThread(Windows::Foundation::IAsyncAction^ operation); // Has capture started? bool started; // Events to signal whether capture has stopped/started HANDLE hStopCompleted; HANDLE hStartCompleted; Windows::Foundation::IAsyncAction^ m_ToggleThread; // Transport BackEndTransport^ transportController; // Native sink and video device CaptureSampleSink *pVideoSink; IAudioVideoCaptureDeviceNative *pVideoDevice; Windows::Phone::Media::Capture::CameraSensorLocation cameraLocation; Windows::Phone::Media::Capture::AudioVideoCaptureDevice ^videoOnlyDevice; Windows::Foundation::IAsyncAction ^videoCaptureAction; }; } } ================================================ FILE: BackEnd/BackEndNativeBuffer.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include "windows.h" #include #include #include #include #include namespace PhoneVoIPApp { namespace BackEnd { /// /// The purpose of this class is to transform byte buffers into an IBuffer /// class NativeBuffer : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >, ABI::Windows::Storage::Streams::IBuffer, Windows::Storage::Streams::IBufferByteAccess, Microsoft::WRL::FtmBase> { public: virtual ~NativeBuffer() { if (m_pBuffer && m_bIsOwner) { delete[] m_pBuffer; m_pBuffer = NULL; } } STDMETHODIMP RuntimeClassInitialize(UINT totalSize) { m_uLength = totalSize; m_uFullSize = totalSize; m_pBuffer = new BYTE[totalSize]; m_bIsOwner = TRUE; return S_OK; } STDMETHODIMP RuntimeClassInitialize(BYTE* pBuffer, UINT totalSize, BOOL fTakeOwnershipOfPassedInBuffer) { m_uLength = totalSize; m_uFullSize = totalSize; m_pBuffer = pBuffer; m_bIsOwner = fTakeOwnershipOfPassedInBuffer; return S_OK; } STDMETHODIMP Buffer( BYTE **value) { *value = m_pBuffer; return S_OK; } STDMETHODIMP get_Capacity(UINT32 *value) { *value = m_uFullSize; return S_OK; } STDMETHODIMP get_Length(UINT32 *value) { *value = m_uLength; return S_OK; } STDMETHODIMP put_Length(UINT32 value) { if(value > m_uFullSize) { return E_INVALIDARG; } m_uLength = value; return S_OK; } static Windows::Storage::Streams::IBuffer^ GetIBufferFromNativeBuffer(Microsoft::WRL::ComPtr spNativeBuffer) { auto iinspectable = reinterpret_cast(spNativeBuffer.Get()); return reinterpret_cast(iinspectable); } static BYTE* GetBytesFromIBuffer(Windows::Storage::Streams::IBuffer^ buffer) { auto iinspectable = (IInspectable*)reinterpret_cast(buffer); Microsoft::WRL::ComPtr spBuffAccess; HRESULT hr = iinspectable->QueryInterface(__uuidof(Windows::Storage::Streams::IBufferByteAccess), (void **)&spBuffAccess); UCHAR * pReadBuffer; spBuffAccess->Buffer(&pReadBuffer); return pReadBuffer; } private: UINT32 m_uLength; UINT32 m_uFullSize; BYTE* m_pBuffer; BOOL m_bIsOwner; }; } } ================================================ FILE: BackEnd/BackEndTransport.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "BackEndTransport.h" #include "BackEndNativeBuffer.h" #include using namespace PhoneVoIPApp::BackEnd; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage::Streams; using namespace Windows::System::Threading; using namespace Microsoft::WRL; using namespace Microsoft::WRL::Details; BackEndTransport::BackEndTransport() { } void BackEndTransport::WriteAudio(BYTE* bytes, int byteCount) { Write(bytes, byteCount, TransportMessageType::Audio, 0, 0); } void BackEndTransport::WriteVideo(BYTE* bytes, int byteCount, UINT64 hnsPresenationTime, UINT64 hnsSampleDuration) { Write(bytes, byteCount, TransportMessageType::Video, hnsPresenationTime, hnsSampleDuration); } void BackEndTransport::Write(BYTE* bytes, int byteCount, TransportMessageType::Value dataType, UINT64 hnsPresenationTime, UINT64 hnsSampleDuration) { static const int MaxPacketSize = 10*1024*1024; int bytesToSend = byteCount; while (bytesToSend) { int chunkSize = bytesToSend > MaxPacketSize ? MaxPacketSize : bytesToSend; ComPtr spNativeBuffer = NULL; if (dataType == TransportMessageType::Audio) { MakeAndInitialize(&spNativeBuffer, bytes, chunkSize, FALSE); AudioMessageReceived(NativeBuffer::GetIBufferFromNativeBuffer(spNativeBuffer), hnsPresenationTime, hnsSampleDuration); } else { // Temporarily duplicating this for sample so that MSS can own this // buffer, and will be released when the stream itself is released BYTE* pMem = new BYTE[chunkSize]; memcpy((void*) pMem, (void*) bytes, chunkSize); MakeAndInitialize(&spNativeBuffer, pMem, chunkSize, TRUE); VideoMessageReceived(NativeBuffer::GetIBufferFromNativeBuffer(spNativeBuffer), hnsPresenationTime, hnsSampleDuration); } // Increment byte position bytes += chunkSize; bytesToSend -= chunkSize; } return; } BackEndTransport::~BackEndTransport() { } ================================================ FILE: BackEnd/BackEndTransport.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include "windows.h" namespace PhoneVoIPApp { namespace BackEnd { namespace TransportMessageType { enum Value { Audio = 0, Video = 1 }; } public delegate void MessageReceivedEventHandler(Windows::Storage::Streams::IBuffer ^pBuffer, UINT64 hnsPresentationTime, UINT64 hnsSampleDuration); /// /// This is an abstraction of a network transport class /// which does not actually send data over the network. /// public ref class BackEndTransport sealed { public: // Constructor BackEndTransport(); // Destructor virtual ~BackEndTransport(); void WriteAudio(BYTE* bytes, int byteCount); void WriteVideo(BYTE* bytes, int byteCount, UINT64 hnsPresentationTime, UINT64 hnsSampleDuration); event MessageReceivedEventHandler^ AudioMessageReceived; event MessageReceivedEventHandler^ VideoMessageReceived; private: void Write(BYTE* bytes, int byteCount, TransportMessageType::Value dataType, UINT64 hnsPresentationTime, UINT64 hnsSampleDurationTime); }; } } ================================================ FILE: BackEnd/BackgroundTask.cpp ================================================ #include "BackgroundTask.h" #include "Globals.h" #include "CallController.h" using namespace PhoneVoIPApp::BackEnd; using namespace Windows::ApplicationModel::Background; using namespace Windows::Phone::Networking::Voip; using namespace Windows::Foundation; using namespace Platform; using namespace Windows::Phone::Media::Devices; BackgroundTask::BackgroundTask() { } void BackgroundTask::Run(IBackgroundTaskInstance^ taskInstance){ return; VoipCallCoordinator^ callCoordinator = Windows::Phone::Networking::Voip::VoipCallCoordinator::GetDefault(); Windows::Phone::Networking::Voip::VoipPhoneCall^ incomingCall; String^ installFolder = String::Concat(Windows::ApplicationModel::Package::Current->InstalledLocation->Path, "\\"); TimeSpan timeout; timeout.Duration = 90 * 10 * 1000 * 1000; // in 100ns units callCoordinator->RequestNewIncomingCall( ref new String(L"/Views/ShellView.xaml"), ref new String(L"test contact"), ref new String(L"test number"), ref new Uri(installFolder, "Assets\\DefaultContactImage.png"), ref new String(L"PhoneVoIPApp"), ref new Uri(installFolder, "Assets\\ApplicationIcon.png"), ref new String(L"call details"), // Was this call forwarded/delegated to this user on behalf of someone else? At this time, we won't use this field ref new Uri(installFolder, "Assets\\Ringtone.wma"), VoipCallMedia::Audio, timeout, // Maximum amount of time to ring for &incomingCall); } void BackgroundTask::IncomingCallDissmissed(){ } ================================================ FILE: BackEnd/BackgroundTask.h ================================================ #pragma once using namespace Windows::ApplicationModel::Background; namespace PhoneVoIPApp { namespace BackEnd { [Windows::Foundation::Metadata::WebHostHidden] public ref class BackgroundTask sealed : public IBackgroundTask { public: BackgroundTask(); virtual void Run(IBackgroundTaskInstance^ taskInstance); private: void IncomingCallDissmissed(); }; } } ================================================ FILE: BackEnd/CallController.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "CallController.h" #include "BackEndAudio.h" #include "BackEndCapture.h" #include "Server.h" using namespace PhoneVoIPApp::BackEnd; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Phone::Media::Devices; using namespace Windows::Phone::Networking::Voip; LibTgVoipStateListener::LibTgVoipStateListener(){ } void LibTgVoipStateListener::OnCallStateChanged(libtgvoip::VoIPControllerWrapper^ sender, libtgvoip::CallState newState) { if (this->statusListener != nullptr){ this->statusListener->OnCallStateChanged((CallState)newState); } } void LibTgVoipStateListener::OnSignalBarsChanged(libtgvoip::VoIPControllerWrapper^ sender, int newSignal) { if (this->statusListener != nullptr){ this->statusListener->OnSignalBarsChanged(newSignal); } } void LibTgVoipStateListener::SetStatusCallback(ICallControllerStatusListener^ statusListener) { this->statusListener = statusListener; } void CallController::StartMTProtoUpdater() { if (Globals::Instance->MTProtoUpdater != nullptr) { Globals::Instance->MTProtoUpdater->Start(0, 0, 0); } } void CallController::StopMTProtoUpdater() { if (Globals::Instance->MTProtoUpdater != nullptr) { Globals::Instance->MTProtoUpdater->Stop(); } } void CallController::HandleUpdatePhoneCall() { ::OutputDebugString(L"[CallController::HandleUpdatePhoneCall]\n"); } void CallController::CreateVoIPControllerWrapper() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); wrapper = ref new libtgvoip::VoIPControllerWrapper(); //wrapper->SetStateCallback(stateListener); wrapper->CallStateChanged += ref new libtgvoip::CallStateChangedEventHandler( stateListener, &LibTgVoipStateListener::OnCallStateChanged ); wrapper->SignalBarsChanged += ref new libtgvoip::SignalBarsChangedEventHandler( stateListener, &LibTgVoipStateListener::OnSignalBarsChanged ); } void CallController::DeleteVoIPControllerWrapper() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ delete wrapper; wrapper = nullptr; } } void CallController::SetConfig(Config config) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { wrapper->SetConfig(config.InitTimeout, config.RecvTimeout, (libtgvoip::DataSavingMode)config.DataSavingMode, config.EnableAEC, config.EnableNS, config.EnableAGC, config.LogFilePath, config.StatsDumpFilePath); } } void CallController::SetEncryptionKey(const Platform::Array^ key, bool isOutgoing) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { wrapper->SetEncryptionKey(key, isOutgoing); } } void CallController::SetPublicEndpoints(const Platform::Array^ endpoints, bool allowP2P, int connectionMaxLayer) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { auto points = ref new Platform::Array(endpoints->Length); for (int i = 0; i < endpoints->Length; i++) { auto point = ref new libtgvoip::Endpoint(); point->id = endpoints[i].id; point->port = endpoints[i].port; point->ipv4 = endpoints[i].ipv4; point->ipv6 = endpoints[i].ipv6; auto length = endpoints[i].peerTag->Length(); auto it = endpoints[i].peerTag->Begin(); auto peerTag = ref new Platform::Array(length); for (size_t i = 0; i < length; i++) { peerTag[i] = (byte)it[i]; } point->peerTag = peerTag; points[i] = point; } wrapper->SetPublicEndpoints(points, allowP2P, connectionMaxLayer); } } void CallController::SetProxy(ProxyStruct proxy) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { wrapper->SetProxy((libtgvoip::ProxyProtocol)proxy.protocol, proxy.address, proxy.port, proxy.username, proxy.password); } } void CallController::Start() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { wrapper->Start(); } } void Handler(Windows::System::Threading::ThreadPoolTimer^ timer){ ::OutputDebugString(L"PeriodicTimer.Handler"); } void CallController::Connect() { ::OutputDebugString(L"[CallController::Connect]\n"); // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr) { wrapper->Connect(); } } void CallController::SetMicMute(bool mute) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ wrapper->SetMicMute(mute); } } void CallController::SwitchSpeaker(bool external) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); libtgvoip::VoIPControllerWrapper::SwitchSpeaker(external); } void CallController::SetStatusCallback(ICallControllerStatusListener^ statusListener) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); this->statusListener = statusListener; this->stateListener->SetStatusCallback(statusListener); } void CallController::UpdateServerConfig(Platform::String^ json) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); libtgvoip::VoIPControllerWrapper::UpdateServerConfig(json); } int64 CallController::GetPreferredRelayID() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ return wrapper->GetPreferredRelayID(); } return 0; } Error CallController::GetLastError() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ return (Error)wrapper->GetLastError(); } return Error::Unknown; } Platform::String^ CallController::GetVersion() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return libtgvoip::VoIPControllerWrapper::GetVersion(); } int CallController::GetSignalBarsCount() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ return wrapper->GetSignalBarsCount(); } return 0; } Platform::String^ CallController::GetDebugLog() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ return wrapper->GetDebugLog(); } return nullptr; } Platform::String^ CallController::GetDebugString() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (wrapper != nullptr){ return wrapper->GetDebugString(); } return nullptr; } bool CallController::InitiateOutgoingCall(Platform::String^ recepientName, int64 recepientId, int64 id, int64 accessHash, Config config, const Platform::Array^ key, bool outgoing, const Platform::Array^ emojis, const Platform::Array^ endpoints, bool allowP2P, int connectionMaxLayer, ProxyStruct proxy) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); VoipPhoneCall^ outgoingCall = nullptr; // In this sample, we allow only one call at a time. if (this->activeCall != nullptr) { ::OutputDebugString(L"[CallController::InitiateOutgoingCall] => Only one active call allowed in this sample at a time\n"); this->activeCall->NotifyCallEnded(); // If we receive a request to initiate an outgoing call when another call is in progress, // we just ignore it. //return false; } ::OutputDebugString(L"[CallController::InitiateOutgoingCall] => Starting outgoing call\n"); // Start a new outgoing call. this->callCoordinator->RequestNewOutgoingCall(this->callInProgressPageUri, recepientName, "Telegram", VoipCallMedia::Audio //| VoipCallMedia::Video , &outgoingCall); // Tell the phone service that this call is active. // Normally, we do this only when the remote party has accepted the call. outgoingCall->NotifyCallActive(); // Store it as the active call - assume we support both audio and video this->SetActiveCall(outgoingCall, recepientId, id, accessHash, key, outgoing, emojis, VoipCallMedia::Audio //| VoipCallMedia::Video ); this->DeleteVoIPControllerWrapper(); this->CreateVoIPControllerWrapper(); this->SetConfig(config); this->SetEncryptionKey(key, outgoing); this->SetPublicEndpoints(endpoints, allowP2P, connectionMaxLayer); this->SetProxy(proxy); this->Start(); //UpdateNetworkType(null); this->Connect(); return true; } bool CallController::InitiateOutgoingCall(Platform::String^ recepientName, int64 recepientId, int64 callId, int64 callAccessHash) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); VoipPhoneCall^ outgoingCall = nullptr; // In this sample, we allow only one call at a time. if (this->activeCall != nullptr) { ::OutputDebugString(L"[CallController::InitiateOutgoingCall] => Only one active call allowed in this sample at a time\n"); // If we receive a request to initiate an outgoing call when another call is in progress, // we just ignore it. return false; } ::OutputDebugString(L"[CallController::InitiateOutgoingCall] => Starting outgoing call\n"); // Start a new outgoing call. this->callCoordinator->RequestNewOutgoingCall(this->callInProgressPageUri, recepientName, "Telegram", VoipCallMedia::Audio //| VoipCallMedia::Video , &outgoingCall); // Tell the phone service that this call is active. // Normally, we do this only when the remote party has accepted the call. outgoingCall->NotifyCallActive(); // Store it as the active call - assume we support both audio and video this->SetActiveCall(outgoingCall, recepientId, callId, callAccessHash, nullptr, true, nullptr, VoipCallMedia::Audio //| VoipCallMedia::Video ); return true; } bool CallController::OnIncomingCallReceived(Platform::String^ contactName, int64 contactId, Platform::String^ contactImage, int64 callId, int64 callAccessHash, IncomingCallDialogDismissedCallback^ incomingCallDialogDismissedCallback) { VoipPhoneCall^ incomingCall = nullptr; // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // TODO: If required, contact your cloud service here for more information about the incoming call. try { TimeSpan timeout; timeout.Duration = 25 * 10 * 1000 * 1000; // in 100ns units ::OutputDebugString(L"[CallController::OnIncomingCallReceived] => Will time out in 90 seconds\n"); // Store the caller number of this incoming call this->incomingId = contactId; this->incomingCallId = callId; this->incomingCallAccessHash = callAccessHash; // Store the callback that needs to be called when the incoming call dialog has been dismissed, // either because the call was accepted or rejected by the user. this->onIncomingCallDialogDismissed = incomingCallDialogDismissedCallback; //Windows::ApplicationModel::Package::Current->InstalledLocation->Path Uri^ contactImageUri = nullptr; if (contactImage != nullptr) { String^ localFolder = String::Concat(Windows::Storage::ApplicationData::Current->LocalFolder->Path, "\\"); contactImageUri = ref new Uri(localFolder, contactImage); } // Ask the Phone Service to start a new incoming call this->callCoordinator->RequestNewIncomingCall( this->callInProgressPageUri, contactName, "Telegram Call", contactImageUri, this->voipServiceName, this->brandingImageUri, "", // Was this call forwarded/delegated to this user on behalf of someone else? At this time, we won't use this field this->ringtoneUri, VoipCallMedia::Audio, // | VoipCallMedia::Video, timeout, // Maximum amount of time to ring for &incomingCall); } catch(...) { // Requesting an incoming call can fail if there is already an incoming call in progress. // This is rare, but possible. Treat this case like a missed call. ::OutputDebugString(L"[CallController::OnIncomingCallReceived] => An exception has occurred\n"); return false; } // Register for events about this incoming call. incomingCall->AnswerRequested += this->acceptCallRequestedHandler; incomingCall->RejectRequested += this->rejectCallRequestedHandler; return true; } bool CallController::HoldCall() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // Nothing to do - there is no call to put on hold return false; } ::OutputDebugString(L"[CallController::HoldCall] => Trying to put call on hold\n"); // Change the call status before notifying that the call is held because // access to the camera will be removed once NotifyCallHeld is called this->SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus::Held); // Hold the active call this->activeCall->NotifyCallHeld(); // TODO: Contact your cloud service and let it know that the active call has been put on hold. return true; } bool CallController::ResumeCall() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // Nothing to do - there is no call to resume return false; } ::OutputDebugString(L"[CallController::ResumeCall] => Trying to resume a call\n"); // Resume the active call this->activeCall->NotifyCallActive(); // TODO: Contact your cloud service and let it know that the active call has been resumed. // Change the call status after notifying that the call is active // if it is done before access to the camera will not have been granted yet this->SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus::InProgress); return true; } bool CallController::EndCall() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // Nothing to do - there is no call to end return false; } ::OutputDebugString(L"[CallController::EndCall] => Trying to end a call\n"); // Unregister from audio endpoint changes this->audioRoutingManager->AudioEndpointChanged -= this->audioEndpointChangedHandlercookie; // TODO: Contact your cloud service and let it know that the active call has ended. // End the active call. this->activeCall->NotifyCallEnded(); this->activeCall = nullptr; // Reset libtgvoip call params this->key = nullptr; this->callId = -1; this->callAccessHash = 0; this->otherPartyId = 0; this->emojis = nullptr; // Reset camera choice to front facing for next call this->cameraLocation = PhoneVoIPApp::BackEnd::CameraLocation::Front; // Change the call status this->SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus::None); return true; } bool CallController::ToggleCamera() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // Nothing to do - there is no call to end return false; } ::OutputDebugString(L"[CallController::ToggleCamera] => Trying to toggle the camera\n"); Globals::Instance->CaptureController->ToggleCamera(); return true; } PhoneVoIPApp::BackEnd::CallStatus CallController::CallStatus::get() { // No need to lock - this get is idempotent return this->callStatus; } PhoneVoIPApp::BackEnd::CameraLocation CallController::CameraLocation::get() { // No need to lock - this get is idempotent return this->cameraLocation; } PhoneVoIPApp::BackEnd::MediaOperations CallController::MediaOperations::get() { // No need to lock - this get is idempotent return this->mediaOperations; } bool CallController::IsShowingVideo::get() { // No need to lock - this get is idempotent return this->isShowingVideo; } void CallController::IsShowingVideo::set(bool value) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // Has anything changed? if (this->isShowingVideo == value) return; // No // Update the value this->isShowingVideo = value; // Start/stop video capture/render based on this change this->UpdateMediaOperations(); } bool CallController::IsRenderingVideo::get() { // No need to lock - this get is idempotent return this->isRenderingVideo; } void CallController::IsRenderingVideo::set(bool value) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // Has anything changed? if (this->isRenderingVideo == value) return; // No // Update the value this->isRenderingVideo = value; // Start/stop video capture/render based on this change this->UpdateMediaOperations(); } CallAudioRoute CallController::AvailableAudioRoutes::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // There is no call in progress return CallAudioRoute::None; } return (CallAudioRoute)(this->audioRoutingManager->AvailableAudioEndpoints); } CallAudioRoute CallController::AudioRoute::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall == nullptr) { // There is no call in progress return CallAudioRoute::None; } auto audioEndpoint = this->audioRoutingManager->GetAudioEndpoint(); switch(audioEndpoint) { case AudioRoutingEndpoint::Earpiece: case AudioRoutingEndpoint::WiredHeadset: case AudioRoutingEndpoint::WiredHeadsetSpeakerOnly: return CallAudioRoute::Earpiece; case AudioRoutingEndpoint::Default: case AudioRoutingEndpoint::Speakerphone: return CallAudioRoute::Speakerphone; case AudioRoutingEndpoint::Bluetooth: case AudioRoutingEndpoint::BluetoothWithNoiseAndEchoCancellation: return CallAudioRoute::Bluetooth; default: throw ref new FailureException("Unexpected audio routing endpoint"); } } void CallController::AudioRoute::set(CallAudioRoute newRoute) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->callStatus != PhoneVoIPApp::BackEnd::CallStatus::InProgress) { // There is no call in progress - do nothing return; } switch(newRoute) { case CallAudioRoute::Earpiece: this->audioRoutingManager->SetAudioEndpoint(AudioRoutingEndpoint::Earpiece); break; case CallAudioRoute::Speakerphone: this->audioRoutingManager->SetAudioEndpoint(AudioRoutingEndpoint::Speakerphone); break; case CallAudioRoute::Bluetooth: this->audioRoutingManager->SetAudioEndpoint(AudioRoutingEndpoint::Bluetooth); break; case CallAudioRoute::None: default: throw ref new FailureException("Cannot set audio route to CallAudioRoute::None"); } } Platform::String^ CallController::OtherPartyName::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->otherPartyName; } int64 CallController::OtherPartyId::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->otherPartyId; } Windows::Foundation::DateTime CallController::CallStartTime::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->activeCall != nullptr) { // There is a call in progress return this->activeCall->StartTime; } else { // There is no call in progress Windows::Foundation::DateTime minValue; minValue.UniversalTime = 0; return minValue; } } int64 CallController::CallId::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->callId; } int64 CallController::CallAccessHash::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->callAccessHash; } int64 CallController::AcceptedCallId::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->acceptedCallId; } void CallController::AcceptedCallId::set(int64 value) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); this->acceptedCallId = value; } Platform::Array^ CallController::Key::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->key; } bool CallController::Outgoing::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->outgoing; } Platform::Array^ CallController::Emojis::get() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); return this->emojis; } CallController::CallController() : wrapper(nullptr), callInProgressPageUri(L"/Views/ShellView.xaml"), voipServiceName(nullptr), defaultContactImageUri(nullptr), brandingImageUri(nullptr), ringtoneUri(nullptr), statusListener(nullptr), callStatus(PhoneVoIPApp::BackEnd::CallStatus::None), otherPartyName(nullptr), otherPartyId(-1), incomingId(-1), acceptedCallId(-1), key(nullptr), emojis(nullptr), mediaOperations(PhoneVoIPApp::BackEnd::MediaOperations::None), onIncomingCallDialogDismissed(nullptr), activeCall(nullptr), cameraLocation(PhoneVoIPApp::BackEnd::CameraLocation::Front) { this->stateListener = ref new LibTgVoipStateListener(); this->callCoordinator = VoipCallCoordinator::GetDefault(); this->audioRoutingManager = AudioRoutingManager::GetDefault(); // URIs required for interactions with the VoipCallCoordinator String^ installFolder = String::Concat(Windows::ApplicationModel::Package::Current->InstalledLocation->Path, "\\"); //this->defaultContactImageUri = ref new Uri(installFolder, "Assets\\DefaultContactImage.png"); this->voipServiceName = ref new String(L"Telegram"); this->brandingImageUri = ref new Uri(installFolder, "SquareTile150x150.png"); //this->ringtoneUri = ref new Uri(installFolder, "Assets\\Ringtone.wma"); // Event handler delegates - creating them once and storing them as member variables // avoids having to create new delegate objects for each phone call. this->acceptCallRequestedHandler = ref new TypedEventHandler(this, &CallController::OnAcceptCallRequested); this->rejectCallRequestedHandler = ref new TypedEventHandler(this, &CallController::OnRejectCallRequested); this->holdCallRequestedHandler = ref new TypedEventHandler(this, &CallController::OnHoldCallRequested); this->resumeCallRequestedHandler = ref new TypedEventHandler(this, &CallController::OnResumeCallRequested); this->endCallRequestedHandler = ref new TypedEventHandler(this, &CallController::OnEndCallRequested); this->audioEndpointChangedHandler = ref new TypedEventHandler(this, &CallController::OnAudioEndpointChanged); this->cameraLocationChangedHandler = ref new CameraLocationChangedEventHandler(this, &CallController::OnCameraLocationChanged); } CallController::~CallController() { } void CallController::SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus newStatus) { // No need to lock - private method if (newStatus == this->callStatus) return; // Nothing more to do // Change the call status this->callStatus = newStatus; // Update audio/video capture/render status, if required. this->UpdateMediaOperations(); // If required, let the UI know. if (this->statusListener != nullptr) { this->statusListener->OnCallStatusChanged(this->callStatus); } } void CallController::SetActiveCall(VoipPhoneCall^ call, int64 contactId, int64 callId, int64 callAccessHash, const Platform::Array^ key, bool outgoing, const Platform::Array^ emojis, VoipCallMedia callMedia) { // No need to lock - private method // The specified call is now active. // For an incoming call, this means that the local party has accepted the call. // For an outoing call, this means that the remote party has accepted the call. this->activeCall = call; // Listen to state changes of the active call. call->HoldRequested += this->holdCallRequestedHandler; call->ResumeRequested += this->resumeCallRequestedHandler; call->EndRequested += this->endCallRequestedHandler; // Register for audio endpoint changes this->audioEndpointChangedHandlercookie = this->audioRoutingManager->AudioEndpointChanged += this->audioEndpointChangedHandler; // Store information about the other party in the call this->otherPartyName = this->activeCall->ContactName; this->otherPartyId = contactId; this->callId = callId; this->callAccessHash = callAccessHash; if (key != nullptr) { this->key = ref new Platform::Array(key->Data, key->Length); } else { this->key = nullptr; } if (emojis != nullptr) { this->emojis = ref new Platform::Array(emojis->Data, emojis->Length); } else { this->emojis = nullptr; } this->outgoing = outgoing; // Change the call status this->SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus::InProgress); // Figure out if video/audio capture/render are all allowed PhoneVoIPApp::BackEnd::MediaOperations newOperations = PhoneVoIPApp::BackEnd::MediaOperations::None; if ((callMedia & VoipCallMedia::Audio) != VoipCallMedia::None) { // Enable both audio capture and render by default newOperations = PhoneVoIPApp::BackEnd::MediaOperations::AudioCapture | PhoneVoIPApp::BackEnd::MediaOperations::AudioRender; } if ((callMedia & VoipCallMedia::Video) != VoipCallMedia::None) { // Enable both video capture and render by default newOperations = newOperations | PhoneVoIPApp::BackEnd::MediaOperations::VideoCapture | PhoneVoIPApp::BackEnd::MediaOperations::VideoRender; } this->SetMediaOperations(newOperations); } void CallController::OnAcceptCallRequested(VoipPhoneCall^ sender, CallAnswerEventArgs^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); ::OutputDebugString(L"[CallController::OnAcceptCallRequested] => Incoming call accepted\n"); // The local user has accepted an incoming call. VoipPhoneCall^ incomingCall = (VoipPhoneCall^)sender; // If there is was a call already in progress, end it // As of now, we support only one call at a time in this application this->EndCall(); // Reset camera choice to front facing for next call this->cameraLocation = PhoneVoIPApp::BackEnd::CameraLocation::Front; // The incoming call is the new active call. incomingCall->NotifyCallActive(); this->acceptedCallId = this->incomingCallId; // Let the incoming call agent know that incoming call processing is now complete if (this->onIncomingCallDialogDismissed != nullptr) this->onIncomingCallDialogDismissed(this->incomingCallId, this->incomingCallAccessHash, false); // Store it as the active call. this->SetActiveCall(incomingCall, this->incomingId, this->incomingCallId, this->incomingCallAccessHash, nullptr, false, nullptr, args->AcceptedMedia); } void CallController::OnRejectCallRequested(VoipPhoneCall^ sender, CallRejectEventArgs^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); ::OutputDebugString(L"[CallController::OnRejectCallRequested] => Incoming call rejected\n"); // The local user has rejected an incoming call. VoipPhoneCall^ incomingCall = (VoipPhoneCall^)sender; // End it. incomingCall->NotifyCallEnded(); // TODO: Contact your cloud service and let it know that the incoming call was rejected. // Finally, let the incoming call agent know that incoming call processing is now complete this->onIncomingCallDialogDismissed(this->incomingCallId, this->incomingCallAccessHash, true); } void CallController::OnHoldCallRequested(VoipPhoneCall^ sender, CallStateChangeEventArgs^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // A request to put the active call on hold has been received. VoipPhoneCall^ callToPutOnHold = (VoipPhoneCall^)sender; // Sanity test. if (callToPutOnHold != this->activeCall) { throw ref new Platform::FailureException(L"Something is wrong. The call to put on hold is not the active call"); } // Put the active call on hold. this->HoldCall(); } void CallController::OnResumeCallRequested(VoipPhoneCall^ sender, CallStateChangeEventArgs^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // A request to resumed the active call has been received. VoipPhoneCall^ callToResume = (VoipPhoneCall^)sender; // Sanity test. if (callToResume != this->activeCall) { throw ref new Platform::FailureException(L"Something is wrong. The call to resume is not the active call"); } // Resume the active call this->ResumeCall(); } void CallController::OnEndCallRequested(VoipPhoneCall^ sender, CallStateChangeEventArgs^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // A request to end the active call has been received. VoipPhoneCall^ callToEnd = (VoipPhoneCall^)sender; // Sanity test. if (callToEnd != this->activeCall) { throw ref new Platform::FailureException(L"Something is wrong. The call to end is not the active call"); } // End the active call this->EndCall(); } void CallController::OnAudioEndpointChanged(AudioRoutingManager^ sender, Object^ args) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // If required, let the UI know. if ((this->activeCall != nullptr) && (this->statusListener != nullptr)) { this->statusListener->OnCallAudioRouteChanged(this->AudioRoute); } } void CallController::OnCameraLocationChanged(PhoneVoIPApp::BackEnd::CameraLocation newCameraLocation) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if(this->cameraLocation == newCameraLocation || this->activeCall == nullptr) { // nothing to do return; } this->cameraLocation = newCameraLocation; // If required, let the UI know. if ((this->statusListener != nullptr)) { this->statusListener->OnCameraLocationChanged(this->cameraLocation); } } void CallController::SetMediaOperations(PhoneVoIPApp::BackEnd::MediaOperations value) { // No need to lock - private method // Has anything changed? if (this->mediaOperations == value) return; // No // Update the value this->mediaOperations = value; // Start/stop video/audio capture based on this change this->UpdateMediaOperations(); } void CallController::UpdateMediaOperations() { // No need to lock - private method bool captureAudio = false, captureVideo = false, renderAudio = false, renderVideo = false; if (this->callStatus == PhoneVoIPApp::BackEnd::CallStatus::InProgress) { // A call is in progress // Start audio capture/render, if enabled captureAudio = ((this->mediaOperations & PhoneVoIPApp::BackEnd::MediaOperations::AudioCapture) != PhoneVoIPApp::BackEnd::MediaOperations::None); renderAudio = ((this->mediaOperations & PhoneVoIPApp::BackEnd::MediaOperations::AudioRender) != PhoneVoIPApp::BackEnd::MediaOperations::None); // Start video capture/render if enabled *and* the UI is showing video. if (this->isShowingVideo) { if(isRenderingVideo) { renderVideo = ((this->mediaOperations & PhoneVoIPApp::BackEnd::MediaOperations::VideoRender) != PhoneVoIPApp::BackEnd::MediaOperations::None); } // Does this phone have a camera? auto availableCameras = Windows::Phone::Media::Capture::AudioVideoCaptureDevice::AvailableSensorLocations; bool isCameraPresent = ((availableCameras != nullptr) && (availableCameras->Size > 0)); // Start capture only if there is a camera present if (isCameraPresent) { captureVideo = ((this->mediaOperations & PhoneVoIPApp::BackEnd::MediaOperations::VideoCapture) != PhoneVoIPApp::BackEnd::MediaOperations::None); } } } // else: call is not in progress - all capture/rendering should stop // What are the new media operations? PhoneVoIPApp::BackEnd::MediaOperations newOperations = PhoneVoIPApp::BackEnd::MediaOperations::None; // Start/stop audio capture and render if (captureAudio || renderAudio) { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Starting audio\n"); newOperations = newOperations | (PhoneVoIPApp::BackEnd::MediaOperations::AudioCapture | PhoneVoIPApp::BackEnd::MediaOperations::AudioRender); //Globals::Instance->AudioController->Start(); } else { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Stopping audio\n"); //Globals::Instance->AudioController->Stop(); } // Start/stop video render if (Globals::Instance->VideoRenderer != nullptr) { if (renderVideo) { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Starting video render\n"); newOperations = newOperations | PhoneVoIPApp::BackEnd::MediaOperations::VideoRender; Globals::Instance->VideoRenderer->Start(); } else { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Stopping video render\n"); Globals::Instance->VideoRenderer->Stop(); } if (captureVideo) { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Starting video capture\n"); newOperations = newOperations | PhoneVoIPApp::BackEnd::MediaOperations::VideoCapture; Globals::Instance->CaptureController->Start(cameraLocation); Globals::Instance->CaptureController->CameraLocationChanged += cameraLocationChangedHandler; } else { ::OutputDebugString(L"[CallController::UpdateMediaOperations] => Stopping video capture\n"); Globals::Instance->CaptureController->Stop(); } } // Let the listener know that the allowed media operation state has changed if (this->statusListener != nullptr) { this->statusListener->OnMediaOperationsChanged(newOperations); } } ================================================ FILE: BackEnd/CallController.h ================================================ /* Copyright (c) 2012 Microsoft Corporation. All rights reserved. Use of this sample source code is subject to the terms of the Microsoft license agreement under which you licensed this sample source code and is provided AS-IS. If you did not accept the terms of the license agreement, you are not authorized to use this sample source code. For the terms of the license, please see the license agreement between you and Microsoft. To see all Code Samples for Windows Phone, visit http://go.microsoft.com/fwlink/?LinkID=219604 */ #pragma once #include "BackEndCapture.h" #include #include "ICallControllerStatusListener.h" #include "IConfig.h" #include "ApiLock.h" namespace PhoneVoIPApp { namespace BackEnd { // Forward declaration ref class Globals; // A method that is called back when the incoming call dialog has been dismissed. // This callback is used to complete the incoming call agent. public delegate void IncomingCallDialogDismissedCallback(int64 callId, int64 callAccessHash, bool rejected); ref class LibTgVoipStateListener sealed { private: ICallControllerStatusListener^ statusListener; public: LibTgVoipStateListener(); void SetStatusCallback(ICallControllerStatusListener^ statusListener); virtual void OnCallStateChanged(libtgvoip::VoIPControllerWrapper^ sender, libtgvoip::CallState newState); virtual void OnSignalBarsChanged(libtgvoip::VoIPControllerWrapper^ sender, int signal); }; public value struct Config{ double InitTimeout; double RecvTimeout; DataSavingMode DataSavingMode; bool EnableAEC; bool EnableNS; bool EnableAGC; Platform::String^ LogFilePath; Platform::String^ StatsDumpFilePath; }; // A class that provides methods and properties related to VoIP calls. // It wraps Windows.Phone.Networking.Voip.VoipCallCoordinator, and provides app-specific call functionality. public ref class CallController sealed { public: // The public methods below are just for illustration purposes - add your own methods here // mtproto void HandleUpdatePhoneCall(); void StartMTProtoUpdater(); void StopMTProtoUpdater(); // libtgvoip void CreateVoIPControllerWrapper(); void DeleteVoIPControllerWrapper(); void SetConfig(Config config); void SetEncryptionKey(const Platform::Array^ key, bool isOutgoing); void SetPublicEndpoints(const Platform::Array^ endpoints, bool allowP2P, int connectionMaxLayer); void SetProxy(ProxyStruct proxy); void Start(); void Connect(); void SetMicMute(bool mute); void SwitchSpeaker(bool external); void UpdateServerConfig(Platform::String^ json); int64 GetPreferredRelayID(); Error GetLastError(); Platform::String^ GetDebugLog(); Platform::String^ GetDebugString(); Platform::String^ GetVersion(); int GetSignalBarsCount(); // Provide an inteface that can be used to get call controller status change notifications void SetStatusCallback(ICallControllerStatusListener^ statusListener); // Initiate an outgoing call. Called by the UI process. // Returns true if the outgoing call processing was started, false otherwise. bool InitiateOutgoingCall(Platform::String^ recepientName, int64 recepientId, int64 callId, int64 callAccessHash); bool InitiateOutgoingCall(Platform::String^ recepientName, int64 recepientId, int64 callId, int64 callAccessHash, Config config, const Platform::Array^ key, bool outgoing, const Platform::Array^ emojis, const Platform::Array^ endpoints, bool allowP2P, int connectionMaxLayer, ProxyStruct proxy); // Start processing an incoming call. Called by managed code in this process (the VoIP agent host process). // Returns true if the incoming call processing was started, false otherwise. bool OnIncomingCallReceived(Platform::String^ contactName, int64 contactId, Platform::String^ contactImage, int64 callId, int64 callAccessHash, IncomingCallDialogDismissedCallback^ incomingCallDialogDismissedCallback); // Hold a call. Called by the UI process. bool HoldCall(); // Resume a call. Called by the UI process. bool ResumeCall(); // End a call. Called by the UI process. bool EndCall(); // Toggle the camera location. Called by the UI process. bool ToggleCamera(); // Get the call state property PhoneVoIPApp::BackEnd::CallStatus CallStatus { PhoneVoIPApp::BackEnd::CallStatus get(); }; // Get or set the media operations that are allowed for a call. property PhoneVoIPApp::BackEnd::MediaOperations MediaOperations { PhoneVoIPApp::BackEnd::MediaOperations get(); } // Indicates if video is currently being displayed or not property bool IsShowingVideo { bool get(); void set(bool value); } // Indicates whether the video is being rendered or not. property bool IsRenderingVideo { bool get(); void set(bool value); } // Get the current camera location property PhoneVoIPApp::BackEnd::CameraLocation CameraLocation { PhoneVoIPApp::BackEnd::CameraLocation get(); } // Get the possible routes for audio property CallAudioRoute AvailableAudioRoutes { CallAudioRoute get(); } // Get or set the current route for audio property CallAudioRoute AudioRoute { CallAudioRoute get(); void set(CallAudioRoute newRoute); } // Get the name of the other party in the most recent call. // Can return nullptr if there hasn't been a call yet. property Platform::String^ OtherPartyName { Platform::String^ get(); } // Get the name of the other party in the most recent call. // Can return nullptr if there hasn't been a call yet. property int64 OtherPartyId { int64 get(); } // Get call start time property Windows::Foundation::DateTime CallStartTime { Windows::Foundation::DateTime get(); } property int64 CallId { int64 get(); } property int64 CallAccessHash { int64 get(); } property int64 AcceptedCallId { int64 get(); void set(int64 value); } property Platform::Array^ Key { Platform::Array^ get(); } property bool Outgoing { bool get(); } property Platform::Array^ Emojis { Platform::Array^ get(); } private: libtgvoip::VoIPControllerWrapper^ wrapper; LibTgVoipStateListener^ stateListener; // Only the server can create an instance of this object friend ref class PhoneVoIPApp::BackEnd::Globals; // Constructor and destructor CallController(); ~CallController(); // Set the call status void SetCallStatus(PhoneVoIPApp::BackEnd::CallStatus newStatus); // Indicates that a call is now active void SetActiveCall(Windows::Phone::Networking::Voip::VoipPhoneCall^ call, int64 contactId, int64 callId, int64 callAccessHash, const Platform::Array^ key, bool outgoing, const Platform::Array^ emojis, Windows::Phone::Networking::Voip::VoipCallMedia callMedia); // Called by the VoipCallCoordinator when the user accepts an incoming call. void OnAcceptCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallAnswerEventArgs^ args); // Called by the VoipCallCoordinator when the user rejects an incoming call. void OnRejectCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallRejectEventArgs^ args); // Called by the VoipCallCoordinator when a call is to be put on hold. void OnHoldCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallStateChangeEventArgs^ args); // Called by the VoipCallCoordinator when a call that was previously put on hold is to be resumed. void OnResumeCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallStateChangeEventArgs^ args); // Called by the VoipCallCoordinator when a call is to be ended. void OnEndCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallStateChangeEventArgs^ args); // Called by the AudioRoutingManager when call audio routing changes. void OnAudioEndpointChanged(Windows::Phone::Media::Devices::AudioRoutingManager^ sender, Platform::Object^ args); // Called by the BackEndCapture when the camera is toggled void OnCameraLocationChanged(PhoneVoIPApp::BackEnd::CameraLocation newCameraLocation); // Set a value that indicates if video/audio capture/render is enabled for a call or not. void SetMediaOperations(PhoneVoIPApp::BackEnd::MediaOperations value); // Start/stop video/audio capture/playback based on the current state. void UpdateMediaOperations(); // The relative URI to the call-in-progress page Platform::String ^callInProgressPageUri; // The name of this service provider Platform::String^ voipServiceName; // The URI to the default contact image Windows::Foundation::Uri^ defaultContactImageUri; // The URI to the branding image Windows::Foundation::Uri^ brandingImageUri; // The URI to the ringtone file Windows::Foundation::Uri^ ringtoneUri; // Interface used to deliver status callbacks ICallControllerStatusListener^ statusListener; // A VoIP call that is in progress Windows::Phone::Networking::Voip::VoipPhoneCall^ activeCall; // The status of a call, if any PhoneVoIPApp::BackEnd::CallStatus callStatus; // The name of the other party, if any Platform::String^ otherPartyName; // The id of the other party, if any int64 otherPartyId; int64 callId; int64 callAccessHash; // The id of the caller for the latest incoming call int64 incomingId; int64 incomingCallId; int64 incomingCallAccessHash; int64 acceptedCallId; Platform::Array^ key; bool outgoing; Platform::Array^ emojis; // Indicates if video/audio capture/render is enabled for a call or not. PhoneVoIPApp::BackEnd::MediaOperations mediaOperations; PhoneVoIPApp::BackEnd::CameraLocation cameraLocation; // Indicates if video is currently being displayed or not. bool isShowingVideo; bool isRenderingVideo; // The method to be called when the incoming call dialog box is dismissed IncomingCallDialogDismissedCallback^ onIncomingCallDialogDismissed; // The VoIP call coordinator Windows::Phone::Networking::Voip::VoipCallCoordinator^ callCoordinator; // The phone audio routing manager Windows::Phone::Media::Devices::AudioRoutingManager^ audioRoutingManager; // Phone call related event handlers Windows::Foundation::TypedEventHandler^ acceptCallRequestedHandler; Windows::Foundation::TypedEventHandler^ rejectCallRequestedHandler; Windows::Foundation::TypedEventHandler^ holdCallRequestedHandler; Windows::Foundation::TypedEventHandler^ resumeCallRequestedHandler; Windows::Foundation::TypedEventHandler^ endCallRequestedHandler; // Audio related event handlers Windows::Foundation::TypedEventHandler^ audioEndpointChangedHandler; // A cookie used to un-register the audio endpoint changed handler Windows::Foundation::EventRegistrationToken audioEndpointChangedHandlercookie; // Camera location related event handlers CameraLocationChangedEventHandler^ cameraLocationChangedHandler; }; } } ================================================ FILE: BackEnd/Globals.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include #include #include #include #include #include "Globals.h" #include "ApiLock.h" #include "CallController.h" #include "BackEndAudio.h" #include "BackEndCapture.h" using namespace PhoneVoIPApp::BackEnd; using namespace Windows::Foundation; using namespace Windows::Phone::Media::Capture; HRESULT __declspec(dllexport) MyGetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ IInspectable **factory) { *factory = nullptr; Microsoft::WRL::ComPtr activationFactory; auto &module = Microsoft::WRL::Module::GetModule(); HRESULT hr = module.GetActivationFactory(activatableClassId, &activationFactory); if (SUCCEEDED(hr)) { *factory = activationFactory.Detach(); if (*factory == nullptr) { return E_OUTOFMEMORY; } } return hr; } // Maximum number of characters required to contain the string version of an unsigned integer #define MAX_CHARS_IN_UINT_AS_STRING ((sizeof(unsigned int) * 4) + 1) const LPCWSTR Globals::noOtherBackgroundProcessEventName = L"PhoneVoIPApp.noOtherBackgroundProcess"; const LPCWSTR Globals::uiDisconnectedEventName = L"PhoneVoIPApp.uiDisconnected."; const LPCWSTR Globals::backgroundProcessReadyEventName = L"PhoneVoIPApp.backgroundProcessReady."; Globals^ Globals::singleton = nullptr; void Globals::StartServer(const Platform::Array^ outOfProcServerClassNames) { HRESULT hr = S_OK; // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (outOfProcServerClassNames == nullptr) { throw ref new Platform::InvalidArgumentException(L"outOfProcServerClassNames cannot be null"); } if (this->started) { return; // Nothing more to be done } // Set an event that indicates that the background process is ready. this->backgroundReadyEvent = ::CreateEventEx( NULL, Globals::GetBackgroundProcessReadyEventName(Globals::GetCurrentProcessId())->Data(), CREATE_EVENT_INITIAL_SET | CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); if (this->backgroundReadyEvent == NULL) { // Something went wrong DWORD dwErr = ::GetLastError(); hr = HRESULT_FROM_WIN32(dwErr); throw ref new Platform::COMException(hr, L"An error occurred trying to create an event that indicates that the background process is ready"); } // Set the event BOOL success = ::SetEvent(this->backgroundReadyEvent); if (success == FALSE) { DWORD dwErr = ::GetLastError(); hr = HRESULT_FROM_WIN32(dwErr); throw ref new Platform::COMException(hr, L"An error occurred trying to set an event that indicates that the background process is ready"); } this->started = true; } void Globals::DoPeriodicKeepAlive() { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); // TODO: Do stuff here - refresh tokens, get new certs from server, etc. } unsigned int Globals::GetCurrentProcessId() { return ::GetCurrentProcessId(); } Platform::String^ Globals::GetUiDisconnectedEventName(unsigned int backgroundProcessId) { WCHAR backgroundProcessIdString[MAX_CHARS_IN_UINT_AS_STRING]; if (swprintf_s<_countof(backgroundProcessIdString)>(backgroundProcessIdString, L"%u", backgroundProcessId) < 0) throw ref new Platform::FailureException(L"Could not create string version of background process id"); auto eventName = ref new Platform::String(Globals::uiDisconnectedEventName) + ref new Platform::String(backgroundProcessIdString); return eventName; } Platform::String^ Globals::GetBackgroundProcessReadyEventName(unsigned int backgroundProcessId) { WCHAR backgroundProcessIdString[MAX_CHARS_IN_UINT_AS_STRING]; if (swprintf_s<_countof(backgroundProcessIdString)>(backgroundProcessIdString, L"%u", backgroundProcessId) < 0) throw ref new Platform::FailureException(L"Could not create string version of background process id"); auto eventName = ref new Platform::String(Globals::backgroundProcessReadyEventName) + ref new Platform::String(backgroundProcessIdString); return eventName; } Globals^ Globals::Instance::get() { if (Globals::singleton == nullptr) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (Globals::singleton == nullptr) { Globals::singleton = ref new Globals(); } // else: some other thread has created an instance of the call controller } return Globals::singleton; } CallController^ Globals::CallController::get() { if (this->callController == nullptr) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); if (this->callController == nullptr) { this->callController = ref new PhoneVoIPApp::BackEnd::CallController(); } // else: some other thread has created an instance of the call controller } return this->callController; } IVideoRenderer^ Globals::VideoRenderer::get() { // No need to lock - this get is idempotent return this->videoRenderer; } void Globals::VideoRenderer::set(IVideoRenderer^ value) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); this->videoRenderer = value; } IMTProtoUpdater^ Globals::MTProtoUpdater::get() { // No need to lock - this get is idempotent return this->mtProtoUpdater; } void Globals::MTProtoUpdater::set(IMTProtoUpdater^ value) { // Make sure only one API call is in progress at a time std::lock_guard lock(g_apiLock); this->mtProtoUpdater = value; } //BackEndAudio^ Globals::AudioController::get() //{ // // No need to lock - this get is idempotent // return this->audioController; //} BackEndCapture^ Globals::CaptureController::get() { // No need to lock - this get is idempotent return this->captureController; } BackEndTransport^ Globals::TransportController::get() { // No need to lock - this get is idempotent return this->transportController; } Globals::Globals() : started(false), serverRegistrationCookie(NULL), callController(nullptr), videoRenderer(nullptr), noOtherBackgroundProcessEvent(NULL), backgroundReadyEvent(NULL), //audioController(nullptr), transportController(nullptr), captureController(nullptr) { { WCHAR szBuffer[256]; swprintf_s(szBuffer, L"[Globals::Globals] => VoIP background process with id %d starting up\n", this->GetCurrentProcessId()); ::OutputDebugString(szBuffer); } // Create an event that indicates if any other VoIP background exits or not this->noOtherBackgroundProcessEvent = ::CreateEventEx(NULL, Globals::noOtherBackgroundProcessEventName, CREATE_EVENT_INITIAL_SET | CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); if (this->noOtherBackgroundProcessEvent == NULL) { // Something went wrong DWORD dwErr = ::GetLastError(); HRESULT hr = HRESULT_FROM_WIN32(dwErr); throw ref new Platform::COMException(hr, L"An error occurred trying to create an event that indicates if the background process exists or not"); } // Wait for up to 30 seconds for the event to become set - if another instance of this process exists, this event would be in the reset state DWORD reason = ::WaitForSingleObjectEx(this->noOtherBackgroundProcessEvent, 30 * 1000, FALSE); _ASSERT(reason != WAIT_FAILED); // We don't care about any of the other reasons why WaitForSingleObjectEx returned if (reason == WAIT_TIMEOUT) { throw ref new Platform::FailureException(L"Another instance of the VoIP background process exists and that process did not exit within 30 seconds. Cannot continue."); } // Reset the event to indicate that there is a VoIP background process BOOL success = ::ResetEvent(this->noOtherBackgroundProcessEvent); if (success == FALSE) { // Something went wrong DWORD dwErr = ::GetLastError(); HRESULT hr = HRESULT_FROM_WIN32(dwErr); throw ref new Platform::COMException(hr, L"An error occurred trying to reset the event that indicates if the background process exists or not"); } // Initialize transport this->transportController = ref new BackEndTransport(); // local // Initialize audio controller //this->audioController = ref new BackEndAudio(); // Set the transport for audio //this->audioController->SetTransport(this->transportController); // Initialize capture controller this->captureController = ref new BackEndCapture(); // Set the transport on the controller this->captureController->SetTransport(this->transportController); // Initialize the call controller this->callController = ref new PhoneVoIPApp::BackEnd::CallController(); } Globals::~Globals() { // The destructor of this singleton object is called when the process is shutting down. // Before shutting down, make sure the UI process is not connected HANDLE uiDisconnectedEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, Globals::GetUiDisconnectedEventName(Globals::GetCurrentProcessId())->Data()); if (uiDisconnectedEvent != NULL) { // The event exists - wait for it to get signaled (for a maximum of 30 seconds) DWORD reason = ::WaitForSingleObjectEx(uiDisconnectedEvent, 30 * 1000, FALSE); _ASSERT(reason != WAIT_FAILED); // We don't care about any of the other reasons why WaitForSingleObjectEx returned } // At this point, the UI is no longer connected to the background process. // It is possible that the UI now reconnects to the background process - this would be a bug, // and we should exit the background process anyway. // Unset the event that indicates that the background process is ready BOOL success; if (this->backgroundReadyEvent != NULL) { success = ::ResetEvent(this->backgroundReadyEvent); _ASSERT(success); ::CloseHandle(this->backgroundReadyEvent); this->backgroundReadyEvent = NULL; } // Unregister the activation factories for out-of-process objects hosted in this process if (this->started) { RoRevokeActivationFactories(this->serverRegistrationCookie); } // Set the event that indicates that no instance of the VoIP background process exists if (this->noOtherBackgroundProcessEvent != NULL) { success = ::SetEvent(this->noOtherBackgroundProcessEvent); _ASSERT(success); ::CloseHandle(this->noOtherBackgroundProcessEvent); this->noOtherBackgroundProcessEvent = NULL; } { WCHAR szBuffer[256]; swprintf_s(szBuffer, L"[Globals::~Globals] => VoIP background process with id %d shutting down\n", this->GetCurrentProcessId()); ::OutputDebugString(szBuffer); } } ================================================ FILE: BackEnd/Globals.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include #include "IVideoRenderer.h" #include "IMTProtoUpdater.h" namespace PhoneVoIPApp { namespace BackEnd { // Forward declarations ref class CallController; //ref class BackEndAudio; ref class BackEndTransport; ref class BackEndCapture; // A singleton container that is used to hold other global singletons and background process-wide static state. // Another purpose of this class is to start the out-of-process WinRT server, so that the UI process // managed code can instantiate WinRT objects in this process. public ref class Globals sealed { public: // Start the out-of-process WinRT server, so that the UI process can instantiate WinRT objects in this process. void StartServer(const Platform::Array^ outOfProcServerClassNames); // Do some app-specific periodic tasks, to let the remote server know that this endpoint is still alive. void DoPeriodicKeepAlive(); // Get the process id of the current process static unsigned int GetCurrentProcessId(); // Get the name of the event that indicates if the UI is connected to the background process or not static Platform::String^ GetUiDisconnectedEventName(unsigned int backgroundProcessId); // Get the name of the event that indicates if the background process is ready or not static Platform::String^ GetBackgroundProcessReadyEventName(unsigned int backgroundProcessId); // Get the single instance of this class static property Globals^ Instance { Globals^ get(); } // Get the call controller singleton object property PhoneVoIPApp::BackEnd::CallController^ CallController { PhoneVoIPApp::BackEnd::CallController^ get(); } // The singleton video renderer object. property IVideoRenderer^ VideoRenderer { IVideoRenderer^ get(); void set(IVideoRenderer^ value); } property IMTProtoUpdater^ MTProtoUpdater { IMTProtoUpdater^ get(); void set(IMTProtoUpdater^ value); } // The singleton audio controller object. /*property BackEndAudio^ AudioController { BackEndAudio^ get(); }*/ // The singleton audio controller object. property BackEndCapture^ CaptureController { BackEndCapture^ get(); } // The singleton transport object. property BackEndTransport^ TransportController { BackEndTransport^ get(); } private: // Default constructor Globals(); // Destructor ~Globals(); // Name of the event that indicates if another instance of the VoIP background process exists or not static const LPCWSTR noOtherBackgroundProcessEventName; // Name of the event that indicates if the UI is connected to the background process or not static const LPCWSTR uiDisconnectedEventName; // Name of the event that indicates if the background process is ready or not static const LPCWSTR backgroundProcessReadyEventName; // The single instance of this class static Globals^ singleton; // Indicates if the out-of-process server has started or not bool started; // A cookie that is used to unregister remotely activatable objects in this process RO_REGISTRATION_COOKIE serverRegistrationCookie; // An event that indicates if another instance of the background process exists or not HANDLE noOtherBackgroundProcessEvent; // An event that indicates that the background process is ready HANDLE backgroundReadyEvent; // The call controller object PhoneVoIPApp::BackEnd::CallController^ callController; // The video renderer object PhoneVoIPApp::BackEnd::IVideoRenderer^ videoRenderer; PhoneVoIPApp::BackEnd::IMTProtoUpdater^ mtProtoUpdater; // The audio capture/render controller //BackEndAudio^ audioController; // The audio capture/render controller BackEndCapture^ captureController; // The data transport BackEndTransport^ transportController; }; } } ================================================ FILE: BackEnd/ICallControllerStatusListener.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include namespace PhoneVoIPApp { namespace BackEnd { // libtgvoip Endpoint public ref class Endpoint sealed{ public: property int64 id; property uint16 port; property Platform::String^ ipv4; property Platform::String^ ipv6; property Platform::Array^ peerTag; }; public value struct EndpointStruct{ int64 id; uint16 port; Platform::String^ ipv4; Platform::String^ ipv6; Platform::String^ peerTag; }; // libtgvoip ProxyProtocol public enum class ProxyProtocol : int{ None = (int)libtgvoip::ProxyProtocol::None, SOCKS5 = (int)libtgvoip::ProxyProtocol::SOCKS5 }; public value struct ProxyStruct{ ProxyProtocol protocol; Platform::String^ address; uint16 port; Platform::String^ username; Platform::String^ password; }; // libtgvoip CallState public enum class CallState : int{ WaitInit = (int)libtgvoip::CallState::WaitInit, WaitInitAck = (int)libtgvoip::CallState::WaitInitAck, Established = (int)libtgvoip::CallState::Established, Failed = (int)libtgvoip::CallState::Failed }; // libtgvoip Error public enum class Error : int{ Unknown = (int)libtgvoip::Error::Unknown, Incompatible = (int)libtgvoip::Error::Incompatible, Timeout = (int)libtgvoip::Error::Timeout, AudioIO = (int)libtgvoip::Error::AudioIO }; // libtgvoip NetworkType public enum class NetworkType : int{ Unknown = (int)libtgvoip::NetworkType::Unknown, GPRS = (int)libtgvoip::NetworkType::GPRS, EDGE = (int)libtgvoip::NetworkType::EDGE, UMTS = (int)libtgvoip::NetworkType::UMTS, HSPA = (int)libtgvoip::NetworkType::HSPA, LTE = (int)libtgvoip::NetworkType::LTE, WiFi = (int)libtgvoip::NetworkType::WiFi, Ethernet = (int)libtgvoip::NetworkType::Ethernet, OtherHighSpeed = (int)libtgvoip::NetworkType::OtherHighSpeed, OtherLowSpeed = (int)libtgvoip::NetworkType::OtherLowSpeed, Dialup = (int)libtgvoip::NetworkType::Dialup, OtherMobile = (int)libtgvoip::NetworkType::OtherMobile, }; // libtgvoip DataSavingMode public enum class DataSavingMode{ Never = (int)libtgvoip::DataSavingMode::Never, MobileOnly = (int)libtgvoip::DataSavingMode::MobileOnly, Always = (int)libtgvoip::DataSavingMode::Always }; // The status of a call public enum class CallStatus { None = 0x00, InProgress, Held }; // Where is the call audio going? public enum class CallAudioRoute { None = (int)Windows::Phone::Media::Devices::AvailableAudioRoutingEndpoints::None, Earpiece = (int)Windows::Phone::Media::Devices::AvailableAudioRoutingEndpoints::Earpiece, Speakerphone = (int)Windows::Phone::Media::Devices::AvailableAudioRoutingEndpoints::Speakerphone, Bluetooth = (int)Windows::Phone::Media::Devices::AvailableAudioRoutingEndpoints::Bluetooth }; // Which camera are we using? public enum class CameraLocation { Front = (int)Windows::Phone::Media::Capture::CameraSensorLocation::Front, Back = (int)Windows::Phone::Media::Capture::CameraSensorLocation::Back }; // Used to indicate the status of video/audio capture/render public enum class MediaOperations { None = 0x00, VideoCapture = 0x01, VideoRender = 0x02, AudioCapture = 0x04, AudioRender = 0x08 }; // An interface that is used by the call controller to deliver status change notifications. // This interface is meant to be implemented in the UI process, and will be called back by // the agent host process using out-of-process WinRT. public interface class ICallControllerStatusListener { void OnSignalBarsChanged(int newSignal); void OnCallStateChanged(CallState newState); // The status of a call has changed. void OnCallStatusChanged(CallStatus newStatus); // The call audio route has changed. Also called when the available audio routes have changed. void OnCallAudioRouteChanged(CallAudioRoute newRoute); // Video/audio capture/render has started/stopped void OnMediaOperationsChanged(MediaOperations newOperations); // Camera location has changed void OnCameraLocationChanged(CameraLocation newCameraLocation); }; } } ================================================ FILE: BackEnd/IConfig.h ================================================ #pragma once namespace PhoneVoIPApp { namespace BackEnd { public interface class IConfig { property double InitTimeout; property double RecvTimeout; }; } } ================================================ FILE: BackEnd/IMTProtoUpdater.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once namespace PhoneVoIPApp { namespace BackEnd { // An interface that is used by the call controller to start and stop mtproto communication. public interface class IMTProtoUpdater { // Start handle background updates. void Start(int pts, int date, int qts); // Stop handle background updates. void Stop(); // Discard incoming call void DiscardCall(int64 id, int64 accessHash); // Received incoming call void ReceivedCall(int64 id, int64 accessHash); }; } } ================================================ FILE: BackEnd/IVideoRenderer.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once namespace PhoneVoIPApp { namespace BackEnd { // An interface that is used by the call controller to start and stop video rendering. public interface class IVideoRenderer { // Start rendering video. void Start(); // Stop rendering video. void Stop(); }; } } ================================================ FILE: BackEnd/Server.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include #include "Globals.h" namespace PhoneVoIPApp { namespace BackEnd { namespace OutOfProcess { // A remotely activatable class that is used by the UI process and managed code within // the VoIP background process to get access to native objects that exist in the VoIP background process. public ref class Server sealed { public: // Constructor Server() { } // Destructor virtual ~Server() { } // Called by the UI process to get the call controller object property CallController^ CallController { PhoneVoIPApp::BackEnd::CallController^ get() { return Globals::Instance->CallController; }; } // Add methods and properties to get other objects here, as required. }; } } } ================================================ FILE: BackEndProxyStub/BackEndProxyStub.def ================================================ EXPORTS DllGetClassObject PRIVATE DllCanUnloadNow PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE ================================================ FILE: BackEndProxyStub/BackEndProxyStub.vcxproj ================================================  Debug Win32 Debug ARM Release Win32 Release ARM {bbabeea1-494c-4618-96e3-399873a5558b} BackEndProxyStub en-US $(VCTargetsPath11) 11.0 Windows Phone 8.0 Windows Phone Silverlight 8.1 DynamicLibrary true v120 false DynamicLibrary true v120 false DynamicLibrary false true v120 false DynamicLibrary false true v120 false false PhoneVoIPApp.$(ProjectName) $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ PhoneVoIPApp.$(ProjectName) $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ PhoneVoIPApp.$(ProjectName) $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ PhoneVoIPApp.$(ProjectName) $(SolutionDir)$(PlatformTarget)\$(Configuration)\$(MSBuildProjectName)\ $(PlatformTarget)\$(Configuration)\ WIN32_LEAN_AND_MEAN;WIN32;REGISTER_PROXY_DLL;_USRDLL;%(PreprocessorDefinitions) WIN32_LEAN_AND_MEAN;WIN32;REGISTER_PROXY_DLL;_USRDLL;NDEBUG;%(PreprocessorDefinitions) WIN32_LEAN_AND_MEAN;_ARM_;WIN32;REGISTER_PROXY_DLL;_USRDLL;%(PreprocessorDefinitions) WIN32_LEAN_AND_MEAN;_ARM_;WIN32;REGISTER_PROXY_DLL;_USRDLL;NDEBUG;%(PreprocessorDefinitions) NotUsing false $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) $(ProjectDir);%(AdditionalIncludeDirectories) $(ProjectDir);%(AdditionalIncludeDirectories) $(ProjectDir);%(AdditionalIncludeDirectories) $(ProjectDir);%(AdditionalIncludeDirectories) Console false windowsphonecore.lib;runtimeobject.lib;rpcrt4.lib;%(AdditionalDependencies) false $(ProjectName).def $(ProjectName).def $(ProjectName).def $(ProjectName).def true true false ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd.OutOfProcess.h ================================================ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:52 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.OutOfProcess.idl-5b92719d: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 475 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __PhoneVoIPApp2EBackEnd2EOutOfProcess_h__ #define __PhoneVoIPApp2EBackEnd2EOutOfProcess_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { namespace OutOfProcess { interface __IServerPublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FWD_DEFINED__ */ /* header files for imported files */ #include "inspectable.h" #include "AsyncInfo.h" #include "EventToken.h" #include "Windows.Foundation.h" #include "PhoneVoIPApp.BackEnd.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0000 */ /* [local] */ #if defined(__cplusplus) } #endif // defined(__cplusplus) #include #if !defined(__phonevoipapp2Ebackend_h__) #include #endif // !defined(__phonevoipapp2Ebackend_h__) #if defined(__cplusplus) extern "C" { #endif // defined(__cplusplus) #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class CallController; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { namespace OutOfProcess { class Server; } /*OutOfProcess*/ } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd_OutOfProcess___IServerPublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.OutOfProcess.__IServerPublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0000 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0000_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::OutOfProcess::__IServerPublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { namespace OutOfProcess { MIDL_INTERFACE("7BF79491-56BE-375A-BC22-0058B158F01F") __IServerPublicNonVirtuals : public IInspectable { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallController( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::__ICallControllerPublicNonVirtuals **__returnValue) = 0; }; extern const __declspec(selectany) IID & IID___IServerPublicNonVirtuals = __uuidof(__IServerPublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallController )( __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals **__returnValue); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_get_CallController(This,__returnValue) \ ( (This)->lpVtbl -> get_CallController(This,__returnValue) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0001 */ /* [local] */ #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_OutOfProcess_Server_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_OutOfProcess_Server_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_OutOfProcess_Server[] = L"PhoneVoIPApp.BackEnd.OutOfProcess.Server"; #endif /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0001 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0001_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0001_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd.OutOfProcess_i.c ================================================ /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ /* link this file in with the server and any clients */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:52 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.OutOfProcess.idl-5b92719d: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ #ifdef __cplusplus extern "C"{ #endif #include #include #ifdef _MIDL_USE_GUIDDEF_ #ifndef INITGUID #define INITGUID #include #undef INITGUID #else #include #endif #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) #else // !_MIDL_USE_GUIDDEF_ #ifndef __IID_DEFINED__ #define __IID_DEFINED__ typedef struct _IID { unsigned long x; unsigned short s1; unsigned short s2; unsigned char c[8]; } IID; #endif // __IID_DEFINED__ #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} #endif !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals,0x7BF79491,0x56BE,0x375A,0xBC,0x22,0x00,0x58,0xB1,0x58,0xF0,0x1F); #undef MIDL_DEFINE_GUID #ifdef __cplusplus } #endif ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd.OutOfProcess_p.c ================================================ /* this ALWAYS GENERATED file contains the proxy stub code */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:52 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.OutOfProcess.idl-5b92719d: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #if defined(_ARM_) #pragma warning( disable: 4049 ) /* more than 64k source lines */ #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning( disable: 4211 ) /* redefine extern to static */ #pragma warning( disable: 4232 ) /* dllimport identity*/ #pragma warning( disable: 4024 ) /* array to pointer mapping*/ #pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ #define USE_STUBLESS_PROXY /* verify that the version is high enough to compile this file*/ #ifndef __REDQ_RPCPROXY_H_VERSION__ #define __REQUIRED_RPCPROXY_H_VERSION__ 475 #endif #include "rpcproxy.h" #ifndef __RPCPROXY_H_VERSION__ #error this stub requires an updated version of #endif /* __RPCPROXY_H_VERSION__ */ #include "PhoneVoIPApp.BackEnd.OutOfProcess.h" #define TYPE_FORMAT_STRING_SIZE 25 #define PROC_FORMAT_STRING_SIZE 43 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 0 typedef struct _PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_TYPE_FORMAT_STRING { short Pad; unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_TYPE_FORMAT_STRING; typedef struct _PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_PROC_FORMAT_STRING { short Pad; unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_PROC_FORMAT_STRING; typedef struct _PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_EXPR_FORMAT_STRING { long Pad; unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_EXPR_FORMAT_STRING; static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; extern const PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_TYPE_FORMAT_STRING PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_TypeFormatString; extern const PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_PROC_FORMAT_STRING PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_ProcFormatString; extern const PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_EXPR_FORMAT_STRING PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_ExprFormatString; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ProxyInfo; #if !defined(__RPC_ARM32__) #error Invalid build platform for this stub. #endif #if !(TARGET_IS_NT50_OR_LATER) #error You need Windows 2000 or later to run this stub because it uses these features: #error /robust command line switch. #error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. #error This app will fail with the RPC_X_WRONG_STUB_VERSION error. #endif static const PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_PROC_FORMAT_STRING PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_ProcFormatString = { 0, { /* Procedure get_CallController */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x6 ), /* 6 */ /* 8 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 10 */ NdrFcShort( 0x0 ), /* 0 */ /* 12 */ NdrFcShort( 0x8 ), /* 8 */ /* 14 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 16 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 18 */ NdrFcShort( 0x0 ), /* 0 */ /* 20 */ NdrFcShort( 0x0 ), /* 0 */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x2 ), /* 2 */ /* 26 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 28 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 30 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 32 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 34 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ /* Return value */ /* 36 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 38 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 40 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 } }; static const PhoneVoIPApp2EBackEnd2EOutOfProcess_MIDL_TYPE_FORMAT_STRING PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_TypeFormatString = { 0, { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ /* 6 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 8 */ NdrFcLong( 0x6b50718 ), /* 112527128 */ /* 12 */ NdrFcShort( 0x3528 ), /* 13608 */ /* 14 */ NdrFcShort( 0x3b66 ), /* 15206 */ /* 16 */ 0xbe, /* 190 */ 0x76, /* 118 */ /* 18 */ 0xe1, /* 225 */ 0x83, /* 131 */ /* 20 */ 0xaa, /* 170 */ 0x80, /* 128 */ /* 22 */ 0xd4, /* 212 */ 0xa5, /* 165 */ 0x0 } }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0000, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: IUnknown, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ /* Object interface: IInspectable, ver. 0.0, GUID={0xAF86E2E0,0xB12D,0x4c6a,{0x9C,0x5A,0xD7,0xAA,0x65,0x10,0x1E,0x90}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals, ver. 0.0, GUID={0x7BF79491,0x56BE,0x375A,{0xBC,0x22,0x00,0x58,0xB1,0x58,0xF0,0x1F}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 0 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(7) ___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals::get_CallController */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_ServerInfo, 7, &__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd2EOutOfProcess_0000_0001, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ static const MIDL_STUB_DESC Object_StubDesc = { 0, NdrOleAllocate, NdrOleFree, 0, 0, 0, 0, 0, PhoneVoIPApp2EBackEnd2EOutOfProcess__MIDL_TypeFormatString.Format, 1, /* -error bounds_check flag */ 0x50002, /* Ndr library version */ 0, 0x800025b, /* MIDL Version 8.0.603 */ 0, 0, 0, /* notify & notify_flag routine table */ 0x1, /* MIDL flag */ 0, /* cs routines */ 0, /* proxy/server info */ 0 }; const CInterfaceProxyVtbl * const _PhoneVoIPApp2EBackEnd2EOutOfProcess_ProxyVtblList[] = { ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsProxyVtbl, 0 }; const CInterfaceStubVtbl * const _PhoneVoIPApp2EBackEnd2EOutOfProcess_StubVtblList[] = { ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtualsStubVtbl, 0 }; PCInterfaceName const _PhoneVoIPApp2EBackEnd2EOutOfProcess_InterfaceNamesList[] = { "__x_ABI_CPhoneVoIPApp_CBackEnd_COutOfProcess_C____IServerPublicNonVirtuals", 0 }; const IID * const _PhoneVoIPApp2EBackEnd2EOutOfProcess_BaseIIDList[] = { &IID_IInspectable, 0 }; #define _PhoneVoIPApp2EBackEnd2EOutOfProcess_CHECK_IID(n) IID_GENERIC_CHECK_IID( _PhoneVoIPApp2EBackEnd2EOutOfProcess, pIID, n) int __stdcall _PhoneVoIPApp2EBackEnd2EOutOfProcess_IID_Lookup( const IID * pIID, int * pIndex ) { if(!_PhoneVoIPApp2EBackEnd2EOutOfProcess_CHECK_IID(0)) { *pIndex = 0; return 1; } return 0; } const ExtendedProxyFileInfo PhoneVoIPApp2EBackEnd2EOutOfProcess_ProxyFileInfo = { (PCInterfaceProxyVtblList *) & _PhoneVoIPApp2EBackEnd2EOutOfProcess_ProxyVtblList, (PCInterfaceStubVtblList *) & _PhoneVoIPApp2EBackEnd2EOutOfProcess_StubVtblList, (const PCInterfaceName * ) & _PhoneVoIPApp2EBackEnd2EOutOfProcess_InterfaceNamesList, (const IID ** ) & _PhoneVoIPApp2EBackEnd2EOutOfProcess_BaseIIDList, & _PhoneVoIPApp2EBackEnd2EOutOfProcess_IID_Lookup, 1, 2, 0, /* table of [async_uuid] interfaces */ 0, /* Filler1 */ 0, /* Filler2 */ 0 /* Filler3 */ }; #if _MSC_VER >= 1200 #pragma warning(pop) #endif #endif /* if defined(_ARM_) */ ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd.h ================================================ /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:50 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.idl-35395493: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 475 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __PhoneVoIPApp2EBackEnd_h__ #define __PhoneVoIPApp2EBackEnd_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface IMessageReceivedEventHandler; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface ICameraLocationChangedEventHandler; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface IIncomingCallDialogDismissedCallback; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IBackEndTransportPublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IBackEndTransportProtectedNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IEndpointPublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface ICallControllerStatusListener; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IBackEndCapturePublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IBackEndCaptureProtectedNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface IConfig; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __ICallControllerPublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface IVideoRenderer; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface IMTProtoUpdater; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IGlobalsPublicNonVirtuals; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FWD_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FWD_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FWD_DEFINED__ typedef interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics; #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { interface __IGlobalsStatics; } /* end namespace */ } /* end namespace */ } /* end namespace */ #endif /* __cplusplus */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FWD_DEFINED__ */ /* header files for imported files */ #include "inspectable.h" #include "AsyncInfo.h" #include "EventToken.h" #include "Windows.Foundation.h" #include "Windows.Storage.Streams.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0000 */ /* [local] */ #if defined(__cplusplus) } #endif // defined(__cplusplus) #include #if !defined(__windows2Estorage2Estreams_h__) #include #endif // !defined(__windows2Estorage2Estreams_h__) #if defined(__cplusplus) extern "C" { #endif // defined(__cplusplus) #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyProtocol __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyProtocol; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallState __x_ABI_CPhoneVoIPApp_CBackEnd_CCallState; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CError __x_ABI_CPhoneVoIPApp_CBackEnd_CError; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CNetworkType __x_ABI_CPhoneVoIPApp_CBackEnd_CNetworkType; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CDataSavingMode __x_ABI_CPhoneVoIPApp_CBackEnd_CDataSavingMode; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallStatus __x_ABI_CPhoneVoIPApp_CBackEnd_CCallStatus; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) typedef enum __x_ABI_CPhoneVoIPApp_CBackEnd_CMediaOperations __x_ABI_CPhoneVoIPApp_CBackEnd_CMediaOperations; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CEndpointStruct __x_ABI_CPhoneVoIPApp_CBackEnd_CEndpointStruct; #endif #if !defined(__cplusplus) typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyStruct __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyStruct; #endif #if !defined(__cplusplus) typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CConfig __x_ABI_CPhoneVoIPApp_CBackEnd_CConfig; #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class BackEndTransport; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class Endpoint; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class BackEndCapture; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class CallController; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #ifdef __cplusplus namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { class Globals; } /*BackEnd*/ } /*PhoneVoIPApp*/ } #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyProtocol { ProxyProtocol_None = 0, ProxyProtocol_SOCKS5 = 1 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallState { CallState_WaitInit = 1, CallState_WaitInitAck = 2, CallState_Established = 3, CallState_Failed = 4 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CError { Error_Unknown = 0, Error_Incompatible = 1, Error_Timeout = 2, Error_AudioIO = 3 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CNetworkType { NetworkType_Unknown = 0, NetworkType_GPRS = 1, NetworkType_EDGE = 2, NetworkType_UMTS = 3, NetworkType_HSPA = 4, NetworkType_LTE = 5, NetworkType_WiFi = 6, NetworkType_Ethernet = 7, NetworkType_OtherHighSpeed = 8, NetworkType_OtherLowSpeed = 9, NetworkType_Dialup = 10, NetworkType_OtherMobile = 11 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CDataSavingMode { DataSavingMode_Never = 0, DataSavingMode_MobileOnly = 1, DataSavingMode_Always = 2 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallStatus { CallStatus_None = 0, CallStatus_InProgress = 1, CallStatus_Held = 2 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute { CallAudioRoute_None = 0, CallAudioRoute_Earpiece = 1, CallAudioRoute_Speakerphone = 2, CallAudioRoute_Bluetooth = 4 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation { CameraLocation_Front = 1, CameraLocation_Back = 0 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) #if !defined(__cplusplus) /* [v1_enum] */ enum __x_ABI_CPhoneVoIPApp_CBackEnd_CMediaOperations { MediaOperations_None = 0, MediaOperations_VideoCapture = 1, MediaOperations_VideoRender = 2, MediaOperations_AudioCapture = 4, MediaOperations_AudioRender = 8 } ; #endif /* end if !defined(__cplusplus) */ #endif #if !defined(__cplusplus) struct __x_ABI_CPhoneVoIPApp_CBackEnd_CEndpointStruct { INT64 id; UINT16 port; HSTRING ipv4; HSTRING ipv6; HSTRING peerTag; } ; #endif #if !defined(__cplusplus) struct __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyStruct { __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyProtocol protocol; HSTRING address; UINT16 port; HSTRING username; HSTRING password; } ; #endif #if !defined(__cplusplus) struct __x_ABI_CPhoneVoIPApp_CBackEnd_CConfig { DOUBLE InitTimeout; DOUBLE RecvTimeout; __x_ABI_CPhoneVoIPApp_CBackEnd_CDataSavingMode DataSavingMode; boolean EnableAEC; boolean EnableNS; boolean EnableAGC; HSTRING LogFilePath; HSTRING StatsDumpFilePath; } ; #endif /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0000 */ /* [local] */ #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum ProxyProtocol ProxyProtocol; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum CallState CallState; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum Error Error; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum NetworkType NetworkType; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum DataSavingMode DataSavingMode; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum CallStatus CallStatus; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum CallAudioRoute CallAudioRoute; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum CameraLocation CameraLocation; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef enum MediaOperations MediaOperations; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef struct EndpointStruct EndpointStruct; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef struct ProxyStruct ProxyStruct; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { typedef struct Config Config; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum ProxyProtocol { ProxyProtocol_None = 0, ProxyProtocol_SOCKS5 = 1 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum CallState { CallState_WaitInit = 1, CallState_WaitInitAck = 2, CallState_Established = 3, CallState_Failed = 4 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum Error { Error_Unknown = 0, Error_Incompatible = 1, Error_Timeout = 2, Error_AudioIO = 3 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum NetworkType { NetworkType_Unknown = 0, NetworkType_GPRS = 1, NetworkType_EDGE = 2, NetworkType_UMTS = 3, NetworkType_HSPA = 4, NetworkType_LTE = 5, NetworkType_WiFi = 6, NetworkType_Ethernet = 7, NetworkType_OtherHighSpeed = 8, NetworkType_OtherLowSpeed = 9, NetworkType_Dialup = 10, NetworkType_OtherMobile = 11 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum DataSavingMode { DataSavingMode_Never = 0, DataSavingMode_MobileOnly = 1, DataSavingMode_Always = 2 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum CallStatus { CallStatus_None = 0, CallStatus_InProgress = 1, CallStatus_Held = 2 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum CallAudioRoute { CallAudioRoute_None = 0, CallAudioRoute_Earpiece = 1, CallAudioRoute_Speakerphone = 2, CallAudioRoute_Bluetooth = 4 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum CameraLocation { CameraLocation_Front = 1, CameraLocation_Back = 0 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { /* [v1_enum] */ enum MediaOperations { MediaOperations_None = 0, MediaOperations_VideoCapture = 1, MediaOperations_VideoRender = 2, MediaOperations_AudioCapture = 4, MediaOperations_AudioRender = 8 } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { struct EndpointStruct { INT64 id; UINT16 port; HSTRING ipv4; HSTRING ipv6; HSTRING peerTag; } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { struct ProxyStruct { ProxyProtocol protocol; HSTRING address; UINT16 port; HSTRING username; HSTRING password; } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif #ifdef __cplusplus } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { struct Config { DOUBLE InitTimeout; DOUBLE RecvTimeout; DataSavingMode DataSavingMode; boolean EnableAEC; boolean EnableNS; boolean EnableAGC; HSTRING LogFilePath; HSTRING StatsDumpFilePath; } ; } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #endif extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0000_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::IMessageReceivedEventHandler */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("F2035E6A-8067-3ABB-A795-7B334C67A2ED") IMessageReceivedEventHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Invoke( /* [in] */ ABI::Windows::Storage::Streams::IBuffer *pBuffer, /* [in] */ UINT64 hnsPresentationTime, /* [in] */ UINT64 hnsSampleDuration) = 0; }; extern const __declspec(selectany) IID & IID_IMessageReceivedEventHandler = __uuidof(IMessageReceivedEventHandler); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler * This); HRESULT ( STDMETHODCALLTYPE *Invoke )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler * This, /* [in] */ __x_ABI_CWindows_CStorage_CStreams_CIBuffer *pBuffer, /* [in] */ UINT64 hnsPresentationTime, /* [in] */ UINT64 hnsSampleDuration); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_Invoke(This,pBuffer,hnsPresentationTime,hnsSampleDuration) \ ( (This)->lpVtbl -> Invoke(This,pBuffer,hnsPresentationTime,hnsSampleDuration) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_INTERFACE_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::ICameraLocationChangedEventHandler */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("1698B961-F90E-30D0-80FF-22E94CF66D7B") ICameraLocationChangedEventHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Invoke( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CameraLocation __param0) = 0; }; extern const __declspec(selectany) IID & IID_ICameraLocationChangedEventHandler = __uuidof(ICameraLocationChangedEventHandler); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler * This); HRESULT ( STDMETHODCALLTYPE *Invoke )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation __param0); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_Invoke(This,__param0) \ ( (This)->lpVtbl -> Invoke(This,__param0) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_INTERFACE_DEFINED__ */ #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::IIncomingCallDialogDismissedCallback */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("91DDEE70-AA90-38E7-B4E5-F7959569CB5C") IIncomingCallDialogDismissedCallback : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE Invoke( /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ boolean rejected) = 0; }; extern const __declspec(selectany) IID & IID_IIncomingCallDialogDismissedCallback = __uuidof(IIncomingCallDialogDismissedCallback); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback * This); HRESULT ( STDMETHODCALLTYPE *Invoke )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback * This, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ boolean rejected); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_Invoke(This,callId,callAccessHash,rejected) \ ( (This)->lpVtbl -> Invoke(This,callId,callAccessHash,rejected) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0003 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IBackEndTransportPublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IBackEndTransportPublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0003 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0003_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0003_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IBackEndTransportPublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("F5A3C2AE-EF7B-3DE2-8B0E-8E8B3CD20D9D") __IBackEndTransportPublicNonVirtuals : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE WriteAudio( /* [out] */ BYTE *bytes, /* [in] */ INT32 byteCount) = 0; virtual HRESULT STDMETHODCALLTYPE WriteVideo( /* [out] */ BYTE *bytes, /* [in] */ INT32 byteCount, /* [in] */ UINT64 hnsPresentationTime, /* [in] */ UINT64 hnsSampleDuration) = 0; virtual HRESULT STDMETHODCALLTYPE add_AudioMessageReceived( /* [in] */ ABI::PhoneVoIPApp::BackEnd::IMessageReceivedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE remove_AudioMessageReceived( /* [in] */ EventRegistrationToken __param0) = 0; virtual HRESULT STDMETHODCALLTYPE add_VideoMessageReceived( /* [in] */ ABI::PhoneVoIPApp::BackEnd::IMessageReceivedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE remove_VideoMessageReceived( /* [in] */ EventRegistrationToken __param0) = 0; }; extern const __declspec(selectany) IID & IID___IBackEndTransportPublicNonVirtuals = __uuidof(__IBackEndTransportPublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *WriteAudio )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [out] */ BYTE *bytes, /* [in] */ INT32 byteCount); HRESULT ( STDMETHODCALLTYPE *WriteVideo )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [out] */ BYTE *bytes, /* [in] */ INT32 byteCount, /* [in] */ UINT64 hnsPresentationTime, /* [in] */ UINT64 hnsSampleDuration); HRESULT ( STDMETHODCALLTYPE *add_AudioMessageReceived )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue); HRESULT ( STDMETHODCALLTYPE *remove_AudioMessageReceived )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [in] */ EventRegistrationToken __param0); HRESULT ( STDMETHODCALLTYPE *add_VideoMessageReceived )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue); HRESULT ( STDMETHODCALLTYPE *remove_VideoMessageReceived )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals * This, /* [in] */ EventRegistrationToken __param0); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_WriteAudio(This,bytes,byteCount) \ ( (This)->lpVtbl -> WriteAudio(This,bytes,byteCount) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_WriteVideo(This,bytes,byteCount,hnsPresentationTime,hnsSampleDuration) \ ( (This)->lpVtbl -> WriteVideo(This,bytes,byteCount,hnsPresentationTime,hnsSampleDuration) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_add_AudioMessageReceived(This,__param0,__returnValue) \ ( (This)->lpVtbl -> add_AudioMessageReceived(This,__param0,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_remove_AudioMessageReceived(This,__param0) \ ( (This)->lpVtbl -> remove_AudioMessageReceived(This,__param0) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_add_VideoMessageReceived(This,__param0,__returnValue) \ ( (This)->lpVtbl -> add_VideoMessageReceived(This,__param0,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_remove_VideoMessageReceived(This,__param0) \ ( (This)->lpVtbl -> remove_VideoMessageReceived(This,__param0) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0004 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IBackEndTransportProtectedNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IBackEndTransportProtectedNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0004 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0004_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0004_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IBackEndTransportProtectedNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("044DEA28-0E8D-3A16-A2C1-BE95C0BED5E5") __IBackEndTransportProtectedNonVirtuals : public IInspectable { public: }; extern const __declspec(selectany) IID & IID___IBackEndTransportProtectedNonVirtuals = __uuidof(__IBackEndTransportProtectedNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0005 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IEndpointPublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IEndpointPublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0005 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0005_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0005_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IEndpointPublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("0CC88A54-89AF-3CC6-9B95-F8F22428ABED") __IEndpointPublicNonVirtuals : public IInspectable { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_id( /* [out][retval] */ INT64 *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_id( /* [in] */ INT64 __set_formal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_port( /* [out][retval] */ UINT16 *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_port( /* [in] */ UINT16 __set_formal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ipv4( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ipv4( /* [in] */ HSTRING __set_formal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ipv6( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_ipv6( /* [in] */ HSTRING __set_formal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_peerTag( /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ BYTE **__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_peerTag( /* [in] */ UINT32 ____set_formalSize, /* [in][size_is] */ BYTE *__set_formal) = 0; }; extern const __declspec(selectany) IID & IID___IEndpointPublicNonVirtuals = __uuidof(__IEndpointPublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_id )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_id )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ INT64 __set_formal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_port )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out][retval] */ UINT16 *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_port )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ UINT16 __set_formal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ipv4 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ipv4 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ HSTRING __set_formal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ipv6 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_ipv6 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ HSTRING __set_formal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_peerTag )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ BYTE **__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_peerTag )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals * This, /* [in] */ UINT32 ____set_formalSize, /* [in][size_is] */ BYTE *__set_formal); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_get_id(This,__returnValue) \ ( (This)->lpVtbl -> get_id(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_put_id(This,__set_formal) \ ( (This)->lpVtbl -> put_id(This,__set_formal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_get_port(This,__returnValue) \ ( (This)->lpVtbl -> get_port(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_put_port(This,__set_formal) \ ( (This)->lpVtbl -> put_port(This,__set_formal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_get_ipv4(This,__returnValue) \ ( (This)->lpVtbl -> get_ipv4(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_put_ipv4(This,__set_formal) \ ( (This)->lpVtbl -> put_ipv4(This,__set_formal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_get_ipv6(This,__returnValue) \ ( (This)->lpVtbl -> get_ipv6(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_put_ipv6(This,__set_formal) \ ( (This)->lpVtbl -> put_ipv6(This,__set_formal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_get_peerTag(This,____returnValueSize,__returnValue) \ ( (This)->lpVtbl -> get_peerTag(This,____returnValueSize,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_put_peerTag(This,____set_formalSize,__set_formal) \ ( (This)->lpVtbl -> put_peerTag(This,____set_formalSize,__set_formal) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0006 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd_ICallControllerStatusListener[] = L"PhoneVoIPApp.BackEnd.ICallControllerStatusListener"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0006 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0006_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0006_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::ICallControllerStatusListener */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("39126060-0292-36D6-B3F8-9AC4156C651D") ICallControllerStatusListener : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE OnSignalBarsChanged( /* [in] */ INT32 newSignal) = 0; virtual HRESULT STDMETHODCALLTYPE OnCallStateChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CallState newState) = 0; virtual HRESULT STDMETHODCALLTYPE OnCallStatusChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CallStatus newStatus) = 0; virtual HRESULT STDMETHODCALLTYPE OnCallAudioRouteChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CallAudioRoute newRoute) = 0; virtual HRESULT STDMETHODCALLTYPE OnMediaOperationsChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::MediaOperations newOperations) = 0; virtual HRESULT STDMETHODCALLTYPE OnCameraLocationChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CameraLocation newCameraLocation) = 0; }; extern const __declspec(selectany) IID & IID_ICallControllerStatusListener = __uuidof(ICallControllerStatusListener); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *OnSignalBarsChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ INT32 newSignal); HRESULT ( STDMETHODCALLTYPE *OnCallStateChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallState newState); HRESULT ( STDMETHODCALLTYPE *OnCallStatusChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallStatus newStatus); HRESULT ( STDMETHODCALLTYPE *OnCallAudioRouteChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute newRoute); HRESULT ( STDMETHODCALLTYPE *OnMediaOperationsChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CMediaOperations newOperations); HRESULT ( STDMETHODCALLTYPE *OnCameraLocationChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation newCameraLocation); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnSignalBarsChanged(This,newSignal) \ ( (This)->lpVtbl -> OnSignalBarsChanged(This,newSignal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnCallStateChanged(This,newState) \ ( (This)->lpVtbl -> OnCallStateChanged(This,newState) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnCallStatusChanged(This,newStatus) \ ( (This)->lpVtbl -> OnCallStatusChanged(This,newStatus) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnCallAudioRouteChanged(This,newRoute) \ ( (This)->lpVtbl -> OnCallAudioRouteChanged(This,newRoute) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnMediaOperationsChanged(This,newOperations) \ ( (This)->lpVtbl -> OnMediaOperationsChanged(This,newOperations) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_OnCameraLocationChanged(This,newCameraLocation) \ ( (This)->lpVtbl -> OnCameraLocationChanged(This,newCameraLocation) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0007 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IBackEndCapturePublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IBackEndCapturePublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0007 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0007_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0007_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IBackEndCapturePublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("8313DBEA-FD3B-3071-8035-7B611658DAD8") __IBackEndCapturePublicNonVirtuals : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE SetTransport( /* [in] */ ABI::PhoneVoIPApp::BackEnd::__IBackEndTransportPublicNonVirtuals *transport) = 0; virtual HRESULT STDMETHODCALLTYPE Start( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CameraLocation cameraLocation) = 0; virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0; virtual HRESULT STDMETHODCALLTYPE ToggleCamera( void) = 0; virtual HRESULT STDMETHODCALLTYPE add_CameraLocationChanged( /* [in] */ ABI::PhoneVoIPApp::BackEnd::ICameraLocationChangedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE remove_CameraLocationChanged( /* [in] */ EventRegistrationToken __param0) = 0; }; extern const __declspec(selectany) IID & IID___IBackEndCapturePublicNonVirtuals = __uuidof(__IBackEndCapturePublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *SetTransport )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals *transport); HRESULT ( STDMETHODCALLTYPE *Start )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation cameraLocation); HRESULT ( STDMETHODCALLTYPE *Stop )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *ToggleCamera )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *add_CameraLocationChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler *__param0, /* [out][retval] */ EventRegistrationToken *__returnValue); HRESULT ( STDMETHODCALLTYPE *remove_CameraLocationChanged )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals * This, /* [in] */ EventRegistrationToken __param0); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_SetTransport(This,transport) \ ( (This)->lpVtbl -> SetTransport(This,transport) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_Start(This,cameraLocation) \ ( (This)->lpVtbl -> Start(This,cameraLocation) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_Stop(This) \ ( (This)->lpVtbl -> Stop(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ToggleCamera(This) \ ( (This)->lpVtbl -> ToggleCamera(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_add_CameraLocationChanged(This,__param0,__returnValue) \ ( (This)->lpVtbl -> add_CameraLocationChanged(This,__param0,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_remove_CameraLocationChanged(This,__param0) \ ( (This)->lpVtbl -> remove_CameraLocationChanged(This,__param0) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0008 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IBackEndCaptureProtectedNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IBackEndCaptureProtectedNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0008 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0008_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0008_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IBackEndCaptureProtectedNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("64B31D5B-1A27-37A8-BCBC-C0BBD5314C79") __IBackEndCaptureProtectedNonVirtuals : public IInspectable { public: }; extern const __declspec(selectany) IID & IID___IBackEndCaptureProtectedNonVirtuals = __uuidof(__IBackEndCaptureProtectedNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0009 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd_IConfig[] = L"PhoneVoIPApp.BackEnd.IConfig"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0009 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0009_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0009_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::IConfig */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("A9F22E31-D4E1-3940-BA20-DCB20973B09F") IConfig : public IInspectable { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InitTimeout( /* [out][retval] */ DOUBLE *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_InitTimeout( /* [in] */ DOUBLE __set_formal) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RecvTimeout( /* [out][retval] */ DOUBLE *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_RecvTimeout( /* [in] */ DOUBLE __set_formal) = 0; }; extern const __declspec(selectany) IID & IID_IConfig = __uuidof(IConfig); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [out] */ TrustLevel *trustLevel); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InitTimeout )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [out][retval] */ DOUBLE *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_InitTimeout )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [in] */ DOUBLE __set_formal); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecvTimeout )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [out][retval] */ DOUBLE *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_RecvTimeout )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig * This, /* [in] */ DOUBLE __set_formal); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_get_InitTimeout(This,__returnValue) \ ( (This)->lpVtbl -> get_InitTimeout(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_put_InitTimeout(This,__set_formal) \ ( (This)->lpVtbl -> put_InitTimeout(This,__set_formal) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_get_RecvTimeout(This,__returnValue) \ ( (This)->lpVtbl -> get_RecvTimeout(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_put_RecvTimeout(This,__set_formal) \ ( (This)->lpVtbl -> put_RecvTimeout(This,__set_formal) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0010 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___ICallControllerPublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__ICallControllerPublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0010 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0010_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0010_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__ICallControllerPublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("06B50718-3528-3B66-BE76-E183AA80D4A5") __ICallControllerPublicNonVirtuals : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE HandleUpdatePhoneCall( void) = 0; virtual HRESULT STDMETHODCALLTYPE StartMTProtoUpdater( void) = 0; virtual HRESULT STDMETHODCALLTYPE StopMTProtoUpdater( void) = 0; virtual HRESULT STDMETHODCALLTYPE CreateVoIPControllerWrapper( void) = 0; virtual HRESULT STDMETHODCALLTYPE DeleteVoIPControllerWrapper( void) = 0; virtual HRESULT STDMETHODCALLTYPE SetConfig( /* [in] */ ABI::PhoneVoIPApp::BackEnd::Config config) = 0; virtual HRESULT STDMETHODCALLTYPE SetEncryptionKey( /* [in] */ UINT32 __keySize, /* [in][size_is] */ BYTE *key, /* [in] */ boolean isOutgoing) = 0; virtual HRESULT STDMETHODCALLTYPE SetPublicEndpoints( /* [in] */ UINT32 __endpointsSize, /* [in][size_is] */ ABI::PhoneVoIPApp::BackEnd::EndpointStruct *endpoints, /* [in] */ boolean allowP2P, /* [in] */ INT32 connectionMaxLayer) = 0; virtual HRESULT STDMETHODCALLTYPE SetProxy( /* [in] */ ABI::PhoneVoIPApp::BackEnd::ProxyStruct proxy) = 0; virtual HRESULT STDMETHODCALLTYPE Start( void) = 0; virtual HRESULT STDMETHODCALLTYPE Connect( void) = 0; virtual HRESULT STDMETHODCALLTYPE SetMicMute( /* [in] */ boolean mute) = 0; virtual HRESULT STDMETHODCALLTYPE SwitchSpeaker( /* [in] */ boolean external) = 0; virtual HRESULT STDMETHODCALLTYPE UpdateServerConfig( /* [in] */ HSTRING json) = 0; virtual HRESULT STDMETHODCALLTYPE GetPreferredRelayID( /* [out][retval] */ INT64 *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetLastError( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::Error *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetDebugLog( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetDebugString( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetVersion( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetSignalBarsCount( /* [out][retval] */ INT32 *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE SetStatusCallback( /* [in] */ ABI::PhoneVoIPApp::BackEnd::ICallControllerStatusListener *statusListener) = 0; virtual HRESULT STDMETHODCALLTYPE InitiateOutgoingCall2( /* [in] */ HSTRING recepientName, /* [in] */ INT64 recepientId, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE InitiateOutgoingCall1( /* [in] */ HSTRING recepientName, /* [in] */ INT64 recepientId, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ ABI::PhoneVoIPApp::BackEnd::Config config, /* [in] */ UINT32 __keySize, /* [in][size_is] */ BYTE *key, /* [in] */ boolean outgoing, /* [in] */ UINT32 __emojisSize, /* [in][size_is] */ HSTRING *emojis, /* [in] */ UINT32 __endpointsSize, /* [in][size_is] */ ABI::PhoneVoIPApp::BackEnd::EndpointStruct *endpoints, /* [in] */ boolean allowP2P, /* [in] */ INT32 connectionMaxLayer, /* [in] */ ABI::PhoneVoIPApp::BackEnd::ProxyStruct proxy, /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE OnIncomingCallReceived( /* [in] */ HSTRING contactName, /* [in] */ INT64 contactId, /* [in] */ HSTRING contactImage, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ ABI::PhoneVoIPApp::BackEnd::IIncomingCallDialogDismissedCallback *incomingCallDialogDismissedCallback, /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE HoldCall( /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE ResumeCall( /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE EndCall( /* [out][retval] */ boolean *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE ToggleCamera( /* [out][retval] */ boolean *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallStatus( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::CallStatus *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MediaOperations( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::MediaOperations *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsShowingVideo( /* [out][retval] */ boolean *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsShowingVideo( /* [in] */ boolean value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsRenderingVideo( /* [out][retval] */ boolean *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_IsRenderingVideo( /* [in] */ boolean value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CameraLocation( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::CameraLocation *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AvailableAudioRoutes( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::CallAudioRoute *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AudioRoute( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::CallAudioRoute *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AudioRoute( /* [in] */ ABI::PhoneVoIPApp::BackEnd::CallAudioRoute newRoute) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OtherPartyName( /* [out][retval] */ HSTRING *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OtherPartyId( /* [out][retval] */ INT64 *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallStartTime( /* [out][retval] */ ABI::Windows::Foundation::DateTime *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallId( /* [out][retval] */ INT64 *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallAccessHash( /* [out][retval] */ INT64 *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AcceptedCallId( /* [out][retval] */ INT64 *__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AcceptedCallId( /* [in] */ INT64 value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Key( /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ BYTE **__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Outgoing( /* [out][retval] */ boolean *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Emojis( /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ HSTRING **__returnValue) = 0; }; extern const __declspec(selectany) IID & IID___ICallControllerPublicNonVirtuals = __uuidof(__ICallControllerPublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *HandleUpdatePhoneCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *StartMTProtoUpdater )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *StopMTProtoUpdater )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *CreateVoIPControllerWrapper )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *DeleteVoIPControllerWrapper )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *SetConfig )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CConfig config); HRESULT ( STDMETHODCALLTYPE *SetEncryptionKey )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ UINT32 __keySize, /* [in][size_is] */ BYTE *key, /* [in] */ boolean isOutgoing); HRESULT ( STDMETHODCALLTYPE *SetPublicEndpoints )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ UINT32 __endpointsSize, /* [in][size_is] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CEndpointStruct *endpoints, /* [in] */ boolean allowP2P, /* [in] */ INT32 connectionMaxLayer); HRESULT ( STDMETHODCALLTYPE *SetProxy )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyStruct proxy); HRESULT ( STDMETHODCALLTYPE *Start )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *Connect )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *SetMicMute )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ boolean mute); HRESULT ( STDMETHODCALLTYPE *SwitchSpeaker )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ boolean external); HRESULT ( STDMETHODCALLTYPE *UpdateServerConfig )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ HSTRING json); HRESULT ( STDMETHODCALLTYPE *GetPreferredRelayID )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetLastError )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CError *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetDebugLog )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetDebugString )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetVersion )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetSignalBarsCount )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT32 *__returnValue); HRESULT ( STDMETHODCALLTYPE *SetStatusCallback )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener *statusListener); HRESULT ( STDMETHODCALLTYPE *InitiateOutgoingCall2 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ HSTRING recepientName, /* [in] */ INT64 recepientId, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *InitiateOutgoingCall1 )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ HSTRING recepientName, /* [in] */ INT64 recepientId, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CConfig config, /* [in] */ UINT32 __keySize, /* [in][size_is] */ BYTE *key, /* [in] */ boolean outgoing, /* [in] */ UINT32 __emojisSize, /* [in][size_is] */ HSTRING *emojis, /* [in] */ UINT32 __endpointsSize, /* [in][size_is] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CEndpointStruct *endpoints, /* [in] */ boolean allowP2P, /* [in] */ INT32 connectionMaxLayer, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CProxyStruct proxy, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *OnIncomingCallReceived )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ HSTRING contactName, /* [in] */ INT64 contactId, /* [in] */ HSTRING contactImage, /* [in] */ INT64 callId, /* [in] */ INT64 callAccessHash, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback *incomingCallDialogDismissedCallback, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *HoldCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *ResumeCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *EndCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); HRESULT ( STDMETHODCALLTYPE *ToggleCamera )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallStatus )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallStatus *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MediaOperations )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CMediaOperations *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsShowingVideo )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsShowingVideo )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ boolean value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsRenderingVideo )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_IsRenderingVideo )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ boolean value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CameraLocation )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCameraLocation *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AvailableAudioRoutes )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioRoute )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AudioRoute )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CCallAudioRoute newRoute); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OtherPartyName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ HSTRING *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OtherPartyId )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallStartTime )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CWindows_CFoundation_CDateTime *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallId )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallAccessHash )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AcceptedCallId )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ INT64 *__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_AcceptedCallId )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [in] */ INT64 value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Key )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ BYTE **__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Outgoing )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out][retval] */ boolean *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Emojis )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals * This, /* [out] */ UINT32 *____returnValueSize, /* [out][retval][size_is][size_is] */ HSTRING **__returnValue); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_HandleUpdatePhoneCall(This) \ ( (This)->lpVtbl -> HandleUpdatePhoneCall(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_StartMTProtoUpdater(This) \ ( (This)->lpVtbl -> StartMTProtoUpdater(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_StopMTProtoUpdater(This) \ ( (This)->lpVtbl -> StopMTProtoUpdater(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_CreateVoIPControllerWrapper(This) \ ( (This)->lpVtbl -> CreateVoIPControllerWrapper(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_DeleteVoIPControllerWrapper(This) \ ( (This)->lpVtbl -> DeleteVoIPControllerWrapper(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetConfig(This,config) \ ( (This)->lpVtbl -> SetConfig(This,config) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetEncryptionKey(This,__keySize,key,isOutgoing) \ ( (This)->lpVtbl -> SetEncryptionKey(This,__keySize,key,isOutgoing) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetPublicEndpoints(This,__endpointsSize,endpoints,allowP2P,connectionMaxLayer) \ ( (This)->lpVtbl -> SetPublicEndpoints(This,__endpointsSize,endpoints,allowP2P,connectionMaxLayer) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetProxy(This,proxy) \ ( (This)->lpVtbl -> SetProxy(This,proxy) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_Start(This) \ ( (This)->lpVtbl -> Start(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_Connect(This) \ ( (This)->lpVtbl -> Connect(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetMicMute(This,mute) \ ( (This)->lpVtbl -> SetMicMute(This,mute) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SwitchSpeaker(This,external) \ ( (This)->lpVtbl -> SwitchSpeaker(This,external) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_UpdateServerConfig(This,json) \ ( (This)->lpVtbl -> UpdateServerConfig(This,json) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetPreferredRelayID(This,__returnValue) \ ( (This)->lpVtbl -> GetPreferredRelayID(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetLastError(This,__returnValue) \ ( (This)->lpVtbl -> GetLastError(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetDebugLog(This,__returnValue) \ ( (This)->lpVtbl -> GetDebugLog(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetDebugString(This,__returnValue) \ ( (This)->lpVtbl -> GetDebugString(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetVersion(This,__returnValue) \ ( (This)->lpVtbl -> GetVersion(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_GetSignalBarsCount(This,__returnValue) \ ( (This)->lpVtbl -> GetSignalBarsCount(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_SetStatusCallback(This,statusListener) \ ( (This)->lpVtbl -> SetStatusCallback(This,statusListener) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_InitiateOutgoingCall2(This,recepientName,recepientId,callId,callAccessHash,__returnValue) \ ( (This)->lpVtbl -> InitiateOutgoingCall2(This,recepientName,recepientId,callId,callAccessHash,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_InitiateOutgoingCall1(This,recepientName,recepientId,callId,callAccessHash,config,__keySize,key,outgoing,__emojisSize,emojis,__endpointsSize,endpoints,allowP2P,connectionMaxLayer,proxy,__returnValue) \ ( (This)->lpVtbl -> InitiateOutgoingCall1(This,recepientName,recepientId,callId,callAccessHash,config,__keySize,key,outgoing,__emojisSize,emojis,__endpointsSize,endpoints,allowP2P,connectionMaxLayer,proxy,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_OnIncomingCallReceived(This,contactName,contactId,contactImage,callId,callAccessHash,incomingCallDialogDismissedCallback,__returnValue) \ ( (This)->lpVtbl -> OnIncomingCallReceived(This,contactName,contactId,contactImage,callId,callAccessHash,incomingCallDialogDismissedCallback,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_HoldCall(This,__returnValue) \ ( (This)->lpVtbl -> HoldCall(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ResumeCall(This,__returnValue) \ ( (This)->lpVtbl -> ResumeCall(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_EndCall(This,__returnValue) \ ( (This)->lpVtbl -> EndCall(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ToggleCamera(This,__returnValue) \ ( (This)->lpVtbl -> ToggleCamera(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_CallStatus(This,__returnValue) \ ( (This)->lpVtbl -> get_CallStatus(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_MediaOperations(This,__returnValue) \ ( (This)->lpVtbl -> get_MediaOperations(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_IsShowingVideo(This,__returnValue) \ ( (This)->lpVtbl -> get_IsShowingVideo(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_put_IsShowingVideo(This,value) \ ( (This)->lpVtbl -> put_IsShowingVideo(This,value) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_IsRenderingVideo(This,__returnValue) \ ( (This)->lpVtbl -> get_IsRenderingVideo(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_put_IsRenderingVideo(This,value) \ ( (This)->lpVtbl -> put_IsRenderingVideo(This,value) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_CameraLocation(This,__returnValue) \ ( (This)->lpVtbl -> get_CameraLocation(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_AvailableAudioRoutes(This,__returnValue) \ ( (This)->lpVtbl -> get_AvailableAudioRoutes(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_AudioRoute(This,__returnValue) \ ( (This)->lpVtbl -> get_AudioRoute(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_put_AudioRoute(This,newRoute) \ ( (This)->lpVtbl -> put_AudioRoute(This,newRoute) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_OtherPartyName(This,__returnValue) \ ( (This)->lpVtbl -> get_OtherPartyName(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_OtherPartyId(This,__returnValue) \ ( (This)->lpVtbl -> get_OtherPartyId(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_CallStartTime(This,__returnValue) \ ( (This)->lpVtbl -> get_CallStartTime(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_CallId(This,__returnValue) \ ( (This)->lpVtbl -> get_CallId(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_CallAccessHash(This,__returnValue) \ ( (This)->lpVtbl -> get_CallAccessHash(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_AcceptedCallId(This,__returnValue) \ ( (This)->lpVtbl -> get_AcceptedCallId(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_put_AcceptedCallId(This,value) \ ( (This)->lpVtbl -> put_AcceptedCallId(This,value) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_Key(This,____returnValueSize,__returnValue) \ ( (This)->lpVtbl -> get_Key(This,____returnValueSize,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_Outgoing(This,__returnValue) \ ( (This)->lpVtbl -> get_Outgoing(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_get_Emojis(This,____returnValueSize,__returnValue) \ ( (This)->lpVtbl -> get_Emojis(This,____returnValueSize,__returnValue) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0011 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd_IVideoRenderer[] = L"PhoneVoIPApp.BackEnd.IVideoRenderer"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0011 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0011_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0011_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::IVideoRenderer */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("6928CA7B-166D-3B37-9010-FBAB2C7E92B0") IVideoRenderer : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE Start( void) = 0; virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0; }; extern const __declspec(selectany) IID & IID_IVideoRenderer = __uuidof(IVideoRenderer); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *Start )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This); HRESULT ( STDMETHODCALLTYPE *Stop )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer * This); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_Start(This) \ ( (This)->lpVtbl -> Start(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_Stop(This) \ ( (This)->lpVtbl -> Stop(This) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0012 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd_IMTProtoUpdater[] = L"PhoneVoIPApp.BackEnd.IMTProtoUpdater"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0012 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0012_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0012_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::IMTProtoUpdater */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("4FA5F2C4-8612-35C9-BFAA-967C2C819FA7") IMTProtoUpdater : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE Start( /* [in] */ INT32 pts, /* [in] */ INT32 date, /* [in] */ INT32 qts) = 0; virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0; virtual HRESULT STDMETHODCALLTYPE DiscardCall( /* [in] */ INT64 id, /* [in] */ INT64 accessHash) = 0; virtual HRESULT STDMETHODCALLTYPE ReceivedCall( /* [in] */ INT64 id, /* [in] */ INT64 accessHash) = 0; }; extern const __declspec(selectany) IID & IID_IMTProtoUpdater = __uuidof(IMTProtoUpdater); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *Start )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [in] */ INT32 pts, /* [in] */ INT32 date, /* [in] */ INT32 qts); HRESULT ( STDMETHODCALLTYPE *Stop )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This); HRESULT ( STDMETHODCALLTYPE *DiscardCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [in] */ INT64 id, /* [in] */ INT64 accessHash); HRESULT ( STDMETHODCALLTYPE *ReceivedCall )( __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater * This, /* [in] */ INT64 id, /* [in] */ INT64 accessHash); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_Start(This,pts,date,qts) \ ( (This)->lpVtbl -> Start(This,pts,date,qts) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_Stop(This) \ ( (This)->lpVtbl -> Stop(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_DiscardCall(This,id,accessHash) \ ( (This)->lpVtbl -> DiscardCall(This,id,accessHash) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ReceivedCall(This,id,accessHash) \ ( (This)->lpVtbl -> ReceivedCall(This,id,accessHash) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0013 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IGlobalsPublicNonVirtuals[] = L"PhoneVoIPApp.BackEnd.__IGlobalsPublicNonVirtuals"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0013 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0013_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0013_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IGlobalsPublicNonVirtuals */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("C8AFE1A8-92FC-3783-9520-D6BBC507B24A") __IGlobalsPublicNonVirtuals : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE StartServer( /* [in] */ UINT32 __outOfProcServerClassNamesSize, /* [in][size_is] */ HSTRING *outOfProcServerClassNames) = 0; virtual HRESULT STDMETHODCALLTYPE DoPeriodicKeepAlive( void) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CallController( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::__ICallControllerPublicNonVirtuals **__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_VideoRenderer( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::IVideoRenderer **__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_VideoRenderer( /* [in] */ ABI::PhoneVoIPApp::BackEnd::IVideoRenderer *value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MTProtoUpdater( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::IMTProtoUpdater **__returnValue) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MTProtoUpdater( /* [in] */ ABI::PhoneVoIPApp::BackEnd::IMTProtoUpdater *value) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CaptureController( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::__IBackEndCapturePublicNonVirtuals **__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TransportController( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::__IBackEndTransportPublicNonVirtuals **__returnValue) = 0; }; extern const __declspec(selectany) IID & IID___IGlobalsPublicNonVirtuals = __uuidof(__IGlobalsPublicNonVirtuals); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *StartServer )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [in] */ UINT32 __outOfProcServerClassNamesSize, /* [in][size_is] */ HSTRING *outOfProcServerClassNames); HRESULT ( STDMETHODCALLTYPE *DoPeriodicKeepAlive )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CallController )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals **__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_VideoRenderer )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer **__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_VideoRenderer )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer *value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MTProtoUpdater )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater **__returnValue); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_MTProtoUpdater )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [in] */ __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater *value); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CaptureController )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals **__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TransportController )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals **__returnValue); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_StartServer(This,__outOfProcServerClassNamesSize,outOfProcServerClassNames) \ ( (This)->lpVtbl -> StartServer(This,__outOfProcServerClassNamesSize,outOfProcServerClassNames) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_DoPeriodicKeepAlive(This) \ ( (This)->lpVtbl -> DoPeriodicKeepAlive(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_get_CallController(This,__returnValue) \ ( (This)->lpVtbl -> get_CallController(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_get_VideoRenderer(This,__returnValue) \ ( (This)->lpVtbl -> get_VideoRenderer(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_put_VideoRenderer(This,value) \ ( (This)->lpVtbl -> put_VideoRenderer(This,value) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_get_MTProtoUpdater(This,__returnValue) \ ( (This)->lpVtbl -> get_MTProtoUpdater(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_put_MTProtoUpdater(This,value) \ ( (This)->lpVtbl -> put_MTProtoUpdater(This,value) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_get_CaptureController(This,__returnValue) \ ( (This)->lpVtbl -> get_CaptureController(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_get_TransportController(This,__returnValue) \ ( (This)->lpVtbl -> get_TransportController(This,__returnValue) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0014 */ /* [local] */ #if !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_INTERFACE_DEFINED__) extern const __declspec(selectany) _Null_terminated_ WCHAR InterfaceName_PhoneVoIPApp_BackEnd___IGlobalsStatics[] = L"PhoneVoIPApp.BackEnd.__IGlobalsStatics"; #endif /* !defined(____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_INTERFACE_DEFINED__) */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0014 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0014_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0014_v0_0_s_ifspec; #ifndef ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_INTERFACE_DEFINED__ #define ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_INTERFACE_DEFINED__ /* interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics */ /* [uuid][object] */ /* interface ABI::PhoneVoIPApp::BackEnd::__IGlobalsStatics */ /* [uuid][object] */ EXTERN_C const IID IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics; #if defined(__cplusplus) && !defined(CINTERFACE) } /* end extern "C" */ namespace ABI { namespace PhoneVoIPApp { namespace BackEnd { MIDL_INTERFACE("2C1E9C37-6827-38F7-857C-021642CA428B") __IGlobalsStatics : public IInspectable { public: virtual HRESULT STDMETHODCALLTYPE GetCurrentProcessId( /* [out][retval] */ UINT32 *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetUiDisconnectedEventName( /* [in] */ UINT32 backgroundProcessId, /* [out][retval] */ HSTRING *__returnValue) = 0; virtual HRESULT STDMETHODCALLTYPE GetBackgroundProcessReadyEventName( /* [in] */ UINT32 backgroundProcessId, /* [out][retval] */ HSTRING *__returnValue) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Instance( /* [out][retval] */ ABI::PhoneVoIPApp::BackEnd::__IGlobalsPublicNonVirtuals **__returnValue) = 0; }; extern const __declspec(selectany) IID & IID___IGlobalsStatics = __uuidof(__IGlobalsStatics); } /* end namespace */ } /* end namespace */ } /* end namespace */ extern "C" { #else /* C style interface */ typedef struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This); ULONG ( STDMETHODCALLTYPE *Release )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This); HRESULT ( STDMETHODCALLTYPE *GetIids )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [out] */ ULONG *iidCount, /* [size_is][size_is][out] */ IID **iids); HRESULT ( STDMETHODCALLTYPE *GetRuntimeClassName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [out] */ HSTRING *className); HRESULT ( STDMETHODCALLTYPE *GetTrustLevel )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [out] */ TrustLevel *trustLevel); HRESULT ( STDMETHODCALLTYPE *GetCurrentProcessId )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [out][retval] */ UINT32 *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetUiDisconnectedEventName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [in] */ UINT32 backgroundProcessId, /* [out][retval] */ HSTRING *__returnValue); HRESULT ( STDMETHODCALLTYPE *GetBackgroundProcessReadyEventName )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [in] */ UINT32 backgroundProcessId, /* [out][retval] */ HSTRING *__returnValue); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Instance )( __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics * This, /* [out][retval] */ __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals **__returnValue); END_INTERFACE } __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsVtbl; interface __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics { CONST_VTBL struct __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsVtbl *lpVtbl; }; #ifdef COBJMACROS #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetIids(This,iidCount,iids) \ ( (This)->lpVtbl -> GetIids(This,iidCount,iids) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetRuntimeClassName(This,className) \ ( (This)->lpVtbl -> GetRuntimeClassName(This,className) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetTrustLevel(This,trustLevel) \ ( (This)->lpVtbl -> GetTrustLevel(This,trustLevel) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetCurrentProcessId(This,__returnValue) \ ( (This)->lpVtbl -> GetCurrentProcessId(This,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetUiDisconnectedEventName(This,backgroundProcessId,__returnValue) \ ( (This)->lpVtbl -> GetUiDisconnectedEventName(This,backgroundProcessId,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_GetBackgroundProcessReadyEventName(This,backgroundProcessId,__returnValue) \ ( (This)->lpVtbl -> GetBackgroundProcessReadyEventName(This,backgroundProcessId,__returnValue) ) #define __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_get_Instance(This,__returnValue) \ ( (This)->lpVtbl -> get_Instance(This,__returnValue) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* ____x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0015 */ /* [local] */ #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_BackEndTransport_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_BackEndTransport_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_BackEndTransport[] = L"PhoneVoIPApp.BackEnd.BackEndTransport"; #endif #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_Endpoint_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_Endpoint_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_Endpoint[] = L"PhoneVoIPApp.BackEnd.Endpoint"; #endif #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_BackEndCapture_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_BackEndCapture_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_BackEndCapture[] = L"PhoneVoIPApp.BackEnd.BackEndCapture"; #endif #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_CallController_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_CallController_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_CallController[] = L"PhoneVoIPApp.BackEnd.CallController"; #endif #ifndef RUNTIMECLASS_PhoneVoIPApp_BackEnd_Globals_DEFINED #define RUNTIMECLASS_PhoneVoIPApp_BackEnd_Globals_DEFINED extern const __declspec(selectany) _Null_terminated_ WCHAR RuntimeClass_PhoneVoIPApp_BackEnd_Globals[] = L"PhoneVoIPApp.BackEnd.Globals"; #endif /* interface __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0015 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0015_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0015_v0_0_s_ifspec; /* Additional Prototypes for ALL interfaces */ unsigned long __RPC_USER HSTRING_UserSize( unsigned long *, unsigned long , HSTRING * ); unsigned char * __RPC_USER HSTRING_UserMarshal( unsigned long *, unsigned char *, HSTRING * ); unsigned char * __RPC_USER HSTRING_UserUnmarshal(unsigned long *, unsigned char *, HSTRING * ); void __RPC_USER HSTRING_UserFree( unsigned long *, HSTRING * ); /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd_i.c ================================================ /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ /* link this file in with the server and any clients */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:50 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.idl-35395493: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ #ifdef __cplusplus extern "C"{ #endif #include #include #ifdef _MIDL_USE_GUIDDEF_ #ifndef INITGUID #define INITGUID #include #undef INITGUID #else #include #endif #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) #else // !_MIDL_USE_GUIDDEF_ #ifndef __IID_DEFINED__ #define __IID_DEFINED__ typedef struct _IID { unsigned long x; unsigned short s1; unsigned short s2; unsigned char c[8]; } IID; #endif // __IID_DEFINED__ #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED #define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} #endif !_MIDL_USE_GUIDDEF_ MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler,0xF2035E6A,0x8067,0x3ABB,0xA7,0x95,0x7B,0x33,0x4C,0x67,0xA2,0xED); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler,0x1698B961,0xF90E,0x30D0,0x80,0xFF,0x22,0xE9,0x4C,0xF6,0x6D,0x7B); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback,0x91DDEE70,0xAA90,0x38E7,0xB4,0xE5,0xF7,0x95,0x95,0x69,0xCB,0x5C); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals,0xF5A3C2AE,0xEF7B,0x3DE2,0x8B,0x0E,0x8E,0x8B,0x3C,0xD2,0x0D,0x9D); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals,0x044DEA28,0x0E8D,0x3A16,0xA2,0xC1,0xBE,0x95,0xC0,0xBE,0xD5,0xE5); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals,0x0CC88A54,0x89AF,0x3CC6,0x9B,0x95,0xF8,0xF2,0x24,0x28,0xAB,0xED); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener,0x39126060,0x0292,0x36D6,0xB3,0xF8,0x9A,0xC4,0x15,0x6C,0x65,0x1D); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals,0x8313DBEA,0xFD3B,0x3071,0x80,0x35,0x7B,0x61,0x16,0x58,0xDA,0xD8); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals,0x64B31D5B,0x1A27,0x37A8,0xBC,0xBC,0xC0,0xBB,0xD5,0x31,0x4C,0x79); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig,0xA9F22E31,0xD4E1,0x3940,0xBA,0x20,0xDC,0xB2,0x09,0x73,0xB0,0x9F); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals,0x06B50718,0x3528,0x3B66,0xBE,0x76,0xE1,0x83,0xAA,0x80,0xD4,0xA5); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer,0x6928CA7B,0x166D,0x3B37,0x90,0x10,0xFB,0xAB,0x2C,0x7E,0x92,0xB0); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater,0x4FA5F2C4,0x8612,0x35C9,0xBF,0xAA,0x96,0x7C,0x2C,0x81,0x9F,0xA7); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals,0xC8AFE1A8,0x92FC,0x3783,0x95,0x20,0xD6,0xBB,0xC5,0x07,0xB2,0x4A); MIDL_DEFINE_GUID(IID, IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics,0x2C1E9C37,0x6827,0x38F7,0x85,0x7C,0x02,0x16,0x42,0xCA,0x42,0x8B); #undef MIDL_DEFINE_GUID #ifdef __cplusplus } #endif ================================================ FILE: BackEndProxyStub/PhoneVoIPApp.BackEnd_p.c ================================================ /* this ALWAYS GENERATED file contains the proxy stub code */ /* File created by MIDL compiler version 8.00.0603 */ /* at Tue Jan 29 08:48:50 2019 */ /* Compiler settings for C:\Users\evgeny\AppData\Local\Temp\PhoneVoIPApp.BackEnd.idl-35395493: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=ARM 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #if defined(_ARM_) #pragma warning( disable: 4049 ) /* more than 64k source lines */ #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning( disable: 4211 ) /* redefine extern to static */ #pragma warning( disable: 4232 ) /* dllimport identity*/ #pragma warning( disable: 4024 ) /* array to pointer mapping*/ #pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ #define USE_STUBLESS_PROXY /* verify that the version is high enough to compile this file*/ #ifndef __REDQ_RPCPROXY_H_VERSION__ #define __REQUIRED_RPCPROXY_H_VERSION__ 475 #endif #include "rpcproxy.h" #ifndef __RPCPROXY_H_VERSION__ #error this stub requires an updated version of #endif /* __RPCPROXY_H_VERSION__ */ #include "PhoneVoIPApp.BackEnd.h" #define TYPE_FORMAT_STRING_SIZE 575 #define PROC_FORMAT_STRING_SIZE 4275 #define EXPR_FORMAT_STRING_SIZE 1 #define TRANSMIT_AS_TABLE_SIZE 0 #define WIRE_MARSHAL_TABLE_SIZE 1 typedef struct _PhoneVoIPApp2EBackEnd_MIDL_TYPE_FORMAT_STRING { short Pad; unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd_MIDL_TYPE_FORMAT_STRING; typedef struct _PhoneVoIPApp2EBackEnd_MIDL_PROC_FORMAT_STRING { short Pad; unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd_MIDL_PROC_FORMAT_STRING; typedef struct _PhoneVoIPApp2EBackEnd_MIDL_EXPR_FORMAT_STRING { long Pad; unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; } PhoneVoIPApp2EBackEnd_MIDL_EXPR_FORMAT_STRING; static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; extern const PhoneVoIPApp2EBackEnd_MIDL_TYPE_FORMAT_STRING PhoneVoIPApp2EBackEnd__MIDL_TypeFormatString; extern const PhoneVoIPApp2EBackEnd_MIDL_PROC_FORMAT_STRING PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString; extern const PhoneVoIPApp2EBackEnd_MIDL_EXPR_FORMAT_STRING PhoneVoIPApp2EBackEnd__MIDL_ExprFormatString; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ProxyInfo; extern const MIDL_STUB_DESC Object_StubDesc; extern const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ServerInfo; extern const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ProxyInfo; extern const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ]; #if !defined(__RPC_ARM32__) #error Invalid build platform for this stub. #endif #if !(TARGET_IS_NT50_OR_LATER) #error You need Windows 2000 or later to run this stub because it uses these features: #error /robust command line switch. #error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. #error This app will fail with the RPC_X_WRONG_STUB_VERSION error. #endif static const PhoneVoIPApp2EBackEnd_MIDL_PROC_FORMAT_STRING PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString = { 0, { /* Procedure Invoke */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2 */ NdrFcLong( 0x0 ), /* 0 */ /* 6 */ NdrFcShort( 0x3 ), /* 3 */ /* 8 */ NdrFcShort( 0x1c ), /* ARM Stack size/offset = 28 */ /* 10 */ NdrFcShort( 0x20 ), /* 32 */ /* 12 */ NdrFcShort( 0x8 ), /* 8 */ /* 14 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x4, /* 4 */ /* 16 */ 0x12, /* 18 */ 0x1, /* Ext Flags: new corr desc, */ /* 18 */ NdrFcShort( 0x0 ), /* 0 */ /* 20 */ NdrFcShort( 0x0 ), /* 0 */ /* 22 */ NdrFcShort( 0x0 ), /* 0 */ /* 24 */ NdrFcShort( 0x6 ), /* 6 */ /* 26 */ 0x6, /* 6 */ 0x80, /* 128 */ /* 28 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 30 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 32 */ 0xfc, /* 252 */ 0x0, /* 0 */ /* Parameter pBuffer */ /* 34 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 36 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 38 */ NdrFcShort( 0x2 ), /* Type Offset=2 */ /* Parameter hnsPresentationTime */ /* 40 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 42 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 44 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter hnsSampleDuration */ /* 46 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 48 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 50 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 52 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 54 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 56 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Invoke */ /* 58 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 60 */ NdrFcLong( 0x0 ), /* 0 */ /* 64 */ NdrFcShort( 0x3 ), /* 3 */ /* 66 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 68 */ NdrFcShort( 0x8 ), /* 8 */ /* 70 */ NdrFcShort( 0x8 ), /* 8 */ /* 72 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 74 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 76 */ NdrFcShort( 0x0 ), /* 0 */ /* 78 */ NdrFcShort( 0x0 ), /* 0 */ /* 80 */ NdrFcShort( 0x0 ), /* 0 */ /* 82 */ NdrFcShort( 0x2 ), /* 2 */ /* 84 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 86 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __param0 */ /* 88 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 90 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 92 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 94 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 96 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 98 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Invoke */ /* 100 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 102 */ NdrFcLong( 0x0 ), /* 0 */ /* 106 */ NdrFcShort( 0x3 ), /* 3 */ /* 108 */ NdrFcShort( 0x20 ), /* ARM Stack size/offset = 32 */ /* 110 */ NdrFcShort( 0x25 ), /* 37 */ /* 112 */ NdrFcShort( 0x8 ), /* 8 */ /* 114 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x4, /* 4 */ /* 116 */ 0x12, /* 18 */ 0x1, /* Ext Flags: new corr desc, */ /* 118 */ NdrFcShort( 0x0 ), /* 0 */ /* 120 */ NdrFcShort( 0x0 ), /* 0 */ /* 122 */ NdrFcShort( 0x0 ), /* 0 */ /* 124 */ NdrFcShort( 0x7 ), /* 7 */ /* 126 */ 0x7, /* 7 */ 0x80, /* 128 */ /* 128 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 130 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 132 */ 0xfc, /* 252 */ 0xfc, /* 252 */ /* Parameter callId */ /* 134 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 136 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 138 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callAccessHash */ /* 140 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 142 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 144 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter rejected */ /* 146 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 148 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 150 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 152 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 154 */ NdrFcShort( 0x1c ), /* ARM Stack size/offset = 28 */ /* 156 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure WriteAudio */ /* 158 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 160 */ NdrFcLong( 0x0 ), /* 0 */ /* 164 */ NdrFcShort( 0x6 ), /* 6 */ /* 166 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 168 */ NdrFcShort( 0x8 ), /* 8 */ /* 170 */ NdrFcShort( 0x21 ), /* 33 */ /* 172 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x3, /* 3 */ /* 174 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 176 */ NdrFcShort( 0x0 ), /* 0 */ /* 178 */ NdrFcShort( 0x0 ), /* 0 */ /* 180 */ NdrFcShort( 0x0 ), /* 0 */ /* 182 */ NdrFcShort( 0x3 ), /* 3 */ /* 184 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 186 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter bytes */ /* 188 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 190 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 192 */ 0x1, /* FC_BYTE */ 0x0, /* 0 */ /* Parameter byteCount */ /* 194 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 196 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 198 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 200 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 202 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 204 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure WriteVideo */ /* 206 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 208 */ NdrFcLong( 0x0 ), /* 0 */ /* 212 */ NdrFcShort( 0x7 ), /* 7 */ /* 214 */ NdrFcShort( 0x24 ), /* ARM Stack size/offset = 36 */ /* 216 */ NdrFcShort( 0x28 ), /* 40 */ /* 218 */ NdrFcShort( 0x21 ), /* 33 */ /* 220 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x5, /* 5 */ /* 222 */ 0x14, /* 20 */ 0x1, /* Ext Flags: new corr desc, */ /* 224 */ NdrFcShort( 0x0 ), /* 0 */ /* 226 */ NdrFcShort( 0x0 ), /* 0 */ /* 228 */ NdrFcShort( 0x0 ), /* 0 */ /* 230 */ NdrFcShort( 0x8 ), /* 8 */ /* 232 */ 0x8, /* 8 */ 0x80, /* 128 */ /* 234 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 236 */ 0x9f, /* 159 */ 0x9d, /* 157 */ /* 238 */ 0xfc, /* 252 */ 0x4, /* 4 */ /* 240 */ 0x0, /* 0 */ 0x0, /* 0 */ /* Parameter bytes */ /* 242 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 244 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 246 */ 0x1, /* FC_BYTE */ 0x0, /* 0 */ /* Parameter byteCount */ /* 248 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 250 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 252 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter hnsPresentationTime */ /* 254 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 256 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 258 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter hnsSampleDuration */ /* 260 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 262 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 264 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 266 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 268 */ NdrFcShort( 0x20 ), /* ARM Stack size/offset = 32 */ /* 270 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure add_AudioMessageReceived */ /* 272 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 274 */ NdrFcLong( 0x0 ), /* 0 */ /* 278 */ NdrFcShort( 0x8 ), /* 8 */ /* 280 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 282 */ NdrFcShort( 0x0 ), /* 0 */ /* 284 */ NdrFcShort( 0x34 ), /* 52 */ /* 286 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x3, /* 3 */ /* 288 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 290 */ NdrFcShort( 0x0 ), /* 0 */ /* 292 */ NdrFcShort( 0x0 ), /* 0 */ /* 294 */ NdrFcShort( 0x0 ), /* 0 */ /* 296 */ NdrFcShort( 0x3 ), /* 3 */ /* 298 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 300 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter __param0 */ /* 302 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 304 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 306 */ NdrFcShort( 0x18 ), /* Type Offset=24 */ /* Parameter __returnValue */ /* 308 */ NdrFcShort( 0x2112 ), /* Flags: must free, out, simple ref, srv alloc size=8 */ /* 310 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 312 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* 314 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 316 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 318 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure remove_AudioMessageReceived */ /* 320 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 322 */ NdrFcLong( 0x0 ), /* 0 */ /* 326 */ NdrFcShort( 0x9 ), /* 9 */ /* 328 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 330 */ NdrFcShort( 0x18 ), /* 24 */ /* 332 */ NdrFcShort( 0x8 ), /* 8 */ /* 334 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 336 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 338 */ NdrFcShort( 0x0 ), /* 0 */ /* 340 */ NdrFcShort( 0x0 ), /* 0 */ /* 342 */ NdrFcShort( 0x0 ), /* 0 */ /* 344 */ NdrFcShort( 0x4 ), /* 4 */ /* 346 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 348 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 350 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter __param0 */ /* 352 */ NdrFcShort( 0x8a ), /* Flags: must free, in, by val, */ /* 354 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 356 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* 358 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 360 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 362 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure add_VideoMessageReceived */ /* 364 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 366 */ NdrFcLong( 0x0 ), /* 0 */ /* 370 */ NdrFcShort( 0xa ), /* 10 */ /* 372 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 374 */ NdrFcShort( 0x0 ), /* 0 */ /* 376 */ NdrFcShort( 0x34 ), /* 52 */ /* 378 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x3, /* 3 */ /* 380 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 382 */ NdrFcShort( 0x0 ), /* 0 */ /* 384 */ NdrFcShort( 0x0 ), /* 0 */ /* 386 */ NdrFcShort( 0x0 ), /* 0 */ /* 388 */ NdrFcShort( 0x3 ), /* 3 */ /* 390 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 392 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter __param0 */ /* 394 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 396 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 398 */ NdrFcShort( 0x18 ), /* Type Offset=24 */ /* Parameter __returnValue */ /* 400 */ NdrFcShort( 0x2112 ), /* Flags: must free, out, simple ref, srv alloc size=8 */ /* 402 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 404 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* 406 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 408 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 410 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure remove_CameraLocationChanged */ /* Procedure remove_VideoMessageReceived */ /* 412 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 414 */ NdrFcLong( 0x0 ), /* 0 */ /* 418 */ NdrFcShort( 0xb ), /* 11 */ /* 420 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 422 */ NdrFcShort( 0x18 ), /* 24 */ /* 424 */ NdrFcShort( 0x8 ), /* 8 */ /* 426 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 428 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 430 */ NdrFcShort( 0x0 ), /* 0 */ /* 432 */ NdrFcShort( 0x0 ), /* 0 */ /* 434 */ NdrFcShort( 0x0 ), /* 0 */ /* 436 */ NdrFcShort( 0x4 ), /* 4 */ /* 438 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 440 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 442 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter __param0 */ /* Parameter __param0 */ /* 444 */ NdrFcShort( 0x8a ), /* Flags: must free, in, by val, */ /* 446 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 448 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* Return value */ /* 450 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 452 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 454 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_id */ /* 456 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 458 */ NdrFcLong( 0x0 ), /* 0 */ /* 462 */ NdrFcShort( 0x6 ), /* 6 */ /* 464 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 466 */ NdrFcShort( 0x0 ), /* 0 */ /* 468 */ NdrFcShort( 0x2c ), /* 44 */ /* 470 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 472 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 474 */ NdrFcShort( 0x0 ), /* 0 */ /* 476 */ NdrFcShort( 0x0 ), /* 0 */ /* 478 */ NdrFcShort( 0x0 ), /* 0 */ /* 480 */ NdrFcShort( 0x2 ), /* 2 */ /* 482 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 484 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 486 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 488 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 490 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 492 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 494 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 496 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_id */ /* 498 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 500 */ NdrFcLong( 0x0 ), /* 0 */ /* 504 */ NdrFcShort( 0x7 ), /* 7 */ /* 506 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 508 */ NdrFcShort( 0x10 ), /* 16 */ /* 510 */ NdrFcShort( 0x8 ), /* 8 */ /* 512 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 514 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 516 */ NdrFcShort( 0x0 ), /* 0 */ /* 518 */ NdrFcShort( 0x0 ), /* 0 */ /* 520 */ NdrFcShort( 0x0 ), /* 0 */ /* 522 */ NdrFcShort( 0x4 ), /* 4 */ /* 524 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 526 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 528 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 530 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 532 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 534 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 536 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 538 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 540 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_port */ /* 542 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 544 */ NdrFcLong( 0x0 ), /* 0 */ /* 548 */ NdrFcShort( 0x8 ), /* 8 */ /* 550 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 552 */ NdrFcShort( 0x0 ), /* 0 */ /* 554 */ NdrFcShort( 0x22 ), /* 34 */ /* 556 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 558 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 560 */ NdrFcShort( 0x0 ), /* 0 */ /* 562 */ NdrFcShort( 0x0 ), /* 0 */ /* 564 */ NdrFcShort( 0x0 ), /* 0 */ /* 566 */ NdrFcShort( 0x2 ), /* 2 */ /* 568 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 570 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 572 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 574 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 576 */ 0x6, /* FC_SHORT */ 0x0, /* 0 */ /* Return value */ /* 578 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 580 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 582 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_port */ /* 584 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 586 */ NdrFcLong( 0x0 ), /* 0 */ /* 590 */ NdrFcShort( 0x9 ), /* 9 */ /* 592 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 594 */ NdrFcShort( 0x6 ), /* 6 */ /* 596 */ NdrFcShort( 0x8 ), /* 8 */ /* 598 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 600 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 602 */ NdrFcShort( 0x0 ), /* 0 */ /* 604 */ NdrFcShort( 0x0 ), /* 0 */ /* 606 */ NdrFcShort( 0x0 ), /* 0 */ /* 608 */ NdrFcShort( 0x2 ), /* 2 */ /* 610 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 612 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 614 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 616 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 618 */ 0x6, /* FC_SHORT */ 0x0, /* 0 */ /* Return value */ /* 620 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 622 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 624 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_ipv4 */ /* 626 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 628 */ NdrFcLong( 0x0 ), /* 0 */ /* 632 */ NdrFcShort( 0xa ), /* 10 */ /* 634 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 636 */ NdrFcShort( 0x0 ), /* 0 */ /* 638 */ NdrFcShort( 0x8 ), /* 8 */ /* 640 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 642 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 644 */ NdrFcShort( 0x1 ), /* 1 */ /* 646 */ NdrFcShort( 0x0 ), /* 0 */ /* 648 */ NdrFcShort( 0x0 ), /* 0 */ /* 650 */ NdrFcShort( 0x2 ), /* 2 */ /* 652 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 654 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 656 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 658 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 660 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 662 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 664 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 666 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_ipv4 */ /* 668 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 670 */ NdrFcLong( 0x0 ), /* 0 */ /* 674 */ NdrFcShort( 0xb ), /* 11 */ /* 676 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 678 */ NdrFcShort( 0x0 ), /* 0 */ /* 680 */ NdrFcShort( 0x8 ), /* 8 */ /* 682 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 684 */ 0xe, /* 14 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 686 */ NdrFcShort( 0x0 ), /* 0 */ /* 688 */ NdrFcShort( 0x1 ), /* 1 */ /* 690 */ NdrFcShort( 0x0 ), /* 0 */ /* 692 */ NdrFcShort( 0x2 ), /* 2 */ /* 694 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 696 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 698 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 700 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 702 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Return value */ /* 704 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 706 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 708 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_ipv6 */ /* 710 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 712 */ NdrFcLong( 0x0 ), /* 0 */ /* 716 */ NdrFcShort( 0xc ), /* 12 */ /* 718 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 720 */ NdrFcShort( 0x0 ), /* 0 */ /* 722 */ NdrFcShort( 0x8 ), /* 8 */ /* 724 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 726 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 728 */ NdrFcShort( 0x1 ), /* 1 */ /* 730 */ NdrFcShort( 0x0 ), /* 0 */ /* 732 */ NdrFcShort( 0x0 ), /* 0 */ /* 734 */ NdrFcShort( 0x2 ), /* 2 */ /* 736 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 738 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 740 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 742 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 744 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 746 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 748 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 750 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_ipv6 */ /* 752 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 754 */ NdrFcLong( 0x0 ), /* 0 */ /* 758 */ NdrFcShort( 0xd ), /* 13 */ /* 760 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 762 */ NdrFcShort( 0x0 ), /* 0 */ /* 764 */ NdrFcShort( 0x8 ), /* 8 */ /* 766 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 768 */ 0xe, /* 14 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 770 */ NdrFcShort( 0x0 ), /* 0 */ /* 772 */ NdrFcShort( 0x1 ), /* 1 */ /* 774 */ NdrFcShort( 0x0 ), /* 0 */ /* 776 */ NdrFcShort( 0x2 ), /* 2 */ /* 778 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 780 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 782 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 784 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 786 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Return value */ /* 788 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 790 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 792 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_peerTag */ /* 794 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 796 */ NdrFcLong( 0x0 ), /* 0 */ /* 800 */ NdrFcShort( 0xe ), /* 14 */ /* 802 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 804 */ NdrFcShort( 0x0 ), /* 0 */ /* 806 */ NdrFcShort( 0x24 ), /* 36 */ /* 808 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x3, /* 3 */ /* 810 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 812 */ NdrFcShort( 0x1 ), /* 1 */ /* 814 */ NdrFcShort( 0x0 ), /* 0 */ /* 816 */ NdrFcShort( 0x0 ), /* 0 */ /* 818 */ NdrFcShort( 0x3 ), /* 3 */ /* 820 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 822 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter ____returnValueSize */ /* 824 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 826 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 828 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 830 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */ /* 832 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 834 */ NdrFcShort( 0x76 ), /* Type Offset=118 */ /* Return value */ /* 836 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 838 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 840 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_peerTag */ /* 842 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 844 */ NdrFcLong( 0x0 ), /* 0 */ /* 848 */ NdrFcShort( 0xf ), /* 15 */ /* 850 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 852 */ NdrFcShort( 0x8 ), /* 8 */ /* 854 */ NdrFcShort( 0x8 ), /* 8 */ /* 856 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x3, /* 3 */ /* 858 */ 0xe, /* 14 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 860 */ NdrFcShort( 0x0 ), /* 0 */ /* 862 */ NdrFcShort( 0x1 ), /* 1 */ /* 864 */ NdrFcShort( 0x0 ), /* 0 */ /* 866 */ NdrFcShort( 0x3 ), /* 3 */ /* 868 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 870 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter ____set_formalSize */ /* 872 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 874 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 876 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 878 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 880 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 882 */ NdrFcShort( 0x8e ), /* Type Offset=142 */ /* Return value */ /* 884 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 886 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 888 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnSignalBarsChanged */ /* 890 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 892 */ NdrFcLong( 0x0 ), /* 0 */ /* 896 */ NdrFcShort( 0x6 ), /* 6 */ /* 898 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 900 */ NdrFcShort( 0x8 ), /* 8 */ /* 902 */ NdrFcShort( 0x8 ), /* 8 */ /* 904 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 906 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 908 */ NdrFcShort( 0x0 ), /* 0 */ /* 910 */ NdrFcShort( 0x0 ), /* 0 */ /* 912 */ NdrFcShort( 0x0 ), /* 0 */ /* 914 */ NdrFcShort( 0x2 ), /* 2 */ /* 916 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 918 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newSignal */ /* 920 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 922 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 924 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 926 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 928 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 930 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Start */ /* Procedure OnCallStateChanged */ /* 932 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 934 */ NdrFcLong( 0x0 ), /* 0 */ /* 938 */ NdrFcShort( 0x7 ), /* 7 */ /* 940 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 942 */ NdrFcShort( 0x8 ), /* 8 */ /* 944 */ NdrFcShort( 0x8 ), /* 8 */ /* 946 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 948 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 950 */ NdrFcShort( 0x0 ), /* 0 */ /* 952 */ NdrFcShort( 0x0 ), /* 0 */ /* 954 */ NdrFcShort( 0x0 ), /* 0 */ /* 956 */ NdrFcShort( 0x2 ), /* 2 */ /* 958 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 960 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter cameraLocation */ /* Parameter newState */ /* 962 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 964 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 966 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* Return value */ /* 968 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 970 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 972 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnCallStatusChanged */ /* 974 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 976 */ NdrFcLong( 0x0 ), /* 0 */ /* 980 */ NdrFcShort( 0x8 ), /* 8 */ /* 982 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 984 */ NdrFcShort( 0x8 ), /* 8 */ /* 986 */ NdrFcShort( 0x8 ), /* 8 */ /* 988 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 990 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 992 */ NdrFcShort( 0x0 ), /* 0 */ /* 994 */ NdrFcShort( 0x0 ), /* 0 */ /* 996 */ NdrFcShort( 0x0 ), /* 0 */ /* 998 */ NdrFcShort( 0x2 ), /* 2 */ /* 1000 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1002 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newStatus */ /* 1004 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1006 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1008 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 1010 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1012 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1014 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnCallAudioRouteChanged */ /* 1016 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1018 */ NdrFcLong( 0x0 ), /* 0 */ /* 1022 */ NdrFcShort( 0x9 ), /* 9 */ /* 1024 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1026 */ NdrFcShort( 0x8 ), /* 8 */ /* 1028 */ NdrFcShort( 0x8 ), /* 8 */ /* 1030 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1032 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1034 */ NdrFcShort( 0x0 ), /* 0 */ /* 1036 */ NdrFcShort( 0x0 ), /* 0 */ /* 1038 */ NdrFcShort( 0x0 ), /* 0 */ /* 1040 */ NdrFcShort( 0x2 ), /* 2 */ /* 1042 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1044 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newRoute */ /* 1046 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1048 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1050 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 1052 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1054 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1056 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnMediaOperationsChanged */ /* 1058 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1060 */ NdrFcLong( 0x0 ), /* 0 */ /* 1064 */ NdrFcShort( 0xa ), /* 10 */ /* 1066 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1068 */ NdrFcShort( 0x8 ), /* 8 */ /* 1070 */ NdrFcShort( 0x8 ), /* 8 */ /* 1072 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1074 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1076 */ NdrFcShort( 0x0 ), /* 0 */ /* 1078 */ NdrFcShort( 0x0 ), /* 0 */ /* 1080 */ NdrFcShort( 0x0 ), /* 0 */ /* 1082 */ NdrFcShort( 0x2 ), /* 2 */ /* 1084 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1086 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newOperations */ /* 1088 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1090 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1092 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 1094 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1096 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1098 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnCameraLocationChanged */ /* 1100 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1102 */ NdrFcLong( 0x0 ), /* 0 */ /* 1106 */ NdrFcShort( 0xb ), /* 11 */ /* 1108 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1110 */ NdrFcShort( 0x8 ), /* 8 */ /* 1112 */ NdrFcShort( 0x8 ), /* 8 */ /* 1114 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1116 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1118 */ NdrFcShort( 0x0 ), /* 0 */ /* 1120 */ NdrFcShort( 0x0 ), /* 0 */ /* 1122 */ NdrFcShort( 0x0 ), /* 0 */ /* 1124 */ NdrFcShort( 0x2 ), /* 2 */ /* 1126 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1128 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newCameraLocation */ /* 1130 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1132 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1134 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 1136 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1138 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1140 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetTransport */ /* 1142 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1144 */ NdrFcLong( 0x0 ), /* 0 */ /* 1148 */ NdrFcShort( 0x6 ), /* 6 */ /* 1150 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1152 */ NdrFcShort( 0x0 ), /* 0 */ /* 1154 */ NdrFcShort( 0x8 ), /* 8 */ /* 1156 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 1158 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1160 */ NdrFcShort( 0x0 ), /* 0 */ /* 1162 */ NdrFcShort( 0x0 ), /* 0 */ /* 1164 */ NdrFcShort( 0x0 ), /* 0 */ /* 1166 */ NdrFcShort( 0x2 ), /* 2 */ /* 1168 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1170 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter transport */ /* 1172 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 1174 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1176 */ NdrFcShort( 0x9a ), /* Type Offset=154 */ /* Return value */ /* 1178 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1180 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1182 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure StopMTProtoUpdater */ /* Procedure Stop */ /* 1184 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1186 */ NdrFcLong( 0x0 ), /* 0 */ /* 1190 */ NdrFcShort( 0x8 ), /* 8 */ /* 1192 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1194 */ NdrFcShort( 0x0 ), /* 0 */ /* 1196 */ NdrFcShort( 0x8 ), /* 8 */ /* 1198 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1200 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1202 */ NdrFcShort( 0x0 ), /* 0 */ /* 1204 */ NdrFcShort( 0x0 ), /* 0 */ /* 1206 */ NdrFcShort( 0x0 ), /* 0 */ /* 1208 */ NdrFcShort( 0x1 ), /* 1 */ /* 1210 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* Return value */ /* 1212 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1214 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1216 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure CreateVoIPControllerWrapper */ /* Procedure ToggleCamera */ /* 1218 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1220 */ NdrFcLong( 0x0 ), /* 0 */ /* 1224 */ NdrFcShort( 0x9 ), /* 9 */ /* 1226 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1228 */ NdrFcShort( 0x0 ), /* 0 */ /* 1230 */ NdrFcShort( 0x8 ), /* 8 */ /* 1232 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1234 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1236 */ NdrFcShort( 0x0 ), /* 0 */ /* 1238 */ NdrFcShort( 0x0 ), /* 0 */ /* 1240 */ NdrFcShort( 0x0 ), /* 0 */ /* 1242 */ NdrFcShort( 0x1 ), /* 1 */ /* 1244 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* Return value */ /* 1246 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1248 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1250 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure add_CameraLocationChanged */ /* 1252 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1254 */ NdrFcLong( 0x0 ), /* 0 */ /* 1258 */ NdrFcShort( 0xa ), /* 10 */ /* 1260 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 1262 */ NdrFcShort( 0x0 ), /* 0 */ /* 1264 */ NdrFcShort( 0x34 ), /* 52 */ /* 1266 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x3, /* 3 */ /* 1268 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1270 */ NdrFcShort( 0x0 ), /* 0 */ /* 1272 */ NdrFcShort( 0x0 ), /* 0 */ /* 1274 */ NdrFcShort( 0x0 ), /* 0 */ /* 1276 */ NdrFcShort( 0x3 ), /* 3 */ /* 1278 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 1280 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter __param0 */ /* 1282 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 1284 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1286 */ NdrFcShort( 0xac ), /* Type Offset=172 */ /* Parameter __returnValue */ /* 1288 */ NdrFcShort( 0x2112 ), /* Flags: must free, out, simple ref, srv alloc size=8 */ /* 1290 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1292 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* 1294 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1296 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1298 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_InitTimeout */ /* 1300 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1302 */ NdrFcLong( 0x0 ), /* 0 */ /* 1306 */ NdrFcShort( 0x6 ), /* 6 */ /* 1308 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1310 */ NdrFcShort( 0x0 ), /* 0 */ /* 1312 */ NdrFcShort( 0x2c ), /* 44 */ /* 1314 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1316 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1318 */ NdrFcShort( 0x0 ), /* 0 */ /* 1320 */ NdrFcShort( 0x0 ), /* 0 */ /* 1322 */ NdrFcShort( 0x0 ), /* 0 */ /* 1324 */ NdrFcShort( 0x2 ), /* 2 */ /* 1326 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1328 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 1330 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 1332 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1334 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Return value */ /* 1336 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1338 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1340 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_InitTimeout */ /* 1342 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1344 */ NdrFcLong( 0x0 ), /* 0 */ /* 1348 */ NdrFcShort( 0x7 ), /* 7 */ /* 1350 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 1352 */ NdrFcShort( 0x10 ), /* 16 */ /* 1354 */ NdrFcShort( 0x8 ), /* 8 */ /* 1356 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1358 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 1360 */ NdrFcShort( 0x0 ), /* 0 */ /* 1362 */ NdrFcShort( 0x0 ), /* 0 */ /* 1364 */ NdrFcShort( 0x0 ), /* 0 */ /* 1366 */ NdrFcShort( 0x4 ), /* 4 */ /* 1368 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 1370 */ 0x9f, /* 159 */ 0x84, /* 132 */ /* 1372 */ 0x85, /* 133 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 1374 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1376 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1378 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Return value */ /* 1380 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1382 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 1384 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_RecvTimeout */ /* 1386 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1388 */ NdrFcLong( 0x0 ), /* 0 */ /* 1392 */ NdrFcShort( 0x8 ), /* 8 */ /* 1394 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1396 */ NdrFcShort( 0x0 ), /* 0 */ /* 1398 */ NdrFcShort( 0x2c ), /* 44 */ /* 1400 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1402 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1404 */ NdrFcShort( 0x0 ), /* 0 */ /* 1406 */ NdrFcShort( 0x0 ), /* 0 */ /* 1408 */ NdrFcShort( 0x0 ), /* 0 */ /* 1410 */ NdrFcShort( 0x2 ), /* 2 */ /* 1412 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1414 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 1416 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 1418 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1420 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Return value */ /* 1422 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1424 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1426 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_RecvTimeout */ /* 1428 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1430 */ NdrFcLong( 0x0 ), /* 0 */ /* 1434 */ NdrFcShort( 0x9 ), /* 9 */ /* 1436 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 1438 */ NdrFcShort( 0x10 ), /* 16 */ /* 1440 */ NdrFcShort( 0x8 ), /* 8 */ /* 1442 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1444 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 1446 */ NdrFcShort( 0x0 ), /* 0 */ /* 1448 */ NdrFcShort( 0x0 ), /* 0 */ /* 1450 */ NdrFcShort( 0x0 ), /* 0 */ /* 1452 */ NdrFcShort( 0x4 ), /* 4 */ /* 1454 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 1456 */ 0x9f, /* 159 */ 0x84, /* 132 */ /* 1458 */ 0x85, /* 133 */ 0x0, /* 0 */ /* Parameter __set_formal */ /* 1460 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1462 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1464 */ 0xc, /* FC_DOUBLE */ 0x0, /* 0 */ /* Return value */ /* 1466 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1468 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 1470 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Start */ /* Procedure HandleUpdatePhoneCall */ /* 1472 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1474 */ NdrFcLong( 0x0 ), /* 0 */ /* 1478 */ NdrFcShort( 0x6 ), /* 6 */ /* 1480 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1482 */ NdrFcShort( 0x0 ), /* 0 */ /* 1484 */ NdrFcShort( 0x8 ), /* 8 */ /* 1486 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1488 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1490 */ NdrFcShort( 0x0 ), /* 0 */ /* 1492 */ NdrFcShort( 0x0 ), /* 0 */ /* 1494 */ NdrFcShort( 0x0 ), /* 0 */ /* 1496 */ NdrFcShort( 0x1 ), /* 1 */ /* 1498 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* Return value */ /* 1500 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1502 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1504 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure DoPeriodicKeepAlive */ /* Procedure Stop */ /* Procedure Stop */ /* Procedure StartMTProtoUpdater */ /* 1506 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1508 */ NdrFcLong( 0x0 ), /* 0 */ /* 1512 */ NdrFcShort( 0x7 ), /* 7 */ /* 1514 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1516 */ NdrFcShort( 0x0 ), /* 0 */ /* 1518 */ NdrFcShort( 0x8 ), /* 8 */ /* 1520 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1522 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1524 */ NdrFcShort( 0x0 ), /* 0 */ /* 1526 */ NdrFcShort( 0x0 ), /* 0 */ /* 1528 */ NdrFcShort( 0x0 ), /* 0 */ /* 1530 */ NdrFcShort( 0x1 ), /* 1 */ /* 1532 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* Return value */ /* Return value */ /* Return value */ /* 1534 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1536 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1538 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure DeleteVoIPControllerWrapper */ /* 1540 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1542 */ NdrFcLong( 0x0 ), /* 0 */ /* 1546 */ NdrFcShort( 0xa ), /* 10 */ /* 1548 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1550 */ NdrFcShort( 0x0 ), /* 0 */ /* 1552 */ NdrFcShort( 0x8 ), /* 8 */ /* 1554 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1556 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1558 */ NdrFcShort( 0x0 ), /* 0 */ /* 1560 */ NdrFcShort( 0x0 ), /* 0 */ /* 1562 */ NdrFcShort( 0x0 ), /* 0 */ /* 1564 */ NdrFcShort( 0x1 ), /* 1 */ /* 1566 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* 1568 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1570 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1572 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetConfig */ /* 1574 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1576 */ NdrFcLong( 0x0 ), /* 0 */ /* 1580 */ NdrFcShort( 0xb ), /* 11 */ /* 1582 */ NdrFcShort( 0x2c ), /* ARM Stack size/offset = 44 */ /* 1584 */ NdrFcShort( 0x0 ), /* 0 */ /* 1586 */ NdrFcShort( 0x8 ), /* 8 */ /* 1588 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 1590 */ 0x14, /* 20 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 1592 */ NdrFcShort( 0x0 ), /* 0 */ /* 1594 */ NdrFcShort( 0x1 ), /* 1 */ /* 1596 */ NdrFcShort( 0x0 ), /* 0 */ /* 1598 */ NdrFcShort( 0xa ), /* 10 */ /* 1600 */ 0x8, /* 8 */ 0x80, /* 128 */ /* 1602 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 1604 */ 0x83, /* 131 */ 0x9d, /* 157 */ /* 1606 */ 0xfc, /* 252 */ 0x6, /* 6 */ /* 1608 */ 0x0, /* 0 */ 0x0, /* 0 */ /* Parameter config */ /* 1610 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 1612 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1614 */ NdrFcShort( 0xc2 ), /* Type Offset=194 */ /* Return value */ /* 1616 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1618 */ NdrFcShort( 0x28 ), /* ARM Stack size/offset = 40 */ /* 1620 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetEncryptionKey */ /* 1622 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1624 */ NdrFcLong( 0x0 ), /* 0 */ /* 1628 */ NdrFcShort( 0xc ), /* 12 */ /* 1630 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 1632 */ NdrFcShort( 0xd ), /* 13 */ /* 1634 */ NdrFcShort( 0x8 ), /* 8 */ /* 1636 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x4, /* 4 */ /* 1638 */ 0x10, /* 16 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 1640 */ NdrFcShort( 0x0 ), /* 0 */ /* 1642 */ NdrFcShort( 0x1 ), /* 1 */ /* 1644 */ NdrFcShort( 0x0 ), /* 0 */ /* 1646 */ NdrFcShort( 0x4 ), /* 4 */ /* 1648 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 1650 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 1652 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter __keySize */ /* 1654 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1656 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1658 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter key */ /* 1660 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 1662 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1664 */ NdrFcShort( 0x8e ), /* Type Offset=142 */ /* Parameter isOutgoing */ /* 1666 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1668 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1670 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 1672 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1674 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 1676 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetPublicEndpoints */ /* 1678 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1680 */ NdrFcLong( 0x0 ), /* 0 */ /* 1684 */ NdrFcShort( 0xd ), /* 13 */ /* 1686 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 1688 */ NdrFcShort( 0x15 ), /* 21 */ /* 1690 */ NdrFcShort( 0x8 ), /* 8 */ /* 1692 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x5, /* 5 */ /* 1694 */ 0x10, /* 16 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 1696 */ NdrFcShort( 0x0 ), /* 0 */ /* 1698 */ NdrFcShort( 0x1 ), /* 1 */ /* 1700 */ NdrFcShort( 0x0 ), /* 0 */ /* 1702 */ NdrFcShort( 0x5 ), /* 5 */ /* 1704 */ 0x5, /* 5 */ 0x80, /* 128 */ /* 1706 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 1708 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* Parameter __endpointsSize */ /* 1710 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1712 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1714 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter endpoints */ /* 1716 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 1718 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1720 */ NdrFcShort( 0xf6 ), /* Type Offset=246 */ /* Parameter allowP2P */ /* 1722 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1724 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1726 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Parameter connectionMaxLayer */ /* 1728 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1730 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 1732 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 1734 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1736 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 1738 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetProxy */ /* 1740 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1742 */ NdrFcLong( 0x0 ), /* 0 */ /* 1746 */ NdrFcShort( 0xe ), /* 14 */ /* 1748 */ NdrFcShort( 0x1c ), /* ARM Stack size/offset = 28 */ /* 1750 */ NdrFcShort( 0x0 ), /* 0 */ /* 1752 */ NdrFcShort( 0x8 ), /* 8 */ /* 1754 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 1756 */ 0x12, /* 18 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 1758 */ NdrFcShort( 0x0 ), /* 0 */ /* 1760 */ NdrFcShort( 0x1 ), /* 1 */ /* 1762 */ NdrFcShort( 0x0 ), /* 0 */ /* 1764 */ NdrFcShort( 0x6 ), /* 6 */ /* 1766 */ 0x6, /* 6 */ 0x80, /* 128 */ /* 1768 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 1770 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 1772 */ 0xfc, /* 252 */ 0x0, /* 0 */ /* Parameter proxy */ /* 1774 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 1776 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1778 */ NdrFcShort( 0x10c ), /* Type Offset=268 */ /* Return value */ /* 1780 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1782 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 1784 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Start */ /* 1786 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1788 */ NdrFcLong( 0x0 ), /* 0 */ /* 1792 */ NdrFcShort( 0xf ), /* 15 */ /* 1794 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1796 */ NdrFcShort( 0x0 ), /* 0 */ /* 1798 */ NdrFcShort( 0x8 ), /* 8 */ /* 1800 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1802 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1804 */ NdrFcShort( 0x0 ), /* 0 */ /* 1806 */ NdrFcShort( 0x0 ), /* 0 */ /* 1808 */ NdrFcShort( 0x0 ), /* 0 */ /* 1810 */ NdrFcShort( 0x1 ), /* 1 */ /* 1812 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* 1814 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1816 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1818 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Connect */ /* 1820 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1822 */ NdrFcLong( 0x0 ), /* 0 */ /* 1826 */ NdrFcShort( 0x10 ), /* 16 */ /* 1828 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1830 */ NdrFcShort( 0x0 ), /* 0 */ /* 1832 */ NdrFcShort( 0x8 ), /* 8 */ /* 1834 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x1, /* 1 */ /* 1836 */ 0xc, /* 12 */ 0x1, /* Ext Flags: new corr desc, */ /* 1838 */ NdrFcShort( 0x0 ), /* 0 */ /* 1840 */ NdrFcShort( 0x0 ), /* 0 */ /* 1842 */ NdrFcShort( 0x0 ), /* 0 */ /* 1844 */ NdrFcShort( 0x1 ), /* 1 */ /* 1846 */ 0x1, /* 1 */ 0x80, /* 128 */ /* Return value */ /* 1848 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1850 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1852 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetMicMute */ /* 1854 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1856 */ NdrFcLong( 0x0 ), /* 0 */ /* 1860 */ NdrFcShort( 0x11 ), /* 17 */ /* 1862 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1864 */ NdrFcShort( 0x5 ), /* 5 */ /* 1866 */ NdrFcShort( 0x8 ), /* 8 */ /* 1868 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1870 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1872 */ NdrFcShort( 0x0 ), /* 0 */ /* 1874 */ NdrFcShort( 0x0 ), /* 0 */ /* 1876 */ NdrFcShort( 0x0 ), /* 0 */ /* 1878 */ NdrFcShort( 0x2 ), /* 2 */ /* 1880 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1882 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter mute */ /* 1884 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1886 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1888 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 1890 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1892 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1894 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SwitchSpeaker */ /* 1896 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1898 */ NdrFcLong( 0x0 ), /* 0 */ /* 1902 */ NdrFcShort( 0x12 ), /* 18 */ /* 1904 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1906 */ NdrFcShort( 0x5 ), /* 5 */ /* 1908 */ NdrFcShort( 0x8 ), /* 8 */ /* 1910 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1912 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1914 */ NdrFcShort( 0x0 ), /* 0 */ /* 1916 */ NdrFcShort( 0x0 ), /* 0 */ /* 1918 */ NdrFcShort( 0x0 ), /* 0 */ /* 1920 */ NdrFcShort( 0x2 ), /* 2 */ /* 1922 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1924 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter external */ /* 1926 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 1928 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1930 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 1932 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1934 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1936 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure UpdateServerConfig */ /* 1938 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1940 */ NdrFcLong( 0x0 ), /* 0 */ /* 1944 */ NdrFcShort( 0x13 ), /* 19 */ /* 1946 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1948 */ NdrFcShort( 0x0 ), /* 0 */ /* 1950 */ NdrFcShort( 0x8 ), /* 8 */ /* 1952 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 1954 */ 0xe, /* 14 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 1956 */ NdrFcShort( 0x0 ), /* 0 */ /* 1958 */ NdrFcShort( 0x1 ), /* 1 */ /* 1960 */ NdrFcShort( 0x0 ), /* 0 */ /* 1962 */ NdrFcShort( 0x2 ), /* 2 */ /* 1964 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 1966 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter json */ /* 1968 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 1970 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 1972 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Return value */ /* 1974 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 1976 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 1978 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetPreferredRelayID */ /* 1980 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 1982 */ NdrFcLong( 0x0 ), /* 0 */ /* 1986 */ NdrFcShort( 0x14 ), /* 20 */ /* 1988 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 1990 */ NdrFcShort( 0x0 ), /* 0 */ /* 1992 */ NdrFcShort( 0x2c ), /* 44 */ /* 1994 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 1996 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 1998 */ NdrFcShort( 0x0 ), /* 0 */ /* 2000 */ NdrFcShort( 0x0 ), /* 0 */ /* 2002 */ NdrFcShort( 0x0 ), /* 0 */ /* 2004 */ NdrFcShort( 0x2 ), /* 2 */ /* 2006 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2008 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2010 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2012 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2014 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 2016 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2018 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2020 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetLastError */ /* 2022 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2024 */ NdrFcLong( 0x0 ), /* 0 */ /* 2028 */ NdrFcShort( 0x15 ), /* 21 */ /* 2030 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2032 */ NdrFcShort( 0x0 ), /* 0 */ /* 2034 */ NdrFcShort( 0x24 ), /* 36 */ /* 2036 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2038 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2040 */ NdrFcShort( 0x0 ), /* 0 */ /* 2042 */ NdrFcShort( 0x0 ), /* 0 */ /* 2044 */ NdrFcShort( 0x0 ), /* 0 */ /* 2046 */ NdrFcShort( 0x2 ), /* 2 */ /* 2048 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2050 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2052 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2054 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2056 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 2058 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2060 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2062 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetDebugLog */ /* 2064 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2066 */ NdrFcLong( 0x0 ), /* 0 */ /* 2070 */ NdrFcShort( 0x16 ), /* 22 */ /* 2072 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2074 */ NdrFcShort( 0x0 ), /* 0 */ /* 2076 */ NdrFcShort( 0x8 ), /* 8 */ /* 2078 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 2080 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 2082 */ NdrFcShort( 0x1 ), /* 1 */ /* 2084 */ NdrFcShort( 0x0 ), /* 0 */ /* 2086 */ NdrFcShort( 0x0 ), /* 0 */ /* 2088 */ NdrFcShort( 0x2 ), /* 2 */ /* 2090 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2092 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2094 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 2096 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2098 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 2100 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2102 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2104 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetDebugString */ /* 2106 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2108 */ NdrFcLong( 0x0 ), /* 0 */ /* 2112 */ NdrFcShort( 0x17 ), /* 23 */ /* 2114 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2116 */ NdrFcShort( 0x0 ), /* 0 */ /* 2118 */ NdrFcShort( 0x8 ), /* 8 */ /* 2120 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 2122 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 2124 */ NdrFcShort( 0x1 ), /* 1 */ /* 2126 */ NdrFcShort( 0x0 ), /* 0 */ /* 2128 */ NdrFcShort( 0x0 ), /* 0 */ /* 2130 */ NdrFcShort( 0x2 ), /* 2 */ /* 2132 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2134 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2136 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 2138 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2140 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 2142 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2144 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2146 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetVersion */ /* 2148 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2150 */ NdrFcLong( 0x0 ), /* 0 */ /* 2154 */ NdrFcShort( 0x18 ), /* 24 */ /* 2156 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2158 */ NdrFcShort( 0x0 ), /* 0 */ /* 2160 */ NdrFcShort( 0x8 ), /* 8 */ /* 2162 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 2164 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 2166 */ NdrFcShort( 0x1 ), /* 1 */ /* 2168 */ NdrFcShort( 0x0 ), /* 0 */ /* 2170 */ NdrFcShort( 0x0 ), /* 0 */ /* 2172 */ NdrFcShort( 0x2 ), /* 2 */ /* 2174 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2176 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2178 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 2180 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2182 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 2184 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2186 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2188 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetSignalBarsCount */ /* 2190 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2192 */ NdrFcLong( 0x0 ), /* 0 */ /* 2196 */ NdrFcShort( 0x19 ), /* 25 */ /* 2198 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2200 */ NdrFcShort( 0x0 ), /* 0 */ /* 2202 */ NdrFcShort( 0x24 ), /* 36 */ /* 2204 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2206 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2208 */ NdrFcShort( 0x0 ), /* 0 */ /* 2210 */ NdrFcShort( 0x0 ), /* 0 */ /* 2212 */ NdrFcShort( 0x0 ), /* 0 */ /* 2214 */ NdrFcShort( 0x2 ), /* 2 */ /* 2216 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2218 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2220 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2222 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2224 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 2226 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2228 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2230 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure SetStatusCallback */ /* 2232 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2234 */ NdrFcLong( 0x0 ), /* 0 */ /* 2238 */ NdrFcShort( 0x1a ), /* 26 */ /* 2240 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2242 */ NdrFcShort( 0x0 ), /* 0 */ /* 2244 */ NdrFcShort( 0x8 ), /* 8 */ /* 2246 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 2248 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2250 */ NdrFcShort( 0x0 ), /* 0 */ /* 2252 */ NdrFcShort( 0x0 ), /* 0 */ /* 2254 */ NdrFcShort( 0x0 ), /* 0 */ /* 2256 */ NdrFcShort( 0x2 ), /* 2 */ /* 2258 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2260 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter statusListener */ /* 2262 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 2264 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2266 */ NdrFcShort( 0x128 ), /* Type Offset=296 */ /* Return value */ /* 2268 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2270 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2272 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure InitiateOutgoingCall2 */ /* 2274 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2276 */ NdrFcLong( 0x0 ), /* 0 */ /* 2280 */ NdrFcShort( 0x1b ), /* 27 */ /* 2282 */ NdrFcShort( 0x28 ), /* ARM Stack size/offset = 40 */ /* 2284 */ NdrFcShort( 0x30 ), /* 48 */ /* 2286 */ NdrFcShort( 0x21 ), /* 33 */ /* 2288 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x6, /* 6 */ /* 2290 */ 0x14, /* 20 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 2292 */ NdrFcShort( 0x0 ), /* 0 */ /* 2294 */ NdrFcShort( 0x1 ), /* 1 */ /* 2296 */ NdrFcShort( 0x0 ), /* 0 */ /* 2298 */ NdrFcShort( 0x9 ), /* 9 */ /* 2300 */ 0x8, /* 8 */ 0x80, /* 128 */ /* 2302 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 2304 */ 0x83, /* 131 */ 0x9d, /* 157 */ /* 2306 */ 0xfc, /* 252 */ 0x5, /* 5 */ /* 2308 */ 0x0, /* 0 */ 0x0, /* 0 */ /* Parameter recepientName */ /* 2310 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2312 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2314 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Parameter recepientId */ /* 2316 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2318 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2320 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callId */ /* 2322 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2324 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 2326 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callAccessHash */ /* 2328 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2330 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 2332 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2334 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2336 */ NdrFcShort( 0x20 ), /* ARM Stack size/offset = 32 */ /* 2338 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2340 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2342 */ NdrFcShort( 0x24 ), /* ARM Stack size/offset = 36 */ /* 2344 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure InitiateOutgoingCall1 */ /* 2346 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2348 */ NdrFcLong( 0x0 ), /* 0 */ /* 2352 */ NdrFcShort( 0x1c ), /* 28 */ /* 2354 */ NdrFcShort( 0x80 ), /* ARM Stack size/offset = 128 */ /* 2356 */ NdrFcShort( 0x5a ), /* 90 */ /* 2358 */ NdrFcShort( 0x21 ), /* 33 */ /* 2360 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x11, /* 17 */ /* 2362 */ 0x14, /* 20 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 2364 */ NdrFcShort( 0x0 ), /* 0 */ /* 2366 */ NdrFcShort( 0x1 ), /* 1 */ /* 2368 */ NdrFcShort( 0x0 ), /* 0 */ /* 2370 */ NdrFcShort( 0x1f ), /* 31 */ /* 2372 */ 0x8, /* 8 */ 0x80, /* 128 */ /* 2374 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 2376 */ 0x83, /* 131 */ 0x9d, /* 157 */ /* 2378 */ 0xfc, /* 252 */ 0x1b, /* 27 */ /* 2380 */ 0x0, /* 0 */ 0x0, /* 0 */ /* Parameter recepientName */ /* 2382 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2384 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2386 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Parameter recepientId */ /* 2388 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2390 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2392 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callId */ /* 2394 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2396 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 2398 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callAccessHash */ /* 2400 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2402 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 2404 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter config */ /* 2406 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2408 */ NdrFcShort( 0x20 ), /* ARM Stack size/offset = 32 */ /* 2410 */ NdrFcShort( 0xc2 ), /* Type Offset=194 */ /* Parameter __keySize */ /* 2412 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2414 */ NdrFcShort( 0x40 ), /* ARM Stack size/offset = 64 */ /* 2416 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter key */ /* 2418 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 2420 */ NdrFcShort( 0x44 ), /* ARM Stack size/offset = 68 */ /* 2422 */ NdrFcShort( 0x142 ), /* Type Offset=322 */ /* Parameter outgoing */ /* 2424 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2426 */ NdrFcShort( 0x48 ), /* ARM Stack size/offset = 72 */ /* 2428 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Parameter __emojisSize */ /* 2430 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2432 */ NdrFcShort( 0x4c ), /* ARM Stack size/offset = 76 */ /* 2434 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter emojis */ /* 2436 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 2438 */ NdrFcShort( 0x50 ), /* ARM Stack size/offset = 80 */ /* 2440 */ NdrFcShort( 0x152 ), /* Type Offset=338 */ /* Parameter __endpointsSize */ /* 2442 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2444 */ NdrFcShort( 0x54 ), /* ARM Stack size/offset = 84 */ /* 2446 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter endpoints */ /* 2448 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 2450 */ NdrFcShort( 0x58 ), /* ARM Stack size/offset = 88 */ /* 2452 */ NdrFcShort( 0x16c ), /* Type Offset=364 */ /* Parameter allowP2P */ /* 2454 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2456 */ NdrFcShort( 0x5c ), /* ARM Stack size/offset = 92 */ /* 2458 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Parameter connectionMaxLayer */ /* 2460 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2462 */ NdrFcShort( 0x60 ), /* ARM Stack size/offset = 96 */ /* 2464 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter proxy */ /* 2466 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2468 */ NdrFcShort( 0x64 ), /* ARM Stack size/offset = 100 */ /* 2470 */ NdrFcShort( 0x10c ), /* Type Offset=268 */ /* Parameter __returnValue */ /* 2472 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2474 */ NdrFcShort( 0x78 ), /* ARM Stack size/offset = 120 */ /* 2476 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2478 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2480 */ NdrFcShort( 0x7c ), /* ARM Stack size/offset = 124 */ /* 2482 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure OnIncomingCallReceived */ /* 2484 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2486 */ NdrFcLong( 0x0 ), /* 0 */ /* 2490 */ NdrFcShort( 0x1d ), /* 29 */ /* 2492 */ NdrFcShort( 0x34 ), /* ARM Stack size/offset = 52 */ /* 2494 */ NdrFcShort( 0x30 ), /* 48 */ /* 2496 */ NdrFcShort( 0x21 ), /* 33 */ /* 2498 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x8, /* 8 */ /* 2500 */ 0x16, /* 22 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 2502 */ NdrFcShort( 0x0 ), /* 0 */ /* 2504 */ NdrFcShort( 0x1 ), /* 1 */ /* 2506 */ NdrFcShort( 0x0 ), /* 0 */ /* 2508 */ NdrFcShort( 0xc ), /* 12 */ /* 2510 */ 0xa, /* 10 */ 0x80, /* 128 */ /* 2512 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 2514 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 2516 */ 0x9f, /* 159 */ 0x9d, /* 157 */ /* 2518 */ 0xfc, /* 252 */ 0x6, /* 6 */ /* 2520 */ 0x0, /* 0 */ 0x0, /* 0 */ /* Parameter contactName */ /* 2522 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2524 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2526 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Parameter contactId */ /* 2528 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2530 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2532 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter contactImage */ /* 2534 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 2536 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 2538 */ NdrFcShort( 0x68 ), /* Type Offset=104 */ /* Parameter callId */ /* 2540 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2542 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 2544 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter callAccessHash */ /* 2546 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2548 */ NdrFcShort( 0x20 ), /* ARM Stack size/offset = 32 */ /* 2550 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter incomingCallDialogDismissedCallback */ /* 2552 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 2554 */ NdrFcShort( 0x28 ), /* ARM Stack size/offset = 40 */ /* 2556 */ NdrFcShort( 0x182 ), /* Type Offset=386 */ /* Parameter __returnValue */ /* 2558 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2560 */ NdrFcShort( 0x2c ), /* ARM Stack size/offset = 44 */ /* 2562 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2564 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2566 */ NdrFcShort( 0x30 ), /* ARM Stack size/offset = 48 */ /* 2568 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure HoldCall */ /* 2570 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2572 */ NdrFcLong( 0x0 ), /* 0 */ /* 2576 */ NdrFcShort( 0x1e ), /* 30 */ /* 2578 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2580 */ NdrFcShort( 0x0 ), /* 0 */ /* 2582 */ NdrFcShort( 0x21 ), /* 33 */ /* 2584 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2586 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2588 */ NdrFcShort( 0x0 ), /* 0 */ /* 2590 */ NdrFcShort( 0x0 ), /* 0 */ /* 2592 */ NdrFcShort( 0x0 ), /* 0 */ /* 2594 */ NdrFcShort( 0x2 ), /* 2 */ /* 2596 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2598 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2600 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2602 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2604 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2606 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2608 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2610 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure ResumeCall */ /* 2612 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2614 */ NdrFcLong( 0x0 ), /* 0 */ /* 2618 */ NdrFcShort( 0x1f ), /* 31 */ /* 2620 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2622 */ NdrFcShort( 0x0 ), /* 0 */ /* 2624 */ NdrFcShort( 0x21 ), /* 33 */ /* 2626 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2628 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2630 */ NdrFcShort( 0x0 ), /* 0 */ /* 2632 */ NdrFcShort( 0x0 ), /* 0 */ /* 2634 */ NdrFcShort( 0x0 ), /* 0 */ /* 2636 */ NdrFcShort( 0x2 ), /* 2 */ /* 2638 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2640 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2642 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2644 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2646 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2648 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2650 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2652 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure EndCall */ /* 2654 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2656 */ NdrFcLong( 0x0 ), /* 0 */ /* 2660 */ NdrFcShort( 0x20 ), /* 32 */ /* 2662 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2664 */ NdrFcShort( 0x0 ), /* 0 */ /* 2666 */ NdrFcShort( 0x21 ), /* 33 */ /* 2668 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2670 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2672 */ NdrFcShort( 0x0 ), /* 0 */ /* 2674 */ NdrFcShort( 0x0 ), /* 0 */ /* 2676 */ NdrFcShort( 0x0 ), /* 0 */ /* 2678 */ NdrFcShort( 0x2 ), /* 2 */ /* 2680 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2682 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2684 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2686 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2688 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2690 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2692 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2694 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure ToggleCamera */ /* 2696 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2698 */ NdrFcLong( 0x0 ), /* 0 */ /* 2702 */ NdrFcShort( 0x21 ), /* 33 */ /* 2704 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2706 */ NdrFcShort( 0x0 ), /* 0 */ /* 2708 */ NdrFcShort( 0x21 ), /* 33 */ /* 2710 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2712 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2714 */ NdrFcShort( 0x0 ), /* 0 */ /* 2716 */ NdrFcShort( 0x0 ), /* 0 */ /* 2718 */ NdrFcShort( 0x0 ), /* 0 */ /* 2720 */ NdrFcShort( 0x2 ), /* 2 */ /* 2722 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2724 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2726 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2728 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2730 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2732 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2734 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2736 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CallStatus */ /* 2738 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2740 */ NdrFcLong( 0x0 ), /* 0 */ /* 2744 */ NdrFcShort( 0x22 ), /* 34 */ /* 2746 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2748 */ NdrFcShort( 0x0 ), /* 0 */ /* 2750 */ NdrFcShort( 0x24 ), /* 36 */ /* 2752 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2754 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2756 */ NdrFcShort( 0x0 ), /* 0 */ /* 2758 */ NdrFcShort( 0x0 ), /* 0 */ /* 2760 */ NdrFcShort( 0x0 ), /* 0 */ /* 2762 */ NdrFcShort( 0x2 ), /* 2 */ /* 2764 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2766 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2768 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2770 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2772 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 2774 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2776 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2778 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_MediaOperations */ /* 2780 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2782 */ NdrFcLong( 0x0 ), /* 0 */ /* 2786 */ NdrFcShort( 0x23 ), /* 35 */ /* 2788 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2790 */ NdrFcShort( 0x0 ), /* 0 */ /* 2792 */ NdrFcShort( 0x24 ), /* 36 */ /* 2794 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2796 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2798 */ NdrFcShort( 0x0 ), /* 0 */ /* 2800 */ NdrFcShort( 0x0 ), /* 0 */ /* 2802 */ NdrFcShort( 0x0 ), /* 0 */ /* 2804 */ NdrFcShort( 0x2 ), /* 2 */ /* 2806 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2808 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2810 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2812 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2814 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 2816 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2818 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2820 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_IsShowingVideo */ /* 2822 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2824 */ NdrFcLong( 0x0 ), /* 0 */ /* 2828 */ NdrFcShort( 0x24 ), /* 36 */ /* 2830 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2832 */ NdrFcShort( 0x0 ), /* 0 */ /* 2834 */ NdrFcShort( 0x21 ), /* 33 */ /* 2836 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2838 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2840 */ NdrFcShort( 0x0 ), /* 0 */ /* 2842 */ NdrFcShort( 0x0 ), /* 0 */ /* 2844 */ NdrFcShort( 0x0 ), /* 0 */ /* 2846 */ NdrFcShort( 0x2 ), /* 2 */ /* 2848 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2850 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2852 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2854 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2856 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2858 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2860 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2862 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_IsShowingVideo */ /* 2864 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2866 */ NdrFcLong( 0x0 ), /* 0 */ /* 2870 */ NdrFcShort( 0x25 ), /* 37 */ /* 2872 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2874 */ NdrFcShort( 0x5 ), /* 5 */ /* 2876 */ NdrFcShort( 0x8 ), /* 8 */ /* 2878 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2880 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2882 */ NdrFcShort( 0x0 ), /* 0 */ /* 2884 */ NdrFcShort( 0x0 ), /* 0 */ /* 2886 */ NdrFcShort( 0x0 ), /* 0 */ /* 2888 */ NdrFcShort( 0x2 ), /* 2 */ /* 2890 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2892 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter value */ /* 2894 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2896 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2898 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2900 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2902 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2904 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_IsRenderingVideo */ /* 2906 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2908 */ NdrFcLong( 0x0 ), /* 0 */ /* 2912 */ NdrFcShort( 0x26 ), /* 38 */ /* 2914 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2916 */ NdrFcShort( 0x0 ), /* 0 */ /* 2918 */ NdrFcShort( 0x21 ), /* 33 */ /* 2920 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2922 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2924 */ NdrFcShort( 0x0 ), /* 0 */ /* 2926 */ NdrFcShort( 0x0 ), /* 0 */ /* 2928 */ NdrFcShort( 0x0 ), /* 0 */ /* 2930 */ NdrFcShort( 0x2 ), /* 2 */ /* 2932 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2934 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 2936 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 2938 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2940 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2942 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2944 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2946 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_IsRenderingVideo */ /* 2948 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2950 */ NdrFcLong( 0x0 ), /* 0 */ /* 2954 */ NdrFcShort( 0x27 ), /* 39 */ /* 2956 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 2958 */ NdrFcShort( 0x5 ), /* 5 */ /* 2960 */ NdrFcShort( 0x8 ), /* 8 */ /* 2962 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 2964 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 2966 */ NdrFcShort( 0x0 ), /* 0 */ /* 2968 */ NdrFcShort( 0x0 ), /* 0 */ /* 2970 */ NdrFcShort( 0x0 ), /* 0 */ /* 2972 */ NdrFcShort( 0x2 ), /* 2 */ /* 2974 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 2976 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter value */ /* 2978 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 2980 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 2982 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 2984 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 2986 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 2988 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CameraLocation */ /* 2990 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 2992 */ NdrFcLong( 0x0 ), /* 0 */ /* 2996 */ NdrFcShort( 0x28 ), /* 40 */ /* 2998 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3000 */ NdrFcShort( 0x0 ), /* 0 */ /* 3002 */ NdrFcShort( 0x24 ), /* 36 */ /* 3004 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3006 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3008 */ NdrFcShort( 0x0 ), /* 0 */ /* 3010 */ NdrFcShort( 0x0 ), /* 0 */ /* 3012 */ NdrFcShort( 0x0 ), /* 0 */ /* 3014 */ NdrFcShort( 0x2 ), /* 2 */ /* 3016 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3018 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3020 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3022 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3024 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 3026 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3028 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3030 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_AvailableAudioRoutes */ /* 3032 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3034 */ NdrFcLong( 0x0 ), /* 0 */ /* 3038 */ NdrFcShort( 0x29 ), /* 41 */ /* 3040 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3042 */ NdrFcShort( 0x0 ), /* 0 */ /* 3044 */ NdrFcShort( 0x24 ), /* 36 */ /* 3046 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3048 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3050 */ NdrFcShort( 0x0 ), /* 0 */ /* 3052 */ NdrFcShort( 0x0 ), /* 0 */ /* 3054 */ NdrFcShort( 0x0 ), /* 0 */ /* 3056 */ NdrFcShort( 0x2 ), /* 2 */ /* 3058 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3060 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3062 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3064 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3066 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 3068 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3070 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3072 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_AudioRoute */ /* 3074 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3076 */ NdrFcLong( 0x0 ), /* 0 */ /* 3080 */ NdrFcShort( 0x2a ), /* 42 */ /* 3082 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3084 */ NdrFcShort( 0x0 ), /* 0 */ /* 3086 */ NdrFcShort( 0x24 ), /* 36 */ /* 3088 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3090 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3092 */ NdrFcShort( 0x0 ), /* 0 */ /* 3094 */ NdrFcShort( 0x0 ), /* 0 */ /* 3096 */ NdrFcShort( 0x0 ), /* 0 */ /* 3098 */ NdrFcShort( 0x2 ), /* 2 */ /* 3100 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3102 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3104 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3106 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3108 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 3110 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3112 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3114 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_AudioRoute */ /* 3116 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3118 */ NdrFcLong( 0x0 ), /* 0 */ /* 3122 */ NdrFcShort( 0x2b ), /* 43 */ /* 3124 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3126 */ NdrFcShort( 0x8 ), /* 8 */ /* 3128 */ NdrFcShort( 0x8 ), /* 8 */ /* 3130 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3132 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3134 */ NdrFcShort( 0x0 ), /* 0 */ /* 3136 */ NdrFcShort( 0x0 ), /* 0 */ /* 3138 */ NdrFcShort( 0x0 ), /* 0 */ /* 3140 */ NdrFcShort( 0x2 ), /* 2 */ /* 3142 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3144 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter newRoute */ /* 3146 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3148 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3150 */ 0xe, /* FC_ENUM32 */ 0x0, /* 0 */ /* Return value */ /* 3152 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3154 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3156 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_OtherPartyName */ /* 3158 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3160 */ NdrFcLong( 0x0 ), /* 0 */ /* 3164 */ NdrFcShort( 0x2c ), /* 44 */ /* 3166 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3168 */ NdrFcShort( 0x0 ), /* 0 */ /* 3170 */ NdrFcShort( 0x8 ), /* 8 */ /* 3172 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 3174 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 3176 */ NdrFcShort( 0x1 ), /* 1 */ /* 3178 */ NdrFcShort( 0x0 ), /* 0 */ /* 3180 */ NdrFcShort( 0x0 ), /* 0 */ /* 3182 */ NdrFcShort( 0x2 ), /* 2 */ /* 3184 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3186 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3188 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 3190 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3192 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 3194 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3196 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3198 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_OtherPartyId */ /* 3200 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3202 */ NdrFcLong( 0x0 ), /* 0 */ /* 3206 */ NdrFcShort( 0x2d ), /* 45 */ /* 3208 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3210 */ NdrFcShort( 0x0 ), /* 0 */ /* 3212 */ NdrFcShort( 0x2c ), /* 44 */ /* 3214 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3216 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3218 */ NdrFcShort( 0x0 ), /* 0 */ /* 3220 */ NdrFcShort( 0x0 ), /* 0 */ /* 3222 */ NdrFcShort( 0x0 ), /* 0 */ /* 3224 */ NdrFcShort( 0x2 ), /* 2 */ /* 3226 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3228 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3230 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3232 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3234 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3236 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3238 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3240 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CallStartTime */ /* 3242 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3244 */ NdrFcLong( 0x0 ), /* 0 */ /* 3248 */ NdrFcShort( 0x2e ), /* 46 */ /* 3250 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3252 */ NdrFcShort( 0x0 ), /* 0 */ /* 3254 */ NdrFcShort( 0x34 ), /* 52 */ /* 3256 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3258 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3260 */ NdrFcShort( 0x0 ), /* 0 */ /* 3262 */ NdrFcShort( 0x0 ), /* 0 */ /* 3264 */ NdrFcShort( 0x0 ), /* 0 */ /* 3266 */ NdrFcShort( 0x2 ), /* 2 */ /* 3268 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3270 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3272 */ NdrFcShort( 0x2112 ), /* Flags: must free, out, simple ref, srv alloc size=8 */ /* 3274 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3276 */ NdrFcShort( 0x2e ), /* Type Offset=46 */ /* Return value */ /* 3278 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3280 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3282 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CallId */ /* 3284 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3286 */ NdrFcLong( 0x0 ), /* 0 */ /* 3290 */ NdrFcShort( 0x2f ), /* 47 */ /* 3292 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3294 */ NdrFcShort( 0x0 ), /* 0 */ /* 3296 */ NdrFcShort( 0x2c ), /* 44 */ /* 3298 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3300 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3302 */ NdrFcShort( 0x0 ), /* 0 */ /* 3304 */ NdrFcShort( 0x0 ), /* 0 */ /* 3306 */ NdrFcShort( 0x0 ), /* 0 */ /* 3308 */ NdrFcShort( 0x2 ), /* 2 */ /* 3310 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3312 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3314 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3316 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3318 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3320 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3322 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3324 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CallAccessHash */ /* 3326 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3328 */ NdrFcLong( 0x0 ), /* 0 */ /* 3332 */ NdrFcShort( 0x30 ), /* 48 */ /* 3334 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3336 */ NdrFcShort( 0x0 ), /* 0 */ /* 3338 */ NdrFcShort( 0x2c ), /* 44 */ /* 3340 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3342 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3344 */ NdrFcShort( 0x0 ), /* 0 */ /* 3346 */ NdrFcShort( 0x0 ), /* 0 */ /* 3348 */ NdrFcShort( 0x0 ), /* 0 */ /* 3350 */ NdrFcShort( 0x2 ), /* 2 */ /* 3352 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3354 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3356 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3358 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3360 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3362 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3364 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3366 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_AcceptedCallId */ /* 3368 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3370 */ NdrFcLong( 0x0 ), /* 0 */ /* 3374 */ NdrFcShort( 0x31 ), /* 49 */ /* 3376 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3378 */ NdrFcShort( 0x0 ), /* 0 */ /* 3380 */ NdrFcShort( 0x2c ), /* 44 */ /* 3382 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3384 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3386 */ NdrFcShort( 0x0 ), /* 0 */ /* 3388 */ NdrFcShort( 0x0 ), /* 0 */ /* 3390 */ NdrFcShort( 0x0 ), /* 0 */ /* 3392 */ NdrFcShort( 0x2 ), /* 2 */ /* 3394 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3396 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3398 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3400 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3402 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3404 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3406 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3408 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_AcceptedCallId */ /* 3410 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3412 */ NdrFcLong( 0x0 ), /* 0 */ /* 3416 */ NdrFcShort( 0x32 ), /* 50 */ /* 3418 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 3420 */ NdrFcShort( 0x10 ), /* 16 */ /* 3422 */ NdrFcShort( 0x8 ), /* 8 */ /* 3424 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3426 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 3428 */ NdrFcShort( 0x0 ), /* 0 */ /* 3430 */ NdrFcShort( 0x0 ), /* 0 */ /* 3432 */ NdrFcShort( 0x0 ), /* 0 */ /* 3434 */ NdrFcShort( 0x4 ), /* 4 */ /* 3436 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 3438 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 3440 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter value */ /* 3442 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3444 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3446 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3448 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3450 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3452 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_Key */ /* 3454 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3456 */ NdrFcLong( 0x0 ), /* 0 */ /* 3460 */ NdrFcShort( 0x33 ), /* 51 */ /* 3462 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3464 */ NdrFcShort( 0x0 ), /* 0 */ /* 3466 */ NdrFcShort( 0x24 ), /* 36 */ /* 3468 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x3, /* 3 */ /* 3470 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 3472 */ NdrFcShort( 0x1 ), /* 1 */ /* 3474 */ NdrFcShort( 0x0 ), /* 0 */ /* 3476 */ NdrFcShort( 0x0 ), /* 0 */ /* 3478 */ NdrFcShort( 0x3 ), /* 3 */ /* 3480 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 3482 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter ____returnValueSize */ /* 3484 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3486 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3488 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3490 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */ /* 3492 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3494 */ NdrFcShort( 0x76 ), /* Type Offset=118 */ /* Return value */ /* 3496 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3498 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3500 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_Outgoing */ /* 3502 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3504 */ NdrFcLong( 0x0 ), /* 0 */ /* 3508 */ NdrFcShort( 0x34 ), /* 52 */ /* 3510 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3512 */ NdrFcShort( 0x0 ), /* 0 */ /* 3514 */ NdrFcShort( 0x21 ), /* 33 */ /* 3516 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 3518 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3520 */ NdrFcShort( 0x0 ), /* 0 */ /* 3522 */ NdrFcShort( 0x0 ), /* 0 */ /* 3524 */ NdrFcShort( 0x0 ), /* 0 */ /* 3526 */ NdrFcShort( 0x2 ), /* 2 */ /* 3528 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3530 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3532 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3534 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3536 */ 0x3, /* FC_SMALL */ 0x0, /* 0 */ /* Return value */ /* 3538 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3540 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3542 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_Emojis */ /* 3544 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3546 */ NdrFcLong( 0x0 ), /* 0 */ /* 3550 */ NdrFcShort( 0x35 ), /* 53 */ /* 3552 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3554 */ NdrFcShort( 0x0 ), /* 0 */ /* 3556 */ NdrFcShort( 0x24 ), /* 36 */ /* 3558 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x3, /* 3 */ /* 3560 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 3562 */ NdrFcShort( 0x1 ), /* 1 */ /* 3564 */ NdrFcShort( 0x0 ), /* 0 */ /* 3566 */ NdrFcShort( 0x0 ), /* 0 */ /* 3568 */ NdrFcShort( 0x3 ), /* 3 */ /* 3570 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 3572 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter ____returnValueSize */ /* 3574 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 3576 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3578 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3580 */ NdrFcShort( 0x2013 ), /* Flags: must size, must free, out, srv alloc size=8 */ /* 3582 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3584 */ NdrFcShort( 0x194 ), /* Type Offset=404 */ /* Return value */ /* 3586 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3588 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3590 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure Start */ /* 3592 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3594 */ NdrFcLong( 0x0 ), /* 0 */ /* 3598 */ NdrFcShort( 0x6 ), /* 6 */ /* 3600 */ NdrFcShort( 0x14 ), /* ARM Stack size/offset = 20 */ /* 3602 */ NdrFcShort( 0x18 ), /* 24 */ /* 3604 */ NdrFcShort( 0x8 ), /* 8 */ /* 3606 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x4, /* 4 */ /* 3608 */ 0x10, /* 16 */ 0x1, /* Ext Flags: new corr desc, */ /* 3610 */ NdrFcShort( 0x0 ), /* 0 */ /* 3612 */ NdrFcShort( 0x0 ), /* 0 */ /* 3614 */ NdrFcShort( 0x0 ), /* 0 */ /* 3616 */ NdrFcShort( 0x4 ), /* 4 */ /* 3618 */ 0x4, /* 4 */ 0x80, /* 128 */ /* 3620 */ 0x81, /* 129 */ 0x82, /* 130 */ /* 3622 */ 0x83, /* 131 */ 0x0, /* 0 */ /* Parameter pts */ /* 3624 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3626 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3628 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter date */ /* 3630 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3632 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3634 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter qts */ /* 3636 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3638 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3640 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 3642 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3644 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3646 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure DiscardCall */ /* 3648 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3650 */ NdrFcLong( 0x0 ), /* 0 */ /* 3654 */ NdrFcShort( 0x8 ), /* 8 */ /* 3656 */ NdrFcShort( 0x1c ), /* ARM Stack size/offset = 28 */ /* 3658 */ NdrFcShort( 0x20 ), /* 32 */ /* 3660 */ NdrFcShort( 0x8 ), /* 8 */ /* 3662 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x3, /* 3 */ /* 3664 */ 0x12, /* 18 */ 0x1, /* Ext Flags: new corr desc, */ /* 3666 */ NdrFcShort( 0x0 ), /* 0 */ /* 3668 */ NdrFcShort( 0x0 ), /* 0 */ /* 3670 */ NdrFcShort( 0x0 ), /* 0 */ /* 3672 */ NdrFcShort( 0x6 ), /* 6 */ /* 3674 */ 0x6, /* 6 */ 0x80, /* 128 */ /* 3676 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 3678 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 3680 */ 0xfc, /* 252 */ 0x0, /* 0 */ /* Parameter id */ /* 3682 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3684 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3686 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter accessHash */ /* 3688 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3690 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3692 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3694 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3696 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 3698 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure ReceivedCall */ /* 3700 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3702 */ NdrFcLong( 0x0 ), /* 0 */ /* 3706 */ NdrFcShort( 0x9 ), /* 9 */ /* 3708 */ NdrFcShort( 0x1c ), /* ARM Stack size/offset = 28 */ /* 3710 */ NdrFcShort( 0x20 ), /* 32 */ /* 3712 */ NdrFcShort( 0x8 ), /* 8 */ /* 3714 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x3, /* 3 */ /* 3716 */ 0x12, /* 18 */ 0x1, /* Ext Flags: new corr desc, */ /* 3718 */ NdrFcShort( 0x0 ), /* 0 */ /* 3720 */ NdrFcShort( 0x0 ), /* 0 */ /* 3722 */ NdrFcShort( 0x0 ), /* 0 */ /* 3724 */ NdrFcShort( 0x6 ), /* 6 */ /* 3726 */ 0x6, /* 6 */ 0x80, /* 128 */ /* 3728 */ 0x9f, /* 159 */ 0x82, /* 130 */ /* 3730 */ 0x83, /* 131 */ 0xfc, /* 252 */ /* 3732 */ 0xfc, /* 252 */ 0x0, /* 0 */ /* Parameter id */ /* 3734 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3736 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3738 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Parameter accessHash */ /* 3740 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3742 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3744 */ 0xb, /* FC_HYPER */ 0x0, /* 0 */ /* Return value */ /* 3746 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3748 */ NdrFcShort( 0x18 ), /* ARM Stack size/offset = 24 */ /* 3750 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure StartServer */ /* 3752 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3754 */ NdrFcLong( 0x0 ), /* 0 */ /* 3758 */ NdrFcShort( 0x6 ), /* 6 */ /* 3760 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 3762 */ NdrFcShort( 0x8 ), /* 8 */ /* 3764 */ NdrFcShort( 0x8 ), /* 8 */ /* 3766 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x3, /* 3 */ /* 3768 */ 0xe, /* 14 */ 0x5, /* Ext Flags: new corr desc, srv corr check, */ /* 3770 */ NdrFcShort( 0x0 ), /* 0 */ /* 3772 */ NdrFcShort( 0x1 ), /* 1 */ /* 3774 */ NdrFcShort( 0x0 ), /* 0 */ /* 3776 */ NdrFcShort( 0x3 ), /* 3 */ /* 3778 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 3780 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter __outOfProcServerClassNamesSize */ /* 3782 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 3784 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3786 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter outOfProcServerClassNames */ /* 3788 */ NdrFcShort( 0x10b ), /* Flags: must size, must free, in, simple ref, */ /* 3790 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3792 */ NdrFcShort( 0x1b6 ), /* Type Offset=438 */ /* Return value */ /* 3794 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3796 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3798 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CallController */ /* 3800 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3802 */ NdrFcLong( 0x0 ), /* 0 */ /* 3806 */ NdrFcShort( 0x8 ), /* 8 */ /* 3808 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3810 */ NdrFcShort( 0x0 ), /* 0 */ /* 3812 */ NdrFcShort( 0x8 ), /* 8 */ /* 3814 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 3816 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3818 */ NdrFcShort( 0x0 ), /* 0 */ /* 3820 */ NdrFcShort( 0x0 ), /* 0 */ /* 3822 */ NdrFcShort( 0x0 ), /* 0 */ /* 3824 */ NdrFcShort( 0x2 ), /* 2 */ /* 3826 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3828 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3830 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 3832 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3834 */ NdrFcShort( 0x1cc ), /* Type Offset=460 */ /* Return value */ /* 3836 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3838 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3840 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_VideoRenderer */ /* 3842 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3844 */ NdrFcLong( 0x0 ), /* 0 */ /* 3848 */ NdrFcShort( 0x9 ), /* 9 */ /* 3850 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3852 */ NdrFcShort( 0x0 ), /* 0 */ /* 3854 */ NdrFcShort( 0x8 ), /* 8 */ /* 3856 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 3858 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3860 */ NdrFcShort( 0x0 ), /* 0 */ /* 3862 */ NdrFcShort( 0x0 ), /* 0 */ /* 3864 */ NdrFcShort( 0x0 ), /* 0 */ /* 3866 */ NdrFcShort( 0x2 ), /* 2 */ /* 3868 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3870 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3872 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 3874 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3876 */ NdrFcShort( 0x1e2 ), /* Type Offset=482 */ /* Return value */ /* 3878 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3880 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3882 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_VideoRenderer */ /* 3884 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3886 */ NdrFcLong( 0x0 ), /* 0 */ /* 3890 */ NdrFcShort( 0xa ), /* 10 */ /* 3892 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3894 */ NdrFcShort( 0x0 ), /* 0 */ /* 3896 */ NdrFcShort( 0x8 ), /* 8 */ /* 3898 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 3900 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3902 */ NdrFcShort( 0x0 ), /* 0 */ /* 3904 */ NdrFcShort( 0x0 ), /* 0 */ /* 3906 */ NdrFcShort( 0x0 ), /* 0 */ /* 3908 */ NdrFcShort( 0x2 ), /* 2 */ /* 3910 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3912 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter value */ /* 3914 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 3916 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3918 */ NdrFcShort( 0x1e6 ), /* Type Offset=486 */ /* Return value */ /* 3920 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3922 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3924 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_MTProtoUpdater */ /* 3926 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3928 */ NdrFcLong( 0x0 ), /* 0 */ /* 3932 */ NdrFcShort( 0xb ), /* 11 */ /* 3934 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3936 */ NdrFcShort( 0x0 ), /* 0 */ /* 3938 */ NdrFcShort( 0x8 ), /* 8 */ /* 3940 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 3942 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3944 */ NdrFcShort( 0x0 ), /* 0 */ /* 3946 */ NdrFcShort( 0x0 ), /* 0 */ /* 3948 */ NdrFcShort( 0x0 ), /* 0 */ /* 3950 */ NdrFcShort( 0x2 ), /* 2 */ /* 3952 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3954 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 3956 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 3958 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 3960 */ NdrFcShort( 0x1f8 ), /* Type Offset=504 */ /* Return value */ /* 3962 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 3964 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 3966 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure put_MTProtoUpdater */ /* 3968 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 3970 */ NdrFcLong( 0x0 ), /* 0 */ /* 3974 */ NdrFcShort( 0xc ), /* 12 */ /* 3976 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 3978 */ NdrFcShort( 0x0 ), /* 0 */ /* 3980 */ NdrFcShort( 0x8 ), /* 8 */ /* 3982 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */ 0x2, /* 2 */ /* 3984 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 3986 */ NdrFcShort( 0x0 ), /* 0 */ /* 3988 */ NdrFcShort( 0x0 ), /* 0 */ /* 3990 */ NdrFcShort( 0x0 ), /* 0 */ /* 3992 */ NdrFcShort( 0x2 ), /* 2 */ /* 3994 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 3996 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter value */ /* 3998 */ NdrFcShort( 0xb ), /* Flags: must size, must free, in, */ /* 4000 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4002 */ NdrFcShort( 0x1fc ), /* Type Offset=508 */ /* Return value */ /* 4004 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4006 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4008 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_CaptureController */ /* 4010 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4012 */ NdrFcLong( 0x0 ), /* 0 */ /* 4016 */ NdrFcShort( 0xd ), /* 13 */ /* 4018 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4020 */ NdrFcShort( 0x0 ), /* 0 */ /* 4022 */ NdrFcShort( 0x8 ), /* 8 */ /* 4024 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 4026 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 4028 */ NdrFcShort( 0x0 ), /* 0 */ /* 4030 */ NdrFcShort( 0x0 ), /* 0 */ /* 4032 */ NdrFcShort( 0x0 ), /* 0 */ /* 4034 */ NdrFcShort( 0x2 ), /* 2 */ /* 4036 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 4038 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4040 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 4042 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4044 */ NdrFcShort( 0x20e ), /* Type Offset=526 */ /* Return value */ /* 4046 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4048 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4050 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_TransportController */ /* 4052 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4054 */ NdrFcLong( 0x0 ), /* 0 */ /* 4058 */ NdrFcShort( 0xe ), /* 14 */ /* 4060 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4062 */ NdrFcShort( 0x0 ), /* 0 */ /* 4064 */ NdrFcShort( 0x8 ), /* 8 */ /* 4066 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 4068 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 4070 */ NdrFcShort( 0x0 ), /* 0 */ /* 4072 */ NdrFcShort( 0x0 ), /* 0 */ /* 4074 */ NdrFcShort( 0x0 ), /* 0 */ /* 4076 */ NdrFcShort( 0x2 ), /* 2 */ /* 4078 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 4080 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4082 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 4084 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4086 */ NdrFcShort( 0x224 ), /* Type Offset=548 */ /* Return value */ /* 4088 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4090 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4092 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetCurrentProcessId */ /* 4094 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4096 */ NdrFcLong( 0x0 ), /* 0 */ /* 4100 */ NdrFcShort( 0x6 ), /* 6 */ /* 4102 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4104 */ NdrFcShort( 0x0 ), /* 0 */ /* 4106 */ NdrFcShort( 0x24 ), /* 36 */ /* 4108 */ 0x44, /* Oi2 Flags: has return, has ext, */ 0x2, /* 2 */ /* 4110 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 4112 */ NdrFcShort( 0x0 ), /* 0 */ /* 4114 */ NdrFcShort( 0x0 ), /* 0 */ /* 4116 */ NdrFcShort( 0x0 ), /* 0 */ /* 4118 */ NdrFcShort( 0x2 ), /* 2 */ /* 4120 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 4122 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4124 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */ /* 4126 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4128 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Return value */ /* 4130 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4132 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4134 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetUiDisconnectedEventName */ /* 4136 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4138 */ NdrFcLong( 0x0 ), /* 0 */ /* 4142 */ NdrFcShort( 0x7 ), /* 7 */ /* 4144 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 4146 */ NdrFcShort( 0x8 ), /* 8 */ /* 4148 */ NdrFcShort( 0x8 ), /* 8 */ /* 4150 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x3, /* 3 */ /* 4152 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 4154 */ NdrFcShort( 0x1 ), /* 1 */ /* 4156 */ NdrFcShort( 0x0 ), /* 0 */ /* 4158 */ NdrFcShort( 0x0 ), /* 0 */ /* 4160 */ NdrFcShort( 0x3 ), /* 3 */ /* 4162 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 4164 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter backgroundProcessId */ /* 4166 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 4168 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4170 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4172 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 4174 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4176 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 4178 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4180 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4182 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure GetBackgroundProcessReadyEventName */ /* 4184 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4186 */ NdrFcLong( 0x0 ), /* 0 */ /* 4190 */ NdrFcShort( 0x8 ), /* 8 */ /* 4192 */ NdrFcShort( 0x10 ), /* ARM Stack size/offset = 16 */ /* 4194 */ NdrFcShort( 0x8 ), /* 8 */ /* 4196 */ NdrFcShort( 0x8 ), /* 8 */ /* 4198 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x3, /* 3 */ /* 4200 */ 0xe, /* 14 */ 0x3, /* Ext Flags: new corr desc, clt corr check, */ /* 4202 */ NdrFcShort( 0x1 ), /* 1 */ /* 4204 */ NdrFcShort( 0x0 ), /* 0 */ /* 4206 */ NdrFcShort( 0x0 ), /* 0 */ /* 4208 */ NdrFcShort( 0x3 ), /* 3 */ /* 4210 */ 0x3, /* 3 */ 0x80, /* 128 */ /* 4212 */ 0x81, /* 129 */ 0x82, /* 130 */ /* Parameter backgroundProcessId */ /* 4214 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ /* 4216 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4218 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4220 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 4222 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4224 */ NdrFcShort( 0x5a ), /* Type Offset=90 */ /* Return value */ /* 4226 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4228 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4230 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ /* Procedure get_Instance */ /* 4232 */ 0x33, /* FC_AUTO_HANDLE */ 0x6c, /* Old Flags: object, Oi2 */ /* 4234 */ NdrFcLong( 0x0 ), /* 0 */ /* 4238 */ NdrFcShort( 0x9 ), /* 9 */ /* 4240 */ NdrFcShort( 0xc ), /* ARM Stack size/offset = 12 */ /* 4242 */ NdrFcShort( 0x0 ), /* 0 */ /* 4244 */ NdrFcShort( 0x8 ), /* 8 */ /* 4246 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ 0x2, /* 2 */ /* 4248 */ 0xe, /* 14 */ 0x1, /* Ext Flags: new corr desc, */ /* 4250 */ NdrFcShort( 0x0 ), /* 0 */ /* 4252 */ NdrFcShort( 0x0 ), /* 0 */ /* 4254 */ NdrFcShort( 0x0 ), /* 0 */ /* 4256 */ NdrFcShort( 0x2 ), /* 2 */ /* 4258 */ 0x2, /* 2 */ 0x80, /* 128 */ /* 4260 */ 0x81, /* 129 */ 0x0, /* 0 */ /* Parameter __returnValue */ /* 4262 */ NdrFcShort( 0x13 ), /* Flags: must size, must free, out, */ /* 4264 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 4266 */ NdrFcShort( 0x228 ), /* Type Offset=552 */ /* Return value */ /* 4268 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 4270 */ NdrFcShort( 0x8 ), /* ARM Stack size/offset = 8 */ /* 4272 */ 0x8, /* FC_LONG */ 0x0, /* 0 */ 0x0 } }; static const PhoneVoIPApp2EBackEnd_MIDL_TYPE_FORMAT_STRING PhoneVoIPApp2EBackEnd__MIDL_TypeFormatString = { 0, { NdrFcShort( 0x0 ), /* 0 */ /* 2 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 4 */ NdrFcLong( 0x905a0fe0 ), /* -1873145888 */ /* 8 */ NdrFcShort( 0xbc53 ), /* -17325 */ /* 10 */ NdrFcShort( 0x11df ), /* 4575 */ /* 12 */ 0x8c, /* 140 */ 0x49, /* 73 */ /* 14 */ 0x0, /* 0 */ 0x1e, /* 30 */ /* 16 */ 0x4f, /* 79 */ 0xc6, /* 198 */ /* 18 */ 0x86, /* 134 */ 0xda, /* 218 */ /* 20 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 22 */ 0x1, /* FC_BYTE */ 0x5c, /* FC_PAD */ /* 24 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 26 */ NdrFcLong( 0xf2035e6a ), /* -234660246 */ /* 30 */ NdrFcShort( 0x8067 ), /* -32665 */ /* 32 */ NdrFcShort( 0x3abb ), /* 15035 */ /* 34 */ 0xa7, /* 167 */ 0x95, /* 149 */ /* 36 */ 0x7b, /* 123 */ 0x33, /* 51 */ /* 38 */ 0x4c, /* 76 */ 0x67, /* 103 */ /* 40 */ 0xa2, /* 162 */ 0xed, /* 237 */ /* 42 */ 0x11, 0x4, /* FC_RP [alloced_on_stack] */ /* 44 */ NdrFcShort( 0x2 ), /* Offset= 2 (46) */ /* 46 */ 0x15, /* FC_STRUCT */ 0x7, /* 7 */ /* 48 */ NdrFcShort( 0x8 ), /* 8 */ /* 50 */ 0xb, /* FC_HYPER */ 0x5b, /* FC_END */ /* 52 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 54 */ 0xb, /* FC_HYPER */ 0x5c, /* FC_PAD */ /* 56 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 58 */ 0x6, /* FC_SHORT */ 0x5c, /* FC_PAD */ /* 60 */ 0x11, 0x4, /* FC_RP [alloced_on_stack] */ /* 62 */ NdrFcShort( 0x1c ), /* Offset= 28 (90) */ /* 64 */ 0x13, 0x0, /* FC_OP */ /* 66 */ NdrFcShort( 0xe ), /* Offset= 14 (80) */ /* 68 */ 0x1b, /* FC_CARRAY */ 0x1, /* 1 */ /* 70 */ NdrFcShort( 0x2 ), /* 2 */ /* 72 */ 0x9, /* Corr desc: FC_ULONG */ 0x0, /* */ /* 74 */ NdrFcShort( 0xfffc ), /* -4 */ /* 76 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 78 */ 0x6, /* FC_SHORT */ 0x5b, /* FC_END */ /* 80 */ 0x17, /* FC_CSTRUCT */ 0x3, /* 3 */ /* 82 */ NdrFcShort( 0x8 ), /* 8 */ /* 84 */ NdrFcShort( 0xfff0 ), /* Offset= -16 (68) */ /* 86 */ 0x8, /* FC_LONG */ 0x8, /* FC_LONG */ /* 88 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 90 */ 0xb4, /* FC_USER_MARSHAL */ 0x83, /* 131 */ /* 92 */ NdrFcShort( 0x0 ), /* 0 */ /* 94 */ NdrFcShort( 0x4 ), /* 4 */ /* 96 */ NdrFcShort( 0x0 ), /* 0 */ /* 98 */ NdrFcShort( 0xffde ), /* Offset= -34 (64) */ /* 100 */ 0x12, 0x0, /* FC_UP */ /* 102 */ NdrFcShort( 0xffea ), /* Offset= -22 (80) */ /* 104 */ 0xb4, /* FC_USER_MARSHAL */ 0x83, /* 131 */ /* 106 */ NdrFcShort( 0x0 ), /* 0 */ /* 108 */ NdrFcShort( 0x4 ), /* 4 */ /* 110 */ NdrFcShort( 0x0 ), /* 0 */ /* 112 */ NdrFcShort( 0xfff4 ), /* Offset= -12 (100) */ /* 114 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 116 */ 0x8, /* FC_LONG */ 0x5c, /* FC_PAD */ /* 118 */ 0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */ /* 120 */ NdrFcShort( 0x2 ), /* Offset= 2 (122) */ /* 122 */ 0x13, 0x0, /* FC_OP */ /* 124 */ NdrFcShort( 0x2 ), /* Offset= 2 (126) */ /* 126 */ 0x1b, /* FC_CARRAY */ 0x0, /* 0 */ /* 128 */ NdrFcShort( 0x1 ), /* 1 */ /* 130 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x54, /* FC_DEREFERENCE */ /* 132 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 134 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 136 */ 0x1, /* FC_BYTE */ 0x5b, /* FC_END */ /* 138 */ 0x11, 0x0, /* FC_RP */ /* 140 */ NdrFcShort( 0x2 ), /* Offset= 2 (142) */ /* 142 */ 0x1b, /* FC_CARRAY */ 0x0, /* 0 */ /* 144 */ NdrFcShort( 0x1 ), /* 1 */ /* 146 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 148 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 150 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 152 */ 0x1, /* FC_BYTE */ 0x5b, /* FC_END */ /* 154 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 156 */ NdrFcLong( 0xf5a3c2ae ), /* -173817170 */ /* 160 */ NdrFcShort( 0xef7b ), /* -4229 */ /* 162 */ NdrFcShort( 0x3de2 ), /* 15842 */ /* 164 */ 0x8b, /* 139 */ 0xe, /* 14 */ /* 166 */ 0x8e, /* 142 */ 0x8b, /* 139 */ /* 168 */ 0x3c, /* 60 */ 0xd2, /* 210 */ /* 170 */ 0xd, /* 13 */ 0x9d, /* 157 */ /* 172 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 174 */ NdrFcLong( 0x1698b961 ), /* 379107681 */ /* 178 */ NdrFcShort( 0xf90e ), /* -1778 */ /* 180 */ NdrFcShort( 0x30d0 ), /* 12496 */ /* 182 */ 0x80, /* 128 */ 0xff, /* 255 */ /* 184 */ 0x22, /* 34 */ 0xe9, /* 233 */ /* 186 */ 0x4c, /* 76 */ 0xf6, /* 246 */ /* 188 */ 0x6d, /* 109 */ 0x7b, /* 123 */ /* 190 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 192 */ 0xc, /* FC_DOUBLE */ 0x5c, /* FC_PAD */ /* 194 */ 0x1a, /* FC_BOGUS_STRUCT */ 0x7, /* 7 */ /* 196 */ NdrFcShort( 0x20 ), /* 32 */ /* 198 */ NdrFcShort( 0x0 ), /* 0 */ /* 200 */ NdrFcShort( 0x0 ), /* Offset= 0 (200) */ /* 202 */ 0xc, /* FC_DOUBLE */ 0xc, /* FC_DOUBLE */ /* 204 */ 0xe, /* FC_ENUM32 */ 0x3, /* FC_SMALL */ /* 206 */ 0x3, /* FC_SMALL */ 0x3, /* FC_SMALL */ /* 208 */ 0x3d, /* FC_STRUCTPAD1 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 210 */ 0x0, /* 0 */ NdrFcShort( 0xff95 ), /* Offset= -107 (104) */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 214 */ 0x0, /* 0 */ NdrFcShort( 0xff91 ), /* Offset= -111 (104) */ 0x5b, /* FC_END */ /* 218 */ 0x11, 0x0, /* FC_RP */ /* 220 */ NdrFcShort( 0x1a ), /* Offset= 26 (246) */ /* 222 */ 0x1a, /* FC_BOGUS_STRUCT */ 0x7, /* 7 */ /* 224 */ NdrFcShort( 0x18 ), /* 24 */ /* 226 */ NdrFcShort( 0x0 ), /* 0 */ /* 228 */ NdrFcShort( 0x0 ), /* Offset= 0 (228) */ /* 230 */ 0xb, /* FC_HYPER */ 0x6, /* FC_SHORT */ /* 232 */ 0x3e, /* FC_STRUCTPAD2 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 234 */ 0x0, /* 0 */ NdrFcShort( 0xff7d ), /* Offset= -131 (104) */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 238 */ 0x0, /* 0 */ NdrFcShort( 0xff79 ), /* Offset= -135 (104) */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 242 */ 0x0, /* 0 */ NdrFcShort( 0xff75 ), /* Offset= -139 (104) */ 0x5b, /* FC_END */ /* 246 */ 0x21, /* FC_BOGUS_ARRAY */ 0x7, /* 7 */ /* 248 */ NdrFcShort( 0x0 ), /* 0 */ /* 250 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 252 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 254 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 256 */ NdrFcLong( 0xffffffff ), /* -1 */ /* 260 */ NdrFcShort( 0x0 ), /* Corr flags: */ /* 262 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ 0x0, /* 0 */ /* 264 */ NdrFcShort( 0xffd6 ), /* Offset= -42 (222) */ /* 266 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 268 */ 0x1a, /* FC_BOGUS_STRUCT */ 0x3, /* 3 */ /* 270 */ NdrFcShort( 0x14 ), /* 20 */ /* 272 */ NdrFcShort( 0x0 ), /* 0 */ /* 274 */ NdrFcShort( 0x0 ), /* Offset= 0 (274) */ /* 276 */ 0xe, /* FC_ENUM32 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 278 */ 0x0, /* 0 */ NdrFcShort( 0xff51 ), /* Offset= -175 (104) */ 0x6, /* FC_SHORT */ /* 282 */ 0x3e, /* FC_STRUCTPAD2 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 284 */ 0x0, /* 0 */ NdrFcShort( 0xff4b ), /* Offset= -181 (104) */ 0x4c, /* FC_EMBEDDED_COMPLEX */ /* 288 */ 0x0, /* 0 */ NdrFcShort( 0xff47 ), /* Offset= -185 (104) */ 0x5b, /* FC_END */ /* 292 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 294 */ 0xe, /* FC_ENUM32 */ 0x5c, /* FC_PAD */ /* 296 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 298 */ NdrFcLong( 0x39126060 ), /* 957505632 */ /* 302 */ NdrFcShort( 0x292 ), /* 658 */ /* 304 */ NdrFcShort( 0x36d6 ), /* 14038 */ /* 306 */ 0xb3, /* 179 */ 0xf8, /* 248 */ /* 308 */ 0x9a, /* 154 */ 0xc4, /* 196 */ /* 310 */ 0x15, /* 21 */ 0x6c, /* 108 */ /* 312 */ 0x65, /* 101 */ 0x1d, /* 29 */ /* 314 */ 0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */ /* 316 */ 0x3, /* FC_SMALL */ 0x5c, /* FC_PAD */ /* 318 */ 0x11, 0x0, /* FC_RP */ /* 320 */ NdrFcShort( 0x2 ), /* Offset= 2 (322) */ /* 322 */ 0x1b, /* FC_CARRAY */ 0x0, /* 0 */ /* 324 */ NdrFcShort( 0x1 ), /* 1 */ /* 326 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 328 */ NdrFcShort( 0x40 ), /* ARM Stack size/offset = 64 */ /* 330 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 332 */ 0x1, /* FC_BYTE */ 0x5b, /* FC_END */ /* 334 */ 0x11, 0x0, /* FC_RP */ /* 336 */ NdrFcShort( 0x2 ), /* Offset= 2 (338) */ /* 338 */ 0x21, /* FC_BOGUS_ARRAY */ 0x3, /* 3 */ /* 340 */ NdrFcShort( 0x0 ), /* 0 */ /* 342 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 344 */ NdrFcShort( 0x4c ), /* ARM Stack size/offset = 76 */ /* 346 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 348 */ NdrFcLong( 0xffffffff ), /* -1 */ /* 352 */ NdrFcShort( 0x0 ), /* Corr flags: */ /* 354 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ 0x0, /* 0 */ /* 356 */ NdrFcShort( 0xff04 ), /* Offset= -252 (104) */ /* 358 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 360 */ 0x11, 0x0, /* FC_RP */ /* 362 */ NdrFcShort( 0x2 ), /* Offset= 2 (364) */ /* 364 */ 0x21, /* FC_BOGUS_ARRAY */ 0x7, /* 7 */ /* 366 */ NdrFcShort( 0x0 ), /* 0 */ /* 368 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 370 */ NdrFcShort( 0x54 ), /* ARM Stack size/offset = 84 */ /* 372 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 374 */ NdrFcLong( 0xffffffff ), /* -1 */ /* 378 */ NdrFcShort( 0x0 ), /* Corr flags: */ /* 380 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ 0x0, /* 0 */ /* 382 */ NdrFcShort( 0xff60 ), /* Offset= -160 (222) */ /* 384 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 386 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 388 */ NdrFcLong( 0x91ddee70 ), /* -1847726480 */ /* 392 */ NdrFcShort( 0xaa90 ), /* -21872 */ /* 394 */ NdrFcShort( 0x38e7 ), /* 14567 */ /* 396 */ 0xb4, /* 180 */ 0xe5, /* 229 */ /* 398 */ 0xf7, /* 247 */ 0x95, /* 149 */ /* 400 */ 0x95, /* 149 */ 0x69, /* 105 */ /* 402 */ 0xcb, /* 203 */ 0x5c, /* 92 */ /* 404 */ 0x11, 0x14, /* FC_RP [alloced_on_stack] [pointer_deref] */ /* 406 */ NdrFcShort( 0x2 ), /* Offset= 2 (408) */ /* 408 */ 0x13, 0x0, /* FC_OP */ /* 410 */ NdrFcShort( 0x2 ), /* Offset= 2 (412) */ /* 412 */ 0x21, /* FC_BOGUS_ARRAY */ 0x3, /* 3 */ /* 414 */ NdrFcShort( 0x0 ), /* 0 */ /* 416 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x54, /* FC_DEREFERENCE */ /* 418 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 420 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 422 */ NdrFcLong( 0xffffffff ), /* -1 */ /* 426 */ NdrFcShort( 0x0 ), /* Corr flags: */ /* 428 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ 0x0, /* 0 */ /* 430 */ NdrFcShort( 0xfeac ), /* Offset= -340 (90) */ /* 432 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 434 */ 0x11, 0x0, /* FC_RP */ /* 436 */ NdrFcShort( 0x2 ), /* Offset= 2 (438) */ /* 438 */ 0x21, /* FC_BOGUS_ARRAY */ 0x3, /* 3 */ /* 440 */ NdrFcShort( 0x0 ), /* 0 */ /* 442 */ 0x29, /* Corr desc: parameter, FC_ULONG */ 0x0, /* */ /* 444 */ NdrFcShort( 0x4 ), /* ARM Stack size/offset = 4 */ /* 446 */ NdrFcShort( 0x1 ), /* Corr flags: early, */ /* 448 */ NdrFcLong( 0xffffffff ), /* -1 */ /* 452 */ NdrFcShort( 0x0 ), /* Corr flags: */ /* 454 */ 0x4c, /* FC_EMBEDDED_COMPLEX */ 0x0, /* 0 */ /* 456 */ NdrFcShort( 0xfea0 ), /* Offset= -352 (104) */ /* 458 */ 0x5c, /* FC_PAD */ 0x5b, /* FC_END */ /* 460 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 462 */ NdrFcShort( 0x2 ), /* Offset= 2 (464) */ /* 464 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 466 */ NdrFcLong( 0x6b50718 ), /* 112527128 */ /* 470 */ NdrFcShort( 0x3528 ), /* 13608 */ /* 472 */ NdrFcShort( 0x3b66 ), /* 15206 */ /* 474 */ 0xbe, /* 190 */ 0x76, /* 118 */ /* 476 */ 0xe1, /* 225 */ 0x83, /* 131 */ /* 478 */ 0xaa, /* 170 */ 0x80, /* 128 */ /* 480 */ 0xd4, /* 212 */ 0xa5, /* 165 */ /* 482 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 484 */ NdrFcShort( 0x2 ), /* Offset= 2 (486) */ /* 486 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 488 */ NdrFcLong( 0x6928ca7b ), /* 1764280955 */ /* 492 */ NdrFcShort( 0x166d ), /* 5741 */ /* 494 */ NdrFcShort( 0x3b37 ), /* 15159 */ /* 496 */ 0x90, /* 144 */ 0x10, /* 16 */ /* 498 */ 0xfb, /* 251 */ 0xab, /* 171 */ /* 500 */ 0x2c, /* 44 */ 0x7e, /* 126 */ /* 502 */ 0x92, /* 146 */ 0xb0, /* 176 */ /* 504 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 506 */ NdrFcShort( 0x2 ), /* Offset= 2 (508) */ /* 508 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 510 */ NdrFcLong( 0x4fa5f2c4 ), /* 1336275652 */ /* 514 */ NdrFcShort( 0x8612 ), /* -31214 */ /* 516 */ NdrFcShort( 0x35c9 ), /* 13769 */ /* 518 */ 0xbf, /* 191 */ 0xaa, /* 170 */ /* 520 */ 0x96, /* 150 */ 0x7c, /* 124 */ /* 522 */ 0x2c, /* 44 */ 0x81, /* 129 */ /* 524 */ 0x9f, /* 159 */ 0xa7, /* 167 */ /* 526 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 528 */ NdrFcShort( 0x2 ), /* Offset= 2 (530) */ /* 530 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 532 */ NdrFcLong( 0x8313dbea ), /* -2095850518 */ /* 536 */ NdrFcShort( 0xfd3b ), /* -709 */ /* 538 */ NdrFcShort( 0x3071 ), /* 12401 */ /* 540 */ 0x80, /* 128 */ 0x35, /* 53 */ /* 542 */ 0x7b, /* 123 */ 0x61, /* 97 */ /* 544 */ 0x16, /* 22 */ 0x58, /* 88 */ /* 546 */ 0xda, /* 218 */ 0xd8, /* 216 */ /* 548 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 550 */ NdrFcShort( 0xfe74 ), /* Offset= -396 (154) */ /* 552 */ 0x11, 0x10, /* FC_RP [pointer_deref] */ /* 554 */ NdrFcShort( 0x2 ), /* Offset= 2 (556) */ /* 556 */ 0x2f, /* FC_IP */ 0x5a, /* FC_CONSTANT_IID */ /* 558 */ NdrFcLong( 0xc8afe1a8 ), /* -927997528 */ /* 562 */ NdrFcShort( 0x92fc ), /* -27908 */ /* 564 */ NdrFcShort( 0x3783 ), /* 14211 */ /* 566 */ 0x95, /* 149 */ 0x20, /* 32 */ /* 568 */ 0xd6, /* 214 */ 0xbb, /* 187 */ /* 570 */ 0xc5, /* 197 */ 0x7, /* 7 */ /* 572 */ 0xb2, /* 178 */ 0x4a, /* 74 */ 0x0 } }; static const USER_MARSHAL_ROUTINE_QUADRUPLE UserMarshalRoutines[ WIRE_MARSHAL_TABLE_SIZE ] = { { HSTRING_UserSize ,HSTRING_UserMarshal ,HSTRING_UserUnmarshal ,HSTRING_UserFree } }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0000, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: IUnknown, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler, ver. 0.0, GUID={0xF2035E6A,0x8067,0x3ABB,{0xA7,0x95,0x7B,0x33,0x4C,0x67,0xA2,0xED}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FormatStringOffsetTable[] = { 0 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(4) ___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler::Invoke */ }; const CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler_ServerInfo, 4, 0, /* pure interpreted */ CStdStubBuffer_METHODS }; /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler, ver. 0.0, GUID={0x1698B961,0xF90E,0x30D0,{0x80,0xFF,0x22,0xE9,0x4C,0xF6,0x6D,0x7B}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FormatStringOffsetTable[] = { 58 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(4) ___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler::Invoke */ }; const CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler_ServerInfo, 4, 0, /* pure interpreted */ CStdStubBuffer_METHODS }; /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback, ver. 0.0, GUID={0x91DDEE70,0xAA90,0x38E7,{0xB4,0xE5,0xF7,0x95,0x95,0x69,0xCB,0x5C}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FormatStringOffsetTable[] = { 100 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(4) ___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback::Invoke */ }; const CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback_ServerInfo, 4, 0, /* pure interpreted */ CStdStubBuffer_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0003, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: IInspectable, ver. 0.0, GUID={0xAF86E2E0,0xB12D,0x4c6a,{0x9C,0x5A,0xD7,0xAA,0x65,0x10,0x1E,0x90}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals, ver. 0.0, GUID={0xF5A3C2AE,0xEF7B,0x3DE2,{0x8B,0x0E,0x8E,0x8B,0x3C,0xD2,0x0D,0x9D}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 158, 206, 272, 320, 364, 412 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(12) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::WriteAudio */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::WriteVideo */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::add_AudioMessageReceived */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::remove_AudioMessageReceived */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::add_VideoMessageReceived */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals::remove_VideoMessageReceived */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_ServerInfo, 12, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0004, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals, ver. 0.0, GUID={0x044DEA28,0x0E8D,0x3A16,{0xA2,0xC1,0xBE,0x95,0xC0,0xBE,0xD5,0xE5}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 0 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(6) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsProxyVtbl = { 0, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_ServerInfo, 6, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0005, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals, ver. 0.0, GUID={0x0CC88A54,0x89AF,0x3CC6,{0x9B,0x95,0xF8,0xF2,0x24,0x28,0xAB,0xED}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 456, 498, 542, 584, 626, 668, 710, 752, 794, 842 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(16) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::get_id */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::put_id */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::get_port */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::put_port */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::get_ipv4 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::put_ipv4 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::get_ipv6 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::put_ipv6 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::get_peerTag */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals::put_peerTag */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_ServerInfo, 16, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0006, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener, ver. 0.0, GUID={0x39126060,0x0292,0x36D6,{0xB3,0xF8,0x9A,0xC4,0x15,0x6C,0x65,0x1D}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 890, 932, 974, 1016, 1058, 1100 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(12) ___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnSignalBarsChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnCallStateChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnCallStatusChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnCallAudioRouteChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnMediaOperationsChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener::OnCameraLocationChanged */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_ServerInfo, 12, &__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0007, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals, ver. 0.0, GUID={0x8313DBEA,0xFD3B,0x3071,{0x80,0x35,0x7B,0x61,0x16,0x58,0xDA,0xD8}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 1142, 932, 1184, 1218, 1252, 412 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(12) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::SetTransport */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::Start */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::Stop */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::ToggleCamera */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::add_CameraLocationChanged */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals::remove_CameraLocationChanged */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_ServerInfo, 12, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0008, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals, ver. 0.0, GUID={0x64B31D5B,0x1A27,0x37A8,{0xBC,0xBC,0xC0,0xBB,0xD5,0x31,0x4C,0x79}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 0 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(6) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsProxyVtbl = { 0, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_ServerInfo, 6, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0009, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig, ver. 0.0, GUID={0xA9F22E31,0xD4E1,0x3940,{0xBA,0x20,0xDC,0xB2,0x09,0x73,0xB0,0x9F}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 1300, 1342, 1386, 1428 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(10) ___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig::get_InitTimeout */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig::put_InitTimeout */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig::get_RecvTimeout */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig::put_RecvTimeout */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_ServerInfo, 10, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0010, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals, ver. 0.0, GUID={0x06B50718,0x3528,0x3B66,{0xBE,0x76,0xE1,0x83,0xAA,0x80,0xD4,0xA5}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 1472, 1506, 1184, 1218, 1540, 1574, 1622, 1678, 1740, 1786, 1820, 1854, 1896, 1938, 1980, 2022, 2064, 2106, 2148, 2190, 2232, 2274, 2346, 2484, 2570, 2612, 2654, 2696, 2738, 2780, 2822, 2864, 2906, 2948, 2990, 3032, 3074, 3116, 3158, 3200, 3242, 3284, 3326, 3368, 3410, 3454, 3502, 3544 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(54) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::HandleUpdatePhoneCall */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::StartMTProtoUpdater */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::StopMTProtoUpdater */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::CreateVoIPControllerWrapper */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::DeleteVoIPControllerWrapper */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetConfig */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetEncryptionKey */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetPublicEndpoints */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetProxy */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::Start */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::Connect */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetMicMute */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SwitchSpeaker */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::UpdateServerConfig */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetPreferredRelayID */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetLastError */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetDebugLog */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetDebugString */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetVersion */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::GetSignalBarsCount */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::SetStatusCallback */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::InitiateOutgoingCall2 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::InitiateOutgoingCall1 */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::OnIncomingCallReceived */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::HoldCall */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::ResumeCall */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::EndCall */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::ToggleCamera */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_CallStatus */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_MediaOperations */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_IsShowingVideo */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::put_IsShowingVideo */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_IsRenderingVideo */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::put_IsRenderingVideo */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_CameraLocation */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_AvailableAudioRoutes */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_AudioRoute */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::put_AudioRoute */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_OtherPartyName */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_OtherPartyId */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_CallStartTime */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_CallId */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_CallAccessHash */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_AcceptedCallId */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::put_AcceptedCallId */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_Key */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_Outgoing */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals::get_Emojis */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_ServerInfo, 54, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0011, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer, ver. 0.0, GUID={0x6928CA7B,0x166D,0x3B37,{0x90,0x10,0xFB,0xAB,0x2C,0x7E,0x92,0xB0}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 1472, 1506 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(8) ___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer::Start */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer::Stop */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_ServerInfo, 8, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0012, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater, ver. 0.0, GUID={0x4FA5F2C4,0x8612,0x35C9,{0xBF,0xAA,0x96,0x7C,0x2C,0x81,0x9F,0xA7}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 3592, 1506, 3648, 3700 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(10) ___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater::Start */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater::Stop */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater::DiscardCall */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater::ReceivedCall */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_ServerInfo, 10, &__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0013, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals, ver. 0.0, GUID={0xC8AFE1A8,0x92FC,0x3783,{0x95,0x20,0xD6,0xBB,0xC5,0x07,0xB2,0x4A}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 3752, 1506, 3800, 3842, 3884, 3926, 3968, 4010, 4052 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(15) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::StartServer */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::DoPeriodicKeepAlive */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::get_CallController */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::get_VideoRenderer */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::put_VideoRenderer */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::get_MTProtoUpdater */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::put_MTProtoUpdater */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::get_CaptureController */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals::get_TransportController */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_ServerInfo, 15, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0014, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics, ver. 0.0, GUID={0x2C1E9C37,0x6827,0x38F7,{0x85,0x7C,0x02,0x16,0x42,0xCA,0x42,0x8B}} */ #pragma code_seg(".orpc") static const unsigned short __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FormatStringOffsetTable[] = { (unsigned short) -1, (unsigned short) -1, (unsigned short) -1, 4094, 4136, 4184, 4232 }; static const MIDL_STUBLESS_PROXY_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ProxyInfo = { &Object_StubDesc, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FormatStringOffsetTable[-3], 0, 0, 0 }; static const MIDL_SERVER_INFO __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ServerInfo = { &Object_StubDesc, 0, PhoneVoIPApp2EBackEnd__MIDL_ProcFormatString.Format, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_FormatStringOffsetTable[-3], 0, 0, 0, 0}; CINTERFACE_PROXY_VTABLE(10) ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsProxyVtbl = { &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ProxyInfo, &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IInspectable::GetIids */ , 0 /* IInspectable::GetRuntimeClassName */ , 0 /* IInspectable::GetTrustLevel */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics::GetCurrentProcessId */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics::GetUiDisconnectedEventName */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics::GetBackgroundProcessReadyEventName */ , (void *) (INT_PTR) -1 /* __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics::get_Instance */ }; static const PRPC_STUB_FUNCTION __x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, NdrStubCall2, NdrStubCall2, NdrStubCall2, NdrStubCall2 }; CInterfaceStubVtbl ___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsStubVtbl = { &IID___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_ServerInfo, 10, &__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics_table[-3], CStdStubBuffer_DELEGATING_METHODS }; /* Standard interface: __MIDL_itf_PhoneVoIPApp2EBackEnd_0000_0015, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ static const MIDL_STUB_DESC Object_StubDesc = { 0, NdrOleAllocate, NdrOleFree, 0, 0, 0, 0, 0, PhoneVoIPApp2EBackEnd__MIDL_TypeFormatString.Format, 1, /* -error bounds_check flag */ 0x50002, /* Ndr library version */ 0, 0x800025b, /* MIDL Version 8.0.603 */ 0, UserMarshalRoutines, 0, /* notify & notify_flag routine table */ 0x1, /* MIDL flag */ 0, /* cs routines */ 0, /* proxy/server info */ 0 }; const CInterfaceProxyVtbl * const _PhoneVoIPApp2EBackEnd_ProxyVtblList[] = { ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterProxyVtbl, ( CInterfaceProxyVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsProxyVtbl, 0 }; const CInterfaceStubVtbl * const _PhoneVoIPApp2EBackEnd_StubVtblList[] = { ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIConfigStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStaticsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListenerStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandlerStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandlerStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallbackStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRendererStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtualsStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdaterStubVtbl, ( CInterfaceStubVtbl *) &___x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtualsStubVtbl, 0 }; PCInterfaceName const _PhoneVoIPApp2EBackEnd_InterfaceNamesList[] = { "__x_ABI_CPhoneVoIPApp_CBackEnd_C____ICallControllerPublicNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportProtectedNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_CIConfig", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsStatics", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IEndpointPublicNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCaptureProtectedNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_CICallControllerStatusListener", "__x_ABI_CPhoneVoIPApp_CBackEnd_CICameraLocationChangedEventHandler", "__x_ABI_CPhoneVoIPApp_CBackEnd_CIMessageReceivedEventHandler", "__x_ABI_CPhoneVoIPApp_CBackEnd_CIIncomingCallDialogDismissedCallback", "__x_ABI_CPhoneVoIPApp_CBackEnd_CIVideoRenderer", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IGlobalsPublicNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndTransportPublicNonVirtuals", "__x_ABI_CPhoneVoIPApp_CBackEnd_CIMTProtoUpdater", "__x_ABI_CPhoneVoIPApp_CBackEnd_C____IBackEndCapturePublicNonVirtuals", 0 }; const IID * const _PhoneVoIPApp2EBackEnd_BaseIIDList[] = { &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, 0, 0, 0, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, &IID_IInspectable, 0 }; #define _PhoneVoIPApp2EBackEnd_CHECK_IID(n) IID_GENERIC_CHECK_IID( _PhoneVoIPApp2EBackEnd, pIID, n) int __stdcall _PhoneVoIPApp2EBackEnd_IID_Lookup( const IID * pIID, int * pIndex ) { IID_BS_LOOKUP_SETUP IID_BS_LOOKUP_INITIAL_TEST( _PhoneVoIPApp2EBackEnd, 15, 8 ) IID_BS_LOOKUP_NEXT_TEST( _PhoneVoIPApp2EBackEnd, 4 ) IID_BS_LOOKUP_NEXT_TEST( _PhoneVoIPApp2EBackEnd, 2 ) IID_BS_LOOKUP_NEXT_TEST( _PhoneVoIPApp2EBackEnd, 1 ) IID_BS_LOOKUP_RETURN_RESULT( _PhoneVoIPApp2EBackEnd, 15, *pIndex ) } const ExtendedProxyFileInfo PhoneVoIPApp2EBackEnd_ProxyFileInfo = { (PCInterfaceProxyVtblList *) & _PhoneVoIPApp2EBackEnd_ProxyVtblList, (PCInterfaceStubVtblList *) & _PhoneVoIPApp2EBackEnd_StubVtblList, (const PCInterfaceName * ) & _PhoneVoIPApp2EBackEnd_InterfaceNamesList, (const IID ** ) & _PhoneVoIPApp2EBackEnd_BaseIIDList, & _PhoneVoIPApp2EBackEnd_IID_Lookup, 15, 2, 0, /* table of [async_uuid] interfaces */ 0, /* Filler1 */ 0, /* Filler2 */ 0 /* Filler3 */ }; #if _MSC_VER >= 1200 #pragma warning(pop) #endif #endif /* if defined(_ARM_) */ ================================================ FILE: BackEndProxyStub/dlldata.c ================================================ /********************************************************* DllData file -- generated by MIDL compiler DO NOT ALTER THIS FILE This file is regenerated by MIDL on every IDL file compile. To completely reconstruct this file, delete it and rerun MIDL on all the IDL files in this DLL, specifying this file for the /dlldata command line option *********************************************************/ #define PROXY_DELEGATION #include #ifdef __cplusplus extern "C" { #endif EXTERN_PROXY_FILE( PhoneVoIPApp2EBackEnd ) EXTERN_PROXY_FILE( PhoneVoIPApp2EBackEnd2EOutOfProcess ) PROXYFILE_LIST_START /* Start of list */ REFERENCE_PROXY_FILE( PhoneVoIPApp2EBackEnd ), REFERENCE_PROXY_FILE( PhoneVoIPApp2EBackEnd2EOutOfProcess ), /* End of list */ PROXYFILE_LIST_END DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) #ifdef __cplusplus } /*extern "C" */ #endif /* end of generated dlldata file */ ================================================ FILE: EmojiPanel/EmojiPanel/App.xaml ================================================  ================================================ FILE: EmojiPanel/EmojiPanel/App.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; namespace EmojiPanel { public partial class App : Application { /// /// Provides easy access to the root frame of the Phone Application. /// /// The root frame of the Phone Application. public PhoneApplicationFrame RootFrame { get; private set; } /// /// Constructor for the Application object. /// public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard Silverlight initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Disable the application idle detection by setting the UserIdleDetectionMode property of the // application's PhoneApplicationService object to Disabled. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } } // Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { } // Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { } // Code to execute when the application is deactivated (sent to background) // This code will not execute when the application is closing private void Application_Deactivated(object sender, DeactivatedEventArgs e) { } // Code to execute when the application is closing (eg, user hit Back) // This code will not execute when the application is deactivated private void Application_Closing(object sender, ClosingEventArgs e) { } // Code to execute if a navigation fails private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { if (Debugger.IsAttached) { // A navigation has failed; break into the debugger Debugger.Break(); } } // Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } } #region Phone application initialization // Avoid double-initialization private bool phoneApplicationInitialized = false; // Do not add any additional code to this method private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render. RootFrame = new PhoneApplicationFrame(); RootFrame.Navigated += CompleteInitializePhoneApplication; // Handle navigation failures RootFrame.NavigationFailed += RootFrame_NavigationFailed; // Ensure we don't initialize again phoneApplicationInitialized = true; } // Do not add any additional code to this method private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) { // Set the root visual to allow the application to render if (RootVisual != RootFrame) RootVisual = RootFrame; // Remove this handler since it is no longer needed RootFrame.Navigated -= CompleteInitializePhoneApplication; } #endregion } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Emoji/EmojiControl.xaml ================================================  ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Emoji/EmojiControl.xaml.cs ================================================ using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; using EmojiPanel.Controls.Utilites; using Microsoft.Phone.Controls; using Telegram.Controls.VirtualizedView; namespace EmojiPanel.Controls.Emoji { public partial class EmojiControl { private List _category1Sprites; private List _category2Sprites; private List _category3Sprites; private List _category4Sprites; private List _category5Sprites; public EventHandler IsOpenedChanged = delegate { }; public TextBox TextBoxTarget { get; set; } private const int AlbumOrientationHeight = 328; private const int PortraitOrientationHeight = 408; private bool _isOpen; private bool _isPortrait = true; private bool _isTextBoxTargetFocused; private bool _isBlocked; // Block IsOpen during animation private int _currentCategory; private bool _wasRendered; private readonly TranslateTransform _frameTransform; private static EmojiControl _instance; public static EmojiControl GetInstance() { return _instance ?? (_instance = new EmojiControl()); } public static readonly DependencyProperty RootFrameTransformProperty = DependencyProperty.Register( "RootFrameTransform", typeof(double), typeof(EmojiControl), new PropertyMetadata(OnRootFrameTransformChanged)); public EmojiControl() { InitializeComponent(); var frame = (Frame)Application.Current.RootVisual; _frameTransform = ((TranslateTransform)((TransformGroup)frame.RenderTransform).Children[0]); var binding = new Binding("Y") { Source = _frameTransform }; SetBinding(RootFrameTransformProperty, binding); VirtPanel.InitializeWithScrollViewer(CSV); VirtPanel.ScrollPositionChanged += VirtPanelOnScrollPositionChanged; SizeChanged += OnSizeChanged; OnSizeChanged(null, null); LoadButtons(); CurrentCategory = 0; } public void BindTextBox(TextBox textBox) { TextBoxTarget = textBox; textBox.GotFocus += TextBoxOnGotFocus; textBox.LostFocus += TextBoxOnLostFocus; } public void UnbindTextBox() { TextBoxTarget.GotFocus -= TextBoxOnGotFocus; TextBoxTarget.LostFocus -= TextBoxOnLostFocus; TextBoxTarget = null; } public bool IsOpen { get { return !_isTextBoxTargetFocused && _isOpen; } set { // Dont hide EmojiControl when keyboard is shown (or to be shown) if (!_isTextBoxTargetFocused && _isOpen == value || _isBlocked) return; if (value) Open(); else Hide(); IsOpenedChanged(null, value); } } private void Open() { _isOpen = true; VisualStateManager.GoToState(TextBoxTarget, "Focused", false); var frame = (PhoneApplicationFrame)Application.Current.RootVisual; EmojiContainer.Visibility = Visibility.Visible; frame.BackKeyPress += OnBackKeyPress; if (!(EmojiContainer.RenderTransform is TranslateTransform)) EmojiContainer.RenderTransform = new TranslateTransform(); var transform = (TranslateTransform)EmojiContainer.RenderTransform; var offset = _isPortrait ? PortraitOrientationHeight : AlbumOrientationHeight; EmojiContainer.Height = offset; var from = 0; if (_frameTransform.Y < 0) // Keyboard is in view { from = (int)_frameTransform.Y; //_frameTransform.Y = -offset; //transform.Y = offset;// -72; } transform.Y = offset;// -72 if (from == offset) return; frame.IsHitTestVisible = false; _isBlocked = true; var storyboard = new Storyboard(); var doubleTransformFrame = new DoubleAnimation { From = from, To = -offset, Duration = TimeSpan.FromMilliseconds(440), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6 } }; storyboard.Children.Add(doubleTransformFrame); Storyboard.SetTarget(doubleTransformFrame, _frameTransform); Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); EmojiContainer.Dispatcher.BeginInvoke(async () => { storyboard.Begin(); if (_frameTransform.Y < 0) // Keyboard is in view { Focus(); TextBoxTarget.Dispatcher.BeginInvoke(() // no effect without dispatcher => VisualStateManager.GoToState(TextBoxTarget, "Focused", false)); } if (_wasRendered) return; await Task.Delay(50); LoadCategory(0); }); storyboard.Completed += (sender, args) => { frame.IsHitTestVisible = true; _isBlocked = false; }; } private void Hide() { _isOpen = false; var frame = (PhoneApplicationFrame)Application.Current.RootVisual; frame.BackKeyPress -= OnBackKeyPress; if (_isTextBoxTargetFocused) { _frameTransform.Y = 0; EmojiContainer.Visibility = Visibility.Collapsed; return; } VisualStateManager.GoToState(TextBoxTarget, "Unfocused", false); frame.IsHitTestVisible = false; _isBlocked = true; var transform = (TranslateTransform)EmojiContainer.RenderTransform; var storyboard = new Storyboard(); var doubleTransformFrame = new DoubleAnimation { From = -transform.Y, To = 0, Duration = TimeSpan.FromMilliseconds(440), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6 } }; storyboard.Children.Add(doubleTransformFrame); Storyboard.SetTarget(doubleTransformFrame, _frameTransform); Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); storyboard.Begin(); storyboard.Completed += (sender, args) => { EmojiContainer.Visibility = Visibility.Collapsed; frame.IsHitTestVisible = true; _isBlocked = false; transform.Y = 0; }; } #region _isTextBoxTargetFocused listeners private void TextBoxOnGotFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = true; } private void TextBoxOnLostFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = false; } #endregion /// /// Hide instance on pressing hardware Back button. Fires only when instance is opened. /// private void OnBackKeyPress(object sender, CancelEventArgs cancelEventArgs) { IsOpen = false; cancelEventArgs.Cancel = true; } /// /// Clear current highlight on scroll /// private static void VirtPanelOnScrollPositionChanged(object sender, MyVirtualizingPanel.ScrollPositionChangedEventAgrs scrollPositionChangedEventAgrs) { EmojiSpriteItem.ClearCurrentHighlight(); } /// /// Changes tabs in UI and _currentCategory property /// public int CurrentCategory { get { return _currentCategory; } set { var previousCategory = GetCategoryButtonByIndex(_currentCategory); var nextCategory = GetCategoryButtonByIndex(value); if (previousCategory != null) previousCategory.Background = new SolidColorBrush(Color.FromArgb(255, 71, 71, 71)); nextCategory.Background = (Brush)Application.Current.Resources["PhoneAccentBrush"]; _currentCategory = value; } } public async void LoadCategory(int index) { VirtPanel.ClearItems(); if (_currentCategory == RecentsCategoryIndex) UnloadRecents(); if (index == RecentsCategoryIndex) { LoadRecents(); return; } List sprites = null; switch (index) { case 0: sprites = _category1Sprites; break; case 1: sprites = _category2Sprites; break; case 2: sprites = _category3Sprites; break; case 3: sprites = _category4Sprites; break; case 4: sprites = _category5Sprites; break; } if (sprites == null) { sprites = new List(); for (var i = 0; i < EmojiData.SpritesByCategory[index].Length; i++) { //var item = new EmojiSpriteItem(index, i); var item = new EmojiSpriteItem(EmojiData.SpritesByCategory[index][i], index, i); item.EmojiSelected += OnEmojiSelected; sprites.Add(item); } switch (index) { case 0: _category1Sprites = sprites; break; case 1: _category2Sprites = sprites; break; case 2: _category3Sprites = sprites; break; case 3: _category4Sprites = sprites; break; case 4: _category5Sprites = sprites; break; } } CurrentCategory = index; VirtPanel.AddItems(new List { sprites[0] }); CreateButtonsBackgrounds(index); if (!_wasRendered) { // Display LoadingProgressBar only once LoadingProgressBar.Visibility = Visibility.Collapsed; _wasRendered = true; } // Delayed rendering of the rest parts - speeds up initial load await Task.Delay(100); if (_currentCategory != index) return; var listList = sprites.ToList(); listList.RemoveAt(0); VirtPanel.AddItems(listList); } public static void OnRootFrameTransformChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { ((EmojiControl)source).OnRootFrameTransformChanged(); } public void OnRootFrameTransformChanged() { if (!_isOpen) return; var offset = _isPortrait ? -PortraitOrientationHeight : -AlbumOrientationHeight; _frameTransform.Y = offset; } #region Recents public void LoadRecents() { CurrentCategory = RecentsCategoryIndex; var recents = EmojiData.Recents; //recents = recents.ToList(); } public void UnloadRecents() { } #endregion Recents private void OnEmojiSelected(object sender, EmojiDataItem emojiDataItem) { TextBoxTarget.Dispatcher.BeginInvoke(() => { var selectionStart = TextBoxTarget.SelectionStart; TextBoxTarget.Text = TextBoxTarget.Text.Insert(selectionStart, emojiDataItem.String); TextBoxTarget.Select(selectionStart + emojiDataItem.String.Length, 0); }); if (_currentCategory == RecentsCategoryIndex) return; var that = emojiDataItem; ThreadPool.QueueUserWorkItem(state => EmojiData.AddToRecents(that)); } /// /// Emoji control backspace button logic /// private void BackspaceButtonOnClick(object sender, RoutedEventArgs routedEventArgs) { var text = TextBoxTarget.Text; var selectionStart = TextBoxTarget.SelectionStart; if (text.Length <= 0) return; if (selectionStart == 0) return; int toSubstring; if (text.Length > 1) { var prevSymbol = text[selectionStart - 2]; var prevBytes = BitConverter.GetBytes(prevSymbol); var curSymbol = text[selectionStart - 1]; var curBytes = BitConverter.GetBytes(curSymbol); if (prevBytes[1] == 0xD8 && (prevBytes[0] == 0x3D || prevBytes[0] == 0x3C)) toSubstring = 2; else if (curBytes[1] == 0x20 && curBytes[0] == 0xE3) toSubstring = 2; else toSubstring = 1; } else { toSubstring = 1; } TextBoxTarget.Text = text.Remove(selectionStart - toSubstring, toSubstring); TextBoxTarget.SelectionStart = selectionStart - toSubstring; } #region User Interface private readonly Button _abcButton = new Button { ClickMode = ClickMode.Release }; private readonly Button _recentsButton = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat0Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat1Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat2Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat3Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat4Button = new Button { ClickMode = ClickMode.Press }; private readonly RepeatButton _backspaceButton = new RepeatButton { ClickMode = ClickMode.Release, Interval = 100 }; public const int RecentsCategoryIndex = 5; private Button GetCategoryButtonByIndex(int index) { switch (index) { case 0: return _cat0Button; case 1: return _cat1Button; case 2: return _cat2Button; case 3: return _cat3Button; case 4: return _cat4Button; case RecentsCategoryIndex: return _recentsButton; default: return null; } } public void LoadButtons() { var buttonStyle = (Style)Resources["CategoryButtonStyle"]; _abcButton.Style = buttonStyle; _recentsButton.Style = buttonStyle; _cat0Button.Style = buttonStyle; _cat1Button.Style = buttonStyle; _cat2Button.Style = buttonStyle; _cat3Button.Style = buttonStyle; _cat4Button.Style = buttonStyle; _backspaceButton.Style = (Style)Resources["RepeatButtonStyle"]; _abcButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.abc")), Width = 34, Height = 32 }; _recentsButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.recent")), Width = 34, Height = 32 }; _cat0Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.category.1")), Width = 34, Height = 32 }; _cat1Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.category.2")), Width = 34, Height = 32 }; _cat2Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.category.3")), Width = 34, Height = 32 }; _cat3Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.category.4")), Width = 34, Height = 32 }; _cat4Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.category.5")), Width = 34, Height = 32 }; _backspaceButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri("emoji.backspace")), Width = 34, Height = 32 }; Grid.SetColumn(_abcButton, 0); Grid.SetColumn(_recentsButton, 1); Grid.SetColumn(_cat0Button, 2); Grid.SetColumn(_cat1Button, 3); Grid.SetColumn(_cat2Button, 4); Grid.SetColumn(_cat3Button, 5); Grid.SetColumn(_cat4Button, 6); Grid.SetColumn(_backspaceButton, 7); ButtonsGrid.Children.Add(_abcButton); ButtonsGrid.Children.Add(_recentsButton); ButtonsGrid.Children.Add(_cat0Button); ButtonsGrid.Children.Add(_cat1Button); ButtonsGrid.Children.Add(_cat2Button); ButtonsGrid.Children.Add(_cat3Button); ButtonsGrid.Children.Add(_cat4Button); ButtonsGrid.Children.Add(_backspaceButton); _abcButton.Click += AbcButtonOnClick; _cat0Button.Click += CategoryButtonClick; _cat1Button.Click += CategoryButtonClick; _cat2Button.Click += CategoryButtonClick; _cat3Button.Click += CategoryButtonClick; _cat4Button.Click += CategoryButtonClick; _recentsButton.Click += CategoryButtonClick; _backspaceButton.Click += BackspaceButtonOnClick; } private void AbcButtonOnClick(object sender, RoutedEventArgs routedEventArgs) { TextBoxTarget.Focus(); } private void CategoryButtonClick(object sender, RoutedEventArgs routedEventArgs) { if (sender == _cat0Button) LoadCategory(0); else if (sender == _cat1Button) LoadCategory(1); else if (sender == _cat2Button) LoadCategory(2); else if (sender == _cat3Button) LoadCategory(3); else if (sender == _cat4Button) LoadCategory(4); else if (sender == _recentsButton) LoadCategory(RecentsCategoryIndex); } private void CreateButtonsBackgrounds(int categoryIndex) { var sprites = EmojiData.SpriteRowsCountByCategory[categoryIndex]; for (var i = 0; i < sprites.Length; i++) { var rowsCount = sprites[i]; var block = new Rectangle { Width = EmojiSpriteItem.SpriteWidth, Height = EmojiSpriteItem.RowHeight * rowsCount, Fill = new SolidColorBrush(Color.FromArgb(255, 71, 71, 71)), Margin = new Thickness(4, 0, 4, 0) }; Canvas.SetTop(block, (EmojiSpriteItem.SpriteHeight) * i); VirtPanel.Children.Insert(0, block); } } private void InitializeOrientation(Orientation orientation) { switch (orientation) { case Orientation.Vertical: ButtonsGrid.Height = 78; ButtonsGrid.Margin = new Thickness(0, 6, 0, 0); EmojiContainer.Height = PortraitOrientationHeight; _frameTransform.Y = -PortraitOrientationHeight; break; case Orientation.Horizontal: ButtonsGrid.Height = 58; ButtonsGrid.Margin = new Thickness(0, 6, 0, 3); EmojiContainer.Height = AlbumOrientationHeight; _frameTransform.Y = -AlbumOrientationHeight; break; } } #endregion User Interface /// /// Orientation change handler /// private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs) { var currentOrientation = ((PhoneApplicationFrame)Application.Current.RootVisual).Orientation; var isPortrait = currentOrientation == PageOrientation.PortraitUp || currentOrientation == PageOrientation.PortraitDown || currentOrientation == PageOrientation.Portrait; if (_isPortrait == isPortrait && _wasRendered) return; _isPortrait = isPortrait; InitializeOrientation(isPortrait ? Orientation.Vertical : Orientation.Horizontal); } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Emoji/EmojiData.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EmojiPanel.Controls.Emoji { public class EmojiDataItem { public EmojiDataItem() { } public EmojiDataItem(string string2, ulong code) { String = string2; Code = code; } public string String { get; set; } public ulong Code { get; set; } public Uri Uri { get; set; } public static string BuildString(ulong code) { var bytes = BitConverter.GetBytes(code); var char1 = BitConverter.ToChar(bytes, 6); var char2 = BitConverter.ToChar(bytes, 4); var char3 = BitConverter.ToChar(bytes, 2); var char4 = BitConverter.ToChar(bytes, 0); string text; if (char1 != 0) { text = new string(new [] { char1, char2, char3, char4 }); } else if (char3 != 0) { text = new string(new [] { char3, char4 }); } else { text = char4.ToString(); } return text; } public static Uri BuildUri(string string2) { //var string3 = BitConverter.ToString(bytes.Take(4).Reverse().ToArray()) var string3 = string.Format("{0:X}", (Int16) string2[0]); switch (string2.Length) { case 2: { uint emoji = 0; emoji |= (uint) string2[0] << 16; emoji |= (uint) string2[1]; return new Uri(string.Format("/Assets/Emoji/Separated/{0:X}.png", emoji), UriKind.Relative); } case 4: { uint emoji1 = 0; emoji1 |= (uint) string2[0] << 16; emoji1 |= (uint) string2[1]; ulong emoji2 = 0; emoji2 |= (uint) string2[2] << 16; emoji2 |= (uint) string2[3]; return new Uri(string.Format("/Assets/Emoji/Separated/{0:X}-{1:X}.png", emoji1, emoji2), UriKind.Relative); } default: return new Uri(string.Format("/Assets/Emoji/Separated/{0:X}.png", (Int16) string2[0]), UriKind.Relative); } } public static EmojiDataItem GetByIndex(int categoryIndex, int spriteIndex, int itemIndex) { var category = EmojiData.CodesByCategory[categoryIndex]; var emojiIndex = spriteIndex * EmojiData.ItemsInSprite + itemIndex; if (category.Length <= emojiIndex) return null; // out of bounds ulong code = category[emojiIndex]; var result = new EmojiDataItem { Code = code, String = BuildString(code) }; result.Uri = BuildUri(result.String); return result; } } public static class EmojiData { public static List Recents; public static void AddToRecents(EmojiDataItem emojiDataItem) { if (Recents == null) { LoadRecents(); if (Recents == null) return; } var prevItem = Recents.FirstOrDefault(x => x.Code == emojiDataItem.Code); if (prevItem != null) { Recents.Remove(prevItem); Recents.Insert(0, prevItem); } else { Recents.Insert(0, emojiDataItem); Recents = Recents.Take(30).ToList(); } SaveRecents(); } public static void LoadRecents() { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists("EmojiRecents")) return; using (var stream = new IsolatedStorageFileStream("EmojiRecents", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite, store)) { if (stream.Length <= 0) return; using (var br = new BinaryReader(stream)) { var count = br.ReadInt32(); Recents = new List(); for (var i = 0; i < count; i++) { var emoji = new EmojiDataItem(br.ReadString(), br.ReadUInt64()); Recents.Add(emoji); } } } } } public static void SaveRecents() { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = new IsolatedStorageFileStream("EmojiRecents", FileMode.Create, FileAccess.Write, FileShare.ReadWrite, store)) { using (var bw = new BinaryWriter(stream)) { var emojies = Recents.ToList(); bw.Write(emojies.Count); foreach (var item in emojies) { bw.Write(item.String); bw.Write(item.Code); } } } } } public const int ItemsInRow = 6; public const int ItemsInSprite = 36; /// /// Custom spaced sprites by category /// public static Uri[][] SpritesByCategory = { new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part5.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part3.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part5.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part6.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part2.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part5.png", UriKind.Relative), }, }; /// /// Config of rows count for sprites in categories /// public static int[][] SpriteRowsCountByCategory = { new [] { 6, 6, 6, 6, 6, 2 }, new [] { 6, 6, 6, 2 }, new [] { 6, 6, 6, 6, 6, 6, 3 }, new [] { 6, 6, 5 }, new [] { 6, 6, 6, 6, 6, 5 } }; /// /// Config of missing cells in last row for each last category's sprite /// public static int[] SpriteMissingCellsByCategory = { 3, 4, 4, 1, 1 }; /// /// Emoji codes combined into the groups corresponding to the categories in the interface /// public static ulong[][] CodesByCategory = { new ulong[]{ 0x00000000D83DDE04L, 0x00000000D83DDE03L, 0x00000000D83DDE00L, 0x00000000D83DDE0AL, 0x000000000000263AL, 0x00000000D83DDE09L, 0x00000000D83DDE0DL, 0x00000000D83DDE18L, 0x00000000D83DDE1AL, 0x00000000D83DDE17L, 0x00000000D83DDE19L, 0x00000000D83DDE1CL, 0x00000000D83DDE1DL, 0x00000000D83DDE1BL, 0x00000000D83DDE33L, 0x00000000D83DDE01L, 0x00000000D83DDE14L, 0x00000000D83DDE0CL, 0x00000000D83DDE12L, 0x00000000D83DDE1EL, 0x00000000D83DDE23L, 0x00000000D83DDE22L, 0x00000000D83DDE02L, 0x00000000D83DDE2DL, 0x00000000D83DDE2AL, 0x00000000D83DDE25L, 0x00000000D83DDE30L, 0x00000000D83DDE05L, 0x00000000D83DDE13L, 0x00000000D83DDE29L, 0x00000000D83DDE2BL, 0x00000000D83DDE28L, 0x00000000D83DDE31L, 0x00000000D83DDE20L, 0x00000000D83DDE21L, 0x00000000D83DDE24L, 0x00000000D83DDE16L, 0x00000000D83DDE06L, 0x00000000D83DDE0BL, 0x00000000D83DDE37L, 0x00000000D83DDE0EL, 0x00000000D83DDE34L, 0x00000000D83DDE35L, 0x00000000D83DDE32L, 0x00000000D83DDE1FL, 0x00000000D83DDE26L, 0x00000000D83DDE27L, 0x00000000D83DDE08L, 0x00000000D83DDC7FL, 0x00000000D83DDE2EL, 0x00000000D83DDE2CL, 0x00000000D83DDE10L, 0x00000000D83DDE15L, 0x00000000D83DDE2FL, 0x00000000D83DDE36L, 0x00000000D83DDE07L, 0x00000000D83DDE0FL, 0x00000000D83DDE11L, 0x00000000D83DDC72L, 0x00000000D83DDC73L, 0x00000000D83DDC6EL, 0x00000000D83DDC77L, 0x00000000D83DDC82L, 0x00000000D83DDC76L, 0x00000000D83DDC66L, 0x00000000D83DDC67L, 0x00000000D83DDC68L, 0x00000000D83DDC69L, 0x00000000D83DDC74L, 0x00000000D83DDC75L, 0x00000000D83DDC71L, 0x00000000D83DDC7CL, 0x00000000D83DDC78L, 0x00000000D83DDE3AL, 0x00000000D83DDE38L, 0x00000000D83DDE3BL, 0x00000000D83DDE3DL, 0x00000000D83DDE3CL, 0x00000000D83DDE40L, 0x00000000D83DDE3FL, 0x00000000D83DDE39L, 0x00000000D83DDE3EL, 0x00000000D83DDC79L, 0x00000000D83DDC7AL, 0x00000000D83DDE48L, 0x00000000D83DDE49L, 0x00000000D83DDE4AL, 0x00000000D83DDC80L, 0x00000000D83DDC7DL, 0x00000000D83DDCA9L, 0x00000000D83DDD25L, 0x0000000000002728L, 0x00000000D83CDF1FL, 0x00000000D83DDCABL, 0x00000000D83DDCA5L, 0x00000000D83DDCA2L, 0x00000000D83DDCA6L, 0x00000000D83DDCA7L, 0x00000000D83DDCA4L, 0x00000000D83DDCA8L, 0x00000000D83DDC42L, 0x00000000D83DDC40L, 0x00000000D83DDC43L, 0x00000000D83DDC45L, 0x00000000D83DDC44L, 0x00000000D83DDC4DL, 0x00000000D83DDC4EL, 0x00000000D83DDC4CL, 0x00000000D83DDC4AL, 0x000000000000270AL, 0x000000000000270CL, 0x00000000D83DDC4BL, 0x000000000000270BL, 0x00000000D83DDC50L, 0x00000000D83DDC46L, 0x00000000D83DDC47L, 0x00000000D83DDC49L, 0x00000000D83DDC48L, 0x00000000D83DDE4CL, 0x00000000D83DDE4FL, 0x000000000000261DL, 0x00000000D83DDC4FL, 0x00000000D83DDCAAL, 0x00000000D83DDEB6L, 0x00000000D83CDFC3L, 0x00000000D83DDC83L, 0x00000000D83DDC6BL, 0x00000000D83DDC6AL, 0x00000000D83DDC6CL, 0x00000000D83DDC6DL, 0x00000000D83DDC8FL, 0x00000000D83DDC91L, 0x00000000D83DDC6FL, 0x00000000D83DDE46L, 0x00000000D83DDE45L, 0x00000000D83DDC81L, 0x00000000D83DDE4BL, 0x00000000D83DDC86L, 0x00000000D83DDC87L, 0x00000000D83DDC85L, 0x00000000D83DDC70L, 0x00000000D83DDE4EL, 0x00000000D83DDE4DL, 0x00000000D83DDE47L, 0x00000000D83CDFA9L, 0x00000000D83DDC51L, 0x00000000D83DDC52L, 0x00000000D83DDC5FL, 0x00000000D83DDC5EL, 0x00000000D83DDC61L, 0x00000000D83DDC60L, 0x00000000D83DDC62L, 0x00000000D83DDC55L, 0x00000000D83DDC54L, 0x00000000D83DDC5AL, 0x00000000D83DDC57L, 0x00000000D83CDFBDL, 0x00000000D83DDC56L, 0x00000000D83DDC58L, 0x00000000D83DDC59L, 0x00000000D83DDCBCL, 0x00000000D83DDC5CL, 0x00000000D83DDC5DL, 0x00000000D83DDC5BL, 0x00000000D83DDC53L, 0x00000000D83CDF80L, 0x00000000D83CDF02L, 0x00000000D83DDC84L, 0x00000000D83DDC9BL, 0x00000000D83DDC99L, 0x00000000D83DDC9CL, 0x00000000D83DDC9AL, 0x0000000000002764L, 0x00000000D83DDC94L, 0x00000000D83DDC97L, 0x00000000D83DDC93L, 0x00000000D83DDC95L, 0x00000000D83DDC96L, 0x00000000D83DDC9EL, 0x00000000D83DDC98L, 0x00000000D83DDC8CL, 0x00000000D83DDC8BL, 0x00000000D83DDC8DL, 0x00000000D83DDC8EL, 0x00000000D83DDC64L, 0x00000000D83DDC65L, 0x00000000D83DDCACL, 0x00000000D83DDC63L, 0x00000000D83DDCADL}, new ulong[]{ 0x00000000D83DDC36L, 0x00000000D83DDC3AL, 0x00000000D83DDC31L, 0x00000000D83DDC2DL, 0x00000000D83DDC39L, 0x00000000D83DDC30L, 0x00000000D83DDC38L, 0x00000000D83DDC2FL, 0x00000000D83DDC28L, 0x00000000D83DDC3BL, 0x00000000D83DDC37L, 0x00000000D83DDC3DL, 0x00000000D83DDC2EL, 0x00000000D83DDC17L, 0x00000000D83DDC35L, 0x00000000D83DDC12L, 0x00000000D83DDC34L, 0x00000000D83DDC11L, 0x00000000D83DDC18L, 0x00000000D83DDC3CL, 0x00000000D83DDC27L, 0x00000000D83DDC26L, 0x00000000D83DDC24L, 0x00000000D83DDC25L, 0x00000000D83DDC23L, 0x00000000D83DDC14L, 0x00000000D83DDC0DL, 0x00000000D83DDC22L, 0x00000000D83DDC1BL, 0x00000000D83DDC1DL, 0x00000000D83DDC1CL, 0x00000000D83DDC1EL, 0x00000000D83DDC0CL, 0x00000000D83DDC19L, 0x00000000D83DDC1AL, 0x00000000D83DDC20L, 0x00000000D83DDC1FL, 0x00000000D83DDC2CL, 0x00000000D83DDC33L, 0x00000000D83DDC0BL, 0x00000000D83DDC04L, 0x00000000D83DDC0FL, 0x00000000D83DDC00L, 0x00000000D83DDC03L, 0x00000000D83DDC05L, 0x00000000D83DDC07L, 0x00000000D83DDC09L, 0x00000000D83DDC0EL, 0x00000000D83DDC10L, 0x00000000D83DDC13L, 0x00000000D83DDC15L, 0x00000000D83DDC16L, 0x00000000D83DDC01L, 0x00000000D83DDC02L, 0x00000000D83DDC32L, 0x00000000D83DDC21L, 0x00000000D83DDC0AL, 0x00000000D83DDC2BL, 0x00000000D83DDC2AL, 0x00000000D83DDC06L, 0x00000000D83DDC08L, 0x00000000D83DDC29L, 0x00000000D83DDC3EL, 0x00000000D83DDC90L, 0x00000000D83CDF38L, 0x00000000D83CDF37L, 0x00000000D83CDF40L, 0x00000000D83CDF39L, 0x00000000D83CDF3BL, 0x00000000D83CDF3AL, 0x00000000D83CDF41L, 0x00000000D83CDF43L, 0x00000000D83CDF42L, 0x00000000D83CDF3FL, 0x00000000D83CDF3EL, 0x00000000D83CDF44L, 0x00000000D83CDF35L, 0x00000000D83CDF34L, 0x00000000D83CDF32L, 0x00000000D83CDF33L, 0x00000000D83CDF30L, 0x00000000D83CDF31L, 0x00000000D83CDF3CL, 0x00000000D83CDF10L, 0x00000000D83CDF1EL, 0x00000000D83CDF1DL, 0x00000000D83CDF1AL, 0x00000000D83CDF11L, 0x00000000D83CDF12L, 0x00000000D83CDF13L, 0x00000000D83CDF14L, 0x00000000D83CDF15L, 0x00000000D83CDF16L, 0x00000000D83CDF17L, 0x00000000D83CDF18L, 0x00000000D83CDF1CL, 0x00000000D83CDF1BL, 0x00000000D83CDF19L, 0x00000000D83CDF0DL, 0x00000000D83CDF0EL, 0x00000000D83CDF0FL, 0x00000000D83CDF0BL, 0x00000000D83CDF0CL, 0x00000000D83CDF20L, 0x0000000000002B50L, 0x0000000000002600L, 0x00000000000026C5L, 0x0000000000002601L, 0x00000000000026A1L, 0x0000000000002614L, 0x0000000000002744L, 0x00000000000026C4L, 0x00000000D83CDF00L, 0x00000000D83CDF01L, 0x00000000D83CDF08L, 0x00000000D83CDF0AL}, new ulong[]{ 0x00000000D83CDF8DL, 0x00000000D83DDC9DL, 0x00000000D83CDF8EL, 0x00000000D83CDF92L, 0x00000000D83CDF93L, 0x00000000D83CDF8FL, 0x00000000D83CDF86L, 0x00000000D83CDF87L, 0x00000000D83CDF90L, 0x00000000D83CDF91L, 0x00000000D83CDF83L, 0x00000000D83DDC7BL, 0x00000000D83CDF85L, 0x00000000D83CDF84L, 0x00000000D83CDF81L, 0x00000000D83CDF8BL, 0x00000000D83CDF89L, 0x00000000D83CDF8AL, 0x00000000D83CDF88L, 0x00000000D83CDF8CL, 0x00000000D83DDD2EL, 0x00000000D83CDFA5L, 0x00000000D83DDCF7L, 0x00000000D83DDCF9L, 0x00000000D83DDCFCL, 0x00000000D83DDCBFL, 0x00000000D83DDCC0L, 0x00000000D83DDCBDL, 0x00000000D83DDCBEL, 0x00000000D83DDCBBL, 0x00000000D83DDCF1L, 0x000000000000260EL, 0x00000000D83DDCDEL, 0x00000000D83DDCDFL, 0x00000000D83DDCE0L, 0x00000000D83DDCE1L, 0x00000000D83DDCFAL, 0x00000000D83DDCFBL, 0x00000000D83DDD0AL, 0x00000000D83DDD09L, 0x00000000D83DDD08L, 0x00000000D83DDD07L, 0x00000000D83DDD14L, 0x00000000D83DDD14L, 0x00000000D83DDCE2L, 0x00000000D83DDCE3L, 0x00000000000023F3L, 0x000000000000231BL, 0x00000000000023F0L, 0x000000000000231AL, 0x00000000D83DDD13L, 0x00000000D83DDD12L, 0x00000000D83DDD0FL, 0x00000000D83DDD10L, 0x00000000D83DDD11L, 0x00000000D83DDD0EL, 0x00000000D83DDCA1L, 0x00000000D83DDD26L, 0x00000000D83DDD06L, 0x00000000D83DDD05L, 0x00000000D83DDD0CL, 0x00000000D83DDD0BL, 0x00000000D83DDD0DL, 0x00000000D83DDEC1L /* was missing */, 0x00000000D83DDEC0L, 0x00000000D83DDEBFL, 0x00000000D83DDEBDL, 0x00000000D83DDD27L, 0x00000000D83DDD29L, 0x00000000D83DDD28L, 0x00000000D83DDEAAL, 0x00000000D83DDEACL, 0x00000000D83DDCA3L, 0x00000000D83DDD2BL, 0x00000000D83DDD2AL, 0x00000000D83DDC8AL, 0x00000000D83DDC89L, 0x00000000D83DDCB0L, 0x00000000D83DDCB4L, 0x00000000D83DDCB5L, 0x00000000D83DDCB7L, 0x00000000D83DDCB6L, 0x00000000D83DDCB3L, 0x00000000D83DDCB8L, 0x00000000D83DDCF2L, 0x00000000D83DDCE7L, 0x00000000D83DDCE5L, 0x00000000D83DDCE4L, 0x0000000000002709L, 0x00000000D83DDCE9L, 0x00000000D83DDCE8L, 0x00000000D83DDCEFL, 0x00000000D83DDCEBL, 0x00000000D83DDCEAL, 0x00000000D83DDCECL, 0x00000000D83DDCEDL, 0x00000000D83DDCEEL, 0x00000000D83DDCE6L, 0x00000000D83DDCDDL, 0x00000000D83DDCC4L, 0x00000000D83DDCC3L, 0x00000000D83DDCD1L, 0x00000000D83DDCCAL, 0x00000000D83DDCC8L, 0x00000000D83DDCC9L, 0x00000000D83DDCDCL, 0x00000000D83DDCCBL, 0x00000000D83DDCC5L, 0x00000000D83DDCC6L, 0x00000000D83DDCC7L, 0x00000000D83DDCC1L, 0x00000000D83DDCC2L, 0x0000000000002702L, 0x00000000D83DDCCCL, 0x00000000D83DDCCEL, 0x0000000000002712L, 0x000000000000270FL, 0x00000000D83DDCCFL, 0x00000000D83DDCD0L, 0x00000000D83DDCD5L, 0x00000000D83DDCD7L, 0x00000000D83DDCD8L, 0x00000000D83DDCD9L, 0x00000000D83DDCD3L, 0x00000000D83DDCD4L, 0x00000000D83DDCD2L, 0x00000000D83DDCDAL, 0x00000000D83DDCD6L, 0x00000000D83DDD16L, 0x00000000D83DDCDBL, 0x00000000D83DDD2CL, 0x00000000D83DDD2DL, 0x00000000D83DDCF0L, 0x00000000D83CDFA8L, 0x00000000D83CDFACL, 0x00000000D83CDFA4L, 0x00000000D83CDFA7L, 0x00000000D83CDFBCL, 0x00000000D83CDFB5L, 0x00000000D83CDFB6L, 0x00000000D83CDFB9L, 0x00000000D83CDFBBL, 0x00000000D83CDFBAL, 0x00000000D83CDFB7L, 0x00000000D83CDFB8L, 0x00000000D83DDC7EL, 0x00000000D83CDFAEL, 0x00000000D83CDCCFL, 0x00000000D83CDFB4L, 0x00000000D83CDC04L, 0x00000000D83CDFB2L, 0x00000000D83CDFAFL, 0x00000000D83CDFC8L, 0x00000000D83CDFC0L, 0x00000000000026BDL, 0x00000000000026BEL, 0x00000000D83CDFBEL, 0x00000000D83CDFB1L, 0x00000000D83CDFC9L, 0x00000000D83CDFB3L, 0x00000000000026F3L, 0x00000000D83DDEB5L, 0x00000000D83DDEB4L, 0x00000000D83CDFC1L, 0x00000000D83CDFC7L, 0x00000000D83CDFC6L, 0x00000000D83CDFBFL, 0x00000000D83CDFC2L, 0x00000000D83CDFCAL, 0x00000000D83CDFC4L, 0x00000000D83CDFA3L, 0x0000000000002615L, 0x00000000D83CDF75L, 0x00000000D83CDF76L, 0x00000000D83CDF7CL, 0x00000000D83CDF7AL, 0x00000000D83CDF7BL, 0x00000000D83CDF78L, 0x00000000D83CDF79L, 0x00000000D83CDF77L, 0x00000000D83CDF74L, 0x00000000D83CDF55L, 0x00000000D83CDF54L, 0x00000000D83CDF5FL, 0x00000000D83CDF57L, 0x00000000D83CDF56L, 0x00000000D83CDF5DL, 0x00000000D83CDF5BL, 0x00000000D83CDF64L, 0x00000000D83CDF71L, 0x00000000D83CDF63L, 0x00000000D83CDF65L, 0x00000000D83CDF59L, 0x00000000D83CDF58L, 0x00000000D83CDF5AL, 0x00000000D83CDF5CL, 0x00000000D83CDF72L, 0x00000000D83CDF62L, 0x00000000D83CDF61L, 0x00000000D83CDF73L, 0x00000000D83CDF5EL, 0x00000000D83CDF69L, 0x00000000D83CDF6EL, 0x00000000D83CDF66L, 0x00000000D83CDF68L, 0x00000000D83CDF67L, 0x00000000D83CDF82L, 0x00000000D83CDF70L, 0x00000000D83CDF6AL, 0x00000000D83CDF6BL, 0x00000000D83CDF6CL, 0x00000000D83CDF6DL, 0x00000000D83CDF6FL, 0x00000000D83CDF4EL, 0x00000000D83CDF4FL, 0x00000000D83CDF4AL, 0x00000000D83CDF4BL, 0x00000000D83CDF52L, 0x00000000D83CDF47L, 0x00000000D83CDF49L, 0x00000000D83CDF53L, 0x00000000D83CDF51L, 0x00000000D83CDF48L, 0x00000000D83CDF4CL, 0x00000000D83CDF50L, 0x00000000D83CDF4DL, 0x00000000D83CDF60L, 0x00000000D83CDF46L, 0x00000000D83CDF45L, 0x00000000D83CDF3DL}, new ulong[]{ 0x00000000D83CDFE0L, 0x00000000D83CDFE1L, 0x00000000D83CDFEBL, 0x00000000D83CDFE2L, 0x00000000D83CDFE3L, 0x00000000D83CDFE5L, 0x00000000D83CDFE6L, 0x00000000D83CDFEAL, 0x00000000D83CDFE9L, 0x00000000D83CDFE8L, 0x00000000D83DDC92L, 0x00000000000026EAL, 0x00000000D83CDFECL, 0x00000000D83CDFE4L, 0x00000000D83CDF07L, 0x00000000D83CDF06L, 0x00000000D83CDFEFL, 0x00000000D83CDFF0L, 0x00000000000026FAL, 0x00000000D83CDFEDL, 0x00000000D83DDDFCL, 0x00000000D83DDDFEL, 0x00000000D83DDDFBL, 0x00000000D83CDF04L, 0x00000000D83CDF05L, 0x00000000D83CDF03L, 0x00000000D83DDDFDL, 0x00000000D83CDF09L, 0x00000000D83CDFA0L, 0x00000000D83CDFA1L, 0x00000000000026F2L, 0x00000000D83CDFA2L, 0x00000000D83DDEA2L, 0x00000000000026F5L, 0x00000000D83DDEA4L, 0x00000000D83DDEA3L, 0x0000000000002693L, 0x00000000D83DDE80L, 0x0000000000002708L, 0x00000000D83DDCBAL, 0x00000000D83DDE81L, 0x00000000D83DDE82L, 0x00000000D83DDE8AL, 0x00000000D83DDE89L, 0x00000000D83DDE9EL, 0x00000000D83DDE86L, 0x00000000D83DDE84L, 0x00000000D83DDE85L, 0x00000000D83DDE88L, 0x00000000D83DDE87L, 0x00000000D83DDE9DL, 0x00000000D83DDE8BL, 0x00000000D83DDE83L, 0x00000000D83DDE8EL, 0x00000000D83DDE8CL, 0x00000000D83DDE8DL, 0x00000000D83DDE99L, 0x00000000D83DDE98L, 0x00000000D83DDE97L, 0x00000000D83DDE95L, 0x00000000D83DDE96L, 0x00000000D83DDE9BL, 0x00000000D83DDE9AL, 0x00000000D83DDEA8L, 0x00000000D83DDE93L, 0x00000000D83DDE94L, 0x00000000D83DDE92L, 0x00000000D83DDE91L, 0x00000000D83DDE90L, 0x00000000D83DDEB2L, 0x00000000D83DDEA1L, 0x00000000D83DDE9FL, 0x00000000D83DDEA0L, 0x00000000D83DDE9CL, 0x00000000D83DDC88L, 0x00000000D83DDE8FL, 0x00000000D83CDFABL, 0x00000000D83DDEA6L, 0x00000000D83DDEA5L, 0x00000000000026A0L, 0x00000000D83DDEA7L, 0x00000000D83DDD30L, 0x00000000000026FDL, 0x00000000D83CDFEEL, 0x00000000D83CDFB0L, 0x0000000000002668L, 0x00000000D83DDDFFL, 0x00000000D83CDFAAL, 0x00000000D83CDFADL, 0x00000000D83DDCCDL, 0x00000000D83DDEA9L, 0xD83CDDEFD83CDDF5L, 0xD83CDDF0D83CDDF7L, 0xD83CDDE9D83CDDEAL, 0xD83CDDE8D83CDDF3L, 0xD83CDDFAD83CDDF8L, 0xD83CDDEBD83CDDF7L, 0xD83CDDEAD83CDDF8L, 0xD83CDDEED83CDDF9L, 0xD83CDDF7D83CDDFAL, 0xD83CDDECD83CDDE7L}, new ulong[]{ 0x00000000003120E3L, 0x00000000003220E3L, 0x00000000003320E3L, 0x00000000003420E3L, 0x00000000003520E3L, 0x00000000003620E3L, 0x00000000003720E3L, 0x00000000003820E3L, 0x00000000003920E3L, 0x00000000003020E3L, 0x00000000D83DDD1FL, 0x00000000D83DDD22L, 0x00000000002320E3L, 0x00000000D83DDD23L, 0x0000000000002B06L, 0x0000000000002B07L, 0x0000000000002B05L, 0x00000000000027A1L, 0x00000000D83DDD20L, 0x00000000D83DDD21L, 0x00000000D83DDD24L, 0x0000000000002197L, 0x0000000000002196L, 0x0000000000002198L, 0x0000000000002199L, 0x0000000000002194L, 0x0000000000002195L, 0x00000000D83DDD04L, 0x00000000000025C0L, 0x00000000000025B6L, 0x00000000D83DDD3CL, 0x00000000D83DDD3DL, 0x00000000000021A9L, 0x00000000000021AAL, 0x0000000000002139L, 0x00000000000023EAL, 0x00000000000023E9L, 0x00000000000023EBL, 0x00000000000023ECL, 0x0000000000002935L, 0x0000000000002934L, 0x00000000D83CDD97L, 0x00000000D83DDD00L, 0x00000000D83DDD01L, 0x00000000D83DDD02L, 0x00000000D83CDD95L, 0x00000000D83CDD99L, 0x00000000D83CDD92L, 0x00000000D83CDD93L, 0x00000000D83CDD96L, 0x00000000D83DDCF6L, 0x00000000D83CDFA6L, 0x00000000D83CDE01L, 0x00000000D83CDE2FL, 0x00000000D83CDE33L, 0x00000000D83CDE35L, 0x00000000D83CDE34L /* was missing */, 0x00000000D83CDE32L, 0x00000000D83CDE50L /* //34 was wrong */, 0x00000000D83CDE39L /* //32 was duplicate */, /* removed 3 */ 0x00000000D83CDE3AL, 0x00000000D83CDE36L, 0x00000000D83CDE1AL, 0x00000000D83DDEBBL, 0x00000000D83DDEB9L, 0x00000000D83DDEBAL, 0x00000000D83DDEBCL, 0x00000000D83DDEBEL, 0x00000000D83DDEB0L, 0x00000000D83DDEAEL, 0x00000000D83CDD7FL, 0x000000000000267FL, 0x00000000D83DDEADL, 0x00000000D83CDE37L, 0x00000000D83CDE38L, 0x00000000D83CDE02L, 0x00000000000024C2L, /* missing 4 unicodes */ 0x00000000D83DDEC2L, 0x00000000D83DDEC4L, 0x00000000D83DDEC5L, 0x00000000D83DDEC3L, 0x00000000D83CDE51L, 0x0000000000003299L, 0x0000000000003297L, 0x00000000D83CDD91L, 0x00000000D83CDD98L, 0x00000000D83CDD94L, 0x00000000D83DDEABL, 0x00000000D83DDD1EL, 0x00000000D83DDCF5L, 0x00000000D83DDEAFL, 0x00000000D83DDEB1L, 0x00000000D83DDEB3L, 0x00000000D83DDEB7L, 0x00000000D83DDEB8L, 0x00000000000026D4L, 0x0000000000002733L, 0x0000000000002747L, 0x000000000000274EL, 0x0000000000002705L, 0x0000000000002734L, 0x00000000D83DDC9FL, 0x00000000D83CDD9AL, 0x00000000D83DDCF3L, 0x00000000D83DDCF4L, 0x00000000D83CDD70L, 0x00000000D83CDD71L, 0x00000000D83CDD8EL, 0x00000000D83CDD7EL, 0x00000000D83DDCA0L, 0x00000000000027BFL, 0x000000000000267BL, 0x0000000000002648L, 0x0000000000002649L, 0x000000000000264AL, 0x000000000000264BL, 0x000000000000264CL, 0x000000000000264DL, 0x000000000000264EL, 0x000000000000264FL, 0x0000000000002650L, 0x0000000000002651L, 0x0000000000002652L, 0x0000000000002653L, 0x00000000000026CEL, 0x00000000D83DDD2FL, 0x00000000D83CDFE7L, 0x00000000D83DDCB9L, 0x00000000D83DDCB2L, 0x00000000D83DDCB1L, 0x00000000000000A9L, 0x00000000000000AEL, 0x0000000000002122L /* TM */, /* was mixed, missing 2-3 */ 0x000000000000274CL, 0x000000000000203CL, 0x0000000000002049L, 0x0000000000002757L, 0x0000000000002753L, 0x0000000000002755L, 0x0000000000002754L, 0x0000000000002B55L, 0x00000000D83DDD1DL, 0x00000000D83DDD1AL, 0x00000000D83DDD19L, 0x00000000D83DDD1BL, 0x00000000D83DDD1CL, 0x00000000D83DDD03L, 0x00000000D83DDD5BL, 0x00000000D83DDD67L, 0x00000000D83DDD50L, 0x00000000D83DDD5CL, 0x00000000D83DDD51L, 0x00000000D83DDD5DL, 0x00000000D83DDD52L, 0x00000000D83DDD5EL, 0x00000000D83DDD53L, 0x00000000D83DDD5FL, 0x00000000D83DDD54L, 0x00000000D83DDD60L, 0x00000000D83DDD55L, 0x00000000D83DDD56L, 0x00000000D83DDD57L, 0x00000000D83DDD58L, 0x00000000D83DDD59L, 0x00000000D83DDD5AL, 0x00000000D83DDD61L, 0x00000000D83DDD62L, 0x00000000D83DDD63L, 0x00000000D83DDD64L, 0x00000000D83DDD65L, 0x00000000D83DDD66L, 0x0000000000002716L, 0x0000000000002795L, 0x0000000000002796L, 0x0000000000002797L, 0x0000000000002660L, 0x0000000000002665L, 0x0000000000002663L, 0x0000000000002666L, 0x00000000D83DDCAEL, 0x00000000D83DDCAFL, 0x0000000000002714L, 0x0000000000002611L, 0x00000000D83DDD18L, 0x00000000D83DDD17L, 0x00000000000027B0L, 0x0000000000003030L, 0x000000000000303DL, 0x00000000D83DDD31L, 0x00000000000025FCL, 0x00000000000025FBL, 0x00000000000025FEL, 0x00000000000025FDL, 0x00000000000025AAL, 0x00000000000025ABL, 0x00000000D83DDD3AL, 0x00000000D83DDD32L, 0x00000000D83DDD33L, 0x00000000000026ABL, 0x00000000000026AAL, 0x00000000D83DDD34L, 0x00000000D83DDD35L, 0x00000000D83DDD3BL, 0x0000000000002B1CL, 0x0000000000002B1BL, 0x00000000D83DDD36L, 0x00000000D83DDD37L, 0x00000000D83DDD38L, 0x00000000D83DDD39L}}; } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Emoji/EmojiSpriteItem.cs ================================================ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using Telegram.Controls.VirtualizedView; namespace EmojiPanel.Controls.Emoji { public class EmojiSpriteItem : VListItemBase { public int CategoryIndex; public int SpriteOffset; public int Rows; public EventHandler EmojiSelected = delegate { }; public EmojiSpriteItem(int categoryIndex, int spriteOffset) { CategoryIndex = categoryIndex; SpriteOffset = spriteOffset; Rows = EmojiData.SpriteRowsCountByCategory[categoryIndex][spriteOffset]; var emojiInCategory = EmojiData.CodesByCategory[categoryIndex]; ulong[] emojis = null; emojis = spriteOffset != 0 ? emojiInCategory.Skip(spriteOffset*EmojiData.ItemsInSprite).Take(EmojiData.ItemsInSprite).ToArray() : emojiInCategory.Take(EmojiData.ItemsInSprite).ToArray(); View.Width = SpriteWidth + 8; var decodePixelWidth = SpriteWidth; switch (Application.Current.Host.Content.ScaleFactor) { case 100: break; case 150: decodePixelWidth = 711; break; case 160: decodePixelWidth = 758; break; } var image = new Image { Width = SpriteWidth, Source = new BitmapImage { DecodePixelWidth = decodePixelWidth, DecodePixelType = DecodePixelType.Physical //UriSource = spriteUri }, Margin = new Thickness(4, 1, 4, 1), VerticalAlignment = VerticalAlignment.Top }; Children.Add(image); View.MouseLeftButtonDown += ViewOnMouseLeftButtonDown; View.LostMouseCapture += ViewOnLostMouseCapture; View.MouseLeftButtonUp += ViewOnLostMouseCapture; View.MouseLeave += ViewOnLostMouseCapture; View.Tap += ViewOnTap; CreateBorders(); } public EmojiSpriteItem(Uri spriteUri, int categoryIndex, int spriteOffset) { CategoryIndex = categoryIndex; SpriteOffset = spriteOffset; Rows = EmojiData.SpriteRowsCountByCategory[categoryIndex][spriteOffset]; View.Width = SpriteWidth + 8; var decodePixelWidth = SpriteWidth; switch (Application.Current.Host.Content.ScaleFactor) { case 100: break; case 150: decodePixelWidth = 711; break; case 160: decodePixelWidth = 758; break; } var image = new Image { Width = SpriteWidth, Source = new BitmapImage { DecodePixelWidth = decodePixelWidth, DecodePixelType = DecodePixelType.Physical, UriSource = spriteUri }, Margin = new Thickness(4, 1, 4, 1), VerticalAlignment = VerticalAlignment.Top }; Children.Add(image); View.MouseLeftButtonDown += ViewOnMouseLeftButtonDown; View.LostMouseCapture += ViewOnLostMouseCapture; View.MouseLeftButtonUp += ViewOnLostMouseCapture; View.MouseLeave += ViewOnLostMouseCapture; View.Tap += ViewOnTap; CreateBorders(); } private static void ViewOnLostMouseCapture(object sender, MouseEventArgs mouseEventArgs) { ClearCurrentHighlight(); } public static void ClearCurrentHighlight() { if (_currentHighlight == null) return; var parent = _currentHighlight.Parent as Grid; if (parent != null) parent.Children.Remove(_currentHighlight); _currentHighlight = null; } private void ViewOnMouseLeftButtonDown(object sender, MouseButtonEventArgs args) { var point = args.GetPosition(View); var column = (int) Math.Ceiling(point.X / ColumnWidth); var row = (int) Math.Ceiling(point.Y / RowHeight); if (column <= 0 || row <= 0) return; if (Rows < MaxRowsInSprite && row == Rows) { if (EmojiData.ItemsInRow - EmojiData.SpriteMissingCellsByCategory[CategoryIndex] < column) return; } var emojiHoverBackground = new Rectangle { Width = ColumnWidth - 2, //width without 2px border Height = RowHeight, Fill = (Brush) Application.Current.Resources["PhoneAccentBrush"], Margin = new Thickness((column - 1) * 79 + 4, (row - 1) * 70 + 2, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; View.Children.Insert(0, emojiHoverBackground); ClearCurrentHighlight(); _currentHighlight = emojiHoverBackground; } private void ViewOnTap(object sender, GestureEventArgs args) { var point = args.GetPosition(View); var column = (int) Math.Ceiling(point.X / 79); var row = (int) Math.Ceiling(point.Y / 70); if (column <= 0 || row <= 0) return; //Debug.WriteLine("{0}-{1}", column, row); var itemIndex = (row - 1) * EmojiData.ItemsInRow + (column - 1); var emoji = EmojiDataItem.GetByIndex(CategoryIndex, SpriteOffset, itemIndex); if (emoji != null) EmojiSelected(null, emoji); } private static Rectangle _currentHighlight; private void CreateBorders() { for (int i = 0; i < Rows + 1; i++) { var line = new Rectangle { Width = SpriteWidth + 4, Height = 2, Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Margin = new Thickness(0, i * RowHeight, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(line); } for (int i = 0; i < 5; i++) { var line = new Rectangle { Width = 2, Height = RowHeight * Rows, Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Margin = new Thickness((i + 1) * ColumnWidth + 2, 0, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(line); } if (Rows < MaxRowsInSprite) { var missingRows = EmojiData.SpriteMissingCellsByCategory[CategoryIndex]; var startIndex = EmojiData.ItemsInRow - missingRows; var width = missingRows * ColumnWidth; var horizontalOffset = startIndex * ColumnWidth + 4; var rect = new Rectangle { Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Width = width, Height = RowHeight, Margin = new Thickness(horizontalOffset, (Rows - 1) * RowHeight, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(rect); } } public const int SpriteWidth = 472; public const int SpriteHeight = 420; public const int ColumnWidth = 79; public const int RowHeight = 70; // 105 in pixel logic public const int MaxRowsInSprite = 6; public override double FixedHeight { get { return RowHeight * Rows; } set { } } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/DelayedExecutor.cs ================================================ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Phone.Logging; namespace Telegram.Controls.Utilities { public class DelayedExecutor { class ExecutionInfo { public Action Action { get; set; } public DateTime Timestamp { get; set; } } ExecutionInfo m_executionInfo; Timer m_timer; int m_delay; bool m_timerIsActive; object m_lockObj = new object(); public DelayedExecutor(int delay) // TO DO : add IDateTimeProvider dependency to remove dependency on DateTime { m_delay = delay; m_timer = new Timer(TimerCallback); } public void AddToDelayedExecution(Action action) { lock (m_lockObj) { m_executionInfo = new ExecutionInfo() { Action = action, Timestamp = DateTime.Now }; } ChangeTimer(true); } private void TimerCallback(object state) { Action executeAction = null; lock (m_lockObj) { if (m_executionInfo != null) { if (DateTime.Now - m_executionInfo.Timestamp >= TimeSpan.FromMilliseconds(m_delay)) { Debug.WriteLine("Action is set to be executed."); executeAction = m_executionInfo.Action; m_executionInfo = null; ChangeTimer(false); } } } if (executeAction != null) { try { executeAction(); } catch (Exception exc) { //Logger.Instance.Error("Exeption during delayed execution", exc); } } } private void ChangeTimer(bool activate) { if (activate && !m_timerIsActive) { lock (m_timer) { m_timerIsActive = true; m_timer.Change(m_delay, m_delay); } } else if (!activate && m_timerIsActive) { lock (m_timer) { m_timerIsActive = false; m_timer.Change(Timeout.Infinite, 0); } } } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/Helpers.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace EmojiPanel.Controls.Utilites { public static class Helpers { public static Uri GetAssetUri(string assetName) { switch (Application.Current.Host.Content.ScaleFactor) { case 100: return new Uri(String.Format("/Assets/{0}-WVGA.png", assetName), UriKind.Relative); case 160: return new Uri(String.Format("/Assets/{0}-WXGA.png", assetName), UriKind.Relative); case 150: return new Uri(String.Format("/Assets/{0}-720p.png", assetName), UriKind.Relative); default: return new Uri(String.Format("/Assets/{0}-WVGA.png", assetName), UriKind.Relative); } } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/MyListItemBase.cs ================================================ using System.Windows.Controls; using System.Windows.Controls.Primitives; using Telegram.Controls.VirtualizedView; namespace Telegram.Controls.VirtualizedView { public class MyListItemBase : Grid { //private Panel _contentPanel; //public Panel ContentPanel //{ // get // { // return _contentPanel; // } // set // { // _contentPanel = value; // Content = _contentPanel; // } //} public VListItemBase VirtSource { get; set; } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/MyVirtualizingPanel.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using Telegram.Controls.Utilities; namespace Telegram.Controls.VirtualizedView { public class MyVirtualizingPanel : Canvas { private const bool IsLogEnabled = false; private static void Log(string str) { if (IsLogEnabled) { Debug.WriteLine(str); } } private const double LoadUnloadThreshold = 500; private const double LoadedHeightUpwards = 300; private const double LoadedHeightDownwards = 900; private const double LoadedHeightDownwardsNotScrolling = 800; private bool _changingVerticalOffset = false; readonly DependencyProperty _listVerticalOffsetProperty = DependencyProperty.Register( "ListVerticalOffset", typeof(double), typeof(MyVirtualizingPanel), new PropertyMetadata(new PropertyChangedCallback(OnListVerticalOffsetChanged))); public double ListVerticalOffset { get { return (double) this.GetValue(_listVerticalOffsetProperty); } set { this.SetValue(_listVerticalOffsetProperty, value); } } private static void OnListVerticalOffsetChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var control = (MyVirtualizingPanel) obj; control.OnListVerticalOffsetChanged(); } private ScrollViewer _scrollViewer; bool _isScrolling = false; public ScrollViewer ScrollViewer { get { return _scrollViewer; } } public void InitializeWithScrollViewer(ScrollViewer scrollViewer) { _scrollViewer = scrollViewer; EnsureBoundToScrollViewer(); } protected void EnsureBoundToScrollViewer() { Binding binding = new Binding { Source = _scrollViewer, Path = new PropertyPath("VerticalOffset"), Mode = BindingMode.OneWay }; this.SetBinding(_listVerticalOffsetProperty, binding); } bool _notReactToScroll = false; private double _savedDelta; //private DelayedExecutor _de = new DelayedExecutor(300); //internal void PrepareForScrollToBottom() //{ // _notReactToScroll = true; // _savedDelta = DeltaOffset; // // load in the end // DeltaOffset = _scrollViewer.ExtentHeight - _scrollViewer.ViewportHeight - _scrollViewer.VerticalOffset; // Debug.WriteLine("PrepareForScrollToBottom"); // PerformLoadUnload2(VirtualizableState.LoadedPartially, false); // _de.AddToDelayedExecution(() => // { // Execute.ExecuteOnUIThread(() => ScrollToBottomCompleted()); // }); //} //internal void ScrollToBottomCompleted() //{ // _notReactToScroll = false; // DeltaOffset = _savedDelta; // PerformLoadUnload(VirtualizableState.LoadedFully); // Debug.WriteLine("ScrolltoBottomCompleted"); //} private void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == "Scrolling") { _isScrolling = true; } else { _isScrolling = false; PerformLoadUnload(true); } } private static VisualStateGroup FindVisualState(FrameworkElement element, string name) { if (element == null) return null; IList groups = VisualStateManager.GetVisualStateGroups(element); foreach (VisualStateGroup group in groups) if (group.Name == name) return group; return null; } public class ScrollPositionChangedEventAgrs : EventArgs { public double CurrentPosition { get; private set; } public double ScrollHeight { get; private set; } public ScrollPositionChangedEventAgrs(double currentPosition, double scrollHeight) { CurrentPosition = currentPosition; ScrollHeight = scrollHeight; } } public event EventHandler ScrollPositionChanged; private double _previousScrollOffset = 0; private DateTime _previousScrollOffsetChangedTime = DateTime.MinValue; private const double PixelsPerSecondThreshold = 200; private void OnListVerticalOffsetChanged() { if (_notReactToScroll) return; if (!_changingVerticalOffset) { var w = new Stopwatch(); w.Start(); PerformLoadUnload(true); w.Stop(); Log("LOADUNLOAD performed in " + w.ElapsedMilliseconds); if (ScrollPositionChanged != null) { ScrollPositionChanged(this, new ScrollPositionChangedEventAgrs( _scrollViewer.VerticalOffset, Height)); } Log("Reported Offset: " + _scrollViewer.VerticalOffset); } } private bool DetermineIfScrollingIsFast() { var now = DateTime.Now; var result = false; if (_previousScrollOffsetChangedTime != DateTime.Now) { var scrolledPixels = Math.Abs(_scrollViewer.VerticalOffset - _previousScrollOffset); var timeInSeconds = (now - _previousScrollOffsetChangedTime).TotalSeconds; if (scrolledPixels != 0) { var speedPixelsPerSecond = scrolledPixels / timeInSeconds; Log(String.Format("Speed of scroll {0} ", speedPixelsPerSecond)); if (speedPixelsPerSecond > PixelsPerSecondThreshold) { result = true; } } } _previousScrollOffsetChangedTime = now; _previousScrollOffset = _scrollViewer.VerticalOffset; return result; } private readonly List _virtItems = new List(); // indexes of loaded items private Segment _loadedSegment = new Segment(); // maps a point to its index in _virtItems // covers only points 0, LoadUnloadThreshold, 2*LoadUnloadThreshold, etc private readonly Dictionary _thresholdPointIndexes = new Dictionary(); // do not change through this property public List VirtItems { get { return _virtItems; } } public MyVirtualizingPanel() { Loaded += MyVirtualizingPanel_Loaded; } void MyVirtualizingPanel_Loaded(object sender, RoutedEventArgs e) { if (!DesignerProperties.GetIsInDesignMode(this)) { // Visual States are always on the first child of the control template FrameworkElement element = VisualTreeHelper.GetChild(_scrollViewer, 0) as FrameworkElement; if (element != null) { VisualStateGroup group = FindVisualState(element, "ScrollStates"); if (group != null) { group.CurrentStateChanging += group_CurrentStateChanging; } } } } public void AddItems(IEnumerable _itemsToBeAdded) { var sw = new Stopwatch(); sw.Start(); double topMargin = 0; if (_virtItems.Count > 0) { topMargin = _virtItems.Sum(vi => vi.FixedHeight); } foreach (var itemToBeAdded in _itemsToBeAdded) { itemToBeAdded.View.Margin = new Thickness(itemToBeAdded.Margin.Left, itemToBeAdded.Margin.Top + topMargin, itemToBeAdded.Margin.Right, itemToBeAdded.Margin.Bottom); _virtItems.Add(itemToBeAdded); var itemHeightIncludingMargin = itemToBeAdded.FixedHeight; List coveredPoints = GetCoveredPoints(topMargin, topMargin + itemHeightIncludingMargin); foreach (var coveredPoint in coveredPoints) { _thresholdPointIndexes[coveredPoint] = _virtItems.Count - 1; // index of the last } topMargin += itemHeightIncludingMargin; } PerformLoadUnload(true); Height = topMargin; sw.Stop(); Log(String.Format("MyVirtualizingPanel.AddItems {0}", sw.ElapsedMilliseconds)); } public void InsertRemoveItems(int index, List itemsToInsert, bool keepItemsBelowIndexFixed = false, VListItemBase itemToRemove = null) { bool needToAdjustScrollPositionAfterInsertion = false; if (keepItemsBelowIndexFixed) { double totalHeightOfAllItemsBeforeIndex = 0; for (int i = 0; i < index; i++) { totalHeightOfAllItemsBeforeIndex += VirtItems[i].FixedHeight + VirtItems[i].Margin.Top + VirtItems[i].Margin.Bottom; } if (totalHeightOfAllItemsBeforeIndex < _scrollViewer.VerticalOffset + _scrollViewer.ViewportHeight) { needToAdjustScrollPositionAfterInsertion = true; } } // UnloadItemsInSegment(_loadedSegment); _loadedSegment = new Segment(); var totalHeight = itemsToInsert.Sum(i => i.FixedHeight + i.Margin.Top + i.Margin.Bottom); _virtItems.InsertRange(index, itemsToInsert); if (itemToRemove != null) { itemToRemove.IsVLoaded = false; totalHeight -= itemToRemove.FixedHeight + itemToRemove.Margin.Top + itemToRemove.Margin.Bottom; _virtItems.Remove(itemToRemove); } RearrangeAllItems(); if (needToAdjustScrollPositionAfterInsertion) { _changingVerticalOffset = true; //Debug.WriteLine("SCROLLING TO " + _scrollViewer.VerticalOffset + totalHeight + " scroll height : " + _scrollViewer.ExtentHeight); _scrollViewer.ScrollToVerticalOffset(_scrollViewer.VerticalOffset + totalHeight); _changingVerticalOffset = false; } PerformLoadUnload(false); } public void RemoveItem(VListItemBase itemToBeRemoved) { itemToBeRemoved.IsVLoaded = false; _virtItems.Remove(itemToBeRemoved); _loadedSegment = new Segment(); RearrangeAllItems(); PerformLoadUnload(true); } private void RearrangeAllItems() { double topMargin = 0; _thresholdPointIndexes.Clear(); int ind = 0; foreach (var item in _virtItems) { item.View.Margin = new Thickness(item.Margin.Left, item.Margin.Top + topMargin, item.Margin.Right, item.Margin.Bottom); var itemHeightIncludingMargin = item.FixedHeight + item.Margin.Top + item.Margin.Bottom; List coveredPoints = GetCoveredPoints(topMargin, topMargin + itemHeightIncludingMargin); foreach (var coveredPoint in coveredPoints) { _thresholdPointIndexes[coveredPoint] = ind; // index of the last } topMargin += itemHeightIncludingMargin; ind++; } Height = topMargin; _scrollViewer.UpdateLayout(); } private void PerformLoadUnload2(bool isToLoad, bool bypassUnload = false) { if (_virtItems.Count == 0) return; double currentOffset = GetRealOffset(); int lowestLoadedInd = 0; int upperInd = 0; bool triggerLoading = false; if (isToLoad || _loadedSegment.IsEmpty) { triggerLoading = true; } else { lowestLoadedInd = _loadedSegment.LowerBound; upperInd = _loadedSegment.UpperBound; double topPoint = _virtItems[lowestLoadedInd].View.Margin.Top; double bottomPoint = _virtItems[upperInd].View.Margin.Top + _virtItems[upperInd].FixedHeight; if (currentOffset - topPoint < 500 || bottomPoint - currentOffset < 1500) { triggerLoading = true; } } if (triggerLoading) { if (_scrollViewer.ExtentHeight < 3000 && _isScrolling) { //Debug.WriteLine("Detected short scroll; loading all items"); // otherwise there are glitches in scrolling lowestLoadedInd = 0; upperInd = VirtItems.Count - 1; isToLoad = true; } else { var threshold = (int) Math.Floor((currentOffset - (currentOffset % LoadUnloadThreshold))); int indexOfBaseItem = _thresholdPointIndexes.ContainsKey(threshold) ? _thresholdPointIndexes[threshold] : -1; lowestLoadedInd = upperInd = indexOfBaseItem < 0 ? 0 : indexOfBaseItem; double loadUpwards = LoadedHeightUpwards; double loadDownwards = _isScrolling ? LoadedHeightDownwards : LoadedHeightDownwardsNotScrolling; //if (_isScrolling) //{ // loadUpwards = LoadUpwardsWhenScrolling; // loadDownwards = LoadDownwardsWhenScrolling; //} // count up from the lower point on view while (lowestLoadedInd > 0 && currentOffset - _virtItems[lowestLoadedInd].View.Margin.Top < loadUpwards) { lowestLoadedInd--; } while (upperInd < _virtItems.Count - 1 && _virtItems[upperInd].View.Margin.Top - currentOffset < loadDownwards) { upperInd++; } } SetLoadedBounds(lowestLoadedInd, upperInd, isToLoad, bypassUnload); if (IsLogEnabled) { string loadedIndexes = "Loaded indexes : "; for (int i = 0; i < _virtItems.Count; i++) { if (_virtItems[i].IsVLoaded) { loadedIndexes += i + ","; } } Log(loadedIndexes); } } } public double DeltaOffset { get; set; } private double GetRealOffset() { //// it might throw exception //try //{ // GeneralTransform childTransform = this.TransformToVisual(_listScrollViewer); // var p = childTransform.Transform(new Point(0, 0)); // var delta = p.Y; // Debug.WriteLine("DELTA offset =" + delta + "; VerticalOffset=" + _listScrollViewer.VerticalOffset); // return -delta; //} //catch (Exception exc) //{ // return _listScrollViewer.VerticalOffset; //} return _scrollViewer.VerticalOffset + DeltaOffset; } private void PerformLoadUnload(bool isToLoad) { PerformLoadUnload2(isToLoad); } private void SetLoadedBounds(int lowerBoundInd, int upperBoundInd, bool isToLoad, bool bypassUnload = false) { var newLoadedSegment = new Segment(lowerBoundInd, upperBoundInd); Segment newMinusLoaded1; Segment newMinusLoaded2; Segment intersection; Segment loadedMinusNew1; Segment loadedMinusNew2; newLoadedSegment.CompareToSegment(_loadedSegment, out newMinusLoaded1, out newMinusLoaded2, out intersection, out loadedMinusNew1, out loadedMinusNew2); Log(String.Format("LoadedSegment:{0}, NewSegment:{1}, NewMinusLoaded1:{2}, NewMinusLoaded2:{3}, loadedMinusNew1:{4}, loadedMinusNew2:{5}", _loadedSegment, newLoadedSegment, newMinusLoaded1, newMinusLoaded2, loadedMinusNew1, loadedMinusNew2)); if (isToLoad) { // ensure items are loaded fully for the whole segment LoadItemsInSegment(newLoadedSegment); } if (!bypassUnload) { UnloadItemsInSegment(loadedMinusNew1); UnloadItemsInSegment(loadedMinusNew2); } _loadedSegment = newLoadedSegment; } private void UnloadItemsInSegment(Segment segment) { for (int i = segment.LowerBound; i <= segment.UpperBound; i++) { var item = _virtItems[i]; Children.Remove(item.View); item.IsVLoaded = false; } } private void LoadItemsInSegment(Segment segment) { for (int i = segment.LowerBound; i <= segment.UpperBound; i++) { var item = _virtItems[i]; item.IsVLoaded = true; if (!Children.Contains(item.View)) { Children.Add(item.View); } } } private List GetCoveredPoints(double from, double to) { var result = new List(); var candidate = from - (from % LoadUnloadThreshold); while (candidate <= to) { if (candidate >= from) { result.Add((int) Math.Floor(candidate)); } candidate += LoadUnloadThreshold; } return result; } public void ClearItems() { _virtItems.Clear(); Children.Clear(); _loadedSegment = new Segment(); _thresholdPointIndexes.Clear(); _scrollViewer.ScrollToVerticalOffset(0); Height = 0; } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/VListItemBase.cs ================================================ using System.Collections.Generic; using System.Windows; using Rectangle = System.Windows.Shapes.Rectangle; namespace Telegram.Controls.VirtualizedView { public abstract class VListItemBase { private readonly List _children = new List(); public MyListItemBase View { get; private set; } public List Children { get { return _children; } } protected VListItemBase() { View = new MyListItemBase { VirtSource = this, Width = 440 }; } public abstract double FixedHeight { get; set; } public Thickness Margin = new Thickness(); public virtual object ItemSource { get; set; } private bool _isVLoaded; public bool IsVLoaded { get { return _isVLoaded; } set { if (value != IsVLoaded) { if (value) Load(); else Unload(); } _isVLoaded = value; } } public virtual void Load() { if (View.Children.Count == 0) foreach (var child in _children) View.Children.Add(child); } public virtual void Unload() { View.Children.Clear(); } } } ================================================ FILE: EmojiPanel/EmojiPanel/Controls/Utilites/VirtSegment.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Telegram.Controls.Utilities { public class Segment { public int LowerBound { get; private set; } public int UpperBound { get; private set; } public bool IsEmpty { get { return UpperBound < LowerBound; } } public Segment(int lowerBound, int upperBound) { LowerBound = lowerBound; UpperBound = upperBound; } public Segment() : this(0, -1) { } public override string ToString() { if (IsEmpty) return "[]"; return String.Format("[{0},{1}]", LowerBound, UpperBound); } public void CompareToSegment( Segment otherSegment, out Segment thisMinusOther1, out Segment thisMinusOther2, out Segment intersection, out Segment otherMinusThis1, out Segment otherMinusThis2) { thisMinusOther1 = new Segment(); thisMinusOther2 = new Segment(); intersection = new Segment(); otherMinusThis1 = new Segment(); otherMinusThis2 = new Segment(); if (this.IsEmpty) { otherMinusThis1 = otherSegment; return; } if (otherSegment.IsEmpty) { thisMinusOther1 = this; return; } if (this.UpperBound < otherSegment.LowerBound) { // do not intersect thisMinusOther1 = this; otherMinusThis1 = otherSegment; return; } if (this.LowerBound < otherSegment.LowerBound && this.UpperBound >= otherSegment.LowerBound && this.UpperBound <= otherSegment.UpperBound) { thisMinusOther1 = new Segment(this.LowerBound, otherSegment.LowerBound - 1); intersection = new Segment(otherSegment.LowerBound, this.UpperBound); otherMinusThis1 = new Segment(this.UpperBound + 1, otherSegment.UpperBound); return; } if (this.LowerBound >= otherSegment.LowerBound && this.UpperBound <= otherSegment.UpperBound) { intersection = this; otherMinusThis1 = new Segment(otherSegment.LowerBound, this.LowerBound - 1); otherMinusThis2 = new Segment(this.UpperBound + 1, otherSegment.UpperBound); return; } otherSegment.CompareToSegment(this, out otherMinusThis1, out otherMinusThis2, out intersection, out thisMinusOther1, out thisMinusOther2); } } } ================================================ FILE: EmojiPanel/EmojiPanel/EmojiPanel.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {2FCB4C15-FE40-496F-87D6-84220F3F07F8} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties EmojiPanel EmojiPanel v8.0 WindowsPhone true true true EmojiPanel_$(Configuration)_$(Platform).xap Properties\AppManifest.xml EmojiPanel.App true true 4.0 11.0 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 Bin\x86\Debug true full false Bin\x86\Release pdbonly true Bin\ARM\Debug true full false Bin\ARM\Release pdbonly true App.xaml EmojiControl.xaml MainPage.xaml Designer MSBuild:Compile MSBuild:Compile Designer Designer MSBuild:Compile Designer MSBuild:Compile MSBuild:Compile Designer Designer PreserveNewest PreserveNewest False Клиентский профиль .NET Framework 3.5 с пакетом обновления 1 %28SP1%29 false False .NET Framework 3.5 SP1 false ================================================ FILE: EmojiPanel/EmojiPanel/MainPage.xaml ================================================  ================================================ FILE: EmojiPanel/EmojiPanel/MainPage.xaml.cs ================================================ using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using EmojiPanel.Controls.Emoji; using Microsoft.Phone.Controls; namespace EmojiPanel { public partial class MainPage { public EmojiControl EmojiInstance; public MainPage() { InitializeComponent(); } private void OnSmileIconClick(object sender, EventArgs e) { if (EmojiInstance == null) { // Initialize EmojiControl EmojiInstance = EmojiControl.GetInstance(); EmojiInstance.BindTextBox(InputTextBox); ContentPanel.Children.Add(EmojiInstance); // Add to view } EmojiInstance.IsOpen = !EmojiInstance.IsOpen; } protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); if (EmojiInstance == null) return; // Destroy EmojiControl EmojiInstance.IsOpen = false; EmojiInstance.UnbindTextBox(); ContentPanel.Children.Remove(EmojiInstance); // Remove from view EmojiInstance = null; } private void ClearAllButtonClick(object sender, EventArgs e) { InputTextBox.Text = ""; } } } ================================================ FILE: EmojiPanel/EmojiPanel/Properties/AppManifest.xml ================================================  ================================================ FILE: EmojiPanel/EmojiPanel/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("EmojiPanel")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EmojiPanel")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("d6cfdaad-1212-43b4-9539-203b0c855191")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en-US")] ================================================ FILE: EmojiPanel/EmojiPanel/Properties/WMAppManifest.xml ================================================  ApplicationIcon.png Background.png 0 Background.png EmojiPanel False ================================================ FILE: ExifLib/ExifIO.cs ================================================ using System; namespace ExifLib { /// /// Utility to handle multi-byte primitives in both big and little endian. /// http://msdn.microsoft.com/en-us/library/system.bitconverter.islittleendian.aspx /// http://en.wikipedia.org/wiki/Endianness /// public static class ExifIO { public static short ReadShort(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToInt16(Data, offset); } else { byte[] beBytes = new byte[2] { Data[offset + 1], Data[offset] }; return BitConverter.ToInt16(beBytes, 0); } } public static ushort ReadUShort(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToUInt16(Data, offset); } else { byte[] beBytes = new byte[2] { Data[offset + 1], Data[offset] }; return BitConverter.ToUInt16(beBytes, 0); } } public static int ReadInt(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToInt32(Data, offset); } else { byte[] beBytes = new byte[4] { Data[offset + 3], Data[offset + 2], Data[offset + 1], Data[offset] }; return BitConverter.ToInt32(beBytes, 0); } } public static uint ReadUInt(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToUInt32(Data, offset); } else { byte[] beBytes = new byte[4] { Data[offset + 3], Data[offset + 2], Data[offset + 1], Data[offset] }; return BitConverter.ToUInt32(beBytes, 0); } } public static float ReadSingle(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToSingle(Data, offset); } else { // need to swap the data first byte[] beBytes = new byte[4] { Data[offset + 3], Data[offset + 2], Data[offset + 1], Data[offset] }; return BitConverter.ToSingle(beBytes, 0); } } public static double ReadDouble(byte[] Data, int offset, bool littleEndian) { if ((littleEndian && BitConverter.IsLittleEndian) || (!littleEndian && !BitConverter.IsLittleEndian)) { return BitConverter.ToDouble(Data, offset); } else { // need to swap the data first byte[] beBytes = new byte[8] { Data[offset + 7], Data[offset + 6], Data[offset + 5], Data[offset + 4], Data[offset + 3], Data[offset + 2], Data[offset + 1], Data[offset]}; return BitConverter.ToDouble(beBytes, 0); } } } } ================================================ FILE: ExifLib/ExifIds.cs ================================================ using System; namespace ExifLib { public static class JpegId { public const int START = 0xFF; public const int SOI = 0xD8; public const int SOS = 0xDA; public const int EOI = 0xD9; public const int COM = 0xFE; public const int JFIF = 0xE0; public const int EXIF = 0xE1; public const int IPTC = 0xED; } public enum ExifIFD { Exif = 0x8769, Gps = 0x8825 } public enum ExifId { Unknown = -1, ImageWidth = 0x100, ImageHeight = 0x101, Orientation = 0x112, XResolution = 0x11A, YResolution = 0x11B, ResolutionUnit = 0x128, DateTime = 0x132, Description = 0x10E, Make = 0x10F, Model = 0x110, Software = 0x131, Artist = 0x13B, ThumbnailOffset = 0x201, ThumbnailLength = 0x202, ExposureTime = 0x829A, FNumber = 0x829D, Copyright = 0x8298, FlashUsed = 0x9209, UserComment = 0x9286 } public enum ExifGps { Version = 0x0, LatitudeRef = 0x1, Latitude = 0x2, LongitudeRef = 0x3, Longitude = 0x4, AltitudeRef = 0x5, Altitude = 0x6, TimeStamp = 0x7, Satellites = 0x8, Status = 0x9, MeasureMode = 0xA, DOP = 0xB, SpeedRef = 0xC, Speed = 0xD, TrackRef = 0xE, Track = 0xF, ImgDirectionRef = 0x10, ImgDirection = 0x11, MapDatum = 0x12, DestLatitudeRef = 0x13, DestLatitude = 0x14, DestLongitudeRef = 0x15, DestLongitude = 0x16, DestBearingRef = 0x17, DestBearing = 0x18, DestDistanceRef = 0x19, DestDistance = 0x1A, ProcessingMethod = 0x1B, AreaInformation = 0x1C, DateStamp = 0x1D, Differential = 0x1E } public enum ExifOrientation { TopLeft = 1, BottomRight = 3, TopRight = 6, BottomLeft = 8, Undefined = 9 } public enum ExifUnit { Undefined = 1, Inch = 2, Centimeter = 3 } /// /// As per http://www.exif.org/Exif2-2.PDF /// [Flags] public enum ExifFlash { No = 0x0, Fired = 0x1, StrobeReturnLightDetected = 0x6, On = 0x8, Off = 0x10, Auto = 0x18, FlashFunctionPresent = 0x20, RedEyeReduction = 0x40 } public enum ExifGpsLatitudeRef { Unknown = 0, North, South } public enum ExifGpsLongitudeRef { Unknown = 0, East, West } } ================================================ FILE: ExifLib/ExifLib.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {1E7F202B-8830-42F6-BCDA-2A6C590A7E10} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties ExifLib ExifLib v4.0 $(TargetFrameworkVersion) WindowsPhone71 Silverlight false true true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 ================================================ FILE: ExifLib/ExifReader.cs ================================================ using System; using System.IO; namespace ExifLib { /// /// Based on http://www.media.mit.edu/pia/Research/deepview/exif.html /// http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif.html /// public class ExifReader { public JpegInfo info { get; private set; } private bool littleEndian = false; public static JpegInfo ReadJpeg(FileInfo fi) { DateTime then = DateTime.Now; using (FileStream fs = fi.OpenRead()) { ExifReader reader = new ExifReader(fs); reader.info.FileSize = (int)fi.Length; reader.info.FileName = fi.Name; reader.info.LoadTime = (DateTime.Now - then); return reader.info; } } public static JpegInfo ReadJpeg(Stream stream) { var reader = new ExifReader(stream); return reader.info; } protected ExifReader(Stream stream) { info = new JpegInfo(); int a = stream.ReadByte(); // ensure SOI marker if (a != JpegId.START || stream.ReadByte() != JpegId.SOI) return; info.IsValid = true; for (; ; ) { int marker = 0, prev = 0; // find next marker for (a = 0; ; ++a) { marker = stream.ReadByte(); if (marker != JpegId.START && prev == JpegId.START) break; prev = marker; } // read section length int lenHigh = stream.ReadByte(); int lenLow = stream.ReadByte(); int itemlen = (lenHigh << 8) | lenLow; // read the section byte[] section = new byte[itemlen]; section[0] = (byte)lenHigh; section[1] = (byte)lenLow; int bytesRead = stream.Read(section, 2, itemlen - 2); if (bytesRead != itemlen - 2) return; switch (marker) { case JpegId.SOS: // start of stream: and we're done return; case JpegId.EOI: // no data? no good. return; case JpegId.EXIF: { if (section[2] == 'E' && section[3] == 'x' && section[4] == 'i' && section[5] == 'f') { ProcessExif(section); } } break; case JpegId.IPTC: { // don't care. } break; case 0xC0: case 0xC1: case 0xC2: case 0xC3: // case 0xC4: // not SOF case 0xC5: case 0xC6: case 0xC7: // case 0xC8: // not SOF case 0xC9: case 0xCA: case 0xCB: // case 0xCC: // not SOF case 0xCD: case 0xCE: case 0xCF: { ProcessSOF(section, marker); } break; default: { // don't care. } break; } section = null; GC.Collect(); } } private void ProcessExif(byte[] section) { int idx = 6; if (section[idx++] != 0 || section[idx++] != 0) { // "Exif" is not followed by 2 null bytes. return; } if (section[idx] == 'I' && section[idx + 1] == 'I') { // intel order littleEndian = true; } else { if (section[idx] == 'M' && section[idx + 1] == 'M') littleEndian = false; else { // unknown order... return; } } idx += 2; int a = ExifIO.ReadUShort(section, idx, littleEndian); idx += 2; if (a != 0x002A) { // bad start... return; } a = ExifIO.ReadInt(section, idx, littleEndian); idx += 4; if (a < 8 || a > 16) { if (a < 16 || a > section.Length - 16) { // invalid offset return; } } ProcessExifDir(section, a + 8, 8, section.Length - 8, 0, ExifIFD.Exif); } private int DirOffset(int start, int num) { return start + 2 + 12 * num; } private void ProcessExifDir(byte[] section, int offsetDir, int offsetBase, int length, int depth, ExifIFD ifd) { if (depth > 4) { // corrupted Exif header... return; } ushort numEntries = ExifIO.ReadUShort(section, offsetDir, littleEndian); if (offsetDir + 2 + 12 * numEntries >= offsetDir + length) { // too long return; } int offset = 0; for (int de = 0; de < numEntries; ++de) { offset = DirOffset(offsetDir, de); ExifTag exifTag = new ExifTag(section, offset, offsetBase, length, littleEndian); if (!exifTag.IsValid) continue; switch (exifTag.Tag) { case (int)ExifIFD.Exif: { int dirStart = offsetBase + exifTag.GetInt(0); if (dirStart <= offsetBase + length) { ProcessExifDir(section, dirStart, offsetBase, length, depth + 1, ExifIFD.Exif); } } break; case (int)ExifIFD.Gps: { int dirStart = offsetBase + exifTag.GetInt(0); if (dirStart <= offsetBase + length) { ProcessExifDir(section, dirStart, offsetBase, length, depth + 1, ExifIFD.Gps); } } break; default: { exifTag.Populate(info, ifd); } break; } } // final link defined? offset = DirOffset(offsetDir, numEntries) + 4; if (offset <= offsetBase + length) { offset = ExifIO.ReadInt(section, offsetDir + 2 + 12 * numEntries, littleEndian); if (offset > 0) { int subDirStart = offsetBase + offset; if (subDirStart <= offsetBase + length && subDirStart >= offsetBase) { ProcessExifDir(section, subDirStart, offsetBase, length, depth + 1, ifd); } } } if (info.ThumbnailData == null && info.ThumbnailOffset > 0 && info.ThumbnailSize > 0) { // store it. info.ThumbnailData = new byte[info.ThumbnailSize]; Array.Copy(section, offsetBase + info.ThumbnailOffset, info.ThumbnailData, 0, info.ThumbnailSize); } } private void ProcessSOF(byte[] section, int marker) { // bytes 1,2 is section len // byte 3 is precision (bytes per sample) info.Height = ((int)section[3] << 8) | (int)section[4]; info.Width = ((int)section[5] << 8) | (int)section[6]; int components = (int)section[7]; info.IsColor = (components == 3); } } } ================================================ FILE: ExifLib/ExifTag.cs ================================================ using System; using System.Text; namespace ExifLib { /// /// As per: http://www.media.mit.edu/pia/Research/deepview/exif.html /// public enum ExifTagFormat { BYTE = 1, STRING = 2, USHORT = 3, ULONG = 4, URATIONAL = 5, SBYTE = 6, UNDEFINED = 7, SSHORT = 8, SLONG = 9, SRATIONAL = 10, SINGLE = 11, DOUBLE = 12, NUM_FORMATS = 12 } public class ExifTag { public int Tag { get; private set; } public ExifTagFormat Format { get; private set; } public int Components { get; private set; } public byte[] Data { get; private set; } public bool LittleEndian { get; private set; } private static int[] BytesPerFormat = new int[] { 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 }; public ExifTag(byte[] section, int sectionOffset, int offsetBase, int length, bool littleEndian) { this.IsValid = false; this.Tag = ExifIO.ReadUShort(section, sectionOffset, littleEndian); int format = ExifIO.ReadUShort(section, sectionOffset + 2, littleEndian); if (format < 1 || format > 12) return; this.Format = (ExifTagFormat)format; this.Components = ExifIO.ReadInt(section, sectionOffset + 4, littleEndian); if (this.Components > 0x10000) return; this.LittleEndian = littleEndian; int byteCount = this.Components * BytesPerFormat[format]; int valueOffset = 0; if (byteCount > 4) { int offsetVal = ExifIO.ReadInt(section, sectionOffset + 8, littleEndian); if (offsetVal + byteCount > length) { // bad offset... return; } valueOffset = offsetBase + offsetVal; } else { valueOffset = sectionOffset + 8; } this.Data = new byte[byteCount]; Array.Copy(section, valueOffset, this.Data, 0, byteCount); this.IsValid = true; } public bool IsValid { get; private set; } private short ReadShort(int offset) { return ExifIO.ReadShort(Data, offset, LittleEndian); } private ushort ReadUShort(int offset) { return ExifIO.ReadUShort(Data, offset, LittleEndian); } private int ReadInt(int offset) { return ExifIO.ReadInt(Data, offset, LittleEndian); } private uint ReadUInt(int offset) { return ExifIO.ReadUInt(Data, offset, LittleEndian); } private float ReadSingle(int offset) { return ExifIO.ReadSingle(Data, offset, LittleEndian); } private double ReadDouble(int offset) { return ExifIO.ReadDouble(Data, offset, LittleEndian); } public bool IsNumeric { get { switch (Format) { case ExifTagFormat.STRING: case ExifTagFormat.UNDEFINED: return false; default: return true; } } } public int GetInt(int componentIndex) { return (int)GetNumericValue(componentIndex); } public double GetNumericValue(int componentIndex) { switch (Format) { case ExifTagFormat.BYTE: return (double)this.Data[componentIndex]; case ExifTagFormat.USHORT: return (double)ReadUShort(componentIndex * 2); case ExifTagFormat.ULONG: return (double)ReadUInt(componentIndex * 4); case ExifTagFormat.URATIONAL: return (double)ReadUInt(componentIndex * 8) / (double)ReadUInt((componentIndex * 8) + 4); case ExifTagFormat.SBYTE: { unchecked { return (double)(sbyte)this.Data[componentIndex]; } } case ExifTagFormat.SSHORT: return (double)ReadShort(componentIndex * 2); case ExifTagFormat.SLONG: return (double)ReadInt(componentIndex * 4); case ExifTagFormat.SRATIONAL: return (double)ReadInt(componentIndex * 8) / (double)ReadInt((componentIndex * 8) + 4); case ExifTagFormat.SINGLE: return (double)ReadSingle(componentIndex * 4); case ExifTagFormat.DOUBLE: return ReadDouble(componentIndex * 8); default: return 0.0; } } public string GetStringValue() { return GetStringValue(0); } public string GetStringValue(int componentIndex) { switch (Format) { case ExifTagFormat.STRING: case ExifTagFormat.UNDEFINED: return Encoding.UTF8.GetString(this.Data, 0, this.Data.Length).Trim(' ', '\t', '\r', '\n', '\0'); case ExifTagFormat.URATIONAL: return ReadUInt(componentIndex * 8).ToString() + "/" + ReadUInt((componentIndex * 8) + 4).ToString(); case ExifTagFormat.SRATIONAL: return ReadInt(componentIndex * 8).ToString() + "/" + ReadInt((componentIndex * 8) + 4).ToString(); default: return GetNumericValue(componentIndex).ToString(); } } public virtual void Populate(JpegInfo info, ExifIFD ifd) { if (ifd == ExifIFD.Exif) { switch ((ExifId)this.Tag) { case ExifId.ImageWidth: info.Width = GetInt(0); break; case ExifId.ImageHeight: info.Height = GetInt(0); break; case ExifId.Orientation: info.Orientation = (ExifOrientation)GetInt(0); break; case ExifId.XResolution: info.XResolution = GetNumericValue(0); break; case ExifId.YResolution: info.YResolution = GetNumericValue(0); break; case ExifId.ResolutionUnit: info.ResolutionUnit = (ExifUnit)GetInt(0); break; case ExifId.DateTime: info.DateTime = GetStringValue(); break; case ExifId.Description: info.Description = GetStringValue(); break; case ExifId.Make: info.Make = GetStringValue(); break; case ExifId.Model: info.Model = GetStringValue(); break; case ExifId.Software: info.Software = GetStringValue(); break; case ExifId.Artist: info.Artist = GetStringValue(); break; case ExifId.ThumbnailOffset: info.ThumbnailOffset = GetInt(0); break; case ExifId.ThumbnailLength: info.ThumbnailSize = GetInt(0); break; case ExifId.Copyright: info.Copyright = GetStringValue(); break; case ExifId.UserComment: info.UserComment = GetStringValue(); break; case ExifId.ExposureTime: info.ExposureTime = GetNumericValue(0); break; case ExifId.FNumber: info.FNumber = GetNumericValue(0); break; case ExifId.FlashUsed: info.Flash = (ExifFlash)GetInt(0); break; default: break; } } else if (ifd == ExifIFD.Gps) { switch ((ExifGps)this.Tag) { case ExifGps.LatitudeRef: { if (GetStringValue() == "N") info.GpsLatitudeRef = ExifGpsLatitudeRef.North; else if (GetStringValue() == "S") info.GpsLatitudeRef = ExifGpsLatitudeRef.South; } break; case ExifGps.LongitudeRef: { if (GetStringValue() == "E") info.GpsLongitudeRef = ExifGpsLongitudeRef.East; else if (GetStringValue() == "W") info.GpsLongitudeRef = ExifGpsLongitudeRef.West; } break; case ExifGps.Latitude: { if (Components == 3) { info.GpsLatitude[0] = GetNumericValue(0); info.GpsLatitude[1] = GetNumericValue(1); info.GpsLatitude[2] = GetNumericValue(2); } } break; case ExifGps.Longitude: { if (Components == 3) { info.GpsLongitude[0] = GetNumericValue(0); info.GpsLongitude[1] = GetNumericValue(1); info.GpsLongitude[2] = GetNumericValue(2); } } break; } } } public override string ToString() { StringBuilder sb = new StringBuilder(64); sb.Append("0x"); sb.Append(this.Tag.ToString("X4")); sb.Append("-"); sb.Append(((ExifId)this.Tag).ToString()); if (this.Components > 0) { sb.Append(": ("); sb.Append(GetStringValue(0)); if (Format != ExifTagFormat.UNDEFINED && Format != ExifTagFormat.STRING) { for (int i = 1; i < Components; ++i) sb.Append(", " + GetStringValue(i)); } sb.Append(")"); } return sb.ToString(); } } } ================================================ FILE: ExifLib/JpegInfo.cs ================================================ using System; namespace ExifLib { public class JpegInfo { /// /// The Jpeg file name (excluding path). /// public string FileName; /// /// The Jpeg file size, in bytes. /// public int FileSize; /// /// True if the provided Stream was detected to be a Jpeg image, False otherwise. /// public bool IsValid; /// /// Image dimensions, in pixels. /// public int Width, Height; /// /// True if the image data is expressed in 3 components (RGB), False otherwise. /// public bool IsColor; /// /// Orientation of the image. /// public ExifOrientation Orientation; /// /// The X and Y resolutions of the image, expressed in ResolutionUnit. /// public double XResolution, YResolution; /// /// Resolution unit of the image. /// public ExifUnit ResolutionUnit; /// /// Date at which the image was taken. /// public string DateTime; /// /// Description of the image. /// public string Description; /// /// Camera manufacturer. /// public string Make; /// /// Camera model. /// public string Model; /// /// Software used to create the image. /// public string Software; /// /// Image artist. /// public string Artist; /// /// Image copyright. /// public string Copyright; /// /// Image user comments. /// public string UserComment; /// /// Exposure time, in seconds. /// public double ExposureTime; /// /// F-number (F-stop) of the camera lens when the image was taken. /// public double FNumber; /// /// Flash settings of the camera when the image was taken. /// public ExifFlash Flash; /// /// GPS latitude reference (North, South). /// public ExifGpsLatitudeRef GpsLatitudeRef; /// /// GPS latitude (degrees, minutes, seconds). /// public double[] GpsLatitude = new double[3]; /// /// GPS longitude reference (East, West). /// public ExifGpsLongitudeRef GpsLongitudeRef; /// /// GPS longitude (degrees, minutes, seconds). /// public double[] GpsLongitude = new double[3]; /// /// Byte offset and size of the thumbnail data within the Exif section of the image file. /// Used internally. /// public int ThumbnailOffset, ThumbnailSize; /// /// Thumbnail data found in the Exif section. /// public byte[] ThumbnailData; /// /// Time taken to load the image information. /// public TimeSpan LoadTime; } } ================================================ FILE: ExifLib/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ExifLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExifLib")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1e7f202b-8830-42f6-bcda-2a6c590a7e10")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: ExifLib.WP8/ExifLib.WP8.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {ED7BD6FE-8929-490A-81BE-521BB2C6D6F5} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties ExifLib.WP8 ExifLib.WP8 WindowsPhone v8.0 $(TargetFrameworkVersion) false true 11.0 true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\x86\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\x86\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\ARM\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\ARM\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 ExifIds.cs ExifIO.cs ExifReader.cs ExifTag.cs JpegInfo.cs ================================================ FILE: ExifLib.WP8/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ExifLib.WP8")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExifLib.WP8")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ed7bd6fe-8929-490a-81be-521bb2c6d6f5")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: FFmpegInterop/Source/FFmpegInteropMSS.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "FFmpegInteropMSS.h" #include "MediaSampleProvider.h" #include "H264AVCSampleProvider.h" #include "H264SampleProvider.h" #include "UncompressedAudioSampleProvider.h" #include "UncompressedVideoSampleProvider.h" #include "shcore.h" extern "C" { #include } using namespace concurrency; using namespace FFmpegInterop; using namespace Platform; using namespace Windows::Storage::Streams; using namespace Windows::Media::MediaProperties; // Size of the buffer when reading a stream const int FILESTREAMBUFFERSZ = 16384; // Static functions passed to FFmpeg for stream interop static int FileStreamRead(void* ptr, uint8_t* buf, int bufSize); static int64_t FileStreamSeek(void* ptr, int64_t pos, int whence); // Initialize an FFmpegInteropObject FFmpegInteropMSS::FFmpegInteropMSS() : avDict(nullptr) , avIOCtx(nullptr) , avFormatCtx(nullptr) , avAudioCodecCtx(nullptr) , avVideoCodecCtx(nullptr) , audioStreamIndex(AVERROR_STREAM_NOT_FOUND) , videoStreamIndex(AVERROR_STREAM_NOT_FOUND) , fileStreamData(nullptr) , fileStreamBuffer(nullptr) { av_register_all(); } FFmpegInteropMSS::~FFmpegInteropMSS() { if (mss) { mss->Starting -= startingRequestedToken; mss->SampleRequested -= sampleRequestedToken; mss = nullptr; } // Clear our data audioSampleProvider = nullptr; videoSampleProvider = nullptr; if (m_pReader != nullptr) { m_pReader->SetAudioStream(AVERROR_STREAM_NOT_FOUND, nullptr); m_pReader->SetVideoStream(AVERROR_STREAM_NOT_FOUND, nullptr); m_pReader = nullptr; } avcodec_close(avVideoCodecCtx); avcodec_close(avAudioCodecCtx); avformat_close_input(&avFormatCtx); av_free(avIOCtx); av_dict_free(&avDict); } FFmpegInteropMSS^ FFmpegInteropMSS::CreateFFmpegInteropMSSFromStream(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions) { auto interopMSS = ref new FFmpegInteropMSS(); if (FAILED(interopMSS->CreateMediaStreamSource(stream, forceAudioDecode, forceVideoDecode, ffmpegOptions))) { // We failed to initialize, clear the variable to return failure interopMSS = nullptr; } return interopMSS; } FFmpegInteropMSS^ FFmpegInteropMSS::CreateFFmpegInteropMSSFromStream(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode) { return CreateFFmpegInteropMSSFromStream(stream, forceAudioDecode, forceVideoDecode, nullptr); } FFmpegInteropMSS^ FFmpegInteropMSS::CreateFFmpegInteropMSSFromUri(String^ uri, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions) { auto interopMSS = ref new FFmpegInteropMSS(); if (FAILED(interopMSS->CreateMediaStreamSource(uri, forceAudioDecode, forceVideoDecode, ffmpegOptions))) { // We failed to initialize, clear the variable to return failure interopMSS = nullptr; } return interopMSS; } FFmpegInteropMSS^ FFmpegInteropMSS::CreateFFmpegInteropMSSFromUri(String^ uri, bool forceAudioDecode, bool forceVideoDecode) { return CreateFFmpegInteropMSSFromUri(uri, forceAudioDecode, forceVideoDecode, nullptr); } MediaStreamSource^ FFmpegInteropMSS::GetMediaStreamSource() { return mss; } HRESULT FFmpegInteropMSS::CreateMediaStreamSource(String^ uri, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions) { HRESULT hr = S_OK; const char* charStr = nullptr; if (!uri) { hr = E_INVALIDARG; } if (SUCCEEDED(hr)) { avFormatCtx = avformat_alloc_context(); if (avFormatCtx == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { // Populate AVDictionary avDict based on PropertySet ffmpegOptions. List of options can be found in https://www.ffmpeg.org/ffmpeg-protocols.html hr = ParseOptions(ffmpegOptions); } if (SUCCEEDED(hr)) { std::wstring uriW(uri->Begin()); std::string uriA(uriW.begin(), uriW.end()); charStr = uriA.c_str(); // Open media in the given URI using the specified options if (avformat_open_input(&avFormatCtx, charStr, NULL, &avDict) < 0) { hr = E_FAIL; // Error opening file } // avDict is not NULL only when there is an issue with the given ffmpegOptions such as invalid key, value type etc. Iterate through it to see which one is causing the issue. if (avDict != nullptr) { DebugMessage(L"Invalid FFmpeg option(s)"); av_dict_free(&avDict); avDict = nullptr; } } if (SUCCEEDED(hr)) { hr = InitFFmpegContext(forceAudioDecode, forceVideoDecode); } return hr; } HRESULT FFmpegInteropMSS::CreateMediaStreamSource(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions) { HRESULT hr = S_OK; if (!stream) { hr = E_INVALIDARG; } if (SUCCEEDED(hr)) { // Convert asynchronous IRandomAccessStream to synchronous IStream. This API requires shcore.h and shcore.lib hr = CreateStreamOverRandomAccessStream(reinterpret_cast(stream), IID_PPV_ARGS(&fileStreamData)); } if (SUCCEEDED(hr)) { // Setup FFmpeg custom IO to access file as stream. This is necessary when accessing any file outside of app installation directory and appdata folder. // Credit to Philipp Sch http://www.codeproject.com/Tips/489450/Creating-Custom-FFmpeg-IO-Context fileStreamBuffer = (unsigned char*)av_malloc(FILESTREAMBUFFERSZ); if (fileStreamBuffer == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { avIOCtx = avio_alloc_context(fileStreamBuffer, FILESTREAMBUFFERSZ, 0, fileStreamData, FileStreamRead, 0, FileStreamSeek); if (avIOCtx == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { avFormatCtx = avformat_alloc_context(); if (avFormatCtx == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { // Populate AVDictionary avDict based on PropertySet ffmpegOptions. List of options can be found in https://www.ffmpeg.org/ffmpeg-protocols.html hr = ParseOptions(ffmpegOptions); } if (SUCCEEDED(hr)) { avFormatCtx->pb = avIOCtx; avFormatCtx->flags |= AVFMT_FLAG_CUSTOM_IO; // Open media file using custom IO setup above instead of using file name. Opening a file using file name will invoke fopen C API call that only have // access within the app installation directory and appdata folder. Custom IO allows access to file selected using FilePicker dialog. if (avformat_open_input(&avFormatCtx, "", NULL, &avDict) < 0) { hr = E_FAIL; // Error opening file } // avDict is not NULL only when there is an issue with the given ffmpegOptions such as invalid key, value type etc. Iterate through it to see which one is causing the issue. if (avDict != nullptr) { DebugMessage(L"Invalid FFmpeg option(s)"); av_dict_free(&avDict); avDict = nullptr; } } if (SUCCEEDED(hr)) { hr = InitFFmpegContext(forceAudioDecode, forceVideoDecode); } return hr; } HRESULT FFmpegInteropMSS::InitFFmpegContext(bool forceAudioDecode, bool forceVideoDecode) { HRESULT hr = S_OK; if (SUCCEEDED(hr)) { if (avformat_find_stream_info(avFormatCtx, NULL) < 0) { hr = E_FAIL; // Error finding info } } if (SUCCEEDED(hr)) { m_pReader = ref new FFmpegReader(avFormatCtx); if (m_pReader == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { // Find the audio stream and its decoder AVCodec* avAudioCodec = nullptr; audioStreamIndex = av_find_best_stream(avFormatCtx, AVMEDIA_TYPE_AUDIO, -1, -1, &avAudioCodec, 0); if (audioStreamIndex != AVERROR_STREAM_NOT_FOUND && avAudioCodec) { avAudioCodecCtx = avFormatCtx->streams[audioStreamIndex]->codec; if (avcodec_open2(avAudioCodecCtx, avAudioCodec, NULL) < 0) { avAudioCodecCtx = nullptr; hr = E_FAIL; } else { // Detect audio format and create audio stream descriptor accordingly hr = CreateAudioStreamDescriptor(forceAudioDecode); if (SUCCEEDED(hr)) { hr = audioSampleProvider->AllocateResources(); if (SUCCEEDED(hr)) { m_pReader->SetAudioStream(audioStreamIndex, audioSampleProvider); } } } } } if (SUCCEEDED(hr)) { // Find the video stream and its decoder AVCodec* avVideoCodec = nullptr; videoStreamIndex = av_find_best_stream(avFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &avVideoCodec, 0); if (videoStreamIndex != AVERROR_STREAM_NOT_FOUND && avVideoCodec) { // FFmpeg identifies album/cover art from a music file as a video stream // Avoid creating unnecessarily video stream from this album/cover art if (avFormatCtx->streams[videoStreamIndex]->disposition == AV_DISPOSITION_ATTACHED_PIC) { videoStreamIndex = AVERROR_STREAM_NOT_FOUND; avVideoCodec = nullptr; } else { avVideoCodecCtx = avFormatCtx->streams[videoStreamIndex]->codec; if (avcodec_open2(avVideoCodecCtx, avVideoCodec, NULL) < 0) { avVideoCodecCtx = nullptr; hr = E_FAIL; // Cannot open the video codec } else { // Detect video format and create video stream descriptor accordingly hr = CreateVideoStreamDescriptor(forceVideoDecode); if (SUCCEEDED(hr)) { hr = videoSampleProvider->AllocateResources(); if (SUCCEEDED(hr)) { m_pReader->SetVideoStream(videoStreamIndex, videoSampleProvider); } } } } } } if (SUCCEEDED(hr)) { // Convert media duration from AV_TIME_BASE to TimeSpan unit mediaDuration = { LONGLONG(avFormatCtx->duration * 10000000 / double(AV_TIME_BASE)) }; if (audioStreamDescriptor) { if (videoStreamDescriptor) { mss = ref new MediaStreamSource(videoStreamDescriptor, audioStreamDescriptor); } else { mss = ref new MediaStreamSource(audioStreamDescriptor); } } else if (videoStreamDescriptor) { mss = ref new MediaStreamSource(videoStreamDescriptor); } if (mss) { if (mediaDuration.Duration > 0) { mss->Duration = mediaDuration; mss->CanSeek = true; } else { // Set buffer time to 0 for realtime streaming to reduce latency mss->BufferTime = { 0 }; } startingRequestedToken = mss->Starting += ref new TypedEventHandler(this, &FFmpegInteropMSS::OnStarting); sampleRequestedToken = mss->SampleRequested += ref new TypedEventHandler(this, &FFmpegInteropMSS::OnSampleRequested); } else { hr = E_OUTOFMEMORY; } } return hr; } HRESULT FFmpegInteropMSS::CreateAudioStreamDescriptor(bool forceAudioDecode) { if (avAudioCodecCtx->codec_id == AV_CODEC_ID_AAC && !forceAudioDecode) { if (avAudioCodecCtx->extradata_size == 0) { audioStreamDescriptor = ref new AudioStreamDescriptor(AudioEncodingProperties::CreateAacAdts(avAudioCodecCtx->sample_rate, avAudioCodecCtx->channels, avAudioCodecCtx->bit_rate)); } else { audioStreamDescriptor = ref new AudioStreamDescriptor(AudioEncodingProperties::CreateAac(avAudioCodecCtx->sample_rate, avAudioCodecCtx->channels, avAudioCodecCtx->bit_rate)); } audioSampleProvider = ref new MediaSampleProvider(m_pReader, avFormatCtx, avAudioCodecCtx); } else if (avAudioCodecCtx->codec_id == AV_CODEC_ID_MP3 && !forceAudioDecode) { audioStreamDescriptor = ref new AudioStreamDescriptor(AudioEncodingProperties::CreateMp3(avAudioCodecCtx->sample_rate, avAudioCodecCtx->channels, avAudioCodecCtx->bit_rate)); audioSampleProvider = ref new MediaSampleProvider(m_pReader, avFormatCtx, avAudioCodecCtx); } else { // Set default 16 bits when bits per sample value is unknown (0) unsigned int bitsPerSample = avAudioCodecCtx->bits_per_coded_sample ? avAudioCodecCtx->bits_per_coded_sample : 16; audioStreamDescriptor = ref new AudioStreamDescriptor(AudioEncodingProperties::CreatePcm(avAudioCodecCtx->sample_rate, avAudioCodecCtx->channels, bitsPerSample)); audioSampleProvider = ref new UncompressedAudioSampleProvider(m_pReader, avFormatCtx, avAudioCodecCtx); } return (audioStreamDescriptor != nullptr && audioSampleProvider != nullptr) ? S_OK : E_OUTOFMEMORY; } HRESULT FFmpegInteropMSS::CreateVideoStreamDescriptor(bool forceVideoDecode) { VideoEncodingProperties^ videoProperties; if (avVideoCodecCtx->codec_id == AV_CODEC_ID_H264 && !forceVideoDecode) { videoProperties = VideoEncodingProperties::CreateH264(); videoProperties->ProfileId = avVideoCodecCtx->profile; videoProperties->Height = avVideoCodecCtx->height; videoProperties->Width = avVideoCodecCtx->width; // Check for H264 bitstream flavor. H.264 AVC extradata starts with 1 while non AVC one starts with 0 if (avVideoCodecCtx->extradata != nullptr && avVideoCodecCtx->extradata_size > 0 && avVideoCodecCtx->extradata[0] == 1) { videoSampleProvider = ref new H264AVCSampleProvider(m_pReader, avFormatCtx, avVideoCodecCtx); } else { videoSampleProvider = ref new H264SampleProvider(m_pReader, avFormatCtx, avVideoCodecCtx); } } else { videoProperties = VideoEncodingProperties::CreateUncompressed(MediaEncodingSubtypes::Nv12, avVideoCodecCtx->width, avVideoCodecCtx->height); videoSampleProvider = ref new UncompressedVideoSampleProvider(m_pReader, avFormatCtx, avVideoCodecCtx); if (avVideoCodecCtx->sample_aspect_ratio.num > 0 && avVideoCodecCtx->sample_aspect_ratio.den != 0) { videoProperties->PixelAspectRatio->Numerator = avVideoCodecCtx->sample_aspect_ratio.num; videoProperties->PixelAspectRatio->Denominator = avVideoCodecCtx->sample_aspect_ratio.den; } } // Detect the correct framerate if (avVideoCodecCtx->framerate.num != 0 || avVideoCodecCtx->framerate.den != 1) { videoProperties->FrameRate->Numerator = avVideoCodecCtx->framerate.num; videoProperties->FrameRate->Denominator = avVideoCodecCtx->framerate.den; } else if (avFormatCtx->streams[videoStreamIndex]->avg_frame_rate.num != 0 || avFormatCtx->streams[videoStreamIndex]->avg_frame_rate.den != 0) { videoProperties->FrameRate->Numerator = avFormatCtx->streams[videoStreamIndex]->avg_frame_rate.num; videoProperties->FrameRate->Denominator = avFormatCtx->streams[videoStreamIndex]->avg_frame_rate.den; } videoProperties->Bitrate = avVideoCodecCtx->bit_rate; videoStreamDescriptor = ref new VideoStreamDescriptor(videoProperties); return (videoStreamDescriptor != nullptr && videoSampleProvider != nullptr) ? S_OK : E_OUTOFMEMORY; } HRESULT FFmpegInteropMSS::ParseOptions(PropertySet^ ffmpegOptions) { HRESULT hr = S_OK; // Convert FFmpeg options given in PropertySet to AVDictionary. List of options can be found in https://www.ffmpeg.org/ffmpeg-protocols.html if (ffmpegOptions != nullptr) { auto options = ffmpegOptions->First(); while (options->HasCurrent) { String^ key = options->Current->Key; std::wstring keyW(key->Begin()); std::string keyA(keyW.begin(), keyW.end()); const char* keyChar = keyA.c_str(); // Convert value from Object^ to const char*. avformat_open_input will internally convert value from const char* to the correct type String^ value = options->Current->Value->ToString(); std::wstring valueW(value->Begin()); std::string valueA(valueW.begin(), valueW.end()); const char* valueChar = valueA.c_str(); // Add key and value pair entry if (av_dict_set(&avDict, keyChar, valueChar, 0) < 0) { hr = E_INVALIDARG; break; } options->MoveNext(); } } return hr; } void FFmpegInteropMSS::OnStarting(MediaStreamSource ^sender, MediaStreamSourceStartingEventArgs ^args) { MediaStreamSourceStartingRequest^ request = args->Request; // Perform seek operation when MediaStreamSource received seek event from MediaElement if (request->StartPosition && request->StartPosition->Value.Duration <= mediaDuration.Duration) { // Select the first valid stream either from video or audio int streamIndex = videoStreamIndex >= 0 ? videoStreamIndex : audioStreamIndex >= 0 ? audioStreamIndex : -1; if (streamIndex >= 0) { // Convert TimeSpan unit to AV_TIME_BASE int64_t seekTarget = static_cast(request->StartPosition->Value.Duration / (av_q2d(avFormatCtx->streams[streamIndex]->time_base) * 10000000)); if (av_seek_frame(avFormatCtx, streamIndex, seekTarget, 0) < 0) { DebugMessage(L" - ### Error while seeking\n"); } else { // Add deferral // Flush the AudioSampleProvider if (audioSampleProvider != nullptr) { audioSampleProvider->Flush(); avcodec_flush_buffers(avAudioCodecCtx); } // Flush the VideoSampleProvider if (videoSampleProvider != nullptr) { videoSampleProvider->Flush(); avcodec_flush_buffers(avVideoCodecCtx); } } } request->SetActualStartPosition(request->StartPosition->Value); } } void FFmpegInteropMSS::OnSampleRequested(Windows::Media::Core::MediaStreamSource ^sender, MediaStreamSourceSampleRequestedEventArgs ^args) { if (args->Request->StreamDescriptor == audioStreamDescriptor && audioSampleProvider != nullptr) { args->Request->Sample = audioSampleProvider->GetNextSample(); } else if (args->Request->StreamDescriptor == videoStreamDescriptor && videoSampleProvider != nullptr) { args->Request->Sample = videoSampleProvider->GetNextSample(); } else { args->Request->Sample = nullptr; } } // Static function to read file stream and pass data to FFmpeg. Credit to Philipp Sch http://www.codeproject.com/Tips/489450/Creating-Custom-FFmpeg-IO-Context static int FileStreamRead(void* ptr, uint8_t* buf, int bufSize) { IStream* pStream = reinterpret_cast(ptr); ULONG bytesRead = 0; HRESULT hr = pStream->Read(buf, bufSize, &bytesRead); if (FAILED(hr)) { return -1; } // If we succeed but don't have any bytes, assume end of file if (bytesRead == 0) { return AVERROR_EOF; // Let FFmpeg know that we have reached eof } return bytesRead; } // Static function to seek in file stream. Credit to Philipp Sch http://www.codeproject.com/Tips/489450/Creating-Custom-FFmpeg-IO-Context static int64_t FileStreamSeek(void* ptr, int64_t pos, int whence) { IStream* pStream = reinterpret_cast(ptr); LARGE_INTEGER in; in.QuadPart = pos; ULARGE_INTEGER out = { 0 }; if (FAILED(pStream->Seek(in, whence, &out))) { return -1; } return out.QuadPart; // Return the new position: } ================================================ FILE: FFmpegInterop/Source/FFmpegInteropMSS.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include #include "MediaSampleProvider.h" #include "FFmpegReader.h" using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::Media::Core; extern "C" { #include } namespace FFmpegInterop { public ref class FFmpegInteropMSS sealed { public: static FFmpegInteropMSS^ CreateFFmpegInteropMSSFromStream(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions); static FFmpegInteropMSS^ CreateFFmpegInteropMSSFromStream(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode); static FFmpegInteropMSS^ CreateFFmpegInteropMSSFromUri(String^ uri, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions); static FFmpegInteropMSS^ CreateFFmpegInteropMSSFromUri(String^ uri, bool forceAudioDecode, bool forceVideoDecode); // Contructor MediaStreamSource^ GetMediaStreamSource(); virtual ~FFmpegInteropMSS(); internal: int ReadPacket(); private: FFmpegInteropMSS(); HRESULT CreateMediaStreamSource(IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions); HRESULT CreateMediaStreamSource(String^ uri, bool forceAudioDecode, bool forceVideoDecode, PropertySet^ ffmpegOptions); HRESULT InitFFmpegContext(bool forceAudioDecode, bool forceVideoDecode); HRESULT CreateAudioStreamDescriptor(bool forceAudioDecode); HRESULT CreateVideoStreamDescriptor(bool forceVideoDecode); HRESULT ParseOptions(PropertySet^ ffmpegOptions); void OnStarting(MediaStreamSource ^sender, MediaStreamSourceStartingEventArgs ^args); void OnSampleRequested(MediaStreamSource ^sender, MediaStreamSourceSampleRequestedEventArgs ^args); MediaStreamSource^ mss; EventRegistrationToken startingRequestedToken; EventRegistrationToken sampleRequestedToken; internal: AVDictionary* avDict; AVIOContext* avIOCtx; AVFormatContext* avFormatCtx; AVCodecContext* avAudioCodecCtx; AVCodecContext* avVideoCodecCtx; private: AudioStreamDescriptor^ audioStreamDescriptor; VideoStreamDescriptor^ videoStreamDescriptor; int audioStreamIndex; int videoStreamIndex; MediaSampleProvider^ audioSampleProvider; MediaSampleProvider^ videoSampleProvider; TimeSpan mediaDuration; IStream* fileStreamData; unsigned char* fileStreamBuffer; FFmpegReader^ m_pReader; }; } ================================================ FILE: FFmpegInterop/Source/FFmpegReader.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "FFmpegReader.h" using namespace FFmpegInterop; FFmpegReader::FFmpegReader(AVFormatContext* avFormatCtx) : m_pAvFormatCtx(avFormatCtx) , m_audioStreamIndex(AVERROR_STREAM_NOT_FOUND) , m_videoStreamIndex(AVERROR_STREAM_NOT_FOUND) { } FFmpegReader::~FFmpegReader() { } // Read the next packet from the stream and push it into the appropriate // sample provider int FFmpegReader::ReadPacket() { int ret; AVPacket avPacket; av_init_packet(&avPacket); avPacket.data = NULL; avPacket.size = 0; ret = av_read_frame(m_pAvFormatCtx, &avPacket); if (ret < 0) { return ret; } // Push the packet to the appropriate if (avPacket.stream_index == m_audioStreamIndex && m_audioSampleProvider != nullptr) { m_audioSampleProvider->PushPacket(avPacket); } else if (avPacket.stream_index == m_videoStreamIndex && m_videoSampleProvider != nullptr) { m_videoSampleProvider->PushPacket(avPacket); } else { DebugMessage(L"Ignoring unused stream\n"); //av_free_packet(&avPacket); } return ret; } void FFmpegReader::SetAudioStream(int audioStreamIndex, MediaSampleProvider^ audioSampleProvider) { m_audioStreamIndex = audioStreamIndex; m_audioSampleProvider = audioSampleProvider; if (audioSampleProvider != nullptr) { audioSampleProvider->SetCurrentStreamIndex(m_audioStreamIndex); } } void FFmpegReader::SetVideoStream(int videoStreamIndex, MediaSampleProvider^ videoSampleProvider) { m_videoStreamIndex = videoStreamIndex; m_videoSampleProvider = videoSampleProvider; if (videoSampleProvider != nullptr) { videoSampleProvider->SetCurrentStreamIndex(m_videoStreamIndex); } } ================================================ FILE: FFmpegInterop/Source/FFmpegReader.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include "MediaSampleProvider.h" namespace FFmpegInterop { ref class FFmpegReader { public: virtual ~FFmpegReader(); int ReadPacket(); void SetAudioStream(int audioStreamIndex, MediaSampleProvider^ audioSampleProvider); void SetVideoStream(int videoStreamIndex, MediaSampleProvider^ videoSampleProvider); internal: FFmpegReader(AVFormatContext* avFormatCtx); private: AVFormatContext* m_pAvFormatCtx; MediaSampleProvider^ m_audioSampleProvider; int m_audioStreamIndex; MediaSampleProvider^ m_videoSampleProvider; int m_videoStreamIndex; }; } ================================================ FILE: FFmpegInterop/Source/H264AVCSampleProvider.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "H264AVCSampleProvider.h" using namespace FFmpegInterop; H264AVCSampleProvider::H264AVCSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx) : MediaSampleProvider(reader, avFormatCtx, avCodecCtx) { } H264AVCSampleProvider::~H264AVCSampleProvider() { } HRESULT H264AVCSampleProvider::WriteAVPacketToStream(DataWriter^ dataWriter, AVPacket* avPacket) { HRESULT hr = S_OK; // On a KeyFrame, write the SPS and PPS if (avPacket->flags & AV_PKT_FLAG_KEY) { hr = GetSPSAndPPSBuffer(dataWriter); } if (SUCCEEDED(hr)) { // Convert the packet to NAL format hr = WriteNALPacket(dataWriter, avPacket); } // We have a complete frame return hr; } HRESULT H264AVCSampleProvider::GetSPSAndPPSBuffer(DataWriter^ dataWriter) { HRESULT hr = S_OK; int spsLength = 0; int ppsLength = 0; // Get the position of the SPS if (m_pAvCodecCtx->extradata == nullptr && m_pAvCodecCtx->extradata_size < 8) { // The data isn't present hr = E_FAIL; } if (SUCCEEDED(hr)) { byte* spsPos = m_pAvCodecCtx->extradata + 8; spsLength = spsPos[-1]; if (m_pAvCodecCtx->extradata_size < (8 + spsLength)) { // We don't have a complete SPS hr = E_FAIL; } else { auto vSPS = ref new Platform::Array(spsPos, spsLength); // Write the NAL unit for the SPS dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(1); // Write the SPS dataWriter->WriteBytes(vSPS); } } if (SUCCEEDED(hr)) { if (m_pAvCodecCtx->extradata_size < (8 + spsLength + 3)) { hr = E_FAIL; } if (SUCCEEDED(hr)) { byte* ppsPos = m_pAvCodecCtx->extradata + 8 + spsLength + 3; ppsLength = ppsPos[-1]; if (m_pAvCodecCtx->extradata_size < (8 + spsLength + 3 + ppsLength)) { hr = E_FAIL; } else { auto vPPS = ref new Platform::Array(ppsPos, ppsLength); // Write the NAL unit for the PPS dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(1); // Write the PPS dataWriter->WriteBytes(vPPS); } } } return hr; } // Write out an H.264 packet converting stream offsets to start-codes HRESULT H264AVCSampleProvider::WriteNALPacket(DataWriter^ dataWriter, AVPacket* avPacket) { HRESULT hr = S_OK; uint32 index = 0; uint32 size = 0; uint32 packetSize = (uint32)avPacket->size; do { // Make sure we have enough data if (packetSize < (index + 4)) { hr = E_FAIL; break; } // Grab the size of the blob size = (avPacket->data[index] << 24) + (avPacket->data[index + 1] << 16) + (avPacket->data[index + 2] << 8) + avPacket->data[index + 3]; // Write the NAL unit to the stream dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(0); dataWriter->WriteByte(1); index += 4; // Stop if index and size goes beyond packet size or overflow if (packetSize < (index + size) || (UINT32_MAX - index) < size) { hr = E_FAIL; break; } // Write the rest of the packet to the stream auto vBuffer = ref new Platform::Array(&(avPacket->data[index]), size); dataWriter->WriteBytes(vBuffer); index += size; } while (index < packetSize); return hr; } ================================================ FILE: FFmpegInterop/Source/H264AVCSampleProvider.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include "MediaSampleProvider.h" namespace FFmpegInterop { ref class H264AVCSampleProvider : public MediaSampleProvider { public: virtual ~H264AVCSampleProvider(); private: HRESULT WriteNALPacket(DataWriter^ dataWriter, AVPacket* avPacket); HRESULT GetSPSAndPPSBuffer(DataWriter^ dataWriter); internal: H264AVCSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx); virtual HRESULT WriteAVPacketToStream(DataWriter^ writer, AVPacket* avPacket) override; }; } ================================================ FILE: FFmpegInterop/Source/H264SampleProvider.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "H264SampleProvider.h" using namespace FFmpegInterop; H264SampleProvider::H264SampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx) : MediaSampleProvider(reader, avFormatCtx, avCodecCtx) { } H264SampleProvider::~H264SampleProvider() { } HRESULT H264SampleProvider::WriteAVPacketToStream(DataWriter^ dataWriter, AVPacket* avPacket) { HRESULT hr = S_OK; // On a KeyFrame, write the SPS and PPS if (avPacket->flags & AV_PKT_FLAG_KEY) { hr = GetSPSAndPPSBuffer(dataWriter); } if (SUCCEEDED(hr)) { // Call base class method that simply write the packet to stream as is hr = MediaSampleProvider::WriteAVPacketToStream(dataWriter, avPacket); } // We have a complete frame return hr; } HRESULT H264SampleProvider::GetSPSAndPPSBuffer(DataWriter^ dataWriter) { HRESULT hr = S_OK; if (m_pAvCodecCtx->extradata == nullptr && m_pAvCodecCtx->extradata_size < 8) { // The data isn't present hr = E_FAIL; } else { // Write both SPS and PPS sequence as is from extradata auto vSPSPPS = ref new Platform::Array(m_pAvCodecCtx->extradata, m_pAvCodecCtx->extradata_size); dataWriter->WriteBytes(vSPSPPS); } return hr; } ================================================ FILE: FFmpegInterop/Source/H264SampleProvider.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include "MediaSampleProvider.h" namespace FFmpegInterop { ref class H264SampleProvider : public MediaSampleProvider { public: virtual ~H264SampleProvider(); private: HRESULT GetSPSAndPPSBuffer(DataWriter^ dataWriter); internal: H264SampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx); virtual HRESULT WriteAVPacketToStream(DataWriter^ writer, AVPacket* avPacket) override; }; } ================================================ FILE: FFmpegInterop/Source/MediaSampleProvider.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "MediaSampleProvider.h" #include "FFmpegInteropMSS.h" #include "FFmpegReader.h" using namespace FFmpegInterop; MediaSampleProvider::MediaSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx) : m_pReader(reader) , m_pAvFormatCtx(avFormatCtx) , m_pAvCodecCtx(avCodecCtx) , m_streamIndex(AVERROR_STREAM_NOT_FOUND) { } HRESULT MediaSampleProvider::AllocateResources() { return S_OK; } MediaSampleProvider::~MediaSampleProvider() { } void MediaSampleProvider::SetCurrentStreamIndex(int streamIndex) { if (m_pAvCodecCtx != nullptr && m_pAvFormatCtx->nb_streams > (unsigned int)streamIndex) { m_streamIndex = streamIndex; } else { m_streamIndex = AVERROR_STREAM_NOT_FOUND; } } MediaStreamSample^ MediaSampleProvider::GetNextSample() { DebugMessage(L"GetNextSample\n"); HRESULT hr = S_OK; MediaStreamSample^ sample; AVPacket avPacket; av_init_packet(&avPacket); avPacket.data = NULL; avPacket.size = 0; DataWriter^ dataWriter = ref new DataWriter(); bool frameComplete = false; bool decodeSuccess = true; while (SUCCEEDED(hr) && !frameComplete) { // Continue reading until there is an appropriate packet in the stream while (m_packetQueue.empty()) { if (m_pReader->ReadPacket() < 0) { DebugMessage(L"GetNextSample reaching EOF\n"); hr = E_FAIL; break; } } if (!m_packetQueue.empty()) { // Pick the packets from the queue one at a time avPacket = PopPacket(); // Decode the packet if necessary hr = DecodeAVPacket(dataWriter, &avPacket); frameComplete = (hr == S_OK); } } if (SUCCEEDED(hr)) { // Write the packet out hr = WriteAVPacketToStream(dataWriter, &avPacket); Windows::Foundation::TimeSpan pts = { LONGLONG(av_q2d(m_pAvFormatCtx->streams[m_streamIndex]->time_base) * 10000000 * avPacket.pts) }; Windows::Foundation::TimeSpan dur = { LONGLONG(av_q2d(m_pAvFormatCtx->streams[m_streamIndex]->time_base) * 10000000 * avPacket.duration) }; sample = MediaStreamSample::CreateFromBuffer(dataWriter->DetachBuffer(), pts); sample->Duration = dur; } //av_free_packet(&avPacket); return sample; } HRESULT MediaSampleProvider::WriteAVPacketToStream(DataWriter^ dataWriter, AVPacket* avPacket) { // This is the simplest form of transfer. Copy the packet directly to the stream // This works for most compressed formats auto aBuffer = ref new Platform::Array(avPacket->data, avPacket->size); dataWriter->WriteBytes(aBuffer); return S_OK; } HRESULT MediaSampleProvider::DecodeAVPacket(DataWriter^ dataWriter, AVPacket *avPacket) { // For the simple case of compressed samples, each packet is a sample return S_OK; } void MediaSampleProvider::PushPacket(AVPacket packet) { DebugMessage(L" - PushPacket\n"); m_packetQueue.push(packet); } AVPacket MediaSampleProvider::PopPacket() { DebugMessage(L" - PopPacket\n"); AVPacket avPacket; av_init_packet(&avPacket); avPacket.data = NULL; avPacket.size = 0; if (!m_packetQueue.empty()) { avPacket = m_packetQueue.front(); m_packetQueue.pop(); } return avPacket; } void MediaSampleProvider::Flush() { /*while (!m_packetQueue.empty()) { av_free_packet(&PopPacket()); }*/ } ================================================ FILE: FFmpegInterop/Source/MediaSampleProvider.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include extern "C" { #include } using namespace Windows::Storage::Streams; using namespace Windows::Media::Core; namespace FFmpegInterop { ref class FFmpegInteropMSS; ref class FFmpegReader; ref class MediaSampleProvider { public: virtual ~MediaSampleProvider(); virtual MediaStreamSample^ GetNextSample(); virtual void Flush(); virtual void SetCurrentStreamIndex(int streamIndex); internal: void PushPacket(AVPacket packet); AVPacket PopPacket(); private: std::queue m_packetQueue; int m_streamIndex; internal: // The FFmpeg context. Because they are complex types // we declare them as internal so they don't get exposed // externally FFmpegReader^ m_pReader; AVFormatContext* m_pAvFormatCtx; AVCodecContext* m_pAvCodecCtx; internal: MediaSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx); virtual HRESULT AllocateResources(); virtual HRESULT WriteAVPacketToStream(DataWriter^ writer, AVPacket* avPacket); virtual HRESULT DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket); }; } ================================================ FILE: FFmpegInterop/Source/UncompressedAudioSampleProvider.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "UncompressedAudioSampleProvider.h" using namespace FFmpegInterop; UncompressedAudioSampleProvider::UncompressedAudioSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx) : MediaSampleProvider(reader, avFormatCtx, avCodecCtx) , m_pAvFrame(nullptr) , m_pSwrCtx(nullptr) { } HRESULT UncompressedAudioSampleProvider::AllocateResources() { HRESULT hr = S_OK; hr = MediaSampleProvider::AllocateResources(); if (SUCCEEDED(hr)) { // Set default channel layout when the value is unknown (0) int64 inChannelLayout = m_pAvCodecCtx->channel_layout ? m_pAvCodecCtx->channel_layout : av_get_default_channel_layout(m_pAvCodecCtx->channels); int64 outChannelLayout = av_get_default_channel_layout(m_pAvCodecCtx->channels); // Set up resampler to convert any PCM format (e.g. AV_SAMPLE_FMT_FLTP) to AV_SAMPLE_FMT_S16 PCM format that is expected by Media Element. // Additional logic can be added to avoid resampling PCM data that is already in AV_SAMPLE_FMT_S16_PCM. m_pSwrCtx = swr_alloc_set_opts( NULL, outChannelLayout, AV_SAMPLE_FMT_S16, m_pAvCodecCtx->sample_rate, inChannelLayout, m_pAvCodecCtx->sample_fmt, m_pAvCodecCtx->sample_rate, 0, NULL); if (!m_pSwrCtx) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { if (swr_init(m_pSwrCtx) < 0) { hr = E_FAIL; } } if (SUCCEEDED(hr)) { m_pAvFrame = av_frame_alloc(); if (!m_pAvFrame) { hr = E_OUTOFMEMORY; } } return hr; } UncompressedAudioSampleProvider::~UncompressedAudioSampleProvider() { if (m_pAvFrame) { av_freep(m_pAvFrame); } // Free swr_free(&m_pSwrCtx); } HRESULT UncompressedAudioSampleProvider::WriteAVPacketToStream(DataWriter^ dataWriter, AVPacket* avPacket) { // Because each packet can contain multiple frames, we have already written the packet to the stream // during the decode stage. return S_OK; } HRESULT UncompressedAudioSampleProvider::DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket) { HRESULT hr = S_OK; int frameComplete = 0; // Each audio packet may contain multiple frames which requires calling avcodec_decode_audio4 for each frame. Loop through the entire packet data while (avPacket->size > 0) { frameComplete = 0; int decodedBytes = avcodec_decode_audio4(m_pAvCodecCtx, m_pAvFrame, &frameComplete, avPacket); if (decodedBytes < 0) { DebugMessage(L"Fail To Decode!\n"); hr = E_FAIL; break; // Skip broken frame } if (SUCCEEDED(hr) && frameComplete) { // Resample uncompressed frame to AV_SAMPLE_FMT_S16 PCM format that is expected by Media Element uint8_t *resampledData = nullptr; unsigned int aBufferSize = av_samples_alloc(&resampledData, NULL, m_pAvFrame->channels, m_pAvFrame->nb_samples, AV_SAMPLE_FMT_S16, 0); int resampledDataSize = swr_convert(m_pSwrCtx, &resampledData, aBufferSize, (const uint8_t **)m_pAvFrame->extended_data, m_pAvFrame->nb_samples); auto aBuffer = ref new Platform::Array(resampledData, min(aBufferSize, (unsigned int)(resampledDataSize * m_pAvFrame->channels * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)))); dataWriter->WriteBytes(aBuffer); av_freep(&resampledData); av_frame_unref(m_pAvFrame); } if (SUCCEEDED(hr)) { // Advance to the next frame data that have not been decoded if any avPacket->size -= decodedBytes; avPacket->data += decodedBytes; } } if (SUCCEEDED(hr)) { // We've completed the packet. Return S_FALSE to indicate an incomplete frame hr = (frameComplete != 0) ? S_OK : S_FALSE; } return hr; } ================================================ FILE: FFmpegInterop/Source/UncompressedAudioSampleProvider.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include "MediaSampleProvider.h" extern "C" { #include } namespace FFmpegInterop { ref class UncompressedAudioSampleProvider: MediaSampleProvider { public: virtual ~UncompressedAudioSampleProvider(); internal: UncompressedAudioSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx); virtual HRESULT WriteAVPacketToStream(DataWriter^ writer, AVPacket* avPacket) override; virtual HRESULT DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket) override; virtual HRESULT AllocateResources() override; private: AVFrame* m_pAvFrame; SwrContext* m_pSwrCtx; }; } ================================================ FILE: FFmpegInterop/Source/UncompressedVideoSampleProvider.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" #include "UncompressedVideoSampleProvider.h" extern "C" { #include } using namespace FFmpegInterop; UncompressedVideoSampleProvider::UncompressedVideoSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx) : MediaSampleProvider(reader, avFormatCtx, avCodecCtx) , m_pAvFrame(nullptr) , m_pSwsCtx(nullptr) { for (int i = 0; i < 4; i++) { m_rgVideoBufferLineSize[i] = 0; m_rgVideoBufferData[i] = nullptr; } } HRESULT UncompressedVideoSampleProvider::AllocateResources() { HRESULT hr = S_OK; hr = MediaSampleProvider::AllocateResources(); if (SUCCEEDED(hr)) { // Setup software scaler to convert any decoder pixel format (e.g. YUV420P) to NV12 that is supported in Windows & Windows Phone MediaElement m_pSwsCtx = sws_getContext( m_pAvCodecCtx->width, m_pAvCodecCtx->height, m_pAvCodecCtx->pix_fmt, m_pAvCodecCtx->width, m_pAvCodecCtx->height, AV_PIX_FMT_NV12, SWS_BICUBIC, NULL, NULL, NULL); if (m_pSwsCtx == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { m_pAvFrame = av_frame_alloc(); if (m_pAvFrame == nullptr) { hr = E_OUTOFMEMORY; } } if (SUCCEEDED(hr)) { if (av_image_alloc(m_rgVideoBufferData, m_rgVideoBufferLineSize, m_pAvCodecCtx->width, m_pAvCodecCtx->height, AV_PIX_FMT_NV12, 1) < 0) { hr = E_FAIL; } } return hr; } UncompressedVideoSampleProvider::~UncompressedVideoSampleProvider() { if (m_pAvFrame) { av_freep(m_pAvFrame); } if (m_rgVideoBufferData) { av_freep(m_rgVideoBufferData); } } HRESULT UncompressedVideoSampleProvider::WriteAVPacketToStream(DataWriter^ dataWriter, AVPacket* avPacket) { // Convert decoded video pixel format to NV12 using FFmpeg software scaler if (sws_scale(m_pSwsCtx, (const uint8_t **)(m_pAvFrame->data), m_pAvFrame->linesize, 0, m_pAvCodecCtx->height, m_rgVideoBufferData, m_rgVideoBufferLineSize) < 0) { return E_FAIL; } auto YBuffer = ref new Platform::Array(m_rgVideoBufferData[0], m_rgVideoBufferLineSize[0] * m_pAvCodecCtx->height); auto UVBuffer = ref new Platform::Array(m_rgVideoBufferData[1], m_rgVideoBufferLineSize[1] * m_pAvCodecCtx->height / 2); dataWriter->WriteBytes(YBuffer); dataWriter->WriteBytes(UVBuffer); av_frame_unref(m_pAvFrame); return S_OK; } HRESULT UncompressedVideoSampleProvider::DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket) { int frameComplete = 0; if (avcodec_decode_video2(m_pAvCodecCtx, m_pAvFrame, &frameComplete, avPacket) < 0) { DebugMessage(L"DecodeAVPacket Failed\n"); frameComplete = 1; } else { if (frameComplete) { avPacket->pts = av_frame_get_best_effort_timestamp(m_pAvFrame); } } return frameComplete ? S_OK : S_FALSE; } ================================================ FILE: FFmpegInterop/Source/UncompressedVideoSampleProvider.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include "MediaSampleProvider.h" extern "C" { #include } namespace FFmpegInterop { ref class UncompressedVideoSampleProvider: MediaSampleProvider { public: virtual ~UncompressedVideoSampleProvider(); internal: UncompressedVideoSampleProvider( FFmpegReader^ reader, AVFormatContext* avFormatCtx, AVCodecContext* avCodecCtx); virtual HRESULT WriteAVPacketToStream(DataWriter^ writer, AVPacket* avPacket) override; virtual HRESULT DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket) override; virtual HRESULT AllocateResources() override; private: AVFrame* m_pAvFrame; SwsContext* m_pSwsCtx; int m_rgVideoBufferLineSize[4]; uint8_t* m_rgVideoBufferData[4]; }; } ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/FFmpegGifDecoder.cpp ================================================ #include "pch.h" #include "FFmpegGifDecoder.h" #include #include #include #ifndef NOMINMAX #undef min #undef max #endif extern "C" { #include } using namespace FFmpegInterop; typedef struct VideoInfo { ~VideoInfo() { if (video_dec_ctx) { avcodec_close(video_dec_ctx); video_dec_ctx = nullptr; } if (fmt_ctx) { avformat_close_input(&fmt_ctx); fmt_ctx = nullptr; } if (frame) { av_frame_free(&frame); frame = nullptr; } if (src) { delete[] src; src = nullptr; } if (free_orig_pkt) { av_free_packet(&orig_pkt); free_orig_pkt = false; } //av_packet_unref(&orig_pkt); video_stream_idx = -1; video_stream = nullptr; } AVFormatContext *fmt_ctx = nullptr; char *src = nullptr; int video_stream_idx = -1; AVStream *video_stream = nullptr; AVCodecContext *video_dec_ctx = nullptr; AVFrame *frame = nullptr; bool has_decoded_frames = false; bool free_orig_pkt = false; AVPacket pkt; AVPacket orig_pkt; }; void Log(Platform::String^ message, Platform::Object^ parameter1, Platform::Object^ parameter2){ auto para1String = parameter1->ToString(); auto para2String = parameter2->ToString(); auto msg = std::wstring(message->Data()); auto para1 = std::wstring(safe_cast(para1String)->Data()); auto para2 = std::wstring(safe_cast(para2String)->Data()); auto offset1 = msg.find(L"{0}"); auto formattedText = msg.replace(offset1, 3, para1);// .append(L"\r\n"); auto offset2 = formattedText.find(L"{1}"); formattedText = formattedText.replace(offset2, 3, para2).append(L"\r\n"); ::OutputDebugString(formattedText.c_str()); } void Log(Platform::String^ message, Platform::Object^ parameter){ auto paraString = parameter->ToString(); auto msg = std::wstring(message->Data()); auto para = std::wstring(safe_cast(paraString)->Data()); auto offset = msg.find(L"{0}"); auto formattedText = msg.replace(offset, 3, para).append(L"\r\n"); ::OutputDebugString(formattedText.c_str()); } int open_codec_context(int *stream_idx, AVFormatContext *fmt_ctx, enum AVMediaType type) { int ret; AVStream *st; AVCodecContext *dec_ctx = NULL; AVCodec *dec = NULL; AVDictionary *opts = NULL; ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0); if (ret < 0) { //LOGE("can't find %s stream in input file\n", av_get_media_type_string(type)); return ret; } else { *stream_idx = ret; st = fmt_ctx->streams[*stream_idx]; dec_ctx = st->codec; dec = avcodec_find_decoder(dec_ctx->codec_id); if (!dec) { //LOGE("failed to find %s codec\n", av_get_media_type_string(type)); return ret; } av_dict_set(&opts, "refcounted_frames", "1", 0); if ((ret = avcodec_open2(dec_ctx, dec, &opts)) < 0) { //LOGE("failed to open %s codec\n", av_get_media_type_string(type)); return ret; } } return 0; } int decode_packet(VideoInfo *info, int *got_frame) { try{ int ret = 0; int decoded = info->pkt.size; *got_frame = 0; if (info->pkt.stream_index == info->video_stream_idx) { ret = avcodec_decode_video2(info->video_dec_ctx, info->frame, got_frame, &info->pkt); if (ret != 0) { return ret; } } return decoded; } catch (Platform::Exception^ e) { } return -1; } static bool _once; int FFmpegGifDecoder::CreateDecoder(Platform::String^ src, Platform::WriteOnlyArray^ data) { //if (!_once) { _once = true; av_register_all(); } VideoInfo *info = new VideoInfo(); Platform::String^ fooRT = src; std::wstring fooW(fooRT->Begin()); std::string fooA(fooW.begin(), fooW.end()); const char* srcString = fooA.c_str(); int len = strlen(srcString); info->src = new char[len + 1]; memcpy(info->src, srcString, len); info->src[len] = '\0'; if (srcString != 0) { //delete[] srcString; //env->ReleaseStringUTFChars(src, srcString); } int ret; if ((ret = avformat_open_input(&info->fmt_ctx, info->src, NULL, NULL)) < 0) { //LOGE("can't open source file %s, %s", info->src, av_err2str(ret)); char* error = new char[256]; auto str = av_strerror(ret, error, 256); delete info; return 0; } if ((ret = avformat_find_stream_info(info->fmt_ctx, NULL)) < 0) { //LOGE("can't find stream information %s, %s", info->src, av_err2str(ret)); delete info; return 0; } if (open_codec_context(&info->video_stream_idx, info->fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) { info->video_stream = info->fmt_ctx->streams[info->video_stream_idx]; info->video_dec_ctx = info->video_stream->codec; } if (info->video_stream <= 0) { //LOGE("can't find video stream in the input, aborting %s", info->src); delete info; return 0; } info->frame = av_frame_alloc(); if (info->frame == nullptr) { //LOGE("can't allocate frame %s", info->src); delete info; return 0; } av_init_packet(&info->pkt); info->pkt.data = NULL; info->pkt.size = 0; info->orig_pkt = info->pkt; //jint *dataArr = env->GetIntArrayElements(data, 0); if (data != nullptr && data->Length >= 2) { data[0] = info->video_dec_ctx->width; data[1] = info->video_dec_ctx->height; //env->ReleaseIntArrayElements(data, dataArr, 0); } //LOGD("successfully opened file %s", info->src); return (int)info; } void FFmpegGifDecoder::DestroyDecoder(int ptr) { if (ptr == NULL) { return; } VideoInfo *info = (VideoInfo *)ptr; delete info; } #define USE_BRANCHLESS 0 #if USE_BRANCHLESS static __inline int32 clamp0(int32 v) { return ((-(v) >> 31) & (v)); } static __inline int32 clamp255(int32 v) { return (((255 - (v)) >> 31) | (v)) & 255; } static __inline uint32 Clamp(int32 val) { int v = clamp0(val); return (uint32)(clamp255(v)); } static __inline uint32 Abs(int32 v) { int m = v >> 31; return (v + m) ^ m; } #else // USE_BRANCHLESS static __inline int32 clamp0(int32 v) { return (v < 0) ? 0 : v; } static __inline int32 clamp255(int32 v) { return (v > 255) ? 255 : v; } static __inline uint32 Clamp(int32 val) { int v = clamp0(val); return (uint32)(clamp255(v)); } static __inline uint32 Abs(int32 v) { return (v < 0) ? -v : v; } #endif // USE_BRANCHLESS #define YG 74 /* (int8)(1.164 * 64 + 0.5) */ #define UB 127 /* min(63,(int8)(2.018 * 64)) */ #define UG -25 /* (int8)(-0.391 * 64 - 0.5) */ #define UR 0 #define VB 0 #define VG -52 /* (int8)(-0.813 * 64 - 0.5) */ #define VR 102 /* (int8)(1.596 * 64 + 0.5) */ // Bias #define BB UB * 128 + VB * 128 #define BG UG * 128 + VG * 128 #define BR UR * 128 + VR * 128 static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, uint8* b, uint8* g, uint8* r) { int32 y1 = ((int32)(y)-16) * YG; *b = Clamp((int32)((u * UB + v * VB) - (BB)+y1) >> 6); *g = Clamp((int32)((u * UG + v * VG) - (BG)+y1) >> 6); *r = Clamp((int32)((u * UR + v * VR) - (BR)+y1) >> 6); } // Also used for 420 void I422ToARGBRow_C(const uint8* src_y, const uint8* src_u, const uint8* src_v, uint8* rgb_buf, int width) { int x; for (x = 0; x < width - 1; x += 2) { YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, rgb_buf + 2); rgb_buf[3] = 255; YuvPixel(src_y[1], src_u[0], src_v[0], rgb_buf + 4, rgb_buf + 5, rgb_buf + 6); rgb_buf[7] = 255; src_y += 2; src_u += 1; src_v += 1; rgb_buf += 8; // Advance 2 pixels. } if (width & 1) { YuvPixel(src_y[0], src_u[0], src_v[0], rgb_buf + 0, rgb_buf + 1, rgb_buf + 2); rgb_buf[3] = 255; } } // Convert I420 to ARGB. // LIBYUV_API int I420ToARGB(const uint8* src_y, int src_stride_y, const uint8* src_u, int src_stride_u, const uint8* src_v, int src_stride_v, uint8* dst_argb, int dst_stride_argb, int width, int height) { if (!src_y || !src_u || !src_v || !dst_argb || width <= 0 || height == 0) { return -1; } // Negative height means invert the image. if (height < 0) { height = -height; dst_argb = dst_argb + (height - 1) * dst_stride_argb; dst_stride_argb = -dst_stride_argb; } void(*I422ToARGBRow)(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, uint8* rgb_buf, int width) = I422ToARGBRow_C; #if defined(HAS_I422TOARGBROW_SSSE3) if (TestCpuFlag(kCpuHasSSSE3) && width >= 8) { I422ToARGBRow = I422ToARGBRow_Any_SSSE3; if (IS_ALIGNED(width, 8)) { I422ToARGBRow = I422ToARGBRow_Unaligned_SSSE3; if (IS_ALIGNED(dst_argb, 16) && IS_ALIGNED(dst_stride_argb, 16)) { I422ToARGBRow = I422ToARGBRow_SSSE3; } } } #endif #if defined(HAS_I422TOARGBROW_AVX2) if (TestCpuFlag(kCpuHasAVX2) && width >= 16) { I422ToARGBRow = I422ToARGBRow_Any_AVX2; if (IS_ALIGNED(width, 16)) { I422ToARGBRow = I422ToARGBRow_AVX2; } } #endif #if defined(HAS_I422TOARGBROW_NEON) if (TestCpuFlag(kCpuHasNEON) && width >= 8) { I422ToARGBRow = I422ToARGBRow_Any_NEON; if (IS_ALIGNED(width, 8)) { I422ToARGBRow = I422ToARGBRow_NEON; } } #endif #if defined(HAS_I422TOARGBROW_MIPS_DSPR2) if (TestCpuFlag(kCpuHasMIPS_DSPR2) && IS_ALIGNED(width, 4) && IS_ALIGNED(src_y, 4) && IS_ALIGNED(src_stride_y, 4) && IS_ALIGNED(src_u, 2) && IS_ALIGNED(src_stride_u, 2) && IS_ALIGNED(src_v, 2) && IS_ALIGNED(src_stride_v, 2) && IS_ALIGNED(dst_argb, 4) && IS_ALIGNED(dst_stride_argb, 4)) { I422ToARGBRow = I422ToARGBRow_MIPS_DSPR2; } #endif for (int y = 0; y < height; ++y) { I422ToARGBRow(src_y, src_u, src_v, dst_argb, width); dst_argb += dst_stride_argb; src_y += src_stride_y; if (y & 1) { src_u += src_stride_u; src_v += src_stride_v; } } return 0; } // Use first 4 shuffler values to reorder ARGB channels. void ARGBShuffleRow_C(const uint8* src_argb, uint8* dst_argb, const uint8* shuffler, int pix) { int index0 = shuffler[0]; int index1 = shuffler[1]; int index2 = shuffler[2]; int index3 = shuffler[3]; // Shuffle a row of ARGB. int x; for (x = 0; x < pix; ++x) { // To support in-place conversion. uint8 b = src_argb[index0]; uint8 g = src_argb[index1]; uint8 r = src_argb[index2]; uint8 a = src_argb[index3]; dst_argb[0] = b; dst_argb[1] = g; dst_argb[2] = r; dst_argb[3] = a; src_argb += 4; dst_argb += 4; } } int ARGBShuffle(const uint8* src_bgra, int src_stride_bgra, uint8* dst_argb, int dst_stride_argb, const uint8* shuffler, int width, int height) { int y; void(*ARGBShuffleRow)(const uint8* src_bgra, uint8* dst_argb, const uint8* shuffler, int pix) = ARGBShuffleRow_C; if (!src_bgra || !dst_argb || width <= 0 || height == 0) { return -1; } // Negative height means invert the image. if (height < 0) { height = -height; src_bgra = src_bgra + (height - 1) * src_stride_bgra; src_stride_bgra = -src_stride_bgra; } // Coalesce rows. if (src_stride_bgra == width * 4 && dst_stride_argb == width * 4) { width *= height; height = 1; src_stride_bgra = dst_stride_argb = 0; } for (y = 0; y < height; ++y) { ARGBShuffleRow(src_bgra, dst_argb, shuffler, width); src_bgra += src_stride_bgra; dst_argb += dst_stride_argb; } return 0; } // Shuffle table for converting ABGR to ARGB. static uint8 kShuffleMaskABGRToARGB[16] = { 2u, 1u, 0u, 3u, 6u, 5u, 4u, 7u, 10u, 9u, 8u, 11u, 14u, 13u, 12u, 15u }; // Convert ABGR to ARGB. int ABGRToARGB(const uint8* src_abgr, int src_stride_abgr, uint8* dst_argb, int dst_stride_argb, int width, int height) { return ARGBShuffle(src_abgr, src_stride_abgr, dst_argb, dst_stride_argb, (const uint8*)(&kShuffleMaskABGRToARGB), width, height); } Platform::Array^ FFmpegGifDecoder::GetVideoFrame(int ptr, Platform::WriteOnlyArray^ data) { auto emptyArray = ref new Platform::Array(0); unsigned int start = clock(); //Log("start={0}", start); if (ptr == NULL) { return emptyArray; } VideoInfo *info = (VideoInfo *)ptr; int ret = 0; int got_frame = 0; while (true) { if (info->pkt.size == 0) { ret = av_read_frame(info->fmt_ctx, &info->pkt); //LOGD("got packet with size %d", info->pkt.size); if (ret >= 0) { info->orig_pkt = info->pkt; info->free_orig_pkt = true; } } if (info->pkt.size > 0) { ret = decode_packet(info, &got_frame); if (ret < 0) { if (info->has_decoded_frames) { ret = 0; } info->pkt.size = 0; } else { //LOGD("read size %d from packet", ret); info->pkt.data += ret; info->pkt.size -= ret; } if (info->pkt.size == 0) { if (info->free_orig_pkt){ info->free_orig_pkt = false; av_free_packet(&info->orig_pkt); } //av_packet_unref(&info->orig_pkt); } } else { info->pkt.data = NULL; info->pkt.size = 0; ret = decode_packet(info, &got_frame); if (ret < 0) { //LOGE("can't decode packet flushed %s", info->src); return emptyArray; } if (got_frame == 0) { if (info->has_decoded_frames) { //LOGD("file end reached %s", info->src); if ((ret = avformat_seek_file(info->fmt_ctx, -1, std::numeric_limits::min(), 0, std::numeric_limits::max(), 0)) < 0) { //LOGE("can't seek to begin of file %s, %s", info->src, av_err2str(ret)); return emptyArray; } else { avcodec_flush_buffers(info->video_dec_ctx); } } } } if (ret < 0) { return emptyArray; } if (got_frame) { auto prevStop = start; auto stop = (clock() - start); Log("elapsed1={0} {1}", (double)stop, (double)(stop - prevStop)); //LOGD("decoded frame with w = %d, h = %d, format = %d", info->frame->width, info->frame->height, info->frame->format); auto pixelsLength = info->frame->width * info->frame->height * 4; auto pixels = ref new Platform::Array(pixelsLength); if (info->frame->format == AV_PIX_FMT_YUV420P || info->frame->format == AV_PIX_FMT_BGRA) { //jint *dataArr = env->GetIntArrayElements(data, 0); if (data != nullptr && data->Length >= 3) { data[2] = (int)(1000 * info->frame->pkt_pts * av_q2d(info->video_stream->time_base)); //env->ReleaseIntArrayElements(data, dataArr, 0); } if (info->frame->format == AV_PIX_FMT_YUV420P) { I420ToARGB(info->frame->data[0], info->frame->linesize[0], info->frame->data[2], info->frame->linesize[2], info->frame->data[1], info->frame->linesize[1], pixels->Data, info->frame->width * 4, info->frame->width, info->frame->height); } else if (info->frame->format == AV_PIX_FMT_BGRA) { ABGRToARGB(info->frame->data[0], info->frame->linesize[0], pixels->Data, info->frame->width * 4, info->frame->width, info->frame->height); } } prevStop = stop; stop = (clock() - start); Log("elapsed2={0} {1}", (double)stop, (double)(stop - prevStop)); info->has_decoded_frames = true; av_frame_unref(info->frame); //prevStop = stop; //stop = (clock() - start); //Log("elapsed3={0} {1}", (double)stop, (double)(stop - prevStop)); //auto returnBitmap = ref new Platform::Array(pixelsLength / 4); //for (int j = 0; j < pixelsLength / 4; j++){ // returnBitmap[j] = // (pixels[j * 4 + 3] << 24) + //b // (pixels[j * 4 + 2] << 0) + //g // (pixels[j * 4 + 1] << 8) + //r // (pixels[j * 4] << 16); //a // //returnBitmap[i] = pixels[i]; //} //delete[] pixels; prevStop = stop; stop = (clock() - start);// / (double)CLOCKS_PER_SEC; Log("elapsed4={0} {1}", (double)stop, (double)(stop - prevStop)); return pixels; } } return emptyArray; } ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/FFmpegGifDecoder.h ================================================ #pragma once namespace FFmpegInterop { public ref class FFmpegGifDecoder sealed { public: static int FFmpegGifDecoder::CreateDecoder(Platform::String^ src, Platform::WriteOnlyArray^ data); static void FFmpegGifDecoder::DestroyDecoder(int ptr); static Platform::Array^ FFmpegGifDecoder::GetVideoFrame(int ptr, Platform::WriteOnlyArray^ data); }; } ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/FFmpegInterop.Shared.vcxitems ================================================  $(MSBuildAllProjects);$(MSBuildThisFileFullPath) true {b290d2ce-e857-4ace-8541-d80a3b9ab04e} FFmpeg FFmpegInterop.Shared 248F659F-DAC5-46E8-AC09-60EC9FC95053 %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) Create ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/FFmpegInterop.Shared.vcxitems.filters ================================================  Create ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/pch.cpp ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #include "pch.h" ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.Shared/pch.h ================================================ //***************************************************************************** // // Copyright 2015 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http ://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //***************************************************************************** #pragma once #include #include // Disable debug string output on non-debug build #if !_DEBUG #define DebugMessage(x) #else #define DebugMessage(x) OutputDebugString(x) #endif ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.WindowsPhone/FFmpegInterop.WindowsPhone.vcxproj ================================================  Debug ARM Debug Win32 Release ARM Release Win32 true false {ebc5ca98-87f1-4a01-a48d-69659c103e72} FFmpegInterop en-US 12.0 true Windows Phone 8.1 CodeSharingWindowsRuntimeComponent FFmpegInterop.WindowsPhone DynamicLibrary true v120_wp81 DynamicLibrary true v120_wp81 DynamicLibrary false true v120_wp81 DynamicLibrary false true v120_wp81 Use _WINRT_DLL;%(PreprocessorDefinitions) pch.h $(IntDir)pch.pch /bigobj %(AdditionalOptions) true $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\include;%(AdditionalIncludeDirectories) Console false avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;shcore.lib;%(AdditionalDependencies) $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\bin;%(AdditionalLibraryDirectories) Use _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) pch.h $(IntDir)pch.pch /bigobj %(AdditionalOptions) true $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\include;%(AdditionalIncludeDirectories) Console false avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;shcore.lib;%(AdditionalDependencies) $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\bin;%(AdditionalLibraryDirectories) Use _WINRT_DLL;%(PreprocessorDefinitions) pch.h $(IntDir)pch.pch /bigobj %(AdditionalOptions) false $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\include;%(AdditionalIncludeDirectories) Console false avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;shcore.lib;%(AdditionalDependencies) $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\bin;%(AdditionalLibraryDirectories) Use _WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) pch.h $(IntDir)pch.pch /bigobj %(AdditionalOptions) false $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\include;%(AdditionalIncludeDirectories) Console false avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;shcore.lib;%(AdditionalDependencies) $(SolutionDir)ffmpeg\Build\WindowsPhone8.1\$(PlatformTarget)\bin;%(AdditionalLibraryDirectories) ================================================ FILE: FFmpegInterop/Win8.1/FFmpegInterop.WindowsPhone/FFmpegInterop.WindowsPhone.vcxproj.filters ================================================  ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ================================================ FILE: OpenCVComponent/Assets/haarcascade_eye.xml ================================================ BOOST HAAR 20 20 93 0 24 <_> 6 -1.4562760591506958e+00 <_> 0 -1 0 1.2963959574699402e-01 -7.7304208278656006e-01 6.8350148200988770e-01 <_> 0 -1 1 -4.6326808631420135e-02 5.7352751493453979e-01 -4.9097689986228943e-01 <_> 0 -1 2 -1.6173090785741806e-02 6.0254341363906860e-01 -3.1610709428787231e-01 <_> 0 -1 3 -4.5828841626644135e-02 6.4177548885345459e-01 -1.5545040369033813e-01 <_> 0 -1 4 -5.3759619593620300e-02 5.4219317436218262e-01 -2.0480829477310181e-01 <_> 0 -1 5 3.4171190112829208e-02 -2.3388190567493439e-01 4.8410901427268982e-01 <_> 12 -1.2550230026245117e+00 <_> 0 -1 6 -2.1727620065212250e-01 7.1098899841308594e-01 -5.9360730648040771e-01 <_> 0 -1 7 1.2071969918906689e-02 -2.8240481019020081e-01 5.9013551473617554e-01 <_> 0 -1 8 -1.7854139208793640e-02 5.3137522935867310e-01 -2.2758960723876953e-01 <_> 0 -1 9 2.2333610802888870e-02 -1.7556099593639374e-01 6.3356137275695801e-01 <_> 0 -1 10 -9.1420017182826996e-02 6.1563092470169067e-01 -1.6899530589580536e-01 <_> 0 -1 11 2.8973650187253952e-02 -1.2250079959630966e-01 7.4401170015335083e-01 <_> 0 -1 12 7.8203463926911354e-03 1.6974370181560516e-01 -6.5441650152206421e-01 <_> 0 -1 13 2.0340489223599434e-02 -1.2556649744510651e-01 8.2710450887680054e-01 <_> 0 -1 14 -1.1926149949431419e-02 3.8605681061744690e-01 -2.0992340147495270e-01 <_> 0 -1 15 -9.7281101625412703e-04 -6.3761192560195923e-01 1.2952390313148499e-01 <_> 0 -1 16 1.8322050891583785e-05 -3.4631478786468506e-01 2.2924269735813141e-01 <_> 0 -1 17 -8.0854417756199837e-03 -6.3665801286697388e-01 1.3078659772872925e-01 <_> 9 -1.3728189468383789e+00 <_> 0 -1 18 -1.1812269687652588e-01 6.7844521999359131e-01 -5.0045782327651978e-01 <_> 0 -1 19 -3.4332759678363800e-02 6.7186361551284790e-01 -3.5744878649711609e-01 <_> 0 -1 20 -2.1530799567699432e-02 7.2220700979232788e-01 -1.8192419409751892e-01 <_> 0 -1 21 -2.1909970790147781e-02 6.6529387235641479e-01 -2.7510228753089905e-01 <_> 0 -1 22 -2.8713539242744446e-02 6.9955700635910034e-01 -1.9615580141544342e-01 <_> 0 -1 23 -1.1467480100691319e-02 5.9267348051071167e-01 -2.2097350656986237e-01 <_> 0 -1 24 -2.2611169144511223e-02 3.4483069181442261e-01 -3.8379558920860291e-01 <_> 0 -1 25 -1.9308089977130294e-03 -7.9445719718933105e-01 1.5628659725189209e-01 <_> 0 -1 26 5.6419910833938047e-05 -3.0896010994911194e-01 3.5431089997291565e-01 <_> 16 -1.2879480123519897e+00 <_> 0 -1 27 1.9886520504951477e-01 -5.2860701084136963e-01 3.5536721348762512e-01 <_> 0 -1 28 -3.6008939146995544e-02 4.2109689116477966e-01 -3.9348980784416199e-01 <_> 0 -1 29 -7.7569849789142609e-02 4.7991541028022766e-01 -2.5122168660163879e-01 <_> 0 -1 30 8.2630853285081685e-05 -3.8475489616394043e-01 3.1849220395088196e-01 <_> 0 -1 31 3.2773229759186506e-04 -2.6427319645881653e-01 3.2547241449356079e-01 <_> 0 -1 32 -1.8574850633740425e-02 4.6736589074134827e-01 -1.5067270398139954e-01 <_> 0 -1 33 -7.0008762122597545e-05 2.9313150048255920e-01 -2.5365099310874939e-01 <_> 0 -1 34 -1.8552130088210106e-02 4.6273660659790039e-01 -1.3148050010204315e-01 <_> 0 -1 35 -1.3030420057475567e-02 4.1627219319343567e-01 -1.7751489579677582e-01 <_> 0 -1 36 6.5694141085259616e-05 -2.8035101294517517e-01 2.6680740714073181e-01 <_> 0 -1 37 1.7005260451696813e-04 -2.7027249336242676e-01 2.3981650173664093e-01 <_> 0 -1 38 -3.3129199873656034e-03 4.4411438703536987e-01 -1.4428889751434326e-01 <_> 0 -1 39 1.7583490116521716e-03 -1.6126190125942230e-01 4.2940768599510193e-01 <_> 0 -1 40 -2.5194749236106873e-02 4.0687298774719238e-01 -1.8202580511569977e-01 <_> 0 -1 41 1.4031709870323539e-03 8.4759786725044250e-02 -8.0018568038940430e-01 <_> 0 -1 42 -7.3991729877889156e-03 5.5766099691390991e-01 -1.1843159794807434e-01 <_> 23 -1.2179850339889526e+00 <_> 0 -1 43 -2.9943080618977547e-02 3.5810810327529907e-01 -3.8487631082534790e-01 <_> 0 -1 44 -1.2567380070686340e-01 3.9316931366920471e-01 -3.0012258887290955e-01 <_> 0 -1 45 5.3635272197425365e-03 -4.3908619880676270e-01 1.9257010519504547e-01 <_> 0 -1 46 -8.0971820279955864e-03 3.9906668663024902e-01 -2.3407870531082153e-01 <_> 0 -1 47 -1.6597909852862358e-02 4.2095288634300232e-01 -2.2674840688705444e-01 <_> 0 -1 48 -2.0199299324303865e-03 -7.4156731367111206e-01 1.2601189315319061e-01 <_> 0 -1 49 -1.5202340437099338e-03 -7.6154601573944092e-01 8.6373612284660339e-02 <_> 0 -1 50 -4.9663940444588661e-03 4.2182239890098572e-01 -1.7904919385910034e-01 <_> 0 -1 51 -1.9207600504159927e-02 4.6894899010658264e-01 -1.4378750324249268e-01 <_> 0 -1 52 -1.2222680263221264e-02 3.2842078804969788e-01 -2.1802149713039398e-01 <_> 0 -1 53 5.7548668235540390e-02 -3.6768808960914612e-01 2.4357110261917114e-01 <_> 0 -1 54 -9.5794079825282097e-03 -7.2245067358016968e-01 6.3664563000202179e-02 <_> 0 -1 55 -2.9545740690082312e-03 3.5846439003944397e-01 -1.6696329414844513e-01 <_> 0 -1 56 -4.2017991654574871e-03 3.9094808697700500e-01 -1.2041790038347244e-01 <_> 0 -1 57 -1.3624990358948708e-02 -5.8767718076705933e-01 8.8404729962348938e-02 <_> 0 -1 58 6.2853112467564642e-05 -2.6348459720611572e-01 2.1419279277324677e-01 <_> 0 -1 59 -2.6782939676195383e-03 -7.8390169143676758e-01 8.0526962876319885e-02 <_> 0 -1 60 -7.0597179234027863e-02 4.1469261050224304e-01 -1.3989959657192230e-01 <_> 0 -1 61 9.2093646526336670e-02 -1.3055180013179779e-01 5.0435781478881836e-01 <_> 0 -1 62 -8.8004386052489281e-03 3.6609750986099243e-01 -1.4036649465560913e-01 <_> 0 -1 63 7.5080977694597095e-05 -2.9704439640045166e-01 2.0702940225601196e-01 <_> 0 -1 64 -2.9870450962334871e-03 3.5615700483322144e-01 -1.5445969998836517e-01 <_> 0 -1 65 -2.6441509835422039e-03 -5.4353517293930054e-01 1.0295110195875168e-01 <_> 27 -1.2905240058898926e+00 <_> 0 -1 66 -4.7862470149993896e-02 4.1528239846229553e-01 -3.4185820817947388e-01 <_> 0 -1 67 8.7350532412528992e-02 -3.8749781250953674e-01 2.4204200506210327e-01 <_> 0 -1 68 -1.6849499195814133e-02 5.3082478046417236e-01 -1.7282910645008087e-01 <_> 0 -1 69 -2.8870029374957085e-02 3.5843509435653687e-01 -2.2402590513229370e-01 <_> 0 -1 70 2.5679389946162701e-03 1.4990499615669250e-01 -6.5609407424926758e-01 <_> 0 -1 71 -2.4116659536957741e-02 5.5889678001403809e-01 -1.4810280501842499e-01 <_> 0 -1 72 -3.2826658338308334e-02 4.6468681097030640e-01 -1.0785529762506485e-01 <_> 0 -1 73 -1.5233060345053673e-02 -7.3954427242279053e-01 5.6236881762742996e-02 <_> 0 -1 74 -3.0209511169232428e-04 -4.5548820495605469e-01 9.7069837152957916e-02 <_> 0 -1 75 7.5365108205005527e-04 9.5147296786308289e-02 -5.4895019531250000e-01 <_> 0 -1 76 -1.0638950392603874e-02 4.0912970900535583e-01 -1.2308409810066223e-01 <_> 0 -1 77 -7.5217830017209053e-03 4.0289148688316345e-01 -1.6048780083656311e-01 <_> 0 -1 78 -1.0677099972963333e-01 6.1759322881698608e-01 -7.3091186583042145e-02 <_> 0 -1 79 1.6256919130682945e-02 -1.3103680312633514e-01 3.7453651428222656e-01 <_> 0 -1 80 -2.0679360255599022e-02 -7.1402907371520996e-01 5.2390009164810181e-02 <_> 0 -1 81 1.7052369192242622e-02 1.2822860479354858e-01 -3.1080681085586548e-01 <_> 0 -1 82 -5.7122060097754002e-03 -6.0556507110595703e-01 8.1884756684303284e-02 <_> 0 -1 83 2.0851430235779844e-05 -2.6812988519668579e-01 1.4453840255737305e-01 <_> 0 -1 84 7.9284431412816048e-03 -7.8795351088047028e-02 5.6762582063674927e-01 <_> 0 -1 85 -2.5217379443347454e-03 3.7068629264831543e-01 -1.3620570302009583e-01 <_> 0 -1 86 -2.2426199167966843e-02 -6.8704998493194580e-01 5.1062859594821930e-02 <_> 0 -1 87 -7.6451441273093224e-03 2.3492220044136047e-01 -1.7905959486961365e-01 <_> 0 -1 88 -1.1175329564139247e-03 -5.9869050979614258e-01 7.4324436485767365e-02 <_> 0 -1 89 1.9212789833545685e-02 -1.5702550113201141e-01 2.9737469553947449e-01 <_> 0 -1 90 5.6293429806828499e-03 -9.9769018590450287e-02 4.2130270600318909e-01 <_> 0 -1 91 -9.5671862363815308e-03 -6.0858798027038574e-01 7.3506258428096771e-02 <_> 0 -1 92 1.1217960156500340e-02 -1.0320810228586197e-01 4.1909849643707275e-01 <_> 28 -1.1600480079650879e+00 <_> 0 -1 93 -1.7486440017819405e-02 3.1307280063629150e-01 -3.3681181073188782e-01 <_> 0 -1 94 3.0714649707078934e-02 -1.8766190111637115e-01 5.3780800104141235e-01 <_> 0 -1 95 -2.2188719362020493e-02 3.6637881398200989e-01 -1.6124810278415680e-01 <_> 0 -1 96 -5.0700771680567414e-05 2.1245710551738739e-01 -2.8444620966911316e-01 <_> 0 -1 97 -7.0170420221984386e-03 3.9543110132217407e-01 -1.3173590600490570e-01 <_> 0 -1 98 -6.8563609384000301e-03 3.0373859405517578e-01 -2.0657819509506226e-01 <_> 0 -1 99 -1.4129259623587132e-02 -7.6503008604049683e-01 9.8213188350200653e-02 <_> 0 -1 100 -4.7915481030941010e-02 4.8307389020919800e-01 -1.3006809353828430e-01 <_> 0 -1 101 4.7032979637151584e-05 -2.5216570496559143e-01 2.4386680126190186e-01 <_> 0 -1 102 1.0221180273219943e-03 6.8857602775096893e-02 -6.5861141681671143e-01 <_> 0 -1 103 -2.6056109927594662e-03 4.2942029237747192e-01 -1.3022460043430328e-01 <_> 0 -1 104 5.4505340813193470e-05 -1.9288620352745056e-01 2.8958499431610107e-01 <_> 0 -1 105 -6.6721157054416835e-05 3.0290710926055908e-01 -1.9854369759559631e-01 <_> 0 -1 106 2.6281431317329407e-01 -2.3293940722942352e-01 2.3692460358142853e-01 <_> 0 -1 107 -2.3569669574499130e-02 1.9401040673255920e-01 -2.8484618663787842e-01 <_> 0 -1 108 -3.9120172150433064e-03 5.5378979444503784e-01 -9.5665678381919861e-02 <_> 0 -1 109 5.0788799853762612e-05 -2.3912659287452698e-01 2.1799489855766296e-01 <_> 0 -1 110 -7.8732017427682877e-03 4.0697428584098816e-01 -1.2768040597438812e-01 <_> 0 -1 111 -1.6778609715402126e-03 -5.7744657993316650e-01 9.7324788570404053e-02 <_> 0 -1 112 -2.6832430739887059e-04 2.9021880030632019e-01 -1.6831269860267639e-01 <_> 0 -1 113 7.8687182394787669e-05 -1.9551570713520050e-01 2.7720969915390015e-01 <_> 0 -1 114 1.2953500263392925e-02 -9.6838317811489105e-02 4.0323871374130249e-01 <_> 0 -1 115 -1.3043959625065327e-02 4.7198569774627686e-01 -8.9287549257278442e-02 <_> 0 -1 116 3.0261781066656113e-03 -1.3623380661010742e-01 3.0686271190643311e-01 <_> 0 -1 117 -6.0438038781285286e-03 -7.7954101562500000e-01 5.7316310703754425e-02 <_> 0 -1 118 -2.2507249377667904e-03 3.0877059698104858e-01 -1.5006309747695923e-01 <_> 0 -1 119 1.5826810151338577e-02 6.4551889896392822e-02 -7.2455567121505737e-01 <_> 0 -1 120 6.5864507632795721e-05 -1.7598840594291687e-01 2.3210389912128448e-01 <_> 36 -1.2257250547409058e+00 <_> 0 -1 121 -2.7854869142174721e-02 4.5518448948860168e-01 -1.8099910020828247e-01 <_> 0 -1 122 1.2895040214061737e-01 -5.2565532922744751e-01 1.6188900172710419e-01 <_> 0 -1 123 2.4403180927038193e-02 -1.4974960684776306e-01 4.2357379198074341e-01 <_> 0 -1 124 -2.4458570405840874e-03 3.2948669791221619e-01 -1.7447690665721893e-01 <_> 0 -1 125 -3.5336529836058617e-03 4.7426640987396240e-01 -7.3618359863758087e-02 <_> 0 -1 126 5.1358150813030079e-05 -3.0421930551528931e-01 1.5633270144462585e-01 <_> 0 -1 127 -1.6225680708885193e-02 2.3002180457115173e-01 -2.0359820127487183e-01 <_> 0 -1 128 -4.6007009223103523e-03 4.0459269285202026e-01 -1.3485440611839294e-01 <_> 0 -1 129 -2.1928999572992325e-02 -6.8724489212036133e-01 8.0684266984462738e-02 <_> 0 -1 130 -2.8971210122108459e-03 -6.9619607925415039e-01 4.8545219004154205e-02 <_> 0 -1 131 -4.4074649922549725e-03 2.5166261196136475e-01 -1.6236649453639984e-01 <_> 0 -1 132 2.8437169268727303e-02 6.0394261032342911e-02 -6.6744458675384521e-01 <_> 0 -1 133 8.3212882280349731e-02 6.4357921481132507e-02 -5.3626042604446411e-01 <_> 0 -1 134 -1.2419329956173897e-02 -7.0816862583160400e-01 5.7526610791683197e-02 <_> 0 -1 135 -4.6992599964141846e-03 5.1254332065582275e-01 -8.7350800633430481e-02 <_> 0 -1 136 -7.8025809489190578e-04 2.6687660813331604e-01 -1.7961509525775909e-01 <_> 0 -1 137 -1.9724339246749878e-02 -6.7563730478286743e-01 7.2941906750202179e-02 <_> 0 -1 138 1.0269250487908721e-03 5.3919319063425064e-02 -5.5540180206298828e-01 <_> 0 -1 139 -2.5957189500331879e-02 5.6362527608871460e-01 -7.1898393332958221e-02 <_> 0 -1 140 -1.2552699772641063e-03 -5.0346630811691284e-01 8.9691452682018280e-02 <_> 0 -1 141 -4.9970578402280807e-02 1.7685119807720184e-01 -2.2301959991455078e-01 <_> 0 -1 142 -2.9899610672146082e-03 3.9122420549392700e-01 -1.0149750113487244e-01 <_> 0 -1 143 4.8546842299401760e-03 -1.1770179867744446e-01 4.2190939188003540e-01 <_> 0 -1 144 1.0448860120959580e-04 -1.7333979904651642e-01 2.2344440221786499e-01 <_> 0 -1 145 5.9689260524464771e-05 -2.3409630358219147e-01 1.6558240354061127e-01 <_> 0 -1 146 -1.3423919677734375e-02 4.3023818731307983e-01 -9.9723652005195618e-02 <_> 0 -1 147 2.2581999655812979e-03 7.2720989584922791e-02 -5.7501018047332764e-01 <_> 0 -1 148 -1.2546280398964882e-02 3.6184579133987427e-01 -1.1457010358572006e-01 <_> 0 -1 149 -2.8705769218504429e-03 2.8210538625717163e-01 -1.2367550283670425e-01 <_> 0 -1 150 1.9785640761256218e-02 4.7876749187707901e-02 -8.0666238069534302e-01 <_> 0 -1 151 4.7588930465281010e-03 -1.0925389826297760e-01 3.3746978640556335e-01 <_> 0 -1 152 -6.9974269717931747e-03 -8.0295938253402710e-01 4.5706700533628464e-02 <_> 0 -1 153 -1.3033480383455753e-02 1.8680439889431000e-01 -1.7688910663127899e-01 <_> 0 -1 154 -1.3742579612880945e-03 2.7725479006767273e-01 -1.2809009850025177e-01 <_> 0 -1 155 2.7657810132950544e-03 9.0758942067623138e-02 -4.2594739794731140e-01 <_> 0 -1 156 2.8941841446794569e-04 -3.8816329836845398e-01 8.9267797768115997e-02 <_> 47 -1.2863140106201172e+00 <_> 0 -1 157 -1.4469229616224766e-02 3.7507829070091248e-01 -2.4928289651870728e-01 <_> 0 -1 158 -1.3317629694938660e-01 3.0166378617286682e-01 -2.2414070367813110e-01 <_> 0 -1 159 -1.0132160037755966e-02 3.6985591053962708e-01 -1.7850010097026825e-01 <_> 0 -1 160 -7.8511182218790054e-03 4.6086761355400085e-01 -1.2931390106678009e-01 <_> 0 -1 161 -1.4295839704573154e-02 4.4841429591178894e-01 -1.0226240009069443e-01 <_> 0 -1 162 -5.9606940485537052e-03 2.7927988767623901e-01 -1.5323829650878906e-01 <_> 0 -1 163 1.0932769626379013e-02 -1.5141740441322327e-01 3.9889648556709290e-01 <_> 0 -1 164 5.0430990086169913e-05 -2.2681570053100586e-01 2.1644389629364014e-01 <_> 0 -1 165 -5.8431681245565414e-03 4.5420148968696594e-01 -1.2587159872055054e-01 <_> 0 -1 166 -2.2346209734678268e-02 -6.2690192461013794e-01 8.2403123378753662e-02 <_> 0 -1 167 -4.8836669884622097e-03 2.6359251141548157e-01 -1.4686630666255951e-01 <_> 0 -1 168 7.5506002758629620e-05 -2.4507020413875580e-01 1.6678880155086517e-01 <_> 0 -1 169 -4.9026997294276953e-04 -4.2649960517883301e-01 8.9973561465740204e-02 <_> 0 -1 170 1.4861579984426498e-03 -1.2040250003337860e-01 3.0097651481628418e-01 <_> 0 -1 171 -1.1988339945673943e-02 2.7852478623390198e-01 -1.2244340032339096e-01 <_> 0 -1 172 1.0502239689230919e-02 4.0452759712934494e-02 -7.4050408601760864e-01 <_> 0 -1 173 -3.0963009223341942e-02 -6.2842690944671631e-01 4.8013761639595032e-02 <_> 0 -1 174 1.1414520442485809e-02 3.9405211806297302e-02 -7.1674120426177979e-01 <_> 0 -1 175 -1.2337000109255314e-02 1.9941329956054688e-01 -1.9274300336837769e-01 <_> 0 -1 176 -5.9942267835140228e-03 5.1318162679672241e-01 -6.1658058315515518e-02 <_> 0 -1 177 -1.1923230485990644e-03 -7.2605299949645996e-01 5.0652720034122467e-02 <_> 0 -1 178 -7.4582789093255997e-03 2.9603078961372375e-01 -1.1754789948463440e-01 <_> 0 -1 179 2.7877509128302336e-03 4.5068711042404175e-02 -6.9535410404205322e-01 <_> 0 -1 180 -2.2503209766000509e-04 2.0047250390052795e-01 -1.5775249898433685e-01 <_> 0 -1 181 -5.0367889925837517e-03 2.9299819469451904e-01 -1.1700499802827835e-01 <_> 0 -1 182 7.4742160737514496e-02 -1.1392319947481155e-01 3.0256620049476624e-01 <_> 0 -1 183 2.0255519077181816e-02 -1.0515890270471573e-01 4.0670460462570190e-01 <_> 0 -1 184 4.4214509427547455e-02 -2.7631640434265137e-01 1.2363869696855545e-01 <_> 0 -1 185 -8.7259558495134115e-04 2.4355030059814453e-01 -1.3300949335098267e-01 <_> 0 -1 186 -2.4453739169985056e-03 -5.3866171836853027e-01 6.2510646879673004e-02 <_> 0 -1 187 8.2725353422574699e-05 -2.0772209763526917e-01 1.6270439326763153e-01 <_> 0 -1 188 -3.6627110093832016e-02 3.6568409204483032e-01 -9.0330280363559723e-02 <_> 0 -1 189 3.0996399000287056e-03 -1.3183020055294037e-01 2.5354298949241638e-01 <_> 0 -1 190 -2.4709280114620924e-03 -5.6853497028350830e-01 5.3505431860685349e-02 <_> 0 -1 191 -1.4114670455455780e-02 -4.8599010705947876e-01 5.8485250920057297e-02 <_> 0 -1 192 8.4537261864170432e-04 -8.0093637108802795e-02 4.0265649557113647e-01 <_> 0 -1 193 -7.1098632179200649e-03 4.4703239202499390e-01 -6.2947437167167664e-02 <_> 0 -1 194 -1.9125960767269135e-02 -6.6422867774963379e-01 4.9822770059108734e-02 <_> 0 -1 195 -5.0773010589182377e-03 1.7379400134086609e-01 -1.6850599646568298e-01 <_> 0 -1 196 -2.9198289848864079e-03 -6.0110282897949219e-01 5.7427939027547836e-02 <_> 0 -1 197 -2.4902150034904480e-02 2.3397980630397797e-01 -1.1818459630012512e-01 <_> 0 -1 198 2.0147779956459999e-02 -8.9459821581840515e-02 3.6024400591850281e-01 <_> 0 -1 199 1.7597640398889780e-03 4.9458440393209457e-02 -6.3102620840072632e-01 <_> 0 -1 200 1.3812039978802204e-03 -1.5218059718608856e-01 1.8971739709377289e-01 <_> 0 -1 201 -1.0904540307819843e-02 -5.8097380399703979e-01 4.4862728565931320e-02 <_> 0 -1 202 7.5157178798690438e-05 -1.3777349889278412e-01 1.9543160498142242e-01 <_> 0 -1 203 3.8649770431220531e-03 -1.0302229970693588e-01 2.5374969840049744e-01 <_> 48 -1.1189440488815308e+00 <_> 0 -1 204 -1.0215889662504196e-01 4.1681259870529175e-01 -1.6655629873275757e-01 <_> 0 -1 205 -5.1939819008111954e-02 3.3023950457572937e-01 -2.0715710520744324e-01 <_> 0 -1 206 -4.2717780917882919e-02 2.6093730330467224e-01 -1.6013890504837036e-01 <_> 0 -1 207 4.3890418601222336e-04 -3.4750530123710632e-01 1.3918919861316681e-01 <_> 0 -1 208 2.4264389649033546e-02 -4.2552059888839722e-01 1.3578380644321442e-01 <_> 0 -1 209 -2.3820599541068077e-02 3.1749808788299561e-01 -1.6652040183544159e-01 <_> 0 -1 210 -7.0518180727958679e-03 3.0947178602218628e-01 -1.3338300585746765e-01 <_> 0 -1 211 -6.8517157342284918e-04 -6.0082262754440308e-01 8.7747000157833099e-02 <_> 0 -1 212 5.3705149330198765e-03 -1.2311449646949768e-01 3.8333550095558167e-01 <_> 0 -1 213 -1.3403539545834064e-02 3.3877369761466980e-01 -1.0140489786863327e-01 <_> 0 -1 214 -6.6856360062956810e-03 -6.1193597316741943e-01 4.7740221023559570e-02 <_> 0 -1 215 -4.2887418530881405e-03 2.5275790691375732e-01 -1.4434510469436646e-01 <_> 0 -1 216 -1.0876749642193317e-02 5.4775732755661011e-01 -5.9455480426549911e-02 <_> 0 -1 217 3.7882640026509762e-04 8.3410300314426422e-02 -4.4226369261741638e-01 <_> 0 -1 218 -2.4550149682909250e-03 2.3330999910831451e-01 -1.3964480161666870e-01 <_> 0 -1 219 1.2721839593723416e-03 6.0480289161205292e-02 -4.9456089735031128e-01 <_> 0 -1 220 -4.8933159559965134e-03 -6.6833269596099854e-01 4.6218499541282654e-02 <_> 0 -1 221 2.6449989527463913e-02 -7.3235362768173218e-02 4.4425961375236511e-01 <_> 0 -1 222 -3.3706070389598608e-03 -4.2464339733123779e-01 6.8676561117172241e-02 <_> 0 -1 223 -2.9559480026364326e-03 1.6218039393424988e-01 -1.8222999572753906e-01 <_> 0 -1 224 3.0619909986853600e-02 -5.8643341064453125e-02 5.3263628482818604e-01 <_> 0 -1 225 -9.5765907317399979e-03 -6.0562682151794434e-01 5.3345989435911179e-02 <_> 0 -1 226 6.6372493165545166e-05 -1.6680839657783508e-01 1.9284160435199738e-01 <_> 0 -1 227 5.0975950434803963e-03 4.4119510799646378e-02 -5.7458841800689697e-01 <_> 0 -1 228 3.7112718564458191e-04 -1.1086399853229523e-01 2.3105390369892120e-01 <_> 0 -1 229 -8.6607588455080986e-03 4.0456289052963257e-01 -6.2446091324090958e-02 <_> 0 -1 230 8.7489158613607287e-04 6.4875148236751556e-02 -4.4871041178703308e-01 <_> 0 -1 231 1.1120870476588607e-03 -9.3861460685729980e-02 3.0453911423683167e-01 <_> 0 -1 232 -2.3837819695472717e-02 -5.8887428045272827e-01 4.6659421175718307e-02 <_> 0 -1 233 2.2272899514064193e-04 -1.4898599684238434e-01 1.7701950669288635e-01 <_> 0 -1 234 2.4467470124363899e-02 -5.5789601057767868e-02 4.9208301305770874e-01 <_> 0 -1 235 -1.4239320158958435e-01 1.5192000567913055e-01 -1.8778899312019348e-01 <_> 0 -1 236 -2.0123120397329330e-02 2.1780100464820862e-01 -1.2081900238990784e-01 <_> 0 -1 237 1.1513679783092812e-04 -1.6856589913368225e-01 1.6451929509639740e-01 <_> 0 -1 238 -2.7556740678846836e-03 -6.9442039728164673e-01 3.9449468255043030e-02 <_> 0 -1 239 -7.5843912782147527e-05 1.8941369652748108e-01 -1.5183840692043304e-01 <_> 0 -1 240 -7.0697711780667305e-03 4.7064599394798279e-01 -5.7927619665861130e-02 <_> 0 -1 241 -3.7393178790807724e-02 -7.5892448425292969e-01 3.4116048365831375e-02 <_> 0 -1 242 -1.5995610505342484e-02 3.0670469999313354e-01 -8.7525576353073120e-02 <_> 0 -1 243 -3.1183990649878979e-03 2.6195371150970459e-01 -9.1214887797832489e-02 <_> 0 -1 244 1.0651360498741269e-03 -1.7427560687065125e-01 1.5277640521526337e-01 <_> 0 -1 245 -1.6029420075938106e-03 3.5612630844116211e-01 -7.6629996299743652e-02 <_> 0 -1 246 4.3619908392429352e-03 4.9356970936059952e-02 -5.9228771924972534e-01 <_> 0 -1 247 -1.0779909789562225e-02 -6.3922178745269775e-01 3.3204540610313416e-02 <_> 0 -1 248 -4.3590869754552841e-03 1.6107389330863953e-01 -1.5221320092678070e-01 <_> 0 -1 249 7.4596069753170013e-03 3.3172961324453354e-02 -7.5007742643356323e-01 <_> 0 -1 250 8.1385448575019836e-03 2.6325279846787453e-02 -7.1731162071228027e-01 <_> 0 -1 251 -3.3338490873575211e-02 3.3536610007286072e-01 -7.0803590118885040e-02 <_> 55 -1.1418989896774292e+00 <_> 0 -1 252 1.9553979858756065e-02 -1.0439720004796982e-01 5.3128951787948608e-01 <_> 0 -1 253 2.2122919559478760e-02 -2.4747270345687866e-01 2.0847250521183014e-01 <_> 0 -1 254 -4.1829389519989491e-03 3.8289439678192139e-01 -1.4711579680442810e-01 <_> 0 -1 255 -8.6381728760898113e-04 -6.2632888555526733e-01 1.1993259936571121e-01 <_> 0 -1 256 7.9958612332120538e-04 9.2573471367359161e-02 -5.5168831348419189e-01 <_> 0 -1 257 9.1527570039033890e-03 -7.2929807007312775e-02 5.5512511730194092e-01 <_> 0 -1 258 -3.9388681761920452e-03 2.0196039974689484e-01 -2.0912039279937744e-01 <_> 0 -1 259 1.4613410166930407e-04 -2.7861818671226501e-01 1.3817410171031952e-01 <_> 0 -1 260 -3.1691689509898424e-03 3.6685898900032043e-01 -7.6308242976665497e-02 <_> 0 -1 261 -2.2189389914274216e-02 3.9096599817276001e-01 -1.0971540212631226e-01 <_> 0 -1 262 -7.4523608200252056e-03 1.2838590145111084e-01 -2.4159869551658630e-01 <_> 0 -1 263 7.7997002517804503e-04 7.1978069841861725e-02 -4.3976500630378723e-01 <_> 0 -1 264 -4.6783639118075371e-03 2.1569849550724030e-01 -1.4205920696258545e-01 <_> 0 -1 265 -1.5188639983534813e-02 3.6458781361579895e-01 -8.2675926387310028e-02 <_> 0 -1 266 5.0619798712432384e-03 -3.4380409121513367e-01 9.2068232595920563e-02 <_> 0 -1 267 -1.7351920250803232e-03 -6.1725497245788574e-01 4.9214478582143784e-02 <_> 0 -1 268 -1.2423450127243996e-02 -5.8558952808380127e-01 4.6112600713968277e-02 <_> 0 -1 269 -1.3031429611146450e-02 -5.9710788726806641e-01 4.0672458708286285e-02 <_> 0 -1 270 -1.2369629694148898e-03 -6.8334168195724487e-01 3.3156178891658783e-02 <_> 0 -1 271 6.1022108420729637e-03 -9.4729237258434296e-02 3.0102241039276123e-01 <_> 0 -1 272 6.6952849738299847e-04 8.1816866993904114e-02 -3.5196030139923096e-01 <_> 0 -1 273 -1.7970580374822021e-03 2.3718979954719543e-01 -1.1768709868192673e-01 <_> 0 -1 274 -7.1074528386816382e-04 -4.4763788580894470e-01 5.7682480663061142e-02 <_> 0 -1 275 -5.9126471169292927e-03 4.3425410985946655e-01 -6.6868573427200317e-02 <_> 0 -1 276 -3.3132149837911129e-03 1.8150010704994202e-01 -1.4180320501327515e-01 <_> 0 -1 277 -6.0814660042524338e-02 4.7221711277961731e-01 -6.1410639435052872e-02 <_> 0 -1 278 -9.6714183688163757e-02 2.7683168649673462e-01 -9.4490036368370056e-02 <_> 0 -1 279 3.9073550142347813e-03 -1.2278530001640320e-01 2.1057400107383728e-01 <_> 0 -1 280 -9.0431869029998779e-03 3.5641568899154663e-01 -7.7806226909160614e-02 <_> 0 -1 281 -4.8800031654536724e-03 -4.1034790873527527e-01 6.9694377481937408e-02 <_> 0 -1 282 -4.3547428213059902e-03 -7.3017889261245728e-01 3.6655150353908539e-02 <_> 0 -1 283 -9.6500627696514130e-03 5.5181127786636353e-01 -5.3168080747127533e-02 <_> 0 -1 284 -1.7397310584783554e-02 -5.7084232568740845e-01 5.0214089453220367e-02 <_> 0 -1 285 -6.8304329179227352e-03 -4.6180281043052673e-01 5.0202690064907074e-02 <_> 0 -1 286 3.3255619928240776e-04 -9.5362730324268341e-02 2.5983759760856628e-01 <_> 0 -1 287 -2.3100529797375202e-03 2.2872470319271088e-01 -1.0533530265092850e-01 <_> 0 -1 288 -7.5426651164889336e-03 -5.6990510225296021e-01 4.8863459378480911e-02 <_> 0 -1 289 -5.2723060362040997e-03 3.5145181417465210e-01 -8.2390107214450836e-02 <_> 0 -1 290 -4.8578968271613121e-03 -6.0417622327804565e-01 4.4539440423250198e-02 <_> 0 -1 291 1.5867310576140881e-03 -1.0340909659862518e-01 2.3282019793987274e-01 <_> 0 -1 292 -4.7427811659872532e-03 2.8490281105041504e-01 -9.8090499639511108e-02 <_> 0 -1 293 -1.3515240279957652e-03 2.3096430301666260e-01 -1.1361840367317200e-01 <_> 0 -1 294 2.2526069078594446e-03 6.4478322863578796e-02 -4.2205891013145447e-01 <_> 0 -1 295 -3.8038659840822220e-04 -3.8076201081275940e-01 6.0043290257453918e-02 <_> 0 -1 296 4.9043921753764153e-03 -7.6104998588562012e-02 3.3232170343399048e-01 <_> 0 -1 297 -9.0969670563936234e-03 1.4287790656089783e-01 -1.6887800395488739e-01 <_> 0 -1 298 -6.9317929446697235e-03 2.7255409955978394e-01 -9.2879563570022583e-02 <_> 0 -1 299 1.1471060570329428e-03 -1.5273059904575348e-01 1.9702400267124176e-01 <_> 0 -1 300 -3.7662889808416367e-02 -5.9320437908172607e-01 4.0738601237535477e-02 <_> 0 -1 301 -6.8165571428835392e-03 2.5494089722633362e-01 -9.4081960618495941e-02 <_> 0 -1 302 6.6205562325194478e-04 4.6795718371868134e-02 -4.8454371094703674e-01 <_> 0 -1 303 -4.2202551849186420e-03 2.4682149291038513e-01 -9.4673976302146912e-02 <_> 0 -1 304 -6.8986512720584869e-02 -6.6514801979064941e-01 3.5926390439271927e-02 <_> 0 -1 305 6.1707608401775360e-03 2.5833319872617722e-02 -7.2686272859573364e-01 <_> 0 -1 306 1.0536249727010727e-02 -8.1828996539115906e-02 2.9760798811912537e-01 <_> 32 -1.1255199909210205e+00 <_> 0 -1 307 -6.2758728861808777e-02 2.7899080514907837e-01 -2.9656109213829041e-01 <_> 0 -1 308 3.4516479354351759e-03 -3.4635880589485168e-01 2.0903840661048889e-01 <_> 0 -1 309 -7.8699486330151558e-03 2.4144889414310455e-01 -1.9205570220947266e-01 <_> 0 -1 310 -3.4624869003891945e-03 -5.9151780605316162e-01 1.2486449629068375e-01 <_> 0 -1 311 -9.4818761572241783e-03 1.8391540646553040e-01 -2.4858260154724121e-01 <_> 0 -1 312 2.3226840130519122e-04 -3.3047258853912354e-01 1.0999260097742081e-01 <_> 0 -1 313 1.8101120367646217e-03 9.8744012415409088e-02 -4.9634781479835510e-01 <_> 0 -1 314 -5.4422430694103241e-03 2.9344418644905090e-01 -1.3094750046730042e-01 <_> 0 -1 315 7.4148122221231461e-03 -1.4762699604034424e-01 3.3277168869972229e-01 <_> 0 -1 316 -1.5565140172839165e-02 -6.8404901027679443e-01 9.9872693419456482e-02 <_> 0 -1 317 2.8720520436763763e-02 -1.4833280444145203e-01 3.0902579426765442e-01 <_> 0 -1 318 9.6687392215244472e-05 -1.7431040108203888e-01 2.1402959525585175e-01 <_> 0 -1 319 5.2371058613061905e-02 -7.0156857371330261e-02 4.9222990870475769e-01 <_> 0 -1 320 -8.6485691368579865e-02 5.0757247209548950e-01 -7.5294211506843567e-02 <_> 0 -1 321 -4.2169868946075439e-02 4.5680961012840271e-01 -9.0219900012016296e-02 <_> 0 -1 322 4.5369830331765115e-05 -2.6538279652595520e-01 1.6189539432525635e-01 <_> 0 -1 323 5.2918000146746635e-03 7.4890151619911194e-02 -5.4054671525955200e-01 <_> 0 -1 324 -7.5511651812121272e-04 -4.9261990189552307e-01 5.8723948895931244e-02 <_> 0 -1 325 7.5108138844370842e-05 -2.1432100236415863e-01 1.4077760279178619e-01 <_> 0 -1 326 4.9981209449470043e-03 -9.0547338128089905e-02 3.5716068744659424e-01 <_> 0 -1 327 -1.4929979806765914e-03 2.5623458623886108e-01 -1.4229069650173187e-01 <_> 0 -1 328 2.7239411137998104e-03 -1.5649250149726868e-01 2.1088710427284241e-01 <_> 0 -1 329 2.2218320518732071e-03 -1.5072989463806152e-01 2.6801869273185730e-01 <_> 0 -1 330 -7.3993072146549821e-04 2.9546990990638733e-01 -1.0692390054464340e-01 <_> 0 -1 331 2.0113459322601557e-03 5.0614349544048309e-02 -7.1683371067047119e-01 <_> 0 -1 332 1.1452870443463326e-02 -1.2719069421291351e-01 2.4152779579162598e-01 <_> 0 -1 333 -1.0782170575112104e-03 2.4813009798526764e-01 -1.3461199402809143e-01 <_> 0 -1 334 3.3417691010981798e-03 5.3578309714794159e-02 -5.2274167537689209e-01 <_> 0 -1 335 6.9398651248775423e-05 -2.1698740124702454e-01 1.2812179327011108e-01 <_> 0 -1 336 -4.0982551872730255e-03 2.4401889741420746e-01 -1.1570589989423752e-01 <_> 0 -1 337 -1.6289720078930259e-03 2.8261470794677734e-01 -1.0659469664096832e-01 <_> 0 -1 338 1.3984859921038151e-02 4.2715899646282196e-02 -7.3646312952041626e-01 <_> 30 -1.1729990243911743e+00 <_> 0 -1 339 1.6416519880294800e-01 -4.8960301280021667e-01 1.7607709765434265e-01 <_> 0 -1 340 8.3413062384352088e-04 -2.8220430016517639e-01 2.4199579656124115e-01 <_> 0 -1 341 -1.7193210078403354e-03 -7.1485888957977295e-01 8.6162216961383820e-02 <_> 0 -1 342 -1.5654950402677059e-03 -7.2972381114959717e-01 9.4070672988891602e-02 <_> 0 -1 343 1.9124479731544852e-03 -3.1187158823013306e-01 1.8143390119075775e-01 <_> 0 -1 344 -1.3512369990348816e-01 2.9577299952507019e-01 -2.2179250419139862e-01 <_> 0 -1 345 -4.0300549007952213e-03 -6.6595137119293213e-01 8.5431016981601715e-02 <_> 0 -1 346 -2.8640460222959518e-03 -6.2086361646652222e-01 5.3106021136045456e-02 <_> 0 -1 347 -1.4065420255064964e-03 2.2346289455890656e-01 -2.0211009681224823e-01 <_> 0 -1 348 -3.5820449702441692e-03 -5.4030400514602661e-01 6.8213619291782379e-02 <_> 0 -1 349 4.1544470936059952e-02 -6.5215840935707092e-02 6.2109231948852539e-01 <_> 0 -1 350 -9.1709550470113754e-03 -7.5553297996520996e-01 5.2640449255704880e-02 <_> 0 -1 351 6.1552738770842552e-03 9.0939402580261230e-02 -4.4246131181716919e-01 <_> 0 -1 352 -1.0043520014733076e-03 2.4292330443859100e-01 -1.8669790029525757e-01 <_> 0 -1 353 1.1519829742610455e-02 -1.1763150244951248e-01 3.6723458766937256e-01 <_> 0 -1 354 -8.9040733873844147e-03 -4.8931330442428589e-01 1.0897020250558853e-01 <_> 0 -1 355 5.3973670583218336e-04 -2.1850399672985077e-01 1.8489989638328552e-01 <_> 0 -1 356 1.3727260520681739e-03 -1.5072910487651825e-01 2.9173129796981812e-01 <_> 0 -1 357 -1.0807390324771404e-02 4.2897450923919678e-01 -1.0280139744281769e-01 <_> 0 -1 358 1.2670770520344377e-03 7.4192158877849579e-02 -6.4208251237869263e-01 <_> 0 -1 359 2.2991129662841558e-03 4.7100279480218887e-02 -7.2335231304168701e-01 <_> 0 -1 360 2.7187510859221220e-03 -1.7086869478225708e-01 2.3513509333133698e-01 <_> 0 -1 361 -6.6619180142879486e-03 -7.8975427150726318e-01 4.5084670186042786e-02 <_> 0 -1 362 -4.8266649246215820e-02 -6.9579917192459106e-01 4.1976079344749451e-02 <_> 0 -1 363 1.5214690007269382e-02 -1.0818280279636383e-01 3.6460620164871216e-01 <_> 0 -1 364 -6.0080131515860558e-03 3.0970990657806396e-01 -1.1359210312366486e-01 <_> 0 -1 365 6.6127157770097256e-03 8.0665342509746552e-02 -4.6658530831336975e-01 <_> 0 -1 366 -7.9607013612985611e-03 -8.7201941013336182e-01 3.6774590611457825e-02 <_> 0 -1 367 3.8847199175506830e-03 -1.1666289716959000e-01 3.3070269227027893e-01 <_> 0 -1 368 -1.0988810099661350e-03 2.3872570693492889e-01 -1.7656759917736053e-01 <_> 44 -1.0368299484252930e+00 <_> 0 -1 369 3.5903379321098328e-03 -2.3688079416751862e-01 2.4631640315055847e-01 <_> 0 -1 370 6.4815930090844631e-03 -3.1373620033264160e-01 1.8675759434700012e-01 <_> 0 -1 371 7.3048402555286884e-05 -2.7644351124763489e-01 1.6496239602565765e-01 <_> 0 -1 372 -3.8514640182256699e-03 -5.6014508008956909e-01 1.1294739693403244e-01 <_> 0 -1 373 3.8588210009038448e-03 3.9848998188972473e-02 -5.8071857690811157e-01 <_> 0 -1 374 -2.4651220068335533e-02 1.6755010187625885e-01 -2.5343671441078186e-01 <_> 0 -1 375 4.7245521098375320e-02 -1.0662080347537994e-01 3.9451980590820312e-01 <_> 0 -1 376 6.5964651294052601e-03 -1.7744250595569611e-01 2.7280190587043762e-01 <_> 0 -1 377 -1.3177490327507257e-03 -5.4272651672363281e-01 4.8606589436531067e-02 <_> 0 -1 378 -5.0261709839105606e-03 2.4394249916076660e-01 -1.3143649697303772e-01 <_> 0 -1 379 3.4632768947631121e-03 6.9049343466758728e-02 -7.0336240530014038e-01 <_> 0 -1 380 2.1692588925361633e-03 -1.3289460539817810e-01 2.2098529338836670e-01 <_> 0 -1 381 2.9395870864391327e-02 -2.8530520200729370e-01 1.3543990254402161e-01 <_> 0 -1 382 -9.6181448316201568e-04 -5.8041381835937500e-01 3.7450648844242096e-02 <_> 0 -1 383 -1.0820999741554260e-01 3.9467281103134155e-01 -7.8655943274497986e-02 <_> 0 -1 384 -1.8024869263172150e-02 2.7355629205703735e-01 -1.3415299355983734e-01 <_> 0 -1 385 6.2509840354323387e-03 2.3388059809803963e-02 -8.0088591575622559e-01 <_> 0 -1 386 -1.6088379779830575e-03 -5.6762522459030151e-01 4.1215669363737106e-02 <_> 0 -1 387 7.7564752427861094e-04 -1.4891269803047180e-01 1.9086180627346039e-01 <_> 0 -1 388 8.7122338300105184e-05 -1.5557530522346497e-01 1.9428220391273499e-01 <_> 0 -1 389 -2.0755320787429810e-02 -6.3006532192230225e-01 3.6134380847215652e-02 <_> 0 -1 390 -6.2931738793849945e-03 2.5609248876571655e-01 -1.0588269680738449e-01 <_> 0 -1 391 1.0844149626791477e-02 -1.0124850273132324e-01 3.0322128534317017e-01 <_> 0 -1 392 -6.3752777350600809e-05 1.9111579656600952e-01 -1.3849230110645294e-01 <_> 0 -1 393 6.6480963141657412e-05 -1.5205250680446625e-01 2.1706309914588928e-01 <_> 0 -1 394 1.3560829684138298e-03 4.9431789666414261e-02 -6.4279842376708984e-01 <_> 0 -1 395 -9.0662558795884252e-04 1.7982010543346405e-01 -1.4044609665870667e-01 <_> 0 -1 396 1.0473709553480148e-03 -1.0933549702167511e-01 2.4265940487384796e-01 <_> 0 -1 397 -1.0243969736620784e-03 2.7162680029869080e-01 -1.1820919811725616e-01 <_> 0 -1 398 -1.2024149764329195e-03 -7.0151102542877197e-01 3.9489898830652237e-02 <_> 0 -1 399 7.6911649666726589e-03 -9.2218913137912750e-02 3.1046289205551147e-01 <_> 0 -1 400 -1.3966549932956696e-01 6.8979388475418091e-01 -3.9706118404865265e-02 <_> 0 -1 401 2.1276050247251987e-03 9.7277611494064331e-02 -2.8841799497604370e-01 <_> 0 -1 402 -2.7594310231506824e-03 2.4168670177459717e-01 -1.1277820169925690e-01 <_> 0 -1 403 5.2236132323741913e-03 -1.1430279910564423e-01 2.4256780743598938e-01 <_> 0 -1 404 -1.2590440455824137e-03 -5.9679388999938965e-01 4.7663960605859756e-02 <_> 0 -1 405 -3.7192099262028933e-03 -4.6414130926132202e-01 5.2847690880298615e-02 <_> 0 -1 406 5.9696151874959469e-03 -7.3244288563728333e-02 3.8743090629577637e-01 <_> 0 -1 407 -5.1776720210909843e-03 -7.4193227291107178e-01 4.0496710687875748e-02 <_> 0 -1 408 5.0035100430250168e-03 -1.3888800144195557e-01 1.8767620623111725e-01 <_> 0 -1 409 -5.2013457752764225e-04 -5.4940617084503174e-01 4.9417849630117416e-02 <_> 0 -1 410 5.3168768063187599e-03 -8.2482978701591492e-02 3.1740561127662659e-01 <_> 0 -1 411 -1.4774589799344540e-02 2.0816099643707275e-01 -1.2115559726953506e-01 <_> 0 -1 412 -4.1416451334953308e-02 -8.2437807321548462e-01 3.3329188823699951e-02 <_> 53 -1.0492420196533203e+00 <_> 0 -1 413 9.0962520334869623e-04 8.4579966962337494e-02 -5.6118410825729370e-01 <_> 0 -1 414 -5.6139789521694183e-02 1.5341749787330627e-01 -2.6967319846153259e-01 <_> 0 -1 415 1.0292009683325887e-03 -2.0489980280399323e-01 2.0153179764747620e-01 <_> 0 -1 416 2.8783010784536600e-03 -1.7351140081882477e-01 2.1297949552536011e-01 <_> 0 -1 417 -7.4144392274320126e-03 -5.9624868631362915e-01 4.7077950090169907e-02 <_> 0 -1 418 -1.4831849839538336e-03 1.9024610519409180e-01 -1.5986390411853790e-01 <_> 0 -1 419 4.5968941412866116e-03 3.1447131186723709e-02 -6.8694341182708740e-01 <_> 0 -1 420 2.4255330208688974e-03 -2.3609359562397003e-01 1.1036109924316406e-01 <_> 0 -1 421 -8.4950566291809082e-02 2.3107160627841949e-01 -1.3776530325412750e-01 <_> 0 -1 422 -5.0145681016147137e-03 3.8676109910011292e-01 -5.6217379868030548e-02 <_> 0 -1 423 -2.1482061129063368e-03 1.8191599845886230e-01 -1.7615699768066406e-01 <_> 0 -1 424 -1.0396770201623440e-02 -7.5351381301879883e-01 2.4091970175504684e-02 <_> 0 -1 425 -1.3466750271618366e-02 -7.2118860483169556e-01 3.4949369728565216e-02 <_> 0 -1 426 -8.4435477852821350e-02 -3.3792638778686523e-01 7.1113817393779755e-02 <_> 0 -1 427 2.4771490134298801e-03 -1.1765109747648239e-01 2.2541989386081696e-01 <_> 0 -1 428 1.5828050673007965e-02 -6.9536216557025909e-02 3.1395369768142700e-01 <_> 0 -1 429 6.4916983246803284e-02 -7.5043588876724243e-02 4.0677338838577271e-01 <_> 0 -1 430 2.9652469675056636e-04 7.3953360319137573e-02 -3.4544008970260620e-01 <_> 0 -1 431 1.3129520229995251e-03 -1.6909439861774445e-01 1.5258370339870453e-01 <_> 0 -1 432 -5.8032129891216755e-03 3.5260149836540222e-01 -8.3444066345691681e-02 <_> 0 -1 433 -1.4791679382324219e-01 4.3004658818244934e-01 -5.7309929281473160e-02 <_> 0 -1 434 -1.6584150493144989e-02 2.3432689905166626e-01 -1.0907640308141708e-01 <_> 0 -1 435 3.0183270573616028e-03 -1.3600939512252808e-01 2.6409289240837097e-01 <_> 0 -1 436 -3.6471918225288391e-02 -6.2809741497039795e-01 4.3545108288526535e-02 <_> 0 -1 437 -7.3119226726703346e-05 1.6470630466938019e-01 -1.6463780403137207e-01 <_> 0 -1 438 -3.6719450727105141e-03 -4.7421360015869141e-01 4.8586919903755188e-02 <_> 0 -1 439 -4.0151178836822510e-03 1.8222180008888245e-01 -1.4097510278224945e-01 <_> 0 -1 440 1.9948020577430725e-02 -6.9787658751010895e-02 3.6707460880279541e-01 <_> 0 -1 441 7.6699437340721488e-04 5.5729299783706665e-02 -4.4585430622100830e-01 <_> 0 -1 442 -1.1806039838120341e-03 -4.6876621246337891e-01 4.8902221024036407e-02 <_> 0 -1 443 1.5847349539399147e-02 -1.2120209634304047e-01 2.0566530525684357e-01 <_> 0 -1 444 -1.1985700111836195e-03 2.0262099802494049e-01 -1.2823820114135742e-01 <_> 0 -1 445 -1.0964959859848022e-01 -8.6619192361831665e-01 3.0351849272847176e-02 <_> 0 -1 446 -9.2532606795430183e-03 2.9343119263648987e-01 -8.5361950099468231e-02 <_> 0 -1 447 1.4686530455946922e-02 3.2798621803522110e-02 -7.7556562423706055e-01 <_> 0 -1 448 -1.3514430029317737e-03 2.4426999688148499e-01 -1.1503250151872635e-01 <_> 0 -1 449 -4.3728090822696686e-03 2.1687670052051544e-01 -1.3984480500221252e-01 <_> 0 -1 450 3.4263390116393566e-03 4.5614220201969147e-02 -5.4567712545394897e-01 <_> 0 -1 451 -3.8404068909585476e-03 1.4949500560760498e-01 -1.5062509477138519e-01 <_> 0 -1 452 3.7988980766385794e-03 -8.7301626801490784e-02 2.5481531023979187e-01 <_> 0 -1 453 -2.0094281062483788e-03 1.7259070277214050e-01 -1.4288470149040222e-01 <_> 0 -1 454 -2.4370709434151649e-03 2.6848098635673523e-01 -8.1898219883441925e-02 <_> 0 -1 455 1.0485399980098009e-03 4.6113260090351105e-02 -4.7243279218673706e-01 <_> 0 -1 456 1.7460780218243599e-03 -1.1030430346727371e-01 2.0379729568958282e-01 <_> 0 -1 457 5.8608627878129482e-03 -1.5619659423828125e-01 1.5927439928054810e-01 <_> 0 -1 458 -2.7724979445338249e-02 1.1349119991064072e-01 -2.1885140240192413e-01 <_> 0 -1 459 4.7080639749765396e-02 -4.1688729077577591e-02 5.3630048036575317e-01 <_> 0 -1 460 -7.9283770173788071e-03 -5.3595131635665894e-01 4.4237509369850159e-02 <_> 0 -1 461 -1.2880540452897549e-02 2.3237949609756470e-01 -1.0246250033378601e-01 <_> 0 -1 462 2.3604769259691238e-02 -8.8291436433792114e-02 3.0561059713363647e-01 <_> 0 -1 463 1.5902200713753700e-02 -1.2238109856843948e-01 1.7849120497703552e-01 <_> 0 -1 464 7.9939495772123337e-03 -8.3729006350040436e-02 3.2319590449333191e-01 <_> 0 -1 465 5.7100867852568626e-03 3.8479208946228027e-02 -6.8138152360916138e-01 <_> 51 -1.1122100353240967e+00 <_> 0 -1 466 2.2480720654129982e-03 -1.6416870057582855e-01 4.1648530960083008e-01 <_> 0 -1 467 4.5813550241291523e-03 -1.2465959787368774e-01 4.0385121107101440e-01 <_> 0 -1 468 -1.6073239967226982e-03 2.6082459092140198e-01 -2.0282520353794098e-01 <_> 0 -1 469 2.5205370038747787e-03 -1.0557229816913605e-01 3.6669111251831055e-01 <_> 0 -1 470 2.4119189474731684e-03 -1.3877600431442261e-01 2.9959911108016968e-01 <_> 0 -1 471 5.7156179100275040e-03 -7.7683463692665100e-02 4.8481920361518860e-01 <_> 0 -1 472 3.1093840952962637e-03 -1.1229000240564346e-01 2.9215508699417114e-01 <_> 0 -1 473 -8.6836628615856171e-02 -3.6779600381851196e-01 7.2597242891788483e-02 <_> 0 -1 474 5.2652182057499886e-03 -1.0890290141105652e-01 3.1791260838508606e-01 <_> 0 -1 475 -1.9913529977202415e-02 -5.3373438119888306e-01 7.0585712790489197e-02 <_> 0 -1 476 3.8297839928418398e-03 -1.3575910031795502e-01 2.2788879275321960e-01 <_> 0 -1 477 1.0431859642267227e-02 8.8797912001609802e-02 -4.7958970069885254e-01 <_> 0 -1 478 -2.0040439441800117e-02 1.5745539963245392e-01 -1.7771570384502411e-01 <_> 0 -1 479 -5.2967290394008160e-03 -6.8434917926788330e-01 3.5671461373567581e-02 <_> 0 -1 480 -2.1624139044433832e-03 2.8318038582801819e-01 -9.8511278629302979e-02 <_> 0 -1 481 -3.5464888787828386e-04 -3.7077340483665466e-01 8.0932952463626862e-02 <_> 0 -1 482 -1.8152060511056334e-04 -3.2207030057907104e-01 7.7551059424877167e-02 <_> 0 -1 483 -2.7563021285459399e-04 -3.2441279292106628e-01 8.7949477136135101e-02 <_> 0 -1 484 6.3823810778558254e-03 -8.8924713432788849e-02 3.1727218627929688e-01 <_> 0 -1 485 1.1150909587740898e-02 7.1019843220710754e-02 -4.0494039654731750e-01 <_> 0 -1 486 -1.0593760525807738e-03 2.6050668954849243e-01 -1.1765640228986740e-01 <_> 0 -1 487 2.3906480055302382e-03 -8.4388621151447296e-02 3.1230551004409790e-01 <_> 0 -1 488 -1.1000749655067921e-02 1.9152249395847321e-01 -1.5210020542144775e-01 <_> 0 -1 489 -2.4643228971399367e-04 -3.1765159964561462e-01 8.6582258343696594e-02 <_> 0 -1 490 2.3053269833326340e-02 -1.0089760273694992e-01 2.5769290328025818e-01 <_> 0 -1 491 -2.2135660983622074e-03 4.5689210295677185e-01 -5.2404791116714478e-02 <_> 0 -1 492 -9.7139709396287799e-04 -3.5518380999565125e-01 8.0094382166862488e-02 <_> 0 -1 493 1.5676229959353805e-03 1.0091420263051987e-01 -2.1603040397167206e-01 <_> 0 -1 494 7.5460801599547267e-04 5.7896178215742111e-02 -4.0461111068725586e-01 <_> 0 -1 495 -2.0698970183730125e-02 3.1543630361557007e-01 -8.0713048577308655e-02 <_> 0 -1 496 -2.0619940012693405e-02 2.7181661128997803e-01 -7.6358616352081299e-02 <_> 0 -1 497 2.1611129865050316e-02 3.9493449032306671e-02 -5.9429651498794556e-01 <_> 0 -1 498 6.5676742233335972e-03 -9.8353669047355652e-02 2.3649279773235321e-01 <_> 0 -1 499 -8.8434796780347824e-03 -5.2523428201675415e-01 4.3099921196699142e-02 <_> 0 -1 500 -9.4260741025209427e-03 2.4665130674839020e-01 -9.4130717217922211e-02 <_> 0 -1 501 -1.9830230157822371e-03 2.6743701100349426e-01 -9.0069316327571869e-02 <_> 0 -1 502 -1.7358399927616119e-03 1.5940019488334656e-01 -1.5789410471916199e-01 <_> 0 -1 503 -1.3513869605958462e-02 4.0792331099510193e-01 -6.4223118126392365e-02 <_> 0 -1 504 -1.9394010305404663e-02 1.8015649914741516e-01 -1.3731400668621063e-01 <_> 0 -1 505 -3.2684770412743092e-03 2.9080390930175781e-01 -8.0161906778812408e-02 <_> 0 -1 506 4.1773589327931404e-04 -2.1412980556488037e-01 1.1273439973592758e-01 <_> 0 -1 507 -7.6351119205355644e-03 -4.5365959405899048e-01 5.4625060409307480e-02 <_> 0 -1 508 -8.3652976900339127e-03 2.6472920179367065e-01 -9.4334110617637634e-02 <_> 0 -1 509 2.7768449857831001e-02 -1.0136710107326508e-01 2.0743979513645172e-01 <_> 0 -1 510 -5.4891228675842285e-02 2.8840309381484985e-01 -7.5312040746212006e-02 <_> 0 -1 511 2.5793339591473341e-03 -1.1088529974222183e-01 2.1724960207939148e-01 <_> 0 -1 512 6.6196516854688525e-05 -1.8872100114822388e-01 1.4440689980983734e-01 <_> 0 -1 513 5.0907251425087452e-03 -7.7601231634616852e-02 2.9398378729820251e-01 <_> 0 -1 514 -1.0444259643554688e-01 2.0133109390735626e-01 -1.0903970152139664e-01 <_> 0 -1 515 -6.7273090826347470e-04 1.7945900559425354e-01 -1.2023670226335526e-01 <_> 0 -1 516 3.2412849832326174e-03 4.0688131004571915e-02 -5.4600572586059570e-01 <_> 44 -1.2529590129852295e+00 <_> 0 -1 517 5.2965320646762848e-03 -1.2154529988765717e-01 6.4420372247695923e-01 <_> 0 -1 518 -2.5326260365545750e-03 5.1233220100402832e-01 -1.1108259856700897e-01 <_> 0 -1 519 -2.9183230362832546e-03 -5.0615429878234863e-01 1.1501979827880859e-01 <_> 0 -1 520 -2.3692339658737183e-02 3.7167280912399292e-01 -1.4672680199146271e-01 <_> 0 -1 521 2.0177470520138741e-02 -1.7388840019702911e-01 4.7759491205215454e-01 <_> 0 -1 522 -2.1723210811614990e-02 -4.3880090117454529e-01 1.3576899468898773e-01 <_> 0 -1 523 2.8369780629873276e-03 -1.2512069940567017e-01 4.6789029240608215e-01 <_> 0 -1 524 2.7148420922458172e-03 -8.8018856942653656e-02 3.6866518855094910e-01 <_> 0 -1 525 3.2625689636915922e-03 -8.5335306823253632e-02 5.1644730567932129e-01 <_> 0 -1 526 -3.5618850961327553e-03 -4.4503930211067200e-01 9.1738171875476837e-02 <_> 0 -1 527 1.9227749435231090e-03 -1.1077310144901276e-01 3.9416998624801636e-01 <_> 0 -1 528 -3.5111969918943942e-04 -3.7775701284408569e-01 1.2166170030832291e-01 <_> 0 -1 529 1.9121779769193381e-04 7.4816018342971802e-02 -4.0767100453376770e-01 <_> 0 -1 530 -2.6525629800744355e-04 -3.3151718974113464e-01 1.1291120201349258e-01 <_> 0 -1 531 2.0086700096726418e-02 -6.1598118394613266e-02 5.6128817796707153e-01 <_> 0 -1 532 3.6783248186111450e-02 -6.0251388698816299e-02 5.2192491292953491e-01 <_> 0 -1 533 1.3941619545221329e-03 -3.5503050684928894e-01 1.0863020271062851e-01 <_> 0 -1 534 -1.5181669965386391e-02 2.2739650309085846e-01 -1.6252990067005157e-01 <_> 0 -1 535 4.6796840615570545e-03 -5.7535041123628616e-02 4.8124238848686218e-01 <_> 0 -1 536 -1.7988319450523704e-04 -3.0587670207023621e-01 1.0868159681558609e-01 <_> 0 -1 537 -3.5850999411195517e-03 3.8596940040588379e-01 -9.2194072902202606e-02 <_> 0 -1 538 1.0793360415846109e-03 -1.1190389841794968e-01 3.1125208735466003e-01 <_> 0 -1 539 7.3285802500322461e-05 -2.0239910483360291e-01 1.5586680173873901e-01 <_> 0 -1 540 1.3678739964962006e-01 -2.1672859787940979e-01 1.4420390129089355e-01 <_> 0 -1 541 -1.1729259975254536e-02 4.3503770232200623e-01 -7.4886530637741089e-02 <_> 0 -1 542 3.9230841211974621e-03 -5.0289329141378403e-02 5.8831161260604858e-01 <_> 0 -1 543 -2.9819121118634939e-04 -3.8232401013374329e-01 9.2451132833957672e-02 <_> 0 -1 544 -4.7992770560085773e-03 4.8488789796829224e-01 -7.3136523365974426e-02 <_> 0 -1 545 -3.0155890271998942e-04 -3.5757359862327576e-01 1.0581880062818527e-01 <_> 0 -1 546 1.0390769690275192e-02 5.2920468151569366e-02 -5.7249659299850464e-01 <_> 0 -1 547 -9.4488041941076517e-04 4.4966828823089600e-01 -8.3075523376464844e-02 <_> 0 -1 548 1.2651870492845774e-03 -9.6695438027381897e-02 3.1302270293235779e-01 <_> 0 -1 549 1.7094539478421211e-02 -8.1248976290225983e-02 3.6113831400871277e-01 <_> 0 -1 550 2.5973359588533640e-03 -1.1338350176811218e-01 2.2233949601650238e-01 <_> 0 -1 551 1.4527440071105957e-03 6.9750443100929260e-02 -3.6720710992813110e-01 <_> 0 -1 552 4.7638658434152603e-03 -6.5788961946964264e-02 3.8328540325164795e-01 <_> 0 -1 553 -6.2501081265509129e-03 -7.0754468441009521e-01 3.8350198417901993e-02 <_> 0 -1 554 -3.1765329185873270e-03 1.3755400478839874e-01 -2.3240029811859131e-01 <_> 0 -1 555 3.2191169448196888e-03 -1.2935450673103333e-01 2.2737880051136017e-01 <_> 0 -1 556 -5.6365579366683960e-03 3.8067150115966797e-01 -6.7246839404106140e-02 <_> 0 -1 557 -2.3844049428589642e-04 -3.1122380495071411e-01 8.3838358521461487e-02 <_> 0 -1 558 -4.1017560288310051e-03 2.6067280769348145e-01 -1.0449740290641785e-01 <_> 0 -1 559 1.3336989795789123e-03 -5.8250140398740768e-02 4.7682440280914307e-01 <_> 0 -1 560 -1.2090239906683564e-03 1.4834509789943695e-01 -1.7329469323158264e-01 <_> 72 -1.1188739538192749e+00 <_> 0 -1 561 -3.1760931015014648e-03 3.3333331346511841e-01 -1.6642349958419800e-01 <_> 0 -1 562 2.4858079850673676e-02 -7.2728872299194336e-02 5.6674581766128540e-01 <_> 0 -1 563 -7.7597280032932758e-03 4.6258568763732910e-01 -9.3112178146839142e-02 <_> 0 -1 564 7.8239021822810173e-03 -2.7414610981941223e-01 1.3243049383163452e-01 <_> 0 -1 565 -1.0948839597404003e-02 2.2345480322837830e-01 -1.4965449273586273e-01 <_> 0 -1 566 -3.4349008928984404e-03 3.8724988698959351e-01 -6.6121727228164673e-02 <_> 0 -1 567 -3.1156290322542191e-02 2.4078279733657837e-01 -1.1406909674406052e-01 <_> 0 -1 568 1.1100519914180040e-03 -2.8207978606224060e-01 1.3275429606437683e-01 <_> 0 -1 569 3.1762740109115839e-03 3.4585930407047272e-02 -5.1374310255050659e-01 <_> 0 -1 570 -2.7977459132671356e-02 2.3926779627799988e-01 -1.3255919516086578e-01 <_> 0 -1 571 -2.3097939789295197e-02 3.9019620418548584e-01 -7.8478008508682251e-02 <_> 0 -1 572 -3.9731930010020733e-03 3.0691069364547729e-01 -7.0601403713226318e-02 <_> 0 -1 573 3.0335749033838511e-03 -1.4002190530300140e-01 1.9134859740734100e-01 <_> 0 -1 574 -1.0844370350241661e-02 1.6548730432987213e-01 -1.5657779574394226e-01 <_> 0 -1 575 -1.8150510266423225e-02 -6.3243591785430908e-01 3.9561819285154343e-02 <_> 0 -1 576 7.1052298881113529e-04 -1.8515570461750031e-01 1.3408809900283813e-01 <_> 0 -1 577 1.0893340222537518e-02 -2.6730230078101158e-02 6.0971802473068237e-01 <_> 0 -1 578 -2.8780900174751878e-04 -3.0065140128135681e-01 7.3171459138393402e-02 <_> 0 -1 579 -3.5855069290846586e-03 2.6217609643936157e-01 -7.9714097082614899e-02 <_> 0 -1 580 -1.9759280607104301e-02 -5.9039229154586792e-01 4.0698971599340439e-02 <_> 0 -1 581 -1.0845210403203964e-02 1.6364559531211853e-01 -1.2586060166358948e-01 <_> 0 -1 582 -4.3183090165257454e-03 -5.7474881410598755e-01 3.7644311785697937e-02 <_> 0 -1 583 1.4913700288161635e-03 6.0913469642400742e-02 -3.0222928524017334e-01 <_> 0 -1 584 1.5675699338316917e-02 -7.3145911097526550e-02 2.9379451274871826e-01 <_> 0 -1 585 -1.1033560149371624e-02 3.9318808913230896e-01 -4.7084320336580276e-02 <_> 0 -1 586 8.8555756956338882e-03 3.7601381540298462e-02 -4.9108490347862244e-01 <_> 0 -1 587 -8.9665671112015843e-04 1.7952020466327667e-01 -1.1086239665746689e-01 <_> 0 -1 588 -3.0592409893870354e-03 -4.4429460167884827e-01 5.1005430519580841e-02 <_> 0 -1 589 6.3201179727911949e-03 -5.2841089665889740e-02 3.7197101116180420e-01 <_> 0 -1 590 2.0682830363512039e-02 5.7667169719934464e-02 -3.6901599168777466e-01 <_> 0 -1 591 9.9822662770748138e-02 -3.7377018481492996e-02 5.8165591955184937e-01 <_> 0 -1 592 -6.5854229032993317e-03 2.8509441018104553e-01 -6.0978069901466370e-02 <_> 0 -1 593 -6.0900300741195679e-02 -5.1031768321990967e-01 3.7787400186061859e-02 <_> 0 -1 594 -2.9991709161549807e-03 -4.7943010926246643e-01 3.8833890110254288e-02 <_> 0 -1 595 -9.8906438797712326e-03 4.0609079599380493e-01 -4.7869648784399033e-02 <_> 0 -1 596 -8.2688927650451660e-02 -7.0671182870864868e-01 2.7487749233841896e-02 <_> 0 -1 597 5.0060399807989597e-03 2.8208440169692039e-02 -5.2909690141677856e-01 <_> 0 -1 598 6.1695030890405178e-03 -5.4554861038923264e-02 3.2837980985641479e-01 <_> 0 -1 599 -3.3914761152118444e-03 9.2117667198181152e-02 -2.1637110412120819e-01 <_> 0 -1 600 -2.6131230406463146e-03 1.3651019334793091e-01 -1.3781130313873291e-01 <_> 0 -1 601 8.0490659456700087e-04 -6.8637110292911530e-02 3.3581069111824036e-01 <_> 0 -1 602 -3.8106508553028107e-02 2.9445430636405945e-01 -6.8239226937294006e-02 <_> 0 -1 603 7.2450799052603543e-05 -1.6750130057334900e-01 1.2178230285644531e-01 <_> 0 -1 604 1.5837959945201874e-03 -9.2042848467826843e-02 2.1348990499973297e-01 <_> 0 -1 605 1.2924340553581715e-03 6.2917232513427734e-02 -3.6174508929252625e-01 <_> 0 -1 606 9.9146775901317596e-03 1.9534060731530190e-02 -8.1015038490295410e-01 <_> 0 -1 607 -1.7086310544982553e-03 2.5525239109992981e-01 -6.8229459226131439e-02 <_> 0 -1 608 2.1844399161636829e-03 2.3314049467444420e-02 -8.4296780824661255e-01 <_> 0 -1 609 -3.4244330599904060e-03 2.7213689684867859e-01 -7.6395228505134583e-02 <_> 0 -1 610 2.7591470279730856e-04 -1.0742840170860291e-01 2.2888970375061035e-01 <_> 0 -1 611 -6.0005177510902286e-04 -2.9854211211204529e-01 6.3479736447334290e-02 <_> 0 -1 612 -2.5001438916660845e-04 -2.7178969979286194e-01 6.9615006446838379e-02 <_> 0 -1 613 6.8751391954720020e-03 -5.7185899466276169e-02 3.6695951223373413e-01 <_> 0 -1 614 1.2761900201439857e-02 6.7955687642097473e-02 -2.8534150123596191e-01 <_> 0 -1 615 -1.4752789866179228e-03 2.0680660009384155e-01 -1.0059390217065811e-01 <_> 0 -1 616 1.2138819694519043e-01 -9.7126796841621399e-02 1.9789619743824005e-01 <_> 0 -1 617 -5.0081279128789902e-02 2.8417178988456726e-01 -6.7879997193813324e-02 <_> 0 -1 618 3.1454950571060181e-02 -8.9468672871589661e-02 2.1298420429229736e-01 <_> 0 -1 619 1.8878319533541799e-03 -1.1656440049409866e-01 1.6663520038127899e-01 <_> 0 -1 620 -5.7211960665881634e-03 2.3702140152454376e-01 -9.0776607394218445e-02 <_> 0 -1 621 -1.8076719425152987e-04 1.7951929569244385e-01 -1.0793480277061462e-01 <_> 0 -1 622 -1.9761849939823151e-01 4.5674291253089905e-01 -4.0480159223079681e-02 <_> 0 -1 623 -2.3846809926908463e-04 -2.3733009397983551e-01 7.5922161340713501e-02 <_> 0 -1 624 2.1540730085689574e-04 8.1688016653060913e-02 -2.8685030341148376e-01 <_> 0 -1 625 1.0163090191781521e-02 -4.1250020265579224e-02 4.8038348555564880e-01 <_> 0 -1 626 -7.2184870950877666e-03 1.7458580434322357e-01 -1.0146500170230865e-01 <_> 0 -1 627 2.4263170361518860e-01 5.3426481783390045e-02 -3.2318529486656189e-01 <_> 0 -1 628 6.9304101634770632e-04 -1.1499179899692535e-01 1.4793939888477325e-01 <_> 0 -1 629 3.5475199110805988e-03 -3.9424978196620941e-02 5.3126180171966553e-01 <_> 0 -1 630 2.1403690334409475e-04 6.9753833115100861e-02 -2.7319580316543579e-01 <_> 0 -1 631 -5.7119462871924043e-04 3.4369900822639465e-01 -5.7699009776115417e-02 <_> 0 -1 632 -6.6290069371461868e-03 1.1758489906787872e-01 -1.5020139515399933e-01 <_> 66 -1.0888810157775879e+00 <_> 0 -1 633 -2.6513449847698212e-02 2.0568640530109406e-01 -2.6473900675773621e-01 <_> 0 -1 634 9.7727458924055099e-03 -1.1192840337753296e-01 3.2570549845695496e-01 <_> 0 -1 635 3.2290350645780563e-02 -9.8574757575988770e-02 3.1779170036315918e-01 <_> 0 -1 636 -2.8103240765631199e-03 1.5213899314403534e-01 -1.9686409831047058e-01 <_> 0 -1 637 -1.0991429910063744e-02 5.1407659053802490e-01 -4.3707210570573807e-02 <_> 0 -1 638 6.3133831135928631e-03 -9.2781022191047668e-02 3.4702470898628235e-01 <_> 0 -1 639 8.7105982005596161e-02 3.0053649097681046e-02 -8.2814818620681763e-01 <_> 0 -1 640 1.1799359926953912e-03 -1.2928420305252075e-01 2.0646120607852936e-01 <_> 0 -1 641 -9.3056890182197094e-04 -5.0021439790725708e-01 9.3666993081569672e-02 <_> 0 -1 642 -1.3687170110642910e-02 -7.9358148574829102e-01 -6.6733639687299728e-03 <_> 0 -1 643 -7.5917452573776245e-02 3.0469641089439392e-01 -7.9655893146991730e-02 <_> 0 -1 644 -2.8559709899127483e-03 2.0961460471153259e-01 -1.2732550501823425e-01 <_> 0 -1 645 -4.0231510065495968e-03 -6.5817278623580933e-01 5.0683639943599701e-02 <_> 0 -1 646 1.7558040097355843e-02 -8.5382692515850067e-02 3.6174559593200684e-01 <_> 0 -1 647 2.1988239139318466e-02 6.2943696975708008e-02 -7.0896339416503906e-01 <_> 0 -1 648 -2.8599589131772518e-03 1.4683780074119568e-01 -1.6465979814529419e-01 <_> 0 -1 649 -1.0030849836766720e-02 4.9579939246177673e-01 -2.7188340201973915e-02 <_> 0 -1 650 -6.9560329429805279e-03 2.7977779507637024e-01 -7.7953331172466278e-02 <_> 0 -1 651 -3.8356808945536613e-03 -5.8163982629776001e-01 3.5739939659833908e-02 <_> 0 -1 652 -3.2647319603711367e-03 -4.9945080280303955e-01 4.6986490488052368e-02 <_> 0 -1 653 -7.8412350267171860e-03 3.4532830119132996e-01 -6.8810403347015381e-02 <_> 0 -1 654 -8.1718113506212831e-05 1.5041710436344147e-01 -1.4146679639816284e-01 <_> 0 -1 655 -3.2448628917336464e-03 2.2724510729312897e-01 -9.2860206961631775e-02 <_> 0 -1 656 -7.8561151167377830e-04 -4.4319018721580505e-01 5.7812441140413284e-02 <_> 0 -1 657 -6.2474247533828020e-04 1.3952389359474182e-01 -1.4668719470500946e-01 <_> 0 -1 658 -3.2942948746494949e-04 -2.9901570081710815e-01 7.6066739857196808e-02 <_> 0 -1 659 1.2605739757418633e-03 -1.6125600039958954e-01 1.3953800499439240e-01 <_> 0 -1 660 -5.1667019724845886e-02 -5.3142839670181274e-01 4.0719520300626755e-02 <_> 0 -1 661 -1.5285619534552097e-02 -7.8206378221511841e-01 2.7183769270777702e-02 <_> 0 -1 662 6.9029822945594788e-02 -3.6427021026611328e-02 7.1102517843246460e-01 <_> 0 -1 663 1.4522749697789550e-03 -9.6890516579151154e-02 2.1668420732021332e-01 <_> 0 -1 664 -2.4765590205788612e-03 1.1645310372114182e-01 -1.8227979540824890e-01 <_> 0 -1 665 -1.5134819550439715e-03 1.7863979935646057e-01 -1.2214969843626022e-01 <_> 0 -1 666 -1.5099470037966967e-03 1.8086239695549011e-01 -1.1446069926023483e-01 <_> 0 -1 667 -6.7054620012640953e-03 2.5106599926948547e-01 -9.1871462762355804e-02 <_> 0 -1 668 -1.4075200073421001e-02 1.3707509636878967e-01 -1.7333500087261200e-01 <_> 0 -1 669 -2.2400720044970512e-03 4.0092980861663818e-01 -4.7576878219842911e-02 <_> 0 -1 670 1.9782369956374168e-02 -1.9040350615978241e-01 1.4923410117626190e-01 <_> 0 -1 671 2.6002870872616768e-03 4.6971768140792847e-02 -4.3307659029960632e-01 <_> 0 -1 672 -5.3445628145709634e-04 -4.3744230270385742e-01 4.1520189493894577e-02 <_> 0 -1 673 -1.7466509714722633e-02 6.5818172693252563e-01 -3.4447491168975830e-02 <_> 0 -1 674 -2.0425589755177498e-03 3.9657929539680481e-01 -4.4052429497241974e-02 <_> 0 -1 675 2.6661779265850782e-03 5.8770958334207535e-02 -3.2806369662284851e-01 <_> 0 -1 676 -5.5982369929552078e-02 -5.1735472679138184e-01 3.5791840404272079e-02 <_> 0 -1 677 -1.5066330088302493e-03 1.5123869478702545e-01 -1.2520180642604828e-01 <_> 0 -1 678 -1.1472369544208050e-02 -6.2930530309677124e-01 3.4704331308603287e-02 <_> 0 -1 679 2.3409629240632057e-02 -5.8063350617885590e-02 3.8668221235275269e-01 <_> 0 -1 680 -2.3243729956448078e-03 1.8754099309444427e-01 -9.8394669592380524e-02 <_> 0 -1 681 -2.9039299115538597e-02 -5.4486900568008423e-01 4.0926340967416763e-02 <_> 0 -1 682 -1.4474649913609028e-02 -6.7248392105102539e-01 2.3128850385546684e-02 <_> 0 -1 683 -5.2086091600358486e-03 -4.3271440267562866e-01 4.3780650943517685e-02 <_> 0 -1 684 4.9382899887859821e-03 -1.0878620296716690e-01 1.9342589378356934e-01 <_> 0 -1 685 -4.3193930760025978e-03 2.4080930650234222e-01 -1.0380800068378448e-01 <_> 0 -1 686 2.3705669445917010e-04 -8.7349072098731995e-02 2.0466239750385284e-01 <_> 0 -1 687 4.7858079778961837e-04 4.5624580234289169e-02 -3.8854670524597168e-01 <_> 0 -1 688 -8.5342838428914547e-04 -5.5077940225601196e-01 3.5825889557600021e-02 <_> 0 -1 689 5.4772121075075120e-05 -1.1225239932537079e-01 1.7503519356250763e-01 <_> 0 -1 690 -3.8445889949798584e-03 2.4526700377464294e-01 -8.1132568418979645e-02 <_> 0 -1 691 -4.0128458291292191e-02 -6.3122707605361938e-01 2.6972670108079910e-02 <_> 0 -1 692 -1.7886360001284629e-04 1.9855099916458130e-01 -1.0333680361509323e-01 <_> 0 -1 693 1.7668239888735116e-04 -9.1359011828899384e-02 1.9848720729351044e-01 <_> 0 -1 694 7.2763383388519287e-02 5.0075579434633255e-02 -3.3852630853652954e-01 <_> 0 -1 695 1.0181630030274391e-02 -9.3229979276657104e-02 2.0059590041637421e-01 <_> 0 -1 696 2.4409969337284565e-03 6.4636632800102234e-02 -2.6921740174293518e-01 <_> 0 -1 697 -3.6227488890290260e-03 1.3169890642166138e-01 -1.2514840066432953e-01 <_> 0 -1 698 -1.3635610230267048e-03 1.6350460052490234e-01 -1.0665939748287201e-01 <_> 69 -1.0408929586410522e+00 <_> 0 -1 699 -9.6991164609789848e-03 6.1125320196151733e-01 -6.6225312650203705e-02 <_> 0 -1 700 -9.6426531672477722e-03 -1. 2.7699959464371204e-03 <_> 0 -1 701 -9.6381865441799164e-03 1. -2.9904270195402205e-04 <_> 0 -1 702 -4.2553939856588840e-03 2.8464388847351074e-01 -1.5540120005607605e-01 <_> 0 -1 703 -9.6223521977663040e-03 -1. 4.3999180197715759e-02 <_> 0 -1 704 -9.1231241822242737e-03 8.6869341135025024e-01 -2.7267890982329845e-03 <_> 0 -1 705 -8.6240433156490326e-03 4.5352488756179810e-01 -8.6071379482746124e-02 <_> 0 -1 706 -8.9324144646525383e-03 1.3375559449195862e-01 -2.6012519001960754e-01 <_> 0 -1 707 -1.4207810163497925e-02 3.2077640295028687e-01 -9.7226411104202271e-02 <_> 0 -1 708 2.5911010801792145e-02 -1.2964080274105072e-01 2.6218649744987488e-01 <_> 0 -1 709 2.0531509653665125e-04 -1.2404280155897141e-01 2.1062959730625153e-01 <_> 0 -1 710 -5.4795680625829846e-05 1.1974299699068069e-01 -2.3201279342174530e-01 <_> 0 -1 711 6.8555199541151524e-03 -6.3276126980781555e-02 4.1044250130653381e-01 <_> 0 -1 712 -1.2253040447831154e-02 5.4883331060409546e-01 -3.9731100201606750e-02 <_> 0 -1 713 -3.9058770053088665e-03 2.4190980195999146e-01 -9.7096011042594910e-02 <_> 0 -1 714 2.7560980524867773e-03 -1.2569679319858551e-01 1.9456650316715240e-01 <_> 0 -1 715 -7.7662160620093346e-03 2.9765701293945312e-01 -9.6818156540393829e-02 <_> 0 -1 716 3.8997188676148653e-04 6.2188401818275452e-02 -4.2040899395942688e-01 <_> 0 -1 717 3.3579880837351084e-03 4.7498140484094620e-02 -6.3216882944107056e-01 <_> 0 -1 718 -1.6745539382100105e-02 7.1098130941390991e-01 -3.9157349616289139e-02 <_> 0 -1 719 -6.5409899689257145e-03 -3.5043171048164368e-01 7.0616953074932098e-02 <_> 0 -1 720 3.0016340315341949e-04 9.1902457177639008e-02 -2.4618670344352722e-01 <_> 0 -1 721 1.4918990433216095e-02 -5.1909450441598892e-02 5.6636041402816772e-01 <_> 0 -1 722 4.8153079114854336e-04 6.4659558236598969e-02 -3.6590608954429626e-01 <_> 0 -1 723 -3.0211321427486837e-04 1.7926569283008575e-01 -1.1410660296678543e-01 <_> 0 -1 724 3.8521419628523290e-04 1.0345619916915894e-01 -2.0072460174560547e-01 <_> 0 -1 725 8.0837132409214973e-03 -6.6073462367057800e-02 3.0284249782562256e-01 <_> 0 -1 726 -2.2804969921708107e-02 5.2962350845336914e-01 -4.0118999779224396e-02 <_> 0 -1 727 1.9440450705587864e-04 8.1854820251464844e-02 -2.4663360416889191e-01 <_> 0 -1 728 -1.2848090380430222e-02 -3.4973311424255371e-01 5.6916229426860809e-02 <_> 0 -1 729 -1.0937290498986840e-03 2.3368680477142334e-01 -9.1604806482791901e-02 <_> 0 -1 730 1.0032650316134095e-03 1.1852180212736130e-01 -1.8469190597534180e-01 <_> 0 -1 731 -4.4688429683446884e-02 -6.4362460374832153e-01 3.0363269150257111e-02 <_> 0 -1 732 8.1657543778419495e-03 4.3674658983945847e-02 -4.3002089858055115e-01 <_> 0 -1 733 -1.1717810295522213e-02 4.1781479120254517e-01 -4.8233699053525925e-02 <_> 0 -1 734 8.4277130663394928e-02 5.3461279720067978e-02 -3.7952190637588501e-01 <_> 0 -1 735 1.4211839996278286e-02 4.4900938868522644e-02 -4.2981499433517456e-01 <_> 0 -1 736 1.5028340276330709e-03 8.2227639853954315e-02 -2.4706399440765381e-01 <_> 0 -1 737 1.0003579780459404e-02 -5.7221669703722000e-02 3.4609371423721313e-01 <_> 0 -1 738 -9.0706320479512215e-03 4.5058089494705200e-01 -4.2795319110155106e-02 <_> 0 -1 739 -3.3141620224341750e-04 1.8336910009384155e-01 -1.0759949684143066e-01 <_> 0 -1 740 1.9723279774188995e-01 -3.0363829806447029e-02 6.6423428058624268e-01 <_> 0 -1 741 -7.1258801035583019e-03 -8.9225047826766968e-01 2.5669990107417107e-02 <_> 0 -1 742 8.6921341717243195e-03 -7.0764370262622833e-02 2.8210529685020447e-01 <_> 0 -1 743 8.9262127876281738e-03 7.1078233420848846e-02 -3.0232560634613037e-01 <_> 0 -1 744 5.7286009192466736e-02 5.0974130630493164e-02 -3.9196950197219849e-01 <_> 0 -1 745 3.7920880131423473e-03 3.3841941505670547e-02 -5.1016288995742798e-01 <_> 0 -1 746 -1.4508679741993546e-03 3.0879148840904236e-01 -6.3845083117485046e-02 <_> 0 -1 747 9.8390132188796997e-04 -1.3029569387435913e-01 1.4604410529136658e-01 <_> 0 -1 748 -1.7221809830516577e-03 2.9157009720802307e-01 -6.8549558520317078e-02 <_> 0 -1 749 1.0948250070214272e-02 3.4351408481597900e-02 -4.7702258825302124e-01 <_> 0 -1 750 -1.7176309484057128e-05 1.6055269539356232e-01 -1.1690840125083923e-01 <_> 0 -1 751 -5.4884208366274834e-03 -4.3415889143943787e-01 4.6106241643428802e-02 <_> 0 -1 752 -3.0975250992923975e-03 3.7943339347839355e-01 -5.6860551238059998e-02 <_> 0 -1 753 6.4182081259787083e-03 -1.5858210623264313e-01 1.2335419654846191e-01 <_> 0 -1 754 1.1831239797174931e-02 -4.0929291397333145e-02 4.5878958702087402e-01 <_> 0 -1 755 1.3540499843657017e-02 -5.3725559264421463e-02 3.5056120157241821e-01 <_> 0 -1 756 -2.5932150892913342e-03 1.1010520160198212e-01 -1.6752210259437561e-01 <_> 0 -1 757 1.6856270376592875e-03 6.6574357450008392e-02 -3.0835020542144775e-01 <_> 0 -1 758 2.6524690911173820e-03 6.6318482160568237e-02 -2.7861338853836060e-01 <_> 0 -1 759 -7.7341729775071144e-03 1.9718359410762787e-01 -1.0782919824123383e-01 <_> 0 -1 760 5.0944271497428417e-03 8.5337489843368530e-02 -2.4847009778022766e-01 <_> 0 -1 761 -2.9162371065467596e-03 -4.7476351261138916e-01 3.3566489815711975e-02 <_> 0 -1 762 3.0121419113129377e-03 -4.7575380653142929e-02 4.2586800456047058e-01 <_> 0 -1 763 3.1694869976490736e-03 -1.0519450157880783e-01 1.7163459956645966e-01 <_> 0 -1 764 2.2327560186386108e-01 -1.4370209537446499e-02 9.2483651638031006e-01 <_> 0 -1 765 -9.5585048198699951e-02 -7.4206638336181641e-01 2.7818970382213593e-02 <_> 0 -1 766 3.4773729566950351e-05 -1.2765780091285706e-01 1.2926669418811798e-01 <_> 0 -1 767 7.2459770308341831e-05 -1.6518579423427582e-01 1.0036809742450714e-01 <_> 59 -1.0566600561141968e+00 <_> 0 -1 768 -6.5778270363807678e-03 3.3815258741378784e-01 -1.5281909704208374e-01 <_> 0 -1 769 -1.0922809597104788e-03 2.2282369434833527e-01 -1.9308499991893768e-01 <_> 0 -1 770 -2.9759589582681656e-02 2.5959870219230652e-01 -1.5409409999847412e-01 <_> 0 -1 771 -1.3147540390491486e-02 1.9033810496330261e-01 -1.6543999314308167e-01 <_> 0 -1 772 -1.4396329643204808e-03 2.0071710646152496e-01 -1.2338940054178238e-01 <_> 0 -1 773 -3.5928250290453434e-03 2.3985520005226135e-01 -1.2922149896621704e-01 <_> 0 -1 774 -1.5314699849113822e-03 -4.9014899134635925e-01 1.0275030136108398e-01 <_> 0 -1 775 -6.2372139655053616e-03 3.1214639544487000e-01 -1.1405629664659500e-01 <_> 0 -1 776 -3.3364649862051010e-02 -4.9520879983901978e-01 5.1328450441360474e-02 <_> 0 -1 777 -2.2827699780464172e-02 3.2558828592300415e-01 -6.5089307725429535e-02 <_> 0 -1 778 -8.6199097335338593e-02 -6.7646330595016479e-01 2.6985699310898781e-02 <_> 0 -1 779 -2.1065981127321720e-03 2.2452430427074432e-01 -1.2610229849815369e-01 <_> 0 -1 780 3.9120148867368698e-02 1.1329399794340134e-01 -2.6860630512237549e-01 <_> 0 -1 781 3.5082739777863026e-03 -1.1359959840774536e-01 2.5649771094322205e-01 <_> 0 -1 782 5.9289898490533233e-04 -1.4942969381809235e-01 1.6409839689731598e-01 <_> 0 -1 783 7.1766850305721164e-04 9.9905692040920258e-02 -2.1967969834804535e-01 <_> 0 -1 784 -2.1803600713610649e-02 -3.1711721420288086e-01 8.2889586687088013e-02 <_> 0 -1 785 -3.2962779514491558e-03 -3.8048729300498962e-01 6.0819379985332489e-02 <_> 0 -1 786 2.4196270387619734e-03 -9.6013016998767853e-02 2.8540581464767456e-01 <_> 0 -1 787 -4.4187481398694217e-04 2.2127939760684967e-01 -9.7434908151626587e-02 <_> 0 -1 788 3.4523929934948683e-03 3.7553120404481888e-02 -5.7969051599502563e-01 <_> 0 -1 789 -2.1834600716829300e-02 2.9562139511108398e-01 -8.0048300325870514e-02 <_> 0 -1 790 -2.1309500152710825e-04 2.2814509272575378e-01 -1.0114189982414246e-01 <_> 0 -1 791 -1.6166249988600612e-03 -5.0541198253631592e-01 4.4764541089534760e-02 <_> 0 -1 792 7.5959609821438789e-03 4.5986540615558624e-02 -4.1197681427001953e-01 <_> 0 -1 793 3.8601809646934271e-03 -8.6563169956207275e-02 2.4809999763965607e-01 <_> 0 -1 794 6.0622231103479862e-03 -7.5557373464107513e-02 2.8433260321617126e-01 <_> 0 -1 795 -1.7097420059144497e-03 -3.5295820236206055e-01 5.8410499244928360e-02 <_> 0 -1 796 1.6515579074621201e-02 -8.0486953258514404e-02 2.3537430167198181e-01 <_> 0 -1 797 4.8465100117027760e-03 4.1895218193531036e-02 -4.8443049192428589e-01 <_> 0 -1 798 -3.1167170032858849e-02 1.9192309677600861e-01 -1.0268159955739975e-01 <_> 0 -1 799 6.1892281519249082e-04 -2.1085770428180695e-01 9.3886926770210266e-02 <_> 0 -1 800 1.1946310289204121e-02 3.9096169173717499e-02 -6.2248629331588745e-01 <_> 0 -1 801 -7.5677200220525265e-03 1.5936839580535889e-01 -1.2250780314207077e-01 <_> 0 -1 802 -5.3747411817312241e-02 -5.5622178316116333e-01 4.1190009564161301e-02 <_> 0 -1 803 1.5513530001044273e-02 -3.9826881140470505e-02 6.2400728464126587e-01 <_> 0 -1 804 1.5246650436893106e-03 7.0138677954673767e-02 -3.0789071321487427e-01 <_> 0 -1 805 -4.8315100139006972e-04 1.7887659370899200e-01 -1.0958620160818100e-01 <_> 0 -1 806 2.7374739293009043e-03 2.7478590607643127e-02 -8.8489568233489990e-01 <_> 0 -1 807 -6.5787717700004578e-02 -4.6432140469551086e-01 3.5037148743867874e-02 <_> 0 -1 808 1.2409730115905404e-03 -9.6479237079620361e-02 2.8779220581054688e-01 <_> 0 -1 809 8.1398809561505914e-04 1.1511719971895218e-01 -1.6766160726547241e-01 <_> 0 -1 810 2.3901820182800293e-02 -3.2603189349174500e-02 6.0017347335815430e-01 <_> 0 -1 811 2.7556600049138069e-02 -6.6137343645095825e-02 2.9994478821754456e-01 <_> 0 -1 812 -3.8070970913395286e-04 -3.3881181478500366e-01 6.4450770616531372e-02 <_> 0 -1 813 -1.3335429830476642e-03 1.4588660001754761e-01 -1.3217620551586151e-01 <_> 0 -1 814 -9.3507990241050720e-03 -5.1177829504013062e-01 3.4969471395015717e-02 <_> 0 -1 815 7.6215229928493500e-03 2.3249529302120209e-02 -6.9619411230087280e-01 <_> 0 -1 816 -5.3407860832521692e-05 2.3727379739284515e-01 -8.6910709738731384e-02 <_> 0 -1 817 -1.5332329785451293e-03 1.9228410720825195e-01 -1.0422399640083313e-01 <_> 0 -1 818 4.3135890737175941e-03 -9.6219547092914581e-02 2.5601211190223694e-01 <_> 0 -1 819 -2.3042880638968199e-04 -3.1564751267433167e-01 5.8838598430156708e-02 <_> 0 -1 820 -7.8411828726530075e-03 -6.6340929269790649e-01 2.4500999599695206e-02 <_> 0 -1 821 1.7103740572929382e-01 3.3831499516963959e-02 -4.5615941286087036e-01 <_> 0 -1 822 -1.6011140542104840e-03 2.1574890613555908e-01 -8.3622530102729797e-02 <_> 0 -1 823 -1.0535780340433121e-02 2.4552319943904877e-01 -8.2384489476680756e-02 <_> 0 -1 824 -5.8351638726890087e-03 -4.7807329893112183e-01 4.4086221605539322e-02 <_> 0 -1 825 -1.8706109374761581e-02 -6.0024029016494751e-01 2.1410040557384491e-02 <_> 0 -1 826 -9.3307439237833023e-04 2.4323590099811554e-01 -7.4165716767311096e-02 <_> 88 -9.7693431377410889e-01 <_> 0 -1 827 1.0646229609847069e-02 -1.3861389458179474e-01 2.6494070887565613e-01 <_> 0 -1 828 3.5298269242048264e-02 -7.5821727514266968e-02 3.9021068811416626e-01 <_> 0 -1 829 7.5638387352228165e-04 -9.5521442592144012e-02 2.9061999917030334e-01 <_> 0 -1 830 9.2497706413269043e-02 -2.7704238891601562e-01 7.9474702477455139e-02 <_> 0 -1 831 -2.9340879991650581e-03 2.2989539802074432e-01 -7.8550010919570923e-02 <_> 0 -1 832 -8.6535848677158356e-02 4.7744810581207275e-01 -6.8231220357120037e-03 <_> 0 -1 833 5.4699288739357144e-05 -2.2642609477043152e-01 8.8192112743854523e-02 <_> 0 -1 834 -3.6592520773410797e-02 2.7353870868682861e-01 -9.8606742918491364e-02 <_> 0 -1 835 2.6469118893146515e-03 -4.4083978980779648e-02 3.1445288658142090e-01 <_> 0 -1 836 -4.4271810911595821e-03 2.3822729289531708e-01 -8.6784273386001587e-02 <_> 0 -1 837 -5.1882481202483177e-03 1.5042769908905029e-01 -1.2672109901905060e-01 <_> 0 -1 838 4.5530400238931179e-03 -5.5945020169019699e-02 3.6501631140708923e-01 <_> 0 -1 839 1.4562410302460194e-02 3.6397770047187805e-02 -5.3559190034866333e-01 <_> 0 -1 840 6.8677567469421774e-05 -1.7479629814624786e-01 1.1068709939718246e-01 <_> 0 -1 841 -5.9744901955127716e-03 3.1077870726585388e-01 -6.6530227661132812e-02 <_> 0 -1 842 -5.8691250160336494e-03 -3.1901490688323975e-01 6.3931830227375031e-02 <_> 0 -1 843 -1.1140310205519199e-02 2.4364790320396423e-01 -8.0935180187225342e-02 <_> 0 -1 844 -5.8643531054258347e-02 -7.6083260774612427e-01 3.0809629708528519e-02 <_> 0 -1 845 -4.6097282320261002e-03 -4.5315021276473999e-01 2.9879059642553329e-02 <_> 0 -1 846 -9.3032103031873703e-03 1.4513379335403442e-01 -1.1033169925212860e-01 <_> 0 -1 847 1.3253629440441728e-03 -9.7698956727981567e-02 1.9646440446376801e-01 <_> 0 -1 848 4.9800761044025421e-03 3.3648081123828888e-02 -3.9792209863662720e-01 <_> 0 -1 849 -7.6542161405086517e-03 9.0841993689537048e-02 -1.5967549383640289e-01 <_> 0 -1 850 -3.8920590281486511e-01 -6.6571092605590820e-01 1.9028829410672188e-02 <_> 0 -1 851 -1.0019669681787491e-01 -5.7559269666671753e-01 2.4282779544591904e-02 <_> 0 -1 852 7.3541211895644665e-04 8.7919801473617554e-02 -1.6195340454578400e-01 <_> 0 -1 853 -3.4802639856934547e-03 2.6064491271972656e-01 -6.0200810432434082e-02 <_> 0 -1 854 8.4000425413250923e-03 -1.0979729890823364e-01 1.5707309544086456e-01 <_> 0 -1 855 2.3786011151969433e-03 3.6058239638805389e-02 -4.7277191281318665e-01 <_> 0 -1 856 7.3831682093441486e-03 -3.5756360739469528e-02 4.9498590826988220e-01 <_> 0 -1 857 3.2115620560944080e-03 -1.0125560313463211e-01 1.5747989714145660e-01 <_> 0 -1 858 -7.8209668397903442e-02 -7.6627081632614136e-01 2.2965829819440842e-02 <_> 0 -1 859 5.3303989261621609e-05 -1.3414350152015686e-01 1.1114919930696487e-01 <_> 0 -1 860 -9.6419155597686768e-03 2.5068029761314392e-01 -6.6608138382434845e-02 <_> 0 -1 861 -7.1092672646045685e-02 -4.0056818723678589e-01 4.0297791361808777e-02 <_> 0 -1 862 3.5171560011804104e-04 4.1861180216073990e-02 -3.2961198687553406e-01 <_> 0 -1 863 -3.3458150574006140e-04 -2.6029831171035767e-01 6.7892737686634064e-02 <_> 0 -1 864 -4.1451421566307545e-03 2.3967699706554413e-01 -7.2093337774276733e-02 <_> 0 -1 865 3.1754500232636929e-03 -7.1235269308090210e-02 2.4128450453281403e-01 <_> 0 -1 866 -5.5184490047395229e-03 5.0320237874984741e-01 -2.9686680063605309e-02 <_> 0 -1 867 -3.0242869979701936e-04 2.4879050254821777e-01 -5.6758578866720200e-02 <_> 0 -1 868 -1.3125919504091144e-03 3.1747800111770630e-01 -4.1845861822366714e-02 <_> 0 -1 869 -2.7123570907860994e-04 -2.7042070031166077e-01 5.6828990578651428e-02 <_> 0 -1 870 -7.3241777718067169e-03 2.7556678652763367e-01 -5.4252970963716507e-02 <_> 0 -1 871 -1.6851710155606270e-02 -3.4852910041809082e-01 4.5368999242782593e-02 <_> 0 -1 872 2.9902100563049316e-02 3.1621079891920090e-02 -4.3114370107650757e-01 <_> 0 -1 873 2.8902660124003887e-03 3.8029961287975311e-02 -3.7027099728584290e-01 <_> 0 -1 874 -1.9242949783802032e-03 2.4800279736518860e-01 -5.9333298355340958e-02 <_> 0 -1 875 4.9354149959981441e-03 -8.3068400621414185e-02 2.2043809294700623e-01 <_> 0 -1 876 8.2075603306293488e-02 -1.9413439556956291e-02 6.9089287519454956e-01 <_> 0 -1 877 -2.4699489586055279e-04 -2.4660569429397583e-01 6.4776450395584106e-02 <_> 0 -1 878 -1.8365769647061825e-03 2.8836160898208618e-01 -5.3390458226203918e-02 <_> 0 -1 879 -4.9553811550140381e-03 1.2740829586982727e-01 -1.2559419870376587e-01 <_> 0 -1 880 -8.3086621016263962e-03 2.3478110134601593e-01 -7.1676492691040039e-02 <_> 0 -1 881 -1.0879919677972794e-01 -2.5992238521575928e-01 5.8689739555120468e-02 <_> 0 -1 882 -9.6786450594663620e-03 -7.0720428228378296e-01 1.8749259412288666e-02 <_> 0 -1 883 -2.7136830613017082e-02 -5.8384227752685547e-01 2.1684130653738976e-02 <_> 0 -1 884 -6.5389778465032578e-03 -5.9748911857604980e-01 2.1480310708284378e-02 <_> 0 -1 885 -1.2095630168914795e-02 1.3269039988517761e-01 -9.9722720682621002e-02 <_> 0 -1 886 -1.6776099801063538e-01 -5.6655067205429077e-01 3.2123088836669922e-02 <_> 0 -1 887 -1.3262550346553326e-02 1.1495590209960938e-01 -1.1738389730453491e-01 <_> 0 -1 888 7.6744519174098969e-02 -3.1413231045007706e-02 5.9935492277145386e-01 <_> 0 -1 889 5.0785229541361332e-03 -5.2911940962076187e-02 2.3342399299144745e-01 <_> 0 -1 890 3.1800279393792152e-03 -7.7734388411045074e-02 1.7652909457683563e-01 <_> 0 -1 891 -1.7729829996824265e-03 1.9591629505157471e-01 -7.9752199351787567e-02 <_> 0 -1 892 -4.8560940194875002e-04 -2.8800371289253235e-01 4.9047119915485382e-02 <_> 0 -1 893 3.6554320831783116e-04 6.7922897636890411e-02 -2.2499430179595947e-01 <_> 0 -1 894 -2.6938671362586319e-04 1.6582170128822327e-01 -8.9744098484516144e-02 <_> 0 -1 895 7.8684233129024506e-02 2.6081679388880730e-02 -5.5693739652633667e-01 <_> 0 -1 896 -7.3774810880422592e-04 1.4036870002746582e-01 -1.1800300329923630e-01 <_> 0 -1 897 2.3957829922437668e-02 3.0470740050077438e-02 -4.6159979701042175e-01 <_> 0 -1 898 -1.6239080578088760e-03 2.6327079534530640e-01 -5.6765370070934296e-02 <_> 0 -1 899 -9.0819748584181070e-04 1.5462459623813629e-01 -1.1087069660425186e-01 <_> 0 -1 900 3.9806248969398439e-04 5.5630370974540710e-02 -2.8331959247589111e-01 <_> 0 -1 901 2.0506449509412050e-03 -9.1604836285114288e-02 1.7585539817810059e-01 <_> 0 -1 902 2.6742549613118172e-02 6.2003031373023987e-02 -2.4487000703811646e-01 <_> 0 -1 903 -2.1497008856385946e-03 2.9449298977851868e-01 -5.3218148648738861e-02 <_> 0 -1 904 5.6671658530831337e-03 -6.4298242330551147e-02 2.4905680119991302e-01 <_> 0 -1 905 6.8317902332637459e-05 -1.6819630563259125e-01 9.6548579633235931e-02 <_> 0 -1 906 1.7600439605303109e-04 6.5308012068271637e-02 -2.4267880618572235e-01 <_> 0 -1 907 4.1861608624458313e-03 -9.7988583147525787e-02 1.8052889406681061e-01 <_> 0 -1 908 -2.1808340679854155e-03 1.9231270253658295e-01 -9.4123929738998413e-02 <_> 0 -1 909 2.1730400621891022e-02 3.5578511655330658e-02 -4.5088538527488708e-01 <_> 0 -1 910 -1.4780269935727119e-02 -4.3927010893821716e-01 3.1735591590404510e-02 <_> 0 -1 911 -3.6145891062915325e-03 1.9811479747295380e-01 -7.7701419591903687e-02 <_> 0 -1 912 1.8892709631472826e-03 1.9962439313530922e-02 -7.2041720151901245e-01 <_> 0 -1 913 -1.3822480104863644e-03 9.8466947674751282e-02 -1.4881080389022827e-01 <_> 0 -1 914 -3.9505911991000175e-03 1.1593230068683624e-01 -1.2791970372200012e-01 <_> 58 -1.0129359960556030e+00 <_> 0 -1 915 -1.9395539537072182e-02 4.7474750876426697e-01 -1.1721090227365494e-01 <_> 0 -1 916 1.3118919916450977e-02 -2.5552129745483398e-01 1.6378800570964813e-01 <_> 0 -1 917 -5.1606801571324468e-04 1.9452619552612305e-01 -1.7448890209197998e-01 <_> 0 -1 918 -1.3184159994125366e-02 4.4181451201438904e-01 -9.0048752725124359e-02 <_> 0 -1 919 3.4657081123441458e-03 -1.3477090001106262e-01 1.8056340515613556e-01 <_> 0 -1 920 6.2980200164020061e-03 -5.4164979606866837e-02 3.6033380031585693e-01 <_> 0 -1 921 1.6879989998415112e-03 -1.9997949898242950e-01 1.2021599709987640e-01 <_> 0 -1 922 3.6039709812030196e-04 1.0524140298366547e-01 -2.4116060137748718e-01 <_> 0 -1 923 -1.5276849735528231e-03 2.8135529160499573e-01 -6.8964816629886627e-02 <_> 0 -1 924 3.5033570602536201e-03 -8.2519583404064178e-02 4.0713590383529663e-01 <_> 0 -1 925 -4.7337161377072334e-03 1.9727009534835815e-01 -1.1710140109062195e-01 <_> 0 -1 926 -1.1557149700820446e-02 -5.6061112880706787e-01 6.8170957267284393e-02 <_> 0 -1 927 -2.7445720508694649e-02 4.9718621373176575e-01 -6.2380149960517883e-02 <_> 0 -1 928 -5.2825778722763062e-02 1.6921220719814301e-01 -1.3093550503253937e-01 <_> 0 -1 929 -2.9849699139595032e-01 -6.4649671316146851e-01 4.0076818317174911e-02 <_> 0 -1 930 -2.6307269581593573e-04 2.5127941370010376e-01 -8.9494839310646057e-02 <_> 0 -1 931 2.3261709429789335e-04 -8.6843989789485931e-02 2.3831979930400848e-01 <_> 0 -1 932 2.3631360090803355e-04 1.1554460227489471e-01 -1.8936349451541901e-01 <_> 0 -1 933 2.0742209162563086e-03 -4.8594851046800613e-02 5.7485991716384888e-01 <_> 0 -1 934 -7.0308889262378216e-03 -5.4120808839797974e-01 4.8743750900030136e-02 <_> 0 -1 935 8.2652270793914795e-03 2.6494519785046577e-02 -6.1728459596633911e-01 <_> 0 -1 936 2.0042760297656059e-04 -1.1768630146980286e-01 1.6333860158920288e-01 <_> 0 -1 937 1.6470040427520871e-03 -5.9954918920993805e-02 3.5179701447486877e-01 <_> 0 -1 938 -3.5642538568936288e-04 -3.4420299530029297e-01 6.4948253333568573e-02 <_> 0 -1 939 -3.0935870483517647e-02 1.9979700446128845e-01 -9.7693696618080139e-02 <_> 0 -1 940 -6.3578772824257612e-04 -3.1481391191482544e-01 5.9425041079521179e-02 <_> 0 -1 941 -1.1862180195748806e-02 2.0043690502643585e-01 -8.9447543025016785e-02 <_> 0 -1 942 7.1508930996060371e-03 -3.9006061851978302e-02 5.3327161073684692e-01 <_> 0 -1 943 -2.0059191156178713e-03 -2.8469720482826233e-01 7.0723608136177063e-02 <_> 0 -1 944 3.6412389017641544e-03 -1.0660319775342941e-01 2.4944800138473511e-01 <_> 0 -1 945 -1.3467429578304291e-01 4.9910080432891846e-01 -4.0332220494747162e-02 <_> 0 -1 946 -2.2547659464180470e-03 1.6851690411567688e-01 -1.1119280010461807e-01 <_> 0 -1 947 4.3842289596796036e-03 8.6139492690563202e-02 -2.7431771159172058e-01 <_> 0 -1 948 -7.3361168615520000e-03 2.4875210225582123e-01 -9.5919162034988403e-02 <_> 0 -1 949 6.4666912658140063e-04 6.7431576550006866e-02 -3.3754080533981323e-01 <_> 0 -1 950 2.2983769304119051e-04 -8.3903051912784576e-02 2.4584099650382996e-01 <_> 0 -1 951 6.7039071582257748e-03 2.9079329222440720e-02 -6.9055938720703125e-01 <_> 0 -1 952 5.0734888645820320e-05 -1.5696719288825989e-01 1.1965429782867432e-01 <_> 0 -1 953 -2.0335559546947479e-01 -6.9506347179412842e-01 2.7507519349455833e-02 <_> 0 -1 954 9.4939414411783218e-03 -8.7449371814727783e-02 2.3968330025672913e-01 <_> 0 -1 955 -2.4055240210145712e-03 2.1150960028171539e-01 -1.3148930668830872e-01 <_> 0 -1 956 -1.1342419747961685e-04 1.5233789384365082e-01 -1.2725900113582611e-01 <_> 0 -1 957 1.4992210082709789e-02 -3.4127969294786453e-02 5.0624072551727295e-01 <_> 0 -1 958 7.4068200774490833e-04 4.8764750361442566e-02 -4.0225321054458618e-01 <_> 0 -1 959 -4.2459447868168354e-03 2.1554760634899139e-01 -8.7126992642879486e-02 <_> 0 -1 960 6.8655109498649836e-04 -7.5418718159198761e-02 2.6405909657478333e-01 <_> 0 -1 961 -1.6751460731029510e-02 -6.7729032039642334e-01 3.2918728888034821e-02 <_> 0 -1 962 -2.6301678735762835e-04 2.2725869715213776e-01 -9.0534873306751251e-02 <_> 0 -1 963 4.3398610432632267e-04 5.5894378572702408e-02 -3.5592669248580933e-01 <_> 0 -1 964 -2.0150149241089821e-02 1.9162760674953461e-01 -9.4929970800876617e-02 <_> 0 -1 965 -1.4452129602432251e-02 -6.8510341644287109e-01 2.5422170758247375e-02 <_> 0 -1 966 -2.1149739623069763e-02 3.7533190846443176e-01 -5.1496580243110657e-02 <_> 0 -1 967 2.1137770265340805e-02 2.9083080589771271e-02 -8.9430367946624756e-01 <_> 0 -1 968 1.1524349683895707e-03 -6.9694936275482178e-02 2.7299800515174866e-01 <_> 0 -1 969 -1.9070580310653895e-04 1.8228119611740112e-01 -9.8367072641849518e-02 <_> 0 -1 970 -3.6349631845951080e-02 -8.3693099021911621e-01 2.5055760517716408e-02 <_> 0 -1 971 -9.0632075443863869e-03 4.1463500261306763e-01 -5.4413449019193649e-02 <_> 0 -1 972 -2.0535490475594997e-03 -1.9750310480594635e-01 1.0506899654865265e-01 <_> 93 -9.7747492790222168e-01 <_> 0 -1 973 -2.2717019543051720e-02 2.4288550019264221e-01 -1.4745520055294037e-01 <_> 0 -1 974 2.5505950674414635e-02 -2.8551739454269409e-01 1.0837209969758987e-01 <_> 0 -1 975 -2.6640091091394424e-03 2.9275730252265930e-01 -1.0372710227966309e-01 <_> 0 -1 976 -3.8115289062261581e-03 2.1426899731159210e-01 -1.3811139762401581e-01 <_> 0 -1 977 -1.6732690855860710e-02 2.6550260186195374e-01 -4.3911330401897430e-02 <_> 0 -1 978 4.9277010839432478e-04 2.1104559302330017e-02 -4.2971360683441162e-01 <_> 0 -1 979 -3.6691110581159592e-02 5.3992420434951782e-01 -4.3648801743984222e-02 <_> 0 -1 980 1.2615970335900784e-03 -1.2933869659900665e-01 1.6638770699501038e-01 <_> 0 -1 981 -8.4106856957077980e-03 -9.4698411226272583e-01 2.1465849131345749e-02 <_> 0 -1 982 6.4902722835540771e-02 -7.1727760136127472e-02 2.6613479852676392e-01 <_> 0 -1 983 3.0305000022053719e-02 -8.2782492041587830e-02 2.7694320678710938e-01 <_> 0 -1 984 2.5875340215861797e-03 -1.2966169416904449e-01 1.7756630480289459e-01 <_> 0 -1 985 -7.0240451022982597e-03 -6.4243179559707642e-01 3.9943210780620575e-02 <_> 0 -1 986 -1.0099769569933414e-03 1.4176610112190247e-01 -1.1659970134496689e-01 <_> 0 -1 987 -4.1179071558872238e-05 1.5687669813632965e-01 -1.1127340048551559e-01 <_> 0 -1 988 -4.7293151146732271e-04 -3.3554559946060181e-01 4.5977730304002762e-02 <_> 0 -1 989 -1.7178079579025507e-03 1.6952909529209137e-01 -1.0578069835901260e-01 <_> 0 -1 990 -1.3333169743418694e-02 -5.8257812261581421e-01 3.0978430062532425e-02 <_> 0 -1 991 -1.8783430568873882e-03 1.4266879856586456e-01 -1.1131259799003601e-01 <_> 0 -1 992 -6.5765981562435627e-03 2.7561360597610474e-01 -5.3100328892469406e-02 <_> 0 -1 993 -7.7210381277836859e-05 1.3240240514278412e-01 -1.1167799681425095e-01 <_> 0 -1 994 2.1968539804220200e-02 -2.6968160644173622e-02 5.0067168474197388e-01 <_> 0 -1 995 -2.7445750311017036e-02 -2.4086740612983704e-01 6.0478270053863525e-02 <_> 0 -1 996 7.8305849456228316e-05 -1.3334889709949493e-01 1.0123469680547714e-01 <_> 0 -1 997 7.0190683007240295e-02 -5.4863780736923218e-02 2.4809940159320831e-01 <_> 0 -1 998 -7.1902133524417877e-02 -3.7846690416336060e-01 4.2210999876260757e-02 <_> 0 -1 999 -1.0780979692935944e-01 -3.7486588954925537e-01 4.2833440005779266e-02 <_> 0 -1 1000 1.4364200178533792e-03 8.0476358532905579e-02 -1.7263789474964142e-01 <_> 0 -1 1001 6.8289190530776978e-02 -3.5595789551734924e-02 4.0761318802833557e-01 <_> 0 -1 1002 -6.8037179298698902e-03 1.9233790040016174e-01 -8.2368023693561554e-02 <_> 0 -1 1003 -5.6193489581346512e-04 1.3057120144367218e-01 -1.4355149865150452e-01 <_> 0 -1 1004 -5.8276649564504623e-02 -3.0125439167022705e-01 5.2819650620222092e-02 <_> 0 -1 1005 -6.1205718666315079e-03 2.2043900191783905e-01 -7.5691752135753632e-02 <_> 0 -1 1006 -1.3594309799373150e-02 -3.9049360156059265e-01 4.1857108473777771e-02 <_> 0 -1 1007 1.3626200379803777e-03 -9.5363423228263855e-02 1.4970320463180542e-01 <_> 0 -1 1008 -1.5074219845701009e-04 -2.3945580422878265e-01 6.4798332750797272e-02 <_> 0 -1 1009 -7.7414259314537048e-02 5.5941981077194214e-01 -2.4516880512237549e-02 <_> 0 -1 1010 9.2117872554808855e-04 5.4928861558437347e-02 -2.7934810519218445e-01 <_> 0 -1 1011 1.0250780032947659e-03 -6.2167309224605560e-02 2.4976369738578796e-01 <_> 0 -1 1012 -8.1174750812351704e-04 2.3437939584255219e-01 -6.5725810825824738e-02 <_> 0 -1 1013 8.3431020379066467e-02 5.0954800099134445e-02 -3.1020981073379517e-01 <_> 0 -1 1014 -9.2014456167817116e-03 -3.9242538809776306e-01 3.2926950603723526e-02 <_> 0 -1 1015 -2.9086650465615094e-04 -3.1039750576019287e-01 4.9711819738149643e-02 <_> 0 -1 1016 7.7576898038387299e-03 -4.4040750712156296e-02 3.6431351304054260e-01 <_> 0 -1 1017 -1.2466090172529221e-01 -8.1957077980041504e-01 1.9150640815496445e-02 <_> 0 -1 1018 1.3242550194263458e-02 3.8988839834928513e-02 -3.3230680227279663e-01 <_> 0 -1 1019 -6.6770128905773163e-03 -3.5790139436721802e-01 4.0460210293531418e-02 <_> 0 -1 1020 -2.7479929849505424e-03 2.5253900885581970e-01 -5.6427821516990662e-02 <_> 0 -1 1021 8.2659651525318623e-04 -7.1988657116889954e-02 2.2780479490756989e-01 <_> 0 -1 1022 -5.0153400748968124e-02 -6.3036471605300903e-01 2.7462050318717957e-02 <_> 0 -1 1023 7.4203149415552616e-03 -6.6610716283321381e-02 2.7787339687347412e-01 <_> 0 -1 1024 -6.7951780511066318e-04 -3.6327061057090759e-01 4.2795430868864059e-02 <_> 0 -1 1025 -1.9305750029161572e-03 1.4196230471134186e-01 -1.0759980231523514e-01 <_> 0 -1 1026 -3.8132671033963561e-04 2.1591760218143463e-01 -7.0202663540840149e-02 <_> 0 -1 1027 -7.0990346372127533e-02 4.5266601443290710e-01 -4.0750481188297272e-02 <_> 0 -1 1028 -5.3368080407381058e-02 -6.7674058675765991e-01 1.9288340583443642e-02 <_> 0 -1 1029 -2.0064849406480789e-02 -4.3365430831909180e-01 3.1853288412094116e-02 <_> 0 -1 1030 1.1976360110566020e-03 -2.6559870690107346e-02 5.0797182321548462e-01 <_> 0 -1 1031 -2.2697300300933421e-04 1.8012599647045135e-01 -8.3606548607349396e-02 <_> 0 -1 1032 1.5262699685990810e-02 -2.0238929986953735e-01 6.7422017455101013e-02 <_> 0 -1 1033 -2.0811769366264343e-01 6.6943860054016113e-01 -2.2452110424637794e-02 <_> 0 -1 1034 1.5514369588345289e-03 -7.5121842324733734e-02 1.7326919734477997e-01 <_> 0 -1 1035 -5.2924010902643204e-02 2.4992519617080688e-01 -6.2879167497158051e-02 <_> 0 -1 1036 -2.1648850291967392e-02 -2.9194280505180359e-01 5.2614491432905197e-02 <_> 0 -1 1037 -2.2905069636180997e-04 -2.2117300331592560e-01 6.3168339431285858e-02 <_> 0 -1 1038 5.0170070608146489e-05 -1.1510709673166275e-01 1.1611440032720566e-01 <_> 0 -1 1039 -1.6416069411206990e-04 1.5871520340442657e-01 -8.2600601017475128e-02 <_> 0 -1 1040 -1.2003289535641670e-02 1.2218090146780014e-01 -1.1229699850082397e-01 <_> 0 -1 1041 -1.7784100025892258e-02 -3.5072788596153259e-01 3.1341921538114548e-02 <_> 0 -1 1042 -6.3457582145929337e-03 1.3078069686889648e-01 -1.0574410110712051e-01 <_> 0 -1 1043 -7.9523242311552167e-04 1.7204670608043671e-01 -8.6001992225646973e-02 <_> 0 -1 1044 -3.1029590172693133e-04 -2.8433170914649963e-01 5.1817119121551514e-02 <_> 0 -1 1045 -1.7053710296750069e-02 3.9242428541183472e-01 -4.0143270045518875e-02 <_> 0 -1 1046 4.6504959464073181e-03 -3.1837560236454010e-02 4.1237699985504150e-01 <_> 0 -1 1047 -1.0358760133385658e-02 -5.6993198394775391e-01 2.9248379170894623e-02 <_> 0 -1 1048 -2.2196240723133087e-02 -4.5605289936065674e-01 2.6285989210009575e-02 <_> 0 -1 1049 -7.0536029525101185e-03 1.5998320281505585e-01 -9.1594859957695007e-02 <_> 0 -1 1050 -5.7094299700111151e-04 -1.4076329767704010e-01 1.0287419706583023e-01 <_> 0 -1 1051 -2.2152599412947893e-03 1.6593599319458008e-01 -8.5273988544940948e-02 <_> 0 -1 1052 -2.8084890916943550e-02 2.7022340893745422e-01 -5.5873811244964600e-02 <_> 0 -1 1053 2.1515151020139456e-03 4.2472891509532928e-02 -3.2005849480628967e-01 <_> 0 -1 1054 -2.9733829433098435e-04 1.6177169978618622e-01 -8.5115589201450348e-02 <_> 0 -1 1055 -1.6694780439138412e-02 -4.2858770489692688e-01 3.0541609972715378e-02 <_> 0 -1 1056 1.1982990056276321e-01 -1.6277290880680084e-02 7.9846781492233276e-01 <_> 0 -1 1057 -3.5499420482665300e-04 1.5935939550399780e-01 -8.3272881805896759e-02 <_> 0 -1 1058 -1.8226269632577896e-02 1.9527280330657959e-01 -7.3939889669418335e-02 <_> 0 -1 1059 -4.0238600922748446e-04 7.9101808369159698e-02 -2.0806129276752472e-01 <_> 0 -1 1060 4.0892060496844351e-04 1.0036630183458328e-01 -1.5128210186958313e-01 <_> 0 -1 1061 9.5368112670257688e-04 -7.3011666536331177e-02 2.1752020716667175e-01 <_> 0 -1 1062 4.3081799149513245e-01 -2.7450699359178543e-02 5.7061582803726196e-01 <_> 0 -1 1063 5.3564831614494324e-04 1.1587540060281754e-01 -1.2790560722351074e-01 <_> 0 -1 1064 2.4430730263702571e-05 -1.6816629469394684e-01 8.0449983477592468e-02 <_> 0 -1 1065 -5.5345650762319565e-02 4.5338949561119080e-01 -3.1222779303789139e-02 <_> <_> 0 8 20 12 -1. <_> 0 14 20 6 2. <_> <_> 9 1 4 15 -1. <_> 9 6 4 5 3. <_> <_> 6 10 9 2 -1. <_> 9 10 3 2 3. <_> <_> 7 0 10 9 -1. <_> 7 3 10 3 3. <_> <_> 12 2 2 18 -1. <_> 12 8 2 6 3. <_> <_> 8 6 8 6 -1. <_> 8 9 8 3 2. <_> <_> 2 0 17 18 -1. <_> 2 6 17 6 3. <_> <_> 10 10 1 8 -1. <_> 10 14 1 4 2. <_> <_> 7 10 9 2 -1. <_> 10 10 3 2 3. <_> <_> 5 1 6 6 -1. <_> 5 3 6 2 3. <_> <_> 3 1 15 9 -1. <_> 3 4 15 3 3. <_> <_> 6 3 9 6 -1. <_> 6 5 9 2 3. <_> <_> 8 17 6 3 -1. <_> 10 17 2 3 3. <_> <_> 9 10 9 1 -1. <_> 12 10 3 1 3. <_> <_> 1 7 6 11 -1. <_> 3 7 2 11 3. <_> <_> 9 18 3 1 -1. <_> 10 18 1 1 3. <_> <_> 16 16 1 2 -1. <_> 16 17 1 1 2. <_> <_> 9 17 6 3 -1. <_> 11 17 2 3 3. <_> <_> 8 0 5 18 -1. <_> 8 6 5 6 3. <_> <_> 6 7 9 7 -1. <_> 9 7 3 7 3. <_> <_> 14 6 6 10 -1. <_> 16 6 2 10 3. <_> <_> 9 8 9 5 -1. <_> 12 8 3 5 3. <_> <_> 3 7 9 6 -1. <_> 6 7 3 6 3. <_> <_> 1 7 6 6 -1. <_> 3 7 2 6 3. <_> <_> 16 0 4 18 -1. <_> 16 6 4 6 3. <_> <_> 0 17 3 3 -1. <_> 0 18 3 1 3. <_> <_> 16 0 2 1 -1. <_> 17 0 1 1 2. <_> <_> 0 8 20 12 -1. <_> 0 14 20 6 2. <_> <_> 6 6 9 8 -1. <_> 9 6 3 8 3. <_> <_> 5 3 12 9 -1. <_> 5 6 12 3 3. <_> <_> 4 16 1 2 -1. <_> 4 17 1 1 2. <_> <_> 18 10 2 1 -1. <_> 19 10 1 1 2. <_> <_> 9 8 6 5 -1. <_> 11 8 2 5 3. <_> <_> 0 0 2 1 -1. <_> 1 0 1 1 2. <_> <_> 6 8 6 6 -1. <_> 8 8 2 6 3. <_> <_> 11 7 6 7 -1. <_> 13 7 2 7 3. <_> <_> 19 14 1 2 -1. <_> 19 15 1 1 2. <_> <_> 6 17 1 2 -1. <_> 6 18 1 1 2. <_> <_> 14 7 2 7 -1. <_> 15 7 1 7 2. <_> <_> 6 8 2 4 -1. <_> 7 8 1 4 2. <_> <_> 5 8 12 6 -1. <_> 5 10 12 2 3. <_> <_> 2 17 1 3 -1. <_> 2 18 1 1 3. <_> <_> 6 7 3 6 -1. <_> 7 7 1 6 3. <_> <_> 6 7 9 12 -1. <_> 9 7 3 12 3. <_> <_> 6 2 11 12 -1. <_> 6 6 11 4 3. <_> <_> 1 12 5 8 -1. <_> 1 16 5 4 2. <_> <_> 14 7 6 7 -1. <_> 16 7 2 7 3. <_> <_> 10 8 6 6 -1. <_> 12 8 2 6 3. <_> <_> 16 18 4 2 -1. <_> 16 19 4 1 2. <_> <_> 18 17 2 3 -1. <_> 18 18 2 1 3. <_> <_> 9 7 3 7 -1. <_> 10 7 1 7 3. <_> <_> 5 6 6 8 -1. <_> 7 6 2 8 3. <_> <_> 2 6 6 11 -1. <_> 4 6 2 11 3. <_> <_> 8 10 12 8 -1. <_> 8 14 12 4 2. <_> <_> 7 17 6 3 -1. <_> 9 17 2 3 3. <_> <_> 10 9 3 3 -1. <_> 11 9 1 3 3. <_> <_> 8 8 3 6 -1. <_> 9 8 1 6 3. <_> <_> 7 0 6 5 -1. <_> 9 0 2 5 3. <_> <_> 6 17 1 3 -1. <_> 6 18 1 1 3. <_> <_> 0 18 4 2 -1. <_> 0 19 4 1 2. <_> <_> 4 1 11 9 -1. <_> 4 4 11 3 3. <_> <_> 3 1 14 9 -1. <_> 3 4 14 3 3. <_> <_> 0 9 6 4 -1. <_> 2 9 2 4 3. <_> <_> 18 13 1 2 -1. <_> 18 14 1 1 2. <_> <_> 13 5 3 11 -1. <_> 14 5 1 11 3. <_> <_> 0 18 8 2 -1. <_> 0 18 4 1 2. <_> 4 19 4 1 2. <_> <_> 5 8 12 5 -1. <_> 9 8 4 5 3. <_> <_> 4 7 11 10 -1. <_> 4 12 11 5 2. <_> <_> 14 9 6 4 -1. <_> 16 9 2 4 3. <_> <_> 0 7 6 8 -1. <_> 3 7 3 8 2. <_> <_> 0 16 3 3 -1. <_> 0 17 3 1 3. <_> <_> 7 11 12 1 -1. <_> 11 11 4 1 3. <_> <_> 4 8 9 4 -1. <_> 7 8 3 4 3. <_> <_> 5 16 6 4 -1. <_> 7 16 2 4 3. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 4 9 4 10 -1. <_> 4 9 2 5 2. <_> 6 14 2 5 2. <_> <_> 4 8 6 4 -1. <_> 6 8 2 4 3. <_> <_> 10 2 2 18 -1. <_> 10 8 2 6 3. <_> <_> 0 5 8 6 -1. <_> 0 5 4 3 2. <_> 4 8 4 3 2. <_> <_> 6 0 6 5 -1. <_> 8 0 2 5 3. <_> <_> 18 0 2 14 -1. <_> 18 7 2 7 2. <_> <_> 8 18 4 2 -1. <_> 10 18 2 2 2. <_> <_> 1 17 6 3 -1. <_> 1 18 6 1 3. <_> <_> 11 8 3 5 -1. <_> 12 8 1 5 3. <_> <_> 11 8 3 4 -1. <_> 12 8 1 4 3. <_> <_> 11 0 6 5 -1. <_> 13 0 2 5 3. <_> <_> 1 7 6 7 -1. <_> 3 7 2 7 3. <_> <_> 0 13 1 3 -1. <_> 0 14 1 1 3. <_> <_> 3 2 9 6 -1. <_> 3 4 9 2 3. <_> <_> 8 6 9 2 -1. <_> 8 7 9 1 2. <_> <_> 0 14 3 6 -1. <_> 0 16 3 2 3. <_> <_> 1 11 6 4 -1. <_> 3 11 2 4 3. <_> <_> 6 9 9 3 -1. <_> 9 9 3 3 3. <_> <_> 6 0 9 6 -1. <_> 6 2 9 2 3. <_> <_> 8 5 6 6 -1. <_> 8 7 6 2 3. <_> <_> 1 12 2 1 -1. <_> 2 12 1 1 2. <_> <_> 10 10 6 2 -1. <_> 12 10 2 2 3. <_> <_> 13 8 6 6 -1. <_> 15 8 2 6 3. <_> <_> 6 16 6 4 -1. <_> 8 16 2 4 3. <_> <_> 8 0 9 9 -1. <_> 8 3 9 3 3. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 7 10 3 3 -1. <_> 8 10 1 3 3. <_> <_> 9 14 2 2 -1. <_> 9 14 1 1 2. <_> 10 15 1 1 2. <_> <_> 9 14 2 2 -1. <_> 9 14 1 1 2. <_> 10 15 1 1 2. <_> <_> 0 8 19 12 -1. <_> 0 14 19 6 2. <_> <_> 7 6 9 14 -1. <_> 10 6 3 14 3. <_> <_> 13 8 3 4 -1. <_> 14 8 1 4 3. <_> <_> 4 17 1 3 -1. <_> 4 18 1 1 3. <_> <_> 4 9 6 3 -1. <_> 6 9 2 3 3. <_> <_> 2 18 5 2 -1. <_> 2 19 5 1 2. <_> <_> 7 8 2 2 -1. <_> 7 8 1 1 2. <_> 8 9 1 1 2. <_> <_> 7 8 2 2 -1. <_> 7 8 1 1 2. <_> 8 9 1 1 2. <_> <_> 5 10 13 2 -1. <_> 5 11 13 1 2. <_> <_> 10 8 1 9 -1. <_> 10 11 1 3 3. <_> <_> 15 8 2 12 -1. <_> 15 8 1 6 2. <_> 16 14 1 6 2. <_> <_> 4 0 3 5 -1. <_> 5 0 1 5 3. <_> <_> 12 6 3 7 -1. <_> 13 6 1 7 3. <_> <_> 7 16 6 4 -1. <_> 9 16 2 4 3. <_> <_> 9 16 2 1 -1. <_> 10 16 1 1 2. <_> <_> 6 10 9 2 -1. <_> 9 10 3 2 3. <_> <_> 0 6 15 14 -1. <_> 0 13 15 7 2. <_> <_> 9 1 5 6 -1. <_> 9 3 5 2 3. <_> <_> 3 9 3 4 -1. <_> 4 9 1 4 3. <_> <_> 5 7 3 6 -1. <_> 6 7 1 6 3. <_> <_> 17 16 1 2 -1. <_> 17 17 1 1 2. <_> <_> 9 8 6 12 -1. <_> 11 8 2 12 3. <_> <_> 6 10 6 1 -1. <_> 8 10 2 1 3. <_> <_> 7 17 9 3 -1. <_> 10 17 3 3 3. <_> <_> 14 18 6 2 -1. <_> 14 19 6 1 2. <_> <_> 9 5 3 14 -1. <_> 10 5 1 14 3. <_> <_> 8 16 9 4 -1. <_> 11 16 3 4 3. <_> <_> 0 0 4 14 -1. <_> 0 7 4 7 2. <_> <_> 8 1 6 3 -1. <_> 10 1 2 3 3. <_> <_> 6 8 3 4 -1. <_> 7 8 1 4 3. <_> <_> 4 8 3 4 -1. <_> 5 8 1 4 3. <_> <_> 5 1 6 5 -1. <_> 7 1 2 5 3. <_> <_> 1 18 1 2 -1. <_> 1 19 1 1 2. <_> <_> 7 0 6 6 -1. <_> 7 2 6 2 3. <_> <_> 0 18 4 2 -1. <_> 0 19 4 1 2. <_> <_> 12 3 8 12 -1. <_> 12 7 8 4 3. <_> <_> 12 9 3 4 -1. <_> 13 9 1 4 3. <_> <_> 12 8 3 5 -1. <_> 13 8 1 5 3. <_> <_> 16 0 2 1 -1. <_> 17 0 1 1 2. <_> <_> 5 17 1 3 -1. <_> 5 18 1 1 3. <_> <_> 10 2 3 6 -1. <_> 10 4 3 2 3. <_> <_> 4 17 2 3 -1. <_> 4 18 2 1 3. <_> <_> 12 7 1 9 -1. <_> 12 10 1 3 3. <_> <_> 7 6 3 9 -1. <_> 8 6 1 9 3. <_> <_> 17 13 3 6 -1. <_> 17 15 3 2 3. <_> <_> 7 7 3 8 -1. <_> 8 7 1 8 3. <_> <_> 5 0 3 5 -1. <_> 6 0 1 5 3. <_> <_> 4 6 9 8 -1. <_> 7 6 3 8 3. <_> <_> 2 9 3 3 -1. <_> 3 9 1 3 3. <_> <_> 16 18 4 2 -1. <_> 16 19 4 1 2. <_> <_> 17 10 3 10 -1. <_> 17 15 3 5 2. <_> <_> 8 9 6 4 -1. <_> 10 9 2 4 3. <_> <_> 5 2 10 12 -1. <_> 5 6 10 4 3. <_> <_> 6 9 6 3 -1. <_> 8 9 2 3 3. <_> <_> 11 7 3 7 -1. <_> 12 7 1 7 3. <_> <_> 12 8 6 4 -1. <_> 14 8 2 4 3. <_> <_> 14 8 6 5 -1. <_> 16 8 2 5 3. <_> <_> 12 12 2 4 -1. <_> 12 14 2 2 2. <_> <_> 3 15 1 2 -1. <_> 3 16 1 1 2. <_> <_> 12 7 3 4 -1. <_> 13 7 1 4 3. <_> <_> 10 0 6 6 -1. <_> 12 0 2 6 3. <_> <_> 10 6 3 8 -1. <_> 11 6 1 8 3. <_> <_> 16 17 1 2 -1. <_> 16 18 1 1 2. <_> <_> 16 16 1 3 -1. <_> 16 17 1 1 3. <_> <_> 11 11 1 2 -1. <_> 11 12 1 1 2. <_> <_> 3 7 6 9 -1. <_> 5 7 2 9 3. <_> <_> 4 18 9 1 -1. <_> 7 18 3 1 3. <_> <_> 0 11 4 9 -1. <_> 0 14 4 3 3. <_> <_> 9 17 6 3 -1. <_> 11 17 2 3 3. <_> <_> 7 8 6 12 -1. <_> 9 8 2 12 3. <_> <_> 6 8 3 4 -1. <_> 7 8 1 4 3. <_> <_> 3 17 1 3 -1. <_> 3 18 1 1 3. <_> <_> 11 9 6 4 -1. <_> 13 9 2 4 3. <_> <_> 6 1 3 2 -1. <_> 7 1 1 2 3. <_> <_> 1 0 2 1 -1. <_> 2 0 1 1 2. <_> <_> 1 0 2 14 -1. <_> 1 0 1 7 2. <_> 2 7 1 7 2. <_> <_> 5 5 11 8 -1. <_> 5 9 11 4 2. <_> <_> 9 3 5 6 -1. <_> 9 5 5 2 3. <_> <_> 7 9 5 10 -1. <_> 7 14 5 5 2. <_> <_> 15 10 2 2 -1. <_> 16 10 1 2 2. <_> <_> 0 18 8 2 -1. <_> 0 19 8 1 2. <_> <_> 7 17 1 3 -1. <_> 7 18 1 1 3. <_> <_> 7 2 11 6 -1. <_> 7 4 11 2 3. <_> <_> 8 3 9 3 -1. <_> 8 4 9 1 3. <_> <_> 0 9 2 2 -1. <_> 0 10 2 1 2. <_> <_> 0 5 3 6 -1. <_> 0 7 3 2 3. <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. <_> <_> 7 6 3 6 -1. <_> 8 6 1 6 3. <_> <_> 12 1 6 4 -1. <_> 14 1 2 4 3. <_> <_> 9 11 6 8 -1. <_> 11 11 2 8 3. <_> <_> 17 15 3 3 -1. <_> 17 16 3 1 3. <_> <_> 6 6 3 9 -1. <_> 6 9 3 3 3. <_> <_> 0 5 8 6 -1. <_> 0 5 4 3 2. <_> 4 8 4 3 2. <_> <_> 0 6 1 3 -1. <_> 0 7 1 1 3. <_> <_> 17 0 2 6 -1. <_> 18 0 1 6 2. <_> <_> 10 17 6 3 -1. <_> 12 17 2 3 3. <_> <_> 13 15 2 2 -1. <_> 13 15 1 1 2. <_> 14 16 1 1 2. <_> <_> 4 0 12 3 -1. <_> 4 1 12 1 3. <_> <_> 5 3 10 9 -1. <_> 5 6 10 3 3. <_> <_> 7 7 9 7 -1. <_> 10 7 3 7 3. <_> <_> 5 8 9 6 -1. <_> 8 8 3 6 3. <_> <_> 0 16 6 2 -1. <_> 0 17 6 1 2. <_> <_> 12 6 7 14 -1. <_> 12 13 7 7 2. <_> <_> 13 7 6 8 -1. <_> 15 7 2 8 3. <_> <_> 2 10 6 3 -1. <_> 4 10 2 3 3. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 7 1 6 2 -1. <_> 7 2 6 1 2. <_> <_> 6 0 6 4 -1. <_> 6 2 6 2 2. <_> <_> 8 18 6 2 -1. <_> 10 18 2 2 3. <_> <_> 7 6 5 2 -1. <_> 7 7 5 1 2. <_> <_> 6 7 3 6 -1. <_> 7 7 1 6 3. <_> <_> 18 18 2 2 -1. <_> 18 18 1 1 2. <_> 19 19 1 1 2. <_> <_> 16 8 3 7 -1. <_> 17 8 1 7 3. <_> <_> 0 16 2 3 -1. <_> 0 17 2 1 3. <_> <_> 5 19 6 1 -1. <_> 7 19 2 1 3. <_> <_> 9 5 6 6 -1. <_> 9 7 6 2 3. <_> <_> 0 10 2 4 -1. <_> 0 12 2 2 2. <_> <_> 0 9 4 3 -1. <_> 2 9 2 3 2. <_> <_> 1 10 6 9 -1. <_> 3 10 2 9 3. <_> <_> 9 0 6 2 -1. <_> 11 0 2 2 3. <_> <_> 14 1 2 1 -1. <_> 15 1 1 1 2. <_> <_> 0 8 1 4 -1. <_> 0 10 1 2 2. <_> <_> 15 6 2 2 -1. <_> 15 6 1 1 2. <_> 16 7 1 1 2. <_> <_> 7 5 3 6 -1. <_> 8 5 1 6 3. <_> <_> 19 17 1 3 -1. <_> 19 18 1 1 3. <_> <_> 7 10 3 1 -1. <_> 8 10 1 1 3. <_> <_> 12 1 6 6 -1. <_> 14 1 2 6 3. <_> <_> 15 5 2 1 -1. <_> 16 5 1 1 2. <_> <_> 8 2 7 4 -1. <_> 8 4 7 2 2. <_> <_> 4 0 14 15 -1. <_> 4 5 14 5 3. <_> <_> 7 8 6 6 -1. <_> 9 8 2 6 3. <_> <_> 11 17 1 3 -1. <_> 11 18 1 1 3. <_> <_> 12 16 2 4 -1. <_> 12 16 1 2 2. <_> 13 18 1 2 2. <_> <_> 10 13 2 1 -1. <_> 11 13 1 1 2. <_> <_> 11 8 3 3 -1. <_> 12 8 1 3 3. <_> <_> 2 0 6 8 -1. <_> 4 0 2 8 3. <_> <_> 3 5 6 6 -1. <_> 3 5 3 3 2. <_> 6 8 3 3 2. <_> <_> 10 8 3 3 -1. <_> 11 8 1 3 3. <_> <_> 5 17 4 2 -1. <_> 5 18 4 1 2. <_> <_> 8 16 5 2 -1. <_> 8 17 5 1 2. <_> <_> 0 4 3 3 -1. <_> 0 5 3 1 3. <_> <_> 6 3 6 2 -1. <_> 8 3 2 2 3. <_> <_> 4 4 9 3 -1. <_> 7 4 3 3 3. <_> <_> 0 13 1 4 -1. <_> 0 15 1 2 2. <_> <_> 0 17 8 3 -1. <_> 0 18 8 1 3. <_> <_> 6 1 11 6 -1. <_> 6 3 11 2 3. <_> <_> 4 10 6 2 -1. <_> 6 10 2 2 3. <_> <_> 10 8 1 12 -1. <_> 10 14 1 6 2. <_> <_> 5 8 3 4 -1. <_> 6 8 1 4 3. <_> <_> 0 17 1 3 -1. <_> 0 18 1 1 3. <_> <_> 0 17 1 3 -1. <_> 0 18 1 1 3. <_> <_> 13 8 3 4 -1. <_> 14 8 1 4 3. <_> <_> 1 5 5 4 -1. <_> 1 7 5 2 2. <_> <_> 18 14 1 2 -1. <_> 18 15 1 1 2. <_> <_> 13 8 2 4 -1. <_> 14 8 1 4 2. <_> <_> 10 6 6 8 -1. <_> 12 6 2 8 3. <_> <_> 8 6 6 10 -1. <_> 10 6 2 10 3. <_> <_> 17 16 1 3 -1. <_> 17 17 1 1 3. <_> <_> 1 7 2 10 -1. <_> 2 7 1 10 2. <_> <_> 5 9 6 3 -1. <_> 7 9 2 3 3. <_> <_> 0 8 5 12 -1. <_> 0 14 5 6 2. <_> <_> 0 11 1 3 -1. <_> 0 12 1 1 3. <_> <_> 6 16 6 4 -1. <_> 8 16 2 4 3. <_> <_> 0 6 2 6 -1. <_> 0 8 2 2 3. <_> <_> 11 18 2 1 -1. <_> 12 18 1 1 2. <_> <_> 5 1 9 2 -1. <_> 5 2 9 1 2. <_> <_> 0 0 1 2 -1. <_> 0 1 1 1 2. <_> <_> 15 9 3 3 -1. <_> 16 9 1 3 3. <_> <_> 18 16 1 3 -1. <_> 18 17 1 1 3. <_> <_> 11 10 6 1 -1. <_> 13 10 2 1 3. <_> <_> 1 3 4 4 -1. <_> 3 3 2 4 2. <_> <_> 11 2 1 18 -1. <_> 11 8 1 6 3. <_> <_> 9 1 5 12 -1. <_> 9 5 5 4 3. <_> <_> 12 0 8 1 -1. <_> 16 0 4 1 2. <_> <_> 8 6 3 10 -1. <_> 9 6 1 10 3. <_> <_> 19 2 1 6 -1. <_> 19 4 1 2 3. <_> <_> 18 6 2 2 -1. <_> 18 7 2 1 2. <_> <_> 7 7 3 4 -1. <_> 8 7 1 4 3. <_> <_> 5 0 6 5 -1. <_> 7 0 2 5 3. <_> <_> 0 3 7 3 -1. <_> 0 4 7 1 3. <_> <_> 1 6 2 1 -1. <_> 2 6 1 1 2. <_> <_> 4 8 2 10 -1. <_> 4 8 1 5 2. <_> 5 13 1 5 2. <_> <_> 2 18 18 2 -1. <_> 2 18 9 1 2. <_> 11 19 9 1 2. <_> <_> 2 7 4 4 -1. <_> 2 7 2 2 2. <_> 4 9 2 2 2. <_> <_> 17 3 3 4 -1. <_> 18 3 1 4 3. <_> <_> 16 9 2 8 -1. <_> 16 9 1 4 2. <_> 17 13 1 4 2. <_> <_> 15 7 1 6 -1. <_> 15 9 1 2 3. <_> <_> 14 2 2 2 -1. <_> 14 3 2 1 2. <_> <_> 17 0 2 3 -1. <_> 17 1 2 1 3. <_> <_> 16 18 2 2 -1. <_> 16 18 1 1 2. <_> 17 19 1 1 2. <_> <_> 10 4 4 3 -1. <_> 10 5 4 1 3. <_> <_> 0 2 8 6 -1. <_> 4 2 4 6 2. <_> <_> 7 14 6 6 -1. <_> 7 16 6 2 3. <_> <_> 11 15 2 2 -1. <_> 11 16 2 1 2. <_> <_> 7 1 9 4 -1. <_> 10 1 3 4 3. <_> <_> 9 7 3 7 -1. <_> 10 7 1 7 3. <_> <_> 6 17 2 2 -1. <_> 6 17 1 1 2. <_> 7 18 1 1 2. <_> <_> 4 6 3 9 -1. <_> 5 6 1 9 3. <_> <_> 0 10 19 10 -1. <_> 0 15 19 5 2. <_> <_> 5 17 6 1 -1. <_> 7 17 2 1 3. <_> <_> 0 12 6 3 -1. <_> 3 12 3 3 2. <_> <_> 2 5 18 5 -1. <_> 8 5 6 5 3. <_> <_> 1 15 6 4 -1. <_> 1 17 6 2 2. <_> <_> 14 10 6 6 -1. <_> 16 10 2 6 3. <_> <_> 0 14 4 3 -1. <_> 0 15 4 1 3. <_> <_> 1 7 6 11 -1. <_> 3 7 2 11 3. <_> <_> 13 17 7 2 -1. <_> 13 18 7 1 2. <_> <_> 0 14 2 3 -1. <_> 0 15 2 1 3. <_> <_> 0 0 6 2 -1. <_> 3 0 3 2 2. <_> <_> 0 1 6 3 -1. <_> 3 1 3 3 2. <_> <_> 0 8 2 6 -1. <_> 0 10 2 2 3. <_> <_> 1 2 6 14 -1. <_> 1 2 3 7 2. <_> 4 9 3 7 2. <_> <_> 17 5 2 2 -1. <_> 17 5 1 1 2. <_> 18 6 1 1 2. <_> <_> 11 10 9 4 -1. <_> 14 10 3 4 3. <_> <_> 2 9 12 4 -1. <_> 6 9 4 4 3. <_> <_> 7 10 12 2 -1. <_> 11 10 4 2 3. <_> <_> 2 13 1 2 -1. <_> 2 14 1 1 2. <_> <_> 16 7 4 3 -1. <_> 16 8 4 1 3. <_> <_> 19 16 1 3 -1. <_> 19 17 1 1 3. <_> <_> 18 11 1 2 -1. <_> 18 12 1 1 2. <_> <_> 12 7 8 2 -1. <_> 12 7 4 1 2. <_> 16 8 4 1 2. <_> <_> 14 9 2 4 -1. <_> 15 9 1 4 2. <_> <_> 14 2 6 4 -1. <_> 14 2 3 2 2. <_> 17 4 3 2 2. <_> <_> 14 0 6 1 -1. <_> 17 0 3 1 2. <_> <_> 3 12 2 1 -1. <_> 4 12 1 1 2. <_> <_> 17 2 3 1 -1. <_> 18 2 1 1 3. <_> <_> 1 16 18 2 -1. <_> 7 16 6 2 3. <_> <_> 2 19 8 1 -1. <_> 6 19 4 1 2. <_> <_> 1 17 4 3 -1. <_> 1 18 4 1 3. <_> <_> 19 13 1 2 -1. <_> 19 14 1 1 2. <_> <_> 9 16 10 4 -1. <_> 9 16 5 2 2. <_> 14 18 5 2 2. <_> <_> 12 9 2 4 -1. <_> 12 9 1 2 2. <_> 13 11 1 2 2. <_> <_> 19 11 1 9 -1. <_> 19 14 1 3 3. <_> <_> 6 6 14 14 -1. <_> 6 13 14 7 2. <_> <_> 2 17 4 2 -1. <_> 2 18 4 1 2. <_> <_> 0 2 1 3 -1. <_> 0 3 1 1 3. <_> <_> 0 12 1 3 -1. <_> 0 13 1 1 3. <_> <_> 15 15 4 4 -1. <_> 15 17 4 2 2. <_> <_> 2 5 18 7 -1. <_> 8 5 6 7 3. <_> <_> 1 16 5 3 -1. <_> 1 17 5 1 3. <_> <_> 0 4 2 3 -1. <_> 0 5 2 1 3. <_> <_> 0 6 2 6 -1. <_> 1 6 1 6 2. <_> <_> 16 14 4 3 -1. <_> 16 15 4 1 3. <_> <_> 0 0 10 6 -1. <_> 0 0 5 3 2. <_> 5 3 5 3 2. <_> <_> 2 2 3 6 -1. <_> 3 2 1 6 3. <_> <_> 2 0 3 10 -1. <_> 3 0 1 10 3. <_> <_> 5 5 2 2 -1. <_> 5 6 2 1 2. <_> <_> 12 6 4 4 -1. <_> 12 8 4 2 2. <_> <_> 13 5 7 3 -1. <_> 13 6 7 1 3. <_> <_> 10 13 1 2 -1. <_> 10 14 1 1 2. <_> <_> 16 16 4 2 -1. <_> 18 16 2 2 2. <_> <_> 16 12 4 7 -1. <_> 18 12 2 7 2. <_> <_> 16 17 1 3 -1. <_> 16 18 1 1 3. <_> <_> 19 9 1 3 -1. <_> 19 10 1 1 3. <_> <_> 18 7 2 6 -1. <_> 19 7 1 6 2. <_> <_> 8 1 3 4 -1. <_> 9 1 1 4 3. <_> <_> 14 0 6 9 -1. <_> 16 0 2 9 3. <_> <_> 4 2 10 2 -1. <_> 9 2 5 2 2. <_> <_> 2 12 8 4 -1. <_> 2 12 4 2 2. <_> 6 14 4 2 2. <_> <_> 0 4 7 3 -1. <_> 0 5 7 1 3. <_> <_> 14 14 3 3 -1. <_> 15 14 1 3 3. <_> <_> 0 3 4 3 -1. <_> 2 3 2 3 2. <_> <_> 1 0 2 7 -1. <_> 2 0 1 7 2. <_> <_> 15 16 4 4 -1. <_> 15 18 4 2 2. <_> <_> 5 8 12 4 -1. <_> 5 10 12 2 2. <_> <_> 3 17 1 2 -1. <_> 3 18 1 1 2. <_> <_> 6 1 3 4 -1. <_> 7 1 1 4 3. <_> <_> 6 2 3 4 -1. <_> 7 2 1 4 3. <_> <_> 6 8 9 12 -1. <_> 9 8 3 12 3. <_> <_> 8 1 8 6 -1. <_> 8 3 8 2 3. <_> <_> 14 2 6 3 -1. <_> 17 2 3 3 2. <_> <_> 0 6 1 3 -1. <_> 0 7 1 1 3. <_> <_> 10 0 10 2 -1. <_> 15 0 5 2 2. <_> <_> 11 0 3 2 -1. <_> 12 0 1 2 3. <_> <_> 3 19 10 1 -1. <_> 8 19 5 1 2. <_> <_> 0 4 7 16 -1. <_> 0 12 7 8 2. <_> <_> 2 16 1 3 -1. <_> 2 17 1 1 3. <_> <_> 7 8 12 6 -1. <_> 11 8 4 6 3. <_> <_> 14 9 6 7 -1. <_> 16 9 2 7 3. <_> <_> 12 17 6 1 -1. <_> 14 17 2 1 3. <_> <_> 16 1 3 1 -1. <_> 17 1 1 1 3. <_> <_> 0 17 8 2 -1. <_> 0 17 4 1 2. <_> 4 18 4 1 2. <_> <_> 17 0 2 1 -1. <_> 18 0 1 1 2. <_> <_> 4 15 6 5 -1. <_> 6 15 2 5 3. <_> <_> 7 2 8 2 -1. <_> 7 3 8 1 2. <_> <_> 4 1 8 4 -1. <_> 4 3 8 2 2. <_> <_> 5 19 2 1 -1. <_> 6 19 1 1 2. <_> <_> 5 19 2 1 -1. <_> 6 19 1 1 2. <_> <_> 16 17 1 3 -1. <_> 16 18 1 1 3. <_> <_> 0 11 2 3 -1. <_> 1 11 1 3 2. <_> <_> 0 19 4 1 -1. <_> 2 19 2 1 2. <_> <_> 0 18 4 2 -1. <_> 2 18 2 2 2. <_> <_> 2 17 1 3 -1. <_> 2 18 1 1 3. <_> <_> 5 7 11 2 -1. <_> 5 8 11 1 2. <_> <_> 9 2 4 10 -1. <_> 9 7 4 5 2. <_> <_> 0 2 4 3 -1. <_> 0 3 4 1 3. <_> <_> 10 19 10 1 -1. <_> 15 19 5 1 2. <_> <_> 11 17 8 3 -1. <_> 15 17 4 3 2. <_> <_> 8 19 3 1 -1. <_> 9 19 1 1 3. <_> <_> 14 0 3 4 -1. <_> 15 0 1 4 3. <_> <_> 10 6 4 3 -1. <_> 10 7 4 1 3. <_> <_> 0 8 3 2 -1. <_> 0 9 3 1 2. <_> <_> 7 12 3 6 -1. <_> 7 14 3 2 3. <_> <_> 1 18 1 2 -1. <_> 1 19 1 1 2. <_> <_> 0 12 4 4 -1. <_> 2 12 2 4 2. <_> <_> 1 8 6 7 -1. <_> 3 8 2 7 3. <_> <_> 0 8 4 5 -1. <_> 2 8 2 5 2. <_> <_> 19 16 1 3 -1. <_> 19 17 1 1 3. <_> <_> 1 5 18 6 -1. <_> 7 5 6 6 3. <_> <_> 2 15 4 2 -1. <_> 2 16 4 1 2. <_> <_> 18 6 2 11 -1. <_> 19 6 1 11 2. <_> <_> 0 12 2 6 -1. <_> 0 14 2 2 3. <_> <_> 12 5 3 2 -1. <_> 12 6 3 1 2. <_> <_> 1 3 2 3 -1. <_> 1 4 2 1 3. <_> <_> 16 14 4 4 -1. <_> 16 16 4 2 2. <_> <_> 6 8 12 5 -1. <_> 10 8 4 5 3. <_> <_> 13 7 2 7 -1. <_> 14 7 1 7 2. <_> <_> 1 8 2 6 -1. <_> 2 8 1 6 2. <_> <_> 15 0 3 7 -1. <_> 16 0 1 7 3. <_> <_> 4 2 6 2 -1. <_> 6 2 2 2 3. <_> <_> 0 9 20 9 -1. <_> 0 12 20 3 3. <_> <_> 10 14 2 2 -1. <_> 10 15 2 1 2. <_> <_> 6 5 10 4 -1. <_> 6 7 10 2 2. <_> <_> 6 1 5 9 -1. <_> 6 4 5 3 3. <_> <_> 16 18 2 2 -1. <_> 16 18 1 1 2. <_> 17 19 1 1 2. <_> <_> 0 14 2 4 -1. <_> 0 16 2 2 2. <_> <_> 10 8 2 5 -1. <_> 11 8 1 5 2. <_> <_> 3 7 12 7 -1. <_> 7 7 4 7 3. <_> <_> 0 0 6 6 -1. <_> 3 0 3 6 2. <_> <_> 1 0 4 4 -1. <_> 3 0 2 4 2. <_> <_> 0 0 6 8 -1. <_> 2 0 2 8 3. <_> <_> 0 0 2 1 -1. <_> 1 0 1 1 2. <_> <_> 0 0 3 3 -1. <_> 0 1 3 1 3. <_> <_> 5 4 2 4 -1. <_> 5 6 2 2 2. <_> <_> 2 10 9 1 -1. <_> 5 10 3 1 3. <_> <_> 1 17 1 3 -1. <_> 1 18 1 1 3. <_> <_> 0 17 2 3 -1. <_> 0 18 2 1 3. <_> <_> 0 15 16 3 -1. <_> 8 15 8 3 2. <_> <_> 0 5 4 1 -1. <_> 2 5 2 1 2. <_> <_> 1 0 6 20 -1. <_> 3 0 2 20 3. <_> <_> 2 5 4 6 -1. <_> 2 5 2 3 2. <_> 4 8 2 3 2. <_> <_> 9 16 6 3 -1. <_> 11 16 2 3 3. <_> <_> 11 17 6 1 -1. <_> 14 17 3 1 2. <_> <_> 3 17 15 2 -1. <_> 8 17 5 2 3. <_> <_> 18 0 2 3 -1. <_> 18 1 2 1 3. <_> <_> 13 1 7 4 -1. <_> 13 3 7 2 2. <_> <_> 13 6 4 4 -1. <_> 13 6 2 2 2. <_> 15 8 2 2 2. <_> <_> 17 6 3 4 -1. <_> 17 8 3 2 2. <_> <_> 14 9 2 2 -1. <_> 15 9 1 2 2. <_> <_> 17 17 1 3 -1. <_> 17 18 1 1 3. <_> <_> 3 19 8 1 -1. <_> 7 19 4 1 2. <_> <_> 0 9 3 6 -1. <_> 0 12 3 3 2. <_> <_> 4 7 15 5 -1. <_> 9 7 5 5 3. <_> <_> 6 9 9 5 -1. <_> 9 9 3 5 3. <_> <_> 8 1 6 2 -1. <_> 10 1 2 2 3. <_> <_> 4 0 12 2 -1. <_> 10 0 6 2 2. <_> <_> 7 0 10 3 -1. <_> 12 0 5 3 2. <_> <_> 5 0 9 6 -1. <_> 5 2 9 2 3. <_> <_> 8 3 6 4 -1. <_> 8 5 6 2 2. <_> <_> 17 4 2 3 -1. <_> 17 5 2 1 3. <_> <_> 5 2 4 3 -1. <_> 5 3 4 1 3. <_> <_> 5 9 2 6 -1. <_> 6 9 1 6 2. <_> <_> 14 10 2 6 -1. <_> 15 10 1 6 2. <_> <_> 7 4 3 3 -1. <_> 7 5 3 1 3. <_> <_> 12 4 8 2 -1. <_> 12 4 4 1 2. <_> 16 5 4 1 2. <_> <_> 15 8 1 6 -1. <_> 15 10 1 2 3. <_> <_> 4 17 11 3 -1. <_> 4 18 11 1 3. <_> <_> 3 0 16 20 -1. <_> 3 10 16 10 2. <_> <_> 12 4 4 6 -1. <_> 12 6 4 2 3. <_> <_> 11 0 6 6 -1. <_> 13 0 2 6 3. <_> <_> 13 1 6 4 -1. <_> 13 1 3 2 2. <_> 16 3 3 2 2. <_> <_> 11 0 6 4 -1. <_> 13 0 2 4 3. <_> <_> 8 6 6 9 -1. <_> 10 6 2 9 3. <_> <_> 7 0 3 4 -1. <_> 8 0 1 4 3. <_> <_> 0 17 14 2 -1. <_> 0 17 7 1 2. <_> 7 18 7 1 2. <_> <_> 6 18 2 2 -1. <_> 6 18 1 1 2. <_> 7 19 1 1 2. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 17 18 2 2 -1. <_> 17 18 1 1 2. <_> 18 19 1 1 2. <_> <_> 5 7 1 9 -1. <_> 5 10 1 3 3. <_> <_> 5 3 6 4 -1. <_> 7 3 2 4 3. <_> <_> 1 9 6 2 -1. <_> 1 9 3 1 2. <_> 4 10 3 1 2. <_> <_> 6 9 2 3 -1. <_> 7 9 1 3 2. <_> <_> 6 8 6 12 -1. <_> 8 8 2 12 3. <_> <_> 4 18 2 2 -1. <_> 4 18 1 1 2. <_> 5 19 1 1 2. <_> <_> 9 1 6 6 -1. <_> 9 3 6 2 3. <_> <_> 6 17 6 2 -1. <_> 6 18 6 1 2. <_> <_> 3 18 16 2 -1. <_> 3 19 16 1 2. <_> <_> 3 0 3 11 -1. <_> 4 0 1 11 3. <_> <_> 13 18 3 1 -1. <_> 14 18 1 1 3. <_> <_> 6 0 9 6 -1. <_> 6 2 9 2 3. <_> <_> 1 2 12 4 -1. <_> 1 2 6 2 2. <_> 7 4 6 2 2. <_> <_> 3 3 6 4 -1. <_> 5 3 2 4 3. <_> <_> 12 0 8 1 -1. <_> 16 0 4 1 2. <_> <_> 9 0 6 2 -1. <_> 11 0 2 2 3. <_> <_> 3 3 12 1 -1. <_> 9 3 6 1 2. <_> <_> 2 7 6 2 -1. <_> 2 7 3 1 2. <_> 5 8 3 1 2. <_> <_> 0 8 4 6 -1. <_> 0 10 4 2 3. <_> <_> 9 6 3 7 -1. <_> 10 6 1 7 3. <_> <_> 9 6 6 13 -1. <_> 11 6 2 13 3. <_> <_> 11 12 6 1 -1. <_> 13 12 2 1 3. <_> <_> 18 9 2 6 -1. <_> 18 12 2 3 2. <_> <_> 17 2 3 9 -1. <_> 18 2 1 9 3. <_> <_> 13 8 4 6 -1. <_> 13 8 2 3 2. <_> 15 11 2 3 2. <_> <_> 4 2 12 6 -1. <_> 10 2 6 6 2. <_> <_> 4 14 16 6 -1. <_> 12 14 8 6 2. <_> <_> 6 19 10 1 -1. <_> 11 19 5 1 2. <_> <_> 6 17 1 3 -1. <_> 6 18 1 1 3. <_> <_> 4 14 10 3 -1. <_> 4 15 10 1 3. <_> <_> 6 0 12 12 -1. <_> 6 4 12 4 3. <_> <_> 5 7 4 2 -1. <_> 5 7 2 1 2. <_> 7 8 2 1 2. <_> <_> 17 5 3 2 -1. <_> 18 5 1 2 3. <_> <_> 8 13 6 3 -1. <_> 8 14 6 1 3. <_> <_> 8 13 5 3 -1. <_> 8 14 5 1 3. <_> <_> 13 2 1 18 -1. <_> 13 11 1 9 2. <_> <_> 6 10 9 2 -1. <_> 9 10 3 2 3. <_> <_> 11 0 7 4 -1. <_> 11 2 7 2 2. <_> <_> 1 0 6 8 -1. <_> 3 0 2 8 3. <_> <_> 9 15 3 3 -1. <_> 9 16 3 1 3. <_> <_> 9 17 9 3 -1. <_> 9 18 9 1 3. <_> <_> 12 12 3 3 -1. <_> 12 13 3 1 3. <_> <_> 4 1 3 5 -1. <_> 5 1 1 5 3. <_> <_> 10 14 2 3 -1. <_> 10 15 2 1 3. <_> <_> 18 17 2 2 -1. <_> 18 17 1 1 2. <_> 19 18 1 1 2. <_> <_> 18 18 2 2 -1. <_> 18 18 1 1 2. <_> 19 19 1 1 2. <_> <_> 18 18 2 2 -1. <_> 18 18 1 1 2. <_> 19 19 1 1 2. <_> <_> 4 10 9 1 -1. <_> 7 10 3 1 3. <_> <_> 3 9 6 5 -1. <_> 5 9 2 5 3. <_> <_> 18 8 1 12 -1. <_> 18 14 1 6 2. <_> <_> 0 2 8 6 -1. <_> 0 2 4 3 2. <_> 4 5 4 3 2. <_> <_> 9 4 3 3 -1. <_> 9 5 3 1 3. <_> <_> 3 18 2 2 -1. <_> 3 18 1 1 2. <_> 4 19 1 1 2. <_> <_> 6 4 4 3 -1. <_> 6 5 4 1 3. <_> <_> 16 7 4 2 -1. <_> 16 7 2 1 2. <_> 18 8 2 1 2. <_> <_> 5 17 1 3 -1. <_> 5 18 1 1 3. <_> <_> 2 0 15 20 -1. <_> 2 10 15 10 2. <_> <_> 8 11 6 4 -1. <_> 8 11 3 2 2. <_> 11 13 3 2 2. <_> <_> 8 16 4 3 -1. <_> 8 17 4 1 3. <_> <_> 8 18 2 2 -1. <_> 8 18 1 1 2. <_> 9 19 1 1 2. <_> <_> 2 16 13 3 -1. <_> 2 17 13 1 3. <_> <_> 16 16 2 2 -1. <_> 16 16 1 1 2. <_> 17 17 1 1 2. <_> <_> 8 1 6 3 -1. <_> 10 1 2 3 3. <_> <_> 16 7 2 2 -1. <_> 16 7 1 1 2. <_> 17 8 1 1 2. <_> <_> 14 7 4 2 -1. <_> 14 7 2 1 2. <_> 16 8 2 1 2. <_> <_> 4 0 14 1 -1. <_> 11 0 7 1 2. <_> <_> 10 4 8 2 -1. <_> 10 4 4 1 2. <_> 14 5 4 1 2. <_> <_> 8 2 3 2 -1. <_> 9 2 1 2 3. <_> <_> 12 11 6 3 -1. <_> 12 12 6 1 3. <_> <_> 1 5 1 4 -1. <_> 1 7 1 2 2. <_> <_> 1 1 1 18 -1. <_> 1 7 1 6 3. <_> <_> 11 13 3 2 -1. <_> 11 14 3 1 2. <_> <_> 0 1 12 2 -1. <_> 0 1 6 1 2. <_> 6 2 6 1 2. <_> <_> 10 18 2 2 -1. <_> 10 18 1 1 2. <_> 11 19 1 1 2. <_> <_> 4 5 4 4 -1. <_> 4 5 2 2 2. <_> 6 7 2 2 2. <_> <_> 6 7 1 3 -1. <_> 6 8 1 1 3. <_> <_> 14 10 6 2 -1. <_> 16 10 2 2 3. <_> <_> 16 8 3 6 -1. <_> 17 8 1 6 3. <_> <_> 4 10 6 2 -1. <_> 6 10 2 2 3. <_> <_> 6 5 3 7 -1. <_> 7 5 1 7 3. <_> <_> 0 13 6 6 -1. <_> 0 16 6 3 2. <_> <_> 12 5 1 9 -1. <_> 12 8 1 3 3. <_> <_> 5 9 3 3 -1. <_> 6 9 1 3 3. <_> <_> 7 5 6 13 -1. <_> 9 5 2 13 3. <_> <_> 19 8 1 10 -1. <_> 19 13 1 5 2. <_> <_> 11 18 6 1 -1. <_> 13 18 2 1 3. <_> <_> 9 7 6 12 -1. <_> 11 7 2 12 3. <_> <_> 12 7 6 6 -1. <_> 14 7 2 6 3. <_> <_> 15 8 3 4 -1. <_> 16 8 1 4 3. <_> <_> 6 11 4 2 -1. <_> 6 12 4 1 2. <_> <_> 1 6 6 8 -1. <_> 3 6 2 8 3. <_> <_> 11 15 6 5 -1. <_> 13 15 2 5 3. <_> <_> 15 17 4 2 -1. <_> 15 18 4 1 2. <_> <_> 13 11 6 1 -1. <_> 15 11 2 1 3. <_> <_> 5 18 2 2 -1. <_> 5 18 1 1 2. <_> 6 19 1 1 2. <_> <_> 4 8 4 4 -1. <_> 4 8 2 2 2. <_> 6 10 2 2 2. <_> <_> 11 7 9 3 -1. <_> 11 8 9 1 3. <_> <_> 0 3 10 4 -1. <_> 0 3 5 2 2. <_> 5 5 5 2 2. <_> <_> 7 18 6 1 -1. <_> 9 18 2 1 3. <_> <_> 0 8 3 3 -1. <_> 0 9 3 1 3. <_> <_> 0 0 6 8 -1. <_> 0 0 3 4 2. <_> 3 4 3 4 2. <_> <_> 7 6 3 8 -1. <_> 8 6 1 8 3. <_> <_> 13 7 7 3 -1. <_> 13 8 7 1 3. <_> <_> 3 3 2 2 -1. <_> 3 4 2 1 2. <_> <_> 0 3 3 3 -1. <_> 0 4 3 1 3. <_> <_> 9 3 5 2 -1. <_> 9 4 5 1 2. <_> <_> 6 5 9 4 -1. <_> 9 5 3 4 3. <_> <_> 3 10 12 3 -1. <_> 7 10 4 3 3. <_> <_> 8 7 3 6 -1. <_> 9 7 1 6 3. <_> <_> 5 5 6 5 -1. <_> 8 5 3 5 2. <_> <_> 0 5 2 3 -1. <_> 0 6 2 1 3. <_> <_> 9 7 3 4 -1. <_> 10 7 1 4 3. <_> <_> 1 0 6 15 -1. <_> 3 0 2 15 3. <_> <_> 15 1 3 5 -1. <_> 16 1 1 5 3. <_> <_> 9 2 3 10 -1. <_> 10 2 1 10 3. <_> <_> 8 8 6 12 -1. <_> 10 8 2 12 3. <_> <_> 16 4 3 4 -1. <_> 16 6 3 2 2. <_> <_> 16 7 2 2 -1. <_> 16 7 1 1 2. <_> 17 8 1 1 2. <_> <_> 13 0 6 9 -1. <_> 13 3 6 3 3. <_> <_> 7 17 1 3 -1. <_> 7 18 1 1 3. <_> <_> 12 1 4 2 -1. <_> 12 2 4 1 2. <_> <_> 17 3 1 3 -1. <_> 17 4 1 1 3. <_> <_> 0 16 9 3 -1. <_> 0 17 9 1 3. <_> <_> 3 6 2 4 -1. <_> 3 6 1 2 2. <_> 4 8 1 2 2. <_> <_> 13 18 3 1 -1. <_> 14 18 1 1 3. <_> <_> 0 18 4 2 -1. <_> 2 18 2 2 2. <_> <_> 1 19 2 1 -1. <_> 2 19 1 1 2. <_> <_> 0 18 4 2 -1. <_> 0 19 4 1 2. <_> <_> 2 17 1 3 -1. <_> 2 18 1 1 3. <_> <_> 4 8 3 5 -1. <_> 5 8 1 5 3. <_> <_> 2 1 6 7 -1. <_> 4 1 2 7 3. <_> <_> 3 6 2 8 -1. <_> 3 6 1 4 2. <_> 4 10 1 4 2. <_> <_> 4 5 11 10 -1. <_> 4 10 11 5 2. <_> <_> 0 13 20 2 -1. <_> 10 13 10 2 2. <_> <_> 1 13 16 3 -1. <_> 9 13 8 3 2. <_> <_> 16 4 4 4 -1. <_> 16 4 2 2 2. <_> 18 6 2 2 2. <_> <_> 16 0 4 12 -1. <_> 16 0 2 6 2. <_> 18 6 2 6 2. <_> <_> 14 15 3 1 -1. <_> 15 15 1 1 3. <_> <_> 3 4 12 10 -1. <_> 3 9 12 5 2. <_> <_> 9 18 2 2 -1. <_> 9 18 1 1 2. <_> 10 19 1 1 2. <_> <_> 9 18 2 2 -1. <_> 9 18 1 1 2. <_> 10 19 1 1 2. <_> <_> 13 4 2 14 -1. <_> 13 4 1 7 2. <_> 14 11 1 7 2. <_> <_> 4 2 6 4 -1. <_> 7 2 3 4 2. <_> <_> 0 0 18 20 -1. <_> 0 0 9 10 2. <_> 9 10 9 10 2. <_> <_> 15 11 1 2 -1. <_> 15 12 1 1 2. <_> <_> 16 10 2 4 -1. <_> 16 10 1 2 2. <_> 17 12 1 2 2. <_> <_> 18 17 2 2 -1. <_> 18 17 1 1 2. <_> 19 18 1 1 2. <_> <_> 9 17 1 2 -1. <_> 9 18 1 1 2. <_> <_> 8 4 9 6 -1. <_> 11 4 3 6 3. <_> <_> 6 9 9 10 -1. <_> 9 9 3 10 3. <_> <_> 5 0 5 4 -1. <_> 5 2 5 2 2. <_> <_> 5 7 11 4 -1. <_> 5 9 11 2 2. <_> <_> 2 4 2 14 -1. <_> 3 4 1 14 2. <_> <_> 8 6 3 5 -1. <_> 9 6 1 5 3. <_> <_> 8 4 3 9 -1. <_> 9 4 1 9 3. <_> <_> 0 8 20 6 -1. <_> 0 10 20 2 3. <_> <_> 14 16 6 1 -1. <_> 17 16 3 1 2. <_> <_> 17 18 2 2 -1. <_> 17 19 2 1 2. <_> <_> 8 17 6 3 -1. <_> 10 17 2 3 3. <_> <_> 4 1 9 15 -1. <_> 7 1 3 15 3. <_> <_> 11 5 3 12 -1. <_> 12 5 1 12 3. <_> <_> 0 15 4 3 -1. <_> 0 16 4 1 3. <_> <_> 0 0 15 1 -1. <_> 5 0 5 1 3. <_> <_> 6 0 6 4 -1. <_> 8 0 2 4 3. <_> <_> 2 0 9 3 -1. <_> 5 0 3 3 3. <_> <_> 13 6 3 7 -1. <_> 14 6 1 7 3. <_> <_> 7 6 4 2 -1. <_> 7 7 4 1 2. <_> <_> 6 18 6 1 -1. <_> 8 18 2 1 3. <_> <_> 18 6 2 2 -1. <_> 18 7 2 1 2. <_> <_> 6 4 7 3 -1. <_> 6 5 7 1 3. <_> <_> 12 7 3 1 -1. <_> 13 7 1 1 3. <_> <_> 15 1 2 10 -1. <_> 15 1 1 5 2. <_> 16 6 1 5 2. <_> <_> 0 18 2 2 -1. <_> 0 19 2 1 2. <_> <_> 19 4 1 8 -1. <_> 19 8 1 4 2. <_> <_> 1 17 1 3 -1. <_> 1 18 1 1 3. <_> <_> 0 15 6 4 -1. <_> 0 15 3 2 2. <_> 3 17 3 2 2. <_> <_> 19 0 1 18 -1. <_> 19 6 1 6 3. <_> <_> 10 2 6 2 -1. <_> 12 2 2 2 3. <_> <_> 2 8 12 2 -1. <_> 6 8 4 2 3. <_> <_> 16 0 4 1 -1. <_> 18 0 2 1 2. <_> <_> 8 4 2 6 -1. <_> 8 7 2 3 2. <_> <_> 14 5 2 10 -1. <_> 15 5 1 10 2. <_> <_> 13 4 2 2 -1. <_> 13 5 2 1 2. <_> <_> 11 1 3 6 -1. <_> 11 3 3 2 3. <_> <_> 6 9 12 2 -1. <_> 10 9 4 2 3. <_> <_> 9 16 4 2 -1. <_> 9 17 4 1 2. <_> <_> 5 14 15 4 -1. <_> 5 16 15 2 2. <_> <_> 18 16 2 2 -1. <_> 18 17 2 1 2. <_> <_> 16 18 2 2 -1. <_> 16 18 1 1 2. <_> 17 19 1 1 2. <_> <_> 6 4 3 8 -1. <_> 7 4 1 8 3. <_> <_> 5 9 3 1 -1. <_> 6 9 1 1 3. <_> <_> 0 8 1 6 -1. <_> 0 10 1 2 3. <_> <_> 11 2 9 6 -1. <_> 14 2 3 6 3. <_> <_> 12 2 6 4 -1. <_> 14 2 2 4 3. <_> <_> 1 7 2 4 -1. <_> 1 9 2 2 2. <_> <_> 13 1 6 4 -1. <_> 13 3 6 2 2. <_> <_> 4 10 2 10 -1. <_> 4 10 1 5 2. <_> 5 15 1 5 2. <_> <_> 2 16 9 3 -1. <_> 5 16 3 3 3. <_> <_> 1 2 3 9 -1. <_> 2 2 1 9 3. <_> <_> 19 7 1 4 -1. <_> 19 9 1 2 2. <_> <_> 14 11 6 8 -1. <_> 14 11 3 4 2. <_> 17 15 3 4 2. <_> <_> 15 12 4 6 -1. <_> 15 12 2 3 2. <_> 17 15 2 3 2. <_> <_> 16 15 2 2 -1. <_> 16 15 1 1 2. <_> 17 16 1 1 2. <_> <_> 17 16 2 2 -1. <_> 17 16 1 1 2. <_> 18 17 1 1 2. <_> <_> 17 16 2 2 -1. <_> 17 16 1 1 2. <_> 18 17 1 1 2. <_> <_> 2 3 2 2 -1. <_> 2 3 1 1 2. <_> 3 4 1 1 2. <_> <_> 10 10 3 3 -1. <_> 11 10 1 3 3. <_> <_> 5 9 7 8 -1. <_> 5 13 7 4 2. <_> <_> 7 16 2 2 -1. <_> 7 16 1 1 2. <_> 8 17 1 1 2. <_> <_> 7 16 2 2 -1. <_> 7 16 1 1 2. <_> 8 17 1 1 2. <_> <_> 9 8 10 3 -1. <_> 14 8 5 3 2. <_> <_> 6 7 4 8 -1. <_> 6 7 2 4 2. <_> 8 11 2 4 2. <_> <_> 1 6 4 3 -1. <_> 1 7 4 1 3. <_> <_> 6 10 6 10 -1. <_> 8 10 2 10 3. <_> <_> 4 6 3 6 -1. <_> 5 6 1 6 3. <_> <_> 3 10 4 4 -1. <_> 3 10 2 2 2. <_> 5 12 2 2 2. <_> <_> 3 10 4 4 -1. <_> 3 10 2 2 2. <_> 5 12 2 2 2. <_> <_> 3 10 4 4 -1. <_> 3 10 2 2 2. <_> 5 12 2 2 2. <_> <_> 14 8 2 6 -1. <_> 15 8 1 6 2. <_> <_> 3 10 4 4 -1. <_> 3 10 2 2 2. <_> 5 12 2 2 2. <_> <_> 3 10 4 4 -1. <_> 3 10 2 2 2. <_> 5 12 2 2 2. <_> <_> 12 4 3 9 -1. <_> 13 4 1 9 3. <_> <_> 12 3 1 12 -1. <_> 12 7 1 4 3. <_> <_> 2 0 18 1 -1. <_> 8 0 6 1 3. <_> <_> 10 0 10 6 -1. <_> 10 0 5 3 2. <_> 15 3 5 3 2. <_> <_> 18 16 2 2 -1. <_> 18 17 2 1 2. <_> <_> 3 5 4 2 -1. <_> 3 5 2 1 2. <_> 5 6 2 1 2. <_> <_> 11 8 3 3 -1. <_> 12 8 1 3 3. <_> <_> 11 7 3 5 -1. <_> 12 7 1 5 3. <_> <_> 3 19 15 1 -1. <_> 8 19 5 1 3. <_> <_> 8 13 3 2 -1. <_> 8 14 3 1 2. <_> <_> 2 12 8 4 -1. <_> 2 12 4 2 2. <_> 6 14 4 2 2. <_> <_> 16 16 2 2 -1. <_> 16 16 1 1 2. <_> 17 17 1 1 2. <_> <_> 7 0 3 2 -1. <_> 8 0 1 2 3. <_> <_> 6 7 2 5 -1. <_> 7 7 1 5 2. <_> <_> 18 0 2 17 -1. <_> 19 0 1 17 2. <_> <_> 16 16 1 3 -1. <_> 16 17 1 1 3. <_> <_> 14 8 3 7 -1. <_> 15 8 1 7 3. <_> <_> 10 17 2 2 -1. <_> 10 17 1 1 2. <_> 11 18 1 1 2. <_> <_> 4 9 1 3 -1. <_> 4 10 1 1 3. <_> <_> 18 10 2 3 -1. <_> 18 11 2 1 3. <_> <_> 12 1 3 10 -1. <_> 13 1 1 10 3. <_> <_> 8 12 9 1 -1. <_> 11 12 3 1 3. <_> <_> 5 18 2 2 -1. <_> 5 18 1 1 2. <_> 6 19 1 1 2. <_> <_> 19 6 1 9 -1. <_> 19 9 1 3 3. <_> <_> 4 7 2 4 -1. <_> 4 7 1 2 2. <_> 5 9 1 2 2. <_> <_> 1 4 6 14 -1. <_> 3 4 2 14 3. <_> <_> 10 5 9 3 -1. <_> 13 5 3 3 3. <_> <_> 18 7 2 6 -1. <_> 18 9 2 2 3. <_> <_> 5 6 2 7 -1. <_> 6 6 1 7 2. <_> <_> 10 4 6 8 -1. <_> 13 4 3 8 2. <_> <_> 0 8 2 9 -1. <_> 0 11 2 3 3. <_> <_> 0 7 5 3 -1. <_> 0 8 5 1 3. <_> <_> 8 1 7 2 -1. <_> 8 2 7 1 2. <_> <_> 7 5 3 5 -1. <_> 8 5 1 5 3. <_> <_> 19 2 1 2 -1. <_> 19 3 1 1 2. <_> <_> 6 7 10 11 -1. <_> 11 7 5 11 2. <_> <_> 9 19 6 1 -1. <_> 11 19 2 1 3. <_> <_> 3 0 12 1 -1. <_> 7 0 4 1 3. <_> <_> 4 1 6 5 -1. <_> 6 1 2 5 3. <_> <_> 6 12 12 6 -1. <_> 10 12 4 6 3. <_> <_> 16 13 2 3 -1. <_> 16 14 2 1 3. <_> <_> 7 14 4 2 -1. <_> 7 15 4 1 2. <_> <_> 7 14 2 2 -1. <_> 7 15 2 1 2. <_> <_> 3 10 2 4 -1. <_> 3 10 1 2 2. <_> 4 12 1 2 2. <_> <_> 0 3 2 6 -1. <_> 0 5 2 2 3. <_> <_> 1 10 2 2 -1. <_> 1 10 1 1 2. <_> 2 11 1 1 2. <_> <_> 16 4 4 3 -1. <_> 16 5 4 1 3. <_> <_> 5 10 2 4 -1. <_> 5 10 1 2 2. <_> 6 12 1 2 2. <_> <_> 5 11 13 2 -1. <_> 5 12 13 1 2. <_> <_> 10 2 3 11 -1. <_> 11 2 1 11 3. <_> <_> 10 2 4 4 -1. <_> 10 4 4 2 2. <_> <_> 8 8 6 2 -1. <_> 10 8 2 2 3. <_> <_> 11 2 3 3 -1. <_> 12 2 1 3 3. <_> <_> 6 18 14 2 -1. <_> 6 18 7 1 2. <_> 13 19 7 1 2. <_> <_> 17 7 1 12 -1. <_> 17 11 1 4 3. <_> <_> 10 5 10 3 -1. <_> 10 6 10 1 3. <_> <_> 6 1 3 3 -1. <_> 7 1 1 3 3. <_> <_> 13 8 3 1 -1. <_> 14 8 1 1 3. <_> <_> 10 14 2 6 -1. <_> 10 16 2 2 3. <_> <_> 4 1 12 14 -1. <_> 8 1 4 14 3. <_> <_> 14 1 6 14 -1. <_> 16 1 2 14 3. <_> <_> 3 16 2 2 -1. <_> 3 16 1 1 2. <_> 4 17 1 1 2. <_> <_> 0 16 2 2 -1. <_> 0 17 2 1 2. <_> <_> 15 6 4 6 -1. <_> 15 6 2 3 2. <_> 17 9 2 3 2. <_> <_> 12 5 2 2 -1. <_> 12 6 2 1 2. <_> <_> 7 6 6 13 -1. <_> 9 6 2 13 3. <_> <_> 1 9 6 5 -1. <_> 3 9 2 5 3. <_> <_> 0 5 3 4 -1. <_> 0 7 3 2 2. <_> <_> 4 1 16 2 -1. <_> 4 1 8 1 2. <_> 12 2 8 1 2. <_> <_> 1 18 4 2 -1. <_> 1 18 2 1 2. <_> 3 19 2 1 2. <_> <_> 7 7 3 4 -1. <_> 8 7 1 4 3. <_> <_> 3 4 9 3 -1. <_> 6 4 3 3 3. <_> <_> 4 6 6 10 -1. <_> 6 6 2 10 3. <_> <_> 9 0 8 10 -1. <_> 13 0 4 10 2. <_> <_> 8 0 8 1 -1. <_> 12 0 4 1 2. <_> <_> 6 2 8 16 -1. <_> 6 2 4 8 2. <_> 10 10 4 8 2. <_> <_> 14 10 2 10 -1. <_> 14 10 1 5 2. <_> 15 15 1 5 2. <_> <_> 12 11 1 2 -1. <_> 12 12 1 1 2. <_> <_> 16 0 3 8 -1. <_> 17 0 1 8 3. <_> <_> 14 0 6 10 -1. <_> 17 0 3 10 2. <_> <_> 16 0 3 5 -1. <_> 17 0 1 5 3. <_> <_> 4 5 11 2 -1. <_> 4 6 11 1 2. <_> <_> 1 0 2 1 -1. <_> 2 0 1 1 2. <_> <_> 0 0 2 3 -1. <_> 0 1 2 1 3. <_> <_> 11 6 6 11 -1. <_> 13 6 2 11 3. <_> <_> 14 0 3 1 -1. <_> 15 0 1 1 3. <_> <_> 19 7 1 2 -1. <_> 19 8 1 1 2. <_> <_> 17 0 3 9 -1. <_> 18 0 1 9 3. <_> <_> 12 7 3 4 -1. <_> 13 7 1 4 3. <_> <_> 0 1 14 2 -1. <_> 0 1 7 1 2. <_> 7 2 7 1 2. <_> <_> 3 1 3 2 -1. <_> 4 1 1 2 3. <_> <_> 4 0 15 2 -1. <_> 9 0 5 2 3. <_> <_> 10 2 6 1 -1. <_> 12 2 2 1 3. <_> <_> 9 4 6 11 -1. <_> 11 4 2 11 3. <_> <_> 2 16 2 4 -1. <_> 2 18 2 2 2. <_> <_> 6 17 6 3 -1. <_> 8 17 2 3 3. <_> <_> 7 9 6 2 -1. <_> 9 9 2 2 3. <_> <_> 6 8 9 2 -1. <_> 9 8 3 2 3. <_> <_> 6 6 2 10 -1. <_> 6 6 1 5 2. <_> 7 11 1 5 2. <_> <_> 0 11 2 3 -1. <_> 0 12 2 1 3. <_> <_> 11 15 4 1 -1. <_> 13 15 2 1 2. <_> <_> 6 17 1 2 -1. <_> 6 18 1 1 2. <_> <_> 0 0 6 20 -1. <_> 2 0 2 20 3. <_> <_> 3 10 2 2 -1. <_> 4 10 1 2 2. <_> <_> 4 7 3 5 -1. <_> 5 7 1 5 3. <_> <_> 3 12 6 2 -1. <_> 5 12 2 2 3. <_> <_> 6 15 7 4 -1. <_> 6 17 7 2 2. <_> <_> 17 16 2 2 -1. <_> 17 16 1 1 2. <_> 18 17 1 1 2. <_> <_> 15 1 3 16 -1. <_> 16 1 1 16 3. <_> <_> 6 16 6 3 -1. <_> 8 16 2 3 3. <_> <_> 15 14 3 2 -1. <_> 15 15 3 1 2. <_> <_> 12 16 1 2 -1. <_> 12 17 1 1 2. <_> <_> 0 2 4 4 -1. <_> 0 2 2 2 2. <_> 2 4 2 2 2. <_> <_> 1 1 6 4 -1. <_> 1 1 3 2 2. <_> 4 3 3 2 2. <_> <_> 1 18 1 2 -1. <_> 1 19 1 1 2. <_> <_> 4 7 2 3 -1. <_> 4 8 2 1 3. <_> <_> 1 0 9 14 -1. <_> 1 7 9 7 2. <_> <_> 4 9 2 6 -1. <_> 4 9 1 3 2. <_> 5 12 1 3 2. <_> <_> 3 9 4 3 -1. <_> 5 9 2 3 2. <_> <_> 0 9 2 4 -1. <_> 0 11 2 2 2. <_> <_> 16 6 3 10 -1. <_> 17 6 1 10 3. <_> <_> 16 11 2 1 -1. <_> 17 11 1 1 2. <_> <_> 5 7 4 4 -1. <_> 5 9 4 2 2. <_> <_> 10 11 9 2 -1. <_> 13 11 3 2 3. <_> <_> 15 10 2 2 -1. <_> 15 10 1 1 2. <_> 16 11 1 1 2. <_> <_> 10 6 6 14 -1. <_> 10 13 6 7 2. <_> <_> 14 7 3 5 -1. <_> 15 7 1 5 3. <_> <_> 6 11 12 3 -1. <_> 10 11 4 3 3. <_> <_> 17 16 1 2 -1. <_> 17 17 1 1 2. <_> <_> 8 5 5 4 -1. <_> 8 7 5 2 2. <_> <_> 11 6 4 2 -1. <_> 11 7 4 1 2. <_> <_> 3 4 8 2 -1. <_> 3 4 4 1 2. <_> 7 5 4 1 2. <_> <_> 0 8 6 6 -1. <_> 2 8 2 6 3. <_> <_> 7 4 6 2 -1. <_> 7 5 6 1 2. <_> <_> 7 3 6 3 -1. <_> 9 3 2 3 3. <_> <_> 2 17 3 3 -1. <_> 2 18 3 1 3. <_> <_> 3 10 6 1 -1. <_> 5 10 2 1 3. <_> <_> 7 2 6 2 -1. <_> 9 2 2 2 3. <_> <_> 4 11 9 1 -1. <_> 7 11 3 1 3. <_> <_> 7 7 11 12 -1. <_> 7 13 11 6 2. <_> <_> 3 2 3 4 -1. <_> 4 2 1 4 3. <_> <_> 9 7 9 3 -1. <_> 12 7 3 3 3. <_> <_> 15 11 2 6 -1. <_> 15 11 1 3 2. <_> 16 14 1 3 2. <_> <_> 0 5 5 3 -1. <_> 0 6 5 1 3. <_> <_> 8 1 6 12 -1. <_> 10 1 2 12 3. <_> <_> 3 7 15 13 -1. <_> 8 7 5 13 3. <_> <_> 0 9 9 9 -1. <_> 0 12 9 3 3. <_> <_> 16 0 3 8 -1. <_> 17 0 1 8 3. <_> <_> 16 2 4 2 -1. <_> 18 2 2 2 2. <_> <_> 13 0 6 5 -1. <_> 16 0 3 5 2. <_> <_> 15 1 3 2 -1. <_> 16 1 1 2 3. <_> <_> 11 8 3 2 -1. <_> 12 8 1 2 3. <_> <_> 1 8 2 12 -1. <_> 1 8 1 6 2. <_> 2 14 1 6 2. <_> <_> 0 1 6 12 -1. <_> 2 1 2 12 3. <_> <_> 19 17 1 3 -1. <_> 19 18 1 1 3. <_> <_> 11 3 3 10 -1. <_> 12 3 1 10 3. <_> <_> 8 1 9 8 -1. <_> 11 1 3 8 3. <_> <_> 18 16 2 2 -1. <_> 18 16 1 1 2. <_> 19 17 1 1 2. <_> <_> 18 16 2 2 -1. <_> 18 16 1 1 2. <_> 19 17 1 1 2. <_> <_> 6 13 2 6 -1. <_> 6 15 2 2 3. <_> <_> 9 14 2 2 -1. <_> 9 15 2 1 2. <_> <_> 14 10 2 4 -1. <_> 14 10 1 2 2. <_> 15 12 1 2 2. <_> <_> 0 15 2 2 -1. <_> 0 15 1 1 2. <_> 1 16 1 1 2. <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. <_> <_> 11 18 2 2 -1. <_> 11 18 1 1 2. <_> 12 19 1 1 2. <_> <_> 0 0 6 4 -1. <_> 0 0 3 2 2. <_> 3 2 3 2 2. <_> <_> 4 1 6 6 -1. <_> 6 1 2 6 3. <_> <_> 15 13 5 4 -1. <_> 15 15 5 2 2. <_> <_> 7 17 6 1 -1. <_> 9 17 2 1 3. <_> <_> 16 19 4 1 -1. <_> 18 19 2 1 2. <_> <_> 16 16 4 4 -1. <_> 18 16 2 4 2. <_> <_> 7 8 9 4 -1. <_> 10 8 3 4 3. <_> <_> 16 18 2 2 -1. <_> 16 18 1 1 2. <_> 17 19 1 1 2. <_> <_> 2 9 2 4 -1. <_> 2 9 1 2 2. <_> 3 11 1 2 2. <_> <_> 0 3 8 4 -1. <_> 0 3 4 2 2. <_> 4 5 4 2 2. <_> <_> 0 1 8 1 -1. <_> 4 1 4 1 2. <_> <_> 0 5 8 9 -1. <_> 4 5 4 9 2. <_> <_> 7 18 6 2 -1. <_> 9 18 2 2 3. <_> <_> 0 4 1 12 -1. <_> 0 8 1 4 3. <_> <_> 19 13 1 6 -1. <_> 19 15 1 2 3. <_> <_> 2 8 6 8 -1. <_> 4 8 2 8 3. <_> <_> 0 0 9 17 -1. <_> 3 0 3 17 3. <_> <_> 7 9 6 8 -1. <_> 9 9 2 8 3. <_> <_> 5 10 9 4 -1. <_> 8 10 3 4 3. <_> <_> 5 0 8 3 -1. <_> 5 1 8 1 3. <_> <_> 16 6 4 4 -1. <_> 16 6 2 2 2. <_> 18 8 2 2 2. <_> <_> 17 4 2 8 -1. <_> 17 4 1 4 2. <_> 18 8 1 4 2. <_> <_> 2 16 1 3 -1. <_> 2 17 1 1 3. <_> <_> 2 16 1 3 -1. <_> 2 17 1 1 3. <_> <_> 11 0 1 3 -1. <_> 11 1 1 1 3. <_> <_> 11 2 9 7 -1. <_> 14 2 3 7 3. <_> <_> 10 2 3 6 -1. <_> 11 2 1 6 3. <_> <_> 5 9 15 2 -1. <_> 5 10 15 1 2. <_> <_> 8 16 6 2 -1. <_> 8 17 6 1 2. <_> <_> 9 16 10 2 -1. <_> 9 16 5 1 2. <_> 14 17 5 1 2. <_> <_> 9 17 2 2 -1. <_> 9 17 1 1 2. <_> 10 18 1 1 2. <_> <_> 10 15 6 4 -1. <_> 10 15 3 2 2. <_> 13 17 3 2 2. <_> <_> 4 5 15 12 -1. <_> 9 5 5 12 3. <_> <_> 11 13 2 3 -1. <_> 11 14 2 1 3. <_> <_> 8 13 7 3 -1. <_> 8 14 7 1 3. <_> <_> 1 12 1 2 -1. <_> 1 13 1 1 2. <_> <_> 16 18 2 2 -1. <_> 16 18 1 1 2. <_> 17 19 1 1 2. <_> <_> 1 19 18 1 -1. <_> 7 19 6 1 3. <_> <_> 1 17 6 1 -1. <_> 4 17 3 1 2. <_> <_> 1 3 1 12 -1. <_> 1 9 1 6 2. <_> <_> 0 9 3 6 -1. <_> 0 11 3 2 3. <_> <_> 5 4 3 10 -1. <_> 6 4 1 10 3. <_> <_> 6 17 2 1 -1. <_> 7 17 1 1 2. <_> <_> 1 0 6 12 -1. <_> 3 0 2 12 3. <_> <_> 4 7 9 2 -1. <_> 7 7 3 2 3. <_> <_> 6 11 9 1 -1. <_> 9 11 3 1 3. <_> <_> 17 10 2 10 -1. <_> 17 15 2 5 2. <_> <_> 4 10 2 10 -1. <_> 4 10 1 5 2. <_> 5 15 1 5 2. <_> <_> 12 3 3 12 -1. <_> 13 3 1 12 3. <_> <_> 15 3 4 6 -1. <_> 15 3 2 3 2. <_> 17 6 2 3 2. <_> <_> 12 8 3 3 -1. <_> 13 8 1 3 3. <_> <_> 4 14 2 4 -1. <_> 4 16 2 2 2. <_> <_> 6 16 1 3 -1. <_> 6 17 1 1 3. <_> <_> 1 1 2 3 -1. <_> 2 1 1 3 2. <_> <_> 0 2 4 1 -1. <_> 2 2 2 1 2. <_> <_> 8 17 12 3 -1. <_> 12 17 4 3 3. <_> <_> 9 16 6 4 -1. <_> 11 16 2 4 3. <_> <_> 4 6 3 6 -1. <_> 4 9 3 3 2. <_> <_> 6 2 12 9 -1. <_> 6 5 12 3 3. <_> <_> 6 0 14 20 -1. <_> 6 0 7 10 2. <_> 13 10 7 10 2. <_> <_> 15 16 2 2 -1. <_> 15 16 1 1 2. <_> 16 17 1 1 2. <_> <_> 15 16 2 2 -1. <_> 15 16 1 1 2. <_> 16 17 1 1 2. <_> <_> 19 8 1 3 -1. <_> 19 9 1 1 3. <_> <_> 13 4 1 2 -1. <_> 13 5 1 1 2. <_> <_> 0 4 4 2 -1. <_> 0 5 4 1 2. <_> <_> 19 5 1 6 -1. <_> 19 7 1 2 3. <_> <_> 16 0 2 1 -1. <_> 17 0 1 1 2. <_> <_> 13 1 1 3 -1. <_> 13 2 1 1 3. <_> <_> 17 17 1 3 -1. <_> 17 18 1 1 3. <_> <_> 5 4 8 8 -1. <_> 5 4 4 4 2. <_> 9 8 4 4 2. <_> <_> 1 2 2 2 -1. <_> 1 2 1 1 2. <_> 2 3 1 1 2. <_> <_> 0 0 8 6 -1. <_> 0 0 4 3 2. <_> 4 3 4 3 2. <_> <_> 6 3 4 2 -1. <_> 6 4 4 1 2. <_> <_> 1 0 3 3 -1. <_> 1 1 3 1 3. <_> <_> 6 1 7 2 -1. <_> 6 2 7 1 2. <_> <_> 2 6 12 6 -1. <_> 6 6 4 6 3. <_> <_> 1 16 9 2 -1. <_> 4 16 3 2 3. <_> <_> 7 15 6 4 -1. <_> 9 15 2 4 3. <_> <_> 6 15 12 1 -1. <_> 12 15 6 1 2. <_> <_> 17 17 1 3 -1. <_> 17 18 1 1 3. <_> <_> 17 15 2 2 -1. <_> 17 15 1 1 2. <_> 18 16 1 1 2. <_> <_> 3 13 3 3 -1. <_> 3 14 3 1 3. <_> <_> 10 17 1 3 -1. <_> 10 18 1 1 3. <_> <_> 4 0 14 8 -1. <_> 11 0 7 8 2. <_> <_> 2 0 12 2 -1. <_> 6 0 4 2 3. <_> <_> 2 0 4 3 -1. <_> 4 0 2 3 2. <_> <_> 13 1 1 2 -1. <_> 13 2 1 1 2. <_> <_> 7 5 3 6 -1. <_> 8 5 1 6 3. <_> <_> 18 2 2 2 -1. <_> 18 2 1 1 2. <_> 19 3 1 1 2. <_> <_> 15 1 2 14 -1. <_> 16 1 1 14 2. <_> <_> 15 6 2 2 -1. <_> 15 6 1 1 2. <_> 16 7 1 1 2. <_> <_> 3 1 6 3 -1. <_> 5 1 2 3 3. <_> <_> 7 16 2 2 -1. <_> 7 16 1 1 2. <_> 8 17 1 1 2. <_> <_> 5 17 2 2 -1. <_> 5 17 1 1 2. <_> 6 18 1 1 2. <_> <_> 9 10 6 10 -1. <_> 11 10 2 10 3. <_> <_> 10 17 6 3 -1. <_> 12 17 2 3 3. <_> <_> 14 5 2 10 -1. <_> 14 10 2 5 2. <_> <_> 11 12 6 2 -1. <_> 11 13 6 1 2. <_> <_> 8 1 1 3 -1. <_> 8 2 1 1 3. <_> <_> 12 15 2 2 -1. <_> 12 15 1 1 2. <_> 13 16 1 1 2. <_> <_> 6 8 6 4 -1. <_> 6 8 3 2 2. <_> 9 10 3 2 2. <_> <_> 7 5 3 5 -1. <_> 8 5 1 5 3. <_> <_> 0 5 7 3 -1. <_> 0 6 7 1 3. <_> <_> 7 9 6 6 -1. <_> 9 9 2 6 3. <_> <_> 5 7 8 8 -1. <_> 5 11 8 4 2. <_> <_> 4 9 2 6 -1. <_> 4 9 1 3 2. <_> 5 12 1 3 2. <_> <_> 10 11 6 1 -1. <_> 12 11 2 1 3. <_> <_> 13 6 6 11 -1. <_> 15 6 2 11 3. <_> <_> 8 17 2 2 -1. <_> 8 17 1 1 2. <_> 9 18 1 1 2. <_> <_> 4 12 12 1 -1. <_> 8 12 4 1 3. <_> <_> 11 17 3 2 -1. <_> 11 18 3 1 2. <_> <_> 8 17 6 1 -1. <_> 10 17 2 1 3. <_> <_> 4 1 14 6 -1. <_> 4 3 14 2 3. <_> <_> 14 2 2 12 -1. <_> 14 8 2 6 2. <_> <_> 12 13 3 2 -1. <_> 12 14 3 1 2. <_> <_> 6 1 6 1 -1. <_> 8 1 2 1 3. <_> <_> 10 6 6 1 -1. <_> 12 6 2 1 3. <_> <_> 3 19 2 1 -1. <_> 4 19 1 1 2. <_> <_> 18 16 2 2 -1. <_> 18 16 1 1 2. <_> 19 17 1 1 2. <_> <_> 16 11 3 7 -1. <_> 17 11 1 7 3. <_> <_> 19 5 1 6 -1. <_> 19 8 1 3 2. <_> <_> 9 8 4 3 -1. <_> 9 9 4 1 3. <_> <_> 16 8 4 4 -1. <_> 16 8 2 2 2. <_> 18 10 2 2 2. <_> <_> 2 8 2 2 -1. <_> 2 8 1 1 2. <_> 3 9 1 1 2. <_> <_> 3 5 6 4 -1. <_> 3 5 3 2 2. <_> 6 7 3 2 2. <_> <_> 2 3 8 16 -1. <_> 2 3 4 8 2. <_> 6 11 4 8 2. <_> <_> 17 17 1 3 -1. <_> 17 18 1 1 3. <_> <_> 7 2 8 11 -1. <_> 11 2 4 11 2. <_> <_> 13 3 6 14 -1. <_> 16 3 3 14 2. <_> <_> 0 9 18 2 -1. <_> 6 9 6 2 3. <_> <_> 6 10 14 3 -1. <_> 6 11 14 1 3. <_> <_> 10 9 9 3 -1. <_> 13 9 3 3 3. <_> <_> 3 5 4 6 -1. <_> 3 5 2 3 2. <_> 5 8 2 3 2. <_> <_> 3 7 3 7 -1. <_> 4 7 1 7 3. <_> <_> 2 8 11 6 -1. <_> 2 10 11 2 3. <_> <_> 8 9 6 3 -1. <_> 8 10 6 1 3. <_> <_> 3 3 3 11 -1. <_> 4 3 1 11 3. <_> <_> 0 19 6 1 -1. <_> 3 19 3 1 2. <_> <_> 18 18 1 2 -1. <_> 18 19 1 1 2. <_> <_> 8 0 12 6 -1. <_> 8 0 6 3 2. <_> 14 3 6 3 2. <_> <_> 19 5 1 3 -1. <_> 19 6 1 1 3. <_> <_> 5 8 2 1 -1. <_> 6 8 1 1 2. <_> <_> 13 11 2 1 -1. <_> 14 11 1 1 2. <_> <_> 3 6 15 13 -1. <_> 8 6 5 13 3. <_> <_> 4 3 6 2 -1. <_> 6 3 2 2 3. <_> <_> 0 18 1 2 -1. <_> 0 19 1 1 2. <_> <_> 7 8 2 6 -1. <_> 8 8 1 6 2. <_> <_> 3 0 6 19 -1. <_> 5 0 2 19 3. <_> <_> 3 1 6 5 -1. <_> 5 1 2 5 3. <_> <_> 17 14 3 6 -1. <_> 17 16 3 2 3. <_> <_> 17 13 2 6 -1. <_> 18 13 1 6 2. <_> <_> 17 18 2 2 -1. <_> 18 18 1 2 2. <_> <_> 11 14 9 4 -1. <_> 14 14 3 4 3. <_> <_> 15 8 4 6 -1. <_> 15 8 2 3 2. <_> 17 11 2 3 2. <_> <_> 1 16 1 3 -1. <_> 1 17 1 1 3. <_> <_> 7 0 3 14 -1. <_> 8 0 1 14 3. <_> <_> 12 0 2 1 -1. <_> 13 0 1 1 2. <_> <_> 7 9 6 5 -1. <_> 10 9 3 5 2. <_> <_> 15 5 4 9 -1. <_> 17 5 2 9 2. <_> <_> 11 0 6 6 -1. <_> 13 0 2 6 3. <_> <_> 16 15 2 2 -1. <_> 16 15 1 1 2. <_> 17 16 1 1 2. <_> <_> 16 15 2 2 -1. <_> 16 15 1 1 2. <_> 17 16 1 1 2. <_> <_> 13 2 2 18 -1. <_> 13 11 2 9 2. <_> <_> 8 4 8 10 -1. <_> 8 9 8 5 2. <_> <_> 8 3 2 3 -1. <_> 8 4 2 1 3. <_> <_> 11 1 6 9 -1. <_> 11 4 6 3 3. <_> <_> 15 4 5 6 -1. <_> 15 6 5 2 3. <_> <_> 12 18 2 2 -1. <_> 12 18 1 1 2. <_> 13 19 1 1 2. <_> <_> 1 17 1 3 -1. <_> 1 18 1 1 3. <_> <_> 12 19 2 1 -1. <_> 13 19 1 1 2. <_> <_> 8 10 6 6 -1. <_> 10 10 2 6 3. <_> <_> 14 2 6 5 -1. <_> 16 2 2 5 3. <_> <_> 9 5 2 6 -1. <_> 9 7 2 2 3. <_> <_> 1 15 2 2 -1. <_> 2 15 1 2 2. <_> <_> 18 17 1 3 -1. <_> 18 18 1 1 3. <_> <_> 10 14 4 6 -1. <_> 10 16 4 2 3. <_> <_> 9 7 3 2 -1. <_> 10 7 1 2 3. <_> <_> 6 9 6 2 -1. <_> 6 9 3 1 2. <_> 9 10 3 1 2. <_> <_> 0 2 1 12 -1. <_> 0 6 1 4 3. <_> <_> 4 0 15 1 -1. <_> 9 0 5 1 3. <_> <_> 9 0 8 2 -1. <_> 9 0 4 1 2. <_> 13 1 4 1 2. <_> <_> 12 2 8 1 -1. <_> 16 2 4 1 2. <_> <_> 7 1 10 6 -1. <_> 7 3 10 2 3. <_> <_> 18 6 2 3 -1. <_> 18 7 2 1 3. <_> <_> 4 12 2 2 -1. <_> 4 12 1 1 2. <_> 5 13 1 1 2. <_> <_> 6 6 6 2 -1. <_> 8 6 2 2 3. <_> <_> 0 9 9 6 -1. <_> 3 9 3 6 3. <_> <_> 17 18 2 2 -1. <_> 18 18 1 2 2. <_> <_> 11 2 6 16 -1. <_> 13 2 2 16 3. <_> <_> 2 4 15 13 -1. <_> 7 4 5 13 3. <_> <_> 16 2 3 10 -1. <_> 17 2 1 10 3. <_> <_> 6 10 2 1 -1. <_> 7 10 1 1 2. <_> <_> 1 1 18 16 -1. <_> 10 1 9 16 2. <_> <_> 14 4 3 15 -1. <_> 15 4 1 15 3. <_> <_> 19 13 1 2 -1. <_> 19 14 1 1 2. <_> <_> 2 6 5 8 -1. <_> 2 10 5 4 2. ================================================ FILE: OpenCVComponent/Assets/haarcascade_frontalface_alt.xml ================================================ BOOST HAAR 20 20 213 0 22 <_> 3 8.2268941402435303e-01 <_> 0 -1 0 4.0141958743333817e-03 3.3794190734624863e-02 8.3781069517135620e-01 <_> 0 -1 1 1.5151339583098888e-02 1.5141320228576660e-01 7.4888122081756592e-01 <_> 0 -1 2 4.2109931819140911e-03 9.0049281716346741e-02 6.3748198747634888e-01 <_> 16 6.9566087722778320e+00 <_> 0 -1 3 1.6227109590545297e-03 6.9308586418628693e-02 7.1109461784362793e-01 <_> 0 -1 4 2.2906649392098188e-03 1.7958030104637146e-01 6.6686922311782837e-01 <_> 0 -1 5 5.0025708042085171e-03 1.6936729848384857e-01 6.5540069341659546e-01 <_> 0 -1 6 7.9659894108772278e-03 5.8663320541381836e-01 9.1414518654346466e-02 <_> 0 -1 7 -3.5227010957896709e-03 1.4131669700145721e-01 6.0318958759307861e-01 <_> 0 -1 8 3.6667689681053162e-02 3.6756721138954163e-01 7.9203182458877563e-01 <_> 0 -1 9 9.3361474573612213e-03 6.1613857746124268e-01 2.0885099470615387e-01 <_> 0 -1 10 8.6961314082145691e-03 2.8362309932708740e-01 6.3602739572525024e-01 <_> 0 -1 11 1.1488880263641477e-03 2.2235809266567230e-01 5.8007007837295532e-01 <_> 0 -1 12 -2.1484689787030220e-03 2.4064640700817108e-01 5.7870548963546753e-01 <_> 0 -1 13 2.1219060290604830e-03 5.5596548318862915e-01 1.3622370362281799e-01 <_> 0 -1 14 -9.3949146568775177e-02 8.5027372837066650e-01 4.7177401185035706e-01 <_> 0 -1 15 1.3777789426967502e-03 5.9936738014221191e-01 2.8345298767089844e-01 <_> 0 -1 16 7.3063157498836517e-02 4.3418860435485840e-01 7.0600342750549316e-01 <_> 0 -1 17 3.6767389974556863e-04 3.0278879404067993e-01 6.0515749454498291e-01 <_> 0 -1 18 -6.0479710809886456e-03 1.7984339594841003e-01 5.6752568483352661e-01 <_> 21 9.4985427856445312e+00 <_> 0 -1 19 -1.6510689631104469e-02 6.6442251205444336e-01 1.4248579740524292e-01 <_> 0 -1 20 2.7052499353885651e-03 6.3253521919250488e-01 1.2884770333766937e-01 <_> 0 -1 21 2.8069869149476290e-03 1.2402880191802979e-01 6.1931931972503662e-01 <_> 0 -1 22 -1.5402400167658925e-03 1.4321430027484894e-01 5.6700158119201660e-01 <_> 0 -1 23 -5.6386279175058007e-04 1.6574330627918243e-01 5.9052079916000366e-01 <_> 0 -1 24 1.9253729842603207e-03 2.6955071091651917e-01 5.7388240098953247e-01 <_> 0 -1 25 -5.0214841030538082e-03 1.8935389816761017e-01 5.7827740907669067e-01 <_> 0 -1 26 2.6365420781075954e-03 2.3093290627002716e-01 5.6954258680343628e-01 <_> 0 -1 27 -1.5127769438549876e-03 2.7596020698547363e-01 5.9566420316696167e-01 <_> 0 -1 28 -1.0157439857721329e-02 1.7325380444526672e-01 5.5220472812652588e-01 <_> 0 -1 29 -1.1953660286962986e-02 1.3394099473953247e-01 5.5590140819549561e-01 <_> 0 -1 30 4.8859491944313049e-03 3.6287039518356323e-01 6.1888492107391357e-01 <_> 0 -1 31 -8.0132916569709778e-02 9.1211050748825073e-02 5.4759448766708374e-01 <_> 0 -1 32 1.0643280111253262e-03 3.7151429057121277e-01 5.7113999128341675e-01 <_> 0 -1 33 -1.3419450260698795e-03 5.9533137083053589e-01 3.3180978894233704e-01 <_> 0 -1 34 -5.4601140320301056e-02 1.8440659344196320e-01 5.6028461456298828e-01 <_> 0 -1 35 2.9071690514683723e-03 3.5942441225051880e-01 6.1317151784896851e-01 <_> 0 -1 36 7.4718717951327562e-04 5.9943532943725586e-01 3.4595629572868347e-01 <_> 0 -1 37 4.3013808317482471e-03 4.1726520657539368e-01 6.9908452033996582e-01 <_> 0 -1 38 4.5017572119832039e-03 4.5097151398658752e-01 7.8014570474624634e-01 <_> 0 -1 39 2.4138500913977623e-02 5.4382127523422241e-01 1.3198269903659821e-01 <_> 39 1.8412969589233398e+01 <_> 0 -1 40 1.9212230108678341e-03 1.4152669906616211e-01 6.1998707056045532e-01 <_> 0 -1 41 -1.2748669541906565e-04 6.1910742521286011e-01 1.8849289417266846e-01 <_> 0 -1 42 5.1409931620582938e-04 1.4873969554901123e-01 5.8579277992248535e-01 <_> 0 -1 43 4.1878609918057919e-03 2.7469098567962646e-01 6.3592398166656494e-01 <_> 0 -1 44 5.1015717908740044e-03 5.8708512783050537e-01 2.1756289899349213e-01 <_> 0 -1 45 -2.1448440384119749e-03 5.8809447288513184e-01 2.9795908927917480e-01 <_> 0 -1 46 -2.8977119363844395e-03 2.3733270168304443e-01 5.8766472339630127e-01 <_> 0 -1 47 -2.1610679104924202e-02 1.2206549942493439e-01 5.1942020654678345e-01 <_> 0 -1 48 -4.6299318782985210e-03 2.6312309503555298e-01 5.8174091577529907e-01 <_> 0 -1 49 5.9393711853772402e-04 3.6386200785636902e-01 5.6985449790954590e-01 <_> 0 -1 50 5.3878661245107651e-02 4.3035310506820679e-01 7.5593662261962891e-01 <_> 0 -1 51 1.8887349870055914e-03 2.1226030588150024e-01 5.6134271621704102e-01 <_> 0 -1 52 -2.3635339457541704e-03 5.6318491697311401e-01 2.6427671313285828e-01 <_> 0 -1 53 2.4017799645662308e-02 5.7971078157424927e-01 2.7517059445381165e-01 <_> 0 -1 54 2.0543030404951423e-04 2.7052420377731323e-01 5.7525688409805298e-01 <_> 0 -1 55 8.4790197433903813e-04 5.4356247186660767e-01 2.3348769545555115e-01 <_> 0 -1 56 1.4091329649090767e-03 5.3194248676300049e-01 2.0631550252437592e-01 <_> 0 -1 57 1.4642629539594054e-03 5.4189807176589966e-01 3.0688610672950745e-01 <_> 0 -1 58 1.6352549428120255e-03 3.6953729391098022e-01 6.1128681898117065e-01 <_> 0 -1 59 8.3172752056270838e-04 3.5650369524955750e-01 6.0252362489700317e-01 <_> 0 -1 60 -2.0998890977352858e-03 1.9139820337295532e-01 5.3628271818161011e-01 <_> 0 -1 61 -7.4213981861248612e-04 3.8355550169944763e-01 5.5293101072311401e-01 <_> 0 -1 62 3.2655049581080675e-03 4.3128961324691772e-01 7.1018958091735840e-01 <_> 0 -1 63 8.9134991867467761e-04 3.9848309755325317e-01 6.3919639587402344e-01 <_> 0 -1 64 -1.5284179709851742e-02 2.3667329549789429e-01 5.4337137937545776e-01 <_> 0 -1 65 4.8381411470472813e-03 5.8175009489059448e-01 3.2391890883445740e-01 <_> 0 -1 66 -9.1093179071322083e-04 5.5405938625335693e-01 2.9118689894676208e-01 <_> 0 -1 67 -6.1275060288608074e-03 1.7752550542354584e-01 5.1966291666030884e-01 <_> 0 -1 68 -4.4576259097084403e-04 3.0241701006889343e-01 5.5335938930511475e-01 <_> 0 -1 69 2.2646540775895119e-02 4.4149309396743774e-01 6.9753772020339966e-01 <_> 0 -1 70 -1.8804960418492556e-03 2.7913948893547058e-01 5.4979521036148071e-01 <_> 0 -1 71 7.0889107882976532e-03 5.2631992101669312e-01 2.3855470120906830e-01 <_> 0 -1 72 1.7318050377070904e-03 4.3193790316581726e-01 6.9836008548736572e-01 <_> 0 -1 73 -6.8482700735330582e-03 3.0820429325103760e-01 5.3909200429916382e-01 <_> 0 -1 74 -1.5062530110299122e-05 5.5219221115112305e-01 3.1203660368919373e-01 <_> 0 -1 75 2.9475569725036621e-02 5.4013228416442871e-01 1.7706030607223511e-01 <_> 0 -1 76 8.1387329846620560e-03 5.1786178350448608e-01 1.2110190093517303e-01 <_> 0 -1 77 2.0942950621247292e-02 5.2902942895889282e-01 3.3112218976020813e-01 <_> 0 -1 78 -9.5665529370307922e-03 7.4719941616058350e-01 4.4519689679145813e-01 <_> 33 1.5324139595031738e+01 <_> 0 -1 79 -2.8206960996612906e-04 2.0640860497951508e-01 6.0767322778701782e-01 <_> 0 -1 80 1.6790600493550301e-03 5.8519971370697021e-01 1.2553839385509491e-01 <_> 0 -1 81 6.9827912375330925e-04 9.4018429517745972e-02 5.7289612293243408e-01 <_> 0 -1 82 7.8959012171253562e-04 1.7819879949092865e-01 5.6943088769912720e-01 <_> 0 -1 83 -2.8560499195009470e-03 1.6383990645408630e-01 5.7886648178100586e-01 <_> 0 -1 84 -3.8122469559311867e-03 2.0854400098323822e-01 5.5085647106170654e-01 <_> 0 -1 85 1.5896620461717248e-03 5.7027608156204224e-01 1.8572150170803070e-01 <_> 0 -1 86 1.0078339837491512e-02 5.1169431209564209e-01 2.1897700428962708e-01 <_> 0 -1 87 -6.3526302576065063e-02 7.1313798427581787e-01 4.0438130497932434e-01 <_> 0 -1 88 -9.1031491756439209e-03 2.5671818852424622e-01 5.4639732837677002e-01 <_> 0 -1 89 -2.4035000242292881e-03 1.7006659507751465e-01 5.5909740924835205e-01 <_> 0 -1 90 1.5226360410451889e-03 5.4105567932128906e-01 2.6190540194511414e-01 <_> 0 -1 91 1.7997439950704575e-02 3.7324368953704834e-01 6.5352207422256470e-01 <_> 0 -1 92 -6.4538191072642803e-03 2.6264819502830505e-01 5.5374461412429810e-01 <_> 0 -1 93 -1.1880760081112385e-02 2.0037539303302765e-01 5.5447459220886230e-01 <_> 0 -1 94 1.2713660253211856e-03 5.5919027328491211e-01 3.0319759249687195e-01 <_> 0 -1 95 1.1376109905540943e-03 2.7304071187973022e-01 5.6465089321136475e-01 <_> 0 -1 96 -4.2651998810470104e-03 1.4059090614318848e-01 5.4618209600448608e-01 <_> 0 -1 97 -2.9602861031889915e-03 1.7950350046157837e-01 5.4592901468276978e-01 <_> 0 -1 98 -8.8448226451873779e-03 5.7367831468582153e-01 2.8092199563980103e-01 <_> 0 -1 99 -6.6430689767003059e-03 2.3706759512424469e-01 5.5038261413574219e-01 <_> 0 -1 100 3.9997808635234833e-03 5.6081998348236084e-01 3.3042821288108826e-01 <_> 0 -1 101 -4.1221720166504383e-03 1.6401059925556183e-01 5.3789931535720825e-01 <_> 0 -1 102 1.5624909661710262e-02 5.2276492118835449e-01 2.2886039316654205e-01 <_> 0 -1 103 -1.0356419719755650e-02 7.0161938667297363e-01 4.2529278993606567e-01 <_> 0 -1 104 -8.7960809469223022e-03 2.7673470973968506e-01 5.3558301925659180e-01 <_> 0 -1 105 1.6226939857006073e-01 4.3422400951385498e-01 7.4425792694091797e-01 <_> 0 -1 106 4.5542530715465546e-03 5.7264858484268188e-01 2.5821250677108765e-01 <_> 0 -1 107 -2.1309209987521172e-03 2.1068480610847473e-01 5.3610187768936157e-01 <_> 0 -1 108 -1.3208420015871525e-02 7.5937908887863159e-01 4.5524680614471436e-01 <_> 0 -1 109 -6.5996676683425903e-02 1.2524759769439697e-01 5.3440397977828979e-01 <_> 0 -1 110 7.9142656177282333e-03 3.3153840899467468e-01 5.6010431051254272e-01 <_> 0 -1 111 2.0894279703497887e-02 5.5060499906539917e-01 2.7688381075859070e-01 <_> 44 2.1010639190673828e+01 <_> 0 -1 112 1.1961159761995077e-03 1.7626909911632538e-01 6.1562412977218628e-01 <_> 0 -1 113 -1.8679830245673656e-03 6.1181068420410156e-01 1.8323999643325806e-01 <_> 0 -1 114 -1.9579799845814705e-04 9.9044263362884521e-02 5.7238161563873291e-01 <_> 0 -1 115 -8.0255657667294145e-04 5.5798798799514771e-01 2.3772829771041870e-01 <_> 0 -1 116 -2.4510810617357492e-03 2.2314579784870148e-01 5.8589351177215576e-01 <_> 0 -1 117 5.0361850298941135e-04 2.6539939641952515e-01 5.7941037416458130e-01 <_> 0 -1 118 4.0293349884450436e-03 5.8038270473480225e-01 2.4848650395870209e-01 <_> 0 -1 119 -1.4451709575951099e-02 1.8303519487380981e-01 5.4842048883438110e-01 <_> 0 -1 120 2.0380979403853416e-03 3.3635589480400085e-01 6.0510927438735962e-01 <_> 0 -1 121 -1.6155190533027053e-03 2.2866420447826385e-01 5.4412460327148438e-01 <_> 0 -1 122 3.3458340913057327e-03 5.6259131431579590e-01 2.3923380672931671e-01 <_> 0 -1 123 1.6379579901695251e-03 3.9069938659667969e-01 5.9646219015121460e-01 <_> 0 -1 124 3.0251210555434227e-02 5.2484822273254395e-01 1.5757469832897186e-01 <_> 0 -1 125 3.7251990288496017e-02 4.1943109035491943e-01 6.7484188079833984e-01 <_> 0 -1 126 -2.5109790265560150e-02 1.8825499713420868e-01 5.4734510183334351e-01 <_> 0 -1 127 -5.3099058568477631e-03 1.3399730622768402e-01 5.2271109819412231e-01 <_> 0 -1 128 1.2086479691788554e-03 3.7620881199836731e-01 6.1096358299255371e-01 <_> 0 -1 129 -2.1907679736614227e-02 2.6631429791450500e-01 5.4040068387985229e-01 <_> 0 -1 130 5.4116579703986645e-03 5.3635787963867188e-01 2.2322730720043182e-01 <_> 0 -1 131 6.9946326315402985e-02 5.3582328557968140e-01 2.4536980688571930e-01 <_> 0 -1 132 3.4520021290518343e-04 2.4096719920635223e-01 5.3769302368164062e-01 <_> 0 -1 133 1.2627709656953812e-03 5.4258567094802856e-01 3.1556931138038635e-01 <_> 0 -1 134 2.2719509899616241e-02 4.1584059596061707e-01 6.5978652238845825e-01 <_> 0 -1 135 -1.8111000536009669e-03 2.8112530708312988e-01 5.5052447319030762e-01 <_> 0 -1 136 3.3469670452177525e-03 5.2600282430648804e-01 1.8914650380611420e-01 <_> 0 -1 137 4.0791751234792173e-04 5.6735092401504517e-01 3.3442100882530212e-01 <_> 0 -1 138 1.2734799645841122e-02 5.3435921669006348e-01 2.3956120014190674e-01 <_> 0 -1 139 -7.3119727894663811e-03 6.0108900070190430e-01 4.0222078561782837e-01 <_> 0 -1 140 -5.6948751211166382e-02 8.1991511583328247e-01 4.5431908965110779e-01 <_> 0 -1 141 -5.0116591155529022e-03 2.2002810239791870e-01 5.3577107191085815e-01 <_> 0 -1 142 6.0334368608891964e-03 4.4130811095237732e-01 7.1817511320114136e-01 <_> 0 -1 143 3.9437441155314445e-03 5.4788607358932495e-01 2.7917331457138062e-01 <_> 0 -1 144 -3.6591119132936001e-03 6.3578677177429199e-01 3.9897239208221436e-01 <_> 0 -1 145 -3.8456181064248085e-03 3.4936860203742981e-01 5.3006649017333984e-01 <_> 0 -1 146 -7.1926261298358440e-03 1.1196149885654449e-01 5.2296727895736694e-01 <_> 0 -1 147 -5.2798941731452942e-02 2.3871029913425446e-01 5.4534512758255005e-01 <_> 0 -1 148 -7.9537667334079742e-03 7.5869178771972656e-01 4.4393768906593323e-01 <_> 0 -1 149 -2.7344180271029472e-03 2.5654768943786621e-01 5.4893219470977783e-01 <_> 0 -1 150 -1.8507939530536532e-03 6.7343479394912720e-01 4.2524749040603638e-01 <_> 0 -1 151 1.5918919816613197e-02 5.4883527755737305e-01 2.2926619648933411e-01 <_> 0 -1 152 -1.2687679845839739e-03 6.1043310165405273e-01 4.0223899483680725e-01 <_> 0 -1 153 6.2883910723030567e-03 5.3108531236648560e-01 1.5361930429935455e-01 <_> 0 -1 154 -6.2259892001748085e-03 1.7291119694709778e-01 5.2416062355041504e-01 <_> 0 -1 155 -1.2132599949836731e-02 6.5977597236633301e-01 4.3251821398735046e-01 <_> 50 2.3918790817260742e+01 <_> 0 -1 156 -3.9184908382594585e-03 6.1034351587295532e-01 1.4693309366703033e-01 <_> 0 -1 157 1.5971299726516008e-03 2.6323631405830383e-01 5.8964669704437256e-01 <_> 0 -1 158 1.7780110239982605e-02 5.8728742599487305e-01 1.7603619396686554e-01 <_> 0 -1 159 6.5334769897162914e-04 1.5678019821643829e-01 5.5960661172866821e-01 <_> 0 -1 160 -2.8353091329336166e-04 1.9131539762020111e-01 5.7320362329483032e-01 <_> 0 -1 161 1.6104689566418529e-03 2.9149138927459717e-01 5.6230807304382324e-01 <_> 0 -1 162 -9.7750619053840637e-02 1.9434769451618195e-01 5.6482332944869995e-01 <_> 0 -1 163 5.5182358482852578e-04 3.1346169114112854e-01 5.5046397447586060e-01 <_> 0 -1 164 -1.2858220376074314e-02 2.5364819169044495e-01 5.7601428031921387e-01 <_> 0 -1 165 4.1530239395797253e-03 5.7677221298217773e-01 3.6597740650177002e-01 <_> 0 -1 166 1.7092459602281451e-03 2.8431910276412964e-01 5.9189391136169434e-01 <_> 0 -1 167 7.5217359699308872e-03 4.0524271130561829e-01 6.1831092834472656e-01 <_> 0 -1 168 2.2479810286313295e-03 5.7837551832199097e-01 3.1354010105133057e-01 <_> 0 -1 169 5.2006211131811142e-02 5.5413120985031128e-01 1.9166369736194611e-01 <_> 0 -1 170 1.2085529975593090e-02 4.0326559543609619e-01 6.6445910930633545e-01 <_> 0 -1 171 1.4687820112158079e-05 3.5359779000282288e-01 5.7093828916549683e-01 <_> 0 -1 172 7.1395188570022583e-06 3.0374449491500854e-01 5.6102699041366577e-01 <_> 0 -1 173 -4.6001640148460865e-03 7.1810871362686157e-01 4.5803260803222656e-01 <_> 0 -1 174 2.0058949012309313e-03 5.6219518184661865e-01 2.9536840319633484e-01 <_> 0 -1 175 4.5050270855426788e-03 4.6153879165649414e-01 7.6190179586410522e-01 <_> 0 -1 176 1.1746830306947231e-02 5.3438371419906616e-01 1.7725290358066559e-01 <_> 0 -1 177 -5.8316338807344437e-02 1.6862459480762482e-01 5.3407722711563110e-01 <_> 0 -1 178 2.3629379575140774e-04 3.7920561432838440e-01 6.0268038511276245e-01 <_> 0 -1 179 -7.8156180679798126e-03 1.5128670632839203e-01 5.3243237733840942e-01 <_> 0 -1 180 -1.0876160115003586e-02 2.0818220078945160e-01 5.3199452161788940e-01 <_> 0 -1 181 -2.7745519764721394e-03 4.0982469916343689e-01 5.2103281021118164e-01 <_> 0 -1 182 -7.8276381827890873e-04 5.6932741403579712e-01 3.4788420796394348e-01 <_> 0 -1 183 1.3870409689843655e-02 5.3267508745193481e-01 2.2576980292797089e-01 <_> 0 -1 184 -2.3674910888075829e-02 1.5513050556182861e-01 5.2007079124450684e-01 <_> 0 -1 185 -1.4879409718560055e-05 5.5005669593811035e-01 3.8201761245727539e-01 <_> 0 -1 186 3.6190641112625599e-03 4.2386838793754578e-01 6.6397482156753540e-01 <_> 0 -1 187 -1.9817110151052475e-02 2.1500380337238312e-01 5.3823578357696533e-01 <_> 0 -1 188 -3.8154039066284895e-03 6.6757112741470337e-01 4.2152971029281616e-01 <_> 0 -1 189 -4.9775829538702965e-03 2.2672890126705170e-01 5.3863281011581421e-01 <_> 0 -1 190 2.2441020701080561e-03 4.3086910247802734e-01 6.8557357788085938e-01 <_> 0 -1 191 1.2282459996640682e-02 5.8366149663925171e-01 3.4674790501594543e-01 <_> 0 -1 192 -2.8548699337989092e-03 7.0169448852539062e-01 4.3114539980888367e-01 <_> 0 -1 193 -3.7875669077038765e-03 2.8953450918197632e-01 5.2249461412429810e-01 <_> 0 -1 194 -1.2201230274513364e-03 2.9755708575248718e-01 5.4816448688507080e-01 <_> 0 -1 195 1.0160599835216999e-02 4.8888179659843445e-01 8.1826978921890259e-01 <_> 0 -1 196 -1.6174569725990295e-02 1.4814929664134979e-01 5.2399927377700806e-01 <_> 0 -1 197 1.9292460754513741e-02 4.7863098978996277e-01 7.3781907558441162e-01 <_> 0 -1 198 -3.2479539513587952e-03 7.3742228746414185e-01 4.4706439971923828e-01 <_> 0 -1 199 -9.3803480267524719e-03 3.4891548752784729e-01 5.5379962921142578e-01 <_> 0 -1 200 -1.2606129981577396e-02 2.3796869814395905e-01 5.3154432773590088e-01 <_> 0 -1 201 -2.5621930137276649e-02 1.9646880030632019e-01 5.1387697458267212e-01 <_> 0 -1 202 -7.5741496402770281e-05 5.5905228853225708e-01 3.3658531308174133e-01 <_> 0 -1 203 -8.9210882782936096e-02 6.3404656946659088e-02 5.1626348495483398e-01 <_> 0 -1 204 -2.7670480776578188e-03 7.3234677314758301e-01 4.4907060265541077e-01 <_> 0 -1 205 2.7152578695677221e-04 4.1148349642753601e-01 5.9855180978775024e-01 <_> 51 2.4527879714965820e+01 <_> 0 -1 206 1.4786219689995050e-03 2.6635450124740601e-01 6.6433167457580566e-01 <_> 0 -1 207 -1.8741659587249160e-03 6.1438488960266113e-01 2.5185129046440125e-01 <_> 0 -1 208 -1.7151009524241090e-03 5.7663410902023315e-01 2.3974630236625671e-01 <_> 0 -1 209 -1.8939269939437509e-03 5.6820458173751831e-01 2.5291448831558228e-01 <_> 0 -1 210 -5.3006052039563656e-03 1.6406759619712830e-01 5.5560797452926636e-01 <_> 0 -1 211 -4.6662531793117523e-02 6.1231541633605957e-01 4.7628301382064819e-01 <_> 0 -1 212 -7.9431332414969802e-04 5.7078588008880615e-01 2.8394040465354919e-01 <_> 0 -1 213 1.4891670085489750e-02 4.0896728634834290e-01 6.0063672065734863e-01 <_> 0 -1 214 -1.2046529445797205e-03 5.7124507427215576e-01 2.7052891254425049e-01 <_> 0 -1 215 6.0619381256401539e-03 5.2625042200088501e-01 3.2622259855270386e-01 <_> 0 -1 216 -2.5286648888140917e-03 6.8538308143615723e-01 4.1992568969726562e-01 <_> 0 -1 217 -5.9010218828916550e-03 3.2662820816040039e-01 5.4348129034042358e-01 <_> 0 -1 218 5.6702760048210621e-03 5.4684108495712280e-01 2.3190039396286011e-01 <_> 0 -1 219 -3.0304100364446640e-03 5.5706679821014404e-01 2.7082380652427673e-01 <_> 0 -1 220 2.9803649522364140e-03 3.7005689740180969e-01 5.8906257152557373e-01 <_> 0 -1 221 -7.5840510427951813e-02 2.1400700509548187e-01 5.4199481010437012e-01 <_> 0 -1 222 1.9262539222836494e-02 5.5267721414566040e-01 2.7265900373458862e-01 <_> 0 -1 223 1.8888259364757687e-04 3.9580118656158447e-01 6.0172098875045776e-01 <_> 0 -1 224 2.9369549825787544e-02 5.2413737773895264e-01 1.4357580244541168e-01 <_> 0 -1 225 1.0417619487270713e-03 3.3854091167449951e-01 5.9299832582473755e-01 <_> 0 -1 226 2.6125640142709017e-03 5.4853779077529907e-01 3.0215978622436523e-01 <_> 0 -1 227 9.6977467183023691e-04 3.3752760291099548e-01 5.5320328474044800e-01 <_> 0 -1 228 5.9512659208849072e-04 5.6317430734634399e-01 3.3593991398811340e-01 <_> 0 -1 229 -1.0156559944152832e-01 6.3735038042068481e-02 5.2304250001907349e-01 <_> 0 -1 230 3.6156699061393738e-02 5.1369631290435791e-01 1.0295289754867554e-01 <_> 0 -1 231 3.4624140243977308e-03 3.8793200254440308e-01 5.5582892894744873e-01 <_> 0 -1 232 1.9554980099201202e-02 5.2500867843627930e-01 1.8758599460124969e-01 <_> 0 -1 233 -2.3121440317481756e-03 6.6720288991928101e-01 4.6796411275863647e-01 <_> 0 -1 234 -1.8605289515107870e-03 7.1633791923522949e-01 4.3346709012985229e-01 <_> 0 -1 235 -9.4026362057775259e-04 3.0213609337806702e-01 5.6502032279968262e-01 <_> 0 -1 236 -5.2418331615626812e-03 1.8200090527534485e-01 5.2502560615539551e-01 <_> 0 -1 237 1.1729019752237946e-04 3.3891880512237549e-01 5.4459732770919800e-01 <_> 0 -1 238 1.1878840159624815e-03 4.0853491425514221e-01 6.2535631656646729e-01 <_> 0 -1 239 -1.0881359688937664e-02 3.3783990144729614e-01 5.7000827789306641e-01 <_> 0 -1 240 1.7354859737679362e-03 4.2046359181404114e-01 6.5230387449264526e-01 <_> 0 -1 241 -6.5119052305817604e-03 2.5952160358428955e-01 5.4281437397003174e-01 <_> 0 -1 242 -1.2136430013924837e-03 6.1651438474655151e-01 3.9778938889503479e-01 <_> 0 -1 243 -1.0354240424931049e-02 1.6280280053615570e-01 5.2195048332214355e-01 <_> 0 -1 244 5.5858830455690622e-04 3.1996509432792664e-01 5.5035740137100220e-01 <_> 0 -1 245 1.5299649909138680e-02 4.1039940714836121e-01 6.1223882436752319e-01 <_> 0 -1 246 -2.1588210016489029e-02 1.0349129885435104e-01 5.1973849534988403e-01 <_> 0 -1 247 -1.2834629416465759e-01 8.4938651323318481e-01 4.8931029438972473e-01 <_> 0 -1 248 -2.2927189711481333e-03 3.1301578879356384e-01 5.4715752601623535e-01 <_> 0 -1 249 7.9915106296539307e-02 4.8563209176063538e-01 6.0739892721176147e-01 <_> 0 -1 250 -7.9441092908382416e-02 8.3946740627288818e-01 4.6245330572128296e-01 <_> 0 -1 251 -5.2800010889768600e-03 1.8816959857940674e-01 5.3066980838775635e-01 <_> 0 -1 252 1.0463109938427806e-03 5.2712291479110718e-01 2.5830659270286560e-01 <_> 0 -1 253 2.6317298761568964e-04 4.2353048920631409e-01 5.7354408502578735e-01 <_> 0 -1 254 -3.6173160187900066e-03 6.9343960285186768e-01 4.4954448938369751e-01 <_> 0 -1 255 1.1421879753470421e-02 5.9009212255477905e-01 4.1381931304931641e-01 <_> 0 -1 256 -1.9963278900831938e-03 6.4663827419281006e-01 4.3272399902343750e-01 <_> 56 2.7153350830078125e+01 <_> 0 -1 257 -9.9691245704889297e-03 6.1423242092132568e-01 2.4822120368480682e-01 <_> 0 -1 258 7.3073059320449829e-04 5.7049518823623657e-01 2.3219659924507141e-01 <_> 0 -1 259 6.4045301405712962e-04 2.1122519671916962e-01 5.8149331808090210e-01 <_> 0 -1 260 4.5424019917845726e-03 2.9504820704460144e-01 5.8663117885589600e-01 <_> 0 -1 261 9.2477443104144186e-05 2.9909908771514893e-01 5.7913267612457275e-01 <_> 0 -1 262 -8.6603146046400070e-03 2.8130298852920532e-01 5.6355422735214233e-01 <_> 0 -1 263 8.0515816807746887e-03 3.5353690385818481e-01 6.0547572374343872e-01 <_> 0 -1 264 4.3835240649059415e-04 5.5965322256088257e-01 2.7315109968185425e-01 <_> 0 -1 265 -9.8168973636347800e-05 5.9780317544937134e-01 3.6385610699653625e-01 <_> 0 -1 266 -1.1298790341243148e-03 2.7552521228790283e-01 5.4327291250228882e-01 <_> 0 -1 267 6.4356150105595589e-03 4.3056419491767883e-01 7.0698332786560059e-01 <_> 0 -1 268 -5.6829329580068588e-02 2.4952429533004761e-01 5.2949970960617065e-01 <_> 0 -1 269 4.0668169967830181e-03 5.4785531759262085e-01 2.4977239966392517e-01 <_> 0 -1 270 4.8164798499783501e-05 3.9386010169982910e-01 5.7063561677932739e-01 <_> 0 -1 271 6.1795017682015896e-03 4.4076061248779297e-01 7.3947668075561523e-01 <_> 0 -1 272 6.4985752105712891e-03 5.4452431201934814e-01 2.4791529774665833e-01 <_> 0 -1 273 -1.0211090557277203e-03 2.5447669625282288e-01 5.3389710187911987e-01 <_> 0 -1 274 -5.4247528314590454e-03 2.7188581228256226e-01 5.3240692615509033e-01 <_> 0 -1 275 -1.0559899965301156e-03 3.1782880425453186e-01 5.5345088243484497e-01 <_> 0 -1 276 6.6465808777138591e-04 4.2842191457748413e-01 6.5581941604614258e-01 <_> 0 -1 277 -2.7524109464138746e-04 5.9028607606887817e-01 3.8102629780769348e-01 <_> 0 -1 278 4.2293202131986618e-03 3.8164898753166199e-01 5.7093858718872070e-01 <_> 0 -1 279 -3.2868210691958666e-03 1.7477439343929291e-01 5.2595442533493042e-01 <_> 0 -1 280 1.5611879643984139e-04 3.6017221212387085e-01 5.7256120443344116e-01 <_> 0 -1 281 -7.3621381488919724e-06 5.4018580913543701e-01 3.0444970726966858e-01 <_> 0 -1 282 -1.4767250046133995e-02 3.2207700610160828e-01 5.5734348297119141e-01 <_> 0 -1 283 2.4489590898156166e-02 4.3015280365943909e-01 6.5188127756118774e-01 <_> 0 -1 284 -3.7652091123163700e-04 3.5645830631256104e-01 5.5982369184494019e-01 <_> 0 -1 285 7.3657688517414499e-06 3.4907829761505127e-01 5.5618977546691895e-01 <_> 0 -1 286 -1.5099939890205860e-02 1.7762720584869385e-01 5.3352999687194824e-01 <_> 0 -1 287 -3.8316650316119194e-03 6.1496877670288086e-01 4.2213940620422363e-01 <_> 0 -1 288 1.6925400123000145e-02 5.4130148887634277e-01 2.1665850281715393e-01 <_> 0 -1 289 -3.0477850232273340e-03 6.4494907855987549e-01 4.3546178936958313e-01 <_> 0 -1 290 3.2140589319169521e-03 5.4001551866531372e-01 3.5232171416282654e-01 <_> 0 -1 291 -4.0023201145231724e-03 2.7745240926742554e-01 5.3384172916412354e-01 <_> 0 -1 292 7.4182129465043545e-03 5.6767392158508301e-01 3.7028178572654724e-01 <_> 0 -1 293 -8.8764587417244911e-03 7.7492219209671021e-01 4.5836889743804932e-01 <_> 0 -1 294 2.7311739977449179e-03 5.3387218713760376e-01 3.9966610074043274e-01 <_> 0 -1 295 -2.5082379579544067e-03 5.6119632720947266e-01 3.7774989008903503e-01 <_> 0 -1 296 -8.0541074275970459e-03 2.9152289032936096e-01 5.1791828870773315e-01 <_> 0 -1 297 -9.7938813269138336e-04 5.5364328622817993e-01 3.7001928687095642e-01 <_> 0 -1 298 -5.8745909482240677e-03 3.7543910741806030e-01 5.6793761253356934e-01 <_> 0 -1 299 -4.4936719350516796e-03 7.0196992158889771e-01 4.4809499382972717e-01 <_> 0 -1 300 -5.4389229044318199e-03 2.3103649914264679e-01 5.3133869171142578e-01 <_> 0 -1 301 -7.5094640487805009e-04 5.8648687601089478e-01 4.1293430328369141e-01 <_> 0 -1 302 1.4528800420521293e-05 3.7324070930480957e-01 5.6196212768554688e-01 <_> 0 -1 303 4.0758069604635239e-02 5.3120911121368408e-01 2.7205219864845276e-01 <_> 0 -1 304 6.6505931317806244e-03 4.7100159525871277e-01 6.6934937238693237e-01 <_> 0 -1 305 4.5759351924061775e-03 5.1678192615509033e-01 1.6372759640216827e-01 <_> 0 -1 306 6.5269311890006065e-03 5.3976088762283325e-01 2.9385319352149963e-01 <_> 0 -1 307 -1.3660379685461521e-02 7.0864880084991455e-01 4.5322000980377197e-01 <_> 0 -1 308 2.7358869090676308e-02 5.2064812183380127e-01 3.5892319679260254e-01 <_> 0 -1 309 6.2197551596909761e-04 3.5070759057998657e-01 5.4411232471466064e-01 <_> 0 -1 310 -3.3077080734074116e-03 5.8595228195190430e-01 4.0248918533325195e-01 <_> 0 -1 311 -1.0631109587848186e-02 6.7432671785354614e-01 4.4226029515266418e-01 <_> 0 -1 312 1.9441649317741394e-02 5.2827161550521851e-01 1.7979049682617188e-01 <_> 71 3.4554111480712891e+01 <_> 0 -1 313 -5.5052167735993862e-03 5.9147310256958008e-01 2.6265591382980347e-01 <_> 0 -1 314 1.9562279339879751e-03 2.3125819861888885e-01 5.7416272163391113e-01 <_> 0 -1 315 -8.8924784213304520e-03 1.6565300524234772e-01 5.6266540288925171e-01 <_> 0 -1 316 8.3638377487659454e-02 5.4234498739242554e-01 1.9572949409484863e-01 <_> 0 -1 317 1.2282270472496748e-03 3.4179040789604187e-01 5.9925037622451782e-01 <_> 0 -1 318 5.7629169896245003e-03 3.7195819616317749e-01 6.0799038410186768e-01 <_> 0 -1 319 -1.6417410224676132e-03 2.5774860382080078e-01 5.5769157409667969e-01 <_> 0 -1 320 3.4113149158656597e-03 2.9507490992546082e-01 5.5141717195510864e-01 <_> 0 -1 321 -1.1069320142269135e-02 7.5693589448928833e-01 4.4770789146423340e-01 <_> 0 -1 322 3.4865971654653549e-02 5.5837088823318481e-01 2.6696211099624634e-01 <_> 0 -1 323 6.5701099811121821e-04 5.6273132562637329e-01 2.9888901114463806e-01 <_> 0 -1 324 -2.4339130148291588e-02 2.7711850404739380e-01 5.1088631153106689e-01 <_> 0 -1 325 5.9435202274471521e-04 5.5806517601013184e-01 3.1203418970108032e-01 <_> 0 -1 326 2.2971509024500847e-03 3.3302500844001770e-01 5.6790757179260254e-01 <_> 0 -1 327 -3.7801829166710377e-03 2.9905349016189575e-01 5.3448081016540527e-01 <_> 0 -1 328 -1.3420669734477997e-01 1.4638589322566986e-01 5.3925681114196777e-01 <_> 0 -1 329 7.5224548345431685e-04 3.7469539046287537e-01 5.6927347183227539e-01 <_> 0 -1 330 -4.0545541793107986e-02 2.7547478675842285e-01 5.4842978715896606e-01 <_> 0 -1 331 1.2572970008477569e-03 3.7445840239524841e-01 5.7560759782791138e-01 <_> 0 -1 332 -7.4249948374927044e-03 7.5138592720031738e-01 4.7282311320304871e-01 <_> 0 -1 333 5.0908129196614027e-04 5.4048967361450195e-01 2.9323211312294006e-01 <_> 0 -1 334 -1.2808450264856219e-03 6.1697798967361450e-01 4.2733490467071533e-01 <_> 0 -1 335 -1.8348860321566463e-03 2.0484960079193115e-01 5.2064722776412964e-01 <_> 0 -1 336 2.7484869584441185e-02 5.2529847621917725e-01 1.6755220293998718e-01 <_> 0 -1 337 2.2372419480234385e-03 5.2677828073501587e-01 2.7776581048965454e-01 <_> 0 -1 338 -8.8635291904211044e-03 6.9545578956604004e-01 4.8120489716529846e-01 <_> 0 -1 339 4.1753971017897129e-03 4.2918878793716431e-01 6.3491958379745483e-01 <_> 0 -1 340 -1.7098189564421773e-03 2.9305368661880493e-01 5.3612488508224487e-01 <_> 0 -1 341 6.5328548662364483e-03 4.4953250885009766e-01 7.4096941947937012e-01 <_> 0 -1 342 -9.5372907817363739e-03 3.1491199135780334e-01 5.4165017604827881e-01 <_> 0 -1 343 2.5310989469289780e-02 5.1218920946121216e-01 1.3117079436779022e-01 <_> 0 -1 344 3.6460969597101212e-02 5.1759117841720581e-01 2.5913399457931519e-01 <_> 0 -1 345 2.0854329690337181e-02 5.1371401548385620e-01 1.5823160111904144e-01 <_> 0 -1 346 -8.7207747856155038e-04 5.5743098258972168e-01 4.3989789485931396e-01 <_> 0 -1 347 -1.5227000403683633e-05 5.5489408969879150e-01 3.7080699205398560e-01 <_> 0 -1 348 -8.4316509310156107e-04 3.3874198794364929e-01 5.5542111396789551e-01 <_> 0 -1 349 3.6037859972566366e-03 5.3580617904663086e-01 3.4111711382865906e-01 <_> 0 -1 350 -6.8057891912758350e-03 6.1252027750015259e-01 4.3458628654479980e-01 <_> 0 -1 351 -4.7021660953760147e-02 2.3581659793853760e-01 5.1937389373779297e-01 <_> 0 -1 352 -3.6954108625650406e-02 7.3231112957000732e-01 4.7609439492225647e-01 <_> 0 -1 353 1.0439479956403375e-03 5.4194551706314087e-01 3.4113308787345886e-01 <_> 0 -1 354 -2.1050689974799752e-04 2.8216940164566040e-01 5.5549472570419312e-01 <_> 0 -1 355 -8.0831587314605713e-02 9.1299301385879517e-01 4.6974349021911621e-01 <_> 0 -1 356 -3.6579059087671340e-04 6.0226702690124512e-01 3.9782929420471191e-01 <_> 0 -1 357 -1.2545920617412776e-04 5.6132131814956665e-01 3.8455399870872498e-01 <_> 0 -1 358 -6.8786486983299255e-02 2.2616119682788849e-01 5.3004968166351318e-01 <_> 0 -1 359 1.2415789999067783e-02 4.0756919980049133e-01 5.8288121223449707e-01 <_> 0 -1 360 -4.7174817882478237e-03 2.8272539377212524e-01 5.2677577733993530e-01 <_> 0 -1 361 3.8136858493089676e-02 5.0747412443161011e-01 1.0236159712076187e-01 <_> 0 -1 362 -2.8168049175292253e-03 6.1690068244934082e-01 4.3596929311752319e-01 <_> 0 -1 363 8.1303603947162628e-03 4.5244330167770386e-01 7.6060950756072998e-01 <_> 0 -1 364 6.0056019574403763e-03 5.2404087781906128e-01 1.8597120046615601e-01 <_> 0 -1 365 1.9139319658279419e-02 5.2093791961669922e-01 2.3320719599723816e-01 <_> 0 -1 366 1.6445759683847427e-02 5.4507029056549072e-01 3.2642349600791931e-01 <_> 0 -1 367 -3.7356890738010406e-02 6.9990468025207520e-01 4.5332419872283936e-01 <_> 0 -1 368 -1.9727900624275208e-02 2.6536649465560913e-01 5.4128098487854004e-01 <_> 0 -1 369 6.6972579807043076e-03 4.4805660843849182e-01 7.1386522054672241e-01 <_> 0 -1 370 7.4457528535276651e-04 4.2313501238822937e-01 5.4713201522827148e-01 <_> 0 -1 371 1.1790640419349074e-03 5.3417021036148071e-01 3.1304550170898438e-01 <_> 0 -1 372 3.4980610013008118e-02 5.1186597347259521e-01 3.4305301308631897e-01 <_> 0 -1 373 5.6859792675822973e-04 3.5321870446205139e-01 5.4686397314071655e-01 <_> 0 -1 374 -1.1340649798512459e-02 2.8423538804054260e-01 5.3487008810043335e-01 <_> 0 -1 375 -6.6228108480572701e-03 6.8836402893066406e-01 4.4926649332046509e-01 <_> 0 -1 376 -8.0160330981016159e-03 1.7098939418792725e-01 5.2243089675903320e-01 <_> 0 -1 377 1.4206819469109178e-03 5.2908462285995483e-01 2.9933831095695496e-01 <_> 0 -1 378 -2.7801711112260818e-03 6.4988541603088379e-01 4.4604998826980591e-01 <_> 0 -1 379 -1.4747589593753219e-03 3.2604381442070007e-01 5.3881132602691650e-01 <_> 0 -1 380 -2.3830339312553406e-02 7.5289410352706909e-01 4.8012199997901917e-01 <_> 0 -1 381 6.9369790144264698e-03 5.3351658582687378e-01 3.2614278793334961e-01 <_> 0 -1 382 8.2806255668401718e-03 4.5803940296173096e-01 5.7378298044204712e-01 <_> 0 -1 383 -1.0439500212669373e-02 2.5923201441764832e-01 5.2338278293609619e-01 <_> 80 3.9107288360595703e+01 <_> 0 -1 384 7.2006587870419025e-03 3.2588860392570496e-01 6.8498080968856812e-01 <_> 0 -1 385 -2.8593589086085558e-03 5.8388811349868774e-01 2.5378298759460449e-01 <_> 0 -1 386 6.8580528022721410e-04 5.7080817222595215e-01 2.8124240040779114e-01 <_> 0 -1 387 7.9580191522836685e-03 2.5010511279106140e-01 5.5442607402801514e-01 <_> 0 -1 388 -1.2124150525778532e-03 2.3853680491447449e-01 5.4333502054214478e-01 <_> 0 -1 389 7.9426132142543793e-03 3.9550709724426270e-01 6.2207579612731934e-01 <_> 0 -1 390 2.4630590341985226e-03 5.6397080421447754e-01 2.9923579096794128e-01 <_> 0 -1 391 -6.0396599583327770e-03 2.1865129470825195e-01 5.4116767644882202e-01 <_> 0 -1 392 -1.2988339876756072e-03 2.3507060110569000e-01 5.3645849227905273e-01 <_> 0 -1 393 2.2299369447864592e-04 3.8041129708290100e-01 5.7296061515808105e-01 <_> 0 -1 394 1.4654280385002494e-03 2.5101679563522339e-01 5.2582687139511108e-01 <_> 0 -1 395 -8.1210042117163539e-04 5.9928238391876221e-01 3.8511589169502258e-01 <_> 0 -1 396 -1.3836020370945334e-03 5.6813961267471313e-01 3.6365869641304016e-01 <_> 0 -1 397 -2.7936449274420738e-02 1.4913170039653778e-01 5.3775602579116821e-01 <_> 0 -1 398 -4.6919551095925272e-04 3.6924299597740173e-01 5.5724847316741943e-01 <_> 0 -1 399 -4.9829659983515739e-03 6.7585092782974243e-01 4.5325040817260742e-01 <_> 0 -1 400 1.8815309740602970e-03 5.3680229187011719e-01 2.9325398802757263e-01 <_> 0 -1 401 -1.9067550078034401e-02 1.6493770480155945e-01 5.3300672769546509e-01 <_> 0 -1 402 -4.6906559728085995e-03 1.9639259576797485e-01 5.1193618774414062e-01 <_> 0 -1 403 5.9777139686048031e-03 4.6711719036102295e-01 7.0083981752395630e-01 <_> 0 -1 404 -3.3303130418062210e-02 1.1554169654846191e-01 5.1041620969772339e-01 <_> 0 -1 405 9.0744107961654663e-02 5.1496601104736328e-01 1.3061730563640594e-01 <_> 0 -1 406 9.3555898638442159e-04 3.6054810881614685e-01 5.4398590326309204e-01 <_> 0 -1 407 1.4901650138199329e-02 4.8862120509147644e-01 7.6875698566436768e-01 <_> 0 -1 408 6.1594118596985936e-04 5.3568130731582642e-01 3.2409390807151794e-01 <_> 0 -1 409 -5.0670988857746124e-02 1.8486219644546509e-01 5.2304041385650635e-01 <_> 0 -1 410 6.8665749859064817e-04 3.8405799865722656e-01 5.5179458856582642e-01 <_> 0 -1 411 8.3712432533502579e-03 4.2885640263557434e-01 6.1317539215087891e-01 <_> 0 -1 412 -1.2953069526702166e-03 2.9136741161346436e-01 5.2807378768920898e-01 <_> 0 -1 413 -4.1941680014133453e-02 7.5547999143600464e-01 4.8560309410095215e-01 <_> 0 -1 414 -2.3529380559921265e-02 2.8382799029350281e-01 5.2560812234878540e-01 <_> 0 -1 415 4.0857449173927307e-02 4.8709350824356079e-01 6.2772971391677856e-01 <_> 0 -1 416 -2.5406869128346443e-02 7.0997077226638794e-01 4.5750290155410767e-01 <_> 0 -1 417 -4.1415440500713885e-04 4.0308868885040283e-01 5.4694122076034546e-01 <_> 0 -1 418 2.1824119612574577e-02 4.5020240545272827e-01 6.7687010765075684e-01 <_> 0 -1 419 1.4114039950072765e-02 5.4428607225418091e-01 3.7917000055313110e-01 <_> 0 -1 420 6.7214590671937913e-05 4.2004638910293579e-01 5.8734762668609619e-01 <_> 0 -1 421 -7.9417638480663300e-03 3.7925618886947632e-01 5.5852657556533813e-01 <_> 0 -1 422 -7.2144409641623497e-03 7.2531038522720337e-01 4.6035489439964294e-01 <_> 0 -1 423 2.5817339774221182e-03 4.6933019161224365e-01 5.9002387523651123e-01 <_> 0 -1 424 1.3409319519996643e-01 5.1492130756378174e-01 1.8088449537754059e-01 <_> 0 -1 425 2.2962710354477167e-03 5.3997439146041870e-01 3.7178671360015869e-01 <_> 0 -1 426 -2.1575849968940020e-03 2.4084959924221039e-01 5.1488637924194336e-01 <_> 0 -1 427 -4.9196188338100910e-03 6.5735882520675659e-01 4.7387400269508362e-01 <_> 0 -1 428 1.6267469618469477e-03 4.1928219795227051e-01 6.3031142950057983e-01 <_> 0 -1 429 3.3413388882763684e-04 5.5402982234954834e-01 3.7021011114120483e-01 <_> 0 -1 430 -2.6698080822825432e-02 1.7109179496765137e-01 5.1014107465744019e-01 <_> 0 -1 431 -3.0561879277229309e-02 1.9042180478572845e-01 5.1687937974929810e-01 <_> 0 -1 432 2.8511548880487680e-03 4.4475069642066956e-01 6.3138538599014282e-01 <_> 0 -1 433 -3.6211479455232620e-02 2.4907270073890686e-01 5.3773492574691772e-01 <_> 0 -1 434 -2.4115189444273710e-03 5.3812432289123535e-01 3.6642369627952576e-01 <_> 0 -1 435 -7.7253201743587852e-04 5.5302321910858154e-01 3.5415500402450562e-01 <_> 0 -1 436 2.9481729143299162e-04 4.1326990723609924e-01 5.6672430038452148e-01 <_> 0 -1 437 -6.2334560789167881e-03 9.8787233233451843e-02 5.1986688375473022e-01 <_> 0 -1 438 -2.6274729520082474e-02 9.1127492487430573e-02 5.0281071662902832e-01 <_> 0 -1 439 5.3212260827422142e-03 4.7266489267349243e-01 6.2227207422256470e-01 <_> 0 -1 440 -4.1129058226943016e-03 2.1574570238590240e-01 5.1378047466278076e-01 <_> 0 -1 441 3.2457809429615736e-03 5.4107707738876343e-01 3.7217769026756287e-01 <_> 0 -1 442 -1.6359709203243256e-02 7.7878749370574951e-01 4.6852919459342957e-01 <_> 0 -1 443 3.2166109303943813e-04 5.4789870977401733e-01 4.2403739690780640e-01 <_> 0 -1 444 6.4452440710738301e-04 5.3305608034133911e-01 3.5013249516487122e-01 <_> 0 -1 445 -7.8909732401371002e-03 6.9235211610794067e-01 4.7265690565109253e-01 <_> 0 -1 446 4.8336211591959000e-02 5.0559002161026001e-01 7.5749203562736511e-02 <_> 0 -1 447 -7.5178127735853195e-04 3.7837418913841248e-01 5.5385738611221313e-01 <_> 0 -1 448 -2.4953910615295172e-03 3.0816510319709778e-01 5.3596121072769165e-01 <_> 0 -1 449 -2.2385010961443186e-03 6.6339588165283203e-01 4.6493428945541382e-01 <_> 0 -1 450 -1.7988430336117744e-03 6.5968447923660278e-01 4.3471878767013550e-01 <_> 0 -1 451 8.7860915809869766e-03 5.2318328619003296e-01 2.3155799508094788e-01 <_> 0 -1 452 3.6715380847454071e-03 5.2042502164840698e-01 2.9773768782615662e-01 <_> 0 -1 453 -3.5336449742317200e-02 7.2388780117034912e-01 4.8615050315856934e-01 <_> 0 -1 454 -6.9189240457490087e-04 3.1050220131874084e-01 5.2298247814178467e-01 <_> 0 -1 455 -3.3946109469980001e-03 3.1389680504798889e-01 5.2101737260818481e-01 <_> 0 -1 456 9.8569283727556467e-04 4.5365801453590393e-01 6.5850979089736938e-01 <_> 0 -1 457 -5.0163101404905319e-02 1.8044540286064148e-01 5.1989167928695679e-01 <_> 0 -1 458 -2.2367259953171015e-03 7.2557020187377930e-01 4.6513590216636658e-01 <_> 0 -1 459 7.4326287722215056e-04 4.4129210710525513e-01 5.8985459804534912e-01 <_> 0 -1 460 -9.3485182151198387e-04 3.5000529885292053e-01 5.3660178184509277e-01 <_> 0 -1 461 1.7497939988970757e-02 4.9121949076652527e-01 8.3152848482131958e-01 <_> 0 -1 462 -1.5200000489130616e-03 3.5702759027481079e-01 5.3705602884292603e-01 <_> 0 -1 463 7.8003940870985389e-04 4.3537721037864685e-01 5.9673351049423218e-01 <_> 103 5.0610481262207031e+01 <_> 0 -1 464 -9.9945552647113800e-03 6.1625832319259644e-01 3.0545330047607422e-01 <_> 0 -1 465 -1.1085229925811291e-03 5.8182948827743530e-01 3.1555780768394470e-01 <_> 0 -1 466 1.0364380432292819e-03 2.5520521402359009e-01 5.6929117441177368e-01 <_> 0 -1 467 6.8211311008781195e-04 3.6850899457931519e-01 5.9349310398101807e-01 <_> 0 -1 468 -6.8057340104132891e-04 2.3323920369148254e-01 5.4747921228408813e-01 <_> 0 -1 469 2.6068789884448051e-04 3.2574570178985596e-01 5.6675457954406738e-01 <_> 0 -1 470 5.1607372006401420e-04 3.7447169423103333e-01 5.8454728126525879e-01 <_> 0 -1 471 8.5007521556690335e-04 3.4203711152076721e-01 5.5228072404861450e-01 <_> 0 -1 472 -1.8607829697430134e-03 2.8044199943542480e-01 5.3754240274429321e-01 <_> 0 -1 473 -1.5033970121294260e-03 2.5790509581565857e-01 5.4989522695541382e-01 <_> 0 -1 474 2.3478909861296415e-03 4.1751560568809509e-01 6.3137108087539673e-01 <_> 0 -1 475 -2.8880240279249847e-04 5.8651697635650635e-01 4.0526661276817322e-01 <_> 0 -1 476 8.9405477046966553e-03 5.2111411094665527e-01 2.3186540603637695e-01 <_> 0 -1 477 -1.9327739253640175e-02 2.7534329891204834e-01 5.2415257692337036e-01 <_> 0 -1 478 -2.0202060113660991e-04 5.7229787111282349e-01 3.6771959066390991e-01 <_> 0 -1 479 2.1179069299250841e-03 4.4661080837249756e-01 5.5424308776855469e-01 <_> 0 -1 480 -1.7743760254234076e-03 2.8132531046867371e-01 5.3009599447250366e-01 <_> 0 -1 481 4.2234458960592747e-03 4.3997099995613098e-01 5.7954281568527222e-01 <_> 0 -1 482 -1.4375220052897930e-02 2.9811179637908936e-01 5.2920591831207275e-01 <_> 0 -1 483 -1.5349180437624454e-02 7.7052152156829834e-01 4.7481718659400940e-01 <_> 0 -1 484 1.5152279956964776e-05 3.7188440561294556e-01 5.5768972635269165e-01 <_> 0 -1 485 -9.1293919831514359e-03 3.6151960492134094e-01 5.2867668867111206e-01 <_> 0 -1 486 2.2512159775942564e-03 5.3647047281265259e-01 3.4862980246543884e-01 <_> 0 -1 487 -4.9696918576955795e-03 6.9276517629623413e-01 4.6768361330032349e-01 <_> 0 -1 488 -1.2829010374844074e-02 7.7121537923812866e-01 4.6607351303100586e-01 <_> 0 -1 489 -9.3660065904259682e-03 3.3749839663505554e-01 5.3512877225875854e-01 <_> 0 -1 490 3.2452319283038378e-03 5.3251898288726807e-01 3.2896101474761963e-01 <_> 0 -1 491 -1.1723560281097889e-02 6.8376529216766357e-01 4.7543001174926758e-01 <_> 0 -1 492 2.9257940695970319e-05 3.5720878839492798e-01 5.3605020046234131e-01 <_> 0 -1 493 -2.2244219508138485e-05 5.5414271354675293e-01 3.5520640015602112e-01 <_> 0 -1 494 5.0881509669125080e-03 5.0708442926406860e-01 1.2564620375633240e-01 <_> 0 -1 495 2.7429679408669472e-02 5.2695602178573608e-01 1.6258180141448975e-01 <_> 0 -1 496 -6.4142867922782898e-03 7.1455889940261841e-01 4.5841971039772034e-01 <_> 0 -1 497 3.3479959238320589e-03 5.3986120223999023e-01 3.4946969151496887e-01 <_> 0 -1 498 -8.2635492086410522e-02 2.4391929805278778e-01 5.1602262258529663e-01 <_> 0 -1 499 1.0261740535497665e-03 3.8868919014930725e-01 5.7679080963134766e-01 <_> 0 -1 500 -1.6307090409100056e-03 3.3894580602645874e-01 5.3477007150650024e-01 <_> 0 -1 501 2.4546680506318808e-03 4.6014139056205750e-01 6.3872468471527100e-01 <_> 0 -1 502 -9.9476519972085953e-04 5.7698792219161987e-01 4.1203960776329041e-01 <_> 0 -1 503 1.5409190207719803e-02 4.8787090182304382e-01 7.0898222923278809e-01 <_> 0 -1 504 1.1784400558099151e-03 5.2635532617568970e-01 2.8952449560165405e-01 <_> 0 -1 505 -2.7701919898390770e-02 1.4988289773464203e-01 5.2196067571640015e-01 <_> 0 -1 506 -2.9505399987101555e-02 2.4893319234251976e-02 4.9998161196708679e-01 <_> 0 -1 507 4.5159430010244250e-04 5.4646229743957520e-01 4.0296629071235657e-01 <_> 0 -1 508 7.1772639639675617e-03 4.2710569500923157e-01 5.8662968873977661e-01 <_> 0 -1 509 -7.4182048439979553e-02 6.8741792440414429e-01 4.9190279841423035e-01 <_> 0 -1 510 -1.7254160717129707e-02 3.3706760406494141e-01 5.3487390279769897e-01 <_> 0 -1 511 1.4851559884846210e-02 4.6267929673194885e-01 6.1299049854278564e-01 <_> 0 -1 512 1.0002000257372856e-02 5.3461229801177979e-01 3.4234538674354553e-01 <_> 0 -1 513 2.0138120744377375e-03 4.6438300609588623e-01 5.8243042230606079e-01 <_> 0 -1 514 1.5135470312088728e-03 5.1963961124420166e-01 2.8561499714851379e-01 <_> 0 -1 515 3.1381431035697460e-03 4.8381629586219788e-01 5.9585297107696533e-01 <_> 0 -1 516 -5.1450440660119057e-03 8.9203029870986938e-01 4.7414121031761169e-01 <_> 0 -1 517 -4.4736708514392376e-03 2.0339429378509521e-01 5.3372788429260254e-01 <_> 0 -1 518 1.9628470763564110e-03 4.5716339349746704e-01 6.7258632183074951e-01 <_> 0 -1 519 5.4260450415313244e-03 5.2711081504821777e-01 2.8456708788871765e-01 <_> 0 -1 520 4.9611460417509079e-04 4.1383129358291626e-01 5.7185977697372437e-01 <_> 0 -1 521 9.3728788197040558e-03 5.2251511812210083e-01 2.8048470616340637e-01 <_> 0 -1 522 6.0500897234305739e-04 5.2367687225341797e-01 3.3145239949226379e-01 <_> 0 -1 523 5.6792551185935736e-04 4.5310598611831665e-01 6.2769711017608643e-01 <_> 0 -1 524 2.4644339457154274e-02 5.1308518648147583e-01 2.0171439647674561e-01 <_> 0 -1 525 -1.0290450416505337e-02 7.7865952253341675e-01 4.8766410350799561e-01 <_> 0 -1 526 2.0629419013857841e-03 4.2885988950729370e-01 5.8812642097473145e-01 <_> 0 -1 527 -5.0519481301307678e-03 3.5239779949188232e-01 5.2860087156295776e-01 <_> 0 -1 528 -5.7692620903253555e-03 6.8410861492156982e-01 4.5880940556526184e-01 <_> 0 -1 529 -4.5789941214025021e-04 3.5655200481414795e-01 5.4859781265258789e-01 <_> 0 -1 530 -7.5918837683275342e-04 3.3687931299209595e-01 5.2541971206665039e-01 <_> 0 -1 531 -1.7737259622663260e-03 3.4221610426902771e-01 5.4540151357650757e-01 <_> 0 -1 532 -8.5610467940568924e-03 6.5336120128631592e-01 4.4858568906784058e-01 <_> 0 -1 533 1.7277270089834929e-03 5.3075802326202393e-01 3.9253529906272888e-01 <_> 0 -1 534 -2.8199609369039536e-02 6.8574589490890503e-01 4.5885840058326721e-01 <_> 0 -1 535 -1.7781109781935811e-03 4.0378510951995850e-01 5.3698569536209106e-01 <_> 0 -1 536 3.3177141449414194e-04 5.3997987508773804e-01 3.7057501077651978e-01 <_> 0 -1 537 2.6385399978607893e-03 4.6654370427131653e-01 6.4527308940887451e-01 <_> 0 -1 538 -2.1183069329708815e-03 5.9147810935974121e-01 4.0646770596504211e-01 <_> 0 -1 539 -1.4773289673030376e-02 3.6420381069183350e-01 5.2947628498077393e-01 <_> 0 -1 540 -1.6815440729260445e-02 2.6642319560050964e-01 5.1449728012084961e-01 <_> 0 -1 541 -6.3370140269398689e-03 6.7795312404632568e-01 4.8520979285240173e-01 <_> 0 -1 542 -4.4560048991115764e-05 5.6139647960662842e-01 4.1530540585517883e-01 <_> 0 -1 543 -1.0240620467811823e-03 5.9644782543182373e-01 4.5663040876388550e-01 <_> 0 -1 544 -2.3161689750850201e-03 2.9761150479316711e-01 5.1881599426269531e-01 <_> 0 -1 545 5.3217571973800659e-01 5.1878392696380615e-01 2.2026319801807404e-01 <_> 0 -1 546 -1.6643050312995911e-01 1.8660229444503784e-01 5.0603431463241577e-01 <_> 0 -1 547 1.1253529787063599e-01 5.2121251821517944e-01 1.1850229650735855e-01 <_> 0 -1 548 9.3046864494681358e-03 4.5899370312690735e-01 6.8261492252349854e-01 <_> 0 -1 549 -4.6255099587142467e-03 3.0799409747123718e-01 5.2250087261199951e-01 <_> 0 -1 550 -1.1116469651460648e-01 2.1010440587997437e-01 5.0808018445968628e-01 <_> 0 -1 551 -1.0888439603149891e-02 5.7653552293777466e-01 4.7904640436172485e-01 <_> 0 -1 552 5.8564301580190659e-03 5.0651001930236816e-01 1.5635989606380463e-01 <_> 0 -1 553 5.4854389280080795e-02 4.9669149518013000e-01 7.2305107116699219e-01 <_> 0 -1 554 -1.1197339743375778e-02 2.1949790418148041e-01 5.0987982749938965e-01 <_> 0 -1 555 4.4069071300327778e-03 4.7784018516540527e-01 6.7709028720855713e-01 <_> 0 -1 556 -6.3665293157100677e-02 1.9363629817962646e-01 5.0810241699218750e-01 <_> 0 -1 557 -9.8081491887569427e-03 5.9990632534027100e-01 4.8103410005569458e-01 <_> 0 -1 558 -2.1717099007219076e-03 3.3383339643478394e-01 5.2354729175567627e-01 <_> 0 -1 559 -1.3315520249307156e-02 6.6170698404312134e-01 4.9192130565643311e-01 <_> 0 -1 560 2.5442079640924931e-03 4.4887441396713257e-01 6.0821849107742310e-01 <_> 0 -1 561 1.2037839740514755e-02 5.4093921184539795e-01 3.2924321293830872e-01 <_> 0 -1 562 -2.0701050758361816e-02 6.8191200494766235e-01 4.5949959754943848e-01 <_> 0 -1 563 2.7608279138803482e-02 4.6307921409606934e-01 5.7672828435897827e-01 <_> 0 -1 564 1.2370620388537645e-03 5.1653790473937988e-01 2.6350161433219910e-01 <_> 0 -1 565 -3.7669338285923004e-02 2.5363931059837341e-01 5.2789801359176636e-01 <_> 0 -1 566 -1.8057259730994701e-03 3.9851561188697815e-01 5.5175000429153442e-01 <_> 111 5.4620071411132812e+01 <_> 0 -1 567 4.4299028813838959e-03 2.8910180926322937e-01 6.3352262973785400e-01 <_> 0 -1 568 -2.3813319858163595e-03 6.2117892503738403e-01 3.4774878621101379e-01 <_> 0 -1 569 2.2915711160749197e-03 2.2544120252132416e-01 5.5821180343627930e-01 <_> 0 -1 570 9.9457940086722374e-04 3.7117108702659607e-01 5.9300708770751953e-01 <_> 0 -1 571 7.7164667891338468e-04 5.6517201662063599e-01 3.3479958772659302e-01 <_> 0 -1 572 -1.1386410333216190e-03 3.0691260099411011e-01 5.5086308717727661e-01 <_> 0 -1 573 -1.6403039626311511e-04 5.7628279924392700e-01 3.6990478634834290e-01 <_> 0 -1 574 2.9793529392918572e-05 2.6442441344261169e-01 5.4379111528396606e-01 <_> 0 -1 575 8.5774902254343033e-03 5.0511389970779419e-01 1.7957249283790588e-01 <_> 0 -1 576 -2.6032689493149519e-04 5.8269691467285156e-01 4.4468268752098083e-01 <_> 0 -1 577 -6.1404630541801453e-03 3.1138521432876587e-01 5.3469717502593994e-01 <_> 0 -1 578 -2.3086950182914734e-02 3.2779461145401001e-01 5.3311979770660400e-01 <_> 0 -1 579 -1.4243650250136852e-02 7.3817098140716553e-01 4.5880630612373352e-01 <_> 0 -1 580 1.9487129524350166e-02 5.2566307783126831e-01 2.2744719684123993e-01 <_> 0 -1 581 -9.6681108698248863e-04 5.5112308263778687e-01 3.8150069117546082e-01 <_> 0 -1 582 3.1474709976464510e-03 5.4256367683410645e-01 2.5437268614768982e-01 <_> 0 -1 583 -1.8026070029009134e-04 5.3801918029785156e-01 3.4063041210174561e-01 <_> 0 -1 584 -6.0266260989010334e-03 3.0358019471168518e-01 5.4205721616744995e-01 <_> 0 -1 585 4.4462960795499384e-04 3.9909970760345459e-01 5.6601101160049438e-01 <_> 0 -1 586 2.2609760053455830e-03 5.5628067255020142e-01 3.9406880736351013e-01 <_> 0 -1 587 5.1133058965206146e-02 4.6096539497375488e-01 7.1185618638992310e-01 <_> 0 -1 588 -1.7786309123039246e-02 2.3161660134792328e-01 5.3221440315246582e-01 <_> 0 -1 589 -4.9679628573358059e-03 2.3307719826698303e-01 5.1220291852951050e-01 <_> 0 -1 590 2.0667689386755228e-03 4.6574440598487854e-01 6.4554882049560547e-01 <_> 0 -1 591 7.4413768015801907e-03 5.1543921232223511e-01 2.3616339266300201e-01 <_> 0 -1 592 -3.6277279723435640e-03 6.2197732925415039e-01 4.4766610860824585e-01 <_> 0 -1 593 -5.3530759178102016e-03 1.8373550474643707e-01 5.1022082567214966e-01 <_> 0 -1 594 1.4530919492244720e-01 5.1459872722625732e-01 1.5359309315681458e-01 <_> 0 -1 595 2.4394490756094456e-03 5.3436601161956787e-01 3.6246618628501892e-01 <_> 0 -1 596 -3.1283390708267689e-03 6.2150079011917114e-01 4.8455920815467834e-01 <_> 0 -1 597 1.7940260004252195e-03 4.2992618680000305e-01 5.8241981267929077e-01 <_> 0 -1 598 3.6253821104764938e-02 5.2603340148925781e-01 1.4394679665565491e-01 <_> 0 -1 599 -5.1746722310781479e-03 3.5065388679504395e-01 5.2870452404022217e-01 <_> 0 -1 600 6.5383297624066472e-04 4.8096409440040588e-01 6.1220401525497437e-01 <_> 0 -1 601 -2.6480229571461678e-02 1.1393620073795319e-01 5.0455862283706665e-01 <_> 0 -1 602 -3.0440660193562508e-03 6.3520950078964233e-01 4.7947341203689575e-01 <_> 0 -1 603 3.6993520334362984e-03 5.1311182975769043e-01 2.4985109269618988e-01 <_> 0 -1 604 -3.6762931267730892e-04 5.4213947057723999e-01 3.7095320224761963e-01 <_> 0 -1 605 -4.1382260620594025e-02 1.8949599564075470e-01 5.0816917419433594e-01 <_> 0 -1 606 -1.0532729793339968e-03 6.4543670415878296e-01 4.7836089134216309e-01 <_> 0 -1 607 -2.1648600231856108e-03 6.2150311470031738e-01 4.4998261332511902e-01 <_> 0 -1 608 -5.6747748749330640e-04 3.7126109004020691e-01 5.4193347692489624e-01 <_> 0 -1 609 1.7375840246677399e-01 5.0236439704895020e-01 1.2157420068979263e-01 <_> 0 -1 610 -2.9049699660390615e-03 3.2402679324150085e-01 5.3818839788436890e-01 <_> 0 -1 611 1.2299539521336555e-03 4.1655078530311584e-01 5.7034862041473389e-01 <_> 0 -1 612 -5.4329237900674343e-04 3.8540428876876831e-01 5.5475491285324097e-01 <_> 0 -1 613 -8.3297258242964745e-03 2.2044940292835236e-01 5.0970828533172607e-01 <_> 0 -1 614 -1.0417630255687982e-04 5.6070661544799805e-01 4.3030360341072083e-01 <_> 0 -1 615 3.1204700469970703e-02 4.6216571331024170e-01 6.9820040464401245e-01 <_> 0 -1 616 7.8943502157926559e-03 5.2695941925048828e-01 2.2690680623054504e-01 <_> 0 -1 617 -4.3645310215651989e-03 6.3592231273651123e-01 4.5379561185836792e-01 <_> 0 -1 618 7.6793059706687927e-03 5.2747678756713867e-01 2.7404838800430298e-01 <_> 0 -1 619 -2.5431139394640923e-02 2.0385199785232544e-01 5.0717329978942871e-01 <_> 0 -1 620 8.2000601105391979e-04 4.5874550938606262e-01 6.1198681592941284e-01 <_> 0 -1 621 2.9284600168466568e-03 5.0712740421295166e-01 2.0282049477100372e-01 <_> 0 -1 622 4.5256470912136137e-05 4.8121041059494019e-01 5.4308217763900757e-01 <_> 0 -1 623 1.3158309739083052e-03 4.6258139610290527e-01 6.7793232202529907e-01 <_> 0 -1 624 1.5870389761403203e-03 5.3862917423248291e-01 3.4314650297164917e-01 <_> 0 -1 625 -2.1539660170674324e-02 2.5942500680685043e-02 5.0032228231430054e-01 <_> 0 -1 626 1.4334480278193951e-02 5.2028447389602661e-01 1.5906329452991486e-01 <_> 0 -1 627 -8.3881383761763573e-03 7.2824811935424805e-01 4.6480441093444824e-01 <_> 0 -1 628 9.1906841844320297e-03 5.5623567104339600e-01 3.9231911301612854e-01 <_> 0 -1 629 -5.8453059755265713e-03 6.8033927679061890e-01 4.6291279792785645e-01 <_> 0 -1 630 -5.4707799106836319e-02 2.5616711378097534e-01 5.2061259746551514e-01 <_> 0 -1 631 9.1142775490880013e-03 5.1896202564239502e-01 3.0538770556449890e-01 <_> 0 -1 632 -1.5575000084936619e-02 1.2950749695301056e-01 5.1690948009490967e-01 <_> 0 -1 633 -1.2050600344082341e-04 5.7350981235504150e-01 4.2308250069618225e-01 <_> 0 -1 634 1.2273970060050488e-03 5.2898782491683960e-01 4.0797919034957886e-01 <_> 0 -1 635 -1.2186600361019373e-03 6.5756398439407349e-01 4.5744091272354126e-01 <_> 0 -1 636 -3.3256649039685726e-03 3.6280471086502075e-01 5.1950198411941528e-01 <_> 0 -1 637 -1.3288309797644615e-02 1.2842659652233124e-01 5.0434887409210205e-01 <_> 0 -1 638 -3.3839771058410406e-03 6.2922400236129761e-01 4.7575059533119202e-01 <_> 0 -1 639 -2.1954220533370972e-01 1.4877319335937500e-01 5.0650137662887573e-01 <_> 0 -1 640 4.9111708067357540e-03 4.2561021447181702e-01 5.6658387184143066e-01 <_> 0 -1 641 -1.8744950648397207e-04 4.0041440725326538e-01 5.5868571996688843e-01 <_> 0 -1 642 -5.2178641781210899e-03 6.0091161727905273e-01 4.8127061128616333e-01 <_> 0 -1 643 -1.1111519997939467e-03 3.5149338841438293e-01 5.2870899438858032e-01 <_> 0 -1 644 4.4036400504410267e-03 4.6422758698463440e-01 5.9240859746932983e-01 <_> 0 -1 645 1.2299499660730362e-01 5.0255292654037476e-01 6.9152481853961945e-02 <_> 0 -1 646 -1.2313510291278362e-02 5.8845919370651245e-01 4.9340128898620605e-01 <_> 0 -1 647 4.1471039876341820e-03 4.3722391128540039e-01 5.8934777975082397e-01 <_> 0 -1 648 -3.5502649843692780e-03 4.3275511264801025e-01 5.3962701559066772e-01 <_> 0 -1 649 -1.9224269315600395e-02 1.9131340086460114e-01 5.0683307647705078e-01 <_> 0 -1 650 1.4395059552043676e-03 5.3081780672073364e-01 4.2435330152511597e-01 <_> 0 -1 651 -6.7751999013125896e-03 6.3653957843780518e-01 4.5400860905647278e-01 <_> 0 -1 652 7.0119630545377731e-03 5.1898342370986938e-01 3.0261999368667603e-01 <_> 0 -1 653 5.4014651104807854e-03 5.1050621271133423e-01 2.5576829910278320e-01 <_> 0 -1 654 9.0274988906458020e-04 4.6969148516654968e-01 5.8618277311325073e-01 <_> 0 -1 655 1.1474450118839741e-02 5.0536459684371948e-01 1.5271779894828796e-01 <_> 0 -1 656 -6.7023430019617081e-03 6.5089809894561768e-01 4.8906040191650391e-01 <_> 0 -1 657 -2.0462959073483944e-03 6.2418168783187866e-01 4.5146000385284424e-01 <_> 0 -1 658 -9.9951568990945816e-03 3.4327811002731323e-01 5.4009538888931274e-01 <_> 0 -1 659 -3.5700708627700806e-02 1.8780590593814850e-01 5.0740778446197510e-01 <_> 0 -1 660 4.5584561303257942e-04 3.8052770495414734e-01 5.4025697708129883e-01 <_> 0 -1 661 -5.4260600358247757e-02 6.8437147140502930e-01 4.5950970053672791e-01 <_> 0 -1 662 6.0600461438298225e-03 5.5029052495956421e-01 4.5005279779434204e-01 <_> 0 -1 663 -6.4791832119226456e-03 3.3688580989837646e-01 5.3107571601867676e-01 <_> 0 -1 664 -1.4939469983801246e-03 6.4876401424407959e-01 4.7561758756637573e-01 <_> 0 -1 665 1.4610530342906713e-05 4.0345790982246399e-01 5.4510641098022461e-01 <_> 0 -1 666 -7.2321938350796700e-03 6.3868737220764160e-01 4.8247399926185608e-01 <_> 0 -1 667 -4.0645818226039410e-03 2.9864218831062317e-01 5.1573359966278076e-01 <_> 0 -1 668 3.0463080853223801e-02 5.0221997499465942e-01 7.1599560976028442e-01 <_> 0 -1 669 -8.0544911324977875e-03 6.4924520254135132e-01 4.6192750334739685e-01 <_> 0 -1 670 3.9505138993263245e-02 5.1505708694458008e-01 2.4506139755249023e-01 <_> 0 -1 671 8.4530208259820938e-03 4.5736691355705261e-01 6.3940370082855225e-01 <_> 0 -1 672 -1.1688120430335402e-03 3.8655120134353638e-01 5.4836612939834595e-01 <_> 0 -1 673 2.8070670086890459e-03 5.1285791397094727e-01 2.7014800906181335e-01 <_> 0 -1 674 4.7365209320560098e-04 4.0515819191932678e-01 5.3874611854553223e-01 <_> 0 -1 675 1.1741080321371555e-02 5.2959501743316650e-01 3.7194138765335083e-01 <_> 0 -1 676 3.1833238899707794e-03 4.7894069552421570e-01 6.8951261043548584e-01 <_> 0 -1 677 7.0241501089185476e-04 5.3844892978668213e-01 3.9180809259414673e-01 <_> 102 5.0169731140136719e+01 <_> 0 -1 678 1.7059929668903351e-02 3.9485278725624084e-01 7.1425348520278931e-01 <_> 0 -1 679 2.1840840578079224e-02 3.3703160285949707e-01 6.0900169610977173e-01 <_> 0 -1 680 2.4520049919374287e-04 3.5005760192871094e-01 5.9879022836685181e-01 <_> 0 -1 681 8.3272606134414673e-03 3.2675281167030334e-01 5.6972408294677734e-01 <_> 0 -1 682 5.7148298947140574e-04 3.0445998907089233e-01 5.5316567420959473e-01 <_> 0 -1 683 6.7373987985774875e-04 3.6500120162963867e-01 5.6726312637329102e-01 <_> 0 -1 684 3.4681590477703139e-05 3.3135411143302917e-01 5.3887271881103516e-01 <_> 0 -1 685 -5.8563398197293282e-03 2.6979428529739380e-01 5.4987788200378418e-01 <_> 0 -1 686 8.5102273151278496e-03 5.2693581581115723e-01 2.7628791332244873e-01 <_> 0 -1 687 -6.9817207753658295e-02 2.9096031188964844e-01 5.2592468261718750e-01 <_> 0 -1 688 -8.6113670840859413e-04 5.8925771713256836e-01 4.0736979246139526e-01 <_> 0 -1 689 9.7149249631911516e-04 3.5235640406608582e-01 5.4158622026443481e-01 <_> 0 -1 690 -1.4727490452060010e-05 5.4230177402496338e-01 3.5031560063362122e-01 <_> 0 -1 691 4.8420291393995285e-02 5.1939457654953003e-01 3.4111958742141724e-01 <_> 0 -1 692 1.3257140526548028e-03 3.1577691435813904e-01 5.3353762626647949e-01 <_> 0 -1 693 1.4922149603080470e-05 4.4512999057769775e-01 5.5365538597106934e-01 <_> 0 -1 694 -2.7173398993909359e-03 3.0317419767379761e-01 5.2480888366699219e-01 <_> 0 -1 695 2.9219500720500946e-03 4.7814530134201050e-01 6.6060417890548706e-01 <_> 0 -1 696 -1.9804988987743855e-03 3.1863081455230713e-01 5.2876251935958862e-01 <_> 0 -1 697 -4.0012109093368053e-03 6.4135968685150146e-01 4.7499281167984009e-01 <_> 0 -1 698 -4.3491991236805916e-03 1.5074980258941650e-01 5.0989967584609985e-01 <_> 0 -1 699 1.3490889687091112e-03 4.3161588907241821e-01 5.8811670541763306e-01 <_> 0 -1 700 1.8597070127725601e-02 4.7355538606643677e-01 9.0897941589355469e-01 <_> 0 -1 701 -1.8562379991635680e-03 3.5531890392303467e-01 5.5778372287750244e-01 <_> 0 -1 702 2.2940430790185928e-03 4.5000949501991272e-01 6.5808779001235962e-01 <_> 0 -1 703 2.9982850537635386e-04 5.6292420625686646e-01 3.9758789539337158e-01 <_> 0 -1 704 3.5455459728837013e-03 5.3815472126007080e-01 3.6054858565330505e-01 <_> 0 -1 705 9.6104722470045090e-03 5.2559971809387207e-01 1.7967459559440613e-01 <_> 0 -1 706 -6.2783220782876015e-03 2.2728569805622101e-01 5.1140302419662476e-01 <_> 0 -1 707 3.4598479978740215e-03 4.6263080835342407e-01 6.6082191467285156e-01 <_> 0 -1 708 -1.3112019514665008e-03 6.3175398111343384e-01 4.4368579983711243e-01 <_> 0 -1 709 2.6876179035753012e-03 5.4211097955703735e-01 4.0540221333503723e-01 <_> 0 -1 710 3.9118169806897640e-03 5.3584778308868408e-01 3.2734549045562744e-01 <_> 0 -1 711 -1.4206450432538986e-02 7.7935767173767090e-01 4.9757811427116394e-01 <_> 0 -1 712 7.1705528534948826e-04 5.2973198890686035e-01 3.5609039664268494e-01 <_> 0 -1 713 1.6635019565001130e-03 4.6780940890312195e-01 5.8164817094802856e-01 <_> 0 -1 714 3.3686188980937004e-03 5.2767342329025269e-01 3.4464201331138611e-01 <_> 0 -1 715 1.2799530290067196e-02 4.8346799612045288e-01 7.4721592664718628e-01 <_> 0 -1 716 3.3901201095432043e-03 4.5118591189384460e-01 6.4017212390899658e-01 <_> 0 -1 717 4.7070779837667942e-03 5.3356587886810303e-01 3.5552209615707397e-01 <_> 0 -1 718 1.4819339849054813e-03 4.2507070302963257e-01 5.7727241516113281e-01 <_> 0 -1 719 -6.9995759986341000e-03 3.0033200979232788e-01 5.2929002046585083e-01 <_> 0 -1 720 1.5939010307192802e-02 5.0673192739486694e-01 1.6755819320678711e-01 <_> 0 -1 721 7.6377349905669689e-03 4.7950699925422668e-01 7.0856010913848877e-01 <_> 0 -1 722 6.7334040068089962e-03 5.1331132650375366e-01 2.1624700725078583e-01 <_> 0 -1 723 -1.2858809903264046e-02 1.9388419389724731e-01 5.2513718605041504e-01 <_> 0 -1 724 -6.2270800117403269e-04 5.6865382194519043e-01 4.1978681087493896e-01 <_> 0 -1 725 -5.2651681471616030e-04 4.2241689562797546e-01 5.4296958446502686e-01 <_> 0 -1 726 1.1075099930167198e-02 5.1137751340866089e-01 2.5145179033279419e-01 <_> 0 -1 727 -3.6728251725435257e-02 7.1946620941162109e-01 4.8496189713478088e-01 <_> 0 -1 728 -2.8207109426148236e-04 3.8402619957923889e-01 5.3944462537765503e-01 <_> 0 -1 729 -2.7489690110087395e-03 5.9370887279510498e-01 4.5691820979118347e-01 <_> 0 -1 730 1.0047519579529762e-02 5.1385760307312012e-01 2.8022980690002441e-01 <_> 0 -1 731 -8.1497840583324432e-03 6.0900372266769409e-01 4.6361210942268372e-01 <_> 0 -1 732 -6.8833888508379459e-03 3.4586110711097717e-01 5.2546602487564087e-01 <_> 0 -1 733 -1.4039360394235700e-05 5.6931042671203613e-01 4.0820831060409546e-01 <_> 0 -1 734 1.5498419525101781e-03 4.3505370616912842e-01 5.8065170049667358e-01 <_> 0 -1 735 -6.7841499112546444e-03 1.4688730239868164e-01 5.1827752590179443e-01 <_> 0 -1 736 2.1705629478674382e-04 5.2935242652893066e-01 3.4561741352081299e-01 <_> 0 -1 737 3.1198898795992136e-04 4.6524509787559509e-01 5.9424138069152832e-01 <_> 0 -1 738 5.4507530294358730e-03 4.6535089612007141e-01 7.0248460769653320e-01 <_> 0 -1 739 -2.5818689027801156e-04 5.4972952604293823e-01 3.7689670920372009e-01 <_> 0 -1 740 -1.7442539334297180e-02 3.9190879464149475e-01 5.4574978351593018e-01 <_> 0 -1 741 -4.5343529433012009e-02 1.6313570737838745e-01 5.1549088954925537e-01 <_> 0 -1 742 1.9190689781680703e-03 5.1458978652954102e-01 2.7918958663940430e-01 <_> 0 -1 743 -6.0177869163453579e-03 6.5176361799240112e-01 4.7563329339027405e-01 <_> 0 -1 744 -4.0720738470554352e-03 5.5146527290344238e-01 4.0926858782768250e-01 <_> 0 -1 745 3.9855059003457427e-04 3.1652408838272095e-01 5.2855509519577026e-01 <_> 0 -1 746 -6.5418570302426815e-03 6.8533778190612793e-01 4.6528089046478271e-01 <_> 0 -1 747 3.4845089539885521e-03 5.4845881462097168e-01 4.5027598738670349e-01 <_> 0 -1 748 -1.3696780428290367e-02 6.3957798480987549e-01 4.5725551247596741e-01 <_> 0 -1 749 -1.7347140237689018e-02 2.7510729432106018e-01 5.1816147565841675e-01 <_> 0 -1 750 -4.0885428898036480e-03 3.3256360888481140e-01 5.1949840784072876e-01 <_> 0 -1 751 -9.4687901437282562e-03 5.9422808885574341e-01 4.8518198728561401e-01 <_> 0 -1 752 1.7084840219467878e-03 4.1671109199523926e-01 5.5198061466217041e-01 <_> 0 -1 753 9.4809094443917274e-03 5.4338949918746948e-01 4.2085149884223938e-01 <_> 0 -1 754 -4.7389650717377663e-03 6.4071899652481079e-01 4.5606550574302673e-01 <_> 0 -1 755 6.5761050209403038e-03 5.2145552635192871e-01 2.2582270205020905e-01 <_> 0 -1 756 -2.1690549328923225e-03 3.1515279412269592e-01 5.1567047834396362e-01 <_> 0 -1 757 1.4660170301795006e-02 4.8708370327949524e-01 6.6899412870407104e-01 <_> 0 -1 758 1.7231999663636088e-04 3.5697489976882935e-01 5.2510780096054077e-01 <_> 0 -1 759 -2.1803760901093483e-02 8.8259208202362061e-01 4.9663299322128296e-01 <_> 0 -1 760 -9.4736106693744659e-02 1.4461620151996613e-01 5.0611138343811035e-01 <_> 0 -1 761 5.5825551971793175e-03 5.3964787721633911e-01 4.2380660772323608e-01 <_> 0 -1 762 1.9517090404406190e-03 4.1704109311103821e-01 5.4977869987487793e-01 <_> 0 -1 763 1.2149900197982788e-02 4.6983671188354492e-01 5.6642740964889526e-01 <_> 0 -1 764 -7.5169620104134083e-03 6.2677729129791260e-01 4.4631358981132507e-01 <_> 0 -1 765 -7.1667909622192383e-02 3.0970111489295959e-01 5.2210032939910889e-01 <_> 0 -1 766 -8.8292419910430908e-02 8.1123888492584229e-02 5.0063651800155640e-01 <_> 0 -1 767 3.1063079833984375e-02 5.1555037498474121e-01 1.2822559475898743e-01 <_> 0 -1 768 4.6621840447187424e-02 4.6997779607772827e-01 7.3639607429504395e-01 <_> 0 -1 769 -1.2189489789307117e-02 3.9205300807952881e-01 5.5189967155456543e-01 <_> 0 -1 770 1.3016110286116600e-02 5.2606582641601562e-01 3.6851361393928528e-01 <_> 0 -1 771 -3.4952899441123009e-03 6.3392949104309082e-01 4.7162809967994690e-01 <_> 0 -1 772 -4.4015039748046547e-05 5.3330272436141968e-01 3.7761849164962769e-01 <_> 0 -1 773 -1.0966490209102631e-01 1.7653420567512512e-01 5.1983469724655151e-01 <_> 0 -1 774 -9.0279558207839727e-04 5.3241598606109619e-01 3.8389080762863159e-01 <_> 0 -1 775 7.1126641705632210e-04 4.6479299664497375e-01 5.7552242279052734e-01 <_> 0 -1 776 -3.1250279862433672e-03 3.2367089390754700e-01 5.1667708158493042e-01 <_> 0 -1 777 2.4144679773598909e-03 4.7874391078948975e-01 6.4597177505493164e-01 <_> 0 -1 778 4.4391240226104856e-04 4.4093081355094910e-01 6.0102558135986328e-01 <_> 0 -1 779 -2.2611189342569560e-04 4.0381139516830444e-01 5.4932558536529541e-01 <_> 135 6.6669120788574219e+01 <_> 0 -1 780 -4.6901289373636246e-02 6.6001719236373901e-01 3.7438011169433594e-01 <_> 0 -1 781 -1.4568349579349160e-03 5.7839912176132202e-01 3.4377971291542053e-01 <_> 0 -1 782 5.5598369799554348e-03 3.6222669482231140e-01 5.9082162380218506e-01 <_> 0 -1 783 7.3170487303286791e-04 5.5004191398620605e-01 2.8735581040382385e-01 <_> 0 -1 784 1.3318009441718459e-03 2.6731699705123901e-01 5.4310190677642822e-01 <_> 0 -1 785 2.4347059661522508e-04 3.8550278544425964e-01 5.7413887977600098e-01 <_> 0 -1 786 -3.0512469820678234e-03 5.5032098293304443e-01 3.4628450870513916e-01 <_> 0 -1 787 -6.8657199153676629e-04 3.2912218570709229e-01 5.4295092821121216e-01 <_> 0 -1 788 1.4668200165033340e-03 3.5883820056915283e-01 5.3518110513687134e-01 <_> 0 -1 789 3.2021870720200241e-04 4.2968419194221497e-01 5.7002341747283936e-01 <_> 0 -1 790 7.4122188379988074e-04 5.2821648120880127e-01 3.3668708801269531e-01 <_> 0 -1 791 3.8330298848450184e-03 4.5595678687095642e-01 6.2573361396789551e-01 <_> 0 -1 792 -1.5456439927220345e-02 2.3501169681549072e-01 5.1294529438018799e-01 <_> 0 -1 793 2.6796779129654169e-03 5.3294152021408081e-01 4.1550621390342712e-01 <_> 0 -1 794 2.8296569362282753e-03 4.2730879783630371e-01 5.8045381307601929e-01 <_> 0 -1 795 -3.9444249123334885e-03 2.9126119613647461e-01 5.2026861906051636e-01 <_> 0 -1 796 2.7179559692740440e-03 5.3076881170272827e-01 3.5856771469116211e-01 <_> 0 -1 797 5.9077627956867218e-03 4.7037750482559204e-01 5.9415858983993530e-01 <_> 0 -1 798 -4.2240349575877190e-03 2.1415670216083527e-01 5.0887960195541382e-01 <_> 0 -1 799 4.0725888684391975e-03 4.7664138674736023e-01 6.8410611152648926e-01 <_> 0 -1 800 1.0149530135095119e-02 5.3607988357543945e-01 3.7484970688819885e-01 <_> 0 -1 801 -1.8864999583456665e-04 5.7201302051544189e-01 3.8538050651550293e-01 <_> 0 -1 802 -4.8864358104765415e-03 3.6931228637695312e-01 5.3409588336944580e-01 <_> 0 -1 803 2.6158479973673820e-02 4.9623748660087585e-01 6.0599899291992188e-01 <_> 0 -1 804 4.8560759751126170e-04 4.4389459490776062e-01 6.0124689340591431e-01 <_> 0 -1 805 1.1268709786236286e-02 5.2442502975463867e-01 1.8403880298137665e-01 <_> 0 -1 806 -2.8114619199186563e-03 6.0602837800979614e-01 4.4098970293998718e-01 <_> 0 -1 807 -5.6112729944288731e-03 3.8911709189414978e-01 5.5892372131347656e-01 <_> 0 -1 808 8.5680093616247177e-03 5.0693458318710327e-01 2.0626190304756165e-01 <_> 0 -1 809 -3.8172779022715986e-04 5.8822017908096313e-01 4.1926109790802002e-01 <_> 0 -1 810 -1.7680290329735726e-04 5.5336058139801025e-01 4.0033689141273499e-01 <_> 0 -1 811 6.5112537704408169e-03 3.3101469278335571e-01 5.4441910982131958e-01 <_> 0 -1 812 -6.5948683186434209e-05 5.4338318109512329e-01 3.9449059963226318e-01 <_> 0 -1 813 6.9939051754772663e-03 5.6003582477569580e-01 4.1927140951156616e-01 <_> 0 -1 814 -4.6744439750909805e-03 6.6854667663574219e-01 4.6049609780311584e-01 <_> 0 -1 815 1.1589850299060345e-02 5.3571212291717529e-01 2.9268300533294678e-01 <_> 0 -1 816 1.3007840141654015e-02 4.6798178553581238e-01 7.3074632883071899e-01 <_> 0 -1 817 -1.1008579749614000e-03 3.9375010132789612e-01 5.4150652885437012e-01 <_> 0 -1 818 6.0472649056464434e-04 4.2423760890960693e-01 5.6040412187576294e-01 <_> 0 -1 819 -1.4494840055704117e-02 3.6312100291252136e-01 5.2931827306747437e-01 <_> 0 -1 820 -5.3056948818266392e-03 6.8604522943496704e-01 4.6218210458755493e-01 <_> 0 -1 821 -8.1829127157106996e-04 3.9440968632698059e-01 5.4204392433166504e-01 <_> 0 -1 822 -1.9077520817518234e-02 1.9626219570636749e-01 5.0378918647766113e-01 <_> 0 -1 823 3.5549470339901745e-04 4.0862590074539185e-01 5.6139731407165527e-01 <_> 0 -1 824 1.9679730758070946e-03 4.4891211390495300e-01 5.9261232614517212e-01 <_> 0 -1 825 6.9189141504466534e-03 5.3359258174896240e-01 3.7283858656883240e-01 <_> 0 -1 826 2.9872779268771410e-03 5.1113212108612061e-01 2.9756438732147217e-01 <_> 0 -1 827 -6.2264618463814259e-03 5.5414897203445435e-01 4.8245379328727722e-01 <_> 0 -1 828 1.3353300280869007e-02 4.5864239335060120e-01 6.4147979021072388e-01 <_> 0 -1 829 3.3505238592624664e-02 5.3924250602722168e-01 3.4299948811531067e-01 <_> 0 -1 830 -2.5294460356235504e-03 1.7037139832973480e-01 5.0133150815963745e-01 <_> 0 -1 831 -1.2801629491150379e-03 5.3054618835449219e-01 4.6974050998687744e-01 <_> 0 -1 832 7.0687388069927692e-03 4.6155458688735962e-01 6.4365047216415405e-01 <_> 0 -1 833 9.6880499040707946e-04 4.8335990309715271e-01 6.0438942909240723e-01 <_> 0 -1 834 3.9647659286856651e-03 5.1876372098922729e-01 3.2318168878555298e-01 <_> 0 -1 835 -2.2057730704545975e-02 4.0792569518089294e-01 5.2009809017181396e-01 <_> 0 -1 836 -6.6906312713399529e-04 5.3316092491149902e-01 3.8156008720397949e-01 <_> 0 -1 837 -6.7009328631684184e-04 5.6554222106933594e-01 4.6889019012451172e-01 <_> 0 -1 838 7.4284552829340100e-04 4.5343810319900513e-01 6.2874001264572144e-01 <_> 0 -1 839 2.2227810695767403e-03 5.3506332635879517e-01 3.3036559820175171e-01 <_> 0 -1 840 -5.4130521602928638e-03 1.1136870086193085e-01 5.0054347515106201e-01 <_> 0 -1 841 -1.4520040167553816e-05 5.6287378072738647e-01 4.3251338601112366e-01 <_> 0 -1 842 2.3369169502984732e-04 4.1658350825309753e-01 5.4477912187576294e-01 <_> 0 -1 843 4.2894547805190086e-03 4.8603910207748413e-01 6.7786490917205811e-01 <_> 0 -1 844 5.9103150852024555e-03 5.2623051404953003e-01 3.6121138930320740e-01 <_> 0 -1 845 1.2900539673864841e-02 5.3193771839141846e-01 3.2502880692481995e-01 <_> 0 -1 846 4.6982979401946068e-03 4.6182450652122498e-01 6.6659259796142578e-01 <_> 0 -1 847 1.0439859703183174e-02 5.5056709051132202e-01 3.8836041092872620e-01 <_> 0 -1 848 3.0443191062659025e-03 4.6978530287742615e-01 7.3018449544906616e-01 <_> 0 -1 849 -6.1593751888722181e-04 3.8308390974998474e-01 5.4649841785430908e-01 <_> 0 -1 850 -3.4247159492224455e-03 2.5663000345230103e-01 5.0895309448242188e-01 <_> 0 -1 851 -9.3538565561175346e-03 6.4699661731719971e-01 4.9407958984375000e-01 <_> 0 -1 852 5.2338998764753342e-02 4.7459828853607178e-01 7.8787708282470703e-01 <_> 0 -1 853 3.5765620414167643e-03 5.3066647052764893e-01 2.7484980225563049e-01 <_> 0 -1 854 7.1555317845195532e-04 5.4131257534027100e-01 4.0419089794158936e-01 <_> 0 -1 855 -1.0516679845750332e-02 6.1585122346878052e-01 4.8152831196784973e-01 <_> 0 -1 856 7.7347927726805210e-03 4.6958059072494507e-01 7.0289808511734009e-01 <_> 0 -1 857 -4.3226778507232666e-03 2.8495660424232483e-01 5.3046840429306030e-01 <_> 0 -1 858 -2.5534399319440126e-03 7.0569849014282227e-01 4.6888920664787292e-01 <_> 0 -1 859 1.0268510231981054e-04 3.9029321074485779e-01 5.5734640359878540e-01 <_> 0 -1 860 7.1395188570022583e-06 3.6842319369316101e-01 5.2639877796173096e-01 <_> 0 -1 861 -1.6711989883333445e-03 3.8491758704185486e-01 5.3872710466384888e-01 <_> 0 -1 862 4.9260449595749378e-03 4.7297719120979309e-01 7.4472510814666748e-01 <_> 0 -1 863 4.3908702209591866e-03 4.8091810941696167e-01 5.5919218063354492e-01 <_> 0 -1 864 -1.7793629318475723e-02 6.9036781787872314e-01 4.6769270300865173e-01 <_> 0 -1 865 2.0469669252634048e-03 5.3706902265548706e-01 3.3081620931625366e-01 <_> 0 -1 866 2.9891489073634148e-02 5.1398652791976929e-01 3.3090591430664062e-01 <_> 0 -1 867 1.5494900289922953e-03 4.6602371335029602e-01 6.0783427953720093e-01 <_> 0 -1 868 1.4956969534978271e-03 4.4048359990119934e-01 5.8639198541641235e-01 <_> 0 -1 869 9.5885928021743894e-04 5.4359710216522217e-01 4.2085230350494385e-01 <_> 0 -1 870 4.9643701640889049e-04 5.3705781698226929e-01 4.0006220340728760e-01 <_> 0 -1 871 -2.7280810754746199e-03 5.6594127416610718e-01 4.2596429586410522e-01 <_> 0 -1 872 2.3026480339467525e-03 5.1616579294204712e-01 3.3508691191673279e-01 <_> 0 -1 873 2.5151631236076355e-01 4.8696619272232056e-01 7.1473097801208496e-01 <_> 0 -1 874 -4.6328022144734859e-03 2.7274489402770996e-01 5.0837898254394531e-01 <_> 0 -1 875 -4.0434490889310837e-02 6.8514388799667358e-01 5.0217670202255249e-01 <_> 0 -1 876 1.4972220014897175e-05 4.2844650149345398e-01 5.5225551128387451e-01 <_> 0 -1 877 -2.4050309730228037e-04 4.2261189222335815e-01 5.3900748491287231e-01 <_> 0 -1 878 2.3657839745283127e-02 4.7446319460868835e-01 7.5043660402297974e-01 <_> 0 -1 879 -8.1449104472994804e-03 4.2450588941574097e-01 5.5383628606796265e-01 <_> 0 -1 880 -3.6992130335420370e-03 5.9523570537567139e-01 4.5297130942344666e-01 <_> 0 -1 881 -6.7718601785600185e-03 4.1377940773963928e-01 5.4733997583389282e-01 <_> 0 -1 882 4.2669530957937241e-03 4.4841149449348450e-01 5.7979941368103027e-01 <_> 0 -1 883 1.7791989957913756e-03 5.6248587369918823e-01 4.4324448704719543e-01 <_> 0 -1 884 1.6774770338088274e-03 4.6377518773078918e-01 6.3642418384552002e-01 <_> 0 -1 885 1.1732629500329494e-03 4.5445030927658081e-01 5.9144157171249390e-01 <_> 0 -1 886 8.6998171173036098e-04 5.3347527980804443e-01 3.8859179615974426e-01 <_> 0 -1 887 7.6378340600058436e-04 5.3985852003097534e-01 3.7449419498443604e-01 <_> 0 -1 888 1.5684569370932877e-04 4.3178731203079224e-01 5.6146162748336792e-01 <_> 0 -1 889 -2.1511370316147804e-02 1.7859250307083130e-01 5.1855427026748657e-01 <_> 0 -1 890 1.3081369979772717e-04 4.3424990773200989e-01 5.6828498840332031e-01 <_> 0 -1 891 2.1992040798068047e-02 5.1617169380187988e-01 2.3793940246105194e-01 <_> 0 -1 892 -8.0136500764638186e-04 5.9867632389068604e-01 4.4664269685745239e-01 <_> 0 -1 893 -8.2736099138855934e-03 4.1082179546356201e-01 5.2510571479797363e-01 <_> 0 -1 894 3.6831789184361696e-03 5.1738142967224121e-01 3.3975180983543396e-01 <_> 0 -1 895 -7.9525681212544441e-03 6.8889832496643066e-01 4.8459240794181824e-01 <_> 0 -1 896 1.5382299898192286e-03 5.1785671710968018e-01 3.4541139006614685e-01 <_> 0 -1 897 -1.4043530449271202e-02 1.6784210503101349e-01 5.1886677742004395e-01 <_> 0 -1 898 1.4315890148282051e-03 4.3682569265365601e-01 5.6557738780975342e-01 <_> 0 -1 899 -3.4014228731393814e-02 7.8022962808609009e-01 4.9592170119285583e-01 <_> 0 -1 900 -1.2027299962937832e-02 1.5851010382175446e-01 5.0322318077087402e-01 <_> 0 -1 901 1.3316619396209717e-01 5.1633048057556152e-01 2.7551281452178955e-01 <_> 0 -1 902 -1.5221949433907866e-03 3.7283179163932800e-01 5.2145522832870483e-01 <_> 0 -1 903 -9.3929271679371595e-04 5.8383792638778687e-01 4.5111650228500366e-01 <_> 0 -1 904 2.7719739824533463e-02 4.7282868623733521e-01 7.3315447568893433e-01 <_> 0 -1 905 3.1030150130391121e-03 5.3022021055221558e-01 4.1015630960464478e-01 <_> 0 -1 906 7.7861219644546509e-02 4.9983340501785278e-01 1.2729619443416595e-01 <_> 0 -1 907 -1.5854939818382263e-02 5.0833359360694885e-02 5.1656562089920044e-01 <_> 0 -1 908 -4.9725300632417202e-03 6.7981338500976562e-01 4.6842318773269653e-01 <_> 0 -1 909 -9.7676506265997887e-04 6.0107719898223877e-01 4.7889319062232971e-01 <_> 0 -1 910 -2.4647710379213095e-03 3.3933979272842407e-01 5.2205038070678711e-01 <_> 0 -1 911 -6.7937700077891350e-03 4.3651369214057922e-01 5.2396631240844727e-01 <_> 0 -1 912 3.2608021050691605e-02 5.0527238845825195e-01 2.4252149462699890e-01 <_> 0 -1 913 -5.8514421107247472e-04 5.7339739799499512e-01 4.7585740685462952e-01 <_> 0 -1 914 -2.9632600024342537e-02 3.8922891020774841e-01 5.2635979652404785e-01 <_> 137 6.7698921203613281e+01 <_> 0 -1 915 4.6550851315259933e-02 3.2769501209259033e-01 6.2405228614807129e-01 <_> 0 -1 916 7.9537127166986465e-03 4.2564851045608521e-01 6.9429391622543335e-01 <_> 0 -1 917 6.8221561377868056e-04 3.7114870548248291e-01 5.9007328748703003e-01 <_> 0 -1 918 -1.9348249770700932e-04 2.0411339402198792e-01 5.3005450963973999e-01 <_> 0 -1 919 -2.6710508973337710e-04 5.4161262512207031e-01 3.1031790375709534e-01 <_> 0 -1 920 2.7818060480058193e-03 5.2778327465057373e-01 3.4670698642730713e-01 <_> 0 -1 921 -4.6779078547842801e-04 5.3082311153411865e-01 3.2944920659065247e-01 <_> 0 -1 922 -3.0335160772665404e-05 5.7738727331161499e-01 3.8520970940589905e-01 <_> 0 -1 923 7.8038009814918041e-04 4.3174389004707336e-01 6.1500579118728638e-01 <_> 0 -1 924 -4.2553851380944252e-03 2.9339039325714111e-01 5.3242927789688110e-01 <_> 0 -1 925 -2.4735610350035131e-04 5.4688447713851929e-01 3.8430300354957581e-01 <_> 0 -1 926 -1.4724259381182492e-04 4.2815428972244263e-01 5.7555872201919556e-01 <_> 0 -1 927 1.1864770203828812e-03 3.7473011016845703e-01 5.4714661836624146e-01 <_> 0 -1 928 2.3936580400913954e-03 4.5377838611602783e-01 6.1115288734436035e-01 <_> 0 -1 929 -1.5390539774671197e-03 2.9713419079780579e-01 5.1895380020141602e-01 <_> 0 -1 930 -7.1968790143728256e-03 6.6990667581558228e-01 4.7264769673347473e-01 <_> 0 -1 931 -4.1499789222143590e-04 3.3849540352821350e-01 5.2603179216384888e-01 <_> 0 -1 932 4.4359830208122730e-03 5.3991222381591797e-01 3.9201408624649048e-01 <_> 0 -1 933 2.6606200262904167e-03 4.4825780391693115e-01 6.1196178197860718e-01 <_> 0 -1 934 -1.5287200221791863e-03 3.7112379074096680e-01 5.3402662277221680e-01 <_> 0 -1 935 -4.7397250309586525e-03 6.0310882329940796e-01 4.4551450014114380e-01 <_> 0 -1 936 -1.4829129911959171e-02 2.8387540578842163e-01 5.3418618440628052e-01 <_> 0 -1 937 9.2275557108223438e-04 5.2095472812652588e-01 3.3616539835929871e-01 <_> 0 -1 938 8.3529807627201080e-02 5.1199698448181152e-01 8.1164449453353882e-02 <_> 0 -1 939 -7.5633148662745953e-04 3.3171200752258301e-01 5.1898312568664551e-01 <_> 0 -1 940 9.8403859883546829e-03 5.2475982904434204e-01 2.3349590599536896e-01 <_> 0 -1 941 -1.5953830443322659e-03 5.7500940561294556e-01 4.2956221103668213e-01 <_> 0 -1 942 3.4766020689858124e-05 4.3424451351165771e-01 5.5640292167663574e-01 <_> 0 -1 943 2.9862910509109497e-02 4.5791471004486084e-01 6.5791881084442139e-01 <_> 0 -1 944 1.1325590312480927e-02 5.2743119001388550e-01 3.6738881468772888e-01 <_> 0 -1 945 -8.7828645482659340e-03 7.1003687381744385e-01 4.6421670913696289e-01 <_> 0 -1 946 4.3639959767460823e-03 5.2792161703109741e-01 2.7058771252632141e-01 <_> 0 -1 947 4.1804728098213673e-03 5.0725251436233521e-01 2.4490830302238464e-01 <_> 0 -1 948 -4.5668511302210391e-04 4.2831051349639893e-01 5.5486911535263062e-01 <_> 0 -1 949 -3.7140368949621916e-03 5.5193877220153809e-01 4.1036531329154968e-01 <_> 0 -1 950 -2.5304289534687996e-02 6.8670022487640381e-01 4.8698890209197998e-01 <_> 0 -1 951 -3.4454080741852522e-04 3.7288740277290344e-01 5.2876931428909302e-01 <_> 0 -1 952 -8.3935231668874621e-04 6.0601520538330078e-01 4.6160620450973511e-01 <_> 0 -1 953 1.7280049622058868e-02 5.0496357679367065e-01 1.8198239803314209e-01 <_> 0 -1 954 -6.3595077954232693e-03 1.6312399506568909e-01 5.2327787876129150e-01 <_> 0 -1 955 1.0298109846189618e-03 4.4632780551910400e-01 6.1765491962432861e-01 <_> 0 -1 956 1.0117109632119536e-03 5.4733848571777344e-01 4.3006989359855652e-01 <_> 0 -1 957 -1.0308800265192986e-02 1.1669850349426270e-01 5.0008672475814819e-01 <_> 0 -1 958 5.4682018235325813e-03 4.7692871093750000e-01 6.7192137241363525e-01 <_> 0 -1 959 -9.1696460731327534e-04 3.4710898995399475e-01 5.1781648397445679e-01 <_> 0 -1 960 2.3922820109874010e-03 4.7852361202239990e-01 6.2163108587265015e-01 <_> 0 -1 961 -7.5573818758130074e-03 5.8147960901260376e-01 4.4100850820541382e-01 <_> 0 -1 962 -7.7024032361805439e-04 3.8780000805854797e-01 5.4657220840454102e-01 <_> 0 -1 963 -8.7125990539789200e-03 1.6600510478019714e-01 4.9958360195159912e-01 <_> 0 -1 964 -1.0306320153176785e-02 4.0933910012245178e-01 5.2742338180541992e-01 <_> 0 -1 965 -2.0940979011356831e-03 6.2061947584152222e-01 4.5722800493240356e-01 <_> 0 -1 966 6.8099051713943481e-03 5.5677592754364014e-01 4.1556000709533691e-01 <_> 0 -1 967 -1.0746059706434608e-03 5.6389278173446655e-01 4.3530249595642090e-01 <_> 0 -1 968 2.1550289820879698e-03 4.8262658715248108e-01 6.7497581243515015e-01 <_> 0 -1 969 3.1742319464683533e-02 5.0483798980712891e-01 1.8832489848136902e-01 <_> 0 -1 970 -7.8382723033428192e-02 2.3695489764213562e-01 5.2601581811904907e-01 <_> 0 -1 971 5.7415119372308254e-03 5.0488287210464478e-01 2.7764698863029480e-01 <_> 0 -1 972 -2.9014600440859795e-03 6.2386047840118408e-01 4.6933171153068542e-01 <_> 0 -1 973 -2.6427931152284145e-03 3.3141419291496277e-01 5.1697772741317749e-01 <_> 0 -1 974 -1.0949660092592239e-01 2.3800450563430786e-01 5.1834410429000854e-01 <_> 0 -1 975 7.4075913289561868e-05 4.0696358680725098e-01 5.3621500730514526e-01 <_> 0 -1 976 -5.0593802006915212e-04 5.5067062377929688e-01 4.3745940923690796e-01 <_> 0 -1 977 -8.2131777890026569e-04 5.5257099866867065e-01 4.2093759775161743e-01 <_> 0 -1 978 -6.0276539443293586e-05 5.4554748535156250e-01 4.7482660412788391e-01 <_> 0 -1 979 6.8065142259001732e-03 5.1579958200454712e-01 3.4245771169662476e-01 <_> 0 -1 980 1.7202789895236492e-03 5.0132077932357788e-01 6.3312637805938721e-01 <_> 0 -1 981 -1.3016929733566940e-04 5.5397182703018188e-01 4.2268699407577515e-01 <_> 0 -1 982 -4.8016388900578022e-03 4.4250950217247009e-01 5.4307800531387329e-01 <_> 0 -1 983 -2.5399310979992151e-03 7.1457821130752563e-01 4.6976050734519958e-01 <_> 0 -1 984 -1.4278929447755218e-03 4.0704450011253357e-01 5.3996050357818604e-01 <_> 0 -1 985 -2.5142550468444824e-02 7.8846907615661621e-01 4.7473520040512085e-01 <_> 0 -1 986 -3.8899609353393316e-03 4.2961919307708740e-01 5.5771100521087646e-01 <_> 0 -1 987 4.3947459198534489e-03 4.6931621432304382e-01 7.0239442586898804e-01 <_> 0 -1 988 2.4678420275449753e-02 5.2423220872879028e-01 3.8125100731849670e-01 <_> 0 -1 989 3.8047678768634796e-02 5.0117397308349609e-01 1.6878280043601990e-01 <_> 0 -1 990 7.9424865543842316e-03 4.8285821080207825e-01 6.3695681095123291e-01 <_> 0 -1 991 -1.5110049862414598e-03 5.9064859151840210e-01 4.4876679778099060e-01 <_> 0 -1 992 6.4201741479337215e-03 5.2410978078842163e-01 2.9905700683593750e-01 <_> 0 -1 993 -2.9802159406244755e-03 3.0414658784866333e-01 5.0784897804260254e-01 <_> 0 -1 994 -7.4580078944563866e-04 4.1281390190124512e-01 5.2568262815475464e-01 <_> 0 -1 995 -1.0470950044691563e-02 5.8083951473236084e-01 4.4942960143089294e-01 <_> 0 -1 996 9.3369204550981522e-03 5.2465528249740601e-01 2.6589488983154297e-01 <_> 0 -1 997 2.7936900034546852e-02 4.6749550104141235e-01 7.0872569084167480e-01 <_> 0 -1 998 7.4277678504586220e-03 5.4094868898391724e-01 3.7585180997848511e-01 <_> 0 -1 999 -2.3584509268403053e-02 3.7586399912834167e-01 5.2385509014129639e-01 <_> 0 -1 1000 1.1452640173956752e-03 4.3295788764953613e-01 5.8042472600936890e-01 <_> 0 -1 1001 -4.3468660442158580e-04 5.2806180715560913e-01 3.8730698823928833e-01 <_> 0 -1 1002 1.0648540221154690e-02 4.9021130800247192e-01 5.6812518835067749e-01 <_> 0 -1 1003 -3.9418050437234342e-04 5.5708801746368408e-01 4.3182510137557983e-01 <_> 0 -1 1004 -1.3270479394122958e-04 5.6584399938583374e-01 4.3435549736022949e-01 <_> 0 -1 1005 -2.0125510636717081e-03 6.0567390918731689e-01 4.5375239849090576e-01 <_> 0 -1 1006 2.4854319635778666e-03 5.3904771804809570e-01 4.1380101442337036e-01 <_> 0 -1 1007 1.8237880431115627e-03 4.3548288941383362e-01 5.7171887159347534e-01 <_> 0 -1 1008 -1.6656659543514252e-02 3.0109131336212158e-01 5.2161228656768799e-01 <_> 0 -1 1009 8.0349558265879750e-04 5.3001511096954346e-01 3.8183969259262085e-01 <_> 0 -1 1010 3.4170378930866718e-03 5.3280287981033325e-01 4.2414000630378723e-01 <_> 0 -1 1011 -3.6222729249857366e-04 5.4917281866073608e-01 4.1869771480560303e-01 <_> 0 -1 1012 -1.1630020290613174e-01 1.4407220482826233e-01 5.2264511585235596e-01 <_> 0 -1 1013 -1.4695010147988796e-02 7.7477252483367920e-01 4.7157171368598938e-01 <_> 0 -1 1014 2.1972130052745342e-03 5.3554338216781616e-01 3.3156448602676392e-01 <_> 0 -1 1015 -4.6965209185145795e-04 5.7672351598739624e-01 4.4581368565559387e-01 <_> 0 -1 1016 6.5144998952746391e-03 5.2156740427017212e-01 3.6478888988494873e-01 <_> 0 -1 1017 2.1300060674548149e-02 4.9942049384117126e-01 1.5679509937763214e-01 <_> 0 -1 1018 3.1881409231573343e-03 4.7422000765800476e-01 6.2872701883316040e-01 <_> 0 -1 1019 9.0019777417182922e-04 5.3479540348052979e-01 3.9437520503997803e-01 <_> 0 -1 1020 -5.1772277802228928e-03 6.7271918058395386e-01 5.0131380558013916e-01 <_> 0 -1 1021 -4.3764649890363216e-03 3.1066751480102539e-01 5.1287931203842163e-01 <_> 0 -1 1022 2.6299960445612669e-03 4.8863101005554199e-01 5.7552158832550049e-01 <_> 0 -1 1023 -2.0458688959479332e-03 6.0257941484451294e-01 4.5580768585205078e-01 <_> 0 -1 1024 6.9482706487178802e-02 5.2407479286193848e-01 2.1852590143680573e-01 <_> 0 -1 1025 2.4048939347267151e-02 5.0118672847747803e-01 2.0906220376491547e-01 <_> 0 -1 1026 3.1095340382307768e-03 4.8667120933532715e-01 7.1085482835769653e-01 <_> 0 -1 1027 -1.2503260513767600e-03 3.4078910946846008e-01 5.1561951637268066e-01 <_> 0 -1 1028 -1.0281190043315291e-03 5.5755722522735596e-01 4.4394320249557495e-01 <_> 0 -1 1029 -8.8893622159957886e-03 6.4020007848739624e-01 4.6204420924186707e-01 <_> 0 -1 1030 -6.1094801640138030e-04 3.7664419412612915e-01 5.4488998651504517e-01 <_> 0 -1 1031 -5.7686357758939266e-03 3.3186489343643188e-01 5.1336771249771118e-01 <_> 0 -1 1032 1.8506490159779787e-03 4.9035701155662537e-01 6.4069348573684692e-01 <_> 0 -1 1033 -9.9799469113349915e-02 1.5360510349273682e-01 5.0155621767044067e-01 <_> 0 -1 1034 -3.5128349065780640e-01 5.8823131024837494e-02 5.1743787527084351e-01 <_> 0 -1 1035 -4.5244570821523666e-02 6.9614887237548828e-01 4.6778729557991028e-01 <_> 0 -1 1036 7.1481578052043915e-02 5.1679861545562744e-01 1.0380929708480835e-01 <_> 0 -1 1037 2.1895780228078365e-03 4.2730781435966492e-01 5.5320608615875244e-01 <_> 0 -1 1038 -5.9242651332169771e-04 4.6389439702033997e-01 5.2763891220092773e-01 <_> 0 -1 1039 1.6788389766588807e-03 5.3016489744186401e-01 3.9320349693298340e-01 <_> 0 -1 1040 -2.2163488902151585e-03 5.6306940317153931e-01 4.7570338845252991e-01 <_> 0 -1 1041 1.1568699846975505e-04 4.3075358867645264e-01 5.5357027053833008e-01 <_> 0 -1 1042 -7.2017288766801357e-03 1.4448820054531097e-01 5.1930642127990723e-01 <_> 0 -1 1043 8.9081272017210722e-04 4.3844321370124817e-01 5.5936211347579956e-01 <_> 0 -1 1044 1.9605009583756328e-04 5.3404158353805542e-01 4.7059568762779236e-01 <_> 0 -1 1045 5.2022142335772514e-04 5.2138561010360718e-01 3.8100790977478027e-01 <_> 0 -1 1046 9.4588572392240167e-04 4.7694149613380432e-01 6.1307388544082642e-01 <_> 0 -1 1047 9.1698471806012094e-05 4.2450091242790222e-01 5.4293632507324219e-01 <_> 0 -1 1048 2.1833200007677078e-03 5.4577308893203735e-01 4.1910758614540100e-01 <_> 0 -1 1049 -8.6039671441540122e-04 5.7645887136459351e-01 4.4716599583625793e-01 <_> 0 -1 1050 -1.3236239552497864e-02 6.3728231191635132e-01 4.6950098872184753e-01 <_> 0 -1 1051 4.3376701069064438e-04 5.3178739547729492e-01 3.9458298683166504e-01 <_> 140 6.9229873657226562e+01 <_> 0 -1 1052 -2.4847149848937988e-02 6.5555167198181152e-01 3.8733118772506714e-01 <_> 0 -1 1053 6.1348611488938332e-03 3.7480720877647400e-01 5.9739977121353149e-01 <_> 0 -1 1054 6.4498498104512691e-03 5.4254919290542603e-01 2.5488111376762390e-01 <_> 0 -1 1055 6.3491211039945483e-04 2.4624420702457428e-01 5.3872537612915039e-01 <_> 0 -1 1056 1.4023890253156424e-03 5.5943220853805542e-01 3.5286578536033630e-01 <_> 0 -1 1057 3.0044000595808029e-04 3.9585039019584656e-01 5.7659381628036499e-01 <_> 0 -1 1058 1.0042409849120304e-04 3.6989969015121460e-01 5.5349981784820557e-01 <_> 0 -1 1059 -5.0841490738093853e-03 3.7110909819602966e-01 5.5478000640869141e-01 <_> 0 -1 1060 -1.9537260755896568e-02 7.4927550554275513e-01 4.5792970061302185e-01 <_> 0 -1 1061 -7.4532740654831287e-06 5.6497871875762939e-01 3.9040699601173401e-01 <_> 0 -1 1062 -3.6079459823668003e-03 3.3810880780220032e-01 5.2678012847900391e-01 <_> 0 -1 1063 2.0697501022368670e-03 5.5192911624908447e-01 3.7143889069557190e-01 <_> 0 -1 1064 -4.6463840408250690e-04 5.6082147359848022e-01 4.1135668754577637e-01 <_> 0 -1 1065 7.5490452582016587e-04 3.5592061281204224e-01 5.3293561935424805e-01 <_> 0 -1 1066 -9.8322238773107529e-04 5.4147958755493164e-01 3.7632051110267639e-01 <_> 0 -1 1067 -1.9940640777349472e-02 6.3479030132293701e-01 4.7052991390228271e-01 <_> 0 -1 1068 3.7680300883948803e-03 3.9134898781776428e-01 5.5637162923812866e-01 <_> 0 -1 1069 -9.4528505578637123e-03 2.5548928976058960e-01 5.2151167392730713e-01 <_> 0 -1 1070 2.9560849070549011e-03 5.1746791601181030e-01 3.0639201402664185e-01 <_> 0 -1 1071 9.1078737750649452e-03 5.3884482383728027e-01 2.8859630227088928e-01 <_> 0 -1 1072 1.8219229532405734e-03 4.3360430002212524e-01 5.8521968126296997e-01 <_> 0 -1 1073 1.4688739553093910e-02 5.2873617410659790e-01 2.8700059652328491e-01 <_> 0 -1 1074 -1.4387990348041058e-02 7.0194488763809204e-01 4.6473708748817444e-01 <_> 0 -1 1075 -1.8986649811267853e-02 2.9865521192550659e-01 5.2470117807388306e-01 <_> 0 -1 1076 1.1527639580890536e-03 4.3234738707542419e-01 5.9316617250442505e-01 <_> 0 -1 1077 1.0933670215308666e-02 5.2868640422821045e-01 3.1303191184997559e-01 <_> 0 -1 1078 -1.4932730235159397e-02 2.6584190130233765e-01 5.0840771198272705e-01 <_> 0 -1 1079 -2.9970539617352188e-04 5.4635268449783325e-01 3.7407240271568298e-01 <_> 0 -1 1080 4.1677621193230152e-03 4.7034969925880432e-01 7.4357217550277710e-01 <_> 0 -1 1081 -6.3905320130288601e-03 2.0692589879035950e-01 5.2805382013320923e-01 <_> 0 -1 1082 4.5029609464108944e-03 5.1826488971710205e-01 3.4835430979728699e-01 <_> 0 -1 1083 -9.2040365561842918e-03 6.8037772178649902e-01 4.9323600530624390e-01 <_> 0 -1 1084 8.1327259540557861e-02 5.0583988428115845e-01 2.2530519962310791e-01 <_> 0 -1 1085 -1.5079280734062195e-01 2.9634249210357666e-01 5.2646797895431519e-01 <_> 0 -1 1086 3.3179009333252907e-03 4.6554958820343018e-01 7.0729321241378784e-01 <_> 0 -1 1087 7.7402801252901554e-04 4.7803479433059692e-01 5.6682378053665161e-01 <_> 0 -1 1088 6.8199541419744492e-04 4.2869961261749268e-01 5.7221567630767822e-01 <_> 0 -1 1089 5.3671570494771004e-03 5.2993071079254150e-01 3.1146219372749329e-01 <_> 0 -1 1090 9.7018666565418243e-05 3.6746388673782349e-01 5.2694618701934814e-01 <_> 0 -1 1091 -1.2534089386463165e-01 2.3514920473098755e-01 5.2457910776138306e-01 <_> 0 -1 1092 -5.2516269497573376e-03 7.1159368753433228e-01 4.6937671303749084e-01 <_> 0 -1 1093 -7.8342109918594360e-03 4.4626510143280029e-01 5.4090857505798340e-01 <_> 0 -1 1094 -1.1310069821774960e-03 5.9456187486648560e-01 4.4176620244979858e-01 <_> 0 -1 1095 1.7601120052859187e-03 5.3532499074935913e-01 3.9734530448913574e-01 <_> 0 -1 1096 -8.1581249833106995e-04 3.7602680921554565e-01 5.2647268772125244e-01 <_> 0 -1 1097 -3.8687589112669230e-03 6.3099128007888794e-01 4.7498199343681335e-01 <_> 0 -1 1098 1.5207129763439298e-03 5.2301818132400513e-01 3.3612239360809326e-01 <_> 0 -1 1099 5.4586738348007202e-01 5.1671397686004639e-01 1.1726350337266922e-01 <_> 0 -1 1100 1.5650190412998199e-02 4.9794390797615051e-01 1.3932949304580688e-01 <_> 0 -1 1101 -1.1731860227882862e-02 7.1296507120132446e-01 4.9211961030960083e-01 <_> 0 -1 1102 -6.1765122227370739e-03 2.2881029546260834e-01 5.0497019290924072e-01 <_> 0 -1 1103 2.2457661107182503e-03 4.6324339509010315e-01 6.0487258434295654e-01 <_> 0 -1 1104 -5.1915869116783142e-03 6.4674210548400879e-01 4.6021929383277893e-01 <_> 0 -1 1105 -2.3827880620956421e-02 1.4820009469985962e-01 5.2260792255401611e-01 <_> 0 -1 1106 1.0284580057486892e-03 5.1354891061782837e-01 3.3759570121765137e-01 <_> 0 -1 1107 -1.0078850202262402e-02 2.7405610680580139e-01 5.3035670518875122e-01 <_> 0 -1 1108 2.6168930344283581e-03 5.3326708078384399e-01 3.9724540710449219e-01 <_> 0 -1 1109 5.4385367548093200e-04 5.3656041622161865e-01 4.0634119510650635e-01 <_> 0 -1 1110 5.3510512225329876e-03 4.6537590026855469e-01 6.8890458345413208e-01 <_> 0 -1 1111 -1.5274790348485112e-03 5.4495012760162354e-01 3.6247238516807556e-01 <_> 0 -1 1112 -8.0624416470527649e-02 1.6560870409011841e-01 5.0002872943878174e-01 <_> 0 -1 1113 2.2192029282450676e-02 5.1327311992645264e-01 2.0028080046176910e-01 <_> 0 -1 1114 7.3100631125271320e-03 4.6179479360580444e-01 6.3665360212326050e-01 <_> 0 -1 1115 -6.4063072204589844e-03 5.9162509441375732e-01 4.8678609728813171e-01 <_> 0 -1 1116 -7.6415040530264378e-04 3.8884091377258301e-01 5.3157979249954224e-01 <_> 0 -1 1117 7.6734489994123578e-04 4.1590648889541626e-01 5.6052798032760620e-01 <_> 0 -1 1118 6.1474501853808761e-04 3.0890220403671265e-01 5.1201480627059937e-01 <_> 0 -1 1119 -5.0105270929634571e-03 3.9721998572349548e-01 5.2073061466217041e-01 <_> 0 -1 1120 -8.6909132078289986e-03 6.2574082612991333e-01 4.6085759997367859e-01 <_> 0 -1 1121 -1.6391459852457047e-02 2.0852099359035492e-01 5.2422660589218140e-01 <_> 0 -1 1122 4.0973909199237823e-04 5.2224272489547729e-01 3.7803208827972412e-01 <_> 0 -1 1123 -2.5242289993911982e-03 5.8039271831512451e-01 4.6118900179862976e-01 <_> 0 -1 1124 5.0945312250405550e-04 4.4012719392776489e-01 5.8460158109664917e-01 <_> 0 -1 1125 1.9656419754028320e-03 5.3223252296447754e-01 4.1845908761024475e-01 <_> 0 -1 1126 5.6298897834494710e-04 3.7418448925018311e-01 5.2345657348632812e-01 <_> 0 -1 1127 -6.7946797935292125e-04 4.6310418844223022e-01 5.3564780950546265e-01 <_> 0 -1 1128 7.2856349870562553e-03 5.0446701049804688e-01 2.3775640130043030e-01 <_> 0 -1 1129 -1.7459489405155182e-02 7.2891211509704590e-01 5.0504350662231445e-01 <_> 0 -1 1130 -2.5421749800443649e-02 6.6671347618103027e-01 4.6781000494956970e-01 <_> 0 -1 1131 -1.5647639520466328e-03 4.3917590379714966e-01 5.3236269950866699e-01 <_> 0 -1 1132 1.1444360017776489e-02 4.3464401364326477e-01 5.6800121068954468e-01 <_> 0 -1 1133 -6.7352550104260445e-04 4.4771409034729004e-01 5.2968120574951172e-01 <_> 0 -1 1134 9.3194209039211273e-03 4.7402000427246094e-01 7.4626070261001587e-01 <_> 0 -1 1135 1.3328490604180843e-04 5.3650617599487305e-01 4.7521349787712097e-01 <_> 0 -1 1136 -7.8815799206495285e-03 1.7522190511226654e-01 5.0152552127838135e-01 <_> 0 -1 1137 -5.7985680177807808e-03 7.2712367773056030e-01 4.8962008953094482e-01 <_> 0 -1 1138 -3.8922499516047537e-04 4.0039089322090149e-01 5.3449410200119019e-01 <_> 0 -1 1139 -1.9288610201328993e-03 5.6056129932403564e-01 4.8039558529853821e-01 <_> 0 -1 1140 8.4214154630899429e-03 4.7532469034194946e-01 7.6236087083816528e-01 <_> 0 -1 1141 8.1655876711010933e-03 5.3932619094848633e-01 4.1916438937187195e-01 <_> 0 -1 1142 4.8280550981871784e-04 4.2408001422882080e-01 5.3998219966888428e-01 <_> 0 -1 1143 -2.7186630759388208e-03 4.2445999383926392e-01 5.4249238967895508e-01 <_> 0 -1 1144 -1.2507230043411255e-02 5.8958417177200317e-01 4.5504111051559448e-01 <_> 0 -1 1145 -2.4286519736051559e-02 2.6471349596977234e-01 5.1891797780990601e-01 <_> 0 -1 1146 -2.9676330741494894e-03 7.3476827144622803e-01 4.7497498989105225e-01 <_> 0 -1 1147 -1.2528999708592892e-02 2.7560499310493469e-01 5.1775997877120972e-01 <_> 0 -1 1148 -1.0104000102728605e-03 3.5105609893798828e-01 5.1447242498397827e-01 <_> 0 -1 1149 -2.1348530426621437e-03 5.6379258632659912e-01 4.6673199534416199e-01 <_> 0 -1 1150 1.9564259797334671e-02 4.6145731210708618e-01 6.1376398801803589e-01 <_> 0 -1 1151 -9.7146347165107727e-02 2.9983788728713989e-01 5.1935559511184692e-01 <_> 0 -1 1152 4.5014568604528904e-03 5.0778847932815552e-01 3.0457559227943420e-01 <_> 0 -1 1153 6.3706971704959869e-03 4.8610189557075500e-01 6.8875008821487427e-01 <_> 0 -1 1154 -9.0721528977155685e-03 1.6733959317207336e-01 5.0175631046295166e-01 <_> 0 -1 1155 -5.3537208586931229e-03 2.6927569508552551e-01 5.2426332235336304e-01 <_> 0 -1 1156 -1.0932840406894684e-02 7.1838641166687012e-01 4.7360289096832275e-01 <_> 0 -1 1157 8.2356072962284088e-03 5.2239668369293213e-01 2.3898629844188690e-01 <_> 0 -1 1158 -1.0038160253316164e-03 5.7193559408187866e-01 4.4339430332183838e-01 <_> 0 -1 1159 4.0859128348529339e-03 5.4728418588638306e-01 4.1488361358642578e-01 <_> 0 -1 1160 1.5485419332981110e-01 4.9738121032714844e-01 6.1061598360538483e-02 <_> 0 -1 1161 2.0897459762636572e-04 4.7091740369796753e-01 5.4238891601562500e-01 <_> 0 -1 1162 3.3316991175524890e-04 4.0896269679069519e-01 5.3009921312332153e-01 <_> 0 -1 1163 -1.0813400149345398e-02 6.1043697595596313e-01 4.9573341012001038e-01 <_> 0 -1 1164 4.5656010508537292e-02 5.0696891546249390e-01 2.8666600584983826e-01 <_> 0 -1 1165 1.2569549726322293e-03 4.8469170928001404e-01 6.3181710243225098e-01 <_> 0 -1 1166 -1.2015070021152496e-01 6.0526140034198761e-02 4.9809598922729492e-01 <_> 0 -1 1167 -1.0533799650147557e-04 5.3631097078323364e-01 4.7080421447753906e-01 <_> 0 -1 1168 -2.0703190565109253e-01 5.9660330414772034e-02 4.9790981411933899e-01 <_> 0 -1 1169 1.2909180077258497e-04 4.7129771113395691e-01 5.3779977560043335e-01 <_> 0 -1 1170 3.8818528992123902e-04 4.3635380268096924e-01 5.5341911315917969e-01 <_> 0 -1 1171 -2.9243610333651304e-03 5.8111858367919922e-01 4.8252159357070923e-01 <_> 0 -1 1172 8.3882332546636462e-04 5.3117001056671143e-01 4.0381389856338501e-01 <_> 0 -1 1173 -1.9061550265178084e-03 3.7707018852233887e-01 5.2600151300430298e-01 <_> 0 -1 1174 8.9514348655939102e-03 4.7661679983139038e-01 7.6821839809417725e-01 <_> 0 -1 1175 1.3083459809422493e-02 5.2644628286361694e-01 3.0622220039367676e-01 <_> 0 -1 1176 -2.1159330010414124e-01 6.7371982336044312e-01 4.6958100795745850e-01 <_> 0 -1 1177 3.1493250280618668e-03 5.6448352336883545e-01 4.3869531154632568e-01 <_> 0 -1 1178 3.9754100725986063e-04 4.5260611176490784e-01 5.8956301212310791e-01 <_> 0 -1 1179 -1.3814480043947697e-03 6.0705822706222534e-01 4.9424138665199280e-01 <_> 0 -1 1180 -5.8122188784182072e-04 5.9982132911682129e-01 4.5082521438598633e-01 <_> 0 -1 1181 -2.3905329871922731e-03 4.2055889964103699e-01 5.2238482236862183e-01 <_> 0 -1 1182 2.7268929407000542e-02 5.2064472436904907e-01 3.5633018612861633e-01 <_> 0 -1 1183 -3.7658358924090862e-03 3.1447041034698486e-01 5.2188140153884888e-01 <_> 0 -1 1184 -1.4903489500284195e-03 3.3801960945129395e-01 5.1244372129440308e-01 <_> 0 -1 1185 -1.7428230494260788e-02 5.8299607038497925e-01 4.9197259545326233e-01 <_> 0 -1 1186 -1.5278030186891556e-02 6.1631447076797485e-01 4.6178871393203735e-01 <_> 0 -1 1187 3.1995609402656555e-02 5.1663571596145630e-01 1.7127640545368195e-01 <_> 0 -1 1188 -3.8256710395216942e-03 3.4080120921134949e-01 5.1313877105712891e-01 <_> 0 -1 1189 -8.5186436772346497e-03 6.1055189371109009e-01 4.9979418516159058e-01 <_> 0 -1 1190 9.0641621500253677e-04 4.3272709846496582e-01 5.5823111534118652e-01 <_> 0 -1 1191 1.0344849899411201e-02 4.8556530475616455e-01 5.4524201154708862e-01 <_> 160 7.9249076843261719e+01 <_> 0 -1 1192 7.8981826081871986e-03 3.3325248956680298e-01 5.9464621543884277e-01 <_> 0 -1 1193 1.6170160379260778e-03 3.4906411170959473e-01 5.5778688192367554e-01 <_> 0 -1 1194 -5.5449741194024682e-04 5.5425661802291870e-01 3.2915300130844116e-01 <_> 0 -1 1195 1.5428980113938451e-03 3.6125791072845459e-01 5.5459791421890259e-01 <_> 0 -1 1196 -1.0329450014978647e-03 3.5301390290260315e-01 5.5761402845382690e-01 <_> 0 -1 1197 7.7698158565908670e-04 3.9167788624763489e-01 5.6453210115432739e-01 <_> 0 -1 1198 1.4320300519466400e-01 4.6674820780754089e-01 7.0236331224441528e-01 <_> 0 -1 1199 -7.3866490274667740e-03 3.0736848711967468e-01 5.2892577648162842e-01 <_> 0 -1 1200 -6.2936742324382067e-04 5.6221181154251099e-01 4.0370491147041321e-01 <_> 0 -1 1201 7.8893528552725911e-04 5.2676612138748169e-01 3.5578748583793640e-01 <_> 0 -1 1202 -1.2228050269186497e-02 6.6683208942413330e-01 4.6255499124526978e-01 <_> 0 -1 1203 3.5420239437371492e-03 5.5214381217956543e-01 3.8696730136871338e-01 <_> 0 -1 1204 -1.0585320414975286e-03 3.6286780238151550e-01 5.3209269046783447e-01 <_> 0 -1 1205 1.4935660146875307e-05 4.6324449777603149e-01 5.3633230924606323e-01 <_> 0 -1 1206 5.2537708543241024e-03 5.1322317123413086e-01 3.2657089829444885e-01 <_> 0 -1 1207 -8.2338023930788040e-03 6.6936898231506348e-01 4.7741401195526123e-01 <_> 0 -1 1208 2.1866810129722580e-05 4.0538620948791504e-01 5.4579311609268188e-01 <_> 0 -1 1209 -3.8150229956954718e-03 6.4549958705902100e-01 4.7931781411170959e-01 <_> 0 -1 1210 1.1105879675596952e-03 5.2704071998596191e-01 3.5296788811683655e-01 <_> 0 -1 1211 -5.7707689702510834e-03 3.8035470247268677e-01 5.3529578447341919e-01 <_> 0 -1 1212 -3.0158339068293571e-03 5.3394031524658203e-01 3.8871330022811890e-01 <_> 0 -1 1213 -8.5453689098358154e-04 3.5646161437034607e-01 5.2736037969589233e-01 <_> 0 -1 1214 1.1050510220229626e-02 4.6719071269035339e-01 6.8497377634048462e-01 <_> 0 -1 1215 4.2605839669704437e-02 5.1514732837677002e-01 7.0220090448856354e-02 <_> 0 -1 1216 -3.0781750101596117e-03 3.0416610836982727e-01 5.1526021957397461e-01 <_> 0 -1 1217 -5.4815728217363358e-03 6.4302957057952881e-01 4.8972299695014954e-01 <_> 0 -1 1218 3.1881860923022032e-03 5.3074932098388672e-01 3.8262099027633667e-01 <_> 0 -1 1219 3.5947180003859103e-04 4.6500471234321594e-01 5.4219049215316772e-01 <_> 0 -1 1220 -4.0705031715333462e-03 2.8496798872947693e-01 5.0791162252426147e-01 <_> 0 -1 1221 -1.4594170264899731e-02 2.9716458916664124e-01 5.1284617185592651e-01 <_> 0 -1 1222 -1.1947689927183092e-04 5.6310981512069702e-01 4.3430820107460022e-01 <_> 0 -1 1223 -6.9344649091362953e-04 4.4035780429840088e-01 5.3599590063095093e-01 <_> 0 -1 1224 1.4834799912932795e-05 3.4210088849067688e-01 5.1646977663040161e-01 <_> 0 -1 1225 9.0296985581517220e-03 4.6393430233001709e-01 6.1140751838684082e-01 <_> 0 -1 1226 -8.0640818923711777e-03 2.8201588988304138e-01 5.0754940509796143e-01 <_> 0 -1 1227 2.6062119752168655e-02 5.2089059352874756e-01 2.6887780427932739e-01 <_> 0 -1 1228 1.7314659431576729e-02 4.6637138724327087e-01 6.7385399341583252e-01 <_> 0 -1 1229 2.2666640579700470e-02 5.2093499898910522e-01 2.2127239406108856e-01 <_> 0 -1 1230 -2.1965929772704840e-03 6.0631012916564941e-01 4.5381900668144226e-01 <_> 0 -1 1231 -9.5282476395368576e-03 4.6352049708366394e-01 5.2474308013916016e-01 <_> 0 -1 1232 8.0943619832396507e-03 5.2894401550292969e-01 3.9138820767402649e-01 <_> 0 -1 1233 -7.2877332568168640e-02 7.7520018815994263e-01 4.9902349710464478e-01 <_> 0 -1 1234 -6.9009521976113319e-03 2.4280390143394470e-01 5.0480902194976807e-01 <_> 0 -1 1235 -1.1308239772915840e-02 5.7343649864196777e-01 4.8423761129379272e-01 <_> 0 -1 1236 5.9613201767206192e-02 5.0298362970352173e-01 2.5249770283699036e-01 <_> 0 -1 1237 -2.8624620754271746e-03 6.0730451345443726e-01 4.8984599113464355e-01 <_> 0 -1 1238 4.4781449250876904e-03 5.0152891874313354e-01 2.2203169763088226e-01 <_> 0 -1 1239 -1.7513240454718471e-03 6.6144287586212158e-01 4.9338689446449280e-01 <_> 0 -1 1240 4.0163420140743256e-02 5.1808780431747437e-01 3.7410449981689453e-01 <_> 0 -1 1241 3.4768949262797832e-04 4.7204169631004333e-01 5.8180320262908936e-01 <_> 0 -1 1242 2.6551650371402502e-03 3.8050109148025513e-01 5.2213358879089355e-01 <_> 0 -1 1243 -8.7706279009580612e-03 2.9441660642623901e-01 5.2312952280044556e-01 <_> 0 -1 1244 -5.5122091434895992e-03 7.3461771011352539e-01 4.7228169441223145e-01 <_> 0 -1 1245 6.8672042107209563e-04 5.4528760910034180e-01 4.2424130439758301e-01 <_> 0 -1 1246 5.6019669864326715e-04 4.3988621234893799e-01 5.6012850999832153e-01 <_> 0 -1 1247 2.4143769405782223e-03 4.7416868805885315e-01 6.1366218328475952e-01 <_> 0 -1 1248 -1.5680900542065501e-03 6.0445529222488403e-01 4.5164099335670471e-01 <_> 0 -1 1249 -3.6827491130679846e-03 2.4524590373039246e-01 5.2949821949005127e-01 <_> 0 -1 1250 -2.9409190756268799e-04 3.7328380346298218e-01 5.2514511346817017e-01 <_> 0 -1 1251 4.2847759323194623e-04 5.4988098144531250e-01 4.0655350685119629e-01 <_> 0 -1 1252 -4.8817070201039314e-03 2.1399089694023132e-01 4.9999570846557617e-01 <_> 0 -1 1253 2.7272020815871656e-04 4.6502870321273804e-01 5.8134287595748901e-01 <_> 0 -1 1254 2.0947199664078653e-04 4.3874868750572205e-01 5.5727928876876831e-01 <_> 0 -1 1255 4.8501189798116684e-02 5.2449727058410645e-01 3.2128891348838806e-01 <_> 0 -1 1256 -4.5166411437094212e-03 6.0568130016326904e-01 4.5458820462226868e-01 <_> 0 -1 1257 -1.2291680090129375e-02 2.0409290492534637e-01 5.1522141695022583e-01 <_> 0 -1 1258 4.8549679922871292e-04 5.2376049757003784e-01 3.7395030260086060e-01 <_> 0 -1 1259 3.0556049197912216e-02 4.9605339765548706e-01 5.9382462501525879e-01 <_> 0 -1 1260 -1.5105320198927075e-04 5.3513038158416748e-01 4.1452041268348694e-01 <_> 0 -1 1261 2.4937440175563097e-03 4.6933668851852417e-01 5.5149412155151367e-01 <_> 0 -1 1262 -1.2382130138576031e-02 6.7913967370986938e-01 4.6816679835319519e-01 <_> 0 -1 1263 -5.1333461888134480e-03 3.6087390780448914e-01 5.2291601896286011e-01 <_> 0 -1 1264 5.1919277757406235e-04 5.3000730276107788e-01 3.6336138844490051e-01 <_> 0 -1 1265 1.5060420334339142e-01 5.1573169231414795e-01 2.2117820382118225e-01 <_> 0 -1 1266 7.7144149690866470e-03 4.4104969501495361e-01 5.7766091823577881e-01 <_> 0 -1 1267 9.4443522393703461e-03 5.4018551111221313e-01 3.7566500902175903e-01 <_> 0 -1 1268 2.5006249779835343e-04 4.3682709336280823e-01 5.6073749065399170e-01 <_> 0 -1 1269 -3.3077150583267212e-03 4.2447990179061890e-01 5.5182307958602905e-01 <_> 0 -1 1270 7.4048910755664110e-04 4.4969621300697327e-01 5.9005767107009888e-01 <_> 0 -1 1271 4.4092051684856415e-02 5.2934932708740234e-01 3.1563550233840942e-01 <_> 0 -1 1272 3.3639909233897924e-03 4.4832968711853027e-01 5.8486622571945190e-01 <_> 0 -1 1273 -3.9760079234838486e-03 4.5595070719718933e-01 5.4836392402648926e-01 <_> 0 -1 1274 2.7716930489987135e-03 5.3417861461639404e-01 3.7924841046333313e-01 <_> 0 -1 1275 -2.4123019829858094e-04 5.6671887636184692e-01 4.5769730210304260e-01 <_> 0 -1 1276 4.9425667384639382e-04 4.4212448596954346e-01 5.6287872791290283e-01 <_> 0 -1 1277 -3.8876468897797167e-04 4.2883709073066711e-01 5.3910630941390991e-01 <_> 0 -1 1278 -5.0048898905515671e-02 6.8995130062103271e-01 4.7037428617477417e-01 <_> 0 -1 1279 -3.6635480821132660e-02 2.2177790105342865e-01 5.1918262243270874e-01 <_> 0 -1 1280 2.4273579474538565e-03 5.1362240314483643e-01 3.4973978996276855e-01 <_> 0 -1 1281 1.9558030180633068e-03 4.8261928558349609e-01 6.4083808660507202e-01 <_> 0 -1 1282 -1.7494610510766506e-03 3.9228358864784241e-01 5.2726852893829346e-01 <_> 0 -1 1283 1.3955079950392246e-02 5.0782018899917603e-01 8.4165048599243164e-01 <_> 0 -1 1284 -2.1896739781368524e-04 5.5204898118972778e-01 4.3142348527908325e-01 <_> 0 -1 1285 -1.5131309628486633e-03 3.9346051216125488e-01 5.3825712203979492e-01 <_> 0 -1 1286 -4.3622800149023533e-03 7.3706287145614624e-01 4.7364759445190430e-01 <_> 0 -1 1287 6.5160587430000305e-02 5.1592797040939331e-01 3.2815951108932495e-01 <_> 0 -1 1288 -2.3567399475723505e-03 3.6728268861770630e-01 5.1728862524032593e-01 <_> 0 -1 1289 1.5146659687161446e-02 5.0314939022064209e-01 6.6876041889190674e-01 <_> 0 -1 1290 -2.2850960493087769e-02 6.7675197124481201e-01 4.7095969319343567e-01 <_> 0 -1 1291 4.8867650330066681e-03 5.2579981088638306e-01 4.0598788857460022e-01 <_> 0 -1 1292 1.7619599821045995e-03 4.6962729096412659e-01 6.6882789134979248e-01 <_> 0 -1 1293 -1.2942519970238209e-03 4.3207129836082458e-01 5.3442817926406860e-01 <_> 0 -1 1294 1.0929949581623077e-02 4.9977061152458191e-01 1.6374860703945160e-01 <_> 0 -1 1295 2.9958489903947338e-05 4.2824178934097290e-01 5.6332242488861084e-01 <_> 0 -1 1296 -6.5884361974895000e-03 6.7721211910247803e-01 4.7005268931388855e-01 <_> 0 -1 1297 3.2527779694646597e-03 5.3133970499038696e-01 4.5361489057540894e-01 <_> 0 -1 1298 -4.0435739792883396e-03 5.6600618362426758e-01 4.4133889675140381e-01 <_> 0 -1 1299 -1.2523540062829852e-03 3.7319138646125793e-01 5.3564518690109253e-01 <_> 0 -1 1300 1.9246719602961093e-04 5.1899862289428711e-01 3.7388110160827637e-01 <_> 0 -1 1301 -3.8589671254158020e-02 2.9563739895820618e-01 5.1888108253479004e-01 <_> 0 -1 1302 1.5489870565943420e-04 4.3471351265907288e-01 5.5095332860946655e-01 <_> 0 -1 1303 -3.3763848245143890e-02 3.2303300499916077e-01 5.1954758167266846e-01 <_> 0 -1 1304 -8.2657067105174065e-03 5.9754890203475952e-01 4.5521140098571777e-01 <_> 0 -1 1305 1.4481440302915871e-05 4.7456780076026917e-01 5.4974269866943359e-01 <_> 0 -1 1306 1.4951299817766994e-05 4.3244731426239014e-01 5.4806441068649292e-01 <_> 0 -1 1307 -1.8741799518465996e-02 1.5800529718399048e-01 5.1785331964492798e-01 <_> 0 -1 1308 1.7572239739820361e-03 4.5176368951797485e-01 5.7737642526626587e-01 <_> 0 -1 1309 -3.1391119118779898e-03 4.1496479511260986e-01 5.4608422517776489e-01 <_> 0 -1 1310 6.6656779381446540e-05 4.0390908718109131e-01 5.2930849790573120e-01 <_> 0 -1 1311 6.7743421532213688e-03 4.7676518559455872e-01 6.1219561100006104e-01 <_> 0 -1 1312 -7.3868161998689175e-03 3.5862588882446289e-01 5.1872807741165161e-01 <_> 0 -1 1313 1.4040930196642876e-02 4.7121399641036987e-01 5.5761557817459106e-01 <_> 0 -1 1314 -5.5258329957723618e-03 2.6610270142555237e-01 5.0392812490463257e-01 <_> 0 -1 1315 3.8684239983558655e-01 5.1443397998809814e-01 2.5258991122245789e-01 <_> 0 -1 1316 1.1459240340627730e-04 4.2849949002265930e-01 5.4233711957931519e-01 <_> 0 -1 1317 -1.8467569723725319e-02 3.8858351111412048e-01 5.2130621671676636e-01 <_> 0 -1 1318 -4.5907011372037232e-04 5.4125630855560303e-01 4.2359098792076111e-01 <_> 0 -1 1319 1.2527540093287826e-03 4.8993051052093506e-01 6.6240912675857544e-01 <_> 0 -1 1320 1.4910609461367130e-03 5.2867782115936279e-01 4.0400519967079163e-01 <_> 0 -1 1321 -7.5435562757775187e-04 6.0329902172088623e-01 4.7951200604438782e-01 <_> 0 -1 1322 -6.9478838704526424e-03 4.0844011306762695e-01 5.3735041618347168e-01 <_> 0 -1 1323 2.8092920547351241e-04 4.8460629582405090e-01 5.7593822479248047e-01 <_> 0 -1 1324 9.6073717577382922e-04 5.1647412776947021e-01 3.5549798607826233e-01 <_> 0 -1 1325 -2.6883929967880249e-04 5.6775820255279541e-01 4.7317659854888916e-01 <_> 0 -1 1326 2.1599370520561934e-03 4.7314870357513428e-01 7.0705670118331909e-01 <_> 0 -1 1327 5.6235301308333874e-03 5.2402430772781372e-01 2.7817919850349426e-01 <_> 0 -1 1328 -5.0243991427123547e-03 2.8370139002799988e-01 5.0623041391372681e-01 <_> 0 -1 1329 -9.7611639648675919e-03 7.4007177352905273e-01 4.9345690011978149e-01 <_> 0 -1 1330 4.1515100747346878e-03 5.1191312074661255e-01 3.4070080518722534e-01 <_> 0 -1 1331 6.2465080991387367e-03 4.9237880110740662e-01 6.5790587663650513e-01 <_> 0 -1 1332 -7.0597478188574314e-03 2.4347110092639923e-01 5.0328421592712402e-01 <_> 0 -1 1333 -2.0587709732353687e-03 5.9003108739852905e-01 4.6950870752334595e-01 <_> 0 -1 1334 -2.4146060459315777e-03 3.6473178863525391e-01 5.1892018318176270e-01 <_> 0 -1 1335 -1.4817609917372465e-03 6.0349482297897339e-01 4.9401280283927917e-01 <_> 0 -1 1336 -6.3016400672495365e-03 5.8189898729324341e-01 4.5604279637336731e-01 <_> 0 -1 1337 3.4763428848236799e-03 5.2174758911132812e-01 3.4839931130409241e-01 <_> 0 -1 1338 -2.2250870242714882e-02 2.3607000708580017e-01 5.0320827960968018e-01 <_> 0 -1 1339 -3.0612550675868988e-02 6.4991867542266846e-01 4.9149191379547119e-01 <_> 0 -1 1340 1.3057479634881020e-02 4.4133231043815613e-01 5.6837642192840576e-01 <_> 0 -1 1341 -6.0095742810517550e-04 4.3597310781478882e-01 5.3334832191467285e-01 <_> 0 -1 1342 -4.1514250915497541e-04 5.5040627717971802e-01 4.3260601162910461e-01 <_> 0 -1 1343 -1.3776290230453014e-02 4.0641129016876221e-01 5.2015489339828491e-01 <_> 0 -1 1344 -3.2296508550643921e-02 4.7351971268653870e-02 4.9771949648857117e-01 <_> 0 -1 1345 5.3556978702545166e-02 4.8817330598831177e-01 6.6669392585754395e-01 <_> 0 -1 1346 8.1889545544981956e-03 5.4000371694564819e-01 4.2408201098442078e-01 <_> 0 -1 1347 2.1055320394225419e-04 4.8020479083061218e-01 5.5638527870178223e-01 <_> 0 -1 1348 -2.4382730480283499e-03 7.3877930641174316e-01 4.7736850380897522e-01 <_> 0 -1 1349 3.2835570164024830e-03 5.2885460853576660e-01 3.1712919473648071e-01 <_> 0 -1 1350 2.3729570675641298e-03 4.7508129477500916e-01 7.0601707696914673e-01 <_> 0 -1 1351 -1.4541699783876538e-03 3.8117301464080811e-01 5.3307390213012695e-01 <_> 177 8.7696029663085938e+01 <_> 0 -1 1352 5.5755238980054855e-02 4.0191569924354553e-01 6.8060368299484253e-01 <_> 0 -1 1353 2.4730248842388391e-03 3.3511489629745483e-01 5.9657198190689087e-01 <_> 0 -1 1354 -3.5031698644161224e-04 5.5577081441879272e-01 3.4822869300842285e-01 <_> 0 -1 1355 5.4167630150914192e-04 4.2608588933944702e-01 5.6933808326721191e-01 <_> 0 -1 1356 7.7193678589537740e-04 3.4942400455474854e-01 5.4336887598037720e-01 <_> 0 -1 1357 -1.5999219613149762e-03 4.0284991264343262e-01 5.4843592643737793e-01 <_> 0 -1 1358 -1.1832080053864047e-04 3.8069018721580505e-01 5.4254651069641113e-01 <_> 0 -1 1359 3.2909031142480671e-04 2.6201000809669495e-01 5.4295217990875244e-01 <_> 0 -1 1360 2.9518108931370080e-04 3.7997689843177795e-01 5.3992640972137451e-01 <_> 0 -1 1361 9.0466710389591753e-05 4.4336450099945068e-01 5.4402261972427368e-01 <_> 0 -1 1362 1.5007190086180344e-05 3.7196549773216248e-01 5.4091197252273560e-01 <_> 0 -1 1363 1.3935610651969910e-01 5.5253958702087402e-01 4.4790428876876831e-01 <_> 0 -1 1364 1.6461990308016539e-03 4.2645010352134705e-01 5.7721698284149170e-01 <_> 0 -1 1365 4.9984431825578213e-04 4.3595260381698608e-01 5.6858712434768677e-01 <_> 0 -1 1366 -1.0971280280500650e-03 3.3901369571685791e-01 5.2054089307785034e-01 <_> 0 -1 1367 6.6919892560690641e-04 4.5574560761451721e-01 5.9806597232818604e-01 <_> 0 -1 1368 8.6471042595803738e-04 5.1348412036895752e-01 2.9440331459045410e-01 <_> 0 -1 1369 -2.7182599296793342e-04 3.9065781235694885e-01 5.3771811723709106e-01 <_> 0 -1 1370 3.0249499104684219e-05 3.6796098947525024e-01 5.2256888151168823e-01 <_> 0 -1 1371 -8.5225896909832954e-03 7.2931021451950073e-01 4.8923650383949280e-01 <_> 0 -1 1372 1.6705560265108943e-03 4.3453249335289001e-01 5.6961381435394287e-01 <_> 0 -1 1373 -7.1433838456869125e-03 2.5912800431251526e-01 5.2256238460540771e-01 <_> 0 -1 1374 -1.6319369897246361e-02 6.9222790002822876e-01 4.6515759825706482e-01 <_> 0 -1 1375 4.8034260980784893e-03 5.3522628545761108e-01 3.2863029837608337e-01 <_> 0 -1 1376 -7.5421929359436035e-03 2.0405440032482147e-01 5.0345462560653687e-01 <_> 0 -1 1377 -1.4363110065460205e-02 6.8048888444900513e-01 4.8890590667724609e-01 <_> 0 -1 1378 8.9063588529825211e-04 5.3106957674026489e-01 3.8954809308052063e-01 <_> 0 -1 1379 -4.4060191139578819e-03 5.7415628433227539e-01 4.3724268674850464e-01 <_> 0 -1 1380 -1.8862540309783071e-04 2.8317859768867493e-01 5.0982052087783813e-01 <_> 0 -1 1381 -3.7979281041771173e-03 3.3725079894065857e-01 5.2465802431106567e-01 <_> 0 -1 1382 1.4627049677073956e-04 5.3066742420196533e-01 3.9117100834846497e-01 <_> 0 -1 1383 -4.9164638767251745e-05 5.4624962806701660e-01 3.9427208900451660e-01 <_> 0 -1 1384 -3.3582501113414764e-02 2.1578240394592285e-01 5.0482118129730225e-01 <_> 0 -1 1385 -3.5339309833943844e-03 6.4653122425079346e-01 4.8726969957351685e-01 <_> 0 -1 1386 5.0144111737608910e-03 4.6176680922508240e-01 6.2480747699737549e-01 <_> 0 -1 1387 1.8817370757460594e-02 5.2206891775131226e-01 2.0000520348548889e-01 <_> 0 -1 1388 -1.3434339780360460e-03 4.0145379304885864e-01 5.3016197681427002e-01 <_> 0 -1 1389 1.7557960236445069e-03 4.7940391302108765e-01 5.6531697511672974e-01 <_> 0 -1 1390 -9.5637463033199310e-02 2.0341950654983521e-01 5.0067067146301270e-01 <_> 0 -1 1391 -2.2241229191422462e-02 7.6724731922149658e-01 5.0463402271270752e-01 <_> 0 -1 1392 -1.5575819648802280e-02 7.4903422594070435e-01 4.7558510303497314e-01 <_> 0 -1 1393 5.3599118255078793e-03 5.3653037548065186e-01 4.0046709775924683e-01 <_> 0 -1 1394 -2.1763499826192856e-02 7.4015498161315918e-02 4.9641749262809753e-01 <_> 0 -1 1395 -1.6561590135097504e-01 2.8591030836105347e-01 5.2180862426757812e-01 <_> 0 -1 1396 1.6461320046801120e-04 4.1916158795356750e-01 5.3807932138442993e-01 <_> 0 -1 1397 -8.9077502489089966e-03 6.2731927633285522e-01 4.8774048686027527e-01 <_> 0 -1 1398 8.6346449097618461e-04 5.1599407196044922e-01 3.6710259318351746e-01 <_> 0 -1 1399 -1.3751760125160217e-03 5.8843767642974854e-01 4.5790839195251465e-01 <_> 0 -1 1400 -1.4081239933148026e-03 3.5605099797248840e-01 5.1399451494216919e-01 <_> 0 -1 1401 -3.9342888630926609e-03 5.9942889213562012e-01 4.6642720699310303e-01 <_> 0 -1 1402 -3.1966928392648697e-02 3.3454620838165283e-01 5.1441830396652222e-01 <_> 0 -1 1403 -1.5089280168467667e-05 5.5826562643051147e-01 4.4140571355819702e-01 <_> 0 -1 1404 5.1994470413774252e-04 4.6236801147460938e-01 6.1689937114715576e-01 <_> 0 -1 1405 -3.4220460802316666e-03 6.5570747852325439e-01 4.9748051166534424e-01 <_> 0 -1 1406 1.7723299970384687e-04 5.2695018053054810e-01 3.9019080996513367e-01 <_> 0 -1 1407 1.5716759953647852e-03 4.6333730220794678e-01 5.7904577255249023e-01 <_> 0 -1 1408 -8.9041329920291901e-03 2.6896080374717712e-01 5.0535911321640015e-01 <_> 0 -1 1409 4.0677518700249493e-04 5.4566031694412231e-01 4.3298989534378052e-01 <_> 0 -1 1410 6.7604780197143555e-03 4.6489939093589783e-01 6.6897618770599365e-01 <_> 0 -1 1411 2.9100088868290186e-03 5.3097039461135864e-01 3.3778399229049683e-01 <_> 0 -1 1412 1.3885459629818797e-03 4.0747389197349548e-01 5.3491330146789551e-01 <_> 0 -1 1413 -7.6764263212680817e-02 1.9921760261058807e-01 5.2282422780990601e-01 <_> 0 -1 1414 -2.2688310127705336e-04 5.4385018348693848e-01 4.2530721426010132e-01 <_> 0 -1 1415 -6.3094152137637138e-03 4.2591789364814758e-01 5.3789097070693970e-01 <_> 0 -1 1416 -1.1007279902696609e-01 6.9041568040847778e-01 4.7217491269111633e-01 <_> 0 -1 1417 2.8619659133255482e-04 4.5249149203300476e-01 5.5483061075210571e-01 <_> 0 -1 1418 2.9425329557852820e-05 5.3703737258911133e-01 4.2364639043807983e-01 <_> 0 -1 1419 -2.4886570870876312e-02 6.4235579967498779e-01 4.9693039059638977e-01 <_> 0 -1 1420 3.3148851245641708e-02 4.9884751439094543e-01 1.6138119995594025e-01 <_> 0 -1 1421 7.8491691965609789e-04 5.4160261154174805e-01 4.2230090498924255e-01 <_> 0 -1 1422 4.7087189741432667e-03 4.5763289928436279e-01 6.0275578498840332e-01 <_> 0 -1 1423 2.4144479539245367e-03 5.3089731931686401e-01 4.4224989414215088e-01 <_> 0 -1 1424 1.9523180089890957e-03 4.7056341171264648e-01 6.6633248329162598e-01 <_> 0 -1 1425 1.3031980488449335e-03 4.4061261415481567e-01 5.5269622802734375e-01 <_> 0 -1 1426 4.4735497795045376e-03 5.1290237903594971e-01 3.3014988899230957e-01 <_> 0 -1 1427 -2.6652868837118149e-03 3.1354710459709167e-01 5.1750361919403076e-01 <_> 0 -1 1428 1.3666770246345550e-04 4.1193708777427673e-01 5.3068768978118896e-01 <_> 0 -1 1429 -1.7126450315117836e-02 6.1778062582015991e-01 4.8365789651870728e-01 <_> 0 -1 1430 -2.6601430727168918e-04 3.6543309688568115e-01 5.1697367429733276e-01 <_> 0 -1 1431 -2.2932380437850952e-02 3.4909150004386902e-01 5.1639920473098755e-01 <_> 0 -1 1432 2.3316550068557262e-03 5.1662999391555786e-01 3.7093898653984070e-01 <_> 0 -1 1433 1.6925660893321037e-02 5.0147360563278198e-01 8.0539882183074951e-01 <_> 0 -1 1434 -8.9858826249837875e-03 6.4707887172698975e-01 4.6570208668708801e-01 <_> 0 -1 1435 -1.1874699965119362e-02 3.2463788986206055e-01 5.2587550878524780e-01 <_> 0 -1 1436 1.9350569345988333e-04 5.1919418573379517e-01 3.8396438956260681e-01 <_> 0 -1 1437 5.8713490143418312e-03 4.9181339144706726e-01 6.1870431900024414e-01 <_> 0 -1 1438 -2.4838790297508240e-01 1.8368029594421387e-01 4.9881500005722046e-01 <_> 0 -1 1439 1.2256000190973282e-02 5.2270537614822388e-01 3.6320298910140991e-01 <_> 0 -1 1440 8.3990179700776935e-04 4.4902500510215759e-01 5.7741481065750122e-01 <_> 0 -1 1441 2.5407369248569012e-03 4.8047870397567749e-01 5.8582991361618042e-01 <_> 0 -1 1442 -1.4822429977357388e-02 2.5210499763488770e-01 5.0235372781753540e-01 <_> 0 -1 1443 -5.7973959483206272e-03 5.9966957569122314e-01 4.8537150025367737e-01 <_> 0 -1 1444 7.2662148158997297e-04 5.1537168025970459e-01 3.6717799305915833e-01 <_> 0 -1 1445 -1.7232580110430717e-02 6.6217190027236938e-01 4.9946561455726624e-01 <_> 0 -1 1446 7.8624086454510689e-03 4.6333950757980347e-01 6.2561017274856567e-01 <_> 0 -1 1447 -4.7343620099127293e-03 3.6155730485916138e-01 5.2818852663040161e-01 <_> 0 -1 1448 8.3048478700220585e-04 4.4428890943527222e-01 5.5509579181671143e-01 <_> 0 -1 1449 7.6602199114859104e-03 5.1629352569580078e-01 2.6133549213409424e-01 <_> 0 -1 1450 -4.1048377752304077e-03 2.7896320819854736e-01 5.0190317630767822e-01 <_> 0 -1 1451 4.8512578941881657e-03 4.9689841270446777e-01 5.6616681814193726e-01 <_> 0 -1 1452 9.9896453320980072e-04 4.4456079602241516e-01 5.5518132448196411e-01 <_> 0 -1 1453 -2.7023631334304810e-01 2.9388209804892540e-02 5.1513141393661499e-01 <_> 0 -1 1454 -1.3090680353343487e-02 5.6993997097015381e-01 4.4474598765373230e-01 <_> 0 -1 1455 -9.4342790544033051e-03 4.3054661154747009e-01 5.4878950119018555e-01 <_> 0 -1 1456 -1.5482039889320731e-03 3.6803171038627625e-01 5.1280808448791504e-01 <_> 0 -1 1457 5.3746132180094719e-03 4.8389169573783875e-01 6.1015558242797852e-01 <_> 0 -1 1458 1.5786769799888134e-03 5.3252232074737549e-01 4.1185480356216431e-01 <_> 0 -1 1459 3.6856050137430429e-03 4.8109480738639832e-01 6.2523031234741211e-01 <_> 0 -1 1460 9.3887019902467728e-03 5.2002298831939697e-01 3.6294108629226685e-01 <_> 0 -1 1461 1.2792630121111870e-02 4.9617099761962891e-01 6.7380160093307495e-01 <_> 0 -1 1462 -3.3661040943115950e-03 4.0602791309356689e-01 5.2835988998413086e-01 <_> 0 -1 1463 3.9771420415490866e-04 4.6741139888763428e-01 5.9007751941680908e-01 <_> 0 -1 1464 1.4868030557408929e-03 4.5191168785095215e-01 6.0820537805557251e-01 <_> 0 -1 1465 -8.8686749339103699e-02 2.8078991174697876e-01 5.1809918880462646e-01 <_> 0 -1 1466 -7.4296112870797515e-05 5.2955842018127441e-01 4.0876251459121704e-01 <_> 0 -1 1467 -1.4932939848222304e-05 5.4614001512527466e-01 4.5385429263114929e-01 <_> 0 -1 1468 5.9162238612771034e-03 5.3291612863540649e-01 4.1921341419219971e-01 <_> 0 -1 1469 1.1141640134155750e-03 4.5120179653167725e-01 5.7062172889709473e-01 <_> 0 -1 1470 8.9249362645205110e-05 4.5778059959411621e-01 5.8976382017135620e-01 <_> 0 -1 1471 2.5319510605186224e-03 5.2996039390563965e-01 3.3576390147209167e-01 <_> 0 -1 1472 1.2426200322806835e-02 4.9590590596199036e-01 1.3466019928455353e-01 <_> 0 -1 1473 2.8335750102996826e-02 5.1170790195465088e-01 6.1043637106195092e-04 <_> 0 -1 1474 6.6165882162749767e-03 4.7363498806953430e-01 7.0116281509399414e-01 <_> 0 -1 1475 8.0468766391277313e-03 5.2164179086685181e-01 3.2828199863433838e-01 <_> 0 -1 1476 -1.1193980462849140e-03 5.8098608255386353e-01 4.5637390017509460e-01 <_> 0 -1 1477 1.3277590274810791e-02 5.3983622789382935e-01 4.1039010882377625e-01 <_> 0 -1 1478 4.8794739996083081e-04 4.2492860555648804e-01 5.4105907678604126e-01 <_> 0 -1 1479 1.1243170127272606e-02 5.2699637413024902e-01 3.4382158517837524e-01 <_> 0 -1 1480 -8.9896668214350939e-04 5.6330758333206177e-01 4.4566130638122559e-01 <_> 0 -1 1481 6.6677159629762173e-03 5.3128892183303833e-01 4.3626791238784790e-01 <_> 0 -1 1482 2.8947299346327782e-02 4.7017949819564819e-01 6.5757977962493896e-01 <_> 0 -1 1483 -2.3400049656629562e-02 0. 5.1373988389968872e-01 <_> 0 -1 1484 -8.9117050170898438e-02 2.3745279759168625e-02 4.9424308538436890e-01 <_> 0 -1 1485 -1.4054600149393082e-02 3.1273230910301208e-01 5.1175111532211304e-01 <_> 0 -1 1486 8.1239398568868637e-03 5.0090491771697998e-01 2.5200259685516357e-01 <_> 0 -1 1487 -4.9964650534093380e-03 6.3871437311172485e-01 4.9278119206428528e-01 <_> 0 -1 1488 3.1253970228135586e-03 5.1368498802185059e-01 3.6804521083831787e-01 <_> 0 -1 1489 6.7669642157852650e-03 5.5098438262939453e-01 4.3636319041252136e-01 <_> 0 -1 1490 -2.3711440153419971e-03 6.1623352766036987e-01 4.5869469642639160e-01 <_> 0 -1 1491 -5.3522791713476181e-03 6.1854577064514160e-01 4.9204909801483154e-01 <_> 0 -1 1492 -1.5968859195709229e-02 1.3826179504394531e-01 4.9832528829574585e-01 <_> 0 -1 1493 4.7676060348749161e-03 4.6880578994750977e-01 5.4900461435317993e-01 <_> 0 -1 1494 -2.4714691098779440e-03 2.3685149848461151e-01 5.0039529800415039e-01 <_> 0 -1 1495 -7.1033788844943047e-04 5.8563941717147827e-01 4.7215330600738525e-01 <_> 0 -1 1496 -1.4117559790611267e-01 8.6900062859058380e-02 4.9615910649299622e-01 <_> 0 -1 1497 1.0651809722185135e-01 5.1388370990753174e-01 1.7410050332546234e-01 <_> 0 -1 1498 -5.2744749933481216e-02 7.3536360263824463e-01 4.7728818655014038e-01 <_> 0 -1 1499 -4.7431760467588902e-03 3.8844060897827148e-01 5.2927017211914062e-01 <_> 0 -1 1500 9.9676765967160463e-04 5.2234929800033569e-01 4.0034240484237671e-01 <_> 0 -1 1501 8.0284131690859795e-03 4.9591061472892761e-01 7.2129642963409424e-01 <_> 0 -1 1502 8.6025858763605356e-04 4.4448840618133545e-01 5.5384761095046997e-01 <_> 0 -1 1503 9.3191501218825579e-04 5.3983712196350098e-01 4.1632440686225891e-01 <_> 0 -1 1504 -2.5082060601562262e-03 5.8542650938034058e-01 4.5625001192092896e-01 <_> 0 -1 1505 -2.1378761157393456e-03 4.6080690622329712e-01 5.2802592515945435e-01 <_> 0 -1 1506 -2.1546049974858761e-03 3.7911269068717957e-01 5.2559971809387207e-01 <_> 0 -1 1507 -7.6214009895920753e-03 5.9986090660095215e-01 4.9520739912986755e-01 <_> 0 -1 1508 2.2055360022932291e-03 4.4842061400413513e-01 5.5885308980941772e-01 <_> 0 -1 1509 1.2586950324475765e-03 5.4507470130920410e-01 4.4238409399986267e-01 <_> 0 -1 1510 -5.0926720723509789e-03 4.1182750463485718e-01 5.2630358934402466e-01 <_> 0 -1 1511 -2.5095739401876926e-03 5.7879078388214111e-01 4.9984949827194214e-01 <_> 0 -1 1512 -7.7327556908130646e-02 8.3978658914566040e-01 4.8111200332641602e-01 <_> 0 -1 1513 -4.1485819965600967e-02 2.4086110293865204e-01 5.1769930124282837e-01 <_> 0 -1 1514 1.0355669655837119e-04 4.3553608655929565e-01 5.4170542955398560e-01 <_> 0 -1 1515 1.3255809899419546e-03 5.4539710283279419e-01 4.8940950632095337e-01 <_> 0 -1 1516 -8.0598732456564903e-03 5.7710242271423340e-01 4.5779189467430115e-01 <_> 0 -1 1517 1.9058620557188988e-02 5.1698678731918335e-01 3.4004750847816467e-01 <_> 0 -1 1518 -3.5057891160249710e-02 2.2032439708709717e-01 5.0005030632019043e-01 <_> 0 -1 1519 5.7296059094369411e-03 5.0434082746505737e-01 6.5975707769393921e-01 <_> 0 -1 1520 -1.1648329906165600e-02 2.1862849593162537e-01 4.9966529011726379e-01 <_> 0 -1 1521 1.4544479781761765e-03 5.0076818466186523e-01 5.5037277936935425e-01 <_> 0 -1 1522 -2.5030909455381334e-04 4.1298410296440125e-01 5.2416700124740601e-01 <_> 0 -1 1523 -8.2907272735610604e-04 5.4128682613372803e-01 4.9744960665702820e-01 <_> 0 -1 1524 1.0862209601327777e-03 4.6055299043655396e-01 5.8792287111282349e-01 <_> 0 -1 1525 2.0000500080641359e-04 5.2788549661636353e-01 4.7052091360092163e-01 <_> 0 -1 1526 2.9212920926511288e-03 5.1296097040176392e-01 3.7555369734764099e-01 <_> 0 -1 1527 2.5387400761246681e-02 4.8226919770240784e-01 5.7907682657241821e-01 <_> 0 -1 1528 -3.1968469265848398e-03 5.2483952045440674e-01 3.9628401398658752e-01 <_> 182 9.0253349304199219e+01 <_> 0 -1 1529 5.8031738735735416e-03 3.4989839792251587e-01 5.9619832038879395e-01 <_> 0 -1 1530 -9.0003069490194321e-03 6.8166369199752808e-01 4.4785520434379578e-01 <_> 0 -1 1531 -1.1549659539014101e-03 5.5857062339782715e-01 3.5782510042190552e-01 <_> 0 -1 1532 -1.1069850297644734e-03 5.3650361299514771e-01 3.0504280328750610e-01 <_> 0 -1 1533 1.0308309720130637e-04 3.6390951275825500e-01 5.3446358442306519e-01 <_> 0 -1 1534 -5.0984839908778667e-03 2.8591570258140564e-01 5.5042648315429688e-01 <_> 0 -1 1535 8.2572200335562229e-04 5.2365237474441528e-01 3.4760418534278870e-01 <_> 0 -1 1536 9.9783325567841530e-03 4.7503221035003662e-01 6.2196469306945801e-01 <_> 0 -1 1537 -3.7402529269456863e-02 3.3433759212493896e-01 5.2780628204345703e-01 <_> 0 -1 1538 4.8548257909715176e-03 5.1921808719635010e-01 3.7004441022872925e-01 <_> 0 -1 1539 -1.8664470408111811e-03 2.9298439621925354e-01 5.0919449329376221e-01 <_> 0 -1 1540 1.6888890415430069e-02 3.6868458986282349e-01 5.4312258958816528e-01 <_> 0 -1 1541 -5.8372621424496174e-03 3.6321839690208435e-01 5.2213358879089355e-01 <_> 0 -1 1542 -1.4713739510625601e-03 5.8706837892532349e-01 4.7006508708000183e-01 <_> 0 -1 1543 -1.1522950371727347e-03 3.1958949565887451e-01 5.1409542560577393e-01 <_> 0 -1 1544 -4.2560300789773464e-03 6.3018590211868286e-01 4.8149210214614868e-01 <_> 0 -1 1545 -6.7378291860222816e-03 1.9770480692386627e-01 5.0258082151412964e-01 <_> 0 -1 1546 1.1382670141756535e-02 4.9541321396827698e-01 6.8670457601547241e-01 <_> 0 -1 1547 5.1794708706438541e-03 5.1644277572631836e-01 3.3506479859352112e-01 <_> 0 -1 1548 -1.1743789911270142e-01 2.3152460157871246e-01 5.2344137430191040e-01 <_> 0 -1 1549 2.8703449293971062e-02 4.6642971038818359e-01 6.7225211858749390e-01 <_> 0 -1 1550 4.8231030814349651e-03 5.2208751440048218e-01 2.7235329151153564e-01 <_> 0 -1 1551 2.6798530016094446e-03 5.0792771577835083e-01 2.9069489240646362e-01 <_> 0 -1 1552 8.0504082143306732e-03 4.8859509825706482e-01 6.3950210809707642e-01 <_> 0 -1 1553 4.8054959625005722e-03 5.1972568035125732e-01 3.6566638946533203e-01 <_> 0 -1 1554 -2.2420159075409174e-03 6.1534678936004639e-01 4.7637018561363220e-01 <_> 0 -1 1555 -1.3757710345089436e-02 2.6373448967933655e-01 5.0309032201766968e-01 <_> 0 -1 1556 -1.0338299721479416e-01 2.2875219583511353e-01 5.1824611425399780e-01 <_> 0 -1 1557 -9.4432085752487183e-03 6.9533038139343262e-01 4.6949490904808044e-01 <_> 0 -1 1558 8.0271181650459766e-04 5.4506552219390869e-01 4.2687839269638062e-01 <_> 0 -1 1559 -4.1945669800043106e-03 6.0913878679275513e-01 4.5716428756713867e-01 <_> 0 -1 1560 1.0942210443317890e-02 5.2410632371902466e-01 3.2845470309257507e-01 <_> 0 -1 1561 -5.7841069065034389e-04 5.3879290819168091e-01 4.1793689131736755e-01 <_> 0 -1 1562 -2.0888620056211948e-03 4.2926910519599915e-01 5.3017157316207886e-01 <_> 0 -1 1563 3.2383969519287348e-03 3.7923479080200195e-01 5.2207440137863159e-01 <_> 0 -1 1564 4.9075027927756310e-03 5.2372831106185913e-01 4.1267579793930054e-01 <_> 0 -1 1565 -3.2277941703796387e-02 1.9476559758186340e-01 4.9945020675659180e-01 <_> 0 -1 1566 -8.9711230248212814e-03 6.0112851858139038e-01 4.9290320277214050e-01 <_> 0 -1 1567 1.5321089886128902e-02 5.0097537040710449e-01 2.0398220419883728e-01 <_> 0 -1 1568 2.0855569746345282e-03 4.8621898889541626e-01 5.7216948270797729e-01 <_> 0 -1 1569 5.0615021027624607e-03 5.0002187490463257e-01 1.8018059432506561e-01 <_> 0 -1 1570 -3.7174751050770283e-03 5.5301171541213989e-01 4.8975929617881775e-01 <_> 0 -1 1571 -1.2170500122010708e-02 4.1786059737205505e-01 5.3837239742279053e-01 <_> 0 -1 1572 4.6248398721218109e-03 4.9971699714660645e-01 5.7613271474838257e-01 <_> 0 -1 1573 -2.1040429419372231e-04 5.3318071365356445e-01 4.0976810455322266e-01 <_> 0 -1 1574 -1.4641780406236649e-02 5.7559251785278320e-01 5.0517761707305908e-01 <_> 0 -1 1575 3.3199489116668701e-03 4.5769768953323364e-01 6.0318058729171753e-01 <_> 0 -1 1576 3.7236879579722881e-03 4.3803969025611877e-01 5.4158830642700195e-01 <_> 0 -1 1577 8.2951161311939359e-04 5.1630318164825439e-01 3.7022191286087036e-01 <_> 0 -1 1578 -1.1408490128815174e-02 6.0729467868804932e-01 4.8625651001930237e-01 <_> 0 -1 1579 -4.5320121571421623e-03 3.2924759387969971e-01 5.0889629125595093e-01 <_> 0 -1 1580 5.1276017911732197e-03 4.8297679424285889e-01 6.1227089166641235e-01 <_> 0 -1 1581 9.8583158105611801e-03 4.6606799960136414e-01 6.5561771392822266e-01 <_> 0 -1 1582 3.6985918879508972e-02 5.2048492431640625e-01 1.6904720664024353e-01 <_> 0 -1 1583 4.6491161920130253e-03 5.1673221588134766e-01 3.7252250313758850e-01 <_> 0 -1 1584 -4.2664702050387859e-03 6.4064931869506836e-01 4.9873429536819458e-01 <_> 0 -1 1585 -4.7956590424291790e-04 5.8972930908203125e-01 4.4648739695549011e-01 <_> 0 -1 1586 3.6827160511165857e-03 5.4415607452392578e-01 3.4726628661155701e-01 <_> 0 -1 1587 -1.0059880092740059e-02 2.1431629359722137e-01 5.0048297643661499e-01 <_> 0 -1 1588 -3.0361840617842972e-04 5.3864240646362305e-01 4.5903238654136658e-01 <_> 0 -1 1589 -1.4545479789376259e-03 5.7511842250823975e-01 4.4970950484275818e-01 <_> 0 -1 1590 1.6515209572389722e-03 5.4219377040863037e-01 4.2385208606719971e-01 <_> 0 -1 1591 -7.8468639403581619e-03 4.0779209136962891e-01 5.2581572532653809e-01 <_> 0 -1 1592 -5.1259850151836872e-03 4.2292758822441101e-01 5.4794532060623169e-01 <_> 0 -1 1593 -3.6890961229801178e-02 6.5963757038116455e-01 4.6746781468391418e-01 <_> 0 -1 1594 2.4035639944486320e-04 4.2511358857154846e-01 5.5732029676437378e-01 <_> 0 -1 1595 -1.5150169929256663e-05 5.2592468261718750e-01 4.0741148591041565e-01 <_> 0 -1 1596 2.2108471021056175e-03 4.6717229485511780e-01 5.8863520622253418e-01 <_> 0 -1 1597 -1.1568620102480054e-03 5.7110661268234253e-01 4.4871619343757629e-01 <_> 0 -1 1598 4.9996292218565941e-03 5.2641981840133667e-01 2.8983271121978760e-01 <_> 0 -1 1599 -1.4656189596280456e-03 3.8917380571365356e-01 5.1978719234466553e-01 <_> 0 -1 1600 -1.1975039960816503e-03 5.7958728075027466e-01 4.9279558658599854e-01 <_> 0 -1 1601 -4.4954330660402775e-03 2.3776030540466309e-01 5.0125551223754883e-01 <_> 0 -1 1602 1.4997160178609192e-04 4.8766261339187622e-01 5.6176078319549561e-01 <_> 0 -1 1603 2.6391509454697371e-03 5.1680880784988403e-01 3.7655091285705566e-01 <_> 0 -1 1604 -2.9368131072260439e-04 5.4466491937637329e-01 4.8746308684349060e-01 <_> 0 -1 1605 1.4211760135367513e-03 4.6878978610038757e-01 6.6913318634033203e-01 <_> 0 -1 1606 7.9427637159824371e-02 5.1934438943862915e-01 2.7329459786415100e-01 <_> 0 -1 1607 7.9937502741813660e-02 4.9717310070991516e-01 1.7820839583873749e-01 <_> 0 -1 1608 1.1089259758591652e-02 5.1659947633743286e-01 3.2094758749008179e-01 <_> 0 -1 1609 1.6560709627810866e-04 4.0584719181060791e-01 5.3072762489318848e-01 <_> 0 -1 1610 -5.3354292176663876e-03 3.4450569748878479e-01 5.1581299304962158e-01 <_> 0 -1 1611 1.1287260567769408e-03 4.5948630571365356e-01 6.0755330324172974e-01 <_> 0 -1 1612 -2.1969219669699669e-02 1.6804009675979614e-01 5.2285957336425781e-01 <_> 0 -1 1613 -2.1775320055894554e-04 3.8615968823432922e-01 5.2156728506088257e-01 <_> 0 -1 1614 2.0200149447191507e-04 5.5179792642593384e-01 4.3630391359329224e-01 <_> 0 -1 1615 -2.1733149886131287e-02 7.9994601011276245e-01 4.7898510098457336e-01 <_> 0 -1 1616 -8.4399932529777288e-04 4.0859758853912354e-01 5.3747731447219849e-01 <_> 0 -1 1617 -4.3895249837078154e-04 5.4704052209854126e-01 4.3661430478096008e-01 <_> 0 -1 1618 1.5092400135472417e-03 4.9889969825744629e-01 5.8421492576599121e-01 <_> 0 -1 1619 -3.5547839943319559e-03 6.7536902427673340e-01 4.7210058569908142e-01 <_> 0 -1 1620 4.8191400128416717e-04 5.4158538579940796e-01 4.3571090698242188e-01 <_> 0 -1 1621 -6.0264398343861103e-03 2.2585099935531616e-01 4.9918809533119202e-01 <_> 0 -1 1622 -1.1668140068650246e-02 6.2565547227859497e-01 4.9274989962577820e-01 <_> 0 -1 1623 -2.8718370012938976e-03 3.9477849006652832e-01 5.2458018064498901e-01 <_> 0 -1 1624 1.7051169648766518e-02 4.7525110840797424e-01 5.7942241430282593e-01 <_> 0 -1 1625 -1.3352080248296261e-02 6.0411047935485840e-01 4.5445358753204346e-01 <_> 0 -1 1626 -3.9301801007241011e-04 4.2582759261131287e-01 5.5449050664901733e-01 <_> 0 -1 1627 3.0483349692076445e-03 5.2334201335906982e-01 3.7802729010581970e-01 <_> 0 -1 1628 -4.3579288758337498e-03 6.3718891143798828e-01 4.8386740684509277e-01 <_> 0 -1 1629 5.6661018170416355e-03 5.3747057914733887e-01 4.1636660695075989e-01 <_> 0 -1 1630 6.0677339206449687e-05 4.6387958526611328e-01 5.3116250038146973e-01 <_> 0 -1 1631 3.6738160997629166e-02 4.6886560320854187e-01 6.4665240049362183e-01 <_> 0 -1 1632 8.6528137326240540e-03 5.2043187618255615e-01 2.1886579692363739e-01 <_> 0 -1 1633 -1.5371359884738922e-01 1.6303719580173492e-01 4.9588400125503540e-01 <_> 0 -1 1634 -4.1560421232134104e-04 5.7744592428207397e-01 4.6964588761329651e-01 <_> 0 -1 1635 -1.2640169588848948e-03 3.9771759510040283e-01 5.2171981334686279e-01 <_> 0 -1 1636 -3.5473341122269630e-03 6.0465282201766968e-01 4.8083150386810303e-01 <_> 0 -1 1637 3.0019069527043030e-05 3.9967238903045654e-01 5.2282011508941650e-01 <_> 0 -1 1638 1.3113019522279501e-03 4.7121581435203552e-01 5.7659977674484253e-01 <_> 0 -1 1639 -1.3374709524214268e-03 4.1095849871635437e-01 5.2531701326370239e-01 <_> 0 -1 1640 2.0876709371805191e-02 5.2029937505722046e-01 1.7579819262027740e-01 <_> 0 -1 1641 -7.5497948564589024e-03 6.5666097402572632e-01 4.6949750185012817e-01 <_> 0 -1 1642 2.4188550189137459e-02 5.1286739110946655e-01 3.3702209591865540e-01 <_> 0 -1 1643 -2.9358828905969858e-03 6.5807867050170898e-01 4.6945410966873169e-01 <_> 0 -1 1644 5.7557929307222366e-02 5.1464450359344482e-01 2.7752599120140076e-01 <_> 0 -1 1645 -1.1343370424583554e-03 3.8366019725799561e-01 5.1926672458648682e-01 <_> 0 -1 1646 1.6816999763250351e-02 5.0855928659439087e-01 6.1772608757019043e-01 <_> 0 -1 1647 5.0535178743302822e-03 5.1387631893157959e-01 3.6847919225692749e-01 <_> 0 -1 1648 -4.5874710194766521e-03 5.9896552562713623e-01 4.8352020978927612e-01 <_> 0 -1 1649 1.6882460331544280e-03 4.5094868540763855e-01 5.7230567932128906e-01 <_> 0 -1 1650 -1.6554000321775675e-03 3.4967708587646484e-01 5.2433192729949951e-01 <_> 0 -1 1651 -1.9373800605535507e-02 1.1205369979143143e-01 4.9687129259109497e-01 <_> 0 -1 1652 1.0374450124800205e-02 5.1481968164443970e-01 4.3952131271362305e-01 <_> 0 -1 1653 1.4973050565458834e-04 4.0849998593330383e-01 5.2698868513107300e-01 <_> 0 -1 1654 -4.2981930077075958e-02 6.3941049575805664e-01 5.0185042619705200e-01 <_> 0 -1 1655 8.3065936341881752e-03 4.7075539827346802e-01 6.6983532905578613e-01 <_> 0 -1 1656 -4.1285790503025055e-03 4.5413690805435181e-01 5.3236472606658936e-01 <_> 0 -1 1657 1.7399420030415058e-03 4.3339619040489197e-01 5.4398661851882935e-01 <_> 0 -1 1658 1.1739750334527344e-04 4.5796871185302734e-01 5.5434262752532959e-01 <_> 0 -1 1659 1.8585780344437808e-04 4.3246439099311829e-01 5.4267549514770508e-01 <_> 0 -1 1660 5.5587692186236382e-03 5.2572208642959595e-01 3.5506111383438110e-01 <_> 0 -1 1661 -7.9851560294628143e-03 6.0430181026458740e-01 4.6306359767913818e-01 <_> 0 -1 1662 6.0594122624024749e-04 4.5982548594474792e-01 5.5331951379776001e-01 <_> 0 -1 1663 -2.2983040253166109e-04 4.1307520866394043e-01 5.3224611282348633e-01 <_> 0 -1 1664 4.3740210821852088e-04 4.0430399775505066e-01 5.4092890024185181e-01 <_> 0 -1 1665 2.9482020181603730e-04 4.4949638843536377e-01 5.6288522481918335e-01 <_> 0 -1 1666 1.0312659665942192e-02 5.1775109767913818e-01 2.7043169736862183e-01 <_> 0 -1 1667 -7.7241109684109688e-03 1.9880190491676331e-01 4.9805539846420288e-01 <_> 0 -1 1668 -4.6797208487987518e-03 6.6447502374649048e-01 5.0182962417602539e-01 <_> 0 -1 1669 -5.0755459815263748e-03 3.8983049988746643e-01 5.1852691173553467e-01 <_> 0 -1 1670 2.2479740437120199e-03 4.8018088936805725e-01 5.6603360176086426e-01 <_> 0 -1 1671 8.3327008178457618e-04 5.2109199762344360e-01 3.9571881294250488e-01 <_> 0 -1 1672 -4.1279330849647522e-02 6.1545419692993164e-01 5.0070542097091675e-01 <_> 0 -1 1673 -5.0930189900100231e-04 3.9759421348571777e-01 5.2284038066864014e-01 <_> 0 -1 1674 1.2568780221045017e-03 4.9791380763053894e-01 5.9391832351684570e-01 <_> 0 -1 1675 8.0048497766256332e-03 4.9844971299171448e-01 1.6333660483360291e-01 <_> 0 -1 1676 -1.1879300000146031e-03 5.9049648046493530e-01 4.9426248669624329e-01 <_> 0 -1 1677 6.1948952497914433e-04 4.1995579004287720e-01 5.3287261724472046e-01 <_> 0 -1 1678 6.6829859279096127e-03 5.4186028242111206e-01 4.9058890342712402e-01 <_> 0 -1 1679 -3.7062340416014194e-03 3.7259390950202942e-01 5.1380002498626709e-01 <_> 0 -1 1680 -3.9739411324262619e-02 6.4789611101150513e-01 5.0503468513488770e-01 <_> 0 -1 1681 1.4085009461268783e-03 4.6823391318321228e-01 6.3778841495513916e-01 <_> 0 -1 1682 3.9322688826359808e-04 5.4585301876068115e-01 4.1504821181297302e-01 <_> 0 -1 1683 -1.8979819724336267e-03 3.6901599168777466e-01 5.1497042179107666e-01 <_> 0 -1 1684 -1.3970440253615379e-02 6.0505628585815430e-01 4.8113578557968140e-01 <_> 0 -1 1685 -1.0100819915533066e-01 2.0170800387859344e-01 4.9923619627952576e-01 <_> 0 -1 1686 -1.7346920445561409e-02 5.7131487131118774e-01 4.8994860053062439e-01 <_> 0 -1 1687 1.5619759506080300e-04 4.2153888940811157e-01 5.3926420211791992e-01 <_> 0 -1 1688 1.3438929617404938e-01 5.1361519098281860e-01 3.7676128745079041e-01 <_> 0 -1 1689 -2.4582240730524063e-02 7.0273578166961670e-01 4.7479069232940674e-01 <_> 0 -1 1690 -3.8553720805794001e-03 4.3174090981483459e-01 5.4277169704437256e-01 <_> 0 -1 1691 -2.3165249731391668e-03 5.9426987171173096e-01 4.6186479926109314e-01 <_> 0 -1 1692 -4.8518120311200619e-03 6.1915689706802368e-01 4.8848950862884521e-01 <_> 0 -1 1693 2.4699938949197531e-03 5.2566647529602051e-01 4.0171998739242554e-01 <_> 0 -1 1694 4.5496959239244461e-02 5.2378678321838379e-01 2.6857739686965942e-01 <_> 0 -1 1695 -2.0319599658250809e-02 2.1304459869861603e-01 4.9797388911247253e-01 <_> 0 -1 1696 2.6994998916052282e-04 4.8140418529510498e-01 5.5431222915649414e-01 <_> 0 -1 1697 -1.8232699949294329e-03 6.4825797080993652e-01 4.7099891304969788e-01 <_> 0 -1 1698 -6.3015790656208992e-03 4.5819279551506042e-01 5.3062361478805542e-01 <_> 0 -1 1699 -2.4139499873854220e-04 5.2320867776870728e-01 4.0517631173133850e-01 <_> 0 -1 1700 -1.0330369696021080e-03 5.5562019348144531e-01 4.7891938686370850e-01 <_> 0 -1 1701 1.8041160365100950e-04 5.2294427156448364e-01 4.0118101239204407e-01 <_> 0 -1 1702 -6.1407860368490219e-02 6.2986820936203003e-01 5.0107032060623169e-01 <_> 0 -1 1703 -6.9543913006782532e-02 7.2282809019088745e-01 4.7731840610504150e-01 <_> 0 -1 1704 -7.0542663335800171e-02 2.2695130109786987e-01 5.1825290918350220e-01 <_> 0 -1 1705 2.4423799477517605e-03 5.2370971441268921e-01 4.0981510281562805e-01 <_> 0 -1 1706 1.5494349645450711e-03 4.7737509012222290e-01 5.4680430889129639e-01 <_> 0 -1 1707 -2.3914219811558723e-02 7.1469759941101074e-01 4.7838249802589417e-01 <_> 0 -1 1708 -1.2453690171241760e-02 2.6352968811988831e-01 5.2411228418350220e-01 <_> 0 -1 1709 -2.0760179904755205e-04 3.6237570643424988e-01 5.1136088371276855e-01 <_> 0 -1 1710 2.9781080229440704e-05 4.7059321403503418e-01 5.4328018426895142e-01 <_> 211 1.0474919891357422e+02 <_> 0 -1 1711 1.1772749945521355e-02 3.8605189323425293e-01 6.4211672544479370e-01 <_> 0 -1 1712 2.7037570253014565e-02 4.3856549263000488e-01 6.7540389299392700e-01 <_> 0 -1 1713 -3.6419500247575343e-05 5.4871010780334473e-01 3.4233158826828003e-01 <_> 0 -1 1714 1.9995409529656172e-03 3.2305321097373962e-01 5.4003179073333740e-01 <_> 0 -1 1715 4.5278300531208515e-03 5.0916397571563721e-01 2.9350438714027405e-01 <_> 0 -1 1716 4.7890920541249216e-04 4.1781538724899292e-01 5.3440642356872559e-01 <_> 0 -1 1717 1.1720920447260141e-03 2.8991821408271790e-01 5.1320707798004150e-01 <_> 0 -1 1718 9.5305702416226268e-04 4.2801249027252197e-01 5.5608451366424561e-01 <_> 0 -1 1719 1.5099150004971307e-05 4.0448719263076782e-01 5.4047602415084839e-01 <_> 0 -1 1720 -6.0817901976406574e-04 4.2717689275741577e-01 5.5034661293029785e-01 <_> 0 -1 1721 3.3224520739167929e-03 3.9627239108085632e-01 5.3697347640991211e-01 <_> 0 -1 1722 -1.1037490330636501e-03 4.7271779179573059e-01 5.2377498149871826e-01 <_> 0 -1 1723 -1.4350269921123981e-03 5.6030082702636719e-01 4.2235091328620911e-01 <_> 0 -1 1724 2.0767399109899998e-03 5.2259171009063721e-01 4.7327259182929993e-01 <_> 0 -1 1725 -1.6412809782195836e-04 3.9990758895874023e-01 5.4327398538589478e-01 <_> 0 -1 1726 8.8302437216043472e-03 4.6783858537673950e-01 6.0273271799087524e-01 <_> 0 -1 1727 -1.0552070103585720e-02 3.4939670562744141e-01 5.2139747142791748e-01 <_> 0 -1 1728 -2.2731600329279900e-03 6.1858189105987549e-01 4.7490629553794861e-01 <_> 0 -1 1729 -8.4786332445219159e-04 5.2853411436080933e-01 3.8434821367263794e-01 <_> 0 -1 1730 1.2081359745934606e-03 5.3606408834457397e-01 3.4473359584808350e-01 <_> 0 -1 1731 2.6512730401009321e-03 4.5582920312881470e-01 6.1939620971679688e-01 <_> 0 -1 1732 -1.1012479662895203e-03 3.6802300810813904e-01 5.3276282548904419e-01 <_> 0 -1 1733 4.9561518244445324e-04 3.9605951309204102e-01 5.2749407291412354e-01 <_> 0 -1 1734 -4.3901771306991577e-02 7.0204448699951172e-01 4.9928390979766846e-01 <_> 0 -1 1735 3.4690350294113159e-02 5.0491642951965332e-01 2.7666029334068298e-01 <_> 0 -1 1736 -2.7442190330475569e-03 2.6726329326629639e-01 5.2749711275100708e-01 <_> 0 -1 1737 3.3316588960587978e-03 4.5794829726219177e-01 6.0011017322540283e-01 <_> 0 -1 1738 -2.0044570788741112e-02 3.1715941429138184e-01 5.2357178926467896e-01 <_> 0 -1 1739 1.3492030557245016e-03 5.2653628587722778e-01 4.0343248844146729e-01 <_> 0 -1 1740 2.9702018946409225e-03 5.3324568271636963e-01 4.5719841122627258e-01 <_> 0 -1 1741 6.3039981760084629e-03 4.5933109521865845e-01 6.0346359014511108e-01 <_> 0 -1 1742 -1.2936590239405632e-02 4.4379639625549316e-01 5.3729712963104248e-01 <_> 0 -1 1743 4.0148729458451271e-03 4.6803238987922668e-01 6.4378339052200317e-01 <_> 0 -1 1744 -2.6401679497212172e-03 3.7096318602561951e-01 5.3143328428268433e-01 <_> 0 -1 1745 1.3918439857661724e-02 4.7235551476478577e-01 7.1308088302612305e-01 <_> 0 -1 1746 -4.5087869511917233e-04 4.4923940300941467e-01 5.3704041242599487e-01 <_> 0 -1 1747 2.5384349282830954e-04 4.4068640470504761e-01 5.5144029855728149e-01 <_> 0 -1 1748 2.2710000630468130e-03 4.6824169158935547e-01 5.9679841995239258e-01 <_> 0 -1 1749 2.4120779708027840e-03 5.0793921947479248e-01 3.0185988545417786e-01 <_> 0 -1 1750 -3.6025670851813629e-05 5.6010371446609497e-01 4.4710969924926758e-01 <_> 0 -1 1751 -7.4905529618263245e-03 2.2075350582599640e-01 4.9899441003799438e-01 <_> 0 -1 1752 -1.7513120546936989e-02 6.5312159061431885e-01 5.0176489353179932e-01 <_> 0 -1 1753 1.4281630516052246e-01 4.9679630994796753e-01 1.4820620417594910e-01 <_> 0 -1 1754 5.5345268920063972e-03 4.8989468812942505e-01 5.9542238712310791e-01 <_> 0 -1 1755 -9.6323591424152255e-04 3.9271169900894165e-01 5.1960742473602295e-01 <_> 0 -1 1756 -2.0370010752230883e-03 5.6133252382278442e-01 4.8848581314086914e-01 <_> 0 -1 1757 1.6614829655736685e-03 4.4728800654411316e-01 5.5788809061050415e-01 <_> 0 -1 1758 -3.1188090797513723e-03 3.8405328989028931e-01 5.3974777460098267e-01 <_> 0 -1 1759 -6.4000617712736130e-03 5.8439838886260986e-01 4.5332181453704834e-01 <_> 0 -1 1760 3.1319601112045348e-04 5.4392218589782715e-01 4.2347279191017151e-01 <_> 0 -1 1761 -1.8222099170088768e-02 1.2884649634361267e-01 4.9584048986434937e-01 <_> 0 -1 1762 8.7969247251749039e-03 4.9512979388237000e-01 7.1534800529479980e-01 <_> 0 -1 1763 -4.2395070195198059e-03 3.9465999603271484e-01 5.1949369907379150e-01 <_> 0 -1 1764 9.7086271271109581e-03 4.8975038528442383e-01 6.0649001598358154e-01 <_> 0 -1 1765 -3.9934171363711357e-03 3.2454401254653931e-01 5.0608289241790771e-01 <_> 0 -1 1766 -1.6785059124231339e-02 1.5819530189037323e-01 5.2037787437438965e-01 <_> 0 -1 1767 1.8272090703248978e-02 4.6809351444244385e-01 6.6269791126251221e-01 <_> 0 -1 1768 5.6872838176786900e-03 5.2116978168487549e-01 3.5121849179267883e-01 <_> 0 -1 1769 -1.0739039862528443e-03 5.7683861255645752e-01 4.5298451185226440e-01 <_> 0 -1 1770 -3.7093870341777802e-03 4.5077630877494812e-01 5.3135812282562256e-01 <_> 0 -1 1771 -2.1110709349159151e-04 5.4608201980590820e-01 4.3333768844604492e-01 <_> 0 -1 1772 1.0670139454305172e-03 5.3718560934066772e-01 4.0783908963203430e-01 <_> 0 -1 1773 3.5943021066486835e-03 4.4712871313095093e-01 5.6438362598419189e-01 <_> 0 -1 1774 -5.1776031032204628e-03 4.4993931055068970e-01 5.2803301811218262e-01 <_> 0 -1 1775 -2.5414369883947074e-04 5.5161732435226440e-01 4.4077080488204956e-01 <_> 0 -1 1776 6.3522560521960258e-03 5.1941901445388794e-01 2.4652279913425446e-01 <_> 0 -1 1777 -4.4205080484971404e-04 3.8307058811187744e-01 5.1396822929382324e-01 <_> 0 -1 1778 7.4488727841526270e-04 4.8910909891128540e-01 5.9747868776321411e-01 <_> 0 -1 1779 -3.5116379149258137e-03 7.4136817455291748e-01 4.7687649726867676e-01 <_> 0 -1 1780 -1.2540910392999649e-02 3.6488190293312073e-01 5.2528268098831177e-01 <_> 0 -1 1781 9.4931852072477341e-03 5.1004928350448608e-01 3.6295869946479797e-01 <_> 0 -1 1782 1.2961150147020817e-02 5.2324420213699341e-01 4.3335610628128052e-01 <_> 0 -1 1783 4.7209449112415314e-03 4.6481490135192871e-01 6.3310527801513672e-01 <_> 0 -1 1784 -2.3119079414755106e-03 5.9303098917007446e-01 4.5310580730438232e-01 <_> 0 -1 1785 -2.8262299019843340e-03 3.8704779744148254e-01 5.2571010589599609e-01 <_> 0 -1 1786 -1.4311339473351836e-03 5.5225032567977905e-01 4.5618548989295959e-01 <_> 0 -1 1787 1.9378310535103083e-03 4.5462208986282349e-01 5.7369667291641235e-01 <_> 0 -1 1788 2.6343559147790074e-04 5.3457391262054443e-01 4.5718750357627869e-01 <_> 0 -1 1789 7.8257522545754910e-04 3.9678159356117249e-01 5.2201879024505615e-01 <_> 0 -1 1790 -1.9550440832972527e-02 2.8296428918838501e-01 5.2435082197189331e-01 <_> 0 -1 1791 4.3914958951063454e-04 4.5900669693946838e-01 5.8990901708602905e-01 <_> 0 -1 1792 2.1452000364661217e-02 5.2314108610153198e-01 2.8553789854049683e-01 <_> 0 -1 1793 5.8973580598831177e-04 4.3972569704055786e-01 5.5064219236373901e-01 <_> 0 -1 1794 -2.6157610118389130e-02 3.1350791454315186e-01 5.1891750097274780e-01 <_> 0 -1 1795 -1.3959860429167747e-02 3.2132729887962341e-01 5.0407177209854126e-01 <_> 0 -1 1796 -6.3699018210172653e-03 6.3875448703765869e-01 4.8495069146156311e-01 <_> 0 -1 1797 -8.5613820701837540e-03 2.7591320872306824e-01 5.0320190191268921e-01 <_> 0 -1 1798 9.6622901037335396e-04 4.6856409311294556e-01 5.8348792791366577e-01 <_> 0 -1 1799 7.6550268568098545e-04 5.1752072572708130e-01 3.8964220881462097e-01 <_> 0 -1 1800 -8.1833340227603912e-03 2.0691369473934174e-01 5.2081221342086792e-01 <_> 0 -1 1801 -9.3976939097046852e-03 6.1340910196304321e-01 4.6412229537963867e-01 <_> 0 -1 1802 4.8028980381786823e-03 5.4541081190109253e-01 4.3952199816703796e-01 <_> 0 -1 1803 -3.5680569708347321e-03 6.3444852828979492e-01 4.6810939908027649e-01 <_> 0 -1 1804 4.0733120404183865e-03 5.2926832437515259e-01 4.0156200528144836e-01 <_> 0 -1 1805 1.2568129459396005e-03 4.3929880857467651e-01 5.4528248310089111e-01 <_> 0 -1 1806 -2.9065010603517294e-03 5.8988320827484131e-01 4.8633798956871033e-01 <_> 0 -1 1807 -2.4409340694546700e-03 4.0693649649620056e-01 5.2474218606948853e-01 <_> 0 -1 1808 2.4830700829625130e-02 5.1827257871627808e-01 3.6825248599052429e-01 <_> 0 -1 1809 -4.8854008316993713e-02 1.3075779378414154e-01 4.9612811207771301e-01 <_> 0 -1 1810 -1.6110379947349429e-03 6.4210057258605957e-01 4.8726621270179749e-01 <_> 0 -1 1811 -9.7009479999542236e-02 4.7769349068403244e-02 4.9509888887405396e-01 <_> 0 -1 1812 1.1209240183234215e-03 4.6162670850753784e-01 5.3547459840774536e-01 <_> 0 -1 1813 -1.3064090162515640e-03 6.2618541717529297e-01 4.6388059854507446e-01 <_> 0 -1 1814 4.5771620352752507e-04 5.3844177722930908e-01 4.6466401219367981e-01 <_> 0 -1 1815 -6.3149951165542006e-04 3.8040471076965332e-01 5.1302570104598999e-01 <_> 0 -1 1816 1.4505970466416329e-04 4.5543101429939270e-01 5.6644618511199951e-01 <_> 0 -1 1817 -1.6474550589919090e-02 6.5969580411911011e-01 4.7158598899841309e-01 <_> 0 -1 1818 1.3369579799473286e-02 5.1954662799835205e-01 3.0359649658203125e-01 <_> 0 -1 1819 1.0271780047332868e-04 5.2291762828826904e-01 4.1070660948753357e-01 <_> 0 -1 1820 -5.5311559699475765e-03 6.3528877496719360e-01 4.9609071016311646e-01 <_> 0 -1 1821 -2.6187049224972725e-03 3.8245460391044617e-01 5.1409840583801270e-01 <_> 0 -1 1822 5.0834268331527710e-03 4.9504399299621582e-01 6.2208187580108643e-01 <_> 0 -1 1823 7.9818159341812134e-02 4.9523359537124634e-01 1.3224759697914124e-01 <_> 0 -1 1824 -9.9226586520671844e-02 7.5427287817001343e-01 5.0084167718887329e-01 <_> 0 -1 1825 -6.5174017800018191e-04 3.6993029713630676e-01 5.1301211118698120e-01 <_> 0 -1 1826 -1.8996849656105042e-02 6.6891789436340332e-01 4.9212029576301575e-01 <_> 0 -1 1827 1.7346899956464767e-02 4.9833008646965027e-01 1.8591980636119843e-01 <_> 0 -1 1828 5.5082101607695222e-04 4.5744240283966064e-01 5.5221217870712280e-01 <_> 0 -1 1829 2.0056050270795822e-03 5.1317447423934937e-01 3.8564699888229370e-01 <_> 0 -1 1830 -7.7688191086053848e-03 4.3617001175880432e-01 5.4343092441558838e-01 <_> 0 -1 1831 5.0878278911113739e-02 4.6827208995819092e-01 6.8406397104263306e-01 <_> 0 -1 1832 -2.2901780903339386e-03 4.3292450904846191e-01 5.3060990571975708e-01 <_> 0 -1 1833 -1.5715380141045898e-04 5.3700572252273560e-01 4.3781641125679016e-01 <_> 0 -1 1834 1.0519240051507950e-01 5.1372742652893066e-01 6.7361466586589813e-02 <_> 0 -1 1835 2.7198919560760260e-03 4.1120609641075134e-01 5.2556651830673218e-01 <_> 0 -1 1836 4.8337779939174652e-02 5.4046237468719482e-01 4.4389671087265015e-01 <_> 0 -1 1837 9.5703761326149106e-04 4.3559691309928894e-01 5.3995108604431152e-01 <_> 0 -1 1838 -2.5371259078383446e-02 5.9951752424240112e-01 5.0310248136520386e-01 <_> 0 -1 1839 5.2457951009273529e-02 4.9502879381179810e-01 1.3983510434627533e-01 <_> 0 -1 1840 -1.2365629896521568e-02 6.3972991704940796e-01 4.9641060829162598e-01 <_> 0 -1 1841 -1.4589719474315643e-01 1.0016699880361557e-01 4.9463221430778503e-01 <_> 0 -1 1842 -1.5908600762486458e-02 3.3123299479484558e-01 5.2083408832550049e-01 <_> 0 -1 1843 3.9486068999394774e-04 4.4063639640808105e-01 5.4261028766632080e-01 <_> 0 -1 1844 -5.2454001270234585e-03 2.7995899319648743e-01 5.1899671554565430e-01 <_> 0 -1 1845 -5.0421799533069134e-03 6.9875800609588623e-01 4.7521421313285828e-01 <_> 0 -1 1846 2.9812189750373363e-03 4.9832889437675476e-01 6.3074797391891479e-01 <_> 0 -1 1847 -7.2884308174252510e-03 2.9823330044746399e-01 5.0268697738647461e-01 <_> 0 -1 1848 1.5094350092113018e-03 5.3084421157836914e-01 3.8329708576202393e-01 <_> 0 -1 1849 -9.3340799212455750e-03 2.0379640161991119e-01 4.9698171019554138e-01 <_> 0 -1 1850 2.8667140752077103e-02 5.0256967544555664e-01 6.9280272722244263e-01 <_> 0 -1 1851 1.7019680142402649e-01 4.9600529670715332e-01 1.4764429628849030e-01 <_> 0 -1 1852 -3.2614478841423988e-03 5.6030637025833130e-01 4.8260560631752014e-01 <_> 0 -1 1853 5.5769277969375253e-04 5.2055621147155762e-01 4.1296330094337463e-01 <_> 0 -1 1854 3.6258339881896973e-01 5.2216529846191406e-01 3.7686121463775635e-01 <_> 0 -1 1855 -1.1615130119025707e-02 6.0226827859878540e-01 4.6374899148941040e-01 <_> 0 -1 1856 -4.0795197710394859e-03 4.0704470872879028e-01 5.3374791145324707e-01 <_> 0 -1 1857 5.7204300537705421e-04 4.6018350124359131e-01 5.9003931283950806e-01 <_> 0 -1 1858 6.7543348995968699e-04 5.3982520103454590e-01 4.3454289436340332e-01 <_> 0 -1 1859 6.3295697327703238e-04 5.2015632390975952e-01 4.0513589978218079e-01 <_> 0 -1 1860 1.2435320531949401e-03 4.6423879265785217e-01 5.5474412441253662e-01 <_> 0 -1 1861 -4.7363857738673687e-03 6.1985671520233154e-01 4.6725520491600037e-01 <_> 0 -1 1862 -6.4658462069928646e-03 6.8373328447341919e-01 5.0190007686614990e-01 <_> 0 -1 1863 3.5017321351915598e-04 4.3448030948638916e-01 5.3636229038238525e-01 <_> 0 -1 1864 1.5754920605104417e-04 4.7600790858268738e-01 5.7320207357406616e-01 <_> 0 -1 1865 9.9774366244673729e-03 5.0909858942031860e-01 3.6350399255752563e-01 <_> 0 -1 1866 -4.1464529931545258e-04 5.5700647830963135e-01 4.5938020944595337e-01 <_> 0 -1 1867 -3.5888899583369493e-04 5.3568458557128906e-01 4.3391349911689758e-01 <_> 0 -1 1868 4.0463250479660928e-04 4.4398030638694763e-01 5.4367768764495850e-01 <_> 0 -1 1869 -8.2184787606820464e-04 4.0422949194908142e-01 5.1762992143630981e-01 <_> 0 -1 1870 5.9467419050633907e-03 4.9276518821716309e-01 5.6337797641754150e-01 <_> 0 -1 1871 -2.1753389388322830e-02 8.0062937736511230e-01 4.8008409142494202e-01 <_> 0 -1 1872 -1.4540379866957664e-02 3.9460548758506775e-01 5.1822227239608765e-01 <_> 0 -1 1873 -4.0510769933462143e-02 2.1324990317225456e-02 4.9357929825782776e-01 <_> 0 -1 1874 -5.8458268176764250e-04 4.0127959847450256e-01 5.3140252828598022e-01 <_> 0 -1 1875 5.5151800625026226e-03 4.6424189209938049e-01 5.8962607383728027e-01 <_> 0 -1 1876 -6.0626221820712090e-03 6.5021592378616333e-01 5.0164777040481567e-01 <_> 0 -1 1877 9.4535842537879944e-02 5.2647089958190918e-01 4.1268271207809448e-01 <_> 0 -1 1878 4.7315051779150963e-03 4.8791998624801636e-01 5.8924478292465210e-01 <_> 0 -1 1879 -5.2571471314877272e-04 3.9172801375389099e-01 5.1894128322601318e-01 <_> 0 -1 1880 -2.5464049540460110e-03 5.8375990390777588e-01 4.9857059121131897e-01 <_> 0 -1 1881 -2.6075689122080803e-02 1.2619839608669281e-01 4.9558219313621521e-01 <_> 0 -1 1882 -5.4779709316790104e-03 5.7225137948989868e-01 5.0102657079696655e-01 <_> 0 -1 1883 5.1337741315364838e-03 5.2732622623443604e-01 4.2263761162757874e-01 <_> 0 -1 1884 4.7944980906322598e-04 4.4500669836997986e-01 5.8195871114730835e-01 <_> 0 -1 1885 -2.1114079281687737e-03 5.7576531171798706e-01 4.5117148756980896e-01 <_> 0 -1 1886 -1.3179990462958813e-02 1.8843810260295868e-01 5.1607340574264526e-01 <_> 0 -1 1887 -4.7968099825084209e-03 6.5897899866104126e-01 4.7361189126968384e-01 <_> 0 -1 1888 6.7483168095350266e-03 5.2594298124313354e-01 3.3563950657844543e-01 <_> 0 -1 1889 1.4623369788751006e-03 5.3552711009979248e-01 4.2640921473503113e-01 <_> 0 -1 1890 4.7645159065723419e-03 5.0344067811965942e-01 5.7868278026580811e-01 <_> 0 -1 1891 6.8066660314798355e-03 4.7566050291061401e-01 6.6778290271759033e-01 <_> 0 -1 1892 3.6608621012419462e-03 5.3696119785308838e-01 4.3115469813346863e-01 <_> 0 -1 1893 2.1449640393257141e-02 4.9686419963836670e-01 1.8888160586357117e-01 <_> 0 -1 1894 4.1678901761770248e-03 4.9307331442832947e-01 5.8153688907623291e-01 <_> 0 -1 1895 8.6467564105987549e-03 5.2052050828933716e-01 4.1325950622558594e-01 <_> 0 -1 1896 -3.6114078829996288e-04 5.4835551977157593e-01 4.8009279370307922e-01 <_> 0 -1 1897 1.0808729566633701e-03 4.6899020671844482e-01 6.0414212942123413e-01 <_> 0 -1 1898 5.7719959877431393e-03 5.1711422204971313e-01 3.0532771348953247e-01 <_> 0 -1 1899 1.5720770461484790e-03 5.2199780941009521e-01 4.1788038611412048e-01 <_> 0 -1 1900 -1.9307859474793077e-03 5.8603698015213013e-01 4.8129200935363770e-01 <_> 0 -1 1901 -7.8926272690296173e-03 1.7492769658565521e-01 4.9717339873313904e-01 <_> 0 -1 1902 -2.2224679123610258e-03 4.3425890803337097e-01 5.2128481864929199e-01 <_> 0 -1 1903 1.9011989934369922e-03 4.7651869058609009e-01 6.8920552730560303e-01 <_> 0 -1 1904 2.7576119173318148e-03 5.2621912956237793e-01 4.3374860286712646e-01 <_> 0 -1 1905 5.1787449046969414e-03 4.8040691018104553e-01 7.8437292575836182e-01 <_> 0 -1 1906 -9.0273341629654169e-04 4.1208469867706299e-01 5.3534239530563354e-01 <_> 0 -1 1907 5.1797959022223949e-03 4.7403728961944580e-01 6.4259600639343262e-01 <_> 0 -1 1908 -1.0114000178873539e-02 2.4687920510768890e-01 5.1750177145004272e-01 <_> 0 -1 1909 -1.8617060035467148e-02 5.7562941312789917e-01 4.6289789676666260e-01 <_> 0 -1 1910 5.9225959703326225e-03 5.1696258783340454e-01 3.2142710685729980e-01 <_> 0 -1 1911 -6.2945079989731312e-03 3.8720148801803589e-01 5.1416367292404175e-01 <_> 0 -1 1912 6.5353019163012505e-03 4.8530489206314087e-01 6.3104897737503052e-01 <_> 0 -1 1913 1.0878399480134249e-03 5.1173150539398193e-01 3.7232589721679688e-01 <_> 0 -1 1914 -2.2542240098118782e-02 5.6927400827407837e-01 4.8871129751205444e-01 <_> 0 -1 1915 -3.0065660830587149e-03 2.5560128688812256e-01 5.0039929151535034e-01 <_> 0 -1 1916 7.4741272255778313e-03 4.8108729720115662e-01 5.6759268045425415e-01 <_> 0 -1 1917 2.6162320747971535e-02 4.9711948633193970e-01 1.7772370576858521e-01 <_> 0 -1 1918 9.4352738233283162e-04 4.9400109052658081e-01 5.4912507534027100e-01 <_> 0 -1 1919 3.3363241702318192e-02 5.0076121091842651e-01 2.7907240390777588e-01 <_> 0 -1 1920 -1.5118650160729885e-02 7.0595788955688477e-01 4.9730318784713745e-01 <_> 0 -1 1921 9.8648946732282639e-04 5.1286202669143677e-01 3.7767618894577026e-01 <_> 213 1.0576110076904297e+02 <_> 0 -1 1922 -9.5150798559188843e-02 6.4707571268081665e-01 4.0172868967056274e-01 <_> 0 -1 1923 6.2702340073883533e-03 3.9998221397399902e-01 5.7464492321014404e-01 <_> 0 -1 1924 3.0018089455552399e-04 3.5587701201438904e-01 5.5388098955154419e-01 <_> 0 -1 1925 1.1757409665733576e-03 4.2565348744392395e-01 5.3826177120208740e-01 <_> 0 -1 1926 4.4235268433112651e-05 3.6829081177711487e-01 5.5899268388748169e-01 <_> 0 -1 1927 -2.9936920327600092e-05 5.4524701833724976e-01 4.0203678607940674e-01 <_> 0 -1 1928 3.0073199886828661e-03 5.2390581369400024e-01 3.3178439736366272e-01 <_> 0 -1 1929 -1.0513889603316784e-02 4.3206891417503357e-01 5.3079837560653687e-01 <_> 0 -1 1930 8.3476826548576355e-03 4.5046371221542358e-01 6.4532989263534546e-01 <_> 0 -1 1931 -3.1492270063608885e-03 4.3134251236915588e-01 5.3705251216888428e-01 <_> 0 -1 1932 -1.4435649973165710e-05 5.3266030550003052e-01 3.8179719448089600e-01 <_> 0 -1 1933 -4.2855090578086674e-04 4.3051639199256897e-01 5.3820097446441650e-01 <_> 0 -1 1934 1.5062429883982986e-04 4.2359709739685059e-01 5.5449652671813965e-01 <_> 0 -1 1935 7.1559831500053406e-02 5.3030598163604736e-01 2.6788029074668884e-01 <_> 0 -1 1936 8.4095180500298738e-04 3.5571089386940002e-01 5.2054339647293091e-01 <_> 0 -1 1937 6.2986500561237335e-02 5.2253627777099609e-01 2.8613761067390442e-01 <_> 0 -1 1938 -3.3798629883676767e-03 3.6241859197616577e-01 5.2016979455947876e-01 <_> 0 -1 1939 -1.1810739670181647e-04 5.4744768142700195e-01 3.9598938822746277e-01 <_> 0 -1 1940 -5.4505601292476058e-04 3.7404221296310425e-01 5.2157157659530640e-01 <_> 0 -1 1941 -1.8454910023137927e-03 5.8930522203445435e-01 4.5844489336013794e-01 <_> 0 -1 1942 -4.3832371011376381e-04 4.0845820307731628e-01 5.3853511810302734e-01 <_> 0 -1 1943 -2.4000830017030239e-03 3.7774550914764404e-01 5.2935802936553955e-01 <_> 0 -1 1944 -9.8795741796493530e-02 2.9636120796203613e-01 5.0700891017913818e-01 <_> 0 -1 1945 3.1798239797353745e-03 4.8776328563690186e-01 6.7264437675476074e-01 <_> 0 -1 1946 3.2406419632025063e-04 4.3669110536575317e-01 5.5611097812652588e-01 <_> 0 -1 1947 -3.2547250390052795e-02 3.1281578540802002e-01 5.3086161613464355e-01 <_> 0 -1 1948 -7.7561130747199059e-03 6.5602248907089233e-01 4.6398720145225525e-01 <_> 0 -1 1949 1.6027249395847321e-02 5.1726800203323364e-01 3.1418979167938232e-01 <_> 0 -1 1950 7.1002350523485802e-06 4.0844461321830750e-01 5.3362947702407837e-01 <_> 0 -1 1951 7.3422808200120926e-03 4.9669221043586731e-01 6.6034650802612305e-01 <_> 0 -1 1952 -1.6970280557870865e-03 5.9082370996475220e-01 4.5001828670501709e-01 <_> 0 -1 1953 2.4118260480463505e-03 5.3151607513427734e-01 3.5997208952903748e-01 <_> 0 -1 1954 -5.5300937965512276e-03 2.3340409994125366e-01 4.9968141317367554e-01 <_> 0 -1 1955 -2.6478730142116547e-03 5.8809357881546021e-01 4.6847340464591980e-01 <_> 0 -1 1956 1.1295629665255547e-02 4.9837771058082581e-01 1.8845909833908081e-01 <_> 0 -1 1957 -6.6952878842130303e-04 5.8721381425857544e-01 4.7990199923515320e-01 <_> 0 -1 1958 1.4410680159926414e-03 5.1311892271041870e-01 3.5010111331939697e-01 <_> 0 -1 1959 2.4637870956212282e-03 5.3393721580505371e-01 4.1176390647888184e-01 <_> 0 -1 1960 3.3114518737420440e-04 4.3133831024169922e-01 5.3982460498809814e-01 <_> 0 -1 1961 -3.3557269722223282e-02 2.6753368973731995e-01 5.1791548728942871e-01 <_> 0 -1 1962 1.8539419397711754e-02 4.9738699197769165e-01 2.3171770572662354e-01 <_> 0 -1 1963 -2.9698139405809343e-04 5.5297082662582397e-01 4.6436640620231628e-01 <_> 0 -1 1964 -4.5577259152196348e-04 5.6295841932296753e-01 4.4691911339759827e-01 <_> 0 -1 1965 -1.0158980265259743e-02 6.7062127590179443e-01 4.9259188771247864e-01 <_> 0 -1 1966 -2.2413829356082715e-05 5.2394217252731323e-01 3.9129018783569336e-01 <_> 0 -1 1967 7.2034963523037732e-05 4.7994381189346313e-01 5.5017888545989990e-01 <_> 0 -1 1968 -6.9267209619283676e-03 6.9300097227096558e-01 4.6980848908424377e-01 <_> 0 -1 1969 -7.6997838914394379e-03 4.0996238589286804e-01 5.4808831214904785e-01 <_> 0 -1 1970 -7.3130549862980843e-03 3.2834759354591370e-01 5.0578862428665161e-01 <_> 0 -1 1971 1.9650589674711227e-03 4.9780470132827759e-01 6.3982498645782471e-01 <_> 0 -1 1972 7.1647600270807743e-03 4.6611601114273071e-01 6.2221372127532959e-01 <_> 0 -1 1973 -2.4078639224171638e-02 2.3346449434757233e-01 5.2221620082855225e-01 <_> 0 -1 1974 -2.1027969196438789e-02 1.1836539953947067e-01 4.9382260441780090e-01 <_> 0 -1 1975 3.6017020465806127e-04 5.3250199556350708e-01 4.1167110204696655e-01 <_> 0 -1 1976 -1.7219729721546173e-02 6.2787622213363647e-01 4.6642690896987915e-01 <_> 0 -1 1977 -7.8672142699360847e-03 3.4034150838851929e-01 5.2497369050979614e-01 <_> 0 -1 1978 -4.4777389848604798e-04 3.6104118824005127e-01 5.0862592458724976e-01 <_> 0 -1 1979 5.5486010387539864e-03 4.8842659592628479e-01 6.2034982442855835e-01 <_> 0 -1 1980 -6.9461148232221603e-03 2.6259300112724304e-01 5.0110971927642822e-01 <_> 0 -1 1981 1.3569870498031378e-04 4.3407949805259705e-01 5.6283122301101685e-01 <_> 0 -1 1982 -4.5880250632762909e-02 6.5079987049102783e-01 4.6962749958038330e-01 <_> 0 -1 1983 -2.1582560613751411e-02 3.8265028595924377e-01 5.2876168489456177e-01 <_> 0 -1 1984 -2.0209539681673050e-02 3.2333680987358093e-01 5.0744771957397461e-01 <_> 0 -1 1985 5.8496710844337940e-03 5.1776039600372314e-01 4.4896709918975830e-01 <_> 0 -1 1986 -5.7476379879517481e-05 4.0208509564399719e-01 5.2463638782501221e-01 <_> 0 -1 1987 -1.1513100471347570e-03 6.3150721788406372e-01 4.9051541090011597e-01 <_> 0 -1 1988 1.9862831104546785e-03 4.7024598717689514e-01 6.4971512556076050e-01 <_> 0 -1 1989 -5.2719512023031712e-03 3.6503839492797852e-01 5.2276527881622314e-01 <_> 0 -1 1990 1.2662699446082115e-03 5.1661008596420288e-01 3.8776180148124695e-01 <_> 0 -1 1991 -6.2919440679252148e-03 7.3758941888809204e-01 5.0238478183746338e-01 <_> 0 -1 1992 6.7360111279413104e-04 4.4232261180877686e-01 5.4955857992172241e-01 <_> 0 -1 1993 -1.0523450328037143e-03 5.9763962030410767e-01 4.8595830798149109e-01 <_> 0 -1 1994 -4.4216238893568516e-04 5.9559392929077148e-01 4.3989309668540955e-01 <_> 0 -1 1995 1.1747940443456173e-03 5.3498882055282593e-01 4.6050581336021423e-01 <_> 0 -1 1996 5.2457437850534916e-03 5.0491911172866821e-01 2.9415771365165710e-01 <_> 0 -1 1997 -2.4539720267057419e-02 2.5501778721809387e-01 5.2185869216918945e-01 <_> 0 -1 1998 7.3793041519820690e-04 4.4248610734939575e-01 5.4908162355422974e-01 <_> 0 -1 1999 1.4233799884095788e-03 5.3195142745971680e-01 4.0813559293746948e-01 <_> 0 -1 2000 -2.4149110540747643e-03 4.0876591205596924e-01 5.2389502525329590e-01 <_> 0 -1 2001 -1.2165299849584699e-03 5.6745791435241699e-01 4.9080529808998108e-01 <_> 0 -1 2002 -1.2438809499144554e-03 4.1294258832931519e-01 5.2561181783676147e-01 <_> 0 -1 2003 6.1942739412188530e-03 5.0601941347122192e-01 7.3136532306671143e-01 <_> 0 -1 2004 -1.6607169527560472e-03 5.9796321392059326e-01 4.5963698625564575e-01 <_> 0 -1 2005 -2.7316259220242500e-02 4.1743651032447815e-01 5.3088420629501343e-01 <_> 0 -1 2006 -1.5845570014789701e-03 5.6158047914505005e-01 4.5194861292839050e-01 <_> 0 -1 2007 -1.5514739789068699e-03 4.0761870145797729e-01 5.3607851266860962e-01 <_> 0 -1 2008 3.8446558755822480e-04 4.3472939729690552e-01 5.4304420948028564e-01 <_> 0 -1 2009 -1.4672259800136089e-02 1.6593049466609955e-01 5.1460939645767212e-01 <_> 0 -1 2010 8.1608882173895836e-03 4.9618190526962280e-01 1.8847459554672241e-01 <_> 0 -1 2011 1.1121659772470593e-03 4.8682639002799988e-01 6.0938161611557007e-01 <_> 0 -1 2012 -7.2603770531713963e-03 6.2843251228332520e-01 4.6903759241104126e-01 <_> 0 -1 2013 -2.4046430189628154e-04 5.5750000476837158e-01 4.0460440516471863e-01 <_> 0 -1 2014 -2.3348190006799996e-04 4.1157621145248413e-01 5.2528482675552368e-01 <_> 0 -1 2015 5.5736480280756950e-03 4.7300729155540466e-01 5.6901007890701294e-01 <_> 0 -1 2016 3.0623769387602806e-02 4.9718868732452393e-01 1.7400950193405151e-01 <_> 0 -1 2017 9.2074798885732889e-04 5.3721177577972412e-01 4.3548721075057983e-01 <_> 0 -1 2018 -4.3550739064812660e-05 5.3668838739395142e-01 4.3473169207572937e-01 <_> 0 -1 2019 -6.6452710889279842e-03 3.4355181455612183e-01 5.1605331897735596e-01 <_> 0 -1 2020 4.3221998959779739e-02 4.7667920589447021e-01 7.2936528921127319e-01 <_> 0 -1 2021 2.2331769578158855e-03 5.0293159484863281e-01 5.6331712007522583e-01 <_> 0 -1 2022 3.1829739455133677e-03 4.0160921216011047e-01 5.1921367645263672e-01 <_> 0 -1 2023 -1.8027749320026487e-04 4.0883159637451172e-01 5.4179197549819946e-01 <_> 0 -1 2024 -5.2934689447283745e-03 4.0756770968437195e-01 5.2435618638992310e-01 <_> 0 -1 2025 1.2750959722325206e-03 4.9132829904556274e-01 6.3870108127593994e-01 <_> 0 -1 2026 4.3385322205722332e-03 5.0316721200942993e-01 2.9473468661308289e-01 <_> 0 -1 2027 8.5250744596123695e-03 4.9497890472412109e-01 6.3088691234588623e-01 <_> 0 -1 2028 -9.4266352243721485e-04 5.3283667564392090e-01 4.2856499552726746e-01 <_> 0 -1 2029 1.3609660090878606e-03 4.9915251135826111e-01 5.9415012598037720e-01 <_> 0 -1 2030 4.4782509212382138e-04 4.5735040307044983e-01 5.8544808626174927e-01 <_> 0 -1 2031 1.3360050506889820e-03 4.6043589711189270e-01 5.8490520715713501e-01 <_> 0 -1 2032 -6.0967548051849008e-04 3.9693889021873474e-01 5.2294230461120605e-01 <_> 0 -1 2033 -2.3656780831515789e-03 5.8083200454711914e-01 4.8983570933341980e-01 <_> 0 -1 2034 1.0734340175986290e-03 4.3512108922004700e-01 5.4700392484664917e-01 <_> 0 -1 2035 2.1923359017819166e-03 5.3550601005554199e-01 3.8429039716720581e-01 <_> 0 -1 2036 5.4968618787825108e-03 5.0181388854980469e-01 2.8271919488906860e-01 <_> 0 -1 2037 -7.5368821620941162e-02 1.2250760197639465e-01 5.1488268375396729e-01 <_> 0 -1 2038 2.5134470313787460e-02 4.7317668795585632e-01 7.0254462957382202e-01 <_> 0 -1 2039 -2.9358599931583740e-05 5.4305320978164673e-01 4.6560868620872498e-01 <_> 0 -1 2040 -5.8355910005047917e-04 4.0310400724411011e-01 5.1901197433471680e-01 <_> 0 -1 2041 -2.6639450807124376e-03 4.3081268668174744e-01 5.1617711782455444e-01 <_> 0 -1 2042 -1.3804089976474643e-03 6.2198299169540405e-01 4.6955159306526184e-01 <_> 0 -1 2043 1.2313219485804439e-03 5.3793638944625854e-01 4.4258311390876770e-01 <_> 0 -1 2044 -1.4644179827882908e-05 5.2816402912139893e-01 4.2225030064582825e-01 <_> 0 -1 2045 -1.2818809598684311e-02 2.5820928812026978e-01 5.1799327135086060e-01 <_> 0 -1 2046 2.2852189838886261e-02 4.7786930203437805e-01 7.6092642545700073e-01 <_> 0 -1 2047 8.2305970136076212e-04 5.3409922122955322e-01 4.6717241406440735e-01 <_> 0 -1 2048 1.2770120054483414e-02 4.9657610058784485e-01 1.4723660051822662e-01 <_> 0 -1 2049 -5.0051510334014893e-02 6.4149940013885498e-01 5.0165921449661255e-01 <_> 0 -1 2050 1.5775270760059357e-02 4.5223200321197510e-01 5.6853622198104858e-01 <_> 0 -1 2051 -1.8501620739698410e-02 2.7647489309310913e-01 5.1379591226577759e-01 <_> 0 -1 2052 2.4626250378787518e-03 5.1419419050216675e-01 3.7954080104827881e-01 <_> 0 -1 2053 6.2916167080402374e-02 5.0606489181518555e-01 6.5804338455200195e-01 <_> 0 -1 2054 -2.1648500478477217e-05 5.1953881978988647e-01 4.0198868513107300e-01 <_> 0 -1 2055 2.1180990152060986e-03 4.9623650312423706e-01 5.9544587135314941e-01 <_> 0 -1 2056 -1.6634890809655190e-02 3.7579330801963806e-01 5.1754468679428101e-01 <_> 0 -1 2057 -2.8899470344185829e-03 6.6240137815475464e-01 5.0571787357330322e-01 <_> 0 -1 2058 7.6783262193202972e-02 4.7957968711853027e-01 8.0477148294448853e-01 <_> 0 -1 2059 3.9170677773654461e-03 4.9378821253776550e-01 5.7199418544769287e-01 <_> 0 -1 2060 -7.2670601308345795e-02 5.3894560784101486e-02 4.9439039826393127e-01 <_> 0 -1 2061 5.4039502143859863e-01 5.1297742128372192e-01 1.1433389782905579e-01 <_> 0 -1 2062 2.9510019812732935e-03 4.5283439755439758e-01 5.6985741853713989e-01 <_> 0 -1 2063 3.4508369863033295e-03 5.3577268123626709e-01 4.2187309265136719e-01 <_> 0 -1 2064 -4.2077939724549651e-04 5.9161728620529175e-01 4.6379259228706360e-01 <_> 0 -1 2065 3.3051050268113613e-03 5.2733850479125977e-01 4.3820428848266602e-01 <_> 0 -1 2066 4.7735060798004270e-04 4.0465280413627625e-01 5.1818847656250000e-01 <_> 0 -1 2067 -2.5928510352969170e-02 7.4522358179092407e-01 5.0893861055374146e-01 <_> 0 -1 2068 -2.9729790985584259e-03 3.2954359054565430e-01 5.0587952136993408e-01 <_> 0 -1 2069 5.8508329093456268e-03 4.8571440577507019e-01 5.7930248975753784e-01 <_> 0 -1 2070 -4.5967519283294678e-02 4.3127310276031494e-01 5.3806531429290771e-01 <_> 0 -1 2071 1.5585960447788239e-01 5.1961702108383179e-01 1.6847139596939087e-01 <_> 0 -1 2072 1.5164829790592194e-02 4.7357571125030518e-01 6.7350268363952637e-01 <_> 0 -1 2073 -1.0604249546304345e-03 5.8229267597198486e-01 4.7757029533386230e-01 <_> 0 -1 2074 6.6476291976869106e-03 4.9991989135742188e-01 2.3195350170135498e-01 <_> 0 -1 2075 -1.2231130152940750e-02 4.7508931159973145e-01 5.2629822492599487e-01 <_> 0 -1 2076 5.6528882123529911e-03 5.0697678327560425e-01 3.5618188977241516e-01 <_> 0 -1 2077 1.2977829901501536e-03 4.8756939172744751e-01 5.6190627813339233e-01 <_> 0 -1 2078 1.0781589895486832e-02 4.7507700324058533e-01 6.7823082208633423e-01 <_> 0 -1 2079 2.8654779307544231e-03 5.3054618835449219e-01 4.2907360196113586e-01 <_> 0 -1 2080 2.8663428965955973e-03 4.5184791088104248e-01 5.5393511056900024e-01 <_> 0 -1 2081 -5.1983320154249668e-03 4.1491198539733887e-01 5.4341888427734375e-01 <_> 0 -1 2082 5.3739990107715130e-03 4.7178968787193298e-01 6.5076571702957153e-01 <_> 0 -1 2083 -1.4641529880464077e-02 2.1721640229225159e-01 5.1617771387100220e-01 <_> 0 -1 2084 -1.5042580344015732e-05 5.3373837471008301e-01 4.2988368868827820e-01 <_> 0 -1 2085 -1.1875660129589960e-04 4.6045941114425659e-01 5.5824470520019531e-01 <_> 0 -1 2086 1.6995530575513840e-02 4.9458950757980347e-01 7.3880076408386230e-02 <_> 0 -1 2087 -3.5095941275358200e-02 7.0055091381072998e-01 4.9775910377502441e-01 <_> 0 -1 2088 2.4217350874096155e-03 4.4662651419639587e-01 5.4776942729949951e-01 <_> 0 -1 2089 -9.6340337768197060e-04 4.7140988707542419e-01 5.3133380413055420e-01 <_> 0 -1 2090 1.6391130338888615e-04 4.3315461277961731e-01 5.3422421216964722e-01 <_> 0 -1 2091 -2.1141460165381432e-02 2.6447001099586487e-01 5.2044987678527832e-01 <_> 0 -1 2092 8.7775202700868249e-04 5.2083498239517212e-01 4.1527429223060608e-01 <_> 0 -1 2093 -2.7943920344114304e-02 6.3441252708435059e-01 5.0188118219375610e-01 <_> 0 -1 2094 6.7297378554940224e-03 5.0504380464553833e-01 3.5008639097213745e-01 <_> 0 -1 2095 2.3281039670109749e-02 4.9663180112838745e-01 6.9686770439147949e-01 <_> 0 -1 2096 -1.1644979938864708e-02 3.3002600073814392e-01 5.0496298074722290e-01 <_> 0 -1 2097 1.5764309093356133e-02 4.9915981292724609e-01 7.3211538791656494e-01 <_> 0 -1 2098 -1.3611479662358761e-03 3.9117351174354553e-01 5.1606708765029907e-01 <_> 0 -1 2099 -8.1522337859496474e-04 5.6289112567901611e-01 4.9497190117835999e-01 <_> 0 -1 2100 -6.0066272271797061e-04 5.8535951375961304e-01 4.5505958795547485e-01 <_> 0 -1 2101 4.9715518252924085e-04 4.2714700102806091e-01 5.4435992240905762e-01 <_> 0 -1 2102 2.3475370835512877e-03 5.1431107521057129e-01 3.8876569271087646e-01 <_> 0 -1 2103 -8.9261569082736969e-03 6.0445022583007812e-01 4.9717208743095398e-01 <_> 0 -1 2104 -1.3919910416007042e-02 2.5831609964370728e-01 5.0003677606582642e-01 <_> 0 -1 2105 1.0209949687123299e-03 4.8573741316795349e-01 5.5603581666946411e-01 <_> 0 -1 2106 -2.7441629208624363e-03 5.9368848800659180e-01 4.6457770466804504e-01 <_> 0 -1 2107 -1.6200130805373192e-02 3.1630149483680725e-01 5.1934951543807983e-01 <_> 0 -1 2108 4.3331980705261230e-03 5.0612241029739380e-01 3.4588789939880371e-01 <_> 0 -1 2109 5.8497930876910686e-04 4.7790178656578064e-01 5.8701777458190918e-01 <_> 0 -1 2110 -2.2466450463980436e-03 4.2978510260581970e-01 5.3747731447219849e-01 <_> 0 -1 2111 2.3146099410951138e-03 5.4386717081069946e-01 4.6409699320793152e-01 <_> 0 -1 2112 8.7679121643304825e-03 4.7268930077552795e-01 6.7717897891998291e-01 <_> 0 -1 2113 -2.2448020172305405e-04 4.2291730642318726e-01 5.4280489683151245e-01 <_> 0 -1 2114 -7.4336021207273006e-03 6.0988807678222656e-01 4.6836739778518677e-01 <_> 0 -1 2115 -2.3189240600913763e-03 5.6894367933273315e-01 4.4242420792579651e-01 <_> 0 -1 2116 -2.1042178850620985e-03 3.7622210383415222e-01 5.1870870590209961e-01 <_> 0 -1 2117 4.6034841216169298e-04 4.6994051337242126e-01 5.7712072134017944e-01 <_> 0 -1 2118 1.0547629790380597e-03 4.4652169942855835e-01 5.6017017364501953e-01 <_> 0 -1 2119 8.7148818420246243e-04 5.4498052597045898e-01 3.9147090911865234e-01 <_> 0 -1 2120 3.3364820410497487e-04 4.5640090107917786e-01 5.6457388401031494e-01 <_> 0 -1 2121 -1.4853250468149781e-03 5.7473778724670410e-01 4.6927788853645325e-01 <_> 0 -1 2122 3.0251620337367058e-03 5.1661968231201172e-01 3.7628141045570374e-01 <_> 0 -1 2123 5.0280741415917873e-03 5.0021117925643921e-01 6.1515271663665771e-01 <_> 0 -1 2124 -5.8164511574432254e-04 5.3945982456207275e-01 4.3907511234283447e-01 <_> 0 -1 2125 4.5141529291868210e-02 5.1883268356323242e-01 2.0630359649658203e-01 <_> 0 -1 2126 -1.0795620037242770e-03 3.9046850800514221e-01 5.1379072666168213e-01 <_> 0 -1 2127 1.5995999274309725e-04 4.8953229188919067e-01 5.4275041818618774e-01 <_> 0 -1 2128 -1.9359270110726357e-02 6.9752287864685059e-01 4.7735071182250977e-01 <_> 0 -1 2129 2.0725509524345398e-01 5.2336359024047852e-01 3.0349919199943542e-01 <_> 0 -1 2130 -4.1953290929086506e-04 5.4193967580795288e-01 4.4601860642433167e-01 <_> 0 -1 2131 2.2582069505006075e-03 4.8157641291618347e-01 6.0274088382720947e-01 <_> 0 -1 2132 -6.7811207845807076e-03 3.9802789688110352e-01 5.1833057403564453e-01 <_> 0 -1 2133 1.1154309846460819e-02 5.4312318563461304e-01 4.1887599229812622e-01 <_> 0 -1 2134 4.3162431567907333e-02 4.7382280230522156e-01 6.5229612588882446e-01 <_> <_> 3 7 14 4 -1. <_> 3 9 14 2 2. <_> <_> 1 2 18 4 -1. <_> 7 2 6 4 3. <_> <_> 1 7 15 9 -1. <_> 1 10 15 3 3. <_> <_> 5 6 2 6 -1. <_> 5 9 2 3 2. <_> <_> 7 5 6 3 -1. <_> 9 5 2 3 3. <_> <_> 4 0 12 9 -1. <_> 4 3 12 3 3. <_> <_> 6 9 10 8 -1. <_> 6 13 10 4 2. <_> <_> 3 6 14 8 -1. <_> 3 10 14 4 2. <_> <_> 14 1 6 10 -1. <_> 14 1 3 10 2. <_> <_> 7 8 5 12 -1. <_> 7 12 5 4 3. <_> <_> 1 1 18 3 -1. <_> 7 1 6 3 3. <_> <_> 1 8 17 2 -1. <_> 1 9 17 1 2. <_> <_> 16 6 4 2 -1. <_> 16 7 4 1 2. <_> <_> 5 17 2 2 -1. <_> 5 18 2 1 2. <_> <_> 14 2 6 12 -1. <_> 14 2 3 12 2. <_> <_> 4 0 4 12 -1. <_> 4 0 2 6 2. <_> 6 6 2 6 2. <_> <_> 2 11 18 8 -1. <_> 8 11 6 8 3. <_> <_> 5 7 10 2 -1. <_> 5 8 10 1 2. <_> <_> 15 11 5 3 -1. <_> 15 12 5 1 3. <_> <_> 5 3 10 9 -1. <_> 5 6 10 3 3. <_> <_> 9 4 2 14 -1. <_> 9 11 2 7 2. <_> <_> 3 5 4 12 -1. <_> 3 9 4 4 3. <_> <_> 4 5 12 5 -1. <_> 8 5 4 5 3. <_> <_> 5 6 10 8 -1. <_> 5 10 10 4 2. <_> <_> 8 0 6 9 -1. <_> 8 3 6 3 3. <_> <_> 9 12 1 8 -1. <_> 9 16 1 4 2. <_> <_> 0 7 20 6 -1. <_> 0 9 20 2 3. <_> <_> 7 0 6 17 -1. <_> 9 0 2 17 3. <_> <_> 9 0 6 4 -1. <_> 11 0 2 4 3. <_> <_> 5 1 6 4 -1. <_> 7 1 2 4 3. <_> <_> 12 1 6 16 -1. <_> 14 1 2 16 3. <_> <_> 0 5 18 8 -1. <_> 0 5 9 4 2. <_> 9 9 9 4 2. <_> <_> 8 15 10 4 -1. <_> 13 15 5 2 2. <_> 8 17 5 2 2. <_> <_> 3 1 4 8 -1. <_> 3 1 2 4 2. <_> 5 5 2 4 2. <_> <_> 3 6 14 10 -1. <_> 10 6 7 5 2. <_> 3 11 7 5 2. <_> <_> 2 1 6 16 -1. <_> 4 1 2 16 3. <_> <_> 0 18 20 2 -1. <_> 0 19 20 1 2. <_> <_> 8 13 4 3 -1. <_> 8 14 4 1 3. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 0 12 9 6 -1. <_> 0 14 9 2 3. <_> <_> 5 7 3 4 -1. <_> 5 9 3 2 2. <_> <_> 9 3 2 16 -1. <_> 9 11 2 8 2. <_> <_> 3 6 13 8 -1. <_> 3 10 13 4 2. <_> <_> 12 3 8 2 -1. <_> 12 3 4 2 2. <_> <_> 8 8 4 12 -1. <_> 8 12 4 4 3. <_> <_> 11 3 8 6 -1. <_> 15 3 4 3 2. <_> 11 6 4 3 2. <_> <_> 7 1 6 19 -1. <_> 9 1 2 19 3. <_> <_> 9 0 6 4 -1. <_> 11 0 2 4 3. <_> <_> 3 1 9 3 -1. <_> 6 1 3 3 3. <_> <_> 8 15 10 4 -1. <_> 13 15 5 2 2. <_> 8 17 5 2 2. <_> <_> 0 3 6 10 -1. <_> 3 3 3 10 2. <_> <_> 3 4 15 15 -1. <_> 3 9 15 5 3. <_> <_> 6 5 8 6 -1. <_> 6 7 8 2 3. <_> <_> 4 4 12 10 -1. <_> 10 4 6 5 2. <_> 4 9 6 5 2. <_> <_> 6 4 4 4 -1. <_> 8 4 2 4 2. <_> <_> 15 11 1 2 -1. <_> 15 12 1 1 2. <_> <_> 3 11 2 2 -1. <_> 3 12 2 1 2. <_> <_> 16 11 1 3 -1. <_> 16 12 1 1 3. <_> <_> 3 15 6 4 -1. <_> 3 15 3 2 2. <_> 6 17 3 2 2. <_> <_> 6 7 8 2 -1. <_> 6 8 8 1 2. <_> <_> 3 11 1 3 -1. <_> 3 12 1 1 3. <_> <_> 6 0 12 2 -1. <_> 6 1 12 1 2. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 7 15 6 2 -1. <_> 7 16 6 1 2. <_> <_> 0 5 4 6 -1. <_> 0 7 4 2 3. <_> <_> 4 12 12 2 -1. <_> 8 12 4 2 3. <_> <_> 6 3 1 9 -1. <_> 6 6 1 3 3. <_> <_> 10 17 3 2 -1. <_> 11 17 1 2 3. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 7 6 6 4 -1. <_> 9 6 2 4 3. <_> <_> 7 17 3 2 -1. <_> 8 17 1 2 3. <_> <_> 10 17 3 3 -1. <_> 11 17 1 3 3. <_> <_> 8 12 3 2 -1. <_> 8 13 3 1 2. <_> <_> 9 3 6 2 -1. <_> 11 3 2 2 3. <_> <_> 3 11 14 4 -1. <_> 3 13 14 2 2. <_> <_> 1 10 18 4 -1. <_> 10 10 9 2 2. <_> 1 12 9 2 2. <_> <_> 0 10 3 3 -1. <_> 0 11 3 1 3. <_> <_> 9 1 6 6 -1. <_> 11 1 2 6 3. <_> <_> 8 7 3 6 -1. <_> 9 7 1 6 3. <_> <_> 1 0 18 9 -1. <_> 1 3 18 3 3. <_> <_> 12 10 2 6 -1. <_> 12 13 2 3 2. <_> <_> 0 5 19 8 -1. <_> 0 9 19 4 2. <_> <_> 7 0 6 9 -1. <_> 9 0 2 9 3. <_> <_> 5 3 6 1 -1. <_> 7 3 2 1 3. <_> <_> 11 3 6 1 -1. <_> 13 3 2 1 3. <_> <_> 5 10 4 6 -1. <_> 5 13 4 3 2. <_> <_> 11 3 6 1 -1. <_> 13 3 2 1 3. <_> <_> 4 4 12 6 -1. <_> 4 6 12 2 3. <_> <_> 15 12 2 6 -1. <_> 15 14 2 2 3. <_> <_> 9 3 2 2 -1. <_> 10 3 1 2 2. <_> <_> 9 3 3 1 -1. <_> 10 3 1 1 3. <_> <_> 1 1 4 14 -1. <_> 3 1 2 14 2. <_> <_> 9 0 4 4 -1. <_> 11 0 2 2 2. <_> 9 2 2 2 2. <_> <_> 7 5 1 14 -1. <_> 7 12 1 7 2. <_> <_> 19 0 1 4 -1. <_> 19 2 1 2 2. <_> <_> 5 5 6 4 -1. <_> 8 5 3 4 2. <_> <_> 9 18 3 2 -1. <_> 10 18 1 2 3. <_> <_> 8 18 3 2 -1. <_> 9 18 1 2 3. <_> <_> 4 5 12 6 -1. <_> 4 7 12 2 3. <_> <_> 3 12 2 6 -1. <_> 3 14 2 2 3. <_> <_> 10 8 2 12 -1. <_> 10 12 2 4 3. <_> <_> 7 18 3 2 -1. <_> 8 18 1 2 3. <_> <_> 9 0 6 2 -1. <_> 11 0 2 2 3. <_> <_> 5 11 9 3 -1. <_> 5 12 9 1 3. <_> <_> 9 0 6 2 -1. <_> 11 0 2 2 3. <_> <_> 1 1 18 5 -1. <_> 7 1 6 5 3. <_> <_> 8 0 4 4 -1. <_> 10 0 2 2 2. <_> 8 2 2 2 2. <_> <_> 3 12 1 3 -1. <_> 3 13 1 1 3. <_> <_> 8 14 5 3 -1. <_> 8 15 5 1 3. <_> <_> 5 4 10 12 -1. <_> 5 4 5 6 2. <_> 10 10 5 6 2. <_> <_> 9 6 9 12 -1. <_> 9 10 9 4 3. <_> <_> 2 2 12 14 -1. <_> 2 2 6 7 2. <_> 8 9 6 7 2. <_> <_> 4 7 12 2 -1. <_> 8 7 4 2 3. <_> <_> 7 4 6 4 -1. <_> 7 6 6 2 2. <_> <_> 4 5 11 8 -1. <_> 4 9 11 4 2. <_> <_> 3 10 16 4 -1. <_> 3 12 16 2 2. <_> <_> 0 0 16 2 -1. <_> 0 1 16 1 2. <_> <_> 7 5 6 2 -1. <_> 9 5 2 2 3. <_> <_> 3 2 6 10 -1. <_> 3 2 3 5 2. <_> 6 7 3 5 2. <_> <_> 10 5 8 15 -1. <_> 10 10 8 5 3. <_> <_> 3 14 8 6 -1. <_> 3 14 4 3 2. <_> 7 17 4 3 2. <_> <_> 14 2 2 2 -1. <_> 14 3 2 1 2. <_> <_> 1 10 7 6 -1. <_> 1 13 7 3 2. <_> <_> 15 4 4 3 -1. <_> 15 4 2 3 2. <_> <_> 2 9 14 6 -1. <_> 2 9 7 3 2. <_> 9 12 7 3 2. <_> <_> 5 7 10 4 -1. <_> 5 9 10 2 2. <_> <_> 6 9 8 8 -1. <_> 6 9 4 4 2. <_> 10 13 4 4 2. <_> <_> 14 1 3 2 -1. <_> 14 2 3 1 2. <_> <_> 1 4 4 2 -1. <_> 3 4 2 2 2. <_> <_> 11 10 2 8 -1. <_> 11 14 2 4 2. <_> <_> 0 0 5 3 -1. <_> 0 1 5 1 3. <_> <_> 2 5 18 8 -1. <_> 11 5 9 4 2. <_> 2 9 9 4 2. <_> <_> 6 6 1 6 -1. <_> 6 9 1 3 2. <_> <_> 19 1 1 3 -1. <_> 19 2 1 1 3. <_> <_> 7 6 6 6 -1. <_> 9 6 2 6 3. <_> <_> 19 1 1 3 -1. <_> 19 2 1 1 3. <_> <_> 3 13 2 3 -1. <_> 3 14 2 1 3. <_> <_> 8 4 8 12 -1. <_> 12 4 4 6 2. <_> 8 10 4 6 2. <_> <_> 5 2 6 3 -1. <_> 7 2 2 3 3. <_> <_> 6 1 9 10 -1. <_> 6 6 9 5 2. <_> <_> 0 4 6 12 -1. <_> 2 4 2 12 3. <_> <_> 15 13 2 3 -1. <_> 15 14 2 1 3. <_> <_> 7 14 5 3 -1. <_> 7 15 5 1 3. <_> <_> 15 13 3 3 -1. <_> 15 14 3 1 3. <_> <_> 6 14 8 3 -1. <_> 6 15 8 1 3. <_> <_> 15 13 3 3 -1. <_> 15 14 3 1 3. <_> <_> 2 13 3 3 -1. <_> 2 14 3 1 3. <_> <_> 4 7 12 12 -1. <_> 10 7 6 6 2. <_> 4 13 6 6 2. <_> <_> 9 7 2 6 -1. <_> 10 7 1 6 2. <_> <_> 8 9 5 2 -1. <_> 8 10 5 1 2. <_> <_> 8 6 3 4 -1. <_> 9 6 1 4 3. <_> <_> 9 6 2 8 -1. <_> 9 10 2 4 2. <_> <_> 7 7 3 6 -1. <_> 8 7 1 6 3. <_> <_> 11 3 3 3 -1. <_> 12 3 1 3 3. <_> <_> 5 4 6 1 -1. <_> 7 4 2 1 3. <_> <_> 5 6 10 3 -1. <_> 5 7 10 1 3. <_> <_> 7 3 6 9 -1. <_> 7 6 6 3 3. <_> <_> 6 7 9 1 -1. <_> 9 7 3 1 3. <_> <_> 2 8 16 8 -1. <_> 2 12 16 4 2. <_> <_> 14 6 2 6 -1. <_> 14 9 2 3 2. <_> <_> 1 5 6 15 -1. <_> 1 10 6 5 3. <_> <_> 10 0 6 9 -1. <_> 10 3 6 3 3. <_> <_> 6 6 7 14 -1. <_> 6 13 7 7 2. <_> <_> 13 7 3 6 -1. <_> 13 9 3 2 3. <_> <_> 1 8 15 4 -1. <_> 6 8 5 4 3. <_> <_> 11 2 3 10 -1. <_> 11 7 3 5 2. <_> <_> 3 7 4 6 -1. <_> 3 9 4 2 3. <_> <_> 13 3 6 10 -1. <_> 15 3 2 10 3. <_> <_> 5 7 8 10 -1. <_> 5 7 4 5 2. <_> 9 12 4 5 2. <_> <_> 4 4 12 12 -1. <_> 10 4 6 6 2. <_> 4 10 6 6 2. <_> <_> 1 4 6 9 -1. <_> 3 4 2 9 3. <_> <_> 11 3 2 5 -1. <_> 11 3 1 5 2. <_> <_> 7 3 2 5 -1. <_> 8 3 1 5 2. <_> <_> 10 14 2 3 -1. <_> 10 15 2 1 3. <_> <_> 5 12 6 2 -1. <_> 8 12 3 2 2. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 4 11 12 6 -1. <_> 4 14 12 3 2. <_> <_> 11 11 5 9 -1. <_> 11 14 5 3 3. <_> <_> 6 15 3 2 -1. <_> 6 16 3 1 2. <_> <_> 11 0 3 5 -1. <_> 12 0 1 5 3. <_> <_> 5 5 6 7 -1. <_> 8 5 3 7 2. <_> <_> 13 0 1 9 -1. <_> 13 3 1 3 3. <_> <_> 3 2 4 8 -1. <_> 3 2 2 4 2. <_> 5 6 2 4 2. <_> <_> 13 12 4 6 -1. <_> 13 14 4 2 3. <_> <_> 3 12 4 6 -1. <_> 3 14 4 2 3. <_> <_> 13 11 3 4 -1. <_> 13 13 3 2 2. <_> <_> 4 4 4 3 -1. <_> 4 5 4 1 3. <_> <_> 7 5 11 8 -1. <_> 7 9 11 4 2. <_> <_> 7 8 3 4 -1. <_> 8 8 1 4 3. <_> <_> 9 1 6 1 -1. <_> 11 1 2 1 3. <_> <_> 5 5 3 3 -1. <_> 5 6 3 1 3. <_> <_> 0 9 20 6 -1. <_> 10 9 10 3 2. <_> 0 12 10 3 2. <_> <_> 8 6 3 5 -1. <_> 9 6 1 5 3. <_> <_> 11 0 1 3 -1. <_> 11 1 1 1 3. <_> <_> 4 2 4 2 -1. <_> 4 3 4 1 2. <_> <_> 12 6 4 3 -1. <_> 12 7 4 1 3. <_> <_> 5 0 6 4 -1. <_> 7 0 2 4 3. <_> <_> 9 7 3 8 -1. <_> 10 7 1 8 3. <_> <_> 9 7 2 2 -1. <_> 10 7 1 2 2. <_> <_> 6 7 14 4 -1. <_> 13 7 7 2 2. <_> 6 9 7 2 2. <_> <_> 0 5 3 6 -1. <_> 0 7 3 2 3. <_> <_> 13 11 3 4 -1. <_> 13 13 3 2 2. <_> <_> 4 11 3 4 -1. <_> 4 13 3 2 2. <_> <_> 5 9 12 8 -1. <_> 11 9 6 4 2. <_> 5 13 6 4 2. <_> <_> 9 12 1 3 -1. <_> 9 13 1 1 3. <_> <_> 10 15 2 4 -1. <_> 10 17 2 2 2. <_> <_> 7 7 6 1 -1. <_> 9 7 2 1 3. <_> <_> 12 3 6 6 -1. <_> 15 3 3 3 2. <_> 12 6 3 3 2. <_> <_> 0 4 10 6 -1. <_> 0 6 10 2 3. <_> <_> 8 3 8 14 -1. <_> 12 3 4 7 2. <_> 8 10 4 7 2. <_> <_> 4 4 7 15 -1. <_> 4 9 7 5 3. <_> <_> 12 2 6 8 -1. <_> 15 2 3 4 2. <_> 12 6 3 4 2. <_> <_> 2 2 6 8 -1. <_> 2 2 3 4 2. <_> 5 6 3 4 2. <_> <_> 2 13 18 7 -1. <_> 8 13 6 7 3. <_> <_> 4 3 8 14 -1. <_> 4 3 4 7 2. <_> 8 10 4 7 2. <_> <_> 18 1 2 6 -1. <_> 18 3 2 2 3. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 18 1 2 6 -1. <_> 18 3 2 2 3. <_> <_> 0 1 2 6 -1. <_> 0 3 2 2 3. <_> <_> 1 5 18 6 -1. <_> 1 7 18 2 3. <_> <_> 0 2 6 7 -1. <_> 3 2 3 7 2. <_> <_> 7 3 6 14 -1. <_> 7 10 6 7 2. <_> <_> 3 7 13 10 -1. <_> 3 12 13 5 2. <_> <_> 11 15 2 2 -1. <_> 11 16 2 1 2. <_> <_> 2 11 16 4 -1. <_> 2 11 8 2 2. <_> 10 13 8 2 2. <_> <_> 13 7 6 4 -1. <_> 16 7 3 2 2. <_> 13 9 3 2 2. <_> <_> 6 10 3 9 -1. <_> 6 13 3 3 3. <_> <_> 14 6 1 6 -1. <_> 14 9 1 3 2. <_> <_> 5 10 4 1 -1. <_> 7 10 2 1 2. <_> <_> 3 8 15 5 -1. <_> 8 8 5 5 3. <_> <_> 1 6 5 4 -1. <_> 1 8 5 2 2. <_> <_> 3 1 17 6 -1. <_> 3 3 17 2 3. <_> <_> 6 7 8 2 -1. <_> 10 7 4 2 2. <_> <_> 9 7 3 2 -1. <_> 10 7 1 2 3. <_> <_> 8 7 3 2 -1. <_> 9 7 1 2 3. <_> <_> 8 9 4 2 -1. <_> 8 10 4 1 2. <_> <_> 8 8 4 3 -1. <_> 8 9 4 1 3. <_> <_> 9 5 6 4 -1. <_> 9 5 3 4 2. <_> <_> 8 13 4 3 -1. <_> 8 14 4 1 3. <_> <_> 4 7 12 6 -1. <_> 10 7 6 3 2. <_> 4 10 6 3 2. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 9 7 3 3 -1. <_> 9 8 3 1 3. <_> <_> 7 4 3 8 -1. <_> 8 4 1 8 3. <_> <_> 10 0 3 6 -1. <_> 11 0 1 6 3. <_> <_> 6 3 4 8 -1. <_> 8 3 2 8 2. <_> <_> 14 3 6 13 -1. <_> 14 3 3 13 2. <_> <_> 8 13 3 6 -1. <_> 8 16 3 3 2. <_> <_> 14 3 6 13 -1. <_> 14 3 3 13 2. <_> <_> 0 7 10 4 -1. <_> 0 7 5 2 2. <_> 5 9 5 2 2. <_> <_> 14 3 6 13 -1. <_> 14 3 3 13 2. <_> <_> 0 3 6 13 -1. <_> 3 3 3 13 2. <_> <_> 9 1 4 1 -1. <_> 9 1 2 1 2. <_> <_> 8 0 2 1 -1. <_> 9 0 1 1 2. <_> <_> 10 16 4 4 -1. <_> 12 16 2 2 2. <_> 10 18 2 2 2. <_> <_> 9 6 2 3 -1. <_> 10 6 1 3 2. <_> <_> 4 5 12 2 -1. <_> 8 5 4 2 3. <_> <_> 8 7 3 5 -1. <_> 9 7 1 5 3. <_> <_> 6 4 8 6 -1. <_> 6 6 8 2 3. <_> <_> 9 5 2 12 -1. <_> 9 11 2 6 2. <_> <_> 4 6 6 8 -1. <_> 4 10 6 4 2. <_> <_> 12 2 8 5 -1. <_> 12 2 4 5 2. <_> <_> 0 8 18 3 -1. <_> 0 9 18 1 3. <_> <_> 8 12 4 8 -1. <_> 8 16 4 4 2. <_> <_> 0 2 8 5 -1. <_> 4 2 4 5 2. <_> <_> 13 11 3 4 -1. <_> 13 13 3 2 2. <_> <_> 5 11 6 1 -1. <_> 7 11 2 1 3. <_> <_> 11 3 3 1 -1. <_> 12 3 1 1 3. <_> <_> 7 13 5 3 -1. <_> 7 14 5 1 3. <_> <_> 11 11 7 6 -1. <_> 11 14 7 3 2. <_> <_> 2 11 7 6 -1. <_> 2 14 7 3 2. <_> <_> 12 14 2 6 -1. <_> 12 16 2 2 3. <_> <_> 8 14 3 3 -1. <_> 8 15 3 1 3. <_> <_> 11 0 3 5 -1. <_> 12 0 1 5 3. <_> <_> 6 1 4 9 -1. <_> 8 1 2 9 2. <_> <_> 10 3 6 1 -1. <_> 12 3 2 1 3. <_> <_> 8 8 3 4 -1. <_> 8 10 3 2 2. <_> <_> 8 12 4 2 -1. <_> 8 13 4 1 2. <_> <_> 5 18 4 2 -1. <_> 5 19 4 1 2. <_> <_> 2 1 18 6 -1. <_> 2 3 18 2 3. <_> <_> 6 0 3 2 -1. <_> 7 0 1 2 3. <_> <_> 13 8 6 2 -1. <_> 16 8 3 1 2. <_> 13 9 3 1 2. <_> <_> 6 10 3 6 -1. <_> 6 13 3 3 2. <_> <_> 0 13 20 4 -1. <_> 10 13 10 2 2. <_> 0 15 10 2 2. <_> <_> 7 7 6 5 -1. <_> 9 7 2 5 3. <_> <_> 11 0 2 2 -1. <_> 11 1 2 1 2. <_> <_> 1 8 6 2 -1. <_> 1 8 3 1 2. <_> 4 9 3 1 2. <_> <_> 0 2 20 2 -1. <_> 10 2 10 1 2. <_> 0 3 10 1 2. <_> <_> 7 14 5 3 -1. <_> 7 15 5 1 3. <_> <_> 7 13 6 6 -1. <_> 10 13 3 3 2. <_> 7 16 3 3 2. <_> <_> 9 12 2 3 -1. <_> 9 13 2 1 3. <_> <_> 16 11 1 6 -1. <_> 16 13 1 2 3. <_> <_> 3 11 1 6 -1. <_> 3 13 1 2 3. <_> <_> 4 4 14 12 -1. <_> 11 4 7 6 2. <_> 4 10 7 6 2. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 12 3 3 3 -1. <_> 13 3 1 3 3. <_> <_> 6 6 8 3 -1. <_> 6 7 8 1 3. <_> <_> 12 3 3 3 -1. <_> 13 3 1 3 3. <_> <_> 3 1 4 10 -1. <_> 3 1 2 5 2. <_> 5 6 2 5 2. <_> <_> 5 7 10 2 -1. <_> 5 7 5 2 2. <_> <_> 8 7 3 3 -1. <_> 9 7 1 3 3. <_> <_> 15 12 2 3 -1. <_> 15 13 2 1 3. <_> <_> 7 8 3 4 -1. <_> 8 8 1 4 3. <_> <_> 13 4 1 12 -1. <_> 13 10 1 6 2. <_> <_> 4 5 12 12 -1. <_> 4 5 6 6 2. <_> 10 11 6 6 2. <_> <_> 7 14 7 3 -1. <_> 7 15 7 1 3. <_> <_> 3 12 2 3 -1. <_> 3 13 2 1 3. <_> <_> 3 2 14 2 -1. <_> 10 2 7 1 2. <_> 3 3 7 1 2. <_> <_> 0 1 3 10 -1. <_> 1 1 1 10 3. <_> <_> 9 0 6 5 -1. <_> 11 0 2 5 3. <_> <_> 5 7 6 2 -1. <_> 8 7 3 2 2. <_> <_> 7 1 6 10 -1. <_> 7 6 6 5 2. <_> <_> 1 1 18 3 -1. <_> 7 1 6 3 3. <_> <_> 16 3 3 6 -1. <_> 16 5 3 2 3. <_> <_> 6 3 7 6 -1. <_> 6 6 7 3 2. <_> <_> 4 7 12 2 -1. <_> 8 7 4 2 3. <_> <_> 0 4 17 10 -1. <_> 0 9 17 5 2. <_> <_> 3 4 15 16 -1. <_> 3 12 15 8 2. <_> <_> 7 15 6 4 -1. <_> 7 17 6 2 2. <_> <_> 15 2 4 9 -1. <_> 15 2 2 9 2. <_> <_> 2 3 3 2 -1. <_> 2 4 3 1 2. <_> <_> 13 6 7 9 -1. <_> 13 9 7 3 3. <_> <_> 8 11 4 3 -1. <_> 8 12 4 1 3. <_> <_> 0 2 20 6 -1. <_> 10 2 10 3 2. <_> 0 5 10 3 2. <_> <_> 3 2 6 10 -1. <_> 3 2 3 5 2. <_> 6 7 3 5 2. <_> <_> 13 10 3 4 -1. <_> 13 12 3 2 2. <_> <_> 4 10 3 4 -1. <_> 4 12 3 2 2. <_> <_> 7 5 6 3 -1. <_> 9 5 2 3 3. <_> <_> 7 6 6 8 -1. <_> 7 10 6 4 2. <_> <_> 0 11 20 6 -1. <_> 0 14 20 3 2. <_> <_> 4 13 4 6 -1. <_> 4 13 2 3 2. <_> 6 16 2 3 2. <_> <_> 6 0 8 12 -1. <_> 10 0 4 6 2. <_> 6 6 4 6 2. <_> <_> 2 0 15 2 -1. <_> 2 1 15 1 2. <_> <_> 9 12 2 3 -1. <_> 9 13 2 1 3. <_> <_> 3 12 1 2 -1. <_> 3 13 1 1 2. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 7 3 3 1 -1. <_> 8 3 1 1 3. <_> <_> 17 7 3 6 -1. <_> 17 9 3 2 3. <_> <_> 7 2 3 2 -1. <_> 8 2 1 2 3. <_> <_> 11 4 5 3 -1. <_> 11 5 5 1 3. <_> <_> 4 4 5 3 -1. <_> 4 5 5 1 3. <_> <_> 19 3 1 2 -1. <_> 19 4 1 1 2. <_> <_> 5 5 4 3 -1. <_> 5 6 4 1 3. <_> <_> 17 7 3 6 -1. <_> 17 9 3 2 3. <_> <_> 0 7 3 6 -1. <_> 0 9 3 2 3. <_> <_> 14 2 6 9 -1. <_> 14 5 6 3 3. <_> <_> 0 4 5 6 -1. <_> 0 6 5 2 3. <_> <_> 10 5 6 2 -1. <_> 12 5 2 2 3. <_> <_> 4 5 6 2 -1. <_> 6 5 2 2 3. <_> <_> 8 1 4 6 -1. <_> 8 3 4 2 3. <_> <_> 0 2 3 6 -1. <_> 0 4 3 2 3. <_> <_> 6 6 8 3 -1. <_> 6 7 8 1 3. <_> <_> 0 1 5 9 -1. <_> 0 4 5 3 3. <_> <_> 16 0 4 15 -1. <_> 16 0 2 15 2. <_> <_> 1 10 3 2 -1. <_> 1 11 3 1 2. <_> <_> 14 4 1 10 -1. <_> 14 9 1 5 2. <_> <_> 0 1 4 12 -1. <_> 2 1 2 12 2. <_> <_> 11 11 4 2 -1. <_> 11 11 2 2 2. <_> <_> 5 11 4 2 -1. <_> 7 11 2 2 2. <_> <_> 3 8 15 5 -1. <_> 8 8 5 5 3. <_> <_> 0 0 6 10 -1. <_> 3 0 3 10 2. <_> <_> 11 4 3 2 -1. <_> 12 4 1 2 3. <_> <_> 8 12 3 8 -1. <_> 8 16 3 4 2. <_> <_> 8 14 5 3 -1. <_> 8 15 5 1 3. <_> <_> 7 14 4 3 -1. <_> 7 15 4 1 3. <_> <_> 11 4 3 2 -1. <_> 12 4 1 2 3. <_> <_> 3 15 14 4 -1. <_> 3 15 7 2 2. <_> 10 17 7 2 2. <_> <_> 2 2 16 4 -1. <_> 10 2 8 2 2. <_> 2 4 8 2 2. <_> <_> 0 8 6 12 -1. <_> 3 8 3 12 2. <_> <_> 5 7 10 2 -1. <_> 5 7 5 2 2. <_> <_> 9 7 2 5 -1. <_> 10 7 1 5 2. <_> <_> 13 7 6 4 -1. <_> 16 7 3 2 2. <_> 13 9 3 2 2. <_> <_> 0 13 8 2 -1. <_> 0 14 8 1 2. <_> <_> 13 7 6 4 -1. <_> 16 7 3 2 2. <_> 13 9 3 2 2. <_> <_> 1 7 6 4 -1. <_> 1 7 3 2 2. <_> 4 9 3 2 2. <_> <_> 12 6 1 12 -1. <_> 12 12 1 6 2. <_> <_> 9 5 2 6 -1. <_> 10 5 1 6 2. <_> <_> 14 12 2 3 -1. <_> 14 13 2 1 3. <_> <_> 4 12 2 3 -1. <_> 4 13 2 1 3. <_> <_> 8 12 4 3 -1. <_> 8 13 4 1 3. <_> <_> 5 2 2 4 -1. <_> 5 2 1 2 2. <_> 6 4 1 2 2. <_> <_> 5 5 11 3 -1. <_> 5 6 11 1 3. <_> <_> 7 6 4 12 -1. <_> 7 12 4 6 2. <_> <_> 12 13 8 5 -1. <_> 12 13 4 5 2. <_> <_> 7 6 1 12 -1. <_> 7 12 1 6 2. <_> <_> 1 2 6 3 -1. <_> 4 2 3 3 2. <_> <_> 9 5 6 10 -1. <_> 12 5 3 5 2. <_> 9 10 3 5 2. <_> <_> 5 5 8 12 -1. <_> 5 5 4 6 2. <_> 9 11 4 6 2. <_> <_> 0 7 20 6 -1. <_> 0 9 20 2 3. <_> <_> 4 2 2 2 -1. <_> 4 3 2 1 2. <_> <_> 4 18 12 2 -1. <_> 8 18 4 2 3. <_> <_> 7 4 4 16 -1. <_> 7 12 4 8 2. <_> <_> 7 6 7 8 -1. <_> 7 10 7 4 2. <_> <_> 6 3 3 1 -1. <_> 7 3 1 1 3. <_> <_> 11 15 2 4 -1. <_> 11 17 2 2 2. <_> <_> 3 5 4 8 -1. <_> 3 9 4 4 2. <_> <_> 7 1 6 12 -1. <_> 7 7 6 6 2. <_> <_> 4 6 6 2 -1. <_> 6 6 2 2 3. <_> <_> 16 4 4 6 -1. <_> 16 6 4 2 3. <_> <_> 3 3 5 2 -1. <_> 3 4 5 1 2. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 2 16 4 2 -1. <_> 2 17 4 1 2. <_> <_> 7 13 6 6 -1. <_> 10 13 3 3 2. <_> 7 16 3 3 2. <_> <_> 7 0 3 4 -1. <_> 8 0 1 4 3. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 0 4 4 6 -1. <_> 0 6 4 2 3. <_> <_> 5 6 12 3 -1. <_> 9 6 4 3 3. <_> <_> 7 6 6 14 -1. <_> 9 6 2 14 3. <_> <_> 9 7 3 3 -1. <_> 10 7 1 3 3. <_> <_> 6 12 2 4 -1. <_> 6 14 2 2 2. <_> <_> 10 12 7 6 -1. <_> 10 14 7 2 3. <_> <_> 1 0 15 2 -1. <_> 1 1 15 1 2. <_> <_> 14 0 6 6 -1. <_> 14 0 3 6 2. <_> <_> 5 3 3 1 -1. <_> 6 3 1 1 3. <_> <_> 14 0 6 6 -1. <_> 14 0 3 6 2. <_> <_> 0 3 20 10 -1. <_> 0 8 20 5 2. <_> <_> 14 0 6 6 -1. <_> 14 0 3 6 2. <_> <_> 0 0 6 6 -1. <_> 3 0 3 6 2. <_> <_> 19 15 1 2 -1. <_> 19 16 1 1 2. <_> <_> 0 2 4 8 -1. <_> 2 2 2 8 2. <_> <_> 2 1 18 4 -1. <_> 11 1 9 2 2. <_> 2 3 9 2 2. <_> <_> 8 12 1 2 -1. <_> 8 13 1 1 2. <_> <_> 5 2 10 6 -1. <_> 10 2 5 3 2. <_> 5 5 5 3 2. <_> <_> 9 7 2 4 -1. <_> 10 7 1 4 2. <_> <_> 9 7 3 3 -1. <_> 10 7 1 3 3. <_> <_> 4 5 12 8 -1. <_> 8 5 4 8 3. <_> <_> 15 15 4 3 -1. <_> 15 16 4 1 3. <_> <_> 8 18 3 1 -1. <_> 9 18 1 1 3. <_> <_> 9 13 4 3 -1. <_> 9 14 4 1 3. <_> <_> 7 13 4 3 -1. <_> 7 14 4 1 3. <_> <_> 19 15 1 2 -1. <_> 19 16 1 1 2. <_> <_> 0 15 8 4 -1. <_> 0 17 8 2 2. <_> <_> 9 3 6 4 -1. <_> 11 3 2 4 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 3 14 14 6 -1. <_> 3 16 14 2 3. <_> <_> 6 3 6 6 -1. <_> 6 6 6 3 2. <_> <_> 5 11 10 6 -1. <_> 5 14 10 3 2. <_> <_> 3 10 3 4 -1. <_> 4 10 1 4 3. <_> <_> 13 9 2 2 -1. <_> 13 9 1 2 2. <_> <_> 5 3 6 4 -1. <_> 7 3 2 4 3. <_> <_> 9 7 3 3 -1. <_> 10 7 1 3 3. <_> <_> 2 12 2 3 -1. <_> 2 13 2 1 3. <_> <_> 9 8 3 12 -1. <_> 9 12 3 4 3. <_> <_> 3 14 4 6 -1. <_> 3 14 2 3 2. <_> 5 17 2 3 2. <_> <_> 16 15 2 2 -1. <_> 16 16 2 1 2. <_> <_> 2 15 2 2 -1. <_> 2 16 2 1 2. <_> <_> 8 12 4 3 -1. <_> 8 13 4 1 3. <_> <_> 0 7 20 1 -1. <_> 10 7 10 1 2. <_> <_> 7 6 8 3 -1. <_> 7 6 4 3 2. <_> <_> 5 7 8 2 -1. <_> 9 7 4 2 2. <_> <_> 9 7 3 5 -1. <_> 10 7 1 5 3. <_> <_> 8 7 3 5 -1. <_> 9 7 1 5 3. <_> <_> 11 1 3 5 -1. <_> 12 1 1 5 3. <_> <_> 6 2 3 6 -1. <_> 7 2 1 6 3. <_> <_> 14 14 6 5 -1. <_> 14 14 3 5 2. <_> <_> 9 8 2 2 -1. <_> 9 9 2 1 2. <_> <_> 10 7 1 3 -1. <_> 10 8 1 1 3. <_> <_> 6 6 2 2 -1. <_> 6 6 1 1 2. <_> 7 7 1 1 2. <_> <_> 2 11 18 4 -1. <_> 11 11 9 2 2. <_> 2 13 9 2 2. <_> <_> 6 6 2 2 -1. <_> 6 6 1 1 2. <_> 7 7 1 1 2. <_> <_> 0 15 20 2 -1. <_> 0 16 20 1 2. <_> <_> 4 14 2 3 -1. <_> 4 15 2 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 8 7 2 3 -1. <_> 8 8 2 1 3. <_> <_> 9 10 2 3 -1. <_> 9 11 2 1 3. <_> <_> 5 4 10 4 -1. <_> 5 6 10 2 2. <_> <_> 9 7 6 4 -1. <_> 12 7 3 2 2. <_> 9 9 3 2 2. <_> <_> 4 7 3 6 -1. <_> 4 9 3 2 3. <_> <_> 11 15 4 4 -1. <_> 13 15 2 2 2. <_> 11 17 2 2 2. <_> <_> 7 8 4 2 -1. <_> 7 9 4 1 2. <_> <_> 13 1 4 3 -1. <_> 13 1 2 3 2. <_> <_> 5 15 4 4 -1. <_> 5 15 2 2 2. <_> 7 17 2 2 2. <_> <_> 9 5 4 7 -1. <_> 9 5 2 7 2. <_> <_> 5 6 8 3 -1. <_> 9 6 4 3 2. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 7 15 5 3 -1. <_> 7 16 5 1 3. <_> <_> 11 10 4 3 -1. <_> 11 10 2 3 2. <_> <_> 6 9 8 10 -1. <_> 6 14 8 5 2. <_> <_> 10 11 6 2 -1. <_> 10 11 3 2 2. <_> <_> 4 11 6 2 -1. <_> 7 11 3 2 2. <_> <_> 11 3 8 1 -1. <_> 11 3 4 1 2. <_> <_> 6 3 3 2 -1. <_> 7 3 1 2 3. <_> <_> 14 5 6 5 -1. <_> 14 5 3 5 2. <_> <_> 7 5 2 12 -1. <_> 7 11 2 6 2. <_> <_> 8 11 4 3 -1. <_> 8 12 4 1 3. <_> <_> 4 1 2 3 -1. <_> 5 1 1 3 2. <_> <_> 18 3 2 6 -1. <_> 18 5 2 2 3. <_> <_> 0 3 2 6 -1. <_> 0 5 2 2 3. <_> <_> 9 12 2 3 -1. <_> 9 13 2 1 3. <_> <_> 7 13 4 3 -1. <_> 7 14 4 1 3. <_> <_> 18 0 2 6 -1. <_> 18 2 2 2 3. <_> <_> 0 0 2 6 -1. <_> 0 2 2 2 3. <_> <_> 8 14 6 3 -1. <_> 8 15 6 1 3. <_> <_> 7 4 2 4 -1. <_> 8 4 1 4 2. <_> <_> 8 5 4 6 -1. <_> 8 7 4 2 3. <_> <_> 6 4 2 2 -1. <_> 7 4 1 2 2. <_> <_> 3 14 14 4 -1. <_> 10 14 7 2 2. <_> 3 16 7 2 2. <_> <_> 6 15 6 2 -1. <_> 6 15 3 1 2. <_> 9 16 3 1 2. <_> <_> 14 15 6 2 -1. <_> 14 16 6 1 2. <_> <_> 2 12 12 8 -1. <_> 2 16 12 4 2. <_> <_> 7 7 7 2 -1. <_> 7 8 7 1 2. <_> <_> 0 2 18 2 -1. <_> 0 3 18 1 2. <_> <_> 9 6 2 5 -1. <_> 9 6 1 5 2. <_> <_> 7 5 3 8 -1. <_> 8 5 1 8 3. <_> <_> 9 6 3 4 -1. <_> 10 6 1 4 3. <_> <_> 4 13 3 2 -1. <_> 4 14 3 1 2. <_> <_> 9 4 6 3 -1. <_> 11 4 2 3 3. <_> <_> 5 4 6 3 -1. <_> 7 4 2 3 3. <_> <_> 14 11 5 2 -1. <_> 14 12 5 1 2. <_> <_> 1 2 6 9 -1. <_> 3 2 2 9 3. <_> <_> 14 6 6 13 -1. <_> 14 6 3 13 2. <_> <_> 3 6 14 8 -1. <_> 3 6 7 4 2. <_> 10 10 7 4 2. <_> <_> 16 0 4 11 -1. <_> 16 0 2 11 2. <_> <_> 3 4 12 12 -1. <_> 3 4 6 6 2. <_> 9 10 6 6 2. <_> <_> 11 4 5 3 -1. <_> 11 5 5 1 3. <_> <_> 4 11 4 2 -1. <_> 4 12 4 1 2. <_> <_> 10 7 2 2 -1. <_> 10 7 1 2 2. <_> <_> 8 7 2 2 -1. <_> 9 7 1 2 2. <_> <_> 9 17 3 2 -1. <_> 10 17 1 2 3. <_> <_> 5 6 3 3 -1. <_> 5 7 3 1 3. <_> <_> 10 0 3 3 -1. <_> 11 0 1 3 3. <_> <_> 5 6 6 2 -1. <_> 5 6 3 1 2. <_> 8 7 3 1 2. <_> <_> 12 16 4 3 -1. <_> 12 17 4 1 3. <_> <_> 3 12 3 2 -1. <_> 3 13 3 1 2. <_> <_> 9 12 3 2 -1. <_> 9 13 3 1 2. <_> <_> 1 11 16 4 -1. <_> 1 11 8 2 2. <_> 9 13 8 2 2. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 4 4 5 3 -1. <_> 4 5 5 1 3. <_> <_> 12 16 4 3 -1. <_> 12 17 4 1 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 9 0 2 2 -1. <_> 9 1 2 1 2. <_> <_> 8 9 4 2 -1. <_> 8 10 4 1 2. <_> <_> 8 8 4 3 -1. <_> 8 9 4 1 3. <_> <_> 0 13 6 3 -1. <_> 2 13 2 3 3. <_> <_> 16 14 3 2 -1. <_> 16 15 3 1 2. <_> <_> 1 18 18 2 -1. <_> 7 18 6 2 3. <_> <_> 16 14 3 2 -1. <_> 16 15 3 1 2. <_> <_> 1 14 3 2 -1. <_> 1 15 3 1 2. <_> <_> 7 14 6 3 -1. <_> 7 15 6 1 3. <_> <_> 5 14 8 3 -1. <_> 5 15 8 1 3. <_> <_> 10 6 4 14 -1. <_> 10 6 2 14 2. <_> <_> 6 6 4 14 -1. <_> 8 6 2 14 2. <_> <_> 13 5 2 3 -1. <_> 13 6 2 1 3. <_> <_> 7 16 6 1 -1. <_> 9 16 2 1 3. <_> <_> 9 12 3 3 -1. <_> 9 13 3 1 3. <_> <_> 7 0 3 3 -1. <_> 8 0 1 3 3. <_> <_> 4 0 16 18 -1. <_> 4 9 16 9 2. <_> <_> 1 1 16 14 -1. <_> 1 8 16 7 2. <_> <_> 3 9 15 4 -1. <_> 8 9 5 4 3. <_> <_> 6 12 7 3 -1. <_> 6 13 7 1 3. <_> <_> 14 15 2 3 -1. <_> 14 16 2 1 3. <_> <_> 2 3 16 14 -1. <_> 2 3 8 7 2. <_> 10 10 8 7 2. <_> <_> 16 2 4 18 -1. <_> 18 2 2 9 2. <_> 16 11 2 9 2. <_> <_> 4 15 2 3 -1. <_> 4 16 2 1 3. <_> <_> 16 2 4 18 -1. <_> 18 2 2 9 2. <_> 16 11 2 9 2. <_> <_> 1 1 8 3 -1. <_> 1 2 8 1 3. <_> <_> 8 11 4 3 -1. <_> 8 12 4 1 3. <_> <_> 5 11 5 9 -1. <_> 5 14 5 3 3. <_> <_> 16 0 4 11 -1. <_> 16 0 2 11 2. <_> <_> 7 0 6 1 -1. <_> 9 0 2 1 3. <_> <_> 16 3 3 7 -1. <_> 17 3 1 7 3. <_> <_> 1 3 3 7 -1. <_> 2 3 1 7 3. <_> <_> 7 8 6 12 -1. <_> 7 12 6 4 3. <_> <_> 0 0 4 11 -1. <_> 2 0 2 11 2. <_> <_> 14 0 6 20 -1. <_> 14 0 3 20 2. <_> <_> 0 3 1 2 -1. <_> 0 4 1 1 2. <_> <_> 5 5 10 8 -1. <_> 10 5 5 4 2. <_> 5 9 5 4 2. <_> <_> 4 7 12 4 -1. <_> 4 7 6 2 2. <_> 10 9 6 2 2. <_> <_> 2 1 6 4 -1. <_> 5 1 3 4 2. <_> <_> 9 7 6 4 -1. <_> 12 7 3 2 2. <_> 9 9 3 2 2. <_> <_> 5 6 2 6 -1. <_> 5 9 2 3 2. <_> <_> 9 16 6 4 -1. <_> 12 16 3 2 2. <_> 9 18 3 2 2. <_> <_> 9 4 2 12 -1. <_> 9 10 2 6 2. <_> <_> 7 1 6 18 -1. <_> 9 1 2 18 3. <_> <_> 4 12 12 2 -1. <_> 8 12 4 2 3. <_> <_> 8 8 6 2 -1. <_> 8 9 6 1 2. <_> <_> 8 0 3 6 -1. <_> 9 0 1 6 3. <_> <_> 11 18 3 2 -1. <_> 11 19 3 1 2. <_> <_> 1 1 17 4 -1. <_> 1 3 17 2 2. <_> <_> 11 8 4 12 -1. <_> 11 8 2 12 2. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 12 3 2 17 -1. <_> 12 3 1 17 2. <_> <_> 4 7 6 1 -1. <_> 6 7 2 1 3. <_> <_> 18 3 2 3 -1. <_> 18 4 2 1 3. <_> <_> 8 4 3 4 -1. <_> 8 6 3 2 2. <_> <_> 4 5 12 10 -1. <_> 4 10 12 5 2. <_> <_> 5 18 4 2 -1. <_> 7 18 2 2 2. <_> <_> 17 2 3 6 -1. <_> 17 4 3 2 3. <_> <_> 7 7 6 6 -1. <_> 9 7 2 6 3. <_> <_> 17 2 3 6 -1. <_> 17 4 3 2 3. <_> <_> 8 0 3 4 -1. <_> 9 0 1 4 3. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 0 12 6 3 -1. <_> 0 13 6 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 3 12 2 3 -1. <_> 3 13 2 1 3. <_> <_> 5 6 12 7 -1. <_> 9 6 4 7 3. <_> <_> 0 2 3 6 -1. <_> 0 4 3 2 3. <_> <_> 14 6 1 3 -1. <_> 14 7 1 1 3. <_> <_> 2 0 3 14 -1. <_> 3 0 1 14 3. <_> <_> 12 14 5 6 -1. <_> 12 16 5 2 3. <_> <_> 4 14 5 6 -1. <_> 4 16 5 2 3. <_> <_> 11 10 2 2 -1. <_> 12 10 1 1 2. <_> 11 11 1 1 2. <_> <_> 5 0 3 14 -1. <_> 6 0 1 14 3. <_> <_> 10 15 2 3 -1. <_> 10 16 2 1 3. <_> <_> 0 2 2 3 -1. <_> 0 3 2 1 3. <_> <_> 5 11 12 6 -1. <_> 5 14 12 3 2. <_> <_> 6 11 3 9 -1. <_> 6 14 3 3 3. <_> <_> 11 10 2 2 -1. <_> 12 10 1 1 2. <_> 11 11 1 1 2. <_> <_> 5 6 1 3 -1. <_> 5 7 1 1 3. <_> <_> 4 9 13 3 -1. <_> 4 10 13 1 3. <_> <_> 1 7 15 6 -1. <_> 6 7 5 6 3. <_> <_> 4 5 12 6 -1. <_> 8 5 4 6 3. <_> <_> 8 10 4 3 -1. <_> 8 11 4 1 3. <_> <_> 15 14 1 3 -1. <_> 15 15 1 1 3. <_> <_> 1 11 5 3 -1. <_> 1 12 5 1 3. <_> <_> 7 1 7 12 -1. <_> 7 7 7 6 2. <_> <_> 0 1 6 10 -1. <_> 0 1 3 5 2. <_> 3 6 3 5 2. <_> <_> 16 1 4 3 -1. <_> 16 2 4 1 3. <_> <_> 5 5 2 3 -1. <_> 5 6 2 1 3. <_> <_> 12 2 3 5 -1. <_> 13 2 1 5 3. <_> <_> 0 3 4 6 -1. <_> 0 5 4 2 3. <_> <_> 8 12 4 2 -1. <_> 8 13 4 1 2. <_> <_> 8 18 3 1 -1. <_> 9 18 1 1 3. <_> <_> 11 10 2 2 -1. <_> 12 10 1 1 2. <_> 11 11 1 1 2. <_> <_> 7 10 2 2 -1. <_> 7 10 1 1 2. <_> 8 11 1 1 2. <_> <_> 11 11 4 4 -1. <_> 11 13 4 2 2. <_> <_> 8 12 3 8 -1. <_> 9 12 1 8 3. <_> <_> 13 0 6 3 -1. <_> 13 1 6 1 3. <_> <_> 8 8 3 4 -1. <_> 9 8 1 4 3. <_> <_> 5 7 10 10 -1. <_> 10 7 5 5 2. <_> 5 12 5 5 2. <_> <_> 3 18 8 2 -1. <_> 3 18 4 1 2. <_> 7 19 4 1 2. <_> <_> 10 2 6 8 -1. <_> 12 2 2 8 3. <_> <_> 4 2 6 8 -1. <_> 6 2 2 8 3. <_> <_> 11 0 3 7 -1. <_> 12 0 1 7 3. <_> <_> 7 11 2 1 -1. <_> 8 11 1 1 2. <_> <_> 15 14 1 3 -1. <_> 15 15 1 1 3. <_> <_> 7 15 2 2 -1. <_> 7 15 1 1 2. <_> 8 16 1 1 2. <_> <_> 15 14 1 3 -1. <_> 15 15 1 1 3. <_> <_> 6 0 3 7 -1. <_> 7 0 1 7 3. <_> <_> 18 1 2 7 -1. <_> 18 1 1 7 2. <_> <_> 2 0 8 20 -1. <_> 2 10 8 10 2. <_> <_> 3 0 15 6 -1. <_> 3 2 15 2 3. <_> <_> 4 3 12 2 -1. <_> 4 4 12 1 2. <_> <_> 16 0 4 5 -1. <_> 16 0 2 5 2. <_> <_> 7 0 3 4 -1. <_> 8 0 1 4 3. <_> <_> 16 0 4 5 -1. <_> 16 0 2 5 2. <_> <_> 1 7 6 13 -1. <_> 3 7 2 13 3. <_> <_> 16 0 4 5 -1. <_> 16 0 2 5 2. <_> <_> 0 0 4 5 -1. <_> 2 0 2 5 2. <_> <_> 14 12 3 6 -1. <_> 14 14 3 2 3. <_> <_> 3 12 3 6 -1. <_> 3 14 3 2 3. <_> <_> 16 1 4 3 -1. <_> 16 2 4 1 3. <_> <_> 8 7 2 10 -1. <_> 8 7 1 5 2. <_> 9 12 1 5 2. <_> <_> 11 11 4 4 -1. <_> 11 13 4 2 2. <_> <_> 0 1 4 3 -1. <_> 0 2 4 1 3. <_> <_> 13 4 1 3 -1. <_> 13 5 1 1 3. <_> <_> 7 15 3 5 -1. <_> 8 15 1 5 3. <_> <_> 9 7 3 5 -1. <_> 10 7 1 5 3. <_> <_> 8 7 3 5 -1. <_> 9 7 1 5 3. <_> <_> 10 6 4 14 -1. <_> 10 6 2 14 2. <_> <_> 0 5 5 6 -1. <_> 0 7 5 2 3. <_> <_> 9 5 6 4 -1. <_> 9 5 3 4 2. <_> <_> 0 0 18 10 -1. <_> 6 0 6 10 3. <_> <_> 10 6 4 14 -1. <_> 10 6 2 14 2. <_> <_> 6 6 4 14 -1. <_> 8 6 2 14 2. <_> <_> 13 4 1 3 -1. <_> 13 5 1 1 3. <_> <_> 5 1 2 3 -1. <_> 6 1 1 3 2. <_> <_> 18 1 2 18 -1. <_> 19 1 1 9 2. <_> 18 10 1 9 2. <_> <_> 2 1 4 3 -1. <_> 2 2 4 1 3. <_> <_> 18 1 2 18 -1. <_> 19 1 1 9 2. <_> 18 10 1 9 2. <_> <_> 1 14 4 6 -1. <_> 1 14 2 3 2. <_> 3 17 2 3 2. <_> <_> 10 11 7 6 -1. <_> 10 13 7 2 3. <_> <_> 0 10 6 10 -1. <_> 0 10 3 5 2. <_> 3 15 3 5 2. <_> <_> 11 0 3 4 -1. <_> 12 0 1 4 3. <_> <_> 5 10 5 6 -1. <_> 5 13 5 3 2. <_> <_> 14 6 1 8 -1. <_> 14 10 1 4 2. <_> <_> 1 7 18 6 -1. <_> 1 7 9 3 2. <_> 10 10 9 3 2. <_> <_> 9 7 2 2 -1. <_> 9 7 1 2 2. <_> <_> 5 9 4 5 -1. <_> 7 9 2 5 2. <_> <_> 7 6 6 3 -1. <_> 9 6 2 3 3. <_> <_> 1 0 18 4 -1. <_> 7 0 6 4 3. <_> <_> 7 15 2 4 -1. <_> 7 17 2 2 2. <_> <_> 1 0 19 9 -1. <_> 1 3 19 3 3. <_> <_> 3 7 3 6 -1. <_> 3 9 3 2 3. <_> <_> 13 7 4 4 -1. <_> 15 7 2 2 2. <_> 13 9 2 2 2. <_> <_> 3 7 4 4 -1. <_> 3 7 2 2 2. <_> 5 9 2 2 2. <_> <_> 9 6 10 8 -1. <_> 9 10 10 4 2. <_> <_> 3 8 14 12 -1. <_> 3 14 14 6 2. <_> <_> 6 5 10 12 -1. <_> 11 5 5 6 2. <_> 6 11 5 6 2. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 9 5 6 5 -1. <_> 9 5 3 5 2. <_> <_> 9 4 2 4 -1. <_> 9 6 2 2 2. <_> <_> 9 5 6 5 -1. <_> 9 5 3 5 2. <_> <_> 5 5 6 5 -1. <_> 8 5 3 5 2. <_> <_> 11 2 6 1 -1. <_> 13 2 2 1 3. <_> <_> 3 2 6 1 -1. <_> 5 2 2 1 3. <_> <_> 13 5 2 3 -1. <_> 13 6 2 1 3. <_> <_> 0 10 1 4 -1. <_> 0 12 1 2 2. <_> <_> 13 5 2 3 -1. <_> 13 6 2 1 3. <_> <_> 8 18 3 2 -1. <_> 9 18 1 2 3. <_> <_> 6 15 9 2 -1. <_> 6 16 9 1 2. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 18 4 2 4 -1. <_> 18 6 2 2 2. <_> <_> 5 5 2 3 -1. <_> 5 6 2 1 3. <_> <_> 15 16 3 2 -1. <_> 15 17 3 1 2. <_> <_> 0 0 3 9 -1. <_> 0 3 3 3 3. <_> <_> 9 7 3 3 -1. <_> 9 8 3 1 3. <_> <_> 8 7 3 3 -1. <_> 8 8 3 1 3. <_> <_> 9 5 2 6 -1. <_> 9 5 1 6 2. <_> <_> 8 6 3 4 -1. <_> 9 6 1 4 3. <_> <_> 7 6 8 12 -1. <_> 11 6 4 6 2. <_> 7 12 4 6 2. <_> <_> 5 6 8 12 -1. <_> 5 6 4 6 2. <_> 9 12 4 6 2. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 2 16 3 2 -1. <_> 2 17 3 1 2. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 2 12 6 6 -1. <_> 2 14 6 2 3. <_> <_> 7 13 6 3 -1. <_> 7 14 6 1 3. <_> <_> 6 14 6 3 -1. <_> 6 15 6 1 3. <_> <_> 14 15 5 3 -1. <_> 14 16 5 1 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 14 15 5 3 -1. <_> 14 16 5 1 3. <_> <_> 5 3 6 2 -1. <_> 7 3 2 2 3. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 1 15 5 3 -1. <_> 1 16 5 1 3. <_> <_> 8 13 4 6 -1. <_> 10 13 2 3 2. <_> 8 16 2 3 2. <_> <_> 7 8 3 3 -1. <_> 8 8 1 3 3. <_> <_> 12 0 5 4 -1. <_> 12 2 5 2 2. <_> <_> 0 2 20 2 -1. <_> 0 2 10 1 2. <_> 10 3 10 1 2. <_> <_> 1 0 18 4 -1. <_> 7 0 6 4 3. <_> <_> 4 3 6 1 -1. <_> 6 3 2 1 3. <_> <_> 4 18 13 2 -1. <_> 4 19 13 1 2. <_> <_> 2 10 3 6 -1. <_> 2 12 3 2 3. <_> <_> 14 12 6 8 -1. <_> 17 12 3 4 2. <_> 14 16 3 4 2. <_> <_> 4 13 10 6 -1. <_> 4 13 5 3 2. <_> 9 16 5 3 2. <_> <_> 14 12 1 2 -1. <_> 14 13 1 1 2. <_> <_> 8 13 4 3 -1. <_> 8 14 4 1 3. <_> <_> 14 12 2 2 -1. <_> 14 13 2 1 2. <_> <_> 4 12 2 2 -1. <_> 4 13 2 1 2. <_> <_> 8 12 9 2 -1. <_> 8 13 9 1 2. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 11 10 3 6 -1. <_> 11 13 3 3 2. <_> <_> 5 6 9 12 -1. <_> 5 12 9 6 2. <_> <_> 11 10 3 6 -1. <_> 11 13 3 3 2. <_> <_> 6 10 3 6 -1. <_> 6 13 3 3 2. <_> <_> 5 4 11 3 -1. <_> 5 5 11 1 3. <_> <_> 7 1 5 10 -1. <_> 7 6 5 5 2. <_> <_> 2 8 18 2 -1. <_> 2 9 18 1 2. <_> <_> 7 17 5 3 -1. <_> 7 18 5 1 3. <_> <_> 5 9 12 1 -1. <_> 9 9 4 1 3. <_> <_> 0 14 6 6 -1. <_> 0 14 3 3 2. <_> 3 17 3 3 2. <_> <_> 5 9 12 1 -1. <_> 9 9 4 1 3. <_> <_> 3 9 12 1 -1. <_> 7 9 4 1 3. <_> <_> 14 10 6 7 -1. <_> 14 10 3 7 2. <_> <_> 1 0 16 2 -1. <_> 1 1 16 1 2. <_> <_> 10 9 10 9 -1. <_> 10 12 10 3 3. <_> <_> 0 1 10 2 -1. <_> 5 1 5 2 2. <_> <_> 17 3 2 3 -1. <_> 17 4 2 1 3. <_> <_> 1 3 2 3 -1. <_> 1 4 2 1 3. <_> <_> 9 7 3 6 -1. <_> 10 7 1 6 3. <_> <_> 6 5 4 3 -1. <_> 8 5 2 3 2. <_> <_> 7 5 6 6 -1. <_> 9 5 2 6 3. <_> <_> 3 4 12 12 -1. <_> 3 4 6 6 2. <_> 9 10 6 6 2. <_> <_> 9 2 6 15 -1. <_> 11 2 2 15 3. <_> <_> 2 2 6 17 -1. <_> 4 2 2 17 3. <_> <_> 14 10 6 7 -1. <_> 14 10 3 7 2. <_> <_> 0 10 6 7 -1. <_> 3 10 3 7 2. <_> <_> 9 2 6 15 -1. <_> 11 2 2 15 3. <_> <_> 5 2 6 15 -1. <_> 7 2 2 15 3. <_> <_> 17 9 3 6 -1. <_> 17 11 3 2 3. <_> <_> 6 7 6 6 -1. <_> 8 7 2 6 3. <_> <_> 1 10 18 6 -1. <_> 10 10 9 3 2. <_> 1 13 9 3 2. <_> <_> 0 9 10 9 -1. <_> 0 12 10 3 3. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 5 12 3 4 -1. <_> 5 14 3 2 2. <_> <_> 3 3 16 12 -1. <_> 3 9 16 6 2. <_> <_> 1 1 12 12 -1. <_> 1 1 6 6 2. <_> 7 7 6 6 2. <_> <_> 10 4 2 4 -1. <_> 11 4 1 2 2. <_> 10 6 1 2 2. <_> <_> 0 9 10 2 -1. <_> 0 9 5 1 2. <_> 5 10 5 1 2. <_> <_> 9 11 3 3 -1. <_> 9 12 3 1 3. <_> <_> 3 12 9 2 -1. <_> 3 13 9 1 2. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 3 4 13 6 -1. <_> 3 6 13 2 3. <_> <_> 9 7 6 4 -1. <_> 12 7 3 2 2. <_> 9 9 3 2 2. <_> <_> 1 0 6 8 -1. <_> 4 0 3 8 2. <_> <_> 9 5 2 12 -1. <_> 9 11 2 6 2. <_> <_> 4 4 3 10 -1. <_> 4 9 3 5 2. <_> <_> 6 17 8 3 -1. <_> 6 18 8 1 3. <_> <_> 0 5 10 6 -1. <_> 0 7 10 2 3. <_> <_> 13 2 3 2 -1. <_> 13 3 3 1 2. <_> <_> 7 5 4 5 -1. <_> 9 5 2 5 2. <_> <_> 12 14 3 6 -1. <_> 12 16 3 2 3. <_> <_> 1 11 8 2 -1. <_> 1 12 8 1 2. <_> <_> 7 13 6 3 -1. <_> 7 14 6 1 3. <_> <_> 0 5 3 6 -1. <_> 0 7 3 2 3. <_> <_> 13 2 3 2 -1. <_> 13 3 3 1 2. <_> <_> 4 14 4 6 -1. <_> 4 14 2 3 2. <_> 6 17 2 3 2. <_> <_> 13 2 3 2 -1. <_> 13 3 3 1 2. <_> <_> 8 2 4 12 -1. <_> 8 6 4 4 3. <_> <_> 14 0 6 8 -1. <_> 17 0 3 4 2. <_> 14 4 3 4 2. <_> <_> 7 17 3 2 -1. <_> 8 17 1 2 3. <_> <_> 8 12 4 2 -1. <_> 8 13 4 1 2. <_> <_> 6 0 8 12 -1. <_> 6 0 4 6 2. <_> 10 6 4 6 2. <_> <_> 14 0 2 10 -1. <_> 15 0 1 5 2. <_> 14 5 1 5 2. <_> <_> 5 3 8 6 -1. <_> 5 3 4 3 2. <_> 9 6 4 3 2. <_> <_> 14 0 6 10 -1. <_> 17 0 3 5 2. <_> 14 5 3 5 2. <_> <_> 9 14 1 2 -1. <_> 9 15 1 1 2. <_> <_> 15 10 4 3 -1. <_> 15 11 4 1 3. <_> <_> 8 14 2 3 -1. <_> 8 15 2 1 3. <_> <_> 3 13 14 4 -1. <_> 10 13 7 2 2. <_> 3 15 7 2 2. <_> <_> 1 10 4 3 -1. <_> 1 11 4 1 3. <_> <_> 9 11 6 1 -1. <_> 11 11 2 1 3. <_> <_> 5 11 6 1 -1. <_> 7 11 2 1 3. <_> <_> 3 5 16 15 -1. <_> 3 10 16 5 3. <_> <_> 6 12 4 2 -1. <_> 8 12 2 2 2. <_> <_> 4 4 12 10 -1. <_> 10 4 6 5 2. <_> 4 9 6 5 2. <_> <_> 8 6 3 4 -1. <_> 9 6 1 4 3. <_> <_> 8 12 4 8 -1. <_> 10 12 2 4 2. <_> 8 16 2 4 2. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 12 2 3 2 -1. <_> 13 2 1 2 3. <_> <_> 8 15 3 2 -1. <_> 8 16 3 1 2. <_> <_> 6 0 9 14 -1. <_> 9 0 3 14 3. <_> <_> 9 6 2 3 -1. <_> 10 6 1 3 2. <_> <_> 10 8 2 3 -1. <_> 10 9 2 1 3. <_> <_> 0 9 4 6 -1. <_> 0 11 4 2 3. <_> <_> 6 0 8 2 -1. <_> 6 1 8 1 2. <_> <_> 6 14 7 3 -1. <_> 6 15 7 1 3. <_> <_> 8 10 8 9 -1. <_> 8 13 8 3 3. <_> <_> 5 2 3 2 -1. <_> 6 2 1 2 3. <_> <_> 14 1 6 8 -1. <_> 17 1 3 4 2. <_> 14 5 3 4 2. <_> <_> 0 1 6 8 -1. <_> 0 1 3 4 2. <_> 3 5 3 4 2. <_> <_> 1 2 18 6 -1. <_> 10 2 9 3 2. <_> 1 5 9 3 2. <_> <_> 9 3 2 1 -1. <_> 10 3 1 1 2. <_> <_> 13 2 4 6 -1. <_> 15 2 2 3 2. <_> 13 5 2 3 2. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 13 5 1 3 -1. <_> 13 6 1 1 3. <_> <_> 2 16 5 3 -1. <_> 2 17 5 1 3. <_> <_> 13 2 4 6 -1. <_> 15 2 2 3 2. <_> 13 5 2 3 2. <_> <_> 3 2 4 6 -1. <_> 3 2 2 3 2. <_> 5 5 2 3 2. <_> <_> 13 5 1 2 -1. <_> 13 6 1 1 2. <_> <_> 5 5 2 2 -1. <_> 5 6 2 1 2. <_> <_> 13 9 2 2 -1. <_> 13 9 1 2 2. <_> <_> 5 9 2 2 -1. <_> 6 9 1 2 2. <_> <_> 13 17 3 2 -1. <_> 13 18 3 1 2. <_> <_> 6 16 4 4 -1. <_> 6 16 2 2 2. <_> 8 18 2 2 2. <_> <_> 9 16 2 3 -1. <_> 9 17 2 1 3. <_> <_> 0 13 9 6 -1. <_> 0 15 9 2 3. <_> <_> 9 14 2 6 -1. <_> 9 17 2 3 2. <_> <_> 9 15 2 3 -1. <_> 9 16 2 1 3. <_> <_> 1 10 18 6 -1. <_> 1 12 18 2 3. <_> <_> 8 11 4 2 -1. <_> 8 12 4 1 2. <_> <_> 7 9 6 2 -1. <_> 7 10 6 1 2. <_> <_> 8 8 2 3 -1. <_> 8 9 2 1 3. <_> <_> 17 5 3 4 -1. <_> 18 5 1 4 3. <_> <_> 1 19 18 1 -1. <_> 7 19 6 1 3. <_> <_> 9 0 3 2 -1. <_> 10 0 1 2 3. <_> <_> 1 8 1 6 -1. <_> 1 10 1 2 3. <_> <_> 12 17 8 3 -1. <_> 12 17 4 3 2. <_> <_> 0 5 3 4 -1. <_> 1 5 1 4 3. <_> <_> 9 7 2 3 -1. <_> 9 8 2 1 3. <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. <_> <_> 11 3 2 5 -1. <_> 11 3 1 5 2. <_> <_> 7 3 2 5 -1. <_> 8 3 1 5 2. <_> <_> 15 13 2 3 -1. <_> 15 14 2 1 3. <_> <_> 5 6 2 3 -1. <_> 5 7 2 1 3. <_> <_> 4 19 15 1 -1. <_> 9 19 5 1 3. <_> <_> 1 19 15 1 -1. <_> 6 19 5 1 3. <_> <_> 15 13 2 3 -1. <_> 15 14 2 1 3. <_> <_> 5 0 4 15 -1. <_> 7 0 2 15 2. <_> <_> 9 6 2 5 -1. <_> 9 6 1 5 2. <_> <_> 9 5 2 7 -1. <_> 10 5 1 7 2. <_> <_> 16 11 3 3 -1. <_> 16 12 3 1 3. <_> <_> 1 11 3 3 -1. <_> 1 12 3 1 3. <_> <_> 6 6 8 3 -1. <_> 6 7 8 1 3. <_> <_> 0 15 6 2 -1. <_> 0 16 6 1 2. <_> <_> 1 0 18 6 -1. <_> 7 0 6 6 3. <_> <_> 6 0 3 4 -1. <_> 7 0 1 4 3. <_> <_> 14 10 4 10 -1. <_> 16 10 2 5 2. <_> 14 15 2 5 2. <_> <_> 3 2 3 2 -1. <_> 4 2 1 2 3. <_> <_> 11 2 2 2 -1. <_> 11 3 2 1 2. <_> <_> 2 10 4 10 -1. <_> 2 10 2 5 2. <_> 4 15 2 5 2. <_> <_> 0 13 20 6 -1. <_> 10 13 10 3 2. <_> 0 16 10 3 2. <_> <_> 0 5 2 15 -1. <_> 1 5 1 15 2. <_> <_> 1 7 18 4 -1. <_> 10 7 9 2 2. <_> 1 9 9 2 2. <_> <_> 0 0 2 17 -1. <_> 1 0 1 17 2. <_> <_> 2 6 16 6 -1. <_> 10 6 8 3 2. <_> 2 9 8 3 2. <_> <_> 8 14 1 3 -1. <_> 8 15 1 1 3. <_> <_> 8 15 4 2 -1. <_> 8 16 4 1 2. <_> <_> 5 2 8 2 -1. <_> 5 2 4 1 2. <_> 9 3 4 1 2. <_> <_> 6 11 8 6 -1. <_> 6 14 8 3 2. <_> <_> 9 13 2 2 -1. <_> 9 14 2 1 2. <_> <_> 18 4 2 6 -1. <_> 18 6 2 2 3. <_> <_> 9 12 2 2 -1. <_> 9 13 2 1 2. <_> <_> 18 4 2 6 -1. <_> 18 6 2 2 3. <_> <_> 9 13 1 3 -1. <_> 9 14 1 1 3. <_> <_> 18 4 2 6 -1. <_> 18 6 2 2 3. <_> <_> 0 4 2 6 -1. <_> 0 6 2 2 3. <_> <_> 9 12 3 3 -1. <_> 9 13 3 1 3. <_> <_> 3 13 2 3 -1. <_> 3 14 2 1 3. <_> <_> 13 13 4 3 -1. <_> 13 14 4 1 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 5 2 10 6 -1. <_> 5 4 10 2 3. <_> <_> 3 13 4 3 -1. <_> 3 14 4 1 3. <_> <_> 3 7 15 5 -1. <_> 8 7 5 5 3. <_> <_> 3 7 12 2 -1. <_> 7 7 4 2 3. <_> <_> 10 3 3 9 -1. <_> 11 3 1 9 3. <_> <_> 8 6 4 6 -1. <_> 10 6 2 6 2. <_> <_> 9 7 4 3 -1. <_> 9 8 4 1 3. <_> <_> 0 9 4 9 -1. <_> 2 9 2 9 2. <_> <_> 9 13 3 5 -1. <_> 10 13 1 5 3. <_> <_> 7 7 6 3 -1. <_> 9 7 2 3 3. <_> <_> 9 7 3 5 -1. <_> 10 7 1 5 3. <_> <_> 5 7 8 2 -1. <_> 9 7 4 2 2. <_> <_> 5 9 12 2 -1. <_> 9 9 4 2 3. <_> <_> 5 6 10 3 -1. <_> 10 6 5 3 2. <_> <_> 10 12 3 1 -1. <_> 11 12 1 1 3. <_> <_> 0 1 11 15 -1. <_> 0 6 11 5 3. <_> <_> 1 0 18 6 -1. <_> 7 0 6 6 3. <_> <_> 7 7 6 1 -1. <_> 9 7 2 1 3. <_> <_> 5 16 6 4 -1. <_> 5 16 3 2 2. <_> 8 18 3 2 2. <_> <_> 6 5 9 8 -1. <_> 6 9 9 4 2. <_> <_> 5 10 2 6 -1. <_> 5 13 2 3 2. <_> <_> 7 6 8 10 -1. <_> 11 6 4 5 2. <_> 7 11 4 5 2. <_> <_> 5 6 8 10 -1. <_> 5 6 4 5 2. <_> 9 11 4 5 2. <_> <_> 9 5 2 2 -1. <_> 9 6 2 1 2. <_> <_> 5 12 8 2 -1. <_> 5 13 8 1 2. <_> <_> 10 2 8 2 -1. <_> 10 3 8 1 2. <_> <_> 4 0 2 10 -1. <_> 4 0 1 5 2. <_> 5 5 1 5 2. <_> <_> 9 10 2 2 -1. <_> 9 11 2 1 2. <_> <_> 2 8 15 3 -1. <_> 2 9 15 1 3. <_> <_> 8 13 4 3 -1. <_> 8 14 4 1 3. <_> <_> 7 2 3 2 -1. <_> 8 2 1 2 3. <_> <_> 7 13 6 3 -1. <_> 7 14 6 1 3. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 17 2 3 6 -1. <_> 17 4 3 2 3. <_> <_> 1 5 3 4 -1. <_> 2 5 1 4 3. <_> <_> 14 8 4 6 -1. <_> 14 10 4 2 3. <_> <_> 1 4 3 8 -1. <_> 2 4 1 8 3. <_> <_> 8 13 4 6 -1. <_> 8 16 4 3 2. <_> <_> 3 14 2 2 -1. <_> 3 15 2 1 2. <_> <_> 14 8 4 6 -1. <_> 14 10 4 2 3. <_> <_> 2 8 4 6 -1. <_> 2 10 4 2 3. <_> <_> 10 14 1 6 -1. <_> 10 17 1 3 2. <_> <_> 7 5 3 6 -1. <_> 8 5 1 6 3. <_> <_> 11 2 2 6 -1. <_> 12 2 1 3 2. <_> 11 5 1 3 2. <_> <_> 6 6 6 5 -1. <_> 8 6 2 5 3. <_> <_> 17 1 3 6 -1. <_> 17 3 3 2 3. <_> <_> 8 7 3 5 -1. <_> 9 7 1 5 3. <_> <_> 9 18 3 2 -1. <_> 10 18 1 2 3. <_> <_> 8 18 3 2 -1. <_> 9 18 1 2 3. <_> <_> 12 3 5 2 -1. <_> 12 4 5 1 2. <_> <_> 7 1 5 12 -1. <_> 7 7 5 6 2. <_> <_> 1 0 18 4 -1. <_> 7 0 6 4 3. <_> <_> 4 2 2 2 -1. <_> 4 3 2 1 2. <_> <_> 11 14 4 2 -1. <_> 13 14 2 1 2. <_> 11 15 2 1 2. <_> <_> 0 2 3 6 -1. <_> 0 4 3 2 3. <_> <_> 9 7 2 3 -1. <_> 9 8 2 1 3. <_> <_> 5 5 1 3 -1. <_> 5 6 1 1 3. <_> <_> 10 10 6 1 -1. <_> 10 10 3 1 2. <_> <_> 4 10 6 1 -1. <_> 7 10 3 1 2. <_> <_> 9 17 3 3 -1. <_> 9 18 3 1 3. <_> <_> 4 14 1 3 -1. <_> 4 15 1 1 3. <_> <_> 12 5 3 3 -1. <_> 12 6 3 1 3. <_> <_> 4 5 12 3 -1. <_> 4 6 12 1 3. <_> <_> 9 8 2 3 -1. <_> 9 9 2 1 3. <_> <_> 4 9 3 3 -1. <_> 5 9 1 3 3. <_> <_> 6 0 9 17 -1. <_> 9 0 3 17 3. <_> <_> 9 12 1 3 -1. <_> 9 13 1 1 3. <_> <_> 9 5 2 15 -1. <_> 9 10 2 5 3. <_> <_> 8 14 2 3 -1. <_> 8 15 2 1 3. <_> <_> 10 14 1 3 -1. <_> 10 15 1 1 3. <_> <_> 7 1 6 5 -1. <_> 9 1 2 5 3. <_> <_> 0 0 20 2 -1. <_> 0 0 10 2 2. <_> <_> 2 13 5 3 -1. <_> 2 14 5 1 3. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 2 5 9 15 -1. <_> 2 10 9 5 3. <_> <_> 5 0 12 10 -1. <_> 11 0 6 5 2. <_> 5 5 6 5 2. <_> <_> 5 1 2 3 -1. <_> 6 1 1 3 2. <_> <_> 10 7 6 1 -1. <_> 12 7 2 1 3. <_> <_> 3 1 2 10 -1. <_> 3 1 1 5 2. <_> 4 6 1 5 2. <_> <_> 13 7 2 1 -1. <_> 13 7 1 1 2. <_> <_> 4 13 4 6 -1. <_> 4 15 4 2 3. <_> <_> 13 7 2 1 -1. <_> 13 7 1 1 2. <_> <_> 5 7 2 1 -1. <_> 6 7 1 1 2. <_> <_> 2 12 18 4 -1. <_> 11 12 9 2 2. <_> 2 14 9 2 2. <_> <_> 5 7 2 2 -1. <_> 5 7 1 1 2. <_> 6 8 1 1 2. <_> <_> 16 3 4 2 -1. <_> 16 4 4 1 2. <_> <_> 0 2 2 18 -1. <_> 0 2 1 9 2. <_> 1 11 1 9 2. <_> <_> 1 2 18 4 -1. <_> 10 2 9 2 2. <_> 1 4 9 2 2. <_> <_> 9 14 1 3 -1. <_> 9 15 1 1 3. <_> <_> 2 12 18 4 -1. <_> 11 12 9 2 2. <_> 2 14 9 2 2. <_> <_> 0 12 18 4 -1. <_> 0 12 9 2 2. <_> 9 14 9 2 2. <_> <_> 11 4 5 3 -1. <_> 11 5 5 1 3. <_> <_> 6 4 7 3 -1. <_> 6 5 7 1 3. <_> <_> 13 17 3 3 -1. <_> 13 18 3 1 3. <_> <_> 8 1 3 4 -1. <_> 9 1 1 4 3. <_> <_> 11 4 2 4 -1. <_> 11 4 1 4 2. <_> <_> 0 17 9 3 -1. <_> 3 17 3 3 3. <_> <_> 11 0 2 8 -1. <_> 12 0 1 4 2. <_> 11 4 1 4 2. <_> <_> 0 8 6 12 -1. <_> 0 8 3 6 2. <_> 3 14 3 6 2. <_> <_> 10 7 4 12 -1. <_> 10 13 4 6 2. <_> <_> 5 3 8 14 -1. <_> 5 10 8 7 2. <_> <_> 14 10 6 1 -1. <_> 14 10 3 1 2. <_> <_> 0 4 10 4 -1. <_> 0 6 10 2 2. <_> <_> 10 0 5 8 -1. <_> 10 4 5 4 2. <_> <_> 8 1 4 8 -1. <_> 8 1 2 4 2. <_> 10 5 2 4 2. <_> <_> 9 11 6 1 -1. <_> 11 11 2 1 3. <_> <_> 8 9 3 4 -1. <_> 9 9 1 4 3. <_> <_> 18 4 2 6 -1. <_> 18 6 2 2 3. <_> <_> 8 8 3 4 -1. <_> 9 8 1 4 3. <_> <_> 7 1 13 3 -1. <_> 7 2 13 1 3. <_> <_> 7 13 6 1 -1. <_> 9 13 2 1 3. <_> <_> 12 11 3 6 -1. <_> 12 13 3 2 3. <_> <_> 5 11 6 1 -1. <_> 7 11 2 1 3. <_> <_> 1 4 18 10 -1. <_> 10 4 9 5 2. <_> 1 9 9 5 2. <_> <_> 8 6 4 9 -1. <_> 8 9 4 3 3. <_> <_> 8 6 4 3 -1. <_> 8 7 4 1 3. <_> <_> 8 7 3 3 -1. <_> 9 7 1 3 3. <_> <_> 14 15 4 3 -1. <_> 14 16 4 1 3. <_> <_> 5 10 3 10 -1. <_> 6 10 1 10 3. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 0 8 1 6 -1. <_> 0 10 1 2 3. <_> <_> 10 15 1 3 -1. <_> 10 16 1 1 3. <_> <_> 2 15 4 3 -1. <_> 2 16 4 1 3. <_> <_> 18 3 2 8 -1. <_> 19 3 1 4 2. <_> 18 7 1 4 2. <_> <_> 0 3 2 8 -1. <_> 0 3 1 4 2. <_> 1 7 1 4 2. <_> <_> 3 7 14 10 -1. <_> 10 7 7 5 2. <_> 3 12 7 5 2. <_> <_> 0 7 19 3 -1. <_> 0 8 19 1 3. <_> <_> 12 6 3 3 -1. <_> 12 7 3 1 3. <_> <_> 0 6 1 3 -1. <_> 0 7 1 1 3. <_> <_> 12 6 3 3 -1. <_> 12 7 3 1 3. <_> <_> 5 6 3 3 -1. <_> 5 7 3 1 3. <_> <_> 8 2 4 2 -1. <_> 8 3 4 1 2. <_> <_> 6 3 4 12 -1. <_> 8 3 2 12 2. <_> <_> 13 6 2 3 -1. <_> 13 7 2 1 3. <_> <_> 0 10 20 4 -1. <_> 0 12 20 2 2. <_> <_> 2 0 17 14 -1. <_> 2 7 17 7 2. <_> <_> 0 0 6 10 -1. <_> 0 0 3 5 2. <_> 3 5 3 5 2. <_> <_> 14 6 6 4 -1. <_> 14 6 3 4 2. <_> <_> 0 6 6 4 -1. <_> 3 6 3 4 2. <_> <_> 13 2 7 2 -1. <_> 13 3 7 1 2. <_> <_> 0 2 7 2 -1. <_> 0 3 7 1 2. <_> <_> 6 11 14 2 -1. <_> 13 11 7 1 2. <_> 6 12 7 1 2. <_> <_> 8 5 2 2 -1. <_> 8 5 1 1 2. <_> 9 6 1 1 2. <_> <_> 13 9 2 3 -1. <_> 13 9 1 3 2. <_> <_> 1 1 3 12 -1. <_> 2 1 1 12 3. <_> <_> 17 4 1 3 -1. <_> 17 5 1 1 3. <_> <_> 2 4 1 3 -1. <_> 2 5 1 1 3. <_> <_> 14 5 1 3 -1. <_> 14 6 1 1 3. <_> <_> 7 16 2 3 -1. <_> 7 17 2 1 3. <_> <_> 8 13 4 6 -1. <_> 10 13 2 3 2. <_> 8 16 2 3 2. <_> <_> 5 5 1 3 -1. <_> 5 6 1 1 3. <_> <_> 16 0 4 20 -1. <_> 16 0 2 20 2. <_> <_> 5 1 2 6 -1. <_> 5 1 1 3 2. <_> 6 4 1 3 2. <_> <_> 5 4 10 4 -1. <_> 5 6 10 2 2. <_> <_> 15 2 4 12 -1. <_> 15 2 2 12 2. <_> <_> 7 6 4 12 -1. <_> 7 12 4 6 2. <_> <_> 14 5 1 8 -1. <_> 14 9 1 4 2. <_> <_> 1 4 14 10 -1. <_> 1 4 7 5 2. <_> 8 9 7 5 2. <_> <_> 11 6 6 14 -1. <_> 14 6 3 7 2. <_> 11 13 3 7 2. <_> <_> 3 6 6 14 -1. <_> 3 6 3 7 2. <_> 6 13 3 7 2. <_> <_> 4 9 15 2 -1. <_> 9 9 5 2 3. <_> <_> 7 14 6 3 -1. <_> 7 15 6 1 3. <_> <_> 6 3 14 4 -1. <_> 13 3 7 2 2. <_> 6 5 7 2 2. <_> <_> 1 9 15 2 -1. <_> 6 9 5 2 3. <_> <_> 6 11 8 9 -1. <_> 6 14 8 3 3. <_> <_> 7 4 3 8 -1. <_> 8 4 1 8 3. <_> <_> 14 6 2 6 -1. <_> 14 9 2 3 2. <_> <_> 5 7 6 4 -1. <_> 5 7 3 2 2. <_> 8 9 3 2 2. <_> <_> 1 1 18 19 -1. <_> 7 1 6 19 3. <_> <_> 1 2 6 5 -1. <_> 4 2 3 5 2. <_> <_> 12 17 6 2 -1. <_> 12 18 6 1 2. <_> <_> 2 17 6 2 -1. <_> 2 18 6 1 2. <_> <_> 17 3 3 6 -1. <_> 17 5 3 2 3. <_> <_> 8 17 3 3 -1. <_> 8 18 3 1 3. <_> <_> 10 13 2 6 -1. <_> 10 16 2 3 2. <_> <_> 7 13 6 3 -1. <_> 7 14 6 1 3. <_> <_> 17 3 3 6 -1. <_> 17 5 3 2 3. <_> <_> 8 13 2 3 -1. <_> 8 14 2 1 3. <_> <_> 9 3 6 2 -1. <_> 11 3 2 2 3. <_> <_> 0 3 3 6 -1. <_> 0 5 3 2 3. <_> <_> 8 5 4 6 -1. <_> 8 7 4 2 3. <_> <_> 5 5 3 2 -1. <_> 5 6 3 1 2. <_> <_> 10 1 3 4 -1. <_> 11 1 1 4 3. <_> <_> 1 2 5 9 -1. <_> 1 5 5 3 3. <_> <_> 13 6 2 3 -1. <_> 13 7 2 1 3. <_> <_> 0 6 14 3 -1. <_> 7 6 7 3 2. <_> <_> 2 11 18 8 -1. <_> 2 15 18 4 2. <_> <_> 5 6 2 3 -1. <_> 5 7 2 1 3. <_> <_> 10 6 4 2 -1. <_> 12 6 2 1 2. <_> 10 7 2 1 2. <_> <_> 6 6 4 2 -1. <_> 6 6 2 1 2. <_> 8 7 2 1 2. <_> <_> 10 1 3 4 -1. <_> 11 1 1 4 3. <_> <_> 7 1 2 7 -1. <_> 8 1 1 7 2. <_> <_> 4 2 15 14 -1. <_> 4 9 15 7 2. <_> <_> 8 7 3 2 -1. <_> 9 7 1 2 3. <_> <_> 2 3 18 4 -1. <_> 11 3 9 2 2. <_> 2 5 9 2 2. <_> <_> 9 7 2 2 -1. <_> 10 7 1 2 2. <_> <_> 13 9 2 3 -1. <_> 13 9 1 3 2. <_> <_> 5 2 6 2 -1. <_> 7 2 2 2 3. <_> <_> 9 5 2 7 -1. <_> 9 5 1 7 2. <_> <_> 5 9 2 3 -1. <_> 6 9 1 3 2. <_> <_> 6 0 14 18 -1. <_> 6 9 14 9 2. <_> <_> 2 16 6 3 -1. <_> 2 17 6 1 3. <_> <_> 9 7 3 6 -1. <_> 10 7 1 6 3. <_> <_> 7 8 4 3 -1. <_> 7 9 4 1 3. <_> <_> 7 12 6 3 -1. <_> 7 13 6 1 3. <_> <_> 9 12 2 3 -1. <_> 9 13 2 1 3. <_> <_> 7 12 6 2 -1. <_> 9 12 2 2 3. <_> <_> 5 11 4 6 -1. <_> 5 14 4 3 2. <_> <_> 11 12 7 2 -1. <_> 11 13 7 1 2. <_> <_> 6 10 8 6 -1. <_> 6 10 4 3 2. <_> 10 13 4 3 2. <_> <_> 11 10 3 4 -1. <_> 11 12 3 2 2. <_> <_> 9 16 2 3 -1. <_> 9 17 2 1 3. <_> <_> 13 3 1 9 -1. <_> 13 6 1 3 3. <_> <_> 1 13 14 6 -1. <_> 1 15 14 2 3. <_> <_> 13 6 1 6 -1. <_> 13 9 1 3 2. <_> <_> 0 4 3 8 -1. <_> 1 4 1 8 3. <_> <_> 18 0 2 18 -1. <_> 18 0 1 18 2. <_> <_> 2 3 6 2 -1. <_> 2 4 6 1 2. <_> <_> 9 0 8 6 -1. <_> 9 2 8 2 3. <_> <_> 6 6 1 6 -1. <_> 6 9 1 3 2. <_> <_> 14 8 6 3 -1. <_> 14 9 6 1 3. <_> <_> 0 0 2 18 -1. <_> 1 0 1 18 2. <_> <_> 1 18 18 2 -1. <_> 10 18 9 1 2. <_> 1 19 9 1 2. <_> <_> 3 15 2 2 -1. <_> 3 16 2 1 2. <_> <_> 8 14 5 3 -1. <_> 8 15 5 1 3. <_> <_> 8 14 2 3 -1. <_> 8 15 2 1 3. <_> <_> 12 3 3 3 -1. <_> 13 3 1 3 3. <_> <_> 7 5 6 2 -1. <_> 9 5 2 2 3. <_> <_> 15 5 5 2 -1. <_> 15 6 5 1 2. <_> <_> 0 5 5 2 -1. <_> 0 6 5 1 2. <_> <_> 17 14 1 6 -1. <_> 17 17 1 3 2. <_> <_> 2 9 9 3 -1. <_> 5 9 3 3 3. <_> <_> 12 3 3 3 -1. <_> 13 3 1 3 3. <_> <_> 0 0 4 18 -1. <_> 2 0 2 18 2. <_> <_> 17 6 1 3 -1. <_> 17 7 1 1 3. <_> <_> 2 14 1 6 -1. <_> 2 17 1 3 2. <_> <_> 19 8 1 2 -1. <_> 19 9 1 1 2. <_> <_> 5 3 3 3 -1. <_> 6 3 1 3 3. <_> <_> 9 16 2 3 -1. <_> 9 17 2 1 3. <_> <_> 2 6 1 3 -1. <_> 2 7 1 1 3. <_> <_> 12 4 8 2 -1. <_> 16 4 4 1 2. <_> 12 5 4 1 2. <_> <_> 0 4 8 2 -1. <_> 0 4 4 1 2. <_> 4 5 4 1 2. <_> <_> 2 16 18 4 -1. <_> 2 18 18 2 2. <_> <_> 7 15 2 4 -1. <_> 7 17 2 2 2. <_> <_> 4 0 14 3 -1. <_> 4 1 14 1 3. <_> <_> 0 0 4 20 -1. <_> 2 0 2 20 2. <_> <_> 12 4 4 8 -1. <_> 14 4 2 4 2. <_> 12 8 2 4 2. <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. <_> <_> 10 6 2 3 -1. <_> 10 7 2 1 3. <_> <_> 8 7 3 2 -1. <_> 8 8 3 1 2. <_> <_> 8 2 6 12 -1. <_> 8 8 6 6 2. <_> <_> 4 0 11 12 -1. <_> 4 4 11 4 3. <_> <_> 14 9 6 11 -1. <_> 16 9 2 11 3. <_> <_> 0 14 4 3 -1. <_> 0 15 4 1 3. <_> <_> 9 10 2 3 -1. <_> 9 11 2 1 3. <_> <_> 5 11 3 2 -1. <_> 5 12 3 1 2. <_> <_> 9 15 3 3 -1. <_> 10 15 1 3 3. <_> <_> 8 8 3 4 -1. <_> 9 8 1 4 3. <_> <_> 9 15 3 3 -1. <_> 10 15 1 3 3. <_> <_> 7 7 3 2 -1. <_> 8 7 1 2 3. <_> <_> 2 10 16 4 -1. <_> 10 10 8 2 2. <_> 2 12 8 2 2. <_> <_> 2 3 4 17 -1. <_> 4 3 2 17 2. <_> <_> 15 13 2 7 -1. <_> 15 13 1 7 2. <_> <_> 2 2 6 1 -1. <_> 5 2 3 1 2. <_> <_> 5 2 12 4 -1. <_> 9 2 4 4 3. <_> <_> 6 0 8 12 -1. <_> 6 0 4 6 2. <_> 10 6 4 6 2. <_> <_> 13 7 2 2 -1. <_> 14 7 1 1 2. <_> 13 8 1 1 2. <_> <_> 0 12 20 6 -1. <_> 0 14 20 2 3. <_> <_> 14 7 2 3 -1. <_> 14 7 1 3 2. <_> <_> 0 8 9 12 -1. <_> 3 8 3 12 3. <_> <_> 3 0 16 2 -1. <_> 3 0 8 2 2. <_> <_> 6 15 3 3 -1. <_> 6 16 3 1 3. <_> <_> 8 15 6 3 -1. <_> 8 16 6 1 3. <_> <_> 0 10 1 6 -1. <_> 0 12 1 2 3. <_> <_> 10 9 4 3 -1. <_> 10 10 4 1 3. <_> <_> 9 15 2 3 -1. <_> 9 16 2 1 3. <_> <_> 5 7 10 1 -1. <_> 5 7 5 1 2. <_> <_> 4 0 12 19 -1. <_> 10 0 6 19 2. <_> <_> 0 6 20 6 -1. <_> 10 6 10 3 2. <_> 0 9 10 3 2. <_> <_> 3 6 2 2 -1. <_> 3 6 1 1 2. <_> 4 7 1 1 2. <_> <_> 15 6 2 2 -1. <_> 16 6 1 1 2. <_> 15 7 1 1 2. <_> <_> 3 6 2 2 -1. <_> 3 6 1 1 2. <_> 4 7 1 1 2. <_> <_> 14 4 1 12 -1. <_> 14 10 1 6 2. <_> <_> 2 5 16 10 -1. <_> 2 5 8 5 2. <_> 10 10 8 5 2. <_> <_> 9 17 3 2 -1. <_> 10 17 1 2 3. <_> <_> 1 4 2 2 -1. <_> 1 5 2 1 2. <_> <_> 5 0 15 5 -1. <_> 10 0 5 5 3. <_> <_> 0 0 15 5 -1. <_> 5 0 5 5 3. <_> <_> 11 2 2 17 -1. <_> 11 2 1 17 2. <_> <_> 7 2 2 17 -1. <_> 8 2 1 17 2. <_> <_> 15 11 2 9 -1. <_> 15 11 1 9 2. <_> <_> 3 11 2 9 -1. <_> 4 11 1 9 2. <_> <_> 5 16 14 4 -1. <_> 5 16 7 4 2. <_> <_> 1 4 18 1 -1. <_> 7 4 6 1 3. <_> <_> 13 7 6 4 -1. <_> 16 7 3 2 2. <_> 13 9 3 2 2. <_> <_> 9 8 2 12 -1. <_> 9 12 2 4 3. <_> <_> 12 1 6 6 -1. <_> 12 3 6 2 3. <_> <_> 5 2 6 6 -1. <_> 5 2 3 3 2. <_> 8 5 3 3 2. <_> <_> 9 16 6 4 -1. <_> 12 16 3 2 2. <_> 9 18 3 2 2. <_> <_> 1 2 18 3 -1. <_> 7 2 6 3 3. <_> <_> 7 4 9 10 -1. <_> 7 9 9 5 2. <_> <_> 5 9 4 4 -1. <_> 7 9 2 4 2. <_> <_> 11 10 3 6 -1. <_> 11 13 3 3 2. <_> <_> 7 11 5 3 -1. <_> 7 12 5 1 3. <_> <_> 7 11 6 6 -1. <_> 10 11 3 3 2. <_> 7 14 3 3 2. <_> <_> 0 0 10 9 -1. <_> 0 3 10 3 3. <_> <_> 13 14 1 6 -1. <_> 13 16 1 2 3. <_> <_> 0 2 3 6 -1. <_> 0 4 3 2 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 6 14 1 6 -1. <_> 6 16 1 2 3. <_> <_> 9 15 2 3 -1. <_> 9 16 2 1 3. <_> <_> 6 4 3 3 -1. <_> 7 4 1 3 3. <_> <_> 9 0 11 3 -1. <_> 9 1 11 1 3. <_> <_> 0 6 20 3 -1. <_> 0 7 20 1 3. <_> <_> 10 1 1 2 -1. <_> 10 2 1 1 2. <_> <_> 9 6 2 6 -1. <_> 10 6 1 6 2. <_> <_> 5 8 12 1 -1. <_> 9 8 4 1 3. <_> <_> 3 8 12 1 -1. <_> 7 8 4 1 3. <_> <_> 9 7 3 5 -1. <_> 10 7 1 5 3. <_> <_> 3 9 6 2 -1. <_> 6 9 3 2 2. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 7 0 6 1 -1. <_> 9 0 2 1 3. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 7 10 2 1 -1. <_> 8 10 1 1 2. <_> <_> 6 4 9 13 -1. <_> 9 4 3 13 3. <_> <_> 6 8 4 2 -1. <_> 6 9 4 1 2. <_> <_> 16 2 4 6 -1. <_> 16 2 2 6 2. <_> <_> 0 17 6 3 -1. <_> 0 18 6 1 3. <_> <_> 10 10 3 10 -1. <_> 10 15 3 5 2. <_> <_> 8 7 3 5 -1. <_> 9 7 1 5 3. <_> <_> 10 4 4 3 -1. <_> 10 4 2 3 2. <_> <_> 8 4 3 8 -1. <_> 9 4 1 8 3. <_> <_> 6 6 9 13 -1. <_> 9 6 3 13 3. <_> <_> 6 0 8 12 -1. <_> 6 0 4 6 2. <_> 10 6 4 6 2. <_> <_> 14 2 6 8 -1. <_> 16 2 2 8 3. <_> <_> 6 0 3 6 -1. <_> 7 0 1 6 3. <_> <_> 14 2 6 8 -1. <_> 16 2 2 8 3. <_> <_> 0 5 6 6 -1. <_> 0 8 6 3 2. <_> <_> 9 12 6 2 -1. <_> 12 12 3 1 2. <_> 9 13 3 1 2. <_> <_> 8 17 3 2 -1. <_> 9 17 1 2 3. <_> <_> 11 6 2 2 -1. <_> 12 6 1 1 2. <_> 11 7 1 1 2. <_> <_> 1 9 18 2 -1. <_> 7 9 6 2 3. <_> <_> 11 6 2 2 -1. <_> 12 6 1 1 2. <_> 11 7 1 1 2. <_> <_> 3 4 12 8 -1. <_> 7 4 4 8 3. <_> <_> 13 11 5 3 -1. <_> 13 12 5 1 3. <_> <_> 9 10 2 3 -1. <_> 9 11 2 1 3. <_> <_> 14 7 2 3 -1. <_> 14 7 1 3 2. <_> <_> 5 4 1 3 -1. <_> 5 5 1 1 3. <_> <_> 13 4 2 3 -1. <_> 13 5 2 1 3. <_> <_> 5 4 2 3 -1. <_> 5 5 2 1 3. <_> <_> 9 8 2 3 -1. <_> 9 9 2 1 3. <_> <_> 8 9 2 2 -1. <_> 8 10 2 1 2. <_> <_> 15 14 1 4 -1. <_> 15 16 1 2 2. <_> <_> 3 12 2 2 -1. <_> 3 13 2 1 2. <_> <_> 12 15 2 2 -1. <_> 13 15 1 1 2. <_> 12 16 1 1 2. <_> <_> 9 13 2 2 -1. <_> 9 14 2 1 2. <_> <_> 4 11 14 9 -1. <_> 4 14 14 3 3. <_> <_> 7 13 4 3 -1. <_> 7 14 4 1 3. <_> <_> 15 14 1 4 -1. <_> 15 16 1 2 2. <_> <_> 4 14 1 4 -1. <_> 4 16 1 2 2. <_> <_> 14 0 6 13 -1. <_> 16 0 2 13 3. <_> <_> 4 1 2 12 -1. <_> 4 1 1 6 2. <_> 5 7 1 6 2. <_> <_> 11 14 6 6 -1. <_> 14 14 3 3 2. <_> 11 17 3 3 2. <_> <_> 3 14 6 6 -1. <_> 3 14 3 3 2. <_> 6 17 3 3 2. <_> <_> 14 17 3 2 -1. <_> 14 18 3 1 2. <_> <_> 3 17 3 2 -1. <_> 3 18 3 1 2. <_> <_> 14 0 6 13 -1. <_> 16 0 2 13 3. <_> <_> 0 0 6 13 -1. <_> 2 0 2 13 3. <_> <_> 10 10 7 6 -1. <_> 10 12 7 2 3. <_> <_> 6 15 2 2 -1. <_> 6 15 1 1 2. <_> 7 16 1 1 2. <_> <_> 6 11 8 6 -1. <_> 10 11 4 3 2. <_> 6 14 4 3 2. <_> <_> 7 6 2 2 -1. <_> 7 6 1 1 2. <_> 8 7 1 1 2. <_> <_> 2 2 16 6 -1. <_> 10 2 8 3 2. <_> 2 5 8 3 2. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 11 7 3 10 -1. <_> 11 12 3 5 2. <_> <_> 6 7 3 10 -1. <_> 6 12 3 5 2. <_> <_> 10 7 3 2 -1. <_> 11 7 1 2 3. <_> <_> 8 12 4 2 -1. <_> 8 13 4 1 2. <_> <_> 10 1 1 3 -1. <_> 10 2 1 1 3. <_> <_> 1 2 4 18 -1. <_> 1 2 2 9 2. <_> 3 11 2 9 2. <_> <_> 12 4 4 12 -1. <_> 12 10 4 6 2. <_> <_> 0 0 1 6 -1. <_> 0 2 1 2 3. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 8 7 4 3 -1. <_> 8 8 4 1 3. <_> <_> 10 7 3 2 -1. <_> 11 7 1 2 3. <_> <_> 7 7 3 2 -1. <_> 8 7 1 2 3. <_> <_> 9 4 6 1 -1. <_> 11 4 2 1 3. <_> <_> 8 7 2 3 -1. <_> 9 7 1 3 2. <_> <_> 12 7 8 6 -1. <_> 16 7 4 3 2. <_> 12 10 4 3 2. <_> <_> 0 7 8 6 -1. <_> 0 7 4 3 2. <_> 4 10 4 3 2. <_> <_> 18 2 2 10 -1. <_> 19 2 1 5 2. <_> 18 7 1 5 2. <_> <_> 0 2 6 4 -1. <_> 3 2 3 4 2. <_> <_> 9 4 6 1 -1. <_> 11 4 2 1 3. <_> <_> 7 15 2 2 -1. <_> 7 15 1 1 2. <_> 8 16 1 1 2. <_> <_> 11 13 1 6 -1. <_> 11 16 1 3 2. <_> <_> 8 13 1 6 -1. <_> 8 16 1 3 2. <_> <_> 14 3 2 1 -1. <_> 14 3 1 1 2. <_> <_> 8 15 2 3 -1. <_> 8 16 2 1 3. <_> <_> 12 15 7 4 -1. <_> 12 17 7 2 2. <_> <_> 4 14 12 3 -1. <_> 4 15 12 1 3. <_> <_> 10 3 3 2 -1. <_> 11 3 1 2 3. <_> <_> 4 12 2 2 -1. <_> 4 13 2 1 2. <_> <_> 10 11 4 6 -1. <_> 10 14 4 3 2. <_> <_> 7 13 2 2 -1. <_> 7 13 1 1 2. <_> 8 14 1 1 2. <_> <_> 4 11 14 4 -1. <_> 11 11 7 2 2. <_> 4 13 7 2 2. <_> <_> 1 18 18 2 -1. <_> 7 18 6 2 3. <_> <_> 11 18 2 2 -1. <_> 12 18 1 1 2. <_> 11 19 1 1 2. <_> <_> 7 18 2 2 -1. <_> 7 18 1 1 2. <_> 8 19 1 1 2. <_> <_> 12 18 8 2 -1. <_> 12 19 8 1 2. <_> <_> 7 14 6 2 -1. <_> 7 15 6 1 2. <_> <_> 8 12 4 8 -1. <_> 10 12 2 4 2. <_> 8 16 2 4 2. <_> <_> 4 9 3 3 -1. <_> 4 10 3 1 3. <_> <_> 7 10 6 2 -1. <_> 9 10 2 2 3. <_> <_> 5 0 4 15 -1. <_> 7 0 2 15 2. <_> <_> 8 6 12 14 -1. <_> 12 6 4 14 3. <_> <_> 5 16 3 3 -1. <_> 5 17 3 1 3. <_> <_> 8 1 12 19 -1. <_> 12 1 4 19 3. <_> <_> 3 0 3 2 -1. <_> 3 1 3 1 2. <_> <_> 10 12 4 5 -1. <_> 10 12 2 5 2. <_> <_> 6 12 4 5 -1. <_> 8 12 2 5 2. <_> <_> 11 11 2 2 -1. <_> 12 11 1 1 2. <_> 11 12 1 1 2. <_> <_> 0 2 3 6 -1. <_> 0 4 3 2 3. <_> <_> 11 11 2 2 -1. <_> 12 11 1 1 2. <_> 11 12 1 1 2. <_> <_> 7 6 4 10 -1. <_> 7 11 4 5 2. <_> <_> 11 11 2 2 -1. <_> 12 11 1 1 2. <_> 11 12 1 1 2. <_> <_> 2 13 5 2 -1. <_> 2 14 5 1 2. <_> <_> 11 11 2 2 -1. <_> 12 11 1 1 2. <_> 11 12 1 1 2. <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. <_> <_> 14 13 3 3 -1. <_> 14 14 3 1 3. <_> <_> 3 13 3 3 -1. <_> 3 14 3 1 3. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 8 7 3 3 -1. <_> 8 8 3 1 3. <_> <_> 13 5 3 3 -1. <_> 13 6 3 1 3. <_> <_> 0 9 5 3 -1. <_> 0 10 5 1 3. <_> <_> 13 5 3 3 -1. <_> 13 6 3 1 3. <_> <_> 9 12 2 8 -1. <_> 9 12 1 4 2. <_> 10 16 1 4 2. <_> <_> 11 7 2 2 -1. <_> 12 7 1 1 2. <_> 11 8 1 1 2. <_> <_> 0 16 6 4 -1. <_> 3 16 3 4 2. <_> <_> 10 6 2 3 -1. <_> 10 7 2 1 3. <_> <_> 9 5 2 6 -1. <_> 9 7 2 2 3. <_> <_> 12 15 8 4 -1. <_> 12 15 4 4 2. <_> <_> 0 14 8 6 -1. <_> 4 14 4 6 2. <_> <_> 9 0 3 2 -1. <_> 10 0 1 2 3. <_> <_> 4 15 4 2 -1. <_> 6 15 2 2 2. <_> <_> 12 7 3 13 -1. <_> 13 7 1 13 3. <_> <_> 5 7 3 13 -1. <_> 6 7 1 13 3. <_> <_> 9 6 3 9 -1. <_> 9 9 3 3 3. <_> <_> 4 4 7 12 -1. <_> 4 10 7 6 2. <_> <_> 12 12 2 2 -1. <_> 13 12 1 1 2. <_> 12 13 1 1 2. <_> <_> 6 12 2 2 -1. <_> 6 12 1 1 2. <_> 7 13 1 1 2. <_> <_> 8 9 4 2 -1. <_> 10 9 2 1 2. <_> 8 10 2 1 2. <_> <_> 3 6 2 2 -1. <_> 3 6 1 1 2. <_> 4 7 1 1 2. <_> <_> 16 6 3 2 -1. <_> 16 7 3 1 2. <_> <_> 0 7 19 4 -1. <_> 0 9 19 2 2. <_> <_> 10 2 10 1 -1. <_> 10 2 5 1 2. <_> <_> 9 4 2 12 -1. <_> 9 10 2 6 2. <_> <_> 12 18 4 1 -1. <_> 12 18 2 1 2. <_> <_> 1 7 6 4 -1. <_> 1 7 3 2 2. <_> 4 9 3 2 2. <_> <_> 12 0 6 13 -1. <_> 14 0 2 13 3. <_> <_> 2 0 6 13 -1. <_> 4 0 2 13 3. <_> <_> 10 5 8 8 -1. <_> 10 9 8 4 2. <_> <_> 8 3 2 5 -1. <_> 9 3 1 5 2. <_> <_> 8 4 9 1 -1. <_> 11 4 3 1 3. <_> <_> 3 4 9 1 -1. <_> 6 4 3 1 3. <_> <_> 1 0 18 10 -1. <_> 7 0 6 10 3. <_> <_> 7 17 5 3 -1. <_> 7 18 5 1 3. <_> <_> 7 11 6 1 -1. <_> 9 11 2 1 3. <_> <_> 2 2 3 2 -1. <_> 2 3 3 1 2. <_> <_> 8 12 4 2 -1. <_> 8 13 4 1 2. <_> <_> 6 10 3 6 -1. <_> 6 13 3 3 2. <_> <_> 11 4 2 4 -1. <_> 11 4 1 4 2. <_> <_> 7 4 2 4 -1. <_> 8 4 1 4 2. <_> <_> 9 6 2 4 -1. <_> 9 6 1 4 2. <_> <_> 6 13 8 3 -1. <_> 6 14 8 1 3. <_> <_> 9 15 3 4 -1. <_> 10 15 1 4 3. <_> <_> 9 2 2 17 -1. <_> 10 2 1 17 2. <_> <_> 7 0 6 1 -1. <_> 9 0 2 1 3. <_> <_> 8 15 3 4 -1. <_> 9 15 1 4 3. <_> <_> 7 13 7 3 -1. <_> 7 14 7 1 3. <_> <_> 8 16 3 3 -1. <_> 9 16 1 3 3. <_> <_> 6 2 8 10 -1. <_> 6 7 8 5 2. <_> <_> 2 5 8 8 -1. <_> 2 9 8 4 2. <_> <_> 14 16 2 2 -1. <_> 14 17 2 1 2. <_> <_> 4 16 2 2 -1. <_> 4 17 2 1 2. <_> <_> 10 11 4 6 -1. <_> 10 14 4 3 2. <_> <_> 6 11 4 6 -1. <_> 6 14 4 3 2. <_> <_> 10 14 1 3 -1. <_> 10 15 1 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 10 0 4 6 -1. <_> 12 0 2 3 2. <_> 10 3 2 3 2. <_> <_> 0 3 20 2 -1. <_> 0 4 20 1 2. <_> <_> 12 0 8 2 -1. <_> 16 0 4 1 2. <_> 12 1 4 1 2. <_> <_> 2 12 10 8 -1. <_> 2 16 10 4 2. <_> <_> 17 7 2 10 -1. <_> 18 7 1 5 2. <_> 17 12 1 5 2. <_> <_> 1 7 2 10 -1. <_> 1 7 1 5 2. <_> 2 12 1 5 2. <_> <_> 15 10 3 6 -1. <_> 15 12 3 2 3. <_> <_> 4 4 6 2 -1. <_> 6 4 2 2 3. <_> <_> 0 5 20 6 -1. <_> 0 7 20 2 3. <_> <_> 0 0 8 2 -1. <_> 0 0 4 1 2. <_> 4 1 4 1 2. <_> <_> 1 0 18 4 -1. <_> 7 0 6 4 3. <_> <_> 1 13 6 2 -1. <_> 1 14 6 1 2. <_> <_> 10 8 3 4 -1. <_> 11 8 1 4 3. <_> <_> 6 1 6 1 -1. <_> 8 1 2 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 1 6 18 2 -1. <_> 10 6 9 2 2. <_> <_> 15 11 1 2 -1. <_> 15 12 1 1 2. <_> <_> 6 5 1 2 -1. <_> 6 6 1 1 2. <_> <_> 13 4 1 3 -1. <_> 13 5 1 1 3. <_> <_> 2 15 1 2 -1. <_> 2 16 1 1 2. <_> <_> 12 4 4 3 -1. <_> 12 5 4 1 3. <_> <_> 0 0 7 3 -1. <_> 0 1 7 1 3. <_> <_> 9 12 6 2 -1. <_> 9 12 3 2 2. <_> <_> 5 4 2 3 -1. <_> 5 5 2 1 3. <_> <_> 18 4 2 3 -1. <_> 18 5 2 1 3. <_> <_> 3 0 8 6 -1. <_> 3 2 8 2 3. <_> <_> 0 2 20 6 -1. <_> 10 2 10 3 2. <_> 0 5 10 3 2. <_> <_> 4 7 2 4 -1. <_> 5 7 1 4 2. <_> <_> 3 10 15 2 -1. <_> 8 10 5 2 3. <_> <_> 3 0 12 11 -1. <_> 9 0 6 11 2. <_> <_> 13 0 2 6 -1. <_> 13 0 1 6 2. <_> <_> 0 19 2 1 -1. <_> 1 19 1 1 2. <_> <_> 16 10 4 10 -1. <_> 18 10 2 5 2. <_> 16 15 2 5 2. <_> <_> 4 8 10 3 -1. <_> 4 9 10 1 3. <_> <_> 14 12 3 3 -1. <_> 14 13 3 1 3. <_> <_> 0 10 4 10 -1. <_> 0 10 2 5 2. <_> 2 15 2 5 2. <_> <_> 18 3 2 6 -1. <_> 18 5 2 2 3. <_> <_> 6 6 1 3 -1. <_> 6 7 1 1 3. <_> <_> 7 7 7 2 -1. <_> 7 8 7 1 2. <_> <_> 0 3 2 6 -1. <_> 0 5 2 2 3. <_> <_> 11 1 3 1 -1. <_> 12 1 1 1 3. <_> <_> 5 0 2 6 -1. <_> 6 0 1 6 2. <_> <_> 1 1 18 14 -1. <_> 7 1 6 14 3. <_> <_> 4 6 8 3 -1. <_> 8 6 4 3 2. <_> <_> 9 12 6 2 -1. <_> 9 12 3 2 2. <_> <_> 5 12 6 2 -1. <_> 8 12 3 2 2. <_> <_> 10 7 3 5 -1. <_> 11 7 1 5 3. <_> <_> 7 7 3 5 -1. <_> 8 7 1 5 3. <_> <_> 13 0 3 10 -1. <_> 14 0 1 10 3. <_> <_> 4 11 3 2 -1. <_> 4 12 3 1 2. <_> <_> 17 3 3 6 -1. <_> 18 3 1 6 3. <_> <_> 1 8 18 10 -1. <_> 1 13 18 5 2. <_> <_> 13 0 3 10 -1. <_> 14 0 1 10 3. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 16 3 3 7 -1. <_> 17 3 1 7 3. <_> <_> 4 0 3 10 -1. <_> 5 0 1 10 3. <_> <_> 16 3 3 7 -1. <_> 17 3 1 7 3. <_> <_> 0 9 1 2 -1. <_> 0 10 1 1 2. <_> <_> 18 1 2 10 -1. <_> 18 1 1 10 2. <_> <_> 0 1 2 10 -1. <_> 1 1 1 10 2. <_> <_> 10 16 3 4 -1. <_> 11 16 1 4 3. <_> <_> 2 8 3 3 -1. <_> 3 8 1 3 3. <_> <_> 11 0 2 6 -1. <_> 12 0 1 3 2. <_> 11 3 1 3 2. <_> <_> 7 0 2 6 -1. <_> 7 0 1 3 2. <_> 8 3 1 3 2. <_> <_> 16 3 3 7 -1. <_> 17 3 1 7 3. <_> <_> 1 3 3 7 -1. <_> 2 3 1 7 3. <_> <_> 14 1 6 16 -1. <_> 16 1 2 16 3. <_> <_> 0 1 6 16 -1. <_> 2 1 2 16 3. <_> <_> 2 0 16 8 -1. <_> 10 0 8 4 2. <_> 2 4 8 4 2. <_> <_> 6 8 5 3 -1. <_> 6 9 5 1 3. <_> <_> 9 7 3 3 -1. <_> 10 7 1 3 3. <_> <_> 8 8 4 3 -1. <_> 8 9 4 1 3. <_> <_> 9 6 2 4 -1. <_> 9 6 1 4 2. <_> <_> 0 7 15 1 -1. <_> 5 7 5 1 3. <_> <_> 8 2 7 9 -1. <_> 8 5 7 3 3. <_> <_> 1 7 16 4 -1. <_> 1 7 8 2 2. <_> 9 9 8 2 2. <_> <_> 6 12 8 2 -1. <_> 6 13 8 1 2. <_> <_> 8 11 3 3 -1. <_> 8 12 3 1 3. <_> <_> 4 5 14 10 -1. <_> 11 5 7 5 2. <_> 4 10 7 5 2. <_> <_> 4 12 3 2 -1. <_> 4 13 3 1 2. <_> <_> 9 11 6 1 -1. <_> 11 11 2 1 3. <_> <_> 4 9 7 6 -1. <_> 4 11 7 2 3. <_> <_> 7 10 6 3 -1. <_> 7 11 6 1 3. <_> <_> 9 11 2 2 -1. <_> 9 12 2 1 2. <_> <_> 0 5 20 6 -1. <_> 0 7 20 2 3. <_> <_> 6 4 6 1 -1. <_> 8 4 2 1 3. <_> <_> 9 11 6 1 -1. <_> 11 11 2 1 3. <_> <_> 5 11 6 1 -1. <_> 7 11 2 1 3. <_> <_> 10 16 3 4 -1. <_> 11 16 1 4 3. <_> <_> 8 7 3 3 -1. <_> 9 7 1 3 3. <_> <_> 2 12 16 8 -1. <_> 2 16 16 4 2. <_> <_> 0 15 15 2 -1. <_> 0 16 15 1 2. <_> <_> 15 4 5 6 -1. <_> 15 6 5 2 3. <_> <_> 9 5 2 4 -1. <_> 10 5 1 4 2. <_> <_> 8 10 9 6 -1. <_> 8 12 9 2 3. <_> <_> 2 19 15 1 -1. <_> 7 19 5 1 3. <_> <_> 10 16 3 4 -1. <_> 11 16 1 4 3. <_> <_> 0 15 20 4 -1. <_> 0 17 20 2 2. <_> <_> 10 16 3 4 -1. <_> 11 16 1 4 3. <_> <_> 7 16 3 4 -1. <_> 8 16 1 4 3. <_> <_> 9 16 3 3 -1. <_> 9 17 3 1 3. <_> <_> 8 11 4 6 -1. <_> 8 14 4 3 2. <_> <_> 9 6 2 12 -1. <_> 9 10 2 4 3. <_> <_> 8 17 4 3 -1. <_> 8 18 4 1 3. <_> <_> 9 18 8 2 -1. <_> 13 18 4 1 2. <_> 9 19 4 1 2. <_> <_> 1 18 8 2 -1. <_> 1 19 8 1 2. <_> <_> 13 5 6 15 -1. <_> 15 5 2 15 3. <_> <_> 9 8 2 2 -1. <_> 9 9 2 1 2. <_> <_> 9 5 2 3 -1. <_> 9 5 1 3 2. <_> <_> 1 5 6 15 -1. <_> 3 5 2 15 3. <_> <_> 4 1 14 8 -1. <_> 11 1 7 4 2. <_> 4 5 7 4 2. <_> <_> 2 4 4 16 -1. <_> 2 4 2 8 2. <_> 4 12 2 8 2. <_> <_> 12 4 3 12 -1. <_> 12 10 3 6 2. <_> <_> 4 5 10 12 -1. <_> 4 5 5 6 2. <_> 9 11 5 6 2. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 5 4 2 3 -1. <_> 5 5 2 1 3. <_> <_> 12 2 4 10 -1. <_> 14 2 2 5 2. <_> 12 7 2 5 2. <_> <_> 6 4 7 3 -1. <_> 6 5 7 1 3. <_> <_> 2 0 18 2 -1. <_> 11 0 9 1 2. <_> 2 1 9 1 2. <_> <_> 0 0 18 2 -1. <_> 0 0 9 1 2. <_> 9 1 9 1 2. <_> <_> 13 13 4 6 -1. <_> 15 13 2 3 2. <_> 13 16 2 3 2. <_> <_> 3 13 4 6 -1. <_> 3 13 2 3 2. <_> 5 16 2 3 2. <_> <_> 10 12 2 6 -1. <_> 10 15 2 3 2. <_> <_> 5 9 10 10 -1. <_> 5 9 5 5 2. <_> 10 14 5 5 2. <_> <_> 11 4 4 2 -1. <_> 13 4 2 1 2. <_> 11 5 2 1 2. <_> <_> 7 12 6 8 -1. <_> 10 12 3 8 2. <_> <_> 12 2 4 10 -1. <_> 14 2 2 5 2. <_> 12 7 2 5 2. <_> <_> 8 11 2 1 -1. <_> 9 11 1 1 2. <_> <_> 10 5 1 12 -1. <_> 10 9 1 4 3. <_> <_> 0 11 6 9 -1. <_> 3 11 3 9 2. <_> <_> 12 2 4 10 -1. <_> 14 2 2 5 2. <_> 12 7 2 5 2. <_> <_> 4 2 4 10 -1. <_> 4 2 2 5 2. <_> 6 7 2 5 2. <_> <_> 11 4 4 2 -1. <_> 13 4 2 1 2. <_> 11 5 2 1 2. <_> <_> 0 14 6 3 -1. <_> 0 15 6 1 3. <_> <_> 11 4 4 2 -1. <_> 13 4 2 1 2. <_> 11 5 2 1 2. <_> <_> 6 1 3 2 -1. <_> 7 1 1 2 3. <_> <_> 11 4 4 2 -1. <_> 13 4 2 1 2. <_> 11 5 2 1 2. <_> <_> 5 4 4 2 -1. <_> 5 4 2 1 2. <_> 7 5 2 1 2. <_> <_> 13 0 2 12 -1. <_> 14 0 1 6 2. <_> 13 6 1 6 2. <_> <_> 6 0 3 10 -1. <_> 7 0 1 10 3. <_> <_> 3 0 17 8 -1. <_> 3 4 17 4 2. <_> <_> 0 4 20 4 -1. <_> 0 6 20 2 2. <_> <_> 0 3 8 2 -1. <_> 4 3 4 2 2. <_> <_> 8 11 4 3 -1. <_> 8 12 4 1 3. <_> <_> 5 7 6 4 -1. <_> 5 7 3 2 2. <_> 8 9 3 2 2. <_> <_> 8 3 4 9 -1. <_> 8 6 4 3 3. <_> <_> 8 15 1 4 -1. <_> 8 17 1 2 2. <_> <_> 4 5 12 7 -1. <_> 8 5 4 7 3. <_> <_> 4 2 4 10 -1. <_> 4 2 2 5 2. <_> 6 7 2 5 2. <_> <_> 3 0 17 2 -1. <_> 3 1 17 1 2. <_> <_> 2 2 16 15 -1. <_> 2 7 16 5 3. <_> <_> 15 2 5 2 -1. <_> 15 3 5 1 2. <_> <_> 9 3 2 2 -1. <_> 10 3 1 2 2. <_> <_> 4 5 16 15 -1. <_> 4 10 16 5 3. <_> <_> 7 13 5 6 -1. <_> 7 16 5 3 2. <_> <_> 10 7 3 2 -1. <_> 11 7 1 2 3. <_> <_> 8 3 3 1 -1. <_> 9 3 1 1 3. <_> <_> 9 16 3 3 -1. <_> 9 17 3 1 3. <_> <_> 0 2 5 2 -1. <_> 0 3 5 1 2. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 1 7 12 1 -1. <_> 5 7 4 1 3. <_> <_> 7 5 6 14 -1. <_> 7 12 6 7 2. <_> <_> 0 0 8 10 -1. <_> 0 0 4 5 2. <_> 4 5 4 5 2. <_> <_> 9 1 3 2 -1. <_> 10 1 1 2 3. <_> <_> 8 1 3 2 -1. <_> 9 1 1 2 3. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 7 4 6 16 -1. <_> 7 12 6 8 2. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 2 3 2 6 -1. <_> 2 5 2 2 3. <_> <_> 14 2 6 9 -1. <_> 14 5 6 3 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 9 17 3 2 -1. <_> 10 17 1 2 3. <_> <_> 5 5 2 3 -1. <_> 5 6 2 1 3. <_> <_> 13 11 3 6 -1. <_> 13 13 3 2 3. <_> <_> 3 14 2 6 -1. <_> 3 17 2 3 2. <_> <_> 14 3 6 2 -1. <_> 14 4 6 1 2. <_> <_> 0 8 16 2 -1. <_> 0 9 16 1 2. <_> <_> 14 3 6 2 -1. <_> 14 4 6 1 2. <_> <_> 0 0 5 6 -1. <_> 0 2 5 2 3. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 4 11 3 6 -1. <_> 4 13 3 2 3. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 9 5 1 3 -1. <_> 9 6 1 1 3. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 6 6 8 12 -1. <_> 6 12 8 6 2. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 5 12 9 2 -1. <_> 8 12 3 2 3. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 4 5 4 3 -1. <_> 4 6 4 1 3. <_> <_> 6 6 9 2 -1. <_> 9 6 3 2 3. <_> <_> 4 11 1 3 -1. <_> 4 12 1 1 3. <_> <_> 14 12 6 6 -1. <_> 14 12 3 6 2. <_> <_> 7 0 3 7 -1. <_> 8 0 1 7 3. <_> <_> 9 8 3 3 -1. <_> 10 8 1 3 3. <_> <_> 8 8 3 3 -1. <_> 9 8 1 3 3. <_> <_> 5 10 11 3 -1. <_> 5 11 11 1 3. <_> <_> 5 7 10 1 -1. <_> 10 7 5 1 2. <_> <_> 9 7 3 2 -1. <_> 10 7 1 2 3. <_> <_> 8 7 3 2 -1. <_> 9 7 1 2 3. <_> <_> 11 9 4 2 -1. <_> 11 9 2 2 2. <_> <_> 5 9 4 2 -1. <_> 7 9 2 2 2. <_> <_> 14 10 2 4 -1. <_> 14 12 2 2 2. <_> <_> 7 7 3 2 -1. <_> 8 7 1 2 3. <_> <_> 14 17 6 3 -1. <_> 14 18 6 1 3. <_> <_> 4 5 12 12 -1. <_> 4 5 6 6 2. <_> 10 11 6 6 2. <_> <_> 6 9 8 8 -1. <_> 10 9 4 4 2. <_> 6 13 4 4 2. <_> <_> 0 4 15 4 -1. <_> 5 4 5 4 3. <_> <_> 13 2 4 1 -1. <_> 13 2 2 1 2. <_> <_> 4 12 2 2 -1. <_> 4 13 2 1 2. <_> <_> 8 13 4 3 -1. <_> 8 14 4 1 3. <_> <_> 9 13 2 3 -1. <_> 9 14 2 1 3. <_> <_> 13 11 2 3 -1. <_> 13 12 2 1 3. <_> <_> 7 12 4 4 -1. <_> 7 12 2 2 2. <_> 9 14 2 2 2. <_> <_> 10 11 2 2 -1. <_> 11 11 1 1 2. <_> 10 12 1 1 2. <_> <_> 8 17 3 2 -1. <_> 9 17 1 2 3. <_> <_> 10 11 2 2 -1. <_> 11 11 1 1 2. <_> 10 12 1 1 2. <_> <_> 0 17 6 3 -1. <_> 0 18 6 1 3. <_> <_> 10 11 2 2 -1. <_> 11 11 1 1 2. <_> 10 12 1 1 2. <_> <_> 8 11 2 2 -1. <_> 8 11 1 1 2. <_> 9 12 1 1 2. <_> <_> 12 5 8 4 -1. <_> 12 5 4 4 2. <_> <_> 0 5 8 4 -1. <_> 4 5 4 4 2. <_> <_> 13 2 4 1 -1. <_> 13 2 2 1 2. <_> <_> 3 2 4 1 -1. <_> 5 2 2 1 2. <_> <_> 10 0 4 2 -1. <_> 12 0 2 1 2. <_> 10 1 2 1 2. <_> <_> 7 12 3 1 -1. <_> 8 12 1 1 3. <_> <_> 8 11 4 8 -1. <_> 10 11 2 4 2. <_> 8 15 2 4 2. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 3 18 15 2 -1. <_> 3 19 15 1 2. <_> <_> 2 6 2 12 -1. <_> 2 6 1 6 2. <_> 3 12 1 6 2. <_> <_> 9 8 2 3 -1. <_> 9 9 2 1 3. <_> <_> 7 10 3 2 -1. <_> 8 10 1 2 3. <_> <_> 11 11 3 1 -1. <_> 12 11 1 1 3. <_> <_> 6 11 3 1 -1. <_> 7 11 1 1 3. <_> <_> 9 2 4 2 -1. <_> 11 2 2 1 2. <_> 9 3 2 1 2. <_> <_> 4 12 2 3 -1. <_> 4 13 2 1 3. <_> <_> 2 1 18 3 -1. <_> 8 1 6 3 3. <_> <_> 5 1 4 14 -1. <_> 7 1 2 14 2. <_> <_> 8 16 12 3 -1. <_> 8 16 6 3 2. <_> <_> 1 17 18 3 -1. <_> 7 17 6 3 3. <_> <_> 9 14 2 6 -1. <_> 9 17 2 3 2. <_> <_> 9 12 1 8 -1. <_> 9 16 1 4 2. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 9 6 2 12 -1. <_> 9 10 2 4 3. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 0 1 4 8 -1. <_> 2 1 2 8 2. <_> <_> 9 1 6 2 -1. <_> 12 1 3 1 2. <_> 9 2 3 1 2. <_> <_> 1 3 12 14 -1. <_> 1 10 12 7 2. <_> <_> 8 12 4 2 -1. <_> 10 12 2 1 2. <_> 8 13 2 1 2. <_> <_> 1 9 10 2 -1. <_> 1 9 5 1 2. <_> 6 10 5 1 2. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 6 8 8 3 -1. <_> 6 9 8 1 3. <_> <_> 9 15 5 3 -1. <_> 9 16 5 1 3. <_> <_> 8 7 4 3 -1. <_> 8 8 4 1 3. <_> <_> 7 7 6 2 -1. <_> 7 8 6 1 2. <_> <_> 5 7 8 2 -1. <_> 5 7 4 1 2. <_> 9 8 4 1 2. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 4 7 4 2 -1. <_> 4 8 4 1 2. <_> <_> 14 2 6 9 -1. <_> 14 5 6 3 3. <_> <_> 4 9 3 3 -1. <_> 5 9 1 3 3. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 0 2 6 9 -1. <_> 0 5 6 3 3. <_> <_> 17 3 3 6 -1. <_> 18 3 1 6 3. <_> <_> 0 3 3 6 -1. <_> 1 3 1 6 3. <_> <_> 17 14 1 2 -1. <_> 17 15 1 1 2. <_> <_> 4 9 4 3 -1. <_> 6 9 2 3 2. <_> <_> 12 9 3 3 -1. <_> 12 10 3 1 3. <_> <_> 5 9 3 3 -1. <_> 5 10 3 1 3. <_> <_> 9 5 6 8 -1. <_> 12 5 3 4 2. <_> 9 9 3 4 2. <_> <_> 5 5 6 8 -1. <_> 5 5 3 4 2. <_> 8 9 3 4 2. <_> <_> 16 1 4 6 -1. <_> 16 4 4 3 2. <_> <_> 1 0 6 20 -1. <_> 3 0 2 20 3. <_> <_> 12 11 3 2 -1. <_> 13 11 1 2 3. <_> <_> 5 11 3 2 -1. <_> 6 11 1 2 3. <_> <_> 9 4 6 1 -1. <_> 11 4 2 1 3. <_> <_> 0 0 8 3 -1. <_> 4 0 4 3 2. <_> <_> 15 0 2 5 -1. <_> 15 0 1 5 2. <_> <_> 4 1 3 2 -1. <_> 5 1 1 2 3. <_> <_> 7 0 6 15 -1. <_> 9 0 2 15 3. <_> <_> 6 11 3 1 -1. <_> 7 11 1 1 3. <_> <_> 12 0 3 4 -1. <_> 13 0 1 4 3. <_> <_> 5 4 6 1 -1. <_> 7 4 2 1 3. <_> <_> 12 7 3 2 -1. <_> 12 8 3 1 2. <_> <_> 0 1 4 6 -1. <_> 0 4 4 3 2. <_> <_> 12 7 3 2 -1. <_> 12 8 3 1 2. <_> <_> 2 16 3 3 -1. <_> 2 17 3 1 3. <_> <_> 13 8 6 10 -1. <_> 16 8 3 5 2. <_> 13 13 3 5 2. <_> <_> 0 9 5 2 -1. <_> 0 10 5 1 2. <_> <_> 12 11 2 2 -1. <_> 13 11 1 1 2. <_> 12 12 1 1 2. <_> <_> 3 15 3 3 -1. <_> 3 16 3 1 3. <_> <_> 12 7 3 2 -1. <_> 12 8 3 1 2. <_> <_> 5 7 3 2 -1. <_> 5 8 3 1 2. <_> <_> 9 5 9 9 -1. <_> 9 8 9 3 3. <_> <_> 5 0 3 7 -1. <_> 6 0 1 7 3. <_> <_> 5 2 12 5 -1. <_> 9 2 4 5 3. <_> <_> 6 11 2 2 -1. <_> 6 11 1 1 2. <_> 7 12 1 1 2. <_> <_> 15 15 3 2 -1. <_> 15 16 3 1 2. <_> <_> 2 15 3 2 -1. <_> 2 16 3 1 2. <_> <_> 14 12 6 8 -1. <_> 17 12 3 4 2. <_> 14 16 3 4 2. <_> <_> 2 8 15 6 -1. <_> 7 8 5 6 3. <_> <_> 2 2 18 17 -1. <_> 8 2 6 17 3. <_> <_> 5 1 4 1 -1. <_> 7 1 2 1 2. <_> <_> 5 2 12 5 -1. <_> 9 2 4 5 3. <_> <_> 3 2 12 5 -1. <_> 7 2 4 5 3. <_> <_> 4 9 12 4 -1. <_> 10 9 6 2 2. <_> 4 11 6 2 2. <_> <_> 5 15 6 2 -1. <_> 5 15 3 1 2. <_> 8 16 3 1 2. <_> <_> 10 14 2 3 -1. <_> 10 15 2 1 3. <_> <_> 0 13 20 2 -1. <_> 0 13 10 1 2. <_> 10 14 10 1 2. <_> <_> 4 9 12 8 -1. <_> 10 9 6 4 2. <_> 4 13 6 4 2. <_> <_> 8 13 3 6 -1. <_> 8 16 3 3 2. <_> <_> 10 12 2 2 -1. <_> 10 13 2 1 2. <_> <_> 9 12 2 2 -1. <_> 9 12 1 1 2. <_> 10 13 1 1 2. <_> <_> 4 11 14 4 -1. <_> 11 11 7 2 2. <_> 4 13 7 2 2. <_> <_> 8 5 4 2 -1. <_> 8 6 4 1 2. <_> <_> 10 10 6 3 -1. <_> 12 10 2 3 3. <_> <_> 2 14 1 2 -1. <_> 2 15 1 1 2. <_> <_> 13 8 6 12 -1. <_> 16 8 3 6 2. <_> 13 14 3 6 2. <_> <_> 1 8 6 12 -1. <_> 1 8 3 6 2. <_> 4 14 3 6 2. <_> <_> 10 0 6 10 -1. <_> 12 0 2 10 3. <_> <_> 5 11 8 4 -1. <_> 5 11 4 2 2. <_> 9 13 4 2 2. <_> <_> 10 16 8 4 -1. <_> 14 16 4 2 2. <_> 10 18 4 2 2. <_> <_> 7 7 6 6 -1. <_> 9 7 2 6 3. <_> <_> 10 2 4 10 -1. <_> 10 2 2 10 2. <_> <_> 6 1 4 9 -1. <_> 8 1 2 9 2. <_> <_> 12 19 2 1 -1. <_> 12 19 1 1 2. <_> <_> 1 2 4 9 -1. <_> 3 2 2 9 2. <_> <_> 7 5 6 4 -1. <_> 9 5 2 4 3. <_> <_> 9 4 2 4 -1. <_> 9 6 2 2 2. <_> <_> 14 5 2 8 -1. <_> 14 9 2 4 2. <_> <_> 7 6 5 12 -1. <_> 7 12 5 6 2. <_> <_> 14 6 2 6 -1. <_> 14 9 2 3 2. <_> <_> 4 6 2 6 -1. <_> 4 9 2 3 2. <_> <_> 8 15 10 4 -1. <_> 13 15 5 2 2. <_> 8 17 5 2 2. <_> <_> 6 18 2 2 -1. <_> 7 18 1 2 2. <_> <_> 11 3 6 2 -1. <_> 11 4 6 1 2. <_> <_> 2 0 16 6 -1. <_> 2 2 16 2 3. <_> <_> 11 3 6 2 -1. <_> 11 4 6 1 2. <_> <_> 4 11 10 3 -1. <_> 4 12 10 1 3. <_> <_> 11 3 6 2 -1. <_> 11 4 6 1 2. <_> <_> 3 3 6 2 -1. <_> 3 4 6 1 2. <_> <_> 16 0 4 7 -1. <_> 16 0 2 7 2. <_> <_> 0 14 9 6 -1. <_> 0 16 9 2 3. <_> <_> 9 16 3 3 -1. <_> 9 17 3 1 3. <_> <_> 4 6 6 2 -1. <_> 6 6 2 2 3. <_> <_> 15 11 1 3 -1. <_> 15 12 1 1 3. <_> <_> 5 5 2 3 -1. <_> 5 6 2 1 3. <_> <_> 10 9 2 2 -1. <_> 10 10 2 1 2. <_> <_> 3 1 4 3 -1. <_> 5 1 2 3 2. <_> <_> 16 0 4 7 -1. <_> 16 0 2 7 2. <_> <_> 0 0 20 1 -1. <_> 10 0 10 1 2. <_> <_> 15 11 1 3 -1. <_> 15 12 1 1 3. <_> <_> 0 4 3 4 -1. <_> 1 4 1 4 3. <_> <_> 16 3 3 6 -1. <_> 16 5 3 2 3. <_> <_> 1 3 3 6 -1. <_> 1 5 3 2 3. <_> <_> 6 2 12 6 -1. <_> 12 2 6 3 2. <_> 6 5 6 3 2. <_> <_> 8 10 4 3 -1. <_> 8 11 4 1 3. <_> <_> 4 2 14 6 -1. <_> 11 2 7 3 2. <_> 4 5 7 3 2. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 15 13 2 3 -1. <_> 15 14 2 1 3. <_> <_> 8 12 4 3 -1. <_> 8 13 4 1 3. <_> <_> 15 11 1 3 -1. <_> 15 12 1 1 3. <_> <_> 7 13 5 2 -1. <_> 7 14 5 1 2. <_> <_> 7 12 6 3 -1. <_> 7 13 6 1 3. <_> <_> 5 11 4 4 -1. <_> 5 13 4 2 2. <_> <_> 11 4 3 3 -1. <_> 12 4 1 3 3. <_> <_> 6 4 3 3 -1. <_> 7 4 1 3 3. <_> <_> 16 5 3 6 -1. <_> 17 5 1 6 3. <_> <_> 3 6 12 7 -1. <_> 7 6 4 7 3. <_> <_> 16 5 3 6 -1. <_> 17 5 1 6 3. <_> <_> 3 13 2 3 -1. <_> 3 14 2 1 3. <_> <_> 16 5 3 6 -1. <_> 17 5 1 6 3. <_> <_> 1 5 3 6 -1. <_> 2 5 1 6 3. <_> <_> 1 9 18 1 -1. <_> 7 9 6 1 3. <_> <_> 0 9 8 7 -1. <_> 4 9 4 7 2. <_> <_> 12 11 8 2 -1. <_> 12 12 8 1 2. <_> <_> 0 11 8 2 -1. <_> 0 12 8 1 2. <_> <_> 9 13 2 3 -1. <_> 9 14 2 1 3. <_> <_> 4 10 12 4 -1. <_> 4 10 6 2 2. <_> 10 12 6 2 2. <_> <_> 9 3 3 7 -1. <_> 10 3 1 7 3. <_> <_> 7 2 3 5 -1. <_> 8 2 1 5 3. <_> <_> 9 12 4 6 -1. <_> 11 12 2 3 2. <_> 9 15 2 3 2. <_> <_> 8 7 3 6 -1. <_> 9 7 1 6 3. <_> <_> 15 4 4 2 -1. <_> 15 5 4 1 2. <_> <_> 8 7 3 3 -1. <_> 9 7 1 3 3. <_> <_> 14 2 6 4 -1. <_> 14 4 6 2 2. <_> <_> 7 16 6 1 -1. <_> 9 16 2 1 3. <_> <_> 15 13 2 3 -1. <_> 15 14 2 1 3. <_> <_> 8 7 3 10 -1. <_> 9 7 1 10 3. <_> <_> 11 10 2 6 -1. <_> 11 12 2 2 3. <_> <_> 6 10 4 1 -1. <_> 8 10 2 1 2. <_> <_> 10 9 2 2 -1. <_> 10 10 2 1 2. <_> <_> 8 9 2 2 -1. <_> 8 10 2 1 2. <_> <_> 12 7 2 2 -1. <_> 13 7 1 1 2. <_> 12 8 1 1 2. <_> <_> 5 7 2 2 -1. <_> 5 7 1 1 2. <_> 6 8 1 1 2. <_> <_> 13 0 3 14 -1. <_> 14 0 1 14 3. <_> <_> 4 0 3 14 -1. <_> 5 0 1 14 3. <_> <_> 13 4 3 14 -1. <_> 14 4 1 14 3. <_> <_> 9 14 2 3 -1. <_> 9 15 2 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 4 2 3 16 -1. <_> 5 2 1 16 3. <_> <_> 7 2 8 10 -1. <_> 7 7 8 5 2. <_> <_> 6 14 7 3 -1. <_> 6 15 7 1 3. <_> <_> 9 2 10 12 -1. <_> 14 2 5 6 2. <_> 9 8 5 6 2. <_> <_> 6 7 8 2 -1. <_> 6 8 8 1 2. <_> <_> 8 13 4 6 -1. <_> 8 16 4 3 2. <_> <_> 6 6 1 3 -1. <_> 6 7 1 1 3. <_> <_> 16 2 4 6 -1. <_> 16 4 4 2 3. <_> <_> 6 6 4 2 -1. <_> 6 6 2 1 2. <_> 8 7 2 1 2. <_> <_> 16 2 4 6 -1. <_> 16 4 4 2 3. <_> <_> 0 2 4 6 -1. <_> 0 4 4 2 3. <_> <_> 9 6 2 6 -1. <_> 9 6 1 6 2. <_> <_> 3 4 6 10 -1. <_> 3 9 6 5 2. <_> <_> 9 5 2 6 -1. <_> 9 5 1 6 2. <_> <_> 3 13 2 3 -1. <_> 3 14 2 1 3. <_> <_> 13 13 3 2 -1. <_> 13 14 3 1 2. <_> <_> 2 16 10 4 -1. <_> 2 16 5 2 2. <_> 7 18 5 2 2. <_> <_> 5 6 10 6 -1. <_> 10 6 5 3 2. <_> 5 9 5 3 2. <_> <_> 7 14 1 3 -1. <_> 7 15 1 1 3. <_> <_> 14 16 6 3 -1. <_> 14 17 6 1 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 7 4 10 3 -1. <_> 7 5 10 1 3. <_> <_> 0 4 5 4 -1. <_> 0 6 5 2 2. <_> <_> 13 11 3 9 -1. <_> 13 14 3 3 3. <_> <_> 4 11 3 9 -1. <_> 4 14 3 3 3. <_> <_> 9 7 2 1 -1. <_> 9 7 1 1 2. <_> <_> 5 0 6 17 -1. <_> 7 0 2 17 3. <_> <_> 10 3 6 3 -1. <_> 10 3 3 3 2. <_> <_> 2 2 15 4 -1. <_> 7 2 5 4 3. <_> <_> 8 2 8 2 -1. <_> 12 2 4 1 2. <_> 8 3 4 1 2. <_> <_> 8 1 3 6 -1. <_> 8 3 3 2 3. <_> <_> 9 17 2 2 -1. <_> 9 18 2 1 2. <_> <_> 0 0 2 14 -1. <_> 1 0 1 14 2. <_> <_> 12 0 7 3 -1. <_> 12 1 7 1 3. <_> <_> 1 14 1 2 -1. <_> 1 15 1 1 2. <_> <_> 14 12 2 8 -1. <_> 15 12 1 4 2. <_> 14 16 1 4 2. <_> <_> 1 0 7 3 -1. <_> 1 1 7 1 3. <_> <_> 14 12 2 8 -1. <_> 15 12 1 4 2. <_> 14 16 1 4 2. <_> <_> 6 0 8 12 -1. <_> 6 0 4 6 2. <_> 10 6 4 6 2. <_> <_> 6 1 8 9 -1. <_> 6 4 8 3 3. <_> <_> 5 2 2 2 -1. <_> 5 3 2 1 2. <_> <_> 13 14 6 6 -1. <_> 16 14 3 3 2. <_> 13 17 3 3 2. <_> <_> 0 17 20 2 -1. <_> 0 17 10 1 2. <_> 10 18 10 1 2. <_> <_> 10 3 2 6 -1. <_> 11 3 1 3 2. <_> 10 6 1 3 2. <_> <_> 5 12 6 2 -1. <_> 8 12 3 2 2. <_> <_> 10 7 6 13 -1. <_> 10 7 3 13 2. <_> <_> 5 15 10 5 -1. <_> 10 15 5 5 2. <_> <_> 10 4 4 10 -1. <_> 10 4 2 10 2. <_> <_> 5 7 2 1 -1. <_> 6 7 1 1 2. <_> <_> 10 3 6 7 -1. <_> 10 3 3 7 2. <_> <_> 4 3 6 7 -1. <_> 7 3 3 7 2. <_> <_> 1 7 18 5 -1. <_> 7 7 6 5 3. <_> <_> 3 17 4 3 -1. <_> 5 17 2 3 2. <_> <_> 8 14 12 6 -1. <_> 14 14 6 3 2. <_> 8 17 6 3 2. <_> <_> 0 13 20 4 -1. <_> 0 13 10 2 2. <_> 10 15 10 2 2. <_> <_> 4 5 14 2 -1. <_> 11 5 7 1 2. <_> 4 6 7 1 2. <_> <_> 1 2 10 12 -1. <_> 1 2 5 6 2. <_> 6 8 5 6 2. <_> <_> 6 1 14 3 -1. <_> 6 2 14 1 3. <_> <_> 8 16 2 3 -1. <_> 8 17 2 1 3. <_> <_> 9 17 3 2 -1. <_> 10 17 1 2 3. <_> <_> 5 15 4 2 -1. <_> 5 15 2 1 2. <_> 7 16 2 1 2. <_> <_> 10 15 1 3 -1. <_> 10 16 1 1 3. <_> <_> 8 16 4 4 -1. <_> 8 16 2 2 2. <_> 10 18 2 2 2. <_> <_> 6 11 8 6 -1. <_> 6 14 8 3 2. <_> <_> 2 13 5 2 -1. <_> 2 14 5 1 2. <_> <_> 13 14 6 6 -1. <_> 16 14 3 3 2. <_> 13 17 3 3 2. <_> <_> 1 9 18 4 -1. <_> 7 9 6 4 3. <_> <_> 13 14 6 6 -1. <_> 16 14 3 3 2. <_> 13 17 3 3 2. <_> <_> 0 2 1 6 -1. <_> 0 4 1 2 3. <_> <_> 5 0 15 20 -1. <_> 5 10 15 10 2. <_> <_> 1 14 6 6 -1. <_> 1 14 3 3 2. <_> 4 17 3 3 2. <_> <_> 8 14 4 6 -1. <_> 10 14 2 3 2. <_> 8 17 2 3 2. <_> <_> 7 11 2 1 -1. <_> 8 11 1 1 2. <_> <_> 9 17 3 2 -1. <_> 10 17 1 2 3. <_> <_> 8 17 3 2 -1. <_> 9 17 1 2 3. <_> <_> 12 14 4 6 -1. <_> 14 14 2 3 2. <_> 12 17 2 3 2. <_> <_> 4 14 4 6 -1. <_> 4 14 2 3 2. <_> 6 17 2 3 2. <_> <_> 13 14 2 6 -1. <_> 14 14 1 3 2. <_> 13 17 1 3 2. <_> <_> 5 14 2 6 -1. <_> 5 14 1 3 2. <_> 6 17 1 3 2. <_> <_> 7 0 6 12 -1. <_> 7 4 6 4 3. <_> <_> 0 7 12 2 -1. <_> 4 7 4 2 3. <_> <_> 10 3 3 13 -1. <_> 11 3 1 13 3. <_> <_> 7 3 3 13 -1. <_> 8 3 1 13 3. <_> <_> 10 8 6 3 -1. <_> 10 9 6 1 3. <_> <_> 3 11 3 2 -1. <_> 4 11 1 2 3. <_> <_> 13 12 6 8 -1. <_> 16 12 3 4 2. <_> 13 16 3 4 2. <_> <_> 7 6 6 5 -1. <_> 9 6 2 5 3. <_> <_> 17 11 2 7 -1. <_> 17 11 1 7 2. <_> <_> 3 13 8 2 -1. <_> 7 13 4 2 2. <_> <_> 6 9 8 3 -1. <_> 6 10 8 1 3. <_> <_> 4 3 4 3 -1. <_> 4 4 4 1 3. <_> <_> 11 3 4 3 -1. <_> 11 4 4 1 3. <_> <_> 1 4 17 12 -1. <_> 1 8 17 4 3. <_> <_> 11 3 4 3 -1. <_> 11 4 4 1 3. <_> <_> 4 8 6 3 -1. <_> 4 9 6 1 3. <_> <_> 12 3 5 3 -1. <_> 12 4 5 1 3. <_> <_> 1 11 2 7 -1. <_> 2 11 1 7 2. <_> <_> 15 12 2 8 -1. <_> 16 12 1 4 2. <_> 15 16 1 4 2. <_> <_> 4 8 11 3 -1. <_> 4 9 11 1 3. <_> <_> 9 13 6 2 -1. <_> 12 13 3 1 2. <_> 9 14 3 1 2. <_> <_> 6 13 4 3 -1. <_> 6 14 4 1 3. <_> <_> 9 12 3 3 -1. <_> 10 12 1 3 3. <_> <_> 5 3 3 3 -1. <_> 5 4 3 1 3. <_> <_> 9 4 2 3 -1. <_> 9 5 2 1 3. <_> <_> 0 2 16 3 -1. <_> 0 3 16 1 3. <_> <_> 15 12 2 8 -1. <_> 16 12 1 4 2. <_> 15 16 1 4 2. <_> <_> 3 12 2 8 -1. <_> 3 12 1 4 2. <_> 4 16 1 4 2. <_> <_> 14 13 3 6 -1. <_> 14 15 3 2 3. <_> <_> 3 13 3 6 -1. <_> 3 15 3 2 3. <_> <_> 6 5 10 2 -1. <_> 11 5 5 1 2. <_> 6 6 5 1 2. <_> <_> 2 14 14 6 -1. <_> 2 17 14 3 2. <_> <_> 10 14 1 3 -1. <_> 10 15 1 1 3. <_> <_> 4 16 2 2 -1. <_> 4 16 1 1 2. <_> 5 17 1 1 2. <_> <_> 10 6 2 3 -1. <_> 10 7 2 1 3. <_> <_> 0 17 20 2 -1. <_> 0 17 10 1 2. <_> 10 18 10 1 2. <_> <_> 13 6 1 3 -1. <_> 13 7 1 1 3. <_> <_> 8 13 3 2 -1. <_> 9 13 1 2 3. <_> <_> 12 2 3 3 -1. <_> 13 2 1 3 3. <_> <_> 3 18 2 2 -1. <_> 3 18 1 1 2. <_> 4 19 1 1 2. <_> <_> 9 16 3 4 -1. <_> 10 16 1 4 3. <_> <_> 6 6 1 3 -1. <_> 6 7 1 1 3. <_> <_> 13 1 5 2 -1. <_> 13 2 5 1 2. <_> <_> 7 14 6 2 -1. <_> 7 14 3 1 2. <_> 10 15 3 1 2. <_> <_> 11 3 3 4 -1. <_> 12 3 1 4 3. <_> <_> 1 13 12 6 -1. <_> 5 13 4 6 3. <_> <_> 14 11 5 2 -1. <_> 14 12 5 1 2. <_> <_> 2 15 14 4 -1. <_> 2 15 7 2 2. <_> 9 17 7 2 2. <_> <_> 3 7 14 2 -1. <_> 10 7 7 1 2. <_> 3 8 7 1 2. <_> <_> 1 11 4 2 -1. <_> 1 12 4 1 2. <_> <_> 14 0 6 14 -1. <_> 16 0 2 14 3. <_> <_> 4 11 1 3 -1. <_> 4 12 1 1 3. <_> <_> 14 0 6 14 -1. <_> 16 0 2 14 3. <_> <_> 1 10 3 7 -1. <_> 2 10 1 7 3. <_> <_> 8 12 9 2 -1. <_> 8 13 9 1 2. <_> <_> 0 6 20 1 -1. <_> 10 6 10 1 2. <_> <_> 8 4 4 4 -1. <_> 8 4 2 4 2. <_> <_> 0 0 2 2 -1. <_> 0 1 2 1 2. <_> <_> 5 3 10 9 -1. <_> 5 6 10 3 3. <_> <_> 15 2 4 10 -1. <_> 15 2 2 10 2. <_> <_> 8 2 2 7 -1. <_> 9 2 1 7 2. <_> <_> 7 4 12 1 -1. <_> 11 4 4 1 3. <_> <_> 3 4 9 1 -1. <_> 6 4 3 1 3. <_> <_> 15 10 1 4 -1. <_> 15 12 1 2 2. <_> <_> 4 10 6 4 -1. <_> 7 10 3 4 2. <_> <_> 15 9 1 6 -1. <_> 15 12 1 3 2. <_> <_> 7 17 6 3 -1. <_> 7 18 6 1 3. <_> <_> 14 3 2 16 -1. <_> 15 3 1 8 2. <_> 14 11 1 8 2. <_> <_> 4 9 1 6 -1. <_> 4 12 1 3 2. <_> <_> 12 1 5 2 -1. <_> 12 2 5 1 2. <_> <_> 6 18 4 2 -1. <_> 6 18 2 1 2. <_> 8 19 2 1 2. <_> <_> 2 4 16 10 -1. <_> 10 4 8 5 2. <_> 2 9 8 5 2. <_> <_> 6 5 1 10 -1. <_> 6 10 1 5 2. <_> <_> 4 8 15 2 -1. <_> 9 8 5 2 3. <_> <_> 1 8 15 2 -1. <_> 6 8 5 2 3. <_> <_> 9 5 3 6 -1. <_> 9 7 3 2 3. <_> <_> 5 7 8 2 -1. <_> 9 7 4 2 2. <_> <_> 9 11 2 3 -1. <_> 9 12 2 1 3. <_> <_> 1 0 16 3 -1. <_> 1 1 16 1 3. <_> <_> 11 2 7 2 -1. <_> 11 3 7 1 2. <_> <_> 5 1 10 18 -1. <_> 5 7 10 6 3. <_> <_> 17 4 3 2 -1. <_> 18 4 1 2 3. <_> <_> 8 13 1 3 -1. <_> 8 14 1 1 3. <_> <_> 3 14 14 6 -1. <_> 3 16 14 2 3. <_> <_> 0 2 3 4 -1. <_> 1 2 1 4 3. <_> <_> 12 1 5 2 -1. <_> 12 2 5 1 2. <_> <_> 3 1 5 2 -1. <_> 3 2 5 1 2. <_> <_> 10 13 2 3 -1. <_> 10 14 2 1 3. <_> <_> 8 13 2 3 -1. <_> 8 14 2 1 3. <_> <_> 14 12 2 3 -1. <_> 14 13 2 1 3. <_> <_> 7 2 2 3 -1. <_> 7 3 2 1 3. <_> <_> 5 6 10 4 -1. <_> 10 6 5 2 2. <_> 5 8 5 2 2. <_> <_> 9 13 1 6 -1. <_> 9 16 1 3 2. <_> <_> 10 12 2 2 -1. <_> 11 12 1 1 2. <_> 10 13 1 1 2. <_> <_> 4 12 2 3 -1. <_> 4 13 2 1 3. <_> <_> 14 4 6 6 -1. <_> 14 6 6 2 3. <_> <_> 8 17 2 3 -1. <_> 8 18 2 1 3. <_> <_> 16 4 4 6 -1. <_> 16 6 4 2 3. <_> <_> 0 4 4 6 -1. <_> 0 6 4 2 3. <_> <_> 14 6 2 3 -1. <_> 14 6 1 3 2. <_> <_> 4 9 8 1 -1. <_> 8 9 4 1 2. <_> <_> 8 12 4 3 -1. <_> 8 13 4 1 3. <_> <_> 5 12 10 6 -1. <_> 5 14 10 2 3. <_> <_> 11 12 1 2 -1. <_> 11 13 1 1 2. <_> <_> 8 15 4 2 -1. <_> 8 16 4 1 2. <_> <_> 6 9 8 8 -1. <_> 10 9 4 4 2. <_> 6 13 4 4 2. <_> <_> 7 12 4 6 -1. <_> 7 12 2 3 2. <_> 9 15 2 3 2. <_> <_> 10 11 3 1 -1. <_> 11 11 1 1 3. <_> <_> 9 7 2 10 -1. <_> 9 7 1 5 2. <_> 10 12 1 5 2. <_> <_> 8 0 6 6 -1. <_> 10 0 2 6 3. <_> <_> 3 11 2 6 -1. <_> 3 13 2 2 3. <_> <_> 16 12 1 2 -1. <_> 16 13 1 1 2. <_> <_> 1 14 6 6 -1. <_> 1 14 3 3 2. <_> 4 17 3 3 2. <_> <_> 13 1 3 6 -1. <_> 14 1 1 6 3. <_> <_> 8 8 2 2 -1. <_> 8 9 2 1 2. <_> <_> 9 9 3 3 -1. <_> 10 9 1 3 3. <_> <_> 8 7 3 3 -1. <_> 8 8 3 1 3. <_> <_> 14 0 2 3 -1. <_> 14 0 1 3 2. <_> <_> 1 0 18 9 -1. <_> 7 0 6 9 3. <_> <_> 11 5 4 15 -1. <_> 11 5 2 15 2. <_> <_> 5 5 4 15 -1. <_> 7 5 2 15 2. <_> <_> 14 0 2 3 -1. <_> 14 0 1 3 2. <_> <_> 4 0 2 3 -1. <_> 5 0 1 3 2. <_> <_> 11 12 2 2 -1. <_> 12 12 1 1 2. <_> 11 13 1 1 2. <_> <_> 7 12 2 2 -1. <_> 7 12 1 1 2. <_> 8 13 1 1 2. <_> <_> 12 0 3 4 -1. <_> 13 0 1 4 3. <_> <_> 4 11 3 3 -1. <_> 4 12 3 1 3. <_> <_> 12 7 4 2 -1. <_> 12 8 4 1 2. <_> <_> 8 10 3 2 -1. <_> 9 10 1 2 3. <_> <_> 9 9 3 2 -1. <_> 10 9 1 2 3. <_> <_> 8 9 3 2 -1. <_> 9 9 1 2 3. <_> <_> 12 0 3 4 -1. <_> 13 0 1 4 3. <_> <_> 5 0 3 4 -1. <_> 6 0 1 4 3. <_> <_> 4 14 12 4 -1. <_> 10 14 6 2 2. <_> 4 16 6 2 2. <_> <_> 8 13 2 3 -1. <_> 8 14 2 1 3. <_> <_> 10 10 3 8 -1. <_> 10 14 3 4 2. <_> <_> 8 10 4 8 -1. <_> 8 10 2 4 2. <_> 10 14 2 4 2. <_> <_> 10 8 3 1 -1. <_> 11 8 1 1 3. <_> <_> 9 12 1 6 -1. <_> 9 15 1 3 2. <_> <_> 10 8 3 1 -1. <_> 11 8 1 1 3. <_> <_> 7 8 3 1 -1. <_> 8 8 1 1 3. <_> <_> 5 2 15 14 -1. <_> 5 9 15 7 2. <_> <_> 2 1 2 10 -1. <_> 2 1 1 5 2. <_> 3 6 1 5 2. <_> <_> 14 14 2 3 -1. <_> 14 15 2 1 3. <_> <_> 2 7 3 3 -1. <_> 3 7 1 3 3. <_> <_> 17 4 3 3 -1. <_> 17 5 3 1 3. <_> <_> 0 4 3 3 -1. <_> 0 5 3 1 3. <_> <_> 13 5 6 2 -1. <_> 16 5 3 1 2. <_> 13 6 3 1 2. <_> <_> 4 19 12 1 -1. <_> 8 19 4 1 3. <_> <_> 12 12 2 4 -1. <_> 12 14 2 2 2. <_> <_> 3 15 1 3 -1. <_> 3 16 1 1 3. <_> <_> 11 16 6 4 -1. <_> 11 16 3 4 2. <_> <_> 2 10 3 10 -1. <_> 3 10 1 10 3. <_> <_> 12 8 2 4 -1. <_> 12 8 1 4 2. <_> <_> 6 8 2 4 -1. <_> 7 8 1 4 2. <_> <_> 10 14 2 3 -1. <_> 10 14 1 3 2. <_> <_> 5 1 10 3 -1. <_> 10 1 5 3 2. <_> <_> 10 7 3 2 -1. <_> 11 7 1 2 3. <_> <_> 5 6 9 2 -1. <_> 8 6 3 2 3. <_> <_> 9 8 2 2 -1. <_> 9 9 2 1 2. <_> <_> 2 11 16 6 -1. <_> 2 11 8 3 2. <_> 10 14 8 3 2. <_> <_> 12 7 2 2 -1. <_> 13 7 1 1 2. <_> 12 8 1 1 2. <_> <_> 9 5 2 3 -1. <_> 9 6 2 1 3. <_> <_> 9 7 3 2 -1. <_> 10 7 1 2 3. <_> <_> 5 1 8 12 -1. <_> 5 7 8 6 2. <_> <_> 13 5 2 2 -1. <_> 13 6 2 1 2. <_> <_> 5 5 2 2 -1. <_> 5 6 2 1 2. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 4 14 2 3 -1. <_> 4 15 2 1 3. <_> <_> 12 4 3 3 -1. <_> 12 5 3 1 3. <_> <_> 5 4 3 3 -1. <_> 5 5 3 1 3. <_> <_> 9 14 2 6 -1. <_> 10 14 1 3 2. <_> 9 17 1 3 2. <_> <_> 8 14 3 2 -1. <_> 9 14 1 2 3. <_> <_> 9 5 6 6 -1. <_> 11 5 2 6 3. <_> <_> 5 5 6 6 -1. <_> 7 5 2 6 3. <_> <_> 13 13 1 2 -1. <_> 13 14 1 1 2. <_> <_> 0 2 10 2 -1. <_> 0 3 10 1 2. <_> <_> 13 13 1 2 -1. <_> 13 14 1 1 2. <_> <_> 5 7 2 2 -1. <_> 5 7 1 1 2. <_> 6 8 1 1 2. <_> <_> 13 5 2 7 -1. <_> 13 5 1 7 2. <_> <_> 6 13 1 2 -1. <_> 6 14 1 1 2. <_> <_> 11 0 3 7 -1. <_> 12 0 1 7 3. <_> <_> 0 3 2 16 -1. <_> 0 3 1 8 2. <_> 1 11 1 8 2. <_> <_> 11 0 3 7 -1. <_> 12 0 1 7 3. <_> <_> 6 0 3 7 -1. <_> 7 0 1 7 3. <_> <_> 11 16 8 4 -1. <_> 11 16 4 4 2. <_> <_> 1 16 8 4 -1. <_> 5 16 4 4 2. <_> <_> 13 5 2 7 -1. <_> 13 5 1 7 2. <_> <_> 5 5 2 7 -1. <_> 6 5 1 7 2. <_> <_> 18 6 2 14 -1. <_> 18 13 2 7 2. <_> <_> 6 10 3 4 -1. <_> 6 12 3 2 2. <_> <_> 14 7 1 2 -1. <_> 14 8 1 1 2. <_> <_> 0 1 18 6 -1. <_> 0 1 9 3 2. <_> 9 4 9 3 2. <_> <_> 14 7 1 2 -1. <_> 14 8 1 1 2. <_> <_> 0 6 2 14 -1. <_> 0 13 2 7 2. <_> <_> 17 0 3 12 -1. <_> 18 0 1 12 3. <_> <_> 0 6 18 3 -1. <_> 0 7 18 1 3. <_> <_> 6 0 14 16 -1. <_> 6 8 14 8 2. <_> <_> 0 0 3 12 -1. <_> 1 0 1 12 3. <_> <_> 13 0 3 7 -1. <_> 14 0 1 7 3. <_> <_> 5 7 1 2 -1. <_> 5 8 1 1 2. <_> <_> 14 4 6 6 -1. <_> 14 6 6 2 3. <_> <_> 5 7 7 2 -1. <_> 5 8 7 1 2. <_> <_> 8 6 6 9 -1. <_> 8 9 6 3 3. <_> <_> 5 4 6 1 -1. <_> 7 4 2 1 3. <_> <_> 13 0 6 4 -1. <_> 16 0 3 2 2. <_> 13 2 3 2 2. <_> <_> 1 2 18 12 -1. <_> 1 6 18 4 3. <_> <_> 3 2 17 12 -1. <_> 3 6 17 4 3. <_> <_> 5 14 7 3 -1. <_> 5 15 7 1 3. <_> <_> 10 14 1 3 -1. <_> 10 15 1 1 3. <_> <_> 3 14 3 3 -1. <_> 3 15 3 1 3. <_> <_> 14 4 6 6 -1. <_> 14 6 6 2 3. <_> <_> 0 4 6 6 -1. <_> 0 6 6 2 3. <_> <_> 12 5 4 3 -1. <_> 12 6 4 1 3. <_> <_> 4 5 4 3 -1. <_> 4 6 4 1 3. <_> <_> 18 0 2 6 -1. <_> 18 2 2 2 3. <_> <_> 8 1 4 9 -1. <_> 10 1 2 9 2. <_> <_> 6 6 8 2 -1. <_> 6 6 4 2 2. <_> <_> 6 5 4 2 -1. <_> 6 5 2 1 2. <_> 8 6 2 1 2. <_> <_> 10 5 2 3 -1. <_> 10 6 2 1 3. <_> <_> 9 5 1 3 -1. <_> 9 6 1 1 3. <_> <_> 9 10 2 2 -1. <_> 9 11 2 1 2. <_> <_> 0 8 4 3 -1. <_> 0 9 4 1 3. <_> <_> 6 0 8 6 -1. <_> 6 3 8 3 2. <_> <_> 1 0 6 4 -1. <_> 1 0 3 2 2. <_> 4 2 3 2 2. <_> <_> 13 0 3 7 -1. <_> 14 0 1 7 3. <_> <_> 9 16 2 2 -1. <_> 9 17 2 1 2. <_> <_> 11 4 6 10 -1. <_> 11 9 6 5 2. <_> <_> 0 10 19 2 -1. <_> 0 11 19 1 2. <_> <_> 9 5 8 9 -1. <_> 9 8 8 3 3. <_> <_> 4 0 3 7 -1. <_> 5 0 1 7 3. <_> <_> 8 6 4 12 -1. <_> 10 6 2 6 2. <_> 8 12 2 6 2. <_> <_> 0 2 6 4 -1. <_> 0 4 6 2 2. <_> <_> 8 15 4 3 -1. <_> 8 16 4 1 3. <_> <_> 8 0 3 7 -1. <_> 9 0 1 7 3. <_> <_> 9 5 3 4 -1. <_> 10 5 1 4 3. <_> <_> 8 5 3 4 -1. <_> 9 5 1 4 3. <_> <_> 7 6 6 1 -1. <_> 9 6 2 1 3. <_> <_> 7 14 4 4 -1. <_> 7 14 2 2 2. <_> 9 16 2 2 2. <_> <_> 13 14 4 6 -1. <_> 15 14 2 3 2. <_> 13 17 2 3 2. <_> <_> 7 8 1 8 -1. <_> 7 12 1 4 2. <_> <_> 16 0 2 8 -1. <_> 17 0 1 4 2. <_> 16 4 1 4 2. <_> <_> 2 0 2 8 -1. <_> 2 0 1 4 2. <_> 3 4 1 4 2. <_> <_> 6 1 14 3 -1. <_> 6 2 14 1 3. <_> <_> 7 9 3 10 -1. <_> 7 14 3 5 2. <_> <_> 9 14 2 2 -1. <_> 9 15 2 1 2. <_> <_> 7 7 6 8 -1. <_> 7 11 6 4 2. <_> <_> 9 7 3 6 -1. <_> 9 10 3 3 2. <_> <_> 7 13 3 3 -1. <_> 7 14 3 1 3. <_> <_> 9 9 2 2 -1. <_> 9 10 2 1 2. <_> <_> 0 1 18 2 -1. <_> 6 1 6 2 3. <_> <_> 7 1 6 14 -1. <_> 7 8 6 7 2. <_> <_> 1 9 18 1 -1. <_> 7 9 6 1 3. <_> <_> 9 7 2 2 -1. <_> 9 7 1 2 2. <_> <_> 9 3 2 9 -1. <_> 10 3 1 9 2. <_> <_> 18 14 2 3 -1. <_> 18 15 2 1 3. <_> <_> 7 11 3 1 -1. <_> 8 11 1 1 3. <_> <_> 10 8 3 4 -1. <_> 11 8 1 4 3. <_> <_> 7 14 3 6 -1. <_> 8 14 1 6 3. <_> <_> 10 8 3 4 -1. <_> 11 8 1 4 3. <_> <_> 7 8 3 4 -1. <_> 8 8 1 4 3. <_> <_> 7 9 6 9 -1. <_> 7 12 6 3 3. <_> <_> 0 14 2 3 -1. <_> 0 15 2 1 3. <_> <_> 11 12 1 2 -1. <_> 11 13 1 1 2. <_> <_> 4 3 8 3 -1. <_> 8 3 4 3 2. <_> <_> 0 4 20 6 -1. <_> 0 4 10 6 2. <_> <_> 9 14 1 3 -1. <_> 9 15 1 1 3. <_> <_> 8 14 4 3 -1. <_> 8 15 4 1 3. <_> <_> 0 15 14 4 -1. <_> 0 17 14 2 2. <_> <_> 1 14 18 6 -1. <_> 1 17 18 3 2. <_> <_> 0 0 10 6 -1. <_> 0 0 5 3 2. <_> 5 3 5 3 2. ================================================ FILE: OpenCVComponent/Assets/haarcascade_mouth.xml ================================================ 25 15 <_> <_> <_> <_> 0 0 14 9 -1. <_> 0 3 14 3 3. 0 -0.1192855015397072 0.7854182124137878 -0.4541360139846802 <_> <_> <_> 17 1 8 14 -1. <_> 17 8 8 7 2. 0 -0.0641647726297379 -0.7407680749893189 0.2652035951614380 <_> <_> <_> 7 3 11 6 -1. <_> 7 5 11 2 3. 0 0.0910761803388596 -0.2063370943069458 0.8400946259498596 <_> <_> <_> 5 2 15 6 -1. <_> 5 4 15 2 3. 0 -0.1129330024123192 0.8284121751785278 -0.1866362988948822 <_> <_> <_> 6 4 11 6 -1. <_> 6 6 11 2 3. 0 -0.0741933435201645 0.8354660272598267 -0.1527701020240784 <_> <_> <_> 17 1 6 3 -1. <_> 19 1 2 3 3. 0 2.1404659491963685e-005 -0.0716945603489876 0.1858334988355637 <_> <_> <_> 5 0 15 6 -1. <_> 5 2 15 2 3. 0 -0.0996975302696228 0.6870458126068115 -0.1721730977296829 <_> <_> <_> 7 3 13 6 -1. <_> 7 5 13 2 3. 0 -0.0900413617491722 0.7310237884521484 -0.1368771940469742 <_> <_> <_> 5 3 6 5 -1. <_> 8 3 3 5 2. 0 2.5138311320915818e-004 -0.3469826877117157 0.3647777140140533 <_> <_> <_> 21 14 4 1 -1. <_> 21 14 2 1 2. 0 1.6144449546118267e-005 -0.3085466027259827 0.2320024073123932 <_> <_> <_> 0 3 3 12 -1. <_> 0 7 3 4 3. 0 1.9363909814273939e-005 -0.3819856047630310 0.2404107004404068 <_> <_> <_> 22 10 3 4 -1. <_> 22 11 3 2 2. 0 6.9673648104071617e-003 0.0545878112316132 -0.7487065792083740 <_> <_> <_> 0 10 3 4 -1. <_> 0 11 3 2 2. 0 -4.7189309261739254e-003 -0.7476686835289002 0.1205869019031525 -1.4372119903564453 -1 -1 <_> <_> <_> <_> 5 0 15 8 -1. <_> 5 2 15 4 2. 0 -0.1006335020065308 0.7848083972930908 -0.3866829872131348 <_> <_> <_> 20 0 5 9 -1. <_> 20 3 5 3 3. 0 -0.0366767607629299 0.5453233718872070 -0.4012677967548370 <_> <_> <_> 6 2 13 4 -1. <_> 6 4 13 2 2. 0 0.0815562233328819 -0.1315398067235947 0.8084958195686340 <_> <_> <_> 7 2 15 6 -1. <_> 7 4 15 2 3. 0 -0.1064186021685600 0.6782389879226685 -0.2083356976509094 <_> <_> <_> 2 3 4 12 -1. <_> 2 9 4 6 2. 0 0.0156307406723499 -0.3749788105487824 0.3150509893894196 <_> <_> <_> 6 1 14 6 -1. <_> 6 3 14 2 3. 0 0.0711290463805199 -0.1557385027408600 0.7050542831420898 <_> <_> <_> 8 3 9 6 -1. <_> 8 5 9 2 3. 0 0.0736639127135277 -0.1547683030366898 0.6715884804725647 <_> <_> <_> 21 0 4 6 -1. <_> 21 3 4 3 2. 0 -1.0592950275167823e-004 0.1365388035774231 -0.2670182883739471 <_> <_> <_> 1 12 1 3 -1. <_> 1 13 1 1 3. 0 -1.9239520188421011e-003 -0.7261438965797424 0.1364576965570450 <_> <_> <_> 23 12 1 3 -1. <_> 23 13 1 1 3. 0 2.3057300131767988e-003 0.0706136971712112 -0.6423184275627136 <_> <_> <_> 1 12 1 3 -1. <_> 1 13 1 1 3. 0 1.8073299434036016e-003 0.1355642974376679 -0.7050786018371582 <_> <_> <_> 7 7 11 8 -1. <_> 7 9 11 4 2. 0 -0.0664333626627922 0.6158788204193115 -0.1400263011455536 <_> <_> <_> 8 4 9 6 -1. <_> 8 6 9 2 3. 0 -0.0689277201890945 0.6765924096107483 -0.1224988028407097 -1.5416599512100220 0 -1 <_> <_> <_> <_> 1 0 15 9 -1. <_> 1 3 15 3 3. 0 -0.1822655051946640 0.5961514711380005 -0.3195483088493347 <_> <_> <_> 9 0 11 15 -1. <_> 9 5 11 5 3. 0 0.2893281877040863 -0.0240151602774858 0.3762707114219666 <_> <_> <_> 0 8 3 4 -1. <_> 0 9 3 2 2. 0 -4.2456621304154396e-003 -0.7117397785186768 0.1214720010757446 <_> <_> <_> 7 9 12 6 -1. <_> 7 12 12 3 2. 0 0.0545681491494179 -0.1822118014097214 0.4597271978855133 <_> <_> <_> 0 5 2 6 -1. <_> 0 7 2 2 3. 0 -4.4434829615056515e-003 -0.5354676842689514 0.1655835956335068 <_> <_> <_> 14 0 2 11 -1. <_> 14 0 1 11 2. 0 -0.0204923897981644 -0.8770608901977539 -0.0151639897376299 <_> <_> <_> 0 9 2 6 -1. <_> 0 11 2 2 3. 0 -4.8007471486926079e-003 -0.5431423187255859 0.1356130987405777 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 0.1226660013198853 0.1124472022056580 -0.6574401855468750 <_> <_> <_> 0 0 3 4 -1. <_> 0 2 3 2 2. 0 -5.5254979088203982e-005 0.1536739021539688 -0.3841981887817383 <_> <_> <_> 7 3 14 6 -1. <_> 7 5 14 2 3. 0 -0.1131860986351967 0.4927195906639099 -0.1094276010990143 <_> <_> <_> 5 3 15 4 -1. <_> 5 5 15 2 2. 0 0.0792956873774529 -0.1647461056709290 0.4720517992973328 <_> <_> <_> 8 13 12 1 -1. <_> 12 13 4 1 3. 0 0.0148729300126433 0.0740143731236458 -0.5926275849342346 <_> <_> <_> 2 3 12 6 -1. <_> 8 3 6 6 2. 0 0.0538397915661335 -0.2111544013023377 0.3537890911102295 <_> <_> <_> 21 2 4 9 -1. <_> 21 2 2 9 2. 1 -0.0759592726826668 0.5931801795959473 -0.1090068966150284 <_> <_> <_> 6 2 13 6 -1. <_> 6 4 13 2 3. 0 0.1158166006207466 -0.0984905213117599 0.5940334796905518 <_> <_> <_> 5 3 15 2 -1. <_> 5 4 15 1 2. 0 -0.0160826407372952 0.3794195055961609 -0.1654051989316940 <_> <_> <_> 0 11 5 3 -1. <_> 0 12 5 1 3. 0 6.7254770547151566e-003 0.0937571078538895 -0.7060937881469727 <_> <_> <_> 14 0 11 14 -1. <_> 14 7 11 7 2. 0 -0.0611884109675884 -0.4381029903888702 0.0796229690313339 <_> <_> <_> 2 10 4 1 -1. <_> 3 11 2 1 2. 1 -5.5152038112282753e-003 -0.7019357085227966 0.0781789273023605 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 -0.1988534033298492 -0.6726130843162537 0.0560497716069222 <_> <_> <_> 0 4 6 6 -1. <_> 0 4 3 3 2. <_> 3 7 3 3 2. 0 0.0194473192095757 -0.1165110021829605 0.4151527881622315 <_> <_> <_> 23 9 1 4 -1. <_> 22 10 1 2 2. 1 -4.6706218272447586e-003 -0.6090158820152283 0.1049979999661446 <_> <_> <_> 2 9 4 1 -1. <_> 3 10 2 1 2. 1 4.0827528573572636e-003 0.0689968466758728 -0.5490871071815491 <_> <_> <_> 16 4 8 10 -1. <_> 20 4 4 5 2. <_> 16 9 4 5 2. 0 -0.0201979596167803 0.2884930074214935 -0.1804888993501663 <_> <_> <_> 8 7 9 6 -1. <_> 8 9 9 2 3. 0 0.0504430681467056 -0.0897706300020218 0.4609920978546143 <_> <_> <_> 11 12 4 3 -1. <_> 12 12 2 3 2. 0 -5.0139562226831913e-003 -0.4820869863033295 0.0588099807500839 <_> <_> <_> 0 0 3 3 -1. <_> 0 1 3 1 3. 0 8.5741933435201645e-003 0.0568646714091301 -0.5979083180427551 <_> <_> <_> 11 9 14 2 -1. <_> 11 9 7 2 2. 0 -0.0121624497696757 0.1446305960416794 -0.1168325990438461 <_> <_> <_> 9 13 4 1 -1. <_> 10 13 2 1 2. 0 -1.9329390488564968e-003 -0.5450860857963562 0.0609783902764320 -1.5324319601058960 1 -1 <_> <_> <_> <_> 0 0 8 6 -1. <_> 0 3 8 3 2. 0 -0.0320550985634327 0.4280030131340027 -0.4258942902088165 <_> <_> <_> 5 1 15 6 -1. <_> 5 3 15 2 3. 0 -0.1231034025549889 0.5121241807937622 -0.2055584937334061 <_> <_> <_> 0 7 4 3 -1. <_> 0 8 4 1 3. 0 -5.8588259853422642e-003 -0.7101820707321167 0.1075906008481979 <_> <_> <_> 3 3 20 6 -1. <_> 8 3 10 6 2. 0 0.0977141335606575 -0.1477957963943481 0.4571174979209900 <_> <_> <_> 0 6 24 5 -1. <_> 6 6 12 5 2. 0 -0.0527394600212574 0.3743767142295837 -0.2183827012777329 <_> <_> <_> 8 5 9 6 -1. <_> 8 7 9 2 3. 0 0.0584189109504223 -0.1386294066905975 0.4993282854557037 <_> <_> <_> 5 2 14 4 -1. <_> 5 4 14 2 2. 0 0.0887569189071655 -0.1315895020961762 0.6216561794281006 <_> <_> <_> 22 8 3 6 -1. <_> 22 10 3 2 3. 0 0.0145876696333289 0.0915696695446968 -0.5815675258636475 <_> <_> <_> 3 9 18 2 -1. <_> 3 9 9 1 2. <_> 12 10 9 1 2. 0 0.1044600009918213 5.2740359678864479e-003 -5.6644519531250000e+004 <_> <_> <_> 22 8 3 6 -1. <_> 22 10 3 2 3. 0 -8.4322784096002579e-003 -0.4866046011447907 0.0979617610573769 <_> <_> <_> 0 0 24 6 -1. <_> 0 0 12 3 2. <_> 12 3 12 3 2. 0 0.0406559295952320 0.1391579061746597 -0.3656015992164612 <_> <_> <_> 14 11 4 4 -1. <_> 15 11 2 4 2. 0 6.3366899266839027e-003 0.0641745477914810 -0.6245471239089966 <_> <_> <_> 5 5 15 2 -1. <_> 5 6 15 1 2. 0 0.0158455893397331 -0.1791914999485016 0.2889905869960785 <_> <_> <_> 5 4 15 6 -1. <_> 5 6 15 2 3. 0 -0.0746863335371017 0.5424023270606995 -0.1314727962017059 <_> <_> <_> 0 7 2 3 -1. <_> 0 8 2 1 3. 0 4.7695250250399113e-003 0.0965340435504913 -0.6561154723167419 <_> <_> <_> 6 6 13 6 -1. <_> 6 8 13 2 3. 0 -0.0535226687788963 0.4636800885200501 -0.1353430002927780 <_> <_> <_> 0 11 6 3 -1. <_> 0 12 6 1 3. 0 -6.3648750074207783e-003 -0.6624563932418823 0.0684857368469238 <_> <_> <_> 11 0 14 14 -1. <_> 11 7 14 7 2. 0 -0.2447337061166763 -0.8181337118148804 0.0450799688696861 <_> <_> <_> 7 13 4 1 -1. <_> 8 13 2 1 2. 0 -2.4634969886392355e-003 -0.7681804895401001 0.0495845898985863 <_> <_> <_> 6 9 13 6 -1. <_> 6 11 13 2 3. 0 -0.0358034893870354 0.3749603927135468 -0.1447928994894028 <_> <_> <_> 0 9 4 4 -1. <_> 0 10 4 2 2. 0 -5.6720529682934284e-003 -0.6127536296844482 0.0935847163200378 <_> <_> <_> 21 0 4 6 -1. <_> 21 3 4 3 2. 0 -0.0132687101140618 0.2863784134387970 -0.2551889121532440 <_> <_> <_> 0 12 6 3 -1. <_> 0 13 6 1 3. 0 -6.2518939375877380e-003 -0.5896773934364319 0.0677111670374870 <_> <_> <_> 16 11 4 3 -1. <_> 17 11 2 3 2. 0 7.3092570528388023e-003 0.0272198095917702 -0.5714861154556274 <_> <_> <_> 0 7 10 8 -1. <_> 0 7 5 4 2. <_> 5 11 5 4 2. 0 0.0258194394409657 -0.1326007992029190 0.3050251901149750 <_> <_> <_> 22 2 3 8 -1. <_> 22 2 3 4 2. 1 -0.0211078803986311 0.1200629025697708 -0.1475265026092529 <_> <_> <_> 1 3 16 4 -1. <_> 9 3 8 4 2. 0 0.0408483408391476 -0.1736883074045181 0.2530446052551270 <_> <_> <_> 1 13 24 2 -1. <_> 13 13 12 1 2. <_> 1 14 12 1 2. 0 -0.0179475992918015 -0.7117617130279541 0.0583698004484177 <_> <_> <_> 5 5 4 10 -1. <_> 6 5 2 10 2. 0 -0.0138895902782679 -0.6778132915496826 0.0435630008578300 <_> <_> <_> 13 7 2 6 -1. <_> 11 9 2 2 3. 1 -9.8488982766866684e-003 0.1479212939739227 -0.0897465273737907 <_> <_> <_> 8 9 8 6 -1. <_> 8 12 8 3 2. 0 -0.0659847036004066 0.5683801770210266 -0.0681742578744888 <_> <_> <_> 24 7 1 4 -1. <_> 24 8 1 2 2. 0 -1.8370660254731774e-003 -0.4986937940120697 0.0779643580317497 <_> <_> <_> 5 7 15 6 -1. <_> 5 9 15 2 3. 0 -0.0277651809155941 0.2679949104785919 -0.1382624953985214 <_> <_> <_> 21 8 4 3 -1. <_> 21 9 4 1 3. 0 9.9889356642961502e-003 0.0445619411766529 -0.7317379117012024 -1.4849940538406372 2 -1 <_> <_> <_> <_> 5 2 15 4 -1. <_> 5 3 15 2 2. 0 -0.0456383489072323 0.6275423169136047 -0.2494937032461166 <_> <_> <_> 6 4 15 3 -1. <_> 6 5 15 1 3. 0 -0.0310676805675030 0.6427816152572632 -0.1671900004148483 <_> <_> <_> 0 3 2 12 -1. <_> 0 3 1 6 2. <_> 1 9 1 6 2. 0 3.0193419661372900e-003 -0.2399346977472305 0.3676818013191223 <_> <_> <_> 7 3 11 4 -1. <_> 7 4 11 2 2. 0 0.0315676406025887 -0.1147691980004311 0.5750172734260559 <_> <_> <_> 0 0 6 6 -1. <_> 0 3 6 3 2. 0 -6.4146341755986214e-003 0.2154625058174133 -0.3768770098686218 <_> <_> <_> 24 3 1 12 -1. <_> 24 7 1 4 3. 0 -5.7010860182344913e-003 -0.4533824026584625 0.0946888476610184 <_> <_> <_> 0 0 24 12 -1. <_> 0 0 12 6 2. <_> 12 6 12 6 2. 0 0.1890300065279007 0.0801155269145966 -0.7184885144233704 <_> <_> <_> 1 1 24 14 -1. <_> 13 1 12 7 2. <_> 1 8 12 7 2. 0 0.1293978989124298 0.1093719005584717 -0.5197048783302307 <_> <_> <_> 5 3 8 4 -1. <_> 5 3 8 2 2. 1 -0.0657683908939362 0.5003104209899902 -0.1238735020160675 <_> <_> <_> 24 9 1 4 -1. <_> 23 10 1 2 2. 1 -4.0884059853851795e-003 -0.5118011236190796 0.0594223700463772 <_> <_> <_> 7 7 11 8 -1. <_> 7 9 11 4 2. 0 -0.0306642707437277 0.2964648902416229 -0.1741248071193695 <_> <_> <_> 24 9 1 4 -1. <_> 23 10 1 2 2. 1 2.7700960636138916e-003 0.0846907272934914 -0.4009515047073364 <_> <_> <_> 0 6 1 9 -1. <_> 0 9 1 3 3. 0 -6.2402039766311646e-003 -0.5560923218727112 0.0800850465893745 <_> <_> <_> 8 2 9 3 -1. <_> 8 3 9 1 3. 0 0.0105152595788240 -0.1309404969215393 0.3612711131572723 <_> <_> <_> 9 4 7 4 -1. <_> 9 5 7 2 2. 0 0.0181792695075274 -0.1245180964469910 0.3556562960147858 <_> <_> <_> 22 0 3 2 -1. <_> 22 1 3 1 2. 0 5.3037698380649090e-003 0.0638220235705376 -0.6178466081619263 <_> <_> <_> 0 0 13 14 -1. <_> 0 7 13 7 2. 0 -0.1947806030511856 -0.7228901982307434 0.0475768186151981 <_> <_> <_> 21 9 4 4 -1. <_> 21 10 4 2 2. 0 7.2230421938002110e-003 0.0453382283449173 -0.5460836291313171 <_> <_> <_> 0 9 4 4 -1. <_> 0 10 4 2 2. 0 5.0375838764011860e-003 0.0804468318820000 -0.4817472100257874 <_> <_> <_> 22 9 1 4 -1. <_> 21 10 1 2 2. 1 -7.1934829466044903e-003 -0.5018991827964783 0.0128700295463204 <_> <_> <_> 3 9 4 1 -1. <_> 4 10 2 1 2. 1 -4.4941599480807781e-003 -0.5862709879875183 0.0634675025939941 <_> <_> <_> 15 3 10 12 -1. <_> 20 3 5 6 2. <_> 15 9 5 6 2. 0 0.0874131396412849 -0.0676202401518822 0.4797031879425049 <_> <_> <_> 0 8 14 6 -1. <_> 0 8 7 3 2. <_> 7 11 7 3 2. 0 -0.0377015694975853 0.3913342952728272 -0.0978809297084808 <_> <_> <_> 23 10 1 4 -1. <_> 22 11 1 2 2. 1 3.0070370994508266e-003 0.0484924912452698 -0.2472224980592728 <_> <_> <_> 0 3 10 12 -1. <_> 0 3 5 6 2. <_> 5 9 5 6 2. 0 0.0974098667502403 -0.0669010728597641 0.5813519954681397 <_> <_> <_> 23 0 2 1 -1. <_> 23 0 1 1 2. 1 -4.0166568942368031e-003 -0.5456554293632507 0.0363924615085125 <_> <_> <_> 8 3 9 3 -1. <_> 8 4 9 1 3. 0 0.0104924896731973 -0.1087466031312943 0.3253425061702728 <_> <_> <_> 7 5 11 4 -1. <_> 7 6 11 2 2. 0 0.0249659996479750 -0.1137896031141281 0.3056510984897614 <_> <_> <_> 2 7 20 8 -1. <_> 12 7 10 8 2. 0 0.1301030069589615 -0.1220476999878883 0.3035365939140320 <_> <_> <_> 12 5 9 8 -1. <_> 15 5 3 8 3. 0 -0.0843720883131027 -0.6943122148513794 0.0178856607526541 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 -2.9267850331962109e-003 -0.5401834845542908 0.0564073212444782 <_> <_> <_> 21 3 4 4 -1. <_> 22 4 2 4 2. 1 -0.0206745099276304 0.4180921018123627 -0.0685340464115143 <_> <_> <_> 4 5 9 8 -1. <_> 7 5 3 8 3. 0 -0.0514506399631500 -0.6289098262786865 0.0529876984655857 <_> <_> <_> 22 10 3 2 -1. <_> 22 10 3 1 2. 1 -8.9261196553707123e-003 -0.4644356071949005 0.0236550793051720 <_> <_> <_> 0 5 24 5 -1. <_> 6 5 12 5 2. 0 -0.0830484703183174 0.3304196894168854 -0.0938697606325150 <_> <_> <_> 9 7 7 3 -1. <_> 9 8 7 1 3. 0 0.0113369999453425 -0.0979600325226784 0.3484053015708923 <_> <_> <_> 2 0 20 9 -1. <_> 7 0 10 9 2. 0 0.0827779024839401 -0.1159391030669212 0.2680957913398743 <_> <_> <_> 11 2 8 9 -1. <_> 13 2 4 9 2. 0 -0.0478848814964294 -0.6079211235046387 0.0222362894564867 <_> <_> <_> 1 8 4 1 -1. <_> 2 9 2 1 2. 1 -3.8582698907703161e-003 -0.4688901007175446 0.0554540418088436 <_> <_> <_> 19 5 6 10 -1. <_> 22 5 3 5 2. <_> 19 10 3 5 2. 0 -0.0334531292319298 0.4192667901515961 -0.0631088465452194 <_> <_> <_> 0 5 6 10 -1. <_> 0 5 3 5 2. <_> 3 10 3 5 2. 0 0.0126036396250129 -0.1227632984519005 0.2175220996141434 <_> <_> <_> 10 10 9 2 -1. <_> 13 10 3 2 3. 0 0.0262600891292095 0.0162896700203419 -0.5688759088516235 -1.5437099933624268 3 -1 <_> <_> <_> <_> 5 2 15 2 -1. <_> 5 3 15 1 2. 0 -0.0197793096303940 0.4472095072269440 -0.2573797106742859 <_> <_> <_> 21 4 4 3 -1. <_> 21 4 2 3 2. 0 -9.1997236013412476e-003 0.4397894144058228 -0.1382309943437576 <_> <_> <_> 1 5 15 4 -1. <_> 1 6 15 2 2. 0 0.0222425796091557 -0.1761150062084198 0.3406811952590942 <_> <_> <_> 21 5 4 10 -1. <_> 23 5 2 5 2. <_> 21 10 2 5 2. 0 5.3650550544261932e-003 -0.1087490990757942 0.1631094068288803 <_> <_> <_> 0 0 21 8 -1. <_> 7 0 7 8 3. 0 0.7425013780593872 4.6233131433837116e-004 -1.4172740478515625e+003 <_> <_> <_> 5 0 15 6 -1. <_> 5 2 15 2 3. 0 -0.1289999037981033 0.4220936894416809 -0.1264209002256393 <_> <_> <_> 2 2 21 3 -1. <_> 9 2 7 3 3. 0 0.4214023947715759 3.0299068894237280e-003 1.2071870117187500e+003 <_> <_> <_> 6 3 15 6 -1. <_> 6 5 15 2 3. 0 -0.1431712061166763 0.5070012211799622 -0.1091170981526375 <_> <_> <_> 0 5 4 10 -1. <_> 0 5 2 5 2. <_> 2 10 2 5 2. 0 4.4366121292114258e-003 -0.2218814045190811 0.2446105927228928 <_> <_> <_> 22 10 1 4 -1. <_> 21 11 1 2 2. 1 3.0177310109138489e-003 0.1072233989834786 -0.3470205068588257 <_> <_> <_> 0 7 3 4 -1. <_> 0 8 3 2 2. 0 -4.8220949247479439e-003 -0.6534119248390198 0.0803434476256371 <_> <_> <_> 1 3 24 3 -1. <_> 7 3 12 3 2. 0 0.0362788289785385 -0.2207075059413910 0.2242490947246552 <_> <_> <_> 0 0 24 13 -1. <_> 6 0 12 13 2. 0 -0.1675994992256165 0.4059072136878967 -0.1054169982671738 <_> <_> <_> 5 3 15 4 -1. <_> 5 4 15 2 2. 0 -0.0509919412434101 0.3452283143997192 -0.1206474006175995 <_> <_> <_> 5 4 14 3 -1. <_> 5 5 14 1 3. 0 0.0161635298281908 -0.1465175002813339 0.3696750998497009 <_> <_> <_> 23 8 2 4 -1. <_> 22 9 2 2 2. 1 8.3268675953149796e-003 0.0642398297786713 -0.5490669012069702 <_> <_> <_> 2 8 4 2 -1. <_> 3 9 2 2 2. 1 -7.2614871896803379e-003 -0.6105815768241882 0.0538330897688866 <_> <_> <_> 9 8 9 6 -1. <_> 9 10 9 2 3. 0 -0.0427855290472507 0.3435507118701935 -0.1058441996574402 <_> <_> <_> 0 0 11 14 -1. <_> 0 7 11 7 2. 0 -0.0558885596692562 -0.4213463068008423 0.0855342373251915 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 0.1077039018273354 0.0796676799654961 -0.5105268955230713 <_> <_> <_> 0 0 3 4 -1. <_> 0 2 3 2 2. 0 -4.8622798203723505e-005 0.1164970993995667 -0.3022361099720001 <_> <_> <_> 7 2 15 4 -1. <_> 7 3 15 2 2. 0 0.0272718109190464 -0.0831976532936096 0.3410704135894775 <_> <_> <_> 2 10 4 1 -1. <_> 3 11 2 1 2. 1 2.7942128945142031e-003 0.0836139172315598 -0.4521746933460236 <_> <_> <_> 21 11 4 4 -1. <_> 21 12 4 2 2. 0 -5.9649557806551456e-003 -0.5814967751502991 0.0588471181690693 <_> <_> <_> 1 7 12 8 -1. <_> 1 7 6 4 2. <_> 7 11 6 4 2. 0 -0.0364551208913326 0.2987614870071411 -0.1163965016603470 <_> <_> <_> 7 8 11 6 -1. <_> 7 11 11 3 2. 0 0.0560359284281731 -0.1189749017357826 0.3490499854087830 <_> <_> <_> 0 13 2 2 -1. <_> 0 14 2 1 2. 0 1.9068910041823983e-003 0.0623399801552296 -0.5222734212875366 <_> <_> <_> 10 3 8 6 -1. <_> 12 3 4 6 2. 0 -0.0314803011715412 -0.5988280177116394 0.0221100505441427 <_> <_> <_> 7 3 8 6 -1. <_> 9 3 4 6 2. 0 -0.0291779898107052 -0.7628328204154968 0.0378519818186760 <_> <_> <_> 22 6 3 3 -1. <_> 22 7 3 1 3. 0 9.3441819772124290e-003 0.0293787997215986 -0.5464184880256653 <_> <_> <_> 0 5 5 6 -1. <_> 0 7 5 2 3. 0 1.2941689928993583e-003 -0.2152619063854218 0.1293071061372757 <_> <_> <_> 8 7 9 6 -1. <_> 8 9 9 2 3. 0 0.0399527512490749 -0.0815632417798042 0.3440327942371368 <_> <_> <_> 2 0 20 13 -1. <_> 12 0 10 13 2. 0 0.2579689919948578 -0.0829713121056557 0.2971759140491486 <_> <_> <_> 19 3 6 4 -1. <_> 22 3 3 2 2. <_> 19 5 3 2 2. 0 8.3975978195667267e-003 -0.1235759034752846 0.3130742907524109 <_> <_> <_> 3 8 12 3 -1. <_> 9 8 6 3 2. 0 -0.0210481006652117 0.2553890943527222 -0.1077592000365257 <_> <_> <_> 22 3 2 5 -1. <_> 22 3 1 5 2. 1 0.0184192396700382 -0.0348858311772347 0.4613004922866821 <_> <_> <_> 6 7 8 8 -1. <_> 8 7 4 8 2. 0 -0.0335993207991123 -0.6385626196861267 0.0432357601821423 <_> <_> <_> 20 0 3 1 -1. <_> 21 1 1 1 3. 1 -5.9369178488850594e-003 -0.3381235003471375 0.0261388104408979 <_> <_> <_> 5 0 1 3 -1. <_> 4 1 1 1 3. 1 7.4244509451091290e-003 0.0416494794189930 -0.6013135910034180 <_> <_> <_> 22 11 1 3 -1. <_> 21 12 1 1 3. 1 -3.8341500330716372e-003 -0.3147934973239899 0.0227260906249285 <_> <_> <_> 1 4 4 3 -1. <_> 3 4 2 3 2. 0 5.9263929724693298e-003 -0.0845179632306099 0.2986125946044922 <_> <_> <_> 19 4 6 8 -1. <_> 22 4 3 4 2. <_> 19 8 3 4 2. 0 -0.0194444190710783 0.2213757932186127 -0.0513583682477474 <_> <_> <_> 0 4 8 8 -1. <_> 0 4 4 4 2. <_> 4 8 4 4 2. 0 0.0187752693891525 -0.1223364025354385 0.2647691071033478 <_> <_> <_> 22 11 1 3 -1. <_> 21 12 1 1 3. 1 6.4857508987188339e-003 0.0205634497106075 -0.5246906280517578 <_> <_> <_> 0 1 24 14 -1. <_> 0 1 12 7 2. <_> 12 8 12 7 2. 0 -0.2598725855350494 -0.6570193767547607 0.0345496907830238 <_> <_> <_> 23 8 2 4 -1. <_> 23 9 2 2 2. 0 -5.8150831609964371e-003 -0.6595460772514343 0.0302442405372858 <_> <_> <_> 5 3 15 4 -1. <_> 5 4 15 2 2. 0 -0.0261219404637814 0.1870407015085220 -0.1252924054861069 <_> <_> <_> 8 1 9 3 -1. <_> 8 2 9 1 3. 0 -5.7821800000965595e-003 0.2328509986400604 -0.1182496026158333 <_> <_> <_> 0 8 2 4 -1. <_> 0 9 2 2 2. 0 -2.9595640953630209e-003 -0.4579938054084778 0.0564655400812626 <_> <_> <_> 18 10 7 2 -1. <_> 18 11 7 1 2. 0 -0.0120882000774145 -0.5189349055290222 0.0244996603578329 <_> <_> <_> 6 11 12 4 -1. <_> 6 12 12 2 2. 0 -8.8109169155359268e-003 0.2570025026798248 -0.0927671566605568 <_> <_> <_> 14 0 6 15 -1. <_> 16 0 2 15 3. 0 -0.0459428504109383 -0.4479719102382660 0.0299462303519249 <_> <_> <_> 0 10 7 2 -1. <_> 0 11 7 1 2. 0 -0.0100041404366493 -0.6149634122848511 0.0364212691783905 <_> <_> <_> 15 5 6 6 -1. <_> 18 5 3 3 2. <_> 15 8 3 3 2. 0 -0.0116753997281194 0.1172877028584480 -0.0613474808633327 <_> <_> <_> 5 0 6 15 -1. <_> 7 0 2 15 3. 0 -0.0524668507277966 -0.7613652944564819 0.0306894704699516 <_> <_> <_> 8 7 9 4 -1. <_> 8 8 9 2 2. 0 0.0182263404130936 -0.0854801833629608 0.2695373892784119 <_> <_> <_> 7 6 10 6 -1. <_> 7 8 10 2 3. 0 -0.0452684201300144 0.3264470100402832 -0.0773756429553032 <_> <_> <_> 19 11 1 3 -1. <_> 18 12 1 1 3. 1 -8.1426883116364479e-003 -0.4582937955856323 9.3973511829972267e-003 <_> <_> <_> 6 11 3 1 -1. <_> 7 12 1 1 3. 1 -5.3349281661212444e-003 -0.5775498151779175 0.0352523885667324 <_> <_> <_> 16 10 4 1 -1. <_> 16 10 2 1 2. 0 -1.0754769900813699e-003 0.1434753984212875 -0.1015762984752655 <_> <_> <_> 0 0 1 2 -1. <_> 0 1 1 1 2. 0 -3.5198600962758064e-003 -0.6082041263580322 0.0328880697488785 <_> <_> <_> 8 1 9 3 -1. <_> 8 2 9 1 3. 0 0.0112483501434326 -0.0905500426888466 0.2323783040046692 <_> <_> <_> 0 6 5 3 -1. <_> 0 7 5 1 3. 0 -0.0119920196011662 -0.5705332159996033 0.0367036312818527 <_> <_> <_> 21 8 1 4 -1. <_> 20 9 1 2 2. 1 -0.0121055301278830 -0.7086269259452820 4.4598700478672981e-003 -1.5637760162353516 4 -1 <_> <_> <_> <_> 5 1 15 6 -1. <_> 5 3 15 2 3. 0 -0.1112890988588333 0.5214446783065796 -0.2762526869773865 <_> <_> <_> 23 0 2 2 -1. <_> 24 0 1 1 2. <_> 23 1 1 1 2. 0 -3.1310080084949732e-003 -0.6073393225669861 0.0243980996310711 <_> <_> <_> 3 3 15 6 -1. <_> 3 5 15 2 3. 0 -0.0975013524293900 0.5489286780357361 -0.1652427017688751 <_> <_> <_> 19 0 6 9 -1. <_> 19 3 6 3 3. 0 -0.0652247071266174 0.3402006924152374 -0.2693930864334106 <_> <_> <_> 5 2 15 6 -1. <_> 5 4 15 2 3. 0 0.1191802993416786 -0.1123576015233994 0.6395980119705200 <_> <_> <_> 17 3 8 3 -1. <_> 17 4 8 1 3. 0 -0.0140629801899195 0.3342761993408203 -0.1284538954496384 <_> <_> <_> 4 3 8 4 -1. <_> 4 3 8 2 2. 1 -0.0564025007188320 0.3790628910064697 -0.1554156988859177 <_> <_> <_> 16 4 6 2 -1. <_> 16 5 6 1 2. 0 7.1742408908903599e-003 -0.1133088991045952 0.1825089007616043 <_> <_> <_> 0 0 24 12 -1. <_> 0 0 12 6 2. <_> 12 6 12 6 2. 0 0.1259752959012985 0.0945485532283783 -0.4853444099426270 <_> <_> <_> 22 10 3 2 -1. <_> 22 10 3 1 2. 1 5.9177991934120655e-003 0.0701321363449097 -0.5377039909362793 <_> <_> <_> 6 3 6 6 -1. <_> 4 5 6 2 3. 1 -0.0439277403056622 0.3950741887092590 -0.1080185994505882 <_> <_> <_> 14 4 9 1 -1. <_> 17 7 3 1 3. 1 -9.8314704373478889e-003 0.0959606170654297 -0.0468075983226299 <_> <_> <_> 3 10 2 3 -1. <_> 3 10 1 3 2. 1 5.6353402324020863e-003 0.0943416282534599 -0.5247716903686523 <_> <_> <_> 20 8 5 2 -1. <_> 20 8 5 1 2. 1 -0.0115382801741362 -0.5154880285263062 0.0138055300340056 <_> <_> <_> 0 9 16 6 -1. <_> 0 9 8 3 2. <_> 8 12 8 3 2. 0 0.0286462493240833 -0.1382701992988586 0.2750437855720520 <_> <_> <_> 6 2 13 3 -1. <_> 6 3 13 1 3. 0 0.0138679798692465 -0.1203586980700493 0.3521435856819153 <_> <_> <_> 0 1 3 4 -1. <_> 0 3 3 2 2. 0 -4.0469371015205979e-004 0.1522637009620667 -0.2590084075927734 <_> <_> <_> 8 0 9 12 -1. <_> 8 6 9 6 2. 0 -0.1594581007957459 -0.6391854882240295 0.0514649897813797 <_> <_> <_> 4 0 1 2 -1. <_> 4 0 1 1 2. 1 -2.7928699273616076e-003 -0.5840150713920593 0.0542793795466423 <_> <_> <_> 5 3 15 3 -1. <_> 5 4 15 1 3. 0 0.0183532107621431 -0.1051151007413864 0.3529815971851349 <_> <_> <_> 3 10 2 3 -1. <_> 3 10 1 3 2. 1 -5.1810559816658497e-003 -0.4741767942905426 0.0798512324690819 <_> <_> <_> 19 4 6 4 -1. <_> 22 4 3 2 2. <_> 19 6 3 2 2. 0 9.2321299016475677e-003 -0.0759327188134193 0.1852813959121704 <_> <_> <_> 0 3 8 4 -1. <_> 0 3 4 2 2. <_> 4 5 4 2 2. 0 0.0121171101927757 -0.1117528975009918 0.2853634953498840 <_> <_> <_> 19 10 5 3 -1. <_> 19 11 5 1 3. 0 -7.2612818330526352e-003 -0.5885108709335327 0.0526883192360401 <_> <_> <_> 1 10 5 3 -1. <_> 1 11 5 1 3. 0 5.6134900078177452e-003 0.0474684908986092 -0.5394589900970459 <_> <_> <_> 12 1 13 14 -1. <_> 12 8 13 7 2. 0 -0.1945167928934097 -0.5634222030639648 0.0302108898758888 <_> <_> <_> 0 1 13 14 -1. <_> 0 8 13 7 2. 0 0.3550943136215210 0.0630894526839256 -0.4980587959289551 <_> <_> <_> 11 3 6 12 -1. <_> 14 3 3 6 2. <_> 11 9 3 6 2. 0 0.0331119708716869 0.0346324704587460 -0.5246484875679016 <_> <_> <_> 9 5 6 10 -1. <_> 9 5 3 5 2. <_> 12 10 3 5 2. 0 0.0342818088829517 0.0431439802050591 -0.6470713019371033 <_> <_> <_> 20 8 5 4 -1. <_> 20 9 5 2 2. 0 -7.8256614506244659e-003 -0.4688000977039337 0.0402393713593483 <_> <_> <_> 0 8 5 4 -1. <_> 0 9 5 2 2. 0 0.0111560495570302 0.0401505008339882 -0.6095538735389710 <_> <_> <_> 8 9 9 3 -1. <_> 8 10 9 1 3. 0 0.0113630602136254 -0.0827489867806435 0.3811689019203186 <_> <_> <_> 7 10 6 4 -1. <_> 9 10 2 4 3. 0 0.0204051006585360 0.0425756387412548 -0.7467774152755737 <_> <_> <_> 6 6 14 4 -1. <_> 6 7 14 2 2. 0 0.0191116295754910 -0.1239197030663490 0.2226520031690598 <_> <_> <_> 9 6 5 4 -1. <_> 9 7 5 2 2. 0 -7.3364898562431335e-003 0.3034206926822662 -0.0926956906914711 <_> <_> <_> 22 5 3 6 -1. <_> 22 7 3 2 3. 0 -8.6538922041654587e-003 -0.3351745009422302 0.0585405789315701 <_> <_> <_> 0 5 3 6 -1. <_> 0 7 3 2 3. 0 0.0347895994782448 0.0337578095495701 -0.7483453154563904 <_> <_> <_> 17 1 5 4 -1. <_> 17 2 5 2 2. 0 -0.0174188297241926 0.2445363998413086 -0.0698786973953247 <_> <_> <_> 3 1 6 4 -1. <_> 3 2 6 2 2. 0 3.5119079984724522e-003 -0.1277886927127838 0.2403315007686615 <_> <_> <_> 21 14 4 1 -1. <_> 21 14 2 1 2. 0 5.0669797929003835e-004 -0.1169779002666473 0.1439380049705505 <_> <_> <_> 4 8 3 2 -1. <_> 5 9 1 2 3. 1 -5.9512741863727570e-003 -0.5078160762786865 0.0478522293269634 <_> <_> <_> 14 2 4 7 -1. <_> 14 2 2 7 2. 0 0.0503778010606766 2.9282520990818739e-003 -0.7751696109771729 <_> <_> <_> 7 2 4 7 -1. <_> 9 2 2 7 2. 0 3.8862510118633509e-003 -0.1550420969724655 0.1570920050144196 <_> <_> <_> 9 3 8 5 -1. <_> 11 3 4 5 2. 0 0.0385116301476955 0.0230970401316881 -0.6291617155075073 <_> <_> <_> 5 10 15 1 -1. <_> 10 10 5 1 3. 0 -5.5746049620211124e-003 0.1807070970535278 -0.1298052966594696 <_> <_> <_> 2 6 21 9 -1. <_> 9 6 7 9 3. 0 0.1266476064920425 -0.0865593999624252 0.2957325875759125 <_> <_> <_> 0 4 6 6 -1. <_> 0 6 6 2 3. 0 5.4126111790537834e-003 -0.1528324931859970 0.1662916988134384 <_> <_> <_> 1 12 24 3 -1. <_> 7 12 12 3 2. 0 -0.0361530818045139 0.2797313034534454 -0.1039886027574539 <_> <_> <_> 6 7 6 2 -1. <_> 6 8 6 1 2. 0 7.1673998609185219e-003 -0.0945642217993736 0.2778528034687042 <_> <_> <_> 13 8 2 4 -1. <_> 13 8 2 2 2. 1 -6.7790350876748562e-003 0.1679068058729172 -0.0839543119072914 <_> <_> <_> 8 6 8 5 -1. <_> 10 6 4 5 2. 0 -0.0298676099628210 -0.7236117124557495 0.0346310697495937 <_> <_> <_> 11 5 6 4 -1. <_> 11 6 6 2 2. 0 6.5265512093901634e-003 -0.1173760965466499 0.1346033960580826 <_> <_> <_> 0 14 4 1 -1. <_> 2 14 2 1 2. 0 3.4080960176652297e-005 -0.1753176003694534 0.1322204023599625 <_> <_> <_> 16 2 4 13 -1. <_> 17 2 2 13 2. 0 -0.0176294595003128 -0.5160853862762451 0.0253861900418997 <_> <_> <_> 0 7 1 4 -1. <_> 0 8 1 2 2. 0 -1.5446309698745608e-003 -0.4142186045646668 0.0513300895690918 <_> <_> <_> 24 0 1 2 -1. <_> 24 1 1 1 2. 0 1.1520429980009794e-003 0.0366159491240978 -0.3692800998687744 <_> <_> <_> 0 5 2 4 -1. <_> 1 5 1 4 2. 0 -2.9612779617309570e-003 0.2446188032627106 -0.0842714235186577 -1.5267670154571533 5 -1 <_> <_> <_> <_> 0 1 8 4 -1. <_> 0 3 8 2 2. 0 -0.0141031695529819 0.2699790894985199 -0.3928318023681641 <_> <_> <_> 15 11 10 4 -1. <_> 20 11 5 2 2. <_> 15 13 5 2 2. 0 5.4714400321245193e-003 -0.2269169986248016 0.2749052047729492 <_> <_> <_> 7 5 11 3 -1. <_> 7 6 11 1 3. 0 0.0166354794055223 -0.1547908037900925 0.3224202096462250 <_> <_> <_> 21 4 4 3 -1. <_> 21 4 2 3 2. 0 -8.4477178752422333e-003 0.3320780992507935 -0.1249654963612557 <_> <_> <_> 0 5 4 1 -1. <_> 2 5 2 1 2. 0 -2.4904569145292044e-003 0.2900204956531525 -0.1460298001766205 <_> <_> <_> 7 3 12 4 -1. <_> 7 4 12 2 2. 0 0.0282104406505823 -0.0831937119364738 0.4805397987365723 <_> <_> <_> 8 6 7 3 -1. <_> 8 7 7 1 3. 0 9.3179903924465179e-003 -0.1692426949739456 0.3482030928134918 <_> <_> <_> 16 0 9 14 -1. <_> 16 7 9 7 2. 0 -0.0579102896153927 -0.5040398836135864 0.0840934887528419 <_> <_> <_> 0 0 24 6 -1. <_> 0 0 12 3 2. <_> 12 3 12 3 2. 0 0.0882126465439796 0.0733099877834320 -0.4883395135402679 <_> <_> <_> 23 13 2 1 -1. <_> 23 13 1 1 2. 0 6.0974380176048726e-005 -0.1594507992267609 0.1473277956247330 <_> <_> <_> 0 13 24 2 -1. <_> 0 13 12 1 2. <_> 12 14 12 1 2. 0 -0.0142063600942492 -0.6365684866905212 0.0507153607904911 <_> <_> <_> 19 12 5 3 -1. <_> 19 13 5 1 3. 0 -7.7181900851428509e-003 -0.6330028772354126 0.0328688994050026 <_> <_> <_> 9 7 7 4 -1. <_> 9 8 7 2 2. 0 0.0120071703568101 -0.1254525035619736 0.2893699109554291 <_> <_> <_> 14 0 4 7 -1. <_> 14 0 2 7 2. 1 0.0707826167345047 0.0305656604468822 -0.5666698217391968 <_> <_> <_> 11 0 7 4 -1. <_> 11 0 7 2 2. 1 -0.0504123307764530 -0.5089793801307678 0.0710048824548721 <_> <_> <_> 9 4 14 2 -1. <_> 9 5 14 1 2. 0 0.0220727995038033 -0.1444841027259827 0.2781184911727905 <_> <_> <_> 3 2 15 4 -1. <_> 3 3 15 2 2. 0 0.0147649403661489 -0.1283989995718002 0.3290185928344727 <_> <_> <_> 19 12 5 3 -1. <_> 19 13 5 1 3. 0 6.8206568248569965e-003 0.0654795467853546 -0.5463265776634216 <_> <_> <_> 0 11 8 4 -1. <_> 0 11 4 2 2. <_> 4 13 4 2 2. 0 2.0179790444672108e-003 -0.2028342932462692 0.1679659038782120 <_> <_> <_> 7 9 11 6 -1. <_> 7 11 11 2 3. 0 0.0250812191516161 -0.1104943975806236 0.3191860020160675 <_> <_> <_> 0 11 7 4 -1. <_> 0 12 7 2 2. 0 8.9391358196735382e-003 0.0734132081270218 -0.5538399219512940 <_> <_> <_> 20 0 5 2 -1. <_> 20 1 5 1 2. 0 -4.6396959805861115e-004 0.1123031005263329 -0.1697127074003220 <_> <_> <_> 5 10 3 2 -1. <_> 6 11 1 2 3. 1 -8.5602197796106339e-003 -0.7347347736358643 0.0417169481515884 <_> <_> <_> 17 4 8 10 -1. <_> 21 4 4 5 2. <_> 17 9 4 5 2. 0 -0.0389347188174725 0.2292626947164536 -0.0792299434542656 <_> <_> <_> 5 3 15 2 -1. <_> 5 4 15 1 2. 0 -0.0215415991842747 0.3007172048091888 -0.1152340024709702 <_> <_> <_> 16 4 5 2 -1. <_> 16 5 5 1 2. 0 4.9337721429765224e-003 -0.1002838015556335 0.1348572969436646 <_> <_> <_> 1 0 22 10 -1. <_> 1 0 11 5 2. <_> 12 5 11 5 2. 0 0.1615066975355148 0.0588171891868114 -0.5656744837760925 <_> <_> <_> 20 0 5 2 -1. <_> 20 1 5 1 2. 0 -0.0123260198161006 -0.2823328077793121 0.0187596306204796 <_> <_> <_> 0 0 5 2 -1. <_> 0 1 5 1 2. 0 5.2987951785326004e-003 0.0524063482880592 -0.5719032287597656 <_> <_> <_> 10 1 6 12 -1. <_> 13 1 3 6 2. <_> 10 7 3 6 2. 0 0.0289043206721544 0.0477108694612980 -0.4854584038257599 <_> <_> <_> 0 0 1 8 -1. <_> 0 4 1 4 2. 0 0.0155697297304869 0.0493178516626358 -0.5100051760673523 <_> <_> <_> 6 0 13 6 -1. <_> 6 2 13 2 3. 0 -0.0938120707869530 0.2564809024333954 -0.1057069003582001 <_> <_> <_> 4 3 4 4 -1. <_> 3 4 4 2 2. 1 -0.0286933295428753 0.5247043967247009 -0.0509502515196800 <_> <_> <_> 20 8 5 3 -1. <_> 20 9 5 1 3. 0 7.2301640175282955e-003 0.0583653002977371 -0.4894312024116516 <_> <_> <_> 7 13 2 2 -1. <_> 7 13 1 1 2. <_> 8 14 1 1 2. 0 8.2664839283097535e-005 -0.1437218040227890 0.1820268929004669 <_> <_> <_> 16 13 2 2 -1. <_> 17 13 1 1 2. <_> 16 14 1 1 2. 0 1.5241750515997410e-003 0.0201267991214991 -0.3884589970111847 <_> <_> <_> 7 13 2 2 -1. <_> 7 13 1 1 2. <_> 8 14 1 1 2. 0 -6.5512307628523558e-005 0.2280354052782059 -0.1581206023693085 <_> <_> <_> 19 5 6 1 -1. <_> 21 5 2 1 3. 0 2.4175599683076143e-003 -0.0890450775623322 0.2839250862598419 <_> <_> <_> 0 8 6 6 -1. <_> 0 10 6 2 3. 0 0.0343084894120693 0.0391304790973663 -0.6263393163681030 <_> <_> <_> 6 8 13 4 -1. <_> 6 9 13 2 2. 0 0.0127667998895049 -0.0984294191002846 0.2857427895069122 <_> <_> <_> 3 10 8 1 -1. <_> 7 10 4 1 2. 0 -2.7450299821794033e-003 0.2090786993503571 -0.1267945021390915 <_> <_> <_> 16 11 4 4 -1. <_> 17 11 2 4 2. 0 -7.0629850961267948e-003 -0.4784719944000244 0.0229746792465448 <_> <_> <_> 5 6 15 2 -1. <_> 5 7 15 1 2. 0 0.0109674101695418 -0.1310741007328033 0.1712857037782669 <_> <_> <_> 3 1 20 10 -1. <_> 3 1 10 10 2. 0 -0.1530689001083374 0.2361073046922684 -0.0965401679277420 <_> <_> <_> 2 4 3 3 -1. <_> 2 5 3 1 3. 0 2.1676090545952320e-003 -0.1028804033994675 0.2537584006786346 <_> <_> <_> 16 11 4 4 -1. <_> 17 11 2 4 2. 0 0.0107051497325301 0.0160892698913813 -0.5868526101112366 <_> <_> <_> 5 11 4 4 -1. <_> 6 11 2 4 2. 0 -6.1142919585108757e-003 -0.6146798133850098 0.0344046317040920 <_> <_> <_> 17 4 8 10 -1. <_> 21 4 4 5 2. <_> 17 9 4 5 2. 0 -0.0160057693719864 0.0954133197665215 -0.0657811686396599 <_> <_> <_> 0 8 5 3 -1. <_> 0 9 5 1 3. 0 8.5541699081659317e-003 0.0425793603062630 -0.5490341186523438 <_> <_> <_> 23 13 2 1 -1. <_> 23 13 1 1 2. 0 -5.5742941185599193e-005 0.1505846977233887 -0.0978325977921486 <_> <_> <_> 0 13 2 1 -1. <_> 1 13 1 1 2. 0 4.9888480134541169e-005 -0.1522217988967896 0.1464709937572479 <_> <_> <_> 10 1 7 3 -1. <_> 10 2 7 1 3. 0 9.3986131250858307e-003 -0.0793018564581871 0.2222844958305359 <_> <_> <_> 0 3 8 12 -1. <_> 0 3 4 6 2. <_> 4 9 4 6 2. 0 -0.0445945896208286 0.3217073082923889 -0.0712599530816078 <_> <_> <_> 6 0 16 11 -1. <_> 6 0 8 11 2. 0 0.2763071060180664 -0.0312894396483898 0.4636780917644501 <_> <_> <_> 2 0 21 3 -1. <_> 9 0 7 3 3. 0 -0.0459242798388004 0.2685551047325134 -0.0946981832385063 <_> <_> <_> 23 1 2 12 -1. <_> 23 1 2 6 2. 1 0.0328284502029419 0.0420088581740856 -0.1909179985523224 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 5.8416211977601051e-003 0.0443820804357529 -0.5017232894897461 <_> <_> <_> 15 0 6 3 -1. <_> 17 0 2 3 3. 0 0.0253127701580524 7.6768198050558567e-003 -0.4524691104888916 <_> <_> <_> 8 9 6 4 -1. <_> 10 9 2 4 3. 0 -0.0206803791224957 -0.7082331180572510 0.0277527105063200 <_> <_> <_> 20 5 5 6 -1. <_> 20 7 5 2 3. 0 1.9456259906291962e-003 -0.1725641041994095 0.0885240733623505 <_> <_> <_> 0 4 24 8 -1. <_> 0 4 12 4 2. <_> 12 8 12 4 2. 0 0.1318278014659882 0.0378756709396839 -0.5236573815345764 <_> <_> <_> 22 10 1 4 -1. <_> 21 11 1 2 2. 1 -4.8449821770191193e-003 -0.3831801116466522 0.0295521095395088 <_> <_> <_> 7 0 11 3 -1. <_> 7 1 11 1 3. 0 5.3295581601560116e-003 -0.1172816008329392 0.1712217032909393 <_> <_> <_> 6 0 13 4 -1. <_> 6 1 13 2 2. 0 -0.0353284589946270 0.3731549978256226 -0.0650273412466049 -1.4507639408111572 6 -1 <_> <_> <_> <_> 7 11 11 4 -1. <_> 7 13 11 2 2. 0 0.0136478496715426 -0.2802368998527527 0.3575335144996643 <_> <_> <_> 21 3 4 12 -1. <_> 23 3 2 6 2. <_> 21 9 2 6 2. 0 0.0123078199103475 -0.1484645009040833 0.2714886069297791 <_> <_> <_> 2 4 21 6 -1. <_> 9 6 7 2 9. 0 0.4659403860569000 -0.0705008506774902 0.5868018865585327 <_> <_> <_> 23 3 2 10 -1. <_> 24 3 1 5 2. <_> 23 8 1 5 2. 0 1.5693339519202709e-003 -0.1150237023830414 0.1375536024570465 <_> <_> <_> 0 3 2 10 -1. <_> 0 3 1 5 2. <_> 1 8 1 5 2. 0 2.5176738854497671e-003 -0.1778890937566757 0.2172407060861588 <_> <_> <_> 24 10 1 4 -1. <_> 23 11 1 2 2. 1 4.5299702323973179e-003 0.0458603501319885 -0.5376703143119812 <_> <_> <_> 1 10 4 1 -1. <_> 2 11 2 1 2. 1 4.0295510552823544e-003 0.0599071383476257 -0.5803095102310181 <_> <_> <_> 8 10 9 4 -1. <_> 8 11 9 2 2. 0 9.0281656011939049e-003 -0.0889611616730690 0.3474006950855255 <_> <_> <_> 5 8 13 6 -1. <_> 5 11 13 3 2. 0 -0.0710994601249695 0.4003205001354218 -0.0876752585172653 <_> <_> <_> 5 0 15 4 -1. <_> 5 2 15 2 2. 0 -0.0905078798532486 0.3202385008335114 -0.1107280030846596 <_> <_> <_> 1 0 22 15 -1. <_> 12 0 11 15 2. 0 0.3949914872646332 -0.0544822700321674 0.4376561045646668 <_> <_> <_> 10 14 8 1 -1. <_> 12 14 4 1 2. 0 6.0021281242370605e-003 0.0412968583405018 -0.6277515888214111 <_> <_> <_> 1 3 8 4 -1. <_> 1 4 8 2 2. 0 -0.0126753300428391 0.1864306032657623 -0.1586595028638840 <_> <_> <_> 15 13 1 2 -1. <_> 15 14 1 1 2. 0 5.2523188060149550e-004 -0.0737809464335442 0.1131825000047684 <_> <_> <_> 5 2 15 6 -1. <_> 5 4 15 2 3. 0 0.1519853025674820 -0.0698502063751221 0.5526459217071533 <_> <_> <_> 23 12 2 1 -1. <_> 23 12 1 1 2. 1 -5.9174448251724243e-003 -0.4224376976490021 0.0234292708337307 <_> <_> <_> 2 12 1 2 -1. <_> 2 12 1 1 2. 1 5.1085697486996651e-004 -0.1782114058732987 0.1747542023658752 <_> <_> <_> 8 13 9 2 -1. <_> 11 13 3 2 3. 0 -0.0286266505718231 -0.7806789875030518 0.0430335216224194 <_> <_> <_> 8 0 8 2 -1. <_> 8 1 8 1 2. 0 3.2388539984822273e-003 -0.1174874976277351 0.2301342934370041 <_> <_> <_> 20 12 4 3 -1. <_> 20 13 4 1 3. 0 -6.8310899659991264e-003 -0.5170273780822754 0.0224770605564117 <_> <_> <_> 3 0 18 10 -1. <_> 3 0 9 5 2. <_> 12 5 9 5 2. 0 -0.1381812989711762 -0.6718307137489319 0.0339458398520947 <_> <_> <_> 10 12 6 3 -1. <_> 12 12 2 3 3. 0 0.0129029303789139 0.0190411508083344 -0.4739249050617218 <_> <_> <_> 0 0 1 8 -1. <_> 0 2 1 4 2. 0 6.3398052006959915e-003 0.0412811301648617 -0.5821130871772766 <_> <_> <_> 22 5 3 4 -1. <_> 22 6 3 2 2. 0 8.4067512943875045e-005 -0.2301639020442963 0.1240853965282440 <_> <_> <_> 0 5 4 4 -1. <_> 0 6 4 2 2. 0 0.0172388590872288 0.0539665818214417 -0.5818564891815186 <_> <_> <_> 6 0 14 10 -1. <_> 13 0 7 5 2. <_> 6 5 7 5 2. 0 -0.0786773264408112 -0.4061115086078644 0.0569235086441040 <_> <_> <_> 1 12 4 3 -1. <_> 1 13 4 1 3. 0 5.5859591811895370e-003 0.0368424393236637 -0.5646867752075195 <_> <_> <_> 20 7 2 2 -1. <_> 21 7 1 1 2. <_> 20 8 1 1 2. 0 -6.1322399415075779e-004 0.1785047054290772 -0.0668883100152016 <_> <_> <_> 3 7 2 2 -1. <_> 3 7 1 1 2. <_> 4 8 1 1 2. 0 7.9400849062949419e-004 -0.0783978328108788 0.3054557144641876 <_> <_> <_> 22 6 3 4 -1. <_> 22 7 3 2 2. 0 0.0128271998837590 0.0404374599456787 -0.6479570865631104 <_> <_> <_> 9 6 7 3 -1. <_> 9 7 7 1 3. 0 0.0119779799133539 -0.0993791595101357 0.2267276048660278 <_> <_> <_> 11 6 4 2 -1. <_> 11 7 4 1 2. 0 -4.9378769472241402e-003 0.2706328034400940 -0.0839221030473709 <_> <_> <_> 0 6 5 4 -1. <_> 0 7 5 2 2. 0 0.0203377306461334 0.0400571115314960 -0.6170961260795593 <_> <_> <_> 5 3 15 6 -1. <_> 5 5 15 2 3. 0 -0.1582631021738052 0.3718011081218720 -0.0776448771357536 <_> <_> <_> 4 4 5 2 -1. <_> 4 5 5 1 2. 0 4.5150578953325748e-003 -0.1424572020769119 0.1946897059679031 <_> <_> <_> 11 12 6 3 -1. <_> 13 12 2 3 3. 0 -0.0179421696811914 -0.7258480787277222 0.0292347799986601 <_> <_> <_> 3 0 1 3 -1. <_> 2 1 1 1 3. 1 5.2153151482343674e-003 0.0460041500627995 -0.4536756873130798 <_> <_> <_> 7 11 12 2 -1. <_> 11 11 4 2 3. 0 -7.7863838523626328e-003 0.1746426969766617 -0.1098980978131294 <_> <_> <_> 0 8 4 4 -1. <_> 0 9 4 2 2. 0 9.4133447855710983e-003 0.0346476286649704 -0.5983666181564331 <_> <_> <_> 8 7 9 3 -1. <_> 8 8 9 1 3. 0 7.6218741014599800e-003 -0.1057026013731957 0.2037336975336075 <_> <_> <_> 8 8 9 6 -1. <_> 8 10 9 2 3. 0 0.0216018799692392 -0.0909303426742554 0.2887038886547089 <_> <_> <_> 20 11 5 4 -1. <_> 20 12 5 2 2. 0 -0.0118230897933245 -0.6303614974021912 0.0240826196968555 <_> <_> <_> 7 5 8 3 -1. <_> 9 5 4 3 2. 0 -0.0202329792082310 -0.7420278787612915 0.0235212203115225 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 6.4510147785767913e-004 -0.0552557893097401 0.1650166064500809 <_> <_> <_> 0 11 5 4 -1. <_> 0 12 5 2 2. 0 -8.1876022741198540e-003 -0.5770931839942932 0.0352346412837505 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 -4.5044958824291825e-004 0.1859780997037888 -0.0824367776513100 <_> <_> <_> 5 9 6 6 -1. <_> 7 9 2 6 3. 0 -0.0273097790777683 -0.7204548716545105 0.0276838503777981 <_> <_> <_> 14 10 10 4 -1. <_> 19 10 5 2 2. <_> 14 12 5 2 2. 0 7.3051019571721554e-003 -0.0758159905672073 0.1228180006146431 <_> <_> <_> 6 6 3 1 -1. <_> 7 6 1 1 3. 0 7.2118180105462670e-004 -0.0847066268324852 0.2212305068969727 <_> <_> <_> 16 6 3 2 -1. <_> 17 6 1 2 3. 0 -5.5794708896428347e-004 0.0922004431486130 -0.0512673109769821 <_> <_> <_> 6 6 3 2 -1. <_> 7 6 1 2 3. 0 -1.2906070332974195e-003 0.2364850938320160 -0.0856367424130440 <_> <_> <_> 13 3 8 4 -1. <_> 12 4 8 2 2. 1 -0.0234409496188164 -0.3417592048645020 0.0303556900471449 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 6.7003733420278877e-005 -0.1778312027454376 0.1098366007208824 <_> <_> <_> 21 0 2 1 -1. <_> 21 0 1 1 2. 1 -2.0913260523229837e-003 -0.3296548128128052 0.0488219298422337 <_> <_> <_> 4 0 1 2 -1. <_> 4 0 1 1 2. 1 5.2883368916809559e-003 0.0476020798087120 -0.4229690134525299 <_> <_> <_> 13 1 8 6 -1. <_> 11 3 8 2 3. 1 0.1046722009778023 0.0145577099174261 -0.5163959860801697 <_> <_> <_> 12 3 4 8 -1. <_> 13 4 2 8 2. 1 0.0410936884582043 0.0255694594234228 -0.6734575033187866 <_> <_> <_> 3 0 20 15 -1. <_> 3 0 10 15 2. 0 0.4545299112796783 -0.0473212711513042 0.4647259116172791 <_> <_> <_> 9 0 7 3 -1. <_> 9 1 7 1 3. 0 -4.4200271368026733e-003 0.2172905951738358 -0.0805237367749214 <_> <_> <_> 12 1 5 2 -1. <_> 12 2 5 1 2. 0 -3.3253689762204885e-003 0.1196364015340805 -0.0847371667623520 <_> <_> <_> 6 1 13 3 -1. <_> 6 2 13 1 3. 0 0.0152236903086305 -0.0892436280846596 0.2284111976623535 <_> <_> <_> 14 3 10 12 -1. <_> 19 3 5 6 2. <_> 14 9 5 6 2. 0 -0.0312239099293947 0.1464260965585709 -0.1012998968362808 <_> <_> <_> 1 6 21 6 -1. <_> 8 6 7 6 3. 0 -0.0729675367474556 0.1977909952402115 -0.0998045280575752 <_> <_> <_> 12 0 10 12 -1. <_> 12 0 5 12 2. 0 0.0434687100350857 -0.0738932862877846 0.1571179032325745 <_> <_> <_> 7 8 11 3 -1. <_> 7 9 11 1 3. 0 7.7427257783710957e-003 -0.0907922536134720 0.2449675947427750 <_> <_> <_> 2 5 22 10 -1. <_> 2 5 11 10 2. 0 -0.0834884494543076 0.1732859015464783 -0.1288128942251205 <_> <_> <_> 5 4 15 4 -1. <_> 5 6 15 2 2. 0 0.0421115085482597 -0.1475321054458618 0.1373448967933655 <_> <_> <_> 7 1 15 6 -1. <_> 7 3 15 2 3. 0 0.0966737270355225 -0.0551961399614811 0.3563303947448731 <_> <_> <_> 0 8 2 6 -1. <_> 0 10 2 2 3. 0 -8.8993981480598450e-003 -0.5261930823326111 0.0388906002044678 <_> <_> <_> 5 1 15 4 -1. <_> 5 2 15 2 2. 0 -0.0238508302718401 0.1924559026956558 -0.1050153970718384 <_> <_> <_> 7 8 2 2 -1. <_> 7 8 1 1 2. <_> 8 9 1 1 2. 0 -7.4902130290865898e-004 0.2476740926504135 -0.0738597288727760 <_> <_> <_> 11 9 9 2 -1. <_> 14 9 3 2 3. 0 -0.0230488497763872 -0.5220348238945007 0.0295383799821138 <_> <_> <_> 7 8 2 2 -1. <_> 7 8 1 1 2. <_> 8 9 1 1 2. 0 5.7920900871977210e-004 -0.0807055011391640 0.2493984997272492 <_> <_> <_> 17 10 8 4 -1. <_> 17 11 8 2 2. 0 -0.0254354309290648 -0.6520490050315857 0.0163280703127384 <_> <_> <_> 0 10 8 4 -1. <_> 0 11 8 2 2. 0 0.0176391601562500 0.0246949195861816 -0.6850522756576538 <_> <_> <_> 16 11 6 4 -1. <_> 18 11 2 4 3. 0 0.0205357391387224 0.0165182203054428 -0.4285225868225098 <_> <_> <_> 0 13 24 1 -1. <_> 6 13 12 1 2. 0 0.0111132804304361 -0.0871591791510582 0.2062001973390579 -1.3936280012130737 7 -1 <_> <_> <_> <_> 0 9 10 6 -1. <_> 0 9 5 3 2. <_> 5 12 5 3 2. 0 0.0140618495643139 -0.2737283110618591 0.4017829895019531 <_> <_> <_> 13 5 10 10 -1. <_> 18 5 5 5 2. <_> 13 10 5 5 2. 0 -0.0334245301783085 0.3433864116668701 -0.1524070948362351 <_> <_> <_> 0 4 4 2 -1. <_> 2 4 2 2 2. 0 -3.3982729073613882e-003 0.3046114146709442 -0.2162856012582779 <_> <_> <_> 13 5 12 10 -1. <_> 19 5 6 5 2. <_> 13 10 6 5 2. 0 0.0673939511179924 -0.0539562106132507 0.3304964005947113 <_> <_> <_> 0 5 12 10 -1. <_> 0 5 6 5 2. <_> 6 10 6 5 2. 0 -0.0515447482466698 0.3804036974906921 -0.1334261000156403 <_> <_> <_> 11 11 3 4 -1. <_> 11 13 3 2 2. 0 3.6630779504776001e-003 -0.1760202944278717 0.2139966934919357 <_> <_> <_> 5 8 2 5 -1. <_> 5 8 1 5 2. 1 7.8836623579263687e-003 0.0570616200566292 -0.5150743126869202 <_> <_> <_> 4 14 18 1 -1. <_> 4 14 9 1 2. 0 -8.9480048045516014e-003 0.2230996936559677 -0.1190536990761757 <_> <_> <_> 1 0 1 6 -1. <_> 1 3 1 3 2. 0 -5.5760587565600872e-004 0.0999659672379494 -0.2558285892009735 <_> <_> <_> 8 9 9 4 -1. <_> 8 10 9 2 2. 0 9.5389392226934433e-003 -0.0655315071344376 0.3246265947818756 <_> <_> <_> 0 9 5 4 -1. <_> 0 10 5 2 2. 0 7.7904132194817066e-003 0.0450260303914547 -0.6068859100341797 <_> <_> <_> 19 5 6 2 -1. <_> 21 5 2 2 3. 0 4.0692770853638649e-003 -0.0624743513762951 0.1570695042610169 <_> <_> <_> 0 5 6 2 -1. <_> 2 5 2 2 3. 0 3.1110940035432577e-003 -0.0744680091738701 0.2600801885128021 <_> <_> <_> 13 9 6 3 -1. <_> 15 9 2 3 3. 0 0.0156514495611191 0.0255663506686687 -0.5172523260116577 <_> <_> <_> 2 3 21 9 -1. <_> 9 3 7 9 3. 0 0.2044613063335419 -0.0763430967926979 0.3323906958103180 <_> <_> <_> 11 9 10 2 -1. <_> 11 9 5 2 2. 0 -0.0101691596210003 0.1606681048870087 -0.1091597974300385 <_> <_> <_> 0 0 24 14 -1. <_> 0 0 12 7 2. <_> 12 7 12 7 2. 0 0.1894780993461609 0.0538599416613579 -0.5398759841918945 <_> <_> <_> 5 2 15 6 -1. <_> 5 4 15 2 3. 0 -0.1479240059852600 0.2385465949773789 -0.1132820993661881 <_> <_> <_> 2 0 16 11 -1. <_> 10 0 8 11 2. 0 -0.1483031064271927 0.3646511137485504 -0.0753156766295433 <_> <_> <_> 5 0 15 6 -1. <_> 5 2 15 2 3. 0 -0.1325532943010330 0.2919555902481079 -0.0949441567063332 <_> <_> <_> 10 5 5 4 -1. <_> 10 6 5 2 2. 0 -0.0163901709020138 0.3920511901378632 -0.0685021281242371 <_> <_> <_> 23 0 2 3 -1. <_> 23 1 2 1 3. 0 -6.3240979798138142e-003 -0.6633772253990173 0.0337768010795116 <_> <_> <_> 0 0 6 3 -1. <_> 0 1 6 1 3. 0 0.0147409504279494 0.0431423708796501 -0.5016931891441345 <_> <_> <_> 10 5 15 2 -1. <_> 10 6 15 1 2. 0 0.0171020403504372 -0.1739968061447144 0.2036074995994568 <_> <_> <_> 0 4 6 4 -1. <_> 0 4 3 2 2. <_> 3 6 3 2 2. 0 -7.5232060626149178e-003 0.2614240050315857 -0.0894730314612389 <_> <_> <_> 21 7 2 4 -1. <_> 20 8 2 2 2. 1 8.0899456515908241e-003 0.0491316393017769 -0.3869245946407318 <_> <_> <_> 4 7 4 2 -1. <_> 5 8 2 2 2. 1 -0.0111914901062846 -0.7151393890380859 0.0292793400585651 <_> <_> <_> 24 13 1 2 -1. <_> 24 14 1 1 2. 0 -6.4855492382775992e-005 0.1147895976901054 -0.1195824965834618 <_> <_> <_> 2 0 4 15 -1. <_> 3 0 2 15 2. 0 0.0263162907212973 0.0260859299451113 -0.8071029186248779 <_> <_> <_> 21 0 4 1 -1. <_> 22 1 2 1 2. 1 -0.0132494196295738 -0.3211443126201630 7.5486088171601295e-003 <_> <_> <_> 4 0 1 4 -1. <_> 3 1 1 2 2. 1 6.2180599197745323e-003 0.0555592402815819 -0.4065248966217041 <_> <_> <_> 1 1 24 14 -1. <_> 13 1 12 7 2. <_> 1 8 12 7 2. 0 0.1724980026483536 0.0407503582537174 -0.5056337714195252 <_> <_> <_> 6 9 6 6 -1. <_> 8 9 2 6 3. 0 -0.0216798391193151 -0.6235452890396118 0.0264780297875404 <_> <_> <_> 5 3 15 4 -1. <_> 10 3 5 4 3. 0 0.0167031493037939 -0.1379484981298447 0.1374935954809189 <_> <_> <_> 0 0 20 10 -1. <_> 5 0 10 10 2. 0 -0.0904578119516373 0.2364515066146851 -0.0822857320308685 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 -0.0319220200181007 0.2578540146350861 -0.0472433306276798 <_> <_> <_> 3 2 7 2 -1. <_> 3 3 7 1 2. 0 -0.0107858600094914 0.1915684044361115 -0.1092626005411148 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 0.0153568601235747 -0.0915980264544487 0.1492947041988373 <_> <_> <_> 0 3 6 12 -1. <_> 0 3 3 6 2. <_> 3 9 3 6 2. 0 -0.0298386197537184 0.3693186044692993 -0.0698615685105324 <_> <_> <_> 19 14 6 1 -1. <_> 19 14 3 1 2. 0 1.5088700456544757e-003 -0.0684053674340248 0.1167493984103203 <_> <_> <_> 4 2 6 13 -1. <_> 6 2 2 13 3. 0 -0.0391593612730503 -0.5139203071594238 0.0376962982118130 <_> <_> <_> 17 14 8 1 -1. <_> 19 14 4 1 2. 0 9.6957627683877945e-003 0.0178152993321419 -0.4685910940170288 <_> <_> <_> 0 14 8 1 -1. <_> 2 14 4 1 2. 0 7.2683161124587059e-004 -0.1310783028602600 0.1574900001287460 <_> <_> <_> 23 11 2 2 -1. <_> 23 11 2 1 2. 1 3.9894571527838707e-003 0.0452235005795956 -0.4237715899944305 <_> <_> <_> 2 11 2 2 -1. <_> 2 11 1 2 2. 1 -5.1600970327854156e-003 -0.5150998830795288 0.0348056405782700 <_> <_> <_> 8 4 9 4 -1. <_> 8 5 9 2 2. 0 -0.0237389300018549 0.2213699966669083 -0.0842292308807373 <_> <_> <_> 8 4 9 3 -1. <_> 8 5 9 1 3. 0 0.0145637700334191 -0.0898087024688721 0.2186468988656998 <_> <_> <_> 22 6 2 4 -1. <_> 23 6 1 2 2. <_> 22 8 1 2 2. 0 7.2849658317863941e-004 -0.0709035396575928 0.1204996034502983 <_> <_> <_> 7 3 6 8 -1. <_> 9 3 2 8 3. 0 -0.0311498604714870 -0.6067348122596741 0.0294798705726862 <_> <_> <_> 22 4 3 4 -1. <_> 22 5 3 2 2. 0 0.0167685598134995 0.0236525908112526 -0.4164066910743713 <_> <_> <_> 3 9 4 2 -1. <_> 4 10 2 2 2. 1 -8.9033348485827446e-003 -0.5536022186279297 0.0302125699818134 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 5.3961132653057575e-004 -0.0588473901152611 0.1531303972005844 <_> <_> <_> 9 11 6 1 -1. <_> 11 11 2 1 3. 0 -8.3886012434959412e-003 -0.7052780985832214 0.0250979401171207 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 -3.4085000515915453e-004 0.1771869063377380 -0.1048467978835106 <_> <_> <_> 0 7 2 4 -1. <_> 0 8 2 2 2. 0 6.1828009784221649e-003 0.0330388285219669 -0.4948574900627136 <_> <_> <_> 20 5 5 6 -1. <_> 20 7 5 2 3. 0 8.2702568033710122e-004 -0.1844830960035324 0.0777885988354683 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 -6.0980831040069461e-004 0.1959578990936279 -0.0837520435452461 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 1.2273030006326735e-004 -0.0814708098769188 0.1209300011396408 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 4.6565610682591796e-004 -0.0953319519758224 0.2288299947977066 <_> <_> <_> 15 0 4 9 -1. <_> 16 0 2 9 2. 0 -0.0216477997601032 -0.6933805942535400 0.0170615408569574 <_> <_> <_> 5 1 14 14 -1. <_> 5 1 7 7 2. <_> 12 8 7 7 2. 0 0.0595006607472897 0.0526031702756882 -0.2782197892665863 <_> <_> <_> 15 0 4 9 -1. <_> 16 0 2 9 2. 0 0.0253651998937130 8.9954538270831108e-003 -0.6383489966392517 <_> <_> <_> 0 7 5 3 -1. <_> 0 8 5 1 3. 0 -3.9667091332376003e-003 -0.3175272047519684 0.0470112897455692 <_> <_> <_> 21 2 3 4 -1. <_> 22 3 1 4 3. 1 8.2784779369831085e-003 -0.0544440597295761 0.2219938933849335 <_> <_> <_> 6 0 4 15 -1. <_> 7 0 2 15 2. 0 -0.0221254508942366 -0.6738150715827942 0.0225456394255161 <_> <_> <_> 21 2 3 4 -1. <_> 22 3 1 4 3. 1 -0.0180159192532301 0.1972057968378067 -0.0419279783964157 <_> <_> <_> 4 2 4 3 -1. <_> 3 3 4 1 3. 1 8.4426235407590866e-003 -0.0605471916496754 0.2649214863777161 <_> <_> <_> 13 5 3 7 -1. <_> 14 6 1 7 3. 1 -0.0325668416917324 -0.7107285857200623 0.0118406098335981 <_> <_> <_> 4 10 15 1 -1. <_> 9 10 5 1 3. 0 -4.7655492089688778e-003 0.1384397000074387 -0.1150531992316246 <_> <_> <_> 12 6 10 9 -1. <_> 12 6 5 9 2. 0 0.0569362901151180 -0.0613397099077702 0.2665694057941437 <_> <_> <_> 1 1 22 14 -1. <_> 12 1 11 14 2. 0 0.1374146044254303 -0.1139679029583931 0.1789363026618958 <_> <_> <_> 11 8 3 2 -1. <_> 11 9 3 1 2. 0 3.4123009536415339e-003 -0.0668940767645836 0.2595616877079010 <_> <_> <_> 2 5 11 2 -1. <_> 2 6 11 1 2. 0 0.0116290198639035 -0.1346206963062286 0.1518495976924896 -1.3217060565948486 8 -1 <_> <_> <_> <_> 4 1 10 4 -1. <_> 3 2 10 2 2. 1 -0.0302658006548882 0.3809668123722076 -0.1337769925594330 <_> <_> <_> 5 1 15 6 -1. <_> 5 3 15 2 3. 0 -0.1888993978500366 0.3472220003604889 -0.1143490970134735 <_> <_> <_> 0 9 6 6 -1. <_> 0 9 3 3 2. <_> 3 12 3 3 2. 0 4.4756601564586163e-003 -0.1779001951217651 0.1983720064163208 <_> <_> <_> 19 3 5 2 -1. <_> 19 4 5 1 2. 0 -9.2559102922677994e-003 0.2553296089172363 -0.0956856831908226 <_> <_> <_> 2 10 14 4 -1. <_> 2 10 7 2 2. <_> 9 12 7 2 2. 0 0.0103751895949245 -0.1290100961923599 0.2047273963689804 <_> <_> <_> 1 3 24 8 -1. <_> 9 3 8 8 3. 0 0.2527360022068024 -0.0779134780168533 0.3413710892200470 <_> <_> <_> 0 8 2 6 -1. <_> 0 10 2 2 3. 0 7.9952310770750046e-003 0.1191667988896370 -0.4138369858264923 <_> <_> <_> 23 14 2 1 -1. <_> 23 14 1 1 2. 0 6.6510503529570997e-005 -0.2305306047201157 0.1328932046890259 <_> <_> <_> 0 4 6 4 -1. <_> 0 4 3 2 2. <_> 3 6 3 2 2. 0 0.0104297399520874 -0.0622061118483543 0.2935121059417725 <_> <_> <_> 3 13 21 1 -1. <_> 10 13 7 1 3. 0 -9.4513092190027237e-003 0.1671503931283951 -0.1161310002207756 <_> <_> <_> 0 0 24 14 -1. <_> 0 0 12 7 2. <_> 12 7 12 7 2. 0 -0.1386305987834930 -0.4514685869216919 0.0725729763507843 <_> <_> <_> 24 0 1 10 -1. <_> 24 5 1 5 2. 0 -0.0154232997447252 -0.4277118146419525 0.0248409193009138 <_> <_> <_> 4 11 2 2 -1. <_> 4 11 1 2 2. 1 -6.5782992169260979e-003 -0.6540787816047669 0.0402618311345577 <_> <_> <_> 23 14 2 1 -1. <_> 23 14 1 1 2. 0 -6.8917557655368000e-005 0.2068260014057159 -0.1195247992873192 <_> <_> <_> 0 14 2 1 -1. <_> 1 14 1 1 2. 0 7.1416288847103715e-005 -0.1625899970531464 0.1518989056348801 <_> <_> <_> 7 2 11 6 -1. <_> 7 4 11 2 3. 0 0.1354866027832031 -0.0504554286599159 0.4712490141391754 <_> <_> <_> 2 2 2 2 -1. <_> 2 2 1 2 2. 1 1.1286230292171240e-003 -0.1934940963983536 0.1492028981447220 <_> <_> <_> 24 0 1 10 -1. <_> 24 5 1 5 2. 0 0.0376871302723885 -6.5130472648888826e-004 -0.5566216707229614 <_> <_> <_> 0 0 1 10 -1. <_> 0 5 1 5 2. 0 -0.0177724994719028 -0.5733047127723694 0.0462512709200382 <_> <_> <_> 12 11 6 2 -1. <_> 14 11 2 2 3. 0 -0.0141524598002434 -0.7905998826026917 0.0153570203110576 <_> <_> <_> 2 0 20 2 -1. <_> 7 0 10 2 2. 0 -0.0194474104791880 0.2123239040374756 -0.1021943986415863 <_> <_> <_> 10 0 10 4 -1. <_> 10 0 5 4 2. 0 0.0129150198772550 -0.0788644626736641 0.1457864940166473 <_> <_> <_> 0 0 20 1 -1. <_> 10 0 10 1 2. 0 7.7283121645450592e-003 -0.1338106989860535 0.2055318057537079 <_> <_> <_> 8 4 10 3 -1. <_> 8 5 10 1 3. 0 -0.0264210291206837 0.2729040980339050 -0.0841038301587105 <_> <_> <_> 9 6 7 6 -1. <_> 9 8 7 2 3. 0 -0.0216425806283951 0.2165616005659103 -0.0997976064682007 <_> <_> <_> 8 5 9 3 -1. <_> 8 6 9 1 3. 0 -0.0186041705310345 0.3167817890644074 -0.0684646219015121 <_> <_> <_> 6 0 1 3 -1. <_> 5 1 1 1 3. 1 7.9184472560882568e-003 0.0389325916767120 -0.5849621891975403 <_> <_> <_> 24 0 1 4 -1. <_> 24 2 1 2 2. 0 -9.0868779807351530e-005 0.1183537989854813 -0.2693997025489807 <_> <_> <_> 9 10 2 1 -1. <_> 10 10 1 1 2. 0 -6.3271610997617245e-005 0.1483621001243591 -0.1414014995098114 <_> <_> <_> 22 10 1 4 -1. <_> 21 11 1 2 2. 1 3.0123859178274870e-003 0.0475597009062767 -0.3168076872825623 <_> <_> <_> 4 0 6 5 -1. <_> 6 0 2 5 3. 0 0.0202028602361679 0.0363369397819042 -0.4958786964416504 <_> <_> <_> 17 3 8 12 -1. <_> 21 3 4 6 2. <_> 17 9 4 6 2. 0 0.0681129470467567 -0.0636018067598343 0.3745648860931397 <_> <_> <_> 0 3 8 12 -1. <_> 0 3 4 6 2. <_> 4 9 4 6 2. 0 -0.0613449215888977 0.3703984022140503 -0.0626903176307678 <_> <_> <_> 10 3 6 10 -1. <_> 13 3 3 5 2. <_> 10 8 3 5 2. 0 -0.0239223092794418 -0.3475331962108612 0.0568292401731014 <_> <_> <_> 3 10 4 1 -1. <_> 4 11 2 1 2. 1 4.4279401190578938e-003 0.0318974405527115 -0.5085908770561218 <_> <_> <_> 16 2 9 4 -1. <_> 16 2 9 2 2. 1 -0.0923664569854736 -0.4889659881591797 9.9938698112964630e-003 <_> <_> <_> 9 2 4 9 -1. <_> 9 2 2 9 2. 1 -3.1878310255706310e-003 0.0857494324445724 -0.2382344007492065 <_> <_> <_> 20 9 3 3 -1. <_> 20 10 3 1 3. 0 6.2605291604995728e-003 0.0244128108024597 -0.5500137209892273 <_> <_> <_> 6 1 13 4 -1. <_> 6 2 13 2 2. 0 0.0217170491814613 -0.0847987011075020 0.2182479947805405 <_> <_> <_> 10 4 5 4 -1. <_> 10 5 5 2 2. 0 0.0102959601208568 -0.1032914966344833 0.1945870965719223 <_> <_> <_> 0 5 3 3 -1. <_> 0 6 3 1 3. 0 0.0121496301144362 0.0322238989174366 -0.5932865738868713 <_> <_> <_> 21 5 4 4 -1. <_> 21 6 4 2 2. 0 0.0191168300807476 0.0309407506138086 -0.4538871943950653 <_> <_> <_> 0 5 4 4 -1. <_> 0 6 4 2 2. 0 7.1067700628191233e-004 -0.1545806974172592 0.1262297928333283 <_> <_> <_> 8 9 9 6 -1. <_> 8 11 9 2 3. 0 -0.0294274203479290 0.2070481926202774 -0.0861818864941597 <_> <_> <_> 4 11 3 1 -1. <_> 5 12 1 1 3. 1 -3.7067469675093889e-003 -0.5155926942825317 0.0383589081466198 <_> <_> <_> 23 14 2 1 -1. <_> 23 14 1 1 2. 0 6.0146670875838026e-005 -0.1023617982864380 0.0884054377675056 <_> <_> <_> 0 14 2 1 -1. <_> 1 14 1 1 2. 0 -6.8713612563442439e-005 0.1984436959028244 -0.0994443595409393 <_> <_> <_> 11 1 4 14 -1. <_> 11 8 4 7 2. 0 -0.0848333984613419 -0.3900933861732483 0.0397581607103348 <_> <_> <_> 4 0 2 3 -1. <_> 3 1 2 1 3. 1 0.0115453395992517 0.0299104899168015 -0.5021548867225647 <_> <_> <_> 24 12 1 2 -1. <_> 24 13 1 1 2. 0 1.2721769744530320e-003 0.0357883498072624 -0.3856284022331238 <_> <_> <_> 0 1 14 14 -1. <_> 0 8 14 7 2. 0 0.3789406120777130 0.0429151207208633 -0.3726823925971985 <_> <_> <_> 13 0 6 15 -1. <_> 15 0 2 15 3. 0 0.0587286688387394 0.0175066608935595 -0.7129334807395935 <_> <_> <_> 0 1 1 4 -1. <_> 0 3 1 2 2. 0 -7.2667418862693012e-005 0.0852374136447906 -0.1796067953109741 <_> <_> <_> 24 13 1 2 -1. <_> 24 14 1 1 2. 0 -2.5661939289420843e-003 -0.4941900074481964 0.0211067497730255 <_> <_> <_> 0 13 1 2 -1. <_> 0 14 1 1 2. 0 -6.2544771935790777e-005 0.1260727941989899 -0.1358107030391693 <_> <_> <_> 23 11 2 4 -1. <_> 23 12 2 2 2. 0 -3.3382088877260685e-003 -0.3425475955009460 0.0313290804624558 <_> <_> <_> 0 11 2 4 -1. <_> 0 12 2 2 2. 0 4.0032588876783848e-003 0.0353341810405254 -0.4785414040088654 <_> <_> <_> 16 10 2 2 -1. <_> 17 10 1 1 2. <_> 16 11 1 1 2. 0 7.8725446655880660e-005 -0.0865093916654587 0.1098069027066231 <_> <_> <_> 7 10 2 2 -1. <_> 7 10 1 1 2. <_> 8 11 1 1 2. 0 3.5411381395533681e-004 -0.0866223275661469 0.1815810948610306 <_> <_> <_> 1 0 24 6 -1. <_> 13 0 12 3 2. <_> 1 3 12 3 2. 0 -0.1003293022513390 -0.4118100106716156 0.0407990105450153 <_> <_> <_> 6 1 6 12 -1. <_> 8 1 2 12 3. 0 0.0457341782748699 0.0250630006194115 -0.5801063179969788 <_> <_> <_> 19 6 6 3 -1. <_> 19 7 6 1 3. 0 0.0143571095541120 0.0273739993572235 -0.3111906945705414 <_> <_> <_> 5 6 7 2 -1. <_> 5 7 7 1 2. 0 4.2823958210647106e-003 -0.1212206035852432 0.1300680041313171 <_> <_> <_> 9 6 7 4 -1. <_> 9 7 7 2 2. 0 -0.0191692691296339 0.3547115027904511 -0.0586979016661644 <_> <_> <_> 0 6 6 3 -1. <_> 0 7 6 1 3. 0 0.0203719399869442 0.0270470399409533 -0.6216102838516235 <_> <_> <_> 6 8 13 4 -1. <_> 6 9 13 2 2. 0 -0.0119816595688462 0.1762886941432953 -0.0943156927824020 <_> <_> <_> 7 10 2 2 -1. <_> 7 10 1 1 2. <_> 8 11 1 1 2. 0 -9.4278322649188340e-005 0.1507049947977066 -0.1071290969848633 <_> <_> <_> 12 11 6 2 -1. <_> 14 11 2 2 3. 0 0.0101822800934315 0.0161433499306440 -0.3503915071487427 <_> <_> <_> 6 0 12 10 -1. <_> 6 0 6 5 2. <_> 12 5 6 5 2. 0 -0.0520590804517269 -0.3121460080146790 0.0477841906249523 <_> <_> <_> 12 11 6 2 -1. <_> 14 11 2 2 3. 0 -0.0249434690922499 -0.7933396100997925 -4.0430951048620045e-004 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 -6.2259827973321080e-004 0.2043831050395966 -0.0712744519114494 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 -5.6859298638300970e-005 0.0861500576138496 -0.0658712089061737 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 4.0834350511431694e-004 -0.1051706001162529 0.2224697023630142 <_> <_> <_> 12 11 6 2 -1. <_> 14 11 2 2 3. 0 -1.1075460352003574e-003 0.0464305393397808 -0.0319086797535419 <_> <_> <_> 7 11 6 2 -1. <_> 9 11 2 2 3. 0 -0.0123662399128079 -0.6207143068313599 0.0261646900326014 <_> <_> <_> 5 12 18 3 -1. <_> 11 12 6 3 3. 0 -0.0354762189090252 0.1230582967400551 -0.0519298203289509 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 -2.3794448934495449e-003 -0.3795419931411743 0.0417488515377045 <_> <_> <_> 21 4 4 2 -1. <_> 23 4 2 1 2. <_> 21 5 2 1 2. 0 1.3966970145702362e-003 -0.0851486772298813 0.1512037962675095 <_> <_> <_> 9 3 7 3 -1. <_> 9 4 7 1 3. 0 5.1437891088426113e-003 -0.0816644281148911 0.1789588034152985 <_> <_> <_> 13 2 8 5 -1. <_> 15 4 4 5 2. 1 -0.1239939033985138 -0.6658980846405029 9.5204189419746399e-003 <_> <_> <_> 12 1 6 4 -1. <_> 11 2 6 2 2. 1 0.0393908508121967 0.0182536505162716 -0.7637290954589844 <_> <_> <_> 22 0 2 2 -1. <_> 22 1 2 1 2. 0 2.9372270219027996e-003 0.0226261299103498 -0.3233875036239624 <_> <_> <_> 4 1 16 12 -1. <_> 12 1 8 12 2. 0 0.1816650927066803 -0.0618673898279667 0.2298932969570160 <_> <_> <_> 3 0 20 10 -1. <_> 3 0 10 10 2. 0 0.0892752110958099 -0.0848015919327736 0.2109096944332123 <_> <_> <_> 0 4 6 6 -1. <_> 0 4 3 3 2. <_> 3 7 3 3 2. 0 0.0179201308637857 -0.0663900971412659 0.2243462055921555 <_> <_> <_> 22 4 3 3 -1. <_> 23 5 1 3 3. 1 5.5024111643433571e-003 -0.0559136196970940 0.1079157963395119 <_> <_> <_> 3 4 3 3 -1. <_> 2 5 3 1 3. 1 -0.0126318400725722 0.3352184891700745 -0.0470694787800312 <_> <_> <_> 22 7 3 4 -1. <_> 22 8 3 2 2. 0 8.2040186971426010e-003 0.0521674789488316 -0.5830680727958679 <_> <_> <_> 3 1 4 7 -1. <_> 4 1 2 7 2. 0 0.0215438604354858 0.0103719802573323 -0.8169081807136536 <_> <_> <_> 22 7 3 4 -1. <_> 22 8 3 2 2. 0 -4.2779878713190556e-003 -0.3437061011791229 0.0348356589674950 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 9.5721762627363205e-003 0.0160374492406845 -0.7592146992683411 <_> <_> <_> 18 4 6 2 -1. <_> 18 5 6 1 2. 0 5.9499992057681084e-003 -0.0835138633847237 0.0937561765313149 <_> <_> <_> 5 3 15 6 -1. <_> 5 5 15 2 3. 0 -0.0868803784251213 0.1977919936180115 -0.0735685229301453 <_> <_> <_> 16 4 8 4 -1. <_> 16 5 8 2 2. 0 5.7690730318427086e-003 -0.0611343309283257 0.0826714411377907 <_> <_> <_> 0 1 24 10 -1. <_> 0 1 12 5 2. <_> 12 6 12 5 2. 0 0.1480645984411240 0.0396532900631428 -0.4085262119770050 <_> <_> <_> 14 0 4 7 -1. <_> 15 0 2 7 2. 0 -0.0186682697385550 -0.6671301126480103 0.0156445093452930 <_> <_> <_> 0 7 3 4 -1. <_> 0 8 3 2 2. 0 0.0101426700130105 0.0211487896740437 -0.5610821843147278 <_> <_> <_> 18 5 4 4 -1. <_> 20 5 2 2 2. <_> 18 7 2 2 2. 0 -2.6263110339641571e-003 0.0881423130631447 -0.0586008317768574 <_> <_> <_> 5 5 6 2 -1. <_> 5 5 3 1 2. <_> 8 6 3 1 2. 0 3.0406240839511156e-003 -0.0699731782078743 0.1942113041877747 <_> <_> <_> 21 9 2 3 -1. <_> 21 10 2 1 3. 0 -4.0523111820220947e-003 -0.3989843130111694 0.0284519009292126 <_> <_> <_> 7 1 2 2 -1. <_> 7 1 1 1 2. <_> 8 2 1 1 2. 0 3.3293411252088845e-004 -0.0920187085866928 0.1521372944116592 <_> <_> <_> 16 1 2 2 -1. <_> 17 1 1 1 2. <_> 16 2 1 1 2. 0 -1.4471479516942054e-004 0.1328881978988648 -0.0869787335395813 -1.4393190145492554 9 -1 <_> <_> <_> <_> 9 7 7 6 -1. <_> 9 9 7 2 3. 0 -0.0305288899689913 0.3361127972602844 -0.1605879068374634 <_> <_> <_> 17 2 7 2 -1. <_> 17 3 7 1 2. 0 -6.8238358944654465e-003 0.2510839104652405 -0.2578383982181549 <_> <_> <_> 4 2 9 4 -1. <_> 3 3 9 2 2. 1 -0.0260700508952141 0.3176701068878174 -0.1111562028527260 <_> <_> <_> 19 14 6 1 -1. <_> 19 14 3 1 2. 0 1.6021650517359376e-003 -0.1096177026629448 0.1561331003904343 <_> <_> <_> 6 9 11 6 -1. <_> 6 11 11 2 3. 0 -0.0346175394952297 0.2614395916461945 -0.0955564379692078 <_> <_> <_> 17 3 8 12 -1. <_> 21 3 4 6 2. <_> 17 9 4 6 2. 0 0.0825498923659325 -0.0359772108495235 0.3189736902713776 <_> <_> <_> 0 7 24 8 -1. <_> 0 7 12 4 2. <_> 12 11 12 4 2. 0 -0.1079908013343811 -0.4661987125873566 0.0965379774570465 <_> <_> <_> 5 3 16 12 -1. <_> 13 3 8 6 2. <_> 5 9 8 6 2. 0 -0.0710962936282158 -0.3290941119194031 0.0201707594096661 <_> <_> <_> 0 3 24 6 -1. <_> 8 5 8 2 9. 0 0.6102272272109985 -0.0410851910710335 0.5919780731201172 <_> <_> <_> 1 8 24 1 -1. <_> 7 8 12 1 2. 0 -9.6180485561490059e-003 0.1845327019691467 -0.1256957054138184 <_> <_> <_> 1 9 14 6 -1. <_> 1 9 7 3 2. <_> 8 12 7 3 2. 0 -0.0216567497700453 0.3558863103389740 -0.0654195472598076 <_> <_> <_> 19 5 3 2 -1. <_> 19 6 3 1 2. 0 3.2288730144500732e-003 -0.1597114056348801 0.1442176997661591 <_> <_> <_> 0 14 10 1 -1. <_> 5 14 5 1 2. 0 3.6023850552737713e-003 -0.1301265954971314 0.1848530024290085 <_> <_> <_> 5 1 15 6 -1. <_> 5 3 15 2 3. 0 0.1224254965782166 -0.0509620085358620 0.4787274003028870 <_> <_> <_> 1 1 7 6 -1. <_> 1 3 7 2 3. 0 -0.0398168414831162 0.1911015063524246 -0.1490415036678314 <_> <_> <_> 15 12 6 3 -1. <_> 17 13 2 1 9. 0 0.0165654607117176 0.0250385701656342 -0.2660810947418213 <_> <_> <_> 4 0 1 3 -1. <_> 3 1 1 1 3. 1 6.7314971238374710e-003 0.0361662209033966 -0.5751237273216248 <_> <_> <_> 1 12 24 3 -1. <_> 7 12 12 3 2. 0 -0.0238826293498278 0.1817242056131363 -0.1013408973813057 <_> <_> <_> 3 12 6 3 -1. <_> 5 13 2 1 9. 0 0.0168766304850578 0.0499957092106342 -0.4964488148689270 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 0.0814632922410965 0.0508196912705898 -0.3092927038669586 <_> <_> <_> 2 0 21 15 -1. <_> 9 0 7 15 3. 0 0.1567866057157517 -0.0846417918801308 0.2097589969635010 <_> <_> <_> 17 3 6 2 -1. <_> 17 4 6 1 2. 0 0.0107369897887111 -0.0588766187429428 0.2673564851284027 <_> <_> <_> 3 3 14 2 -1. <_> 3 4 14 1 2. 0 -0.0162507798522711 0.2185824960470200 -0.1275278925895691 <_> <_> <_> 4 0 21 4 -1. <_> 11 0 7 4 3. 0 -0.0513998307287693 0.1707165986299515 -0.0564976185560226 <_> <_> <_> 6 13 4 1 -1. <_> 7 13 2 1 2. 0 1.8661050125956535e-003 0.0403385981917381 -0.4740450084209442 <_> <_> <_> 17 3 8 12 -1. <_> 21 3 4 6 2. <_> 17 9 4 6 2. 0 -0.0494354106485844 0.1537600010633469 -0.0417859293520451 <_> <_> <_> 0 3 8 12 -1. <_> 0 3 4 6 2. <_> 4 9 4 6 2. 0 0.0696671828627586 -0.0588539093732834 0.3099964857101440 <_> <_> <_> 5 0 16 8 -1. <_> 13 0 8 4 2. <_> 5 4 8 4 2. 0 -0.0781185403466225 -0.4109517037868500 0.0523068793118000 <_> <_> <_> 3 7 4 2 -1. <_> 4 8 2 2 2. 1 -8.6161941289901733e-003 -0.5668942928314209 0.0286804605275393 <_> <_> <_> 5 11 15 4 -1. <_> 5 12 15 2 2. 0 6.8916371092200279e-003 -0.0957784205675125 0.1680631041526794 <_> <_> <_> 10 13 1 2 -1. <_> 10 14 1 1 2. 0 8.4734419942833483e-005 -0.1476065963506699 0.1278074979782105 <_> <_> <_> 12 14 6 1 -1. <_> 14 14 2 1 3. 0 -6.5460228361189365e-003 -0.5353912711143494 0.0211423803120852 <_> <_> <_> 9 5 6 4 -1. <_> 9 6 6 2 2. 0 -0.0119369700551033 0.2489618957042694 -0.0659059137105942 <_> <_> <_> 12 5 13 2 -1. <_> 12 6 13 1 2. 0 0.0160134993493557 -0.0751639306545258 0.0920000970363617 <_> <_> <_> 5 0 15 6 -1. <_> 5 2 15 2 3. 0 -0.1797882020473480 0.3122220933437347 -0.0546800307929516 <_> <_> <_> 3 0 20 15 -1. <_> 3 0 10 15 2. 0 0.4293603003025055 -0.0467442497611046 0.4671711027622223 <_> <_> <_> 1 1 22 14 -1. <_> 12 1 11 14 2. 0 0.1762980967760086 -0.1196762025356293 0.2303612977266312 <_> <_> <_> 15 5 10 2 -1. <_> 15 6 10 1 2. 0 0.0434980615973473 0.0213767793029547 -0.3402695953845978 <_> <_> <_> 0 5 13 2 -1. <_> 0 6 13 1 2. 0 0.0168955195695162 -0.1305568963289261 0.1834042966365814 <_> <_> <_> 5 2 15 4 -1. <_> 5 3 15 2 2. 0 0.0185353793203831 -0.0754243135452271 0.2354936003684998 <_> <_> <_> 5 4 15 3 -1. <_> 5 5 15 1 3. 0 0.0173294302076101 -0.0853839814662933 0.2036404013633728 <_> <_> <_> 21 11 4 4 -1. <_> 21 12 4 2 2. 0 8.6630741134285927e-003 0.0385910011827946 -0.6201460957527161 <_> <_> <_> 5 0 1 2 -1. <_> 5 0 1 1 2. 1 5.7052681222558022e-003 0.0312472805380821 -0.4070529043674469 <_> <_> <_> 23 3 2 4 -1. <_> 23 3 1 4 2. 0 -1.8030379433184862e-003 0.1957851052284241 -0.1433366984128952 <_> <_> <_> 7 1 4 6 -1. <_> 8 1 2 6 2. 0 -0.0187879204750061 -0.8691418766975403 0.0169819705188274 <_> <_> <_> 8 6 11 3 -1. <_> 8 7 11 1 3. 0 0.0186009202152491 -0.0818153098225594 0.1891387999057770 <_> <_> <_> 0 13 2 1 -1. <_> 1 13 1 1 2. 0 8.4120598330628127e-005 -0.1289912015199661 0.1211050972342491 <_> <_> <_> 21 12 3 3 -1. <_> 21 13 3 1 3. 0 -5.6057129986584187e-003 -0.4698300957679749 0.0159890707582235 <_> <_> <_> 1 12 3 3 -1. <_> 1 13 3 1 3. 0 3.5192570649087429e-003 0.0361930206418037 -0.4484112858772278 <_> <_> <_> 23 3 2 4 -1. <_> 23 3 1 4 2. 0 1.7741440096870065e-003 -0.0433034710586071 0.1395574957132340 <_> <_> <_> 0 3 2 4 -1. <_> 1 3 1 4 2. 0 -1.6350420191884041e-003 0.1395068019628525 -0.1124152988195419 <_> <_> <_> 21 3 4 10 -1. <_> 23 3 2 5 2. <_> 21 8 2 5 2. 0 6.4794770441949368e-003 -0.0600515604019165 0.0728941932320595 <_> <_> <_> 0 3 4 10 -1. <_> 0 3 2 5 2. <_> 2 8 2 5 2. 0 -0.0203247498720884 0.4297815859317780 -0.0396846085786819 <_> <_> <_> 24 1 1 4 -1. <_> 24 2 1 2 2. 0 -6.3453041948378086e-003 -0.2533842921257019 0.0242939405143261 <_> <_> <_> 0 0 1 6 -1. <_> 0 2 1 2 3. 0 9.0959975495934486e-003 0.0340887792408466 -0.4518730044364929 <_> <_> <_> 16 1 4 4 -1. <_> 17 1 2 4 2. 0 0.0161635801196098 6.8225921131670475e-003 -0.7205737829208374 <_> <_> <_> 5 1 4 4 -1. <_> 6 1 2 4 2. 0 -0.0112293101847172 -0.6191986203193665 0.0222914796322584 <_> <_> <_> 15 2 10 12 -1. <_> 15 8 10 6 2. 0 -0.1763328015804291 -0.6819115877151489 8.8407555595040321e-003 <_> <_> <_> 8 5 9 3 -1. <_> 8 6 9 1 3. 0 0.0192962400615215 -0.0796290487051010 0.2013067007064819 <_> <_> <_> 6 7 14 2 -1. <_> 6 8 14 1 2. 0 0.0105654401704669 -0.0832984521985054 0.1872760951519013 <_> <_> <_> 10 7 5 4 -1. <_> 10 8 5 2 2. 0 -6.7616738379001617e-003 0.2069583982229233 -0.0813189968466759 <_> <_> <_> 23 12 2 3 -1. <_> 23 13 2 1 3. 0 -2.3086878936737776e-003 -0.2798121869564056 0.0293897707015276 <_> <_> <_> 0 7 4 4 -1. <_> 0 8 4 2 2. 0 -6.9189318455755711e-003 -0.5095586180686951 0.0291001908481121 <_> <_> <_> 3 13 21 2 -1. <_> 10 13 7 2 3. 0 -0.0195926092565060 0.1248695999383926 -0.0666698589920998 <_> <_> <_> 6 1 3 1 -1. <_> 7 1 1 1 3. 0 -5.6698801927268505e-004 0.1772525012493134 -0.0755556300282478 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 6.5187108702957630e-004 -0.0468317084014416 0.1377387940883637 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 -4.3244438711553812e-004 0.1750548034906387 -0.0822173282504082 <_> <_> <_> 23 12 2 3 -1. <_> 23 13 2 1 3. 0 3.2091289758682251e-003 0.0258904304355383 -0.3546032905578613 <_> <_> <_> 8 8 9 2 -1. <_> 11 8 3 2 3. 0 -0.0288993604481220 -0.7315214276313782 0.0180548094213009 <_> <_> <_> 23 12 2 3 -1. <_> 23 13 2 1 3. 0 9.8803699074778706e-005 -0.0383186303079128 0.0343451388180256 <_> <_> <_> 0 12 2 3 -1. <_> 0 13 2 1 3. 0 -2.2848090156912804e-003 -0.3603490889072418 0.0380517281591892 <_> <_> <_> 8 4 9 9 -1. <_> 8 7 9 3 3. 0 0.2230083048343658 -0.0353877097368240 0.4118692874908447 <_> <_> <_> 3 11 12 4 -1. <_> 3 11 6 2 2. <_> 9 13 6 2 2. 0 3.8663020823150873e-003 -0.1147940978407860 0.1196625977754593 <_> <_> <_> 10 10 5 4 -1. <_> 10 11 5 2 2. 0 3.6781090311706066e-003 -0.0887862071394920 0.2093122005462647 <_> <_> <_> 7 14 6 1 -1. <_> 9 14 2 1 3. 0 3.6886930465698242e-003 0.0420652516186237 -0.3311671912670136 <_> <_> <_> 4 0 18 15 -1. <_> 4 0 9 15 2. 0 -0.5000842809677124 0.4582319855690002 -0.0300164502114058 <_> <_> <_> 0 3 4 4 -1. <_> 1 3 2 4 2. 0 3.2457590568810701e-003 -0.0581394806504250 0.2244455963373184 <_> <_> <_> 22 0 3 4 -1. <_> 22 2 3 2 2. 0 -7.2515371721237898e-004 0.0857456997036934 -0.2164471000432968 <_> <_> <_> 0 0 20 8 -1. <_> 5 0 10 8 2. 0 0.0756241232156754 -0.0728698670864105 0.1809341013431549 <_> <_> <_> 1 5 24 10 -1. <_> 13 5 12 5 2. <_> 1 10 12 5 2. 0 -0.1401147991418839 -0.3049497008323669 0.0322263389825821 <_> <_> <_> 0 5 5 6 -1. <_> 0 7 5 2 3. 0 1.2914249673485756e-003 -0.1651930958032608 0.0796989724040031 <_> <_> <_> 18 3 4 2 -1. <_> 18 4 4 1 2. 0 4.8063062131404877e-003 -0.0511631406843662 0.1528493016958237 <_> <_> <_> 2 3 4 2 -1. <_> 2 3 4 1 2. 1 0.0197005104273558 -0.0214679203927517 0.5898631215095520 <_> <_> <_> 14 1 6 6 -1. <_> 16 1 2 6 3. 0 -0.0282465498894453 -0.3611007034778595 0.0215946007519960 <_> <_> <_> 5 1 6 6 -1. <_> 7 1 2 6 3. 0 0.0318388007581234 0.0213881190866232 -0.5591915845870972 <_> <_> <_> 11 10 6 1 -1. <_> 13 10 2 1 3. 0 5.2926959469914436e-003 0.0171414706856012 -0.3245368003845215 <_> <_> <_> 6 8 11 4 -1. <_> 6 9 11 2 2. 0 9.3176206573843956e-003 -0.0691479519009590 0.1877806931734085 <_> <_> <_> 23 13 2 2 -1. <_> 24 13 1 1 2. <_> 23 14 1 1 2. 0 1.9812679965980351e-004 -0.0710251703858376 0.1166272014379501 <_> <_> <_> 6 0 13 4 -1. <_> 6 1 13 2 2. 0 0.0172033403068781 -0.0834768265485764 0.1448491960763931 <_> <_> <_> 17 0 3 1 -1. <_> 18 1 1 1 3. 1 8.0548562109470367e-003 0.0214444492012262 -0.2763100862503052 <_> <_> <_> 8 0 1 3 -1. <_> 7 1 1 1 3. 1 6.7419088445603848e-003 0.0341341383755207 -0.3555370867252350 <_> <_> <_> 22 12 2 2 -1. <_> 23 12 1 1 2. <_> 22 13 1 1 2. 0 5.7136920077027753e-005 -0.0699329003691673 0.0822271332144737 <_> <_> <_> 0 13 2 1 -1. <_> 1 13 1 1 2. 0 -6.0014430346200243e-005 0.1533315926790237 -0.0801942795515060 <_> <_> <_> 22 13 2 1 -1. <_> 22 13 1 1 2. 0 -6.6377622715663165e-005 0.0740585327148438 -0.0435769110918045 <_> <_> <_> 1 13 2 1 -1. <_> 2 13 1 1 2. 0 7.0605492510367185e-005 -0.1192411035299301 0.1157367005944252 <_> <_> <_> 22 13 3 1 -1. <_> 23 13 1 1 3. 0 7.2301438194699585e-005 -0.0702318474650383 0.0793638303875923 <_> <_> <_> 1 2 2 12 -1. <_> 2 2 1 12 2. 0 -1.4867830323055387e-003 0.1245760992169380 -0.1076287999749184 <_> <_> <_> 18 3 4 2 -1. <_> 18 4 4 1 2. 0 -5.2434820681810379e-003 0.1116774976253510 -0.0614912398159504 <_> <_> <_> 3 3 4 2 -1. <_> 3 4 4 1 2. 0 7.8055239282548428e-003 -0.0496800504624844 0.3046393096446991 <_> <_> <_> 24 0 1 12 -1. <_> 24 3 1 6 2. 0 0.0167157892137766 0.0242684707045555 -0.5641499757766724 <_> <_> <_> 5 8 15 6 -1. <_> 5 10 15 2 3. 0 -0.0197794307023287 0.1293102055788040 -0.1014008000493050 <_> <_> <_> 19 7 6 2 -1. <_> 19 7 6 1 2. 1 -6.7752218456007540e-005 0.0773630663752556 -0.0876037329435349 <_> <_> <_> 1 10 5 3 -1. <_> 1 11 5 1 3. 0 -0.0129433302208781 -0.8692914843559265 0.0158042199909687 <_> <_> <_> 24 0 1 12 -1. <_> 24 3 1 6 2. 0 -0.0125468103215098 -0.1350758969783783 0.0456306189298630 <_> <_> <_> 0 0 1 12 -1. <_> 0 3 1 6 2. 0 7.9727862030267715e-003 0.0405779294669628 -0.3409133851528168 <_> <_> <_> 9 0 12 1 -1. <_> 13 0 4 1 3. 0 -6.3152899965643883e-003 0.1372991949319840 -0.0561671592295170 <_> <_> <_> 4 0 12 1 -1. <_> 8 0 4 1 3. 0 -3.6897659301757813e-003 0.1639326065778732 -0.0914164036512375 <_> <_> <_> 3 0 20 1 -1. <_> 8 0 10 1 2. 0 5.0578881055116653e-003 -0.0800797268748283 0.1433712989091873 <_> <_> <_> 1 0 9 2 -1. <_> 4 0 3 2 3. 0 -0.0299335699528456 -0.5326762199401856 0.0227312203496695 <_> <_> <_> 11 6 8 2 -1. <_> 11 7 8 1 2. 0 7.0810988545417786e-003 -0.0732182189822197 0.1027508974075317 <_> <_> <_> 11 3 3 8 -1. <_> 11 7 3 4 2. 0 0.0508137904107571 0.0516868904232979 -0.2544622123241425 <_> <_> <_> 20 4 4 2 -1. <_> 21 5 2 2 2. 1 4.7044758684933186e-003 -0.0572907589375973 0.0760648325085640 <_> <_> <_> 6 7 2 6 -1. <_> 6 7 1 6 2. 1 4.6408819034695625e-003 0.0559986904263496 -0.2172269970178604 <_> <_> <_> 20 4 4 2 -1. <_> 21 5 2 2 2. 1 -9.5121748745441437e-003 0.1812860071659088 -0.0377242304384708 <_> <_> <_> 5 4 2 4 -1. <_> 4 5 2 2 2. 1 2.5726249441504478e-003 -0.1238458007574081 0.1421934068202972 -1.3500690460205078 10 -1 <_> <_> <_> <_> 7 5 11 3 -1. <_> 7 6 11 1 3. 0 0.0184330195188522 -0.1618741005659103 0.3351263999938965 <_> <_> <_> 20 1 3 4 -1. <_> 20 2 3 2 2. 0 4.8202150501310825e-003 -0.0972008332610130 0.2755692005157471 <_> <_> <_> 8 4 9 3 -1. <_> 8 5 9 1 3. 0 0.0214508101344109 -0.1013654991984367 0.3922119140625000 <_> <_> <_> 9 6 9 3 -1. <_> 9 7 9 1 3. 0 0.0201995000243187 -0.1041551977396011 0.3485709130764008 <_> <_> <_> 0 7 8 8 -1. <_> 0 7 4 4 2. <_> 4 11 4 4 2. 0 0.0154604399576783 -0.1814713031053543 0.2296576052904129 <_> <_> <_> 9 7 7 3 -1. <_> 9 8 7 1 3. 0 0.0121146701276302 -0.0955794528126717 0.3321264982223511 <_> <_> <_> 8 3 9 3 -1. <_> 8 4 9 1 3. 0 0.0166161693632603 -0.0751067474484444 0.3475660085678101 <_> <_> <_> 21 1 1 6 -1. <_> 19 3 1 2 3. 1 -0.0151290399953723 0.1396238952875137 -0.1150512024760246 <_> <_> <_> 0 7 24 5 -1. <_> 6 7 12 5 2. 0 -0.0707296282052994 0.2683610916137695 -0.1016533970832825 <_> <_> <_> 24 11 1 2 -1. <_> 24 11 1 1 2. 1 2.2831759415566921e-003 0.0443518795073032 -0.4632245898246765 <_> <_> <_> 5 2 8 5 -1. <_> 5 2 4 5 2. 1 5.5853649973869324e-003 0.0919516831636429 -0.3147256970405579 <_> <_> <_> 16 3 8 12 -1. <_> 20 3 4 6 2. <_> 16 9 4 6 2. 0 -0.0406785085797310 0.1471066027879715 -0.0726505890488625 <_> <_> <_> 0 0 24 12 -1. <_> 0 0 12 6 2. <_> 12 6 12 6 2. 0 -0.1358978003263474 -0.5053529739379883 0.0469954796135426 <_> <_> <_> 8 2 10 8 -1. <_> 13 2 5 4 2. <_> 8 6 5 4 2. 0 -0.0384974703192711 -0.3717043101787567 0.0552083589136600 <_> <_> <_> 0 3 2 8 -1. <_> 0 3 1 4 2. <_> 1 7 1 4 2. 0 2.7928350027650595e-003 -0.1162076964974403 0.1937797069549561 <_> <_> <_> 22 11 2 4 -1. <_> 22 12 2 2 2. 0 5.3412551060318947e-003 0.0129640102386475 -0.4924449026584625 <_> <_> <_> 1 11 2 4 -1. <_> 1 12 2 2 2. 0 -2.6604509912431240e-003 -0.4564127027988434 0.0437755398452282 <_> <_> <_> 12 2 13 12 -1. <_> 12 8 13 6 2. 0 0.3209887146949768 0.0484563298523426 -0.3930096924304962 <_> <_> <_> 5 8 2 4 -1. <_> 5 8 1 4 2. 1 -7.2495201602578163e-003 -0.4188942015171051 0.0410884395241737 <_> <_> <_> 15 6 6 7 -1. <_> 17 6 2 7 3. 0 0.0233532395213842 0.0302080996334553 -0.3757928013801575 <_> <_> <_> 4 6 6 6 -1. <_> 6 6 2 6 3. 0 -0.0224980209022760 -0.4524075090885162 0.0389229394495487 <_> <_> <_> 13 13 9 2 -1. <_> 16 13 3 2 3. 0 -0.0238666702061892 -0.5288146734237671 0.0138155296444893 <_> <_> <_> 4 4 7 4 -1. <_> 3 5 7 2 2. 1 -0.0336419306695461 0.4436714053153992 -0.0403416194021702 <_> <_> <_> 18 4 6 8 -1. <_> 21 4 3 4 2. <_> 18 8 3 4 2. 0 0.0221408791840076 -0.0495454296469688 0.2051838934421539 <_> <_> <_> 3 14 9 1 -1. <_> 6 14 3 1 3. 0 0.0106034297496080 0.0319968499243259 -0.5148760080337524 <_> <_> <_> 11 11 14 4 -1. <_> 18 11 7 2 2. <_> 11 13 7 2 2. 0 9.6357148140668869e-003 -0.1237379983067513 0.1527843028306961 <_> <_> <_> 1 4 6 8 -1. <_> 1 4 3 4 2. <_> 4 8 3 4 2. 0 0.0297187492251396 -0.0567854084074497 0.2904588878154755 <_> <_> <_> 23 0 2 2 -1. <_> 23 0 1 2 2. 1 2.0548420434352010e-004 -0.2718465924263001 0.1070784032344818 <_> <_> <_> 6 0 13 4 -1. <_> 6 1 13 2 2. 0 -0.0486726500093937 0.4235774874687195 -0.0456859990954399 <_> <_> <_> 11 0 4 2 -1. <_> 11 1 4 1 2. 0 2.5377809070050716e-003 -0.0727348327636719 0.2103600949048996 <_> <_> <_> 2 0 2 2 -1. <_> 2 0 2 1 2. 1 -3.3941529691219330e-003 -0.3815236985683441 0.0445483289659023 <_> <_> <_> 20 9 5 6 -1. <_> 20 11 5 2 3. 0 -0.0237451493740082 -0.4413619935512543 0.0249414704740047 <_> <_> <_> 5 2 15 3 -1. <_> 5 3 15 1 3. 0 -0.0200922992080450 0.1694606989622116 -0.0953345969319344 <_> <_> <_> 9 2 7 3 -1. <_> 9 3 7 1 3. 0 0.0110265100374818 -0.0721762925386429 0.2484644949436188 <_> <_> <_> 2 14 21 1 -1. <_> 9 14 7 1 3. 0 -0.0158068798482418 0.2241718024015427 -0.0724460408091545 <_> <_> <_> 8 11 16 4 -1. <_> 8 11 8 4 2. 0 0.0490073598921299 -0.0551217384636402 0.2583925127983093 <_> <_> <_> 0 12 24 2 -1. <_> 12 12 12 2 2. 0 0.0288716107606888 -0.1153011992573738 0.1924846023321152 <_> <_> <_> 22 9 3 6 -1. <_> 22 11 3 2 3. 0 7.3990179225802422e-003 0.0522995889186859 -0.2191856950521469 <_> <_> <_> 0 1 12 2 -1. <_> 0 1 6 1 2. <_> 6 2 6 1 2. 0 -6.1737848445773125e-003 0.2038096934556961 -0.0696693286299706 <_> <_> <_> 8 9 9 3 -1. <_> 8 10 9 1 3. 0 9.4332564622163773e-003 -0.0534071698784828 0.2586283981800079 <_> <_> <_> 0 9 3 6 -1. <_> 0 11 3 2 3. 0 0.0143210804089904 0.0336425192654133 -0.4679594039916992 <_> <_> <_> 11 11 14 4 -1. <_> 18 11 7 2 2. <_> 11 13 7 2 2. 0 0.0224872808903456 -0.0431007482111454 0.1123055964708328 <_> <_> <_> 7 9 4 6 -1. <_> 8 9 2 6 2. 0 -8.8018830865621567e-003 -0.5997744798660278 0.0238500293344259 <_> <_> <_> 10 12 6 2 -1. <_> 12 12 2 2 3. 0 -9.2824921011924744e-003 -0.3792850077152252 0.0247395392507315 <_> <_> <_> 0 12 1 2 -1. <_> 0 13 1 1 2. 0 -3.8288799260044470e-005 0.1094501987099648 -0.1270592063665390 <_> <_> <_> 15 3 10 12 -1. <_> 20 3 5 6 2. <_> 15 9 5 6 2. 0 -0.1060767024755478 0.1223917007446289 -0.0179706607013941 <_> <_> <_> 10 9 4 6 -1. <_> 10 9 2 3 2. <_> 12 12 2 3 2. 0 0.0145011199638247 0.0254385806620121 -0.5499516725540161 <_> <_> <_> 11 3 6 4 -1. <_> 11 3 3 4 2. 0 -0.0294254906475544 -0.4407989084720612 0.0163295306265354 <_> <_> <_> 0 0 14 14 -1. <_> 0 7 14 7 2. 0 -0.2141247987747192 -0.5817149281501770 0.0224080495536327 <_> <_> <_> 15 2 10 12 -1. <_> 20 2 5 6 2. <_> 15 8 5 6 2. 0 -0.0159379299730062 0.0447719283401966 -0.0470217689871788 <_> <_> <_> 8 3 6 4 -1. <_> 11 3 3 4 2. 0 0.0358322896063328 0.0257156305015087 -0.5430511236190796 <_> <_> <_> 23 5 2 6 -1. <_> 23 7 2 2 3. 0 -0.0114978998899460 -0.4132392108440399 0.0246592592447996 <_> <_> <_> 10 8 5 3 -1. <_> 10 9 5 1 3. 0 7.6680490747094154e-003 -0.0596144981682301 0.2419749945402145 <_> <_> <_> 20 7 5 4 -1. <_> 20 8 5 2 2. 0 0.0123357502743602 0.0375008806586266 -0.4776956140995026 <_> <_> <_> 7 10 11 4 -1. <_> 7 11 11 2 2. 0 0.0130474697798491 -0.0609255395829678 0.2419895976781845 <_> <_> <_> 16 13 1 2 -1. <_> 16 14 1 1 2. 0 5.2074559789616615e-005 -0.0981822684407234 0.0891881734132767 <_> <_> <_> 3 1 5 4 -1. <_> 3 2 5 2 2. 0 3.2866070978343487e-003 -0.0941056609153748 0.1441165059804916 <_> <_> <_> 17 3 8 2 -1. <_> 17 4 8 1 2. 0 -0.0417326614260674 -0.6405817270278931 0.0221338905394077 <_> <_> <_> 0 7 5 4 -1. <_> 0 8 5 2 2. 0 9.7638191655278206e-003 0.0412781611084938 -0.3354279994964600 <_> <_> <_> 9 4 12 6 -1. <_> 13 4 4 6 3. 0 0.1077456995844841 8.1762494519352913e-003 -0.4347884058952332 <_> <_> <_> 4 4 12 6 -1. <_> 8 4 4 6 3. 0 0.1119699031114578 0.0199715103954077 -0.6503595113754273 <_> <_> <_> 11 0 12 9 -1. <_> 11 0 6 9 2. 0 0.0680430680513382 -0.0602735094726086 0.1384491026401520 <_> <_> <_> 4 5 16 8 -1. <_> 12 5 8 8 2. 0 0.1206192970275879 -0.0666261836886406 0.2128939926624298 <_> <_> <_> 16 12 2 1 -1. <_> 16 12 1 1 2. 0 -2.7089789509773254e-003 -0.4214768111705780 7.0062931627035141e-003 <_> <_> <_> 7 12 2 1 -1. <_> 8 12 1 1 2. 0 -9.8798991530202329e-005 0.1287330985069275 -0.1178120002150536 <_> <_> <_> 19 3 6 4 -1. <_> 22 3 3 2 2. <_> 19 5 3 2 2. 0 0.0177976898849010 -0.0398075394332409 0.2582241892814636 <_> <_> <_> 8 10 6 3 -1. <_> 10 10 2 3 3. 0 -0.0155267501249909 -0.5375617146492004 0.0254285801202059 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 -1.1374800233170390e-003 0.1497129052877426 -0.0317900516092777 <_> <_> <_> 0 0 24 2 -1. <_> 0 0 12 1 2. <_> 12 1 12 1 2. 0 0.0219873897731304 0.0302675794810057 -0.4156928062438965 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 5.9880971093662083e-005 -0.0641673132777214 0.0799537077546120 <_> <_> <_> 0 3 6 4 -1. <_> 0 3 3 2 2. <_> 3 5 3 2 2. 0 7.6966080814599991e-003 -0.0727465227246284 0.1708455979824066 <_> <_> <_> 22 0 3 4 -1. <_> 22 2 3 2 2. 0 6.2799488659948111e-004 0.0341552086174488 -0.1379152983427048 <_> <_> <_> 11 0 2 3 -1. <_> 11 1 2 1 3. 0 -1.2622140347957611e-003 0.1615235060453415 -0.0755578279495239 <_> <_> <_> 21 7 2 4 -1. <_> 20 8 2 2 2. 1 -0.0110059296712279 -0.4823004007339478 0.0268340297043324 <_> <_> <_> 4 9 10 1 -1. <_> 9 9 5 1 2. 0 -9.5793791115283966e-003 0.1946887969970703 -0.0669640377163887 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 -9.1821959358640015e-005 0.0793757066130638 -0.0674495473504066 <_> <_> <_> 7 6 2 2 -1. <_> 7 6 1 1 2. <_> 8 7 1 1 2. 0 1.2134959688410163e-003 -0.0511140711605549 0.2775780856609345 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 7.9206802183762193e-004 -0.0284809302538633 0.1130611971020699 <_> <_> <_> 0 0 1 4 -1. <_> 0 2 1 2 2. 0 2.7196949813514948e-003 0.0362051688134670 -0.3822895884513855 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 -7.0203691720962524e-003 -0.7084425091743469 9.6215400844812393e-005 <_> <_> <_> 7 6 2 2 -1. <_> 7 6 1 1 2. <_> 8 7 1 1 2. 0 -7.4910762486979365e-004 0.1899659931659699 -0.0707588419318199 <_> <_> <_> 8 9 9 6 -1. <_> 11 11 3 2 9. 0 -0.0300100892782211 0.1409595012664795 -0.0833628922700882 <_> <_> <_> 0 5 2 6 -1. <_> 0 7 2 2 3. 0 0.0211524497717619 0.0258801300078630 -0.4697616100311279 <_> <_> <_> 14 4 4 7 -1. <_> 15 5 2 7 2. 1 -0.0319705903530121 -0.5124071240425110 0.0121158296242356 <_> <_> <_> 2 13 20 2 -1. <_> 2 13 10 1 2. <_> 12 14 10 1 2. 0 0.0105077195912600 0.0386607907712460 -0.3098644018173218 <_> <_> <_> 23 7 2 2 -1. <_> 24 7 1 1 2. <_> 23 8 1 1 2. 0 4.8152811359614134e-005 -0.0616559796035290 0.0678063929080963 <_> <_> <_> 3 2 1 4 -1. <_> 3 3 1 2 2. 0 9.6495117759332061e-004 -0.0613585598766804 0.1991685926914215 <_> <_> <_> 11 2 14 4 -1. <_> 11 3 14 2 2. 0 -0.0404121391475201 0.1341411024332047 -0.0717744380235672 <_> <_> <_> 5 7 4 5 -1. <_> 6 7 2 5 2. 0 5.8856019750237465e-003 0.0359793491661549 -0.3332307040691376 <_> <_> <_> 23 8 1 4 -1. <_> 22 9 1 2 2. 1 5.3272489458322525e-003 0.0328989103436470 -0.5153871178627014 <_> <_> <_> 2 0 10 8 -1. <_> 7 0 5 8 2. 0 0.0532727986574173 -0.0784574225544930 0.1582656949758530 <_> <_> <_> 1 5 24 3 -1. <_> 9 6 8 1 9. 0 0.0174429006874561 0.1339583992958069 -0.1186174973845482 <_> <_> <_> 10 0 4 10 -1. <_> 10 5 4 5 2. 0 -0.0433590598404408 -0.2269790023565292 0.0467031300067902 <_> <_> <_> 5 4 15 3 -1. <_> 5 5 15 1 3. 0 -0.0231206398457289 0.1634031981229782 -0.0685165524482727 <_> <_> <_> 11 6 3 6 -1. <_> 11 8 3 2 3. 0 -9.3796178698539734e-003 0.1582739949226379 -0.0771108269691467 <_> <_> <_> 18 8 7 3 -1. <_> 18 9 7 1 3. 0 -0.0141222495585680 -0.5691561102867127 0.0232016704976559 <_> <_> <_> 0 0 4 2 -1. <_> 0 1 4 1 2. 0 -0.0155957797542214 -0.7199953794479370 0.0111829601228237 <_> <_> <_> 20 0 2 1 -1. <_> 20 0 1 1 2. 1 7.4529898120090365e-004 -0.0766925588250160 0.0582969412207603 <_> <_> <_> 0 6 1 8 -1. <_> 0 8 1 4 2. 0 -5.1220599561929703e-003 -0.4147517085075378 0.0252124201506376 <_> <_> <_> 23 7 2 2 -1. <_> 24 7 1 1 2. <_> 23 8 1 1 2. 0 -5.7267909141955897e-005 0.0905847102403641 -0.0668906867504120 <_> <_> <_> 0 7 2 2 -1. <_> 0 7 1 1 2. <_> 1 8 1 1 2. 0 8.8431767653673887e-004 -0.0570513382554054 0.2420555055141449 <_> <_> <_> 24 8 1 4 -1. <_> 23 9 1 2 2. 1 -6.3992529176175594e-003 -0.4766991138458252 0.0172231607139111 <_> <_> <_> 1 8 3 1 -1. <_> 2 9 1 1 3. 1 3.4215620253235102e-003 0.0330659411847591 -0.3505514860153198 <_> <_> <_> 21 7 2 2 -1. <_> 22 7 1 1 2. <_> 21 8 1 1 2. 0 6.0761801432818174e-004 -0.0633307918906212 0.1801937073469162 <_> <_> <_> 5 8 15 6 -1. <_> 5 10 15 2 3. 0 -0.0271245595067739 0.1347420066595078 -0.0843034014105797 <_> <_> <_> 6 7 14 8 -1. <_> 6 9 14 4 2. 0 0.0320383384823799 -0.0676692426204681 0.1796665936708450 <_> <_> <_> 1 4 10 2 -1. <_> 1 5 10 1 2. 0 7.2583961300551891e-003 -0.0986167713999748 0.1166217997670174 <_> <_> <_> 12 5 3 3 -1. <_> 13 6 1 1 9. 0 -3.7803640589118004e-003 0.1233021020889282 -0.0477618910372257 <_> <_> <_> 0 4 7 3 -1. <_> 0 5 7 1 3. 0 0.0392416305840015 0.0167705602943897 -0.7329750061035156 <_> <_> <_> 21 7 2 2 -1. <_> 22 7 1 1 2. <_> 21 8 1 1 2. 0 -5.3865249356022105e-005 0.0850126668810844 -0.0751027390360832 <_> <_> <_> 2 7 2 2 -1. <_> 2 7 1 1 2. <_> 3 8 1 1 2. 0 8.2592968828976154e-004 -0.0551505312323570 0.2059426009654999 <_> <_> <_> 22 9 1 3 -1. <_> 21 10 1 1 3. 1 -5.6403529015369713e-005 0.0762555226683617 -0.0699946209788322 <_> <_> <_> 11 13 2 2 -1. <_> 11 13 1 1 2. <_> 12 14 1 1 2. 0 -5.6928332196548581e-004 -0.2483194023370743 0.0468857996165752 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 0.0424826890230179 -0.0344216786324978 0.1484764963388443 <_> <_> <_> 0 3 6 12 -1. <_> 0 3 3 6 2. <_> 3 9 3 6 2. 0 -0.0339534096419811 0.2843470871448517 -0.0431083589792252 <_> <_> <_> 17 1 4 11 -1. <_> 18 1 2 11 2. 0 0.0188998207449913 0.0142998602241278 -0.4192070066928864 <_> <_> <_> 0 10 6 3 -1. <_> 0 11 6 1 3. 0 1.9765710458159447e-003 0.0621932409703732 -0.1786025017499924 <_> <_> <_> 23 11 2 1 -1. <_> 23 11 1 1 2. 0 -5.0894439482362941e-005 0.0948854833841324 -0.0689786225557327 <_> <_> <_> 4 1 4 11 -1. <_> 5 1 2 11 2. 0 0.0114915501326323 0.0331886112689972 -0.3628959059715271 <_> <_> <_> 21 3 4 12 -1. <_> 23 3 2 6 2. <_> 21 9 2 6 2. 0 -0.0215106792747974 0.2759737968444824 -0.0317491404712200 <_> <_> <_> 0 3 4 12 -1. <_> 0 3 2 6 2. <_> 2 9 2 6 2. 0 0.0130551997572184 -0.0830815583467484 0.1449849009513855 <_> <_> <_> 11 11 6 4 -1. <_> 11 12 6 2 2. 0 6.6747581586241722e-003 -0.0461902506649494 0.1383360028266907 <_> <_> <_> 6 11 13 4 -1. <_> 6 12 13 2 2. 0 -7.0616300217807293e-003 0.1968749016523361 -0.0837985798716545 <_> <_> <_> 11 10 3 1 -1. <_> 12 10 1 1 3. 0 6.1481661396101117e-004 0.0542011298239231 -0.1981233954429627 <_> <_> <_> 5 2 13 8 -1. <_> 5 6 13 4 2. 0 0.2860183119773865 0.0232954602688551 -0.4173370003700256 <_> <_> <_> 15 2 10 6 -1. <_> 15 4 10 2 3. 0 0.0463717207312584 -0.0290123391896486 0.1808013021945953 <_> <_> <_> 0 2 10 6 -1. <_> 0 4 10 2 3. 0 -0.0557247512042522 0.1358146965503693 -0.1061223000288010 <_> <_> <_> 12 1 13 8 -1. <_> 12 3 13 4 2. 0 -0.2584396898746491 -0.4910731911659241 0.0151501996442676 -1.3960490226745605 11 -1 <_> <_> <_> <_> 5 3 15 3 -1. <_> 5 4 15 1 3. 0 -0.0417404398322105 0.4202992916107178 -0.1386588066816330 <_> <_> <_> 9 3 9 3 -1. <_> 9 4 9 1 3. 0 0.0274386107921600 -0.0691855624318123 0.6378138065338135 <_> <_> <_> 3 2 7 3 -1. <_> 2 3 7 1 3. 1 -0.0319233611226082 0.5562999844551086 -0.0588022507727146 <_> <_> <_> 5 2 15 3 -1. <_> 5 3 15 1 3. 0 -0.0426339097321033 0.3957036137580872 -0.0923223569989204 <_> <_> <_> 5 4 15 3 -1. <_> 5 5 15 1 3. 0 -0.0453329794108868 0.4831672012805939 -0.0990284606814384 <_> <_> <_> 17 6 2 2 -1. <_> 18 6 1 1 2. <_> 17 7 1 1 2. 0 1.4149550115689635e-003 -0.0383210293948650 0.3782787919044495 <_> <_> <_> 5 10 2 3 -1. <_> 5 10 1 3 2. 1 3.1844570767134428e-003 0.0845874175429344 -0.3629348874092102 <_> <_> <_> 23 11 2 4 -1. <_> 23 13 2 2 2. 0 7.9865548759698868e-003 0.0660245269536972 -0.4990949034690857 <_> <_> <_> 0 11 14 4 -1. <_> 0 11 7 2 2. <_> 7 13 7 2 2. 0 8.3637079223990440e-003 -0.1568834036588669 0.1732781976461411 <_> <_> <_> 10 4 6 3 -1. <_> 10 5 6 1 3. 0 0.0166161693632603 -0.1092156991362572 0.3208172023296356 <_> <_> <_> 0 1 24 14 -1. <_> 0 1 12 7 2. <_> 12 8 12 7 2. 0 -0.1083723008632660 -0.3144314885139465 0.0960887372493744 <_> <_> <_> 1 5 24 8 -1. <_> 13 5 12 4 2. <_> 1 9 12 4 2. 0 -0.0552641600370407 -0.3238588869571686 0.0760045275092125 <_> <_> <_> 0 0 24 12 -1. <_> 0 0 12 6 2. <_> 12 6 12 6 2. 0 0.1263256967067719 0.0652572736144066 -0.4011892974376679 <_> <_> <_> 10 0 15 14 -1. <_> 10 7 15 7 2. 0 0.3880456089973450 0.0290472805500031 -0.2850419878959656 <_> <_> <_> 1 11 2 1 -1. <_> 1 11 1 1 2. 1 2.1647498942911625e-003 0.0566388815641403 -0.4483107030391693 <_> <_> <_> 1 11 24 4 -1. <_> 1 11 12 4 2. 0 -0.0850358307361603 0.2374248951673508 -0.1127642020583153 <_> <_> <_> 7 7 10 3 -1. <_> 7 8 10 1 3. 0 0.0297137200832367 -0.0403699316084385 0.4747174084186554 <_> <_> <_> 9 5 7 3 -1. <_> 9 6 7 1 3. 0 0.0189488306641579 -0.0794471576809883 0.2721098959445953 <_> <_> <_> 0 9 2 6 -1. <_> 0 11 2 2 3. 0 -5.4433820769190788e-003 -0.4018659889698029 0.0573576912283897 <_> <_> <_> 22 8 3 2 -1. <_> 22 8 3 1 2. 1 -7.4416291899979115e-003 -0.4642170965671539 0.0343283303081989 <_> <_> <_> 12 6 1 3 -1. <_> 12 7 1 1 3. 0 3.1745829619467258e-003 -0.0719946026802063 0.2899833023548126 <_> <_> <_> 24 6 1 6 -1. <_> 24 8 1 2 3. 0 -4.6435040421783924e-003 -0.4219543039798737 0.0394870713353157 <_> <_> <_> 3 3 7 2 -1. <_> 3 3 7 1 2. 1 -0.0225970800966024 0.2745698094367981 -0.0772427767515183 <_> <_> <_> 10 4 6 10 -1. <_> 13 4 3 5 2. <_> 10 9 3 5 2. 0 0.0175681803375483 0.0604698508977890 -0.2755838930606842 <_> <_> <_> 0 3 14 6 -1. <_> 0 6 14 3 2. 0 0.2285360991954804 0.0372774116694927 -0.5375431180000305 <_> <_> <_> 9 0 8 8 -1. <_> 13 0 4 4 2. <_> 9 4 4 4 2. 0 0.0323306396603584 0.0458961501717567 -0.3844825029373169 <_> <_> <_> 3 4 5 3 -1. <_> 2 5 5 1 3. 1 -0.0285396501421928 0.5891790986061096 -0.0340728089213371 <_> <_> <_> 18 9 7 6 -1. <_> 18 11 7 2 3. 0 0.0286119598895311 0.0241741407662630 -0.2325512021780014 <_> <_> <_> 0 9 7 6 -1. <_> 0 11 7 2 3. 0 0.0190214607864618 0.0562911406159401 -0.3404670059680939 <_> <_> <_> 12 1 3 3 -1. <_> 12 2 3 1 3. 0 -5.7942080311477184e-003 0.2392093986272812 -0.0638626366853714 <_> <_> <_> 9 2 6 8 -1. <_> 9 2 3 4 2. <_> 12 6 3 4 2. 0 0.0198575407266617 0.0513716302812099 -0.3405377864837647 <_> <_> <_> 1 14 24 1 -1. <_> 7 14 12 1 2. 0 -0.0227794591337442 0.2922581136226654 -0.0604945607483387 <_> <_> <_> 0 3 12 12 -1. <_> 0 3 6 6 2. <_> 6 9 6 6 2. 0 0.1480142027139664 -0.0343834199011326 0.4667116999626160 <_> <_> <_> 11 3 9 4 -1. <_> 14 3 3 4 3. 0 -0.0337039716541767 -0.3770483136177063 0.0263036508113146 <_> <_> <_> 9 4 6 6 -1. <_> 9 4 3 3 2. <_> 12 7 3 3 2. 0 -0.0162283908575773 -0.3382456898689270 0.0570861399173737 <_> <_> <_> 20 0 4 1 -1. <_> 20 0 2 1 2. 1 -4.2941919527947903e-003 -0.3295148909091950 0.0434178002178669 <_> <_> <_> 8 3 9 4 -1. <_> 11 3 3 4 3. 0 -0.0235741101205349 -0.3945200145244598 0.0398236103355885 <_> <_> <_> 14 4 6 9 -1. <_> 16 4 2 9 3. 0 0.0218487493693829 0.0268086697906256 -0.2596569955348969 <_> <_> <_> 5 4 6 9 -1. <_> 7 4 2 9 3. 0 -0.0209309905767441 -0.3641955852508545 0.0437827892601490 <_> <_> <_> 16 5 2 2 -1. <_> 17 5 1 1 2. <_> 16 6 1 1 2. 0 1.6019339673221111e-003 -0.0240206904709339 0.2182880043983460 <_> <_> <_> 0 0 15 12 -1. <_> 0 4 15 4 3. 0 -0.5489655733108521 -0.5673372149467468 0.0286840796470642 <_> <_> <_> 8 1 11 3 -1. <_> 8 2 11 1 3. 0 0.0151870902627707 -0.0816961303353310 0.2107073962688446 <_> <_> <_> 0 6 1 6 -1. <_> 0 8 1 2 3. 0 -3.0653451103717089e-003 -0.3701387047767639 0.0471426397562027 <_> <_> <_> 14 5 1 3 -1. <_> 14 6 1 1 3. 0 -2.2847671061754227e-003 0.1813296973705292 -0.0419041812419891 <_> <_> <_> 7 2 2 2 -1. <_> 7 2 1 1 2. <_> 8 3 1 1 2. 0 1.3886080123484135e-003 -0.0477169714868069 0.3120515942573547 <_> <_> <_> 22 9 1 4 -1. <_> 21 10 1 2 2. 1 -4.2354268953204155e-003 -0.3120726943016052 0.0365724302828312 <_> <_> <_> 10 5 5 3 -1. <_> 10 6 5 1 3. 0 4.9234707839787006e-003 -0.1105178967118263 0.1364745944738388 <_> <_> <_> 14 5 1 3 -1. <_> 14 6 1 1 3. 0 -9.7824353724718094e-004 0.1019112989306450 -0.0396985597908497 <_> <_> <_> 0 0 2 2 -1. <_> 0 1 2 1 2. 0 2.3952899500727654e-003 0.0345855616033077 -0.4620797038078308 <_> <_> <_> 22 9 1 4 -1. <_> 21 10 1 2 2. 1 -2.7391599360271357e-005 0.0470036789774895 -0.0576489008963108 <_> <_> <_> 3 9 4 1 -1. <_> 4 10 2 1 2. 1 -3.7895010318607092e-003 -0.3904446959495544 0.0392708182334900 <_> <_> <_> 8 8 9 3 -1. <_> 8 9 9 1 3. 0 0.0251507405191660 -0.0313480608165264 0.4742729067802429 <_> <_> <_> 2 8 21 3 -1. <_> 9 9 7 1 9. 0 -0.0545641481876373 0.1494560986757278 -0.0982013270258904 <_> <_> <_> 10 6 8 8 -1. <_> 12 6 4 8 2. 0 -0.0416621901094913 -0.4245094060897827 0.0152987902984023 <_> <_> <_> 7 3 6 12 -1. <_> 9 3 2 12 3. 0 -0.0207394007593393 -0.3218981921672821 0.0479229800403118 <_> <_> <_> 11 0 3 1 -1. <_> 12 0 1 1 3. 0 -9.7902817651629448e-004 0.2330693006515503 -0.0597994215786457 <_> <_> <_> 10 10 4 4 -1. <_> 11 10 2 4 2. 0 -4.1547799482941628e-003 -0.3040251135826111 0.0456931404769421 <_> <_> <_> 16 5 2 2 -1. <_> 17 5 1 1 2. <_> 16 6 1 1 2. 0 -2.6045470804092474e-005 0.0553880184888840 -0.0540977194905281 <_> <_> <_> 7 5 2 2 -1. <_> 7 5 1 1 2. <_> 8 6 1 1 2. 0 1.0567409917712212e-003 -0.0526767596602440 0.2473292946815491 <_> <_> <_> 1 0 24 8 -1. <_> 13 0 12 4 2. <_> 1 4 12 4 2. 0 0.1842923015356064 0.0165581107139587 -0.5789644718170166 <_> <_> <_> 6 6 3 1 -1. <_> 7 6 1 1 3. 0 1.4177090488374233e-003 -0.0524071305990219 0.2524789869785309 <_> <_> <_> 21 12 4 3 -1. <_> 21 13 4 1 3. 0 -4.0882350876927376e-003 -0.3066633939743042 0.0269502196460962 <_> <_> <_> 0 3 4 4 -1. <_> 0 3 2 2 2. <_> 2 5 2 2 2. 0 8.5421912372112274e-003 -0.0481166206300259 0.2716326117515564 <_> <_> <_> 19 0 2 3 -1. <_> 19 0 1 3 2. 1 0.0195690393447876 0.0251199807971716 -0.3371602892875671 <_> <_> <_> 2 2 15 6 -1. <_> 2 5 15 3 2. 0 0.2677350938320160 0.0231193397194147 -0.5075724124908447 <_> <_> <_> 5 0 15 2 -1. <_> 5 1 15 1 2. 0 -0.0326806083321571 0.2773688137531281 -0.0481392890214920 <_> <_> <_> 0 0 2 4 -1. <_> 0 1 2 2 2. 0 -5.0574508495628834e-003 -0.3639586865901947 0.0363070890307426 <_> <_> <_> 23 1 2 12 -1. <_> 20 4 2 6 2. 1 0.0791702270507813 -0.0295530706644058 0.1632819026708603 <_> <_> <_> 4 2 2 3 -1. <_> 4 3 2 1 3. 0 2.2955629974603653e-003 -0.0644191280007362 0.1921634972095490 <_> <_> <_> 20 0 2 2 -1. <_> 20 0 1 2 2. 1 2.1744619880337268e-004 -0.1248127967119217 0.0513428300619125 <_> <_> <_> 0 12 4 3 -1. <_> 0 13 4 1 3. 0 -5.9793200343847275e-003 -0.5400406122207642 0.0236572697758675 <_> <_> <_> 13 1 12 8 -1. <_> 13 3 12 4 2. 0 -0.2183004021644592 -0.3002713024616242 0.0188296400010586 <_> <_> <_> 5 0 2 2 -1. <_> 5 0 2 1 2. 1 -2.5782659649848938e-003 -0.2936800122261047 0.0437353104352951 <_> <_> <_> 11 2 14 12 -1. <_> 11 8 14 6 2. 0 -0.1344317942857742 -0.2982031106948853 0.0219516493380070 <_> <_> <_> 0 2 14 12 -1. <_> 0 8 14 6 2. 0 0.3329834043979645 0.0417996607720852 -0.3464672863483429 <_> <_> <_> 16 7 6 8 -1. <_> 18 7 2 8 3. 0 -0.0276046600192785 -0.3169625997543335 0.0150398099794984 <_> <_> <_> 7 0 13 2 -1. <_> 7 0 13 1 2. 1 0.0284599401056767 0.0311327595263720 -0.4115855097770691 <_> <_> <_> 16 7 6 8 -1. <_> 18 7 2 8 3. 0 0.0568751804530621 3.1998890917748213e-003 -0.8496329784393311 <_> <_> <_> 3 7 6 8 -1. <_> 5 7 2 8 3. 0 -0.0264140591025352 -0.4030340015888214 0.0285327993333340 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 8.2670920528471470e-004 -0.0478886701166630 0.2083473950624466 <_> <_> <_> 12 5 3 6 -1. <_> 13 6 1 6 3. 1 -0.0174812003970146 -0.4784274101257324 0.0261973403394222 <_> <_> <_> 20 2 1 6 -1. <_> 20 4 1 2 3. 0 0.0102093704044819 -0.0323491990566254 0.3333239853382111 <_> <_> <_> 7 2 2 2 -1. <_> 7 2 1 1 2. <_> 8 3 1 1 2. 0 -9.0442842338234186e-004 0.2252988964319229 -0.0502184815704823 <_> <_> <_> 19 10 2 1 -1. <_> 19 10 1 1 2. 0 -5.5155509471660480e-005 0.0854163095355034 -0.0922556668519974 <_> <_> <_> 6 4 8 2 -1. <_> 8 4 4 2 2. 0 -7.5864349491894245e-003 -0.2745333909988403 0.0428331792354584 <_> <_> <_> 9 5 16 7 -1. <_> 13 5 8 7 2. 0 0.0689363330602646 -0.0362212397158146 0.2202139943838120 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 1.0017789900302887e-003 -0.0464680194854736 0.2603206038475037 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 -1.5333900228142738e-003 0.2831267118453980 -0.0321949794888496 <_> <_> <_> 11 13 2 2 -1. <_> 11 13 1 1 2. <_> 12 14 1 1 2. 0 5.0275481771677732e-004 0.0547226108610630 -0.2383649945259094 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 6.7827408201992512e-005 -0.0391390211880207 0.0501381084322929 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 -9.6863682847470045e-004 0.2108709067106247 -0.0608406700193882 <_> <_> <_> 20 8 5 3 -1. <_> 20 9 5 1 3. 0 0.0157267302274704 0.0115508204326034 -0.8977199196815491 <_> <_> <_> 11 13 2 2 -1. <_> 11 13 1 1 2. <_> 12 14 1 1 2. 0 -6.1983527848497033e-004 -0.2865422964096069 0.0380632318556309 <_> <_> <_> 5 11 15 4 -1. <_> 5 12 15 2 2. 0 -0.0148898903280497 0.2188885957002640 -0.0534253492951393 <_> <_> <_> 0 8 6 3 -1. <_> 0 9 6 1 3. 0 9.1423774138092995e-003 0.0289719104766846 -0.4331383109092712 <_> <_> <_> 19 10 2 1 -1. <_> 19 10 1 1 2. 0 4.4567110307980329e-005 -0.0493506006896496 0.0829902365803719 <_> <_> <_> 4 10 2 1 -1. <_> 5 10 1 1 2. 0 -4.6295441279653460e-005 0.1145173981785774 -0.1154157966375351 <_> <_> <_> 1 0 24 6 -1. <_> 13 0 12 3 2. <_> 1 3 12 3 2. 0 -0.0951543077826500 -0.3621807992458344 0.0389639586210251 <_> <_> <_> 5 1 2 5 -1. <_> 5 1 1 5 2. 1 0.0114479204639792 -0.0633771494030952 0.1799890995025635 <_> <_> <_> 21 3 4 12 -1. <_> 23 3 2 6 2. <_> 21 9 2 6 2. 0 0.0168469492346048 -0.0795559063553810 0.2080432027578354 <_> <_> <_> 0 3 4 12 -1. <_> 0 3 2 6 2. <_> 2 9 2 6 2. 0 -0.0195328295230865 0.3306660056114197 -0.0368879809975624 <_> <_> <_> 24 2 1 6 -1. <_> 24 5 1 3 2. 0 -9.9951513111591339e-003 -0.2601873874664307 0.0200320500880480 <_> <_> <_> 5 2 9 8 -1. <_> 8 2 3 8 3. 0 0.0559661500155926 0.0298731103539467 -0.3797968029975891 <_> <_> <_> 24 2 1 6 -1. <_> 24 5 1 3 2. 0 0.0223989300429821 9.4442693516612053e-003 -0.3070712089538574 <_> <_> <_> 0 2 1 6 -1. <_> 0 5 1 3 2. 0 -0.0111306598410010 -0.4547461867332459 0.0237820893526077 <_> <_> <_> 9 6 9 4 -1. <_> 9 7 9 2 2. 0 0.0103914495557547 -0.0801509991288185 0.1017400026321411 <_> <_> <_> 11 6 3 4 -1. <_> 11 7 3 2 2. 0 -9.7076389938592911e-003 0.3220044970512390 -0.0475250408053398 <_> <_> <_> 20 14 2 1 -1. <_> 20 14 1 1 2. 0 1.9170529412804171e-005 -0.0619046017527580 0.0758714973926544 <_> <_> <_> 0 8 6 4 -1. <_> 0 9 6 2 2. 0 -5.7660471647977829e-003 -0.2893261909484863 0.0357113592326641 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 -8.0189562868326902e-004 0.1487676948308945 -0.0337995104491711 <_> <_> <_> 8 0 9 15 -1. <_> 11 5 3 5 9. 0 -0.4516898989677429 -0.5800644755363464 0.0182942803949118 <_> <_> <_> 13 9 4 6 -1. <_> 14 9 2 6 2. 0 7.1167000569403172e-003 0.0221952199935913 -0.4342006146907806 <_> <_> <_> 8 2 9 3 -1. <_> 8 3 9 1 3. 0 0.0214324798434973 -0.0425198413431644 0.2711758911609650 -1.3937480449676514 12 -1 <_> <_> <_> <_> 0 9 8 6 -1. <_> 0 9 4 3 2. <_> 4 12 4 3 2. 0 8.8465185835957527e-003 -0.2059727013111115 0.2158975005149841 <_> <_> <_> 20 1 5 4 -1. <_> 20 3 5 2 2. 0 -0.0114869000390172 0.1450283974409103 -0.2512278854846954 <_> <_> <_> 4 3 16 7 -1. <_> 8 3 8 7 2. 0 0.0613779015839100 -0.1210888996720314 0.2893109023571014 <_> <_> <_> 15 0 10 8 -1. <_> 15 2 10 4 2. 0 -0.0514667406678200 0.0770430117845535 -0.1447598934173584 <_> <_> <_> 0 2 24 10 -1. <_> 0 2 12 5 2. <_> 12 7 12 5 2. 0 0.0990432873368263 0.0879464074969292 -0.3668490052223206 <_> <_> <_> 20 9 5 4 -1. <_> 20 10 5 2 2. 0 6.0240789316594601e-003 0.0559716187417507 -0.4230535030364990 <_> <_> <_> 0 14 22 1 -1. <_> 11 14 11 1 2. 0 9.3228947371244431e-003 -0.1488721966743469 0.1423504054546356 <_> <_> <_> 22 0 3 12 -1. <_> 22 0 3 6 2. 1 -0.0837828367948532 -0.0506230294704437 0.0671857669949532 <_> <_> <_> 0 4 2 2 -1. <_> 1 4 1 2 2. 0 -1.4369570417329669e-003 0.1669974029064179 -0.1184794977307320 <_> <_> <_> 20 9 5 4 -1. <_> 20 10 5 2 2. 0 -8.4923747926950455e-003 -0.5746508240699768 0.0469529181718826 <_> <_> <_> 0 9 5 4 -1. <_> 0 10 5 2 2. 0 6.1581619083881378e-003 0.0387838594615459 -0.4179377853870392 <_> <_> <_> 7 3 18 6 -1. <_> 13 5 6 2 9. 0 0.3882668018341065 -0.0341588892042637 0.3883490860462189 <_> <_> <_> 4 10 10 1 -1. <_> 9 10 5 1 2. 0 -6.2880381010472775e-003 0.1877942979335785 -0.1096756979823113 <_> <_> <_> 21 1 4 10 -1. <_> 21 1 2 10 2. 1 -0.0886473506689072 0.2961074113845825 -0.0496502704918385 <_> <_> <_> 4 1 10 4 -1. <_> 4 1 10 2 2. 1 0.0573849491775036 -0.0621429793536663 0.4039953947067261 <_> <_> <_> 16 8 4 7 -1. <_> 17 8 2 7 2. 0 6.3049891032278538e-003 0.0302408598363400 -0.2553277909755707 <_> <_> <_> 5 8 4 7 -1. <_> 6 8 2 7 2. 0 -0.0128176100552082 -0.7491502761840820 0.0188356805592775 <_> <_> <_> 6 0 13 2 -1. <_> 6 1 13 1 2. 0 6.5159690566360950e-003 -0.0749715119600296 0.1975888013839722 <_> <_> <_> 0 12 8 3 -1. <_> 0 13 8 1 3. 0 8.2992920652031898e-003 0.0329895503818989 -0.4346657097339630 <_> <_> <_> 22 0 2 1 -1. <_> 22 0 1 1 2. 1 6.3911718316376209e-003 0.0297571904957294 -0.3072845935821533 <_> <_> <_> 3 0 1 2 -1. <_> 3 0 1 1 2. 1 6.8949637352488935e-005 -0.1729405969381332 0.0927027910947800 <_> <_> <_> 17 3 8 8 -1. <_> 21 3 4 4 2. <_> 17 7 4 4 2. 0 0.0413548089563847 -0.0279047600924969 0.1629645973443985 <_> <_> <_> 6 2 13 6 -1. <_> 6 4 13 2 3. 0 0.1899937987327576 -0.0312954708933830 0.4835174977779388 <_> <_> <_> 10 0 15 14 -1. <_> 10 7 15 7 2. 0 -0.1273290067911148 -0.4309565126895905 0.0414485186338425 <_> <_> <_> 1 1 12 1 -1. <_> 1 1 6 1 2. 1 -0.0356059707701206 -0.2009662985801697 0.0775555819272995 <_> <_> <_> 18 3 4 2 -1. <_> 18 4 4 1 2. 0 -7.2760661132633686e-003 0.1169442981481552 -0.0564889013767242 <_> <_> <_> 7 11 6 4 -1. <_> 9 11 2 4 3. 0 -0.0167282801121473 -0.5582438707351685 0.0246787108480930 <_> <_> <_> 20 4 5 6 -1. <_> 20 6 5 2 3. 0 3.5163350403308868e-003 -0.1312393993139267 0.0638676136732101 <_> <_> <_> 1 12 5 3 -1. <_> 1 13 5 1 3. 0 -3.7709469906985760e-003 -0.3320902884006500 0.0413776598870754 <_> <_> <_> 1 0 24 2 -1. <_> 13 0 12 1 2. <_> 1 1 12 1 2. 0 -0.0138869602233171 -0.3127424120903015 0.0425702482461929 <_> <_> <_> 3 3 5 3 -1. <_> 2 4 5 1 3. 1 9.3537326902151108e-003 -0.0667856708168983 0.1907455027103424 <_> <_> <_> 17 6 8 4 -1. <_> 19 6 4 4 2. 0 -0.0194346699863672 0.3152694106101990 -0.0473581515252590 <_> <_> <_> 5 0 1 3 -1. <_> 4 1 1 1 3. 1 6.2511018477380276e-003 0.0309588797390461 -0.3830946981906891 <_> <_> <_> 23 0 2 4 -1. <_> 23 2 2 2 2. 0 -0.0252969004213810 -0.2962245941162109 0.0151915997266769 <_> <_> <_> 0 0 3 6 -1. <_> 0 3 3 3 2. 0 -3.0754129402339458e-003 0.0729133188724518 -0.1764045059680939 <_> <_> <_> 11 1 14 2 -1. <_> 18 1 7 1 2. <_> 11 2 7 1 2. 0 7.8001008369028568e-003 -0.0501575507223606 0.1162889003753662 <_> <_> <_> 0 1 14 2 -1. <_> 0 1 7 1 2. <_> 7 2 7 1 2. 0 -7.7680540271103382e-003 0.2415755987167358 -0.0778944417834282 <_> <_> <_> 5 4 15 6 -1. <_> 5 6 15 2 3. 0 -0.0880923122167587 0.2515082955360413 -0.0482993088662624 <_> <_> <_> 10 7 2 2 -1. <_> 10 8 2 1 2. 0 -1.7023129621520638e-003 0.1797576993703842 -0.0970716699957848 <_> <_> <_> 13 2 8 5 -1. <_> 15 4 4 5 2. 1 -0.0997034236788750 -0.4700092971324921 0.0155829498544335 <_> <_> <_> 2 9 2 2 -1. <_> 2 9 1 2 2. 1 4.6657170169055462e-003 0.0295135807245970 -0.4018146991729736 <_> <_> <_> 12 8 6 3 -1. <_> 14 8 2 3 3. 0 -0.0176613796502352 -0.5449513792991638 0.0168585199862719 <_> <_> <_> 0 9 24 6 -1. <_> 8 11 8 2 9. 0 -0.2230933010578156 0.1843273043632507 -0.0632233396172524 <_> <_> <_> 1 12 24 3 -1. <_> 9 13 8 1 9. 0 0.0528507791459560 -0.0734771713614464 0.1994421929121018 <_> <_> <_> 5 11 15 4 -1. <_> 5 13 15 2 2. 0 -0.0246656592935324 0.2699545025825501 -0.0523515492677689 <_> <_> <_> 24 10 1 4 -1. <_> 23 11 1 2 2. 1 -4.9799769185483456e-003 -0.4495851993560791 0.0269833803176880 <_> <_> <_> 1 10 4 1 -1. <_> 2 11 2 1 2. 1 3.0535869300365448e-003 0.0375075116753578 -0.3464896082878113 <_> <_> <_> 15 1 10 14 -1. <_> 15 8 10 7 2. 0 -0.0263100396841764 -0.1766241043806076 0.0256136003881693 <_> <_> <_> 0 7 4 2 -1. <_> 2 7 2 2 2. 0 -4.8684021458029747e-003 0.1877097040414810 -0.0605575516819954 <_> <_> <_> 20 4 5 6 -1. <_> 20 6 5 2 3. 0 0.0458405800163746 0.0330421291291714 -0.2026686072349548 <_> <_> <_> 0 4 7 6 -1. <_> 0 6 7 2 3. 0 6.7487969063222408e-003 -0.1384654939174652 0.1144922971725464 <_> <_> <_> 11 7 6 3 -1. <_> 11 8 6 1 3. 0 0.0107938302680850 -0.0550474487245083 0.1810662001371384 <_> <_> <_> 8 10 9 1 -1. <_> 11 10 3 1 3. 0 -0.0132016502320766 -0.4654887914657593 0.0258085392415524 <_> <_> <_> 5 10 15 1 -1. <_> 10 10 5 1 3. 0 -4.9963342025876045e-003 0.1138966009020805 -0.1140139997005463 <_> <_> <_> 7 8 6 3 -1. <_> 9 8 2 3 3. 0 -0.0158193595707417 -0.4853562116622925 0.0220876205712557 <_> <_> <_> 23 12 2 1 -1. <_> 23 12 1 1 2. 0 6.8264620495028794e-005 -0.0819193720817566 0.0840993970632553 <_> <_> <_> 0 13 24 2 -1. <_> 0 13 12 1 2. <_> 12 14 12 1 2. 0 -0.0156373791396618 -0.4515635073184967 0.0227358005940914 <_> <_> <_> 9 9 7 3 -1. <_> 9 10 7 1 3. 0 8.3005577325820923e-003 -0.0514142103493214 0.2212347984313965 <_> <_> <_> 0 6 2 4 -1. <_> 0 7 2 2 2. 0 6.6999751143157482e-003 0.0297896005213261 -0.3543488979339600 <_> <_> <_> 18 2 5 4 -1. <_> 18 3 5 2 2. 0 5.1744161173701286e-003 -0.0496886894106865 0.2202914059162140 <_> <_> <_> 1 4 8 2 -1. <_> 1 4 4 1 2. <_> 5 5 4 1 2. 0 6.1278040520846844e-003 -0.0630758926272392 0.1783366054296494 <_> <_> <_> 21 8 4 4 -1. <_> 21 9 4 2 2. 0 6.8791587837040424e-003 0.0284415297210217 -0.2993854880332947 <_> <_> <_> 4 4 8 4 -1. <_> 4 5 8 2 2. 0 -0.0217361003160477 0.1791318953037262 -0.0602877512574196 <_> <_> <_> 11 4 14 4 -1. <_> 11 5 14 2 2. 0 0.0140090202912688 -0.1060196980834007 0.1548174023628235 <_> <_> <_> 3 0 18 9 -1. <_> 12 0 9 9 2. 0 0.2186813950538635 -0.0483517609536648 0.2573468983173370 <_> <_> <_> 3 0 20 15 -1. <_> 3 0 10 15 2. 0 0.2838009893894196 -0.0509055890142918 0.2936053872108460 <_> <_> <_> 12 1 6 8 -1. <_> 14 3 2 8 3. 1 0.1209316030144692 0.0173095706850290 -0.6926872134208679 <_> <_> <_> 17 4 1 9 -1. <_> 14 7 1 3 3. 1 0.0569618307054043 -0.0186788197606802 0.3227567970752716 <_> <_> <_> 6 7 4 8 -1. <_> 7 7 2 8 2. 0 -9.0500963851809502e-003 -0.4240661859512329 0.0268415194004774 <_> <_> <_> 21 5 4 3 -1. <_> 21 6 4 1 3. 0 0.0231182798743248 0.0105462800711393 -0.5228689908981323 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 1.1480690445750952e-003 -0.0459857396781445 0.2319914996623993 <_> <_> <_> 21 8 4 3 -1. <_> 21 9 4 1 3. 0 -9.8909307271242142e-003 -0.5407552123069763 0.0142617002129555 <_> <_> <_> 7 1 2 2 -1. <_> 7 1 1 1 2. <_> 8 2 1 1 2. 0 7.0599978789687157e-004 -0.0649549588561058 0.1677557975053787 <_> <_> <_> 16 1 2 2 -1. <_> 17 1 1 1 2. <_> 16 2 1 1 2. 0 -8.2311293226666749e-005 0.0727679133415222 -0.0542482398450375 <_> <_> <_> 0 8 4 3 -1. <_> 0 9 4 1 3. 0 5.3380471654236317e-003 0.0320924408733845 -0.3186857998371124 <_> <_> <_> 20 9 2 2 -1. <_> 21 9 1 1 2. <_> 20 10 1 1 2. 0 5.9835889260284603e-005 -0.0492977797985077 0.0571143105626106 <_> <_> <_> 3 9 2 2 -1. <_> 3 9 1 1 2. <_> 4 10 1 1 2. 0 4.0741640987107530e-005 -0.0992263928055763 0.1105673015117645 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 -0.0271146595478058 0.2459900975227356 -0.0621489509940147 <_> <_> <_> 7 1 2 2 -1. <_> 7 1 1 1 2. <_> 8 2 1 1 2. 0 -8.8477227836847305e-004 0.2023449987173080 -0.0529261194169521 <_> <_> <_> 7 4 12 3 -1. <_> 7 5 12 1 3. 0 -0.0192636791616678 0.1516259014606476 -0.0715369805693626 <_> <_> <_> 0 0 11 2 -1. <_> 0 1 11 1 2. 0 9.6891522407531738e-003 0.0357108712196350 -0.3255082964897156 <_> <_> <_> 13 2 6 5 -1. <_> 15 2 2 5 3. 0 -0.0228419005870819 -0.3499914109706879 0.0171892996877432 <_> <_> <_> 0 0 24 10 -1. <_> 0 0 12 5 2. <_> 12 5 12 5 2. 0 -0.1477797031402588 -0.4319078028202057 0.0216299500316381 <_> <_> <_> 20 4 2 3 -1. <_> 20 5 2 1 3. 0 2.3399880155920982e-003 -0.0442668199539185 0.0963377729058266 <_> <_> <_> 0 3 7 4 -1. <_> 0 4 7 2 2. 0 -0.0728321895003319 -0.8186188936233521 0.0117990002036095 <_> <_> <_> 11 1 14 14 -1. <_> 11 8 14 7 2. 0 -0.3072721064090729 -0.7007309198379517 3.5564110148698092e-003 <_> <_> <_> 6 2 6 5 -1. <_> 8 2 2 5 3. 0 -0.0207666493952274 -0.3913905024528503 0.0246222894638777 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 -3.6341920495033264e-003 -0.4501088857650757 5.5562350898981094e-003 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 -7.0794070779811591e-005 0.1087834984064102 -0.0905004590749741 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 -8.8314860477112234e-005 0.0641764104366302 -0.0494646318256855 <_> <_> <_> 2 0 20 1 -1. <_> 7 0 10 1 2. 0 -0.0110706500709057 0.1473083049058914 -0.0670493170619011 <_> <_> <_> 11 0 14 1 -1. <_> 11 0 7 1 2. 0 6.3626351766288280e-003 -0.0400333292782307 0.0926633775234222 <_> <_> <_> 9 3 6 2 -1. <_> 9 4 6 1 2. 0 -7.7499519102275372e-003 0.1392461061477661 -0.0774780735373497 <_> <_> <_> 11 3 3 4 -1. <_> 11 4 3 2 2. 0 4.7532729804515839e-003 -0.0729171708226204 0.1706562042236328 <_> <_> <_> 0 11 18 3 -1. <_> 6 12 6 1 9. 0 -0.0168079808354378 0.1308007985353470 -0.0801806673407555 <_> <_> <_> 15 3 10 12 -1. <_> 20 3 5 6 2. <_> 15 9 5 6 2. 0 0.1279494017362595 -0.0199226494878531 0.3711799085140228 <_> <_> <_> 0 3 14 3 -1. <_> 0 4 14 1 3. 0 -0.0181895997375250 0.1235873028635979 -0.0830406174063683 <_> <_> <_> 9 4 8 3 -1. <_> 11 4 4 3 2. 0 -0.0161725897341967 -0.4490650892257690 0.0227566491812468 <_> <_> <_> 0 12 2 1 -1. <_> 1 12 1 1 2. 0 6.8046152591705322e-005 -0.1011824011802673 0.0935735777020454 <_> <_> <_> 23 13 2 2 -1. <_> 24 13 1 1 2. <_> 23 14 1 1 2. 0 1.1714019638020545e-004 -0.0810816064476967 0.1062628999352455 <_> <_> <_> 0 13 2 2 -1. <_> 0 13 1 1 2. <_> 1 14 1 1 2. 0 5.4521678976016119e-005 -0.0932891815900803 0.1159989982843399 <_> <_> <_> 9 12 8 1 -1. <_> 11 12 4 1 2. 0 -9.5095802098512650e-003 -0.5051903724670410 0.0141592798754573 <_> <_> <_> 0 7 6 4 -1. <_> 0 8 6 2 2. 0 -2.8461390174925327e-003 -0.1991575956344605 0.0473652109503746 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 0.0232862401753664 -0.0403292290866375 0.0805157274007797 <_> <_> <_> 0 3 6 12 -1. <_> 0 3 3 6 2. <_> 3 9 3 6 2. 0 -0.0426056496798992 0.3344807922840118 -0.0383727103471756 <_> <_> <_> 23 7 2 4 -1. <_> 23 8 2 2 2. 0 4.5101181603968143e-003 0.0263549294322729 -0.2349215000867844 <_> <_> <_> 0 7 2 4 -1. <_> 0 8 2 2 2. 0 6.1817811802029610e-003 0.0211725104600191 -0.4420514106750488 <_> <_> <_> 13 7 8 4 -1. <_> 17 7 4 2 2. <_> 13 9 4 2 2. 0 -0.0106069697067142 0.0654574930667877 -0.0324725992977619 <_> <_> <_> 0 1 10 14 -1. <_> 0 8 10 7 2. 0 -0.0858135819435120 -0.3406231105327606 0.0301514994353056 <_> <_> <_> 9 8 7 3 -1. <_> 9 9 7 1 3. 0 6.2758061103522778e-003 -0.0619911886751652 0.1503033936023712 <_> <_> <_> 9 8 3 4 -1. <_> 9 9 3 2 2. 0 -3.0965260230004787e-003 0.1481299996376038 -0.0813362672924995 <_> <_> <_> 18 10 2 3 -1. <_> 17 11 2 1 3. 1 -0.0111239803954959 -0.4638158082962036 0.0152134699746966 <_> <_> <_> 7 10 3 2 -1. <_> 8 11 1 2 3. 1 -0.0111039802432060 -0.6005380153656006 0.0135854296386242 <_> <_> <_> 23 0 2 1 -1. <_> 23 0 1 1 2. 1 -3.2944830600172281e-003 -0.4641366004943848 0.0262269694358110 <_> <_> <_> 12 8 4 3 -1. <_> 12 8 2 3 2. 1 0.0113766100257635 -0.0565435998141766 0.1575082987546921 <_> <_> <_> 5 7 15 3 -1. <_> 10 8 5 1 9. 0 -0.0294652003794909 0.1486423015594482 -0.0651882514357567 <_> <_> <_> 0 0 20 8 -1. <_> 10 0 10 8 2. 0 0.0491673015058041 -0.0922251716256142 0.1015425994992256 <_> <_> <_> 21 0 4 3 -1. <_> 20 1 4 1 3. 1 -0.0209590997546911 0.1749638020992279 -0.0255501996725798 <_> <_> <_> 4 0 3 4 -1. <_> 5 1 1 4 3. 1 5.4627470672130585e-003 -0.0626592189073563 0.1695216000080109 <_> <_> <_> 18 3 5 2 -1. <_> 18 4 5 1 2. 0 -4.3515427969396114e-003 0.0822615697979927 -0.0598390214145184 <_> <_> <_> 2 3 5 2 -1. <_> 2 4 5 1 2. 0 7.4772499501705170e-003 -0.0495455190539360 0.2469687014818192 <_> <_> <_> 13 0 2 5 -1. <_> 13 0 1 5 2. 1 -0.0374278612434864 -0.9178332090377808 3.5620180424302816e-003 <_> <_> <_> 5 12 6 3 -1. <_> 7 13 2 1 9. 0 -0.0248439908027649 -0.4893918037414551 0.0171825792640448 <_> <_> <_> 13 0 2 5 -1. <_> 13 0 1 5 2. 1 8.0120442435145378e-003 0.0217423699796200 -0.0648176670074463 <_> <_> <_> 9 6 4 2 -1. <_> 9 7 4 1 2. 0 5.7306028902530670e-003 -0.0707883909344673 0.1390995979309082 <_> <_> <_> 18 9 4 3 -1. <_> 18 10 4 1 3. 0 0.0109893204644322 7.0361187681555748e-003 -0.3556833863258362 <_> <_> <_> 3 9 4 3 -1. <_> 3 10 4 1 3. 0 -3.5342550836503506e-003 -0.2303902953863144 0.0395394414663315 <_> <_> <_> 7 9 15 6 -1. <_> 7 12 15 3 2. 0 0.0326121784746647 -0.0834509506821632 0.0961622893810272 <_> <_> <_> 4 1 12 6 -1. <_> 4 1 6 3 2. <_> 10 4 6 3 2. 0 -0.0519190989434719 -0.3597438931465149 0.0235583093017340 <_> <_> <_> 10 5 14 10 -1. <_> 10 10 14 5 2. 0 0.2802706062793732 0.0191025994718075 -0.2738722860813141 <_> <_> <_> 10 6 2 3 -1. <_> 10 7 2 1 3. 0 -1.8680640496313572e-003 0.1557087004184723 -0.0592420399188995 <_> <_> <_> 13 4 4 6 -1. <_> 14 5 2 6 2. 1 0.0412711799144745 9.2102894559502602e-003 -0.6225361824035645 <_> <_> <_> 12 4 6 4 -1. <_> 11 5 6 2 2. 1 -0.0341574586927891 -0.6910676956176758 0.0140588199719787 <_> <_> <_> 19 0 5 3 -1. <_> 19 1 5 1 3. 0 0.0281112492084503 6.3892039470374584e-003 -0.6016489267349243 <_> <_> <_> 6 7 3 1 -1. <_> 7 7 1 1 3. 0 -9.7675784491002560e-004 0.1663821935653687 -0.0533109381794930 <_> <_> <_> 19 0 5 3 -1. <_> 19 1 5 1 3. 0 -0.0284041091799736 -0.8431190848350525 4.9202498048543930e-003 <_> <_> <_> 6 7 3 1 -1. <_> 7 7 1 1 3. 0 9.7658135928213596e-004 -0.0524366609752178 0.1696853935718536 <_> <_> <_> 11 0 6 15 -1. <_> 13 0 2 15 3. 0 -0.0793864428997040 -0.7418122291564941 4.5842900872230530e-003 <_> <_> <_> 0 2 2 6 -1. <_> 0 2 1 3 2. <_> 1 5 1 3 2. 0 2.9205000028014183e-003 -0.0499707907438278 0.1705241948366165 <_> <_> <_> 21 0 2 1 -1. <_> 21 0 1 1 2. 1 -4.9792099744081497e-003 -0.4247047007083893 0.0113332699984312 <_> <_> <_> 4 0 1 2 -1. <_> 4 0 1 1 2. 1 7.5309360399842262e-003 0.0200634505599737 -0.4817556142807007 <_> <_> <_> 9 0 14 8 -1. <_> 9 0 7 8 2. 0 -0.1206317022442818 0.1783839017152786 -0.0404023304581642 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 6.4506952185183764e-005 -0.0858542472124100 0.1069532036781311 <_> <_> <_> 4 6 18 4 -1. <_> 4 6 9 4 2. 0 0.1407386958599091 -0.0227742493152618 0.4258378148078919 <_> <_> <_> 0 7 2 2 -1. <_> 0 7 1 1 2. <_> 1 8 1 1 2. 0 5.8708712458610535e-004 -0.0585701502859592 0.1556326001882553 <_> <_> <_> 23 7 2 2 -1. <_> 24 7 1 1 2. <_> 23 8 1 1 2. 0 4.2137140553677455e-005 -0.0576708205044270 0.0648988783359528 <_> <_> <_> 0 7 2 2 -1. <_> 0 7 1 1 2. <_> 1 8 1 1 2. 0 -5.4859159718034789e-005 0.1383187025785446 -0.0935516208410263 <_> <_> <_> 23 7 2 2 -1. <_> 24 7 1 1 2. <_> 23 8 1 1 2. 0 -8.1318263255525380e-005 0.0786737129092216 -0.0584529899060726 <_> <_> <_> 0 7 2 2 -1. <_> 0 7 1 1 2. <_> 1 8 1 1 2. 0 1.0710170317906886e-004 -0.1036069020628929 0.1105291023850441 <_> <_> <_> 24 6 1 4 -1. <_> 24 7 1 2 2. 0 5.9485197998583317e-003 0.0124739902094007 -0.6046726703643799 <_> <_> <_> 0 6 1 4 -1. <_> 0 7 1 2 2. 0 -3.8341151084750891e-003 -0.5651066899299622 0.0139579800888896 <_> <_> <_> 11 0 6 15 -1. <_> 13 0 2 15 3. 0 0.0481832996010780 6.8787620402872562e-003 -0.2265198975801468 <_> <_> <_> 0 1 2 3 -1. <_> 0 2 2 1 3. 0 9.8468521609902382e-003 0.0149204200133681 -0.5408421754837036 <_> <_> <_> 8 1 9 3 -1. <_> 8 2 9 1 3. 0 7.0795980282127857e-003 -0.0740584135055542 0.1212510019540787 <_> <_> <_> 8 1 3 3 -1. <_> 9 2 1 1 9. 0 -1.7187669873237610e-003 0.1150275021791458 -0.0767944231629372 <_> <_> <_> 19 7 5 3 -1. <_> 18 8 5 1 3. 1 0.0141321197152138 0.0222348105162382 -0.3713991045951843 <_> <_> <_> 6 7 3 5 -1. <_> 7 8 1 5 3. 1 -8.0704037100076675e-003 -0.2536310851573944 0.0307344105094671 <_> <_> <_> 1 0 24 14 -1. <_> 13 0 12 7 2. <_> 1 7 12 7 2. 0 0.2283755987882614 0.0168569702655077 -0.5456647872924805 <_> <_> <_> 8 11 9 4 -1. <_> 8 12 9 2 2. 0 -0.0106975501403213 0.1705504059791565 -0.0482324399054050 <_> <_> <_> 6 11 14 4 -1. <_> 6 12 14 2 2. 0 6.1057992279529572e-003 -0.0747807994484901 0.1244964972138405 <_> <_> <_> 0 11 3 4 -1. <_> 0 12 3 2 2. 0 3.5825320519506931e-003 0.0343106091022491 -0.2529211938381195 <_> <_> <_> 17 11 8 2 -1. <_> 17 12 8 1 2. 0 8.7969396263360977e-003 0.0227318406105042 -0.2092120051383972 <_> <_> <_> 0 11 8 2 -1. <_> 0 12 8 1 2. 0 -0.0117600196972489 -0.5789325237274170 0.0150208799168468 <_> <_> <_> 23 13 1 2 -1. <_> 23 14 1 1 2. 0 1.4420140068978071e-003 0.0108067002147436 -0.1743503063917160 <_> <_> <_> 1 13 1 2 -1. <_> 1 14 1 1 2. 0 -4.9062469770433381e-005 0.0891510024666786 -0.0946391522884369 <_> <_> <_> 9 0 14 8 -1. <_> 9 0 7 8 2. 0 0.0330546088516712 -0.0502973310649395 0.0724259391427040 <_> <_> <_> 0 1 14 8 -1. <_> 0 3 14 4 2. 0 -0.0449321903288364 0.0714013203978539 -0.1246540024876595 <_> <_> <_> 20 4 2 3 -1. <_> 20 5 2 1 3. 0 -0.0123274503275752 0.2216438055038452 -0.0160399992018938 <_> <_> <_> 0 1 14 9 -1. <_> 0 4 14 3 3. 0 -0.3724926114082336 -0.3693152964115143 0.0260022208094597 <_> <_> <_> 9 13 9 1 -1. <_> 12 13 3 1 3. 0 0.0152763100340962 5.3399899043142796e-003 -0.5456783771514893 <_> <_> <_> 7 13 9 1 -1. <_> 10 13 3 1 3. 0 -0.0145687395706773 -0.5883231163024902 0.0139877004548907 <_> <_> <_> 20 7 2 2 -1. <_> 21 7 1 1 2. <_> 20 8 1 1 2. 0 9.9890248384326696e-004 -0.0358810797333717 0.1743257045745850 -1.3605639934539795 13 -1 <_> <_> <_> <_> 5 9 15 6 -1. <_> 5 12 15 3 2. 0 0.0572950802743435 -0.1768665015697479 0.2448291033506393 <_> <_> <_> 21 0 2 6 -1. <_> 21 3 2 3 2. 0 -0.0100825401023030 0.1378919035196304 -0.2031147032976151 <_> <_> <_> 4 4 8 10 -1. <_> 4 4 4 5 2. <_> 8 9 4 5 2. 0 -0.0185250397771597 0.1623972952365875 -0.1676190942525864 <_> <_> <_> 16 1 8 6 -1. <_> 16 3 8 2 3. 0 -0.0527544915676117 0.1347105056047440 -0.1428814977407455 <_> <_> <_> 2 1 11 2 -1. <_> 2 1 11 1 2. 1 0.0243547502905130 -0.0266546793282032 0.4326488971710205 <_> <_> <_> 20 4 5 6 -1. <_> 20 6 5 2 3. 0 0.0634179636836052 0.0422610901296139 -0.4013176858425140 <_> <_> <_> 0 4 5 6 -1. <_> 0 6 5 2 3. 0 3.8921029772609472e-003 -0.1906750947237015 0.1267316043376923 <_> <_> <_> 19 11 6 4 -1. <_> 22 11 3 2 2. <_> 19 13 3 2 2. 0 1.5238909982144833e-003 -0.1371546983718872 0.1246439963579178 <_> <_> <_> 10 4 5 2 -1. <_> 10 5 5 1 2. 0 -6.7657418549060822e-003 0.2558242976665497 -0.0607152618467808 <_> <_> <_> 7 6 11 4 -1. <_> 7 7 11 2 2. 0 -0.0241763703525066 0.2859889864921570 -0.0642128363251686 <_> <_> <_> 9 2 4 4 -1. <_> 9 2 2 4 2. 1 -9.1761918738484383e-003 0.1021848022937775 -0.1999447047710419 <_> <_> <_> 1 0 24 11 -1. <_> 7 0 12 11 2. 0 -0.1578399986028671 0.2398308068513870 -0.0785783529281616 <_> <_> <_> 4 0 10 10 -1. <_> 9 0 5 10 2. 0 0.0487401895225048 -0.1100914031267166 0.1558353006839752 <_> <_> <_> 23 8 2 4 -1. <_> 23 8 2 2 2. 1 0.0191179793328047 0.0197066999971867 -0.3720233142375946 <_> <_> <_> 2 8 4 2 -1. <_> 2 8 2 2 2. 1 -0.0127781601622701 -0.4160012900829315 0.0353787206113338 <_> <_> <_> 23 3 2 12 -1. <_> 24 3 1 6 2. <_> 23 9 1 6 2. 0 2.6996301021426916e-003 -0.0985597372055054 0.1149144023656845 <_> <_> <_> 9 3 6 12 -1. <_> 9 3 3 6 2. <_> 12 9 3 6 2. 0 0.0245021991431713 0.0430920794606209 -0.3663294017314911 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 0.0850031301379204 0.0430114008486271 -0.2886289954185486 <_> <_> <_> 0 3 2 12 -1. <_> 0 3 1 6 2. <_> 1 9 1 6 2. 0 3.1647530850023031e-003 -0.1142930984497070 0.1279425024986267 <_> <_> <_> 14 8 3 4 -1. <_> 14 8 3 2 2. 1 0.0116577902808785 -0.0515255816280842 0.1422376930713654 <_> <_> <_> 0 0 6 1 -1. <_> 2 0 2 1 3. 0 -6.6801449283957481e-003 -0.4743103981018066 0.0287305805832148 <_> <_> <_> 9 2 16 7 -1. <_> 13 2 8 7 2. 0 -0.0388207696378231 0.0953134000301361 -0.0473909191787243 <_> <_> <_> 8 7 1 6 -1. <_> 8 7 1 3 2. 1 -0.0254217702895403 -0.4219881892204285 0.0284377895295620 <_> <_> <_> 8 7 9 4 -1. <_> 8 8 9 2 2. 0 -0.0121460696682334 0.1830082982778549 -0.0762820765376091 <_> <_> <_> 7 5 10 4 -1. <_> 7 6 10 2 2. 0 -0.0267872195690870 0.2859373092651367 -0.0522297993302345 <_> <_> <_> 14 2 1 6 -1. <_> 12 4 1 2 3. 1 -0.0116149904206395 0.1138594970107079 -0.0663506835699081 <_> <_> <_> 0 3 8 12 -1. <_> 0 3 4 6 2. <_> 4 9 4 6 2. 0 -0.0599568895995617 0.2777940034866333 -0.0470041483640671 <_> <_> <_> 19 13 6 2 -1. <_> 19 13 3 2 2. 0 -8.6737014353275299e-003 0.2129196971654892 -0.0287764091044664 <_> <_> <_> 0 13 6 2 -1. <_> 3 13 3 2 2. 0 2.8543549124151468e-003 -0.1221636980772018 0.1421594023704529 <_> <_> <_> 23 12 1 3 -1. <_> 23 13 1 1 3. 0 2.2713060025125742e-003 0.0182375106960535 -0.4104354083538055 <_> <_> <_> 1 12 1 3 -1. <_> 1 13 1 1 3. 0 -1.2334890197962523e-003 -0.3772745132446289 0.0350435785949230 <_> <_> <_> 23 12 1 3 -1. <_> 23 13 1 1 3. 0 -2.6904400438070297e-003 -0.4196098148822784 0.0100445803254843 <_> <_> <_> 4 10 10 1 -1. <_> 9 10 5 1 2. 0 -2.6551370974630117e-003 0.1150795966386795 -0.1072231009602547 <_> <_> <_> 23 12 1 3 -1. <_> 23 13 1 1 3. 0 -5.6895318266469985e-005 0.0416303612291813 -0.0317232310771942 <_> <_> <_> 1 12 1 3 -1. <_> 1 13 1 1 3. 0 9.8731368780136108e-004 0.0429715514183044 -0.2815021872520447 <_> <_> <_> 11 2 12 4 -1. <_> 11 3 12 2 2. 0 0.0182135794311762 -0.0451830588281155 0.1914888024330139 <_> <_> <_> 3 1 12 6 -1. <_> 3 3 12 2 3. 0 -0.0872772708535194 0.1718962937593460 -0.1219599992036820 <_> <_> <_> 23 0 2 2 -1. <_> 23 0 1 2 2. 1 -5.3898650221526623e-003 -0.3866654038429260 0.0155352503061295 <_> <_> <_> 2 0 2 2 -1. <_> 2 0 2 1 2. 1 0.0108539797365665 0.0364841781556606 -0.3959751129150391 <_> <_> <_> 14 13 4 2 -1. <_> 15 13 2 2 2. 0 -4.1801291517913342e-003 -0.4820233881473541 0.0170424394309521 <_> <_> <_> 3 6 6 3 -1. <_> 2 7 6 1 3. 1 -0.0234517697244883 0.4986476898193359 -0.0220960807055235 <_> <_> <_> 14 13 4 2 -1. <_> 15 13 2 2 2. 0 2.9061511158943176e-003 0.0269486699253321 -0.3256624042987824 <_> <_> <_> 0 7 24 4 -1. <_> 0 7 12 2 2. <_> 12 9 12 2 2. 0 0.0463646091520786 0.0268820300698280 -0.3762974143028259 <_> <_> <_> 23 0 2 2 -1. <_> 23 1 2 1 2. 0 -2.1972910326439887e-004 0.0705367177724838 -0.1089593023061752 <_> <_> <_> 7 13 4 2 -1. <_> 8 13 2 2 2. 0 -3.7804399617016315e-003 -0.4887917041778565 0.0199932008981705 <_> <_> <_> 16 11 2 2 -1. <_> 17 11 1 1 2. <_> 16 12 1 1 2. 0 6.0642170865321532e-005 -0.0753576681017876 0.0811428874731064 <_> <_> <_> 8 11 9 4 -1. <_> 8 12 9 2 2. 0 -0.0106888897716999 0.2206722944974899 -0.0562041401863098 <_> <_> <_> 2 12 21 3 -1. <_> 9 13 7 1 9. 0 0.0436831787228584 -0.0610822103917599 0.1712581962347031 <_> <_> <_> 1 13 21 2 -1. <_> 8 13 7 2 3. 0 -0.0202471297234297 0.1565587073564529 -0.0770068317651749 <_> <_> <_> 22 10 1 4 -1. <_> 21 11 1 2 2. 1 -5.9285280294716358e-003 -0.4369310140609741 0.0202764291316271 <_> <_> <_> 3 5 6 3 -1. <_> 2 6 6 1 3. 1 0.0113492002710700 -0.0597750283777714 0.1651744991540909 <_> <_> <_> 13 2 8 5 -1. <_> 15 4 4 5 2. 1 -0.1365716010332108 -0.8707361817359924 4.2868419550359249e-003 <_> <_> <_> 4 2 8 6 -1. <_> 4 4 8 2 3. 0 0.0663046464323998 -0.0388697795569897 0.2649452090263367 <_> <_> <_> 5 1 15 4 -1. <_> 5 2 15 2 2. 0 0.0195911191403866 -0.0803443267941475 0.1665123999118805 <_> <_> <_> 0 1 8 4 -1. <_> 0 2 8 2 2. 0 0.0340932197868824 0.0261821094900370 -0.4526833891868591 <_> <_> <_> 10 0 15 14 -1. <_> 10 7 15 7 2. 0 -0.2061661928892136 -0.4254589080810547 0.0156788490712643 <_> <_> <_> 9 13 6 2 -1. <_> 11 13 2 2 3. 0 -7.6675140298902988e-003 -0.3513334095478058 0.0274340193718672 <_> <_> <_> 8 9 11 4 -1. <_> 8 10 11 2 2. 0 -0.0129145104438066 0.1359857022762299 -0.0633687376976013 <_> <_> <_> 8 6 3 3 -1. <_> 9 7 1 3 3. 1 0.0160742308944464 0.0215212907642126 -0.4643712937831879 <_> <_> <_> 21 5 4 6 -1. <_> 21 7 4 2 3. 0 0.0369430296123028 0.0274755004793406 -0.3073608875274658 <_> <_> <_> 12 3 6 6 -1. <_> 10 5 6 2 3. 1 -0.0755213573575020 -0.4241931140422821 0.0237817000597715 <_> <_> <_> 12 9 10 6 -1. <_> 12 9 5 6 2. 0 0.0243982393294573 -0.0493879318237305 0.1672402024269104 <_> <_> <_> 3 9 10 6 -1. <_> 8 9 5 6 2. 0 0.1157704964280129 0.0166440103203058 -0.6928011178970337 <_> <_> <_> 12 0 4 1 -1. <_> 13 0 2 1 2. 0 9.1529998462647200e-004 -0.0502800084650517 0.1328525990247726 <_> <_> <_> 3 10 4 1 -1. <_> 4 11 2 1 2. 1 -3.6248450633138418e-003 -0.3066833913326263 0.0284923594444990 <_> <_> <_> 18 12 1 2 -1. <_> 18 12 1 1 2. 1 -7.3581631295382977e-004 0.0559885688126087 -0.0392797887325287 <_> <_> <_> 2 0 20 10 -1. <_> 12 0 10 10 2. 0 0.2000436931848526 -0.0568408109247684 0.1685038954019547 <_> <_> <_> 22 2 3 6 -1. <_> 23 3 1 6 3. 1 -0.0178776904940605 0.1931751966476440 -0.0514639392495155 <_> <_> <_> 3 2 6 3 -1. <_> 2 3 6 1 3. 1 0.0113503802567720 -0.0489644110202789 0.2181939035654068 <_> <_> <_> 21 1 4 6 -1. <_> 23 1 2 3 2. <_> 21 4 2 3 2. 0 0.0125029096379876 -0.0419848784804344 0.2713862061500549 <_> <_> <_> 0 1 4 6 -1. <_> 0 1 2 3 2. <_> 2 4 2 3 2. 0 -9.3033276498317719e-003 0.1590452045202255 -0.0626974031329155 <_> <_> <_> 24 0 1 6 -1. <_> 24 3 1 3 2. 0 9.8205171525478363e-003 0.0155331101268530 -0.3304075896739960 <_> <_> <_> 0 0 1 6 -1. <_> 0 3 1 3 2. 0 4.4993069022893906e-003 0.0376702398061752 -0.3112137019634247 <_> <_> <_> 18 0 6 6 -1. <_> 18 2 6 2 3. 0 0.0140464501455426 -0.0434262491762638 0.1032719984650612 <_> <_> <_> 5 1 15 4 -1. <_> 5 2 15 2 2. 0 -0.0411175191402435 0.1867991983890533 -0.0664343684911728 <_> <_> <_> 4 8 18 1 -1. <_> 10 8 6 1 3. 0 -0.0107145197689533 0.1244383975863457 -0.0663585364818573 <_> <_> <_> 8 6 6 4 -1. <_> 8 7 6 2 2. 0 9.2895422130823135e-003 -0.0821698531508446 0.1224353983998299 <_> <_> <_> 9 5 8 2 -1. <_> 11 5 4 2 2. 0 -0.0130508001893759 -0.4003388881683350 0.0166369099169970 <_> <_> <_> 5 0 6 6 -1. <_> 7 0 2 6 3. 0 -0.0364681892096996 -0.5473737716674805 0.0148177295923233 <_> <_> <_> 21 8 2 1 -1. <_> 21 8 1 1 2. 0 -7.5372940045781434e-005 0.0594716407358646 -0.0578790009021759 <_> <_> <_> 7 1 2 2 -1. <_> 7 1 2 1 2. 1 0.0142522901296616 0.0252972692251205 -0.3336473107337952 <_> <_> <_> 17 4 8 4 -1. <_> 17 5 8 2 2. 0 3.3469200134277344e-003 -0.0707368031144142 0.0745013207197189 <_> <_> <_> 6 0 13 2 -1. <_> 6 1 13 1 2. 0 4.4445958919823170e-003 -0.0672459527850151 0.1451885998249054 <_> <_> <_> 21 5 4 6 -1. <_> 21 7 4 2 3. 0 -8.7205823510885239e-003 -0.2021352946758270 0.0275202393531799 <_> <_> <_> 0 5 4 6 -1. <_> 0 7 4 2 3. 0 0.0469216890633106 0.0161568503826857 -0.5311927795410156 <_> <_> <_> 21 8 2 1 -1. <_> 21 8 1 1 2. 0 5.8387980971019715e-005 -0.0557161718606949 0.0720106214284897 <_> <_> <_> 2 8 2 1 -1. <_> 3 8 1 1 2. 0 -4.6103101340122521e-005 0.0959030091762543 -0.0971473827958107 <_> <_> <_> 23 0 2 1 -1. <_> 23 0 1 1 2. 1 6.0657761059701443e-003 0.0240712091326714 -0.2376091033220291 <_> <_> <_> 4 0 15 4 -1. <_> 4 1 15 2 2. 0 -0.0555203706026077 0.3074511885643005 -0.0299711804836988 <_> <_> <_> 15 1 10 8 -1. <_> 15 3 10 4 2. 0 -0.0365539006888866 0.0328120291233063 -0.0570152215659618 <_> <_> <_> 0 5 4 2 -1. <_> 0 5 2 1 2. <_> 2 6 2 1 2. 0 1.8784699495881796e-003 -0.0653261989355087 0.1390983015298843 <_> <_> <_> 23 0 2 1 -1. <_> 23 0 1 1 2. 1 -7.4822120368480682e-003 -0.7748216986656189 5.9286328032612801e-003 <_> <_> <_> 0 5 1 4 -1. <_> 0 6 1 2 2. 0 -3.3365150447934866e-003 -0.3616085052490234 0.0226737502962351 <_> <_> <_> 19 13 4 2 -1. <_> 19 14 4 1 2. 0 -0.0122549999505281 -0.6580218076705933 4.3241591192781925e-003 <_> <_> <_> 7 12 2 2 -1. <_> 7 12 1 1 2. <_> 8 13 1 1 2. 0 -2.5022740010172129e-004 0.1368491053581238 -0.0613101907074451 <_> <_> <_> 1 0 24 8 -1. <_> 13 0 12 4 2. <_> 1 4 12 4 2. 0 0.1189583986997604 0.0244670100510120 -0.3081929087638855 <_> <_> <_> 2 4 3 3 -1. <_> 2 5 3 1 3. 0 1.8534749979153275e-003 -0.0657177790999413 0.1380506008863449 <_> <_> <_> 20 6 4 3 -1. <_> 19 7 4 1 3. 1 -0.0139663796871901 -0.4281671941280365 0.0166652500629425 <_> <_> <_> 5 6 3 4 -1. <_> 6 7 1 4 3. 1 -0.0120118902996182 -0.4546675086021423 0.0174813903868198 <_> <_> <_> 16 11 2 2 -1. <_> 17 11 1 1 2. <_> 16 12 1 1 2. 0 8.6380320135504007e-004 0.0268306396901608 -0.1949577033519745 <_> <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. 0 -5.4863549303263426e-004 0.1728172004222870 -0.0519250482320786 <_> <_> <_> 9 5 9 3 -1. <_> 12 5 3 3 3. 0 0.0356420204043388 0.0119973402470350 -0.2636224925518036 <_> <_> <_> 0 0 6 1 -1. <_> 2 0 2 1 3. 0 9.2830741778016090e-003 0.0153813296929002 -0.5276867151260376 <_> <_> <_> 17 4 8 1 -1. <_> 19 4 4 1 2. 0 3.3444799482822418e-003 -0.0448165088891983 0.1556369960308075 <_> <_> <_> 7 5 9 3 -1. <_> 10 5 3 3 3. 0 -0.0348524898290634 -0.6144651770591736 0.0147144095972180 <_> <_> <_> 17 4 8 1 -1. <_> 19 4 4 1 2. 0 -3.6836538929492235e-003 0.0679996237158775 -0.0403181910514832 <_> <_> <_> 0 4 8 1 -1. <_> 2 4 4 1 2. 0 2.6370671112090349e-003 -0.0527165904641151 0.1650273054838181 <_> <_> <_> 16 11 2 2 -1. <_> 17 11 1 1 2. <_> 16 12 1 1 2. 0 -1.1408380232751369e-003 -0.1495666950941086 0.0155292097479105 <_> <_> <_> 6 11 12 2 -1. <_> 9 11 6 2 2. 0 -5.5604642257094383e-003 0.1015162020921707 -0.0783084183931351 <_> <_> <_> 4 6 20 9 -1. <_> 9 6 10 9 2. 0 0.0313040204346180 -0.0519621782004833 0.1036399006843567 <_> <_> <_> 6 8 12 2 -1. <_> 6 9 12 1 2. 0 9.2903850600123405e-003 -0.0539887212216854 0.1653061956167221 <_> <_> <_> 6 8 13 4 -1. <_> 6 9 13 2 2. 0 -0.0108930300921202 0.1281013935804367 -0.0734129622578621 <_> <_> <_> 2 13 4 2 -1. <_> 2 14 4 1 2. 0 -4.9190609715878963e-003 -0.3507530987262726 0.0244891606271267 <_> <_> <_> 11 1 3 12 -1. <_> 11 4 3 6 2. 0 0.0811754167079926 0.0209406390786171 -0.3776533007621765 <_> <_> <_> 7 10 11 4 -1. <_> 7 11 11 2 2. 0 -7.1189319714903831e-003 0.1320966929197311 -0.0743796005845070 <_> <_> <_> 5 9 15 6 -1. <_> 5 11 15 2 3. 0 0.0290335901081562 -0.0601534284651279 0.1686525046825409 <_> <_> <_> 1 5 14 10 -1. <_> 1 10 14 5 2. 0 0.2666859030723572 0.0302151106297970 -0.3336375057697296 <_> <_> <_> 13 10 2 2 -1. <_> 14 10 1 1 2. <_> 13 11 1 1 2. 0 1.3437710003927350e-003 0.0244619604200125 -0.3497652113437653 <_> <_> <_> 0 0 4 2 -1. <_> 0 1 4 1 2. 0 -6.4065970946103334e-005 0.0681859701871872 -0.1218236982822418 <_> <_> <_> 18 3 4 2 -1. <_> 18 4 4 1 2. 0 -2.2273659706115723e-003 0.0591664388775826 -0.0569609887897968 <_> <_> <_> 0 7 4 4 -1. <_> 0 8 4 2 2. 0 1.0822839976754040e-004 -0.1183675006031990 0.0699028074741364 <_> <_> <_> 12 12 6 2 -1. <_> 14 12 2 2 3. 0 7.7762501314282417e-003 0.0182663407176733 -0.3238837122917175 <_> <_> <_> 7 0 3 1 -1. <_> 8 0 1 1 3. 0 -8.5627898806706071e-004 0.1596496999263763 -0.0523401089012623 <_> <_> <_> 15 0 2 1 -1. <_> 15 0 1 1 2. 0 3.9805951528251171e-003 5.6993248872458935e-003 -0.6384922862052918 <_> <_> <_> 8 0 2 1 -1. <_> 9 0 1 1 2. 0 -4.9052381655201316e-004 0.1629474014043808 -0.0742301419377327 <_> <_> <_> 18 3 2 10 -1. <_> 18 3 1 10 2. 0 -0.0184035003185272 -0.6773443222045898 0.0107059404253960 <_> <_> <_> 7 1 2 2 -1. <_> 7 1 1 1 2. <_> 8 2 1 1 2. 0 -8.9714571367949247e-004 0.1691973060369492 -0.0477185398340225 <_> <_> <_> 18 0 7 3 -1. <_> 18 1 7 1 3. 0 -0.0167341101914644 -0.3151237964630127 0.0124420495703816 <_> <_> <_> 7 12 6 2 -1. <_> 9 12 2 2 3. 0 -0.0119769899174571 -0.5293223857879639 0.0144362701103091 <_> <_> <_> 20 7 4 3 -1. <_> 20 8 4 1 3. 0 7.0368088781833649e-003 0.0264915898442268 -0.2470992058515549 <_> <_> <_> 5 3 2 10 -1. <_> 6 3 1 10 2. 0 -0.0105798998847604 -0.4092808067798615 0.0187591798603535 <_> <_> <_> 16 0 2 2 -1. <_> 17 0 1 1 2. <_> 16 1 1 1 2. 0 6.0849997680634260e-004 -0.0334094502031803 0.0843884497880936 <_> <_> <_> 7 0 2 2 -1. <_> 7 0 1 1 2. <_> 8 1 1 1 2. 0 -5.9445307124406099e-004 0.1412419974803925 -0.0555582903325558 <_> <_> <_> 15 0 6 2 -1. <_> 17 0 2 2 3. 0 -0.0157594103366137 -0.3833500146865845 0.0156633593142033 <_> <_> <_> 0 0 1 4 -1. <_> 0 2 1 2 2. 0 -0.0101080304011703 -0.3391439020633698 0.0209970101714134 <_> <_> <_> 22 1 2 12 -1. <_> 18 5 2 4 3. 1 8.8242385536432266e-003 0.0468829013407230 -0.0345581099390984 <_> <_> <_> 4 0 12 3 -1. <_> 8 4 4 3 3. 1 0.1695280969142914 -0.0297883804887533 0.2978200018405914 <_> <_> <_> 14 13 2 2 -1. <_> 15 13 1 1 2. <_> 14 14 1 1 2. 0 1.4175090473145247e-003 0.0145506802946329 -0.2557711899280548 <_> <_> <_> 11 6 3 3 -1. <_> 12 7 1 1 9. 0 -6.2455357983708382e-003 0.1703144013881683 -0.0457185097038746 <_> <_> <_> 15 1 10 8 -1. <_> 15 3 10 4 2. 0 0.0829719901084900 -0.0108856502920389 0.2358570992946625 <_> <_> <_> 0 1 10 8 -1. <_> 0 3 10 4 2. 0 -0.0363879613578320 0.0720635578036308 -0.1351491957902908 <_> <_> <_> 11 3 14 10 -1. <_> 11 8 14 5 2. 0 0.2605817019939423 0.0307604894042015 -0.2081860005855560 <_> <_> <_> 0 0 24 12 -1. <_> 0 0 12 6 2. <_> 12 6 12 6 2. 0 -0.1837086975574493 -0.4619984030723572 0.0176900699734688 <_> <_> <_> 20 7 4 3 -1. <_> 20 8 4 1 3. 0 -3.9726989343762398e-003 -0.1660892963409424 0.0209467206150293 <_> <_> <_> 0 1 7 3 -1. <_> 0 2 7 1 3. 0 0.0214559100568295 0.0231478307396173 -0.3625465929508209 <_> <_> <_> 20 7 4 3 -1. <_> 20 8 4 1 3. 0 0.0144318202510476 4.4689280912280083e-003 -0.2445929050445557 <_> <_> <_> 0 7 1 8 -1. <_> 0 9 1 4 2. 0 -3.3524229656904936e-003 -0.2480840981006622 0.0316352993249893 <_> <_> <_> 22 4 3 4 -1. <_> 23 5 1 4 3. 1 -0.0156694706529379 0.3172483146190643 -0.0374899208545685 <_> <_> <_> 11 2 12 1 -1. <_> 15 6 4 1 3. 1 -0.0400774292647839 -0.2589775919914246 0.0327349714934826 <_> <_> <_> 22 4 3 4 -1. <_> 23 5 1 4 3. 1 0.0123612098395824 -0.0450748614966869 0.1690649986267090 <_> <_> <_> 1 7 4 3 -1. <_> 1 8 4 1 3. 0 0.0109678898006678 0.0187921095639467 -0.4384852945804596 <_> <_> <_> 13 9 6 2 -1. <_> 15 9 2 2 3. 0 -0.0137434704229236 -0.4609765112400055 0.0122369602322578 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 -1.0322439484298229e-003 0.1648599952459335 -0.0516587682068348 <_> <_> <_> 13 9 6 2 -1. <_> 15 9 2 2 3. 0 8.8313361629843712e-003 0.0159355308860540 -0.2015953958034515 <_> <_> <_> 4 0 6 2 -1. <_> 6 0 2 2 3. 0 0.0144206797704101 0.0160773508250713 -0.4641633033752441 <_> <_> <_> 13 9 6 2 -1. <_> 15 9 2 2 3. 0 -1.8205989617854357e-003 0.0433134213089943 -0.0280837193131447 <_> <_> <_> 7 7 2 6 -1. <_> 7 7 1 6 2. 1 3.9304671809077263e-003 0.0497011989355087 -0.1514773964881897 <_> <_> <_> 24 0 1 10 -1. <_> 24 5 1 5 2. 0 -8.3210691809654236e-003 -0.1029928028583527 0.0179813895374537 <_> <_> <_> 6 7 3 1 -1. <_> 7 7 1 1 3. 0 -1.1277500307187438e-003 0.1659521013498306 -0.0483443103730679 <_> <_> <_> 14 13 2 2 -1. <_> 15 13 1 1 2. <_> 14 14 1 1 2. 0 -7.8385067172348499e-004 -0.1946461051702499 0.0250845197588205 <_> <_> <_> 8 7 4 1 -1. <_> 9 7 2 1 2. 0 -8.5464341100305319e-004 0.1473073959350586 -0.0529893897473812 <_> <_> <_> 24 4 1 9 -1. <_> 21 7 1 3 3. 1 -6.1449417844414711e-003 0.0951583385467529 -0.0323545187711716 <_> <_> <_> 1 4 9 1 -1. <_> 4 7 3 1 3. 1 0.0537422299385071 -0.0160139091312885 0.5178387761116028 <_> <_> <_> 11 1 6 13 -1. <_> 13 1 2 13 3. 0 -9.1773690655827522e-003 0.0658730715513229 -0.0286986008286476 <_> <_> <_> 10 2 4 7 -1. <_> 11 2 2 7 2. 0 -1.6262140125036240e-003 0.1165013015270233 -0.0662005692720413 <_> <_> <_> 11 1 6 13 -1. <_> 13 1 2 13 3. 0 -0.0702467709779739 -0.5561671257019043 3.3650770783424377e-003 <_> <_> <_> 8 1 6 13 -1. <_> 10 1 2 13 3. 0 -0.0457130484282970 -0.5554363131523132 0.0145238302648067 <_> <_> <_> 16 9 4 1 -1. <_> 16 9 2 1 2. 0 -1.6252630157396197e-003 0.0774459466338158 -0.0477535910904408 <_> <_> <_> 5 9 4 1 -1. <_> 7 9 2 1 2. 0 -8.7784547358751297e-003 -0.6660557985305786 0.0114997997879982 <_> <_> <_> 17 4 1 9 -1. <_> 14 7 1 3 3. 1 0.0581780597567558 -0.0126901902258396 0.2431164979934692 <_> <_> <_> 7 4 2 2 -1. <_> 7 4 1 1 2. <_> 8 5 1 1 2. 0 -1.0166700230911374e-003 0.1701835989952087 -0.0434626787900925 <_> <_> <_> 13 9 2 2 -1. <_> 14 9 1 1 2. <_> 13 10 1 1 2. 0 -8.3186908159404993e-004 -0.1554417014122009 0.0277679692953825 <_> <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. 0 1.0635660146363080e-004 -0.0799610763788223 0.0975525230169296 <_> <_> <_> 13 9 2 2 -1. <_> 14 9 1 1 2. <_> 13 10 1 1 2. 0 7.7358598355203867e-004 0.0280197393149138 -0.1640979051589966 <_> <_> <_> 6 13 10 1 -1. <_> 11 13 5 1 2. 0 -5.1288288086652756e-003 0.1435500979423523 -0.0521811507642269 <_> <_> <_> 9 8 10 7 -1. <_> 9 8 5 7 2. 0 -0.0296237897127867 0.1256711930036545 -0.0727018266916275 <_> <_> <_> 4 5 15 10 -1. <_> 9 5 5 10 3. 0 0.0479203201830387 -0.0627507865428925 0.1496749967336655 <_> <_> <_> 20 6 5 4 -1. <_> 20 7 5 2 2. 0 0.0299077890813351 3.3279890194535255e-003 -0.5352283716201782 <_> <_> <_> 0 6 5 4 -1. <_> 0 7 5 2 2. 0 -3.1103161163628101e-003 -0.1846338063478470 0.0402609407901764 <_> <_> <_> 11 7 3 1 -1. <_> 12 7 1 1 3. 0 1.1777599574998021e-003 -0.0421488806605339 0.1833201944828033 <_> <_> <_> 9 4 7 3 -1. <_> 9 5 7 1 3. 0 0.0149721698835492 -0.0501780100166798 0.1479559987783432 <_> <_> <_> 15 4 4 3 -1. <_> 15 4 2 3 2. 0 0.0226974897086620 8.8858045637607574e-003 -0.3510260879993439 <_> <_> <_> 6 4 4 3 -1. <_> 8 4 2 3 2. 0 0.0128841297701001 0.0346549116075039 -0.2406193017959595 <_> <_> <_> 16 6 2 2 -1. <_> 17 6 1 1 2. <_> 16 7 1 1 2. 0 -1.1240700259804726e-003 0.1314530968666077 -0.0288430396467447 <_> <_> <_> 7 6 2 2 -1. <_> 7 6 1 1 2. <_> 8 7 1 1 2. 0 -1.3627869775518775e-003 0.2013843953609467 -0.0379555486142635 <_> <_> <_> 14 13 2 2 -1. <_> 15 13 1 1 2. <_> 14 14 1 1 2. 0 5.3557957289740443e-004 0.0279592797160149 -0.1196514964103699 <_> <_> <_> 6 0 4 2 -1. <_> 6 0 4 1 2. 1 -0.0152801796793938 -0.4851869940757752 0.0156223699450493 <_> <_> <_> 20 14 2 1 -1. <_> 20 14 1 1 2. 0 4.6412500523729250e-005 -0.0589389093220234 0.0601089298725128 <_> <_> <_> 1 13 6 2 -1. <_> 1 13 3 1 2. <_> 4 14 3 1 2. 0 9.6553878393024206e-005 -0.0965948700904846 0.0779175236821175 <_> <_> <_> 12 1 2 2 -1. <_> 12 2 2 1 2. 0 3.8991239853203297e-003 -0.0261822007596493 0.1902385950088501 <_> <_> <_> 8 0 8 8 -1. <_> 8 0 4 4 2. <_> 12 4 4 4 2. 0 0.0237854700535536 0.0403596796095371 -0.1793317049741745 <_> <_> <_> 16 12 2 2 -1. <_> 17 12 1 1 2. <_> 16 13 1 1 2. 0 5.9117228374816477e-005 -0.0676945373415947 0.0789666101336479 <_> <_> <_> 0 4 8 8 -1. <_> 0 4 4 4 2. <_> 4 8 4 4 2. 0 0.0585355199873447 -0.0279133208096027 0.2635962069034576 <_> <_> <_> 19 4 2 1 -1. <_> 19 4 1 1 2. 0 -6.7125670611858368e-003 -0.8246011137962341 3.6960430443286896e-003 <_> <_> <_> 4 4 2 1 -1. <_> 5 4 1 1 2. 0 -4.6747662127017975e-003 -0.7625464797019959 9.2743840068578720e-003 <_> <_> <_> 20 0 2 2 -1. <_> 21 0 1 1 2. <_> 20 1 1 1 2. 0 5.3981528617441654e-003 1.9147379789501429e-003 -0.8057739734649658 <_> <_> <_> 0 5 15 3 -1. <_> 0 6 15 1 3. 0 7.7252141200006008e-003 -0.0822006091475487 0.0925986021757126 <_> <_> <_> 13 5 1 3 -1. <_> 13 6 1 1 3. 0 -1.1672140099108219e-003 0.1147938966751099 -0.0459650196135044 <_> <_> <_> 4 9 3 2 -1. <_> 5 10 1 2 3. 1 -7.4022258631885052e-003 -0.4262216091156006 0.0174518898129463 <_> <_> <_> 20 0 2 2 -1. <_> 21 0 1 1 2. <_> 20 1 1 1 2. 0 6.5430802351329476e-005 -0.0445476993918419 0.0498182512819767 <_> <_> <_> 3 0 2 2 -1. <_> 3 0 1 1 2. <_> 4 1 1 1 2. 0 4.6353430661838502e-005 -0.0820099934935570 0.0922331288456917 -1.2964390516281128 14 -1 <_> <_> <_> <_> 0 11 12 4 -1. <_> 0 11 6 2 2. <_> 6 13 6 2 2. 0 0.0105607798323035 -0.1728546023368835 0.2072951048612595 <_> <_> <_> 17 1 8 4 -1. <_> 17 3 8 2 2. 0 -0.0382373891770840 0.1771112978458405 -0.1585303992033005 <_> <_> <_> 6 6 13 6 -1. <_> 6 8 13 2 3. 0 -0.0541206710040569 0.2564443051815033 -0.0884335711598396 <_> <_> <_> 23 4 2 3 -1. <_> 23 4 1 3 2. 0 -2.2004460915923119e-003 0.2010346055030823 -0.1101640984416008 <_> <_> <_> 2 13 10 2 -1. <_> 2 14 10 1 2. 0 0.0654388666152954 7.8213139204308391e-004 -4.3508232421875000e+003 <_> <_> <_> 23 4 2 3 -1. <_> 23 4 1 3 2. 0 -0.0135645801201463 -0.5407810807228088 4.8653590492904186e-003 <_> <_> <_> 0 4 2 3 -1. <_> 1 4 1 3 2. 0 -1.8708320567384362e-003 0.1633561998605728 -0.1228590980172157 <_> <_> <_> 2 7 21 3 -1. <_> 9 8 7 1 9. 0 0.1699268966913223 -4.5410599559545517e-003 0.4810850024223328 <_> <_> <_> 2 11 2 2 -1. <_> 2 11 1 2 2. 1 3.5981500986963511e-003 0.0356757305562496 -0.4236158132553101 <_> <_> <_> 2 2 21 6 -1. <_> 9 4 7 2 9. 0 0.5448976159095764 -0.0198735594749451 0.5460472106933594 <_> <_> <_> 1 1 8 6 -1. <_> 1 3 8 2 3. 0 -0.0627753064036369 0.1722137033939362 -0.1143800020217896 <_> <_> <_> 6 4 15 4 -1. <_> 6 5 15 2 2. 0 -0.0459444113075733 0.2595784068107605 -0.0732216089963913 <_> <_> <_> 2 10 4 1 -1. <_> 3 11 2 1 2. 1 2.1809421014040709e-003 0.0495434813201427 -0.3175086975097656 <_> <_> <_> 4 14 18 1 -1. <_> 4 14 9 1 2. 0 -9.6566081047058105e-003 0.1581763029098511 -0.0890468433499336 <_> <_> <_> 0 3 24 10 -1. <_> 0 3 12 5 2. <_> 12 8 12 5 2. 0 0.0808042436838150 0.0503276288509369 -0.2887117862701416 <_> <_> <_> 15 3 10 12 -1. <_> 20 3 5 6 2. <_> 15 9 5 6 2. 0 0.0987789332866669 -0.0381883382797241 0.3119831085205078 <_> <_> <_> 9 5 6 3 -1. <_> 9 6 6 1 3. 0 8.4114018827676773e-003 -0.0949936509132385 0.1344850063323975 <_> <_> <_> 2 13 21 1 -1. <_> 9 13 7 1 3. 0 -0.0147700998932123 0.1715719997882843 -0.0750405564904213 <_> <_> <_> 0 3 10 12 -1. <_> 0 3 5 6 2. <_> 5 9 5 6 2. 0 0.1057564020156860 -0.0440231785178185 0.3495194017887116 <_> <_> <_> 5 3 15 4 -1. <_> 5 4 15 2 2. 0 0.0401043891906738 -0.0572791509330273 0.2763915061950684 <_> <_> <_> 8 6 9 3 -1. <_> 8 7 9 1 3. 0 0.0135993398725986 -0.0886402428150177 0.1596630066633225 <_> <_> <_> 14 13 3 1 -1. <_> 15 13 1 1 3. 0 -3.3378789667040110e-003 -0.4990870058536530 7.1760369464755058e-003 <_> <_> <_> 7 1 10 2 -1. <_> 7 2 10 1 2. 0 6.5490198321640491e-003 -0.0597806982696056 0.2110590040683746 <_> <_> <_> 14 13 3 1 -1. <_> 15 13 1 1 3. 0 -6.2758670537732542e-005 0.0655476525425911 -0.0541992485523224 <_> <_> <_> 8 13 3 1 -1. <_> 9 13 1 1 3. 0 9.0889551211148500e-004 0.0425700992345810 -0.2828716039657593 <_> <_> <_> 1 0 24 12 -1. <_> 13 0 12 6 2. <_> 1 6 12 6 2. 0 0.0881031826138496 0.0406627096235752 -0.2983728945255280 <_> <_> <_> 0 0 13 14 -1. <_> 0 7 13 7 2. 0 -0.1351538002490997 -0.4011076092720032 0.0259989295154810 <_> <_> <_> 21 6 3 3 -1. <_> 20 7 3 1 3. 1 0.0105496803298593 0.0265602301806211 -0.3554666042327881 <_> <_> <_> 8 9 8 4 -1. <_> 8 10 8 2 2. 0 -0.0109745198860765 0.1540209054946899 -0.0715849623084068 <_> <_> <_> 13 10 6 4 -1. <_> 15 10 2 4 3. 0 -0.0128105496987700 -0.2680475115776062 0.0205432493239641 <_> <_> <_> 11 3 4 4 -1. <_> 11 3 2 4 2. 1 -0.0673751235008240 -0.5299177169799805 0.0192500203847885 <_> <_> <_> 13 10 6 4 -1. <_> 15 10 2 4 3. 0 0.0133285904303193 0.0141924796625972 -0.2692896127700806 <_> <_> <_> 7 10 10 4 -1. <_> 7 12 10 2 2. 0 -0.0349247902631760 0.2877762019634247 -0.0366922505199909 <_> <_> <_> 13 10 6 4 -1. <_> 15 10 2 4 3. 0 -0.0259607005864382 -0.5250588059425354 4.2013241909444332e-003 <_> <_> <_> 6 10 6 4 -1. <_> 8 10 2 4 3. 0 -0.0144326100125909 -0.4404621124267578 0.0239412691444159 <_> <_> <_> 21 14 4 1 -1. <_> 21 14 2 1 2. 0 1.0242980206385255e-003 -0.0813294127583504 0.1090075969696045 <_> <_> <_> 0 7 4 4 -1. <_> 0 8 4 2 2. 0 -3.3913699444383383e-003 -0.2744260132312775 0.0353980511426926 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 -0.0254591107368469 0.1884281933307648 -0.0505212917923927 <_> <_> <_> 5 1 15 2 -1. <_> 5 2 15 1 2. 0 -0.0250639300793409 0.1583306044340134 -0.0679820179939270 <_> <_> <_> 19 1 3 4 -1. <_> 19 2 3 2 2. 0 4.5757358893752098e-003 -0.0512838996946812 0.1146584972739220 <_> <_> <_> 2 5 20 4 -1. <_> 12 5 10 4 2. 0 -0.1538352966308594 0.4274145960807800 -0.0233538504689932 <_> <_> <_> 21 14 4 1 -1. <_> 21 14 2 1 2. 0 6.7441980354487896e-003 0.0116364201530814 -0.1990616023540497 <_> <_> <_> 0 14 4 1 -1. <_> 2 14 2 1 2. 0 4.9857632257044315e-004 -0.1112217977643013 0.0913273170590401 <_> <_> <_> 19 3 6 12 -1. <_> 22 3 3 6 2. <_> 19 9 3 6 2. 0 0.0416502095758915 -0.0342307090759277 0.1340909004211426 <_> <_> <_> 0 3 6 12 -1. <_> 0 3 3 6 2. <_> 3 9 3 6 2. 0 -0.0486865788698196 0.3840608894824982 -0.0367092713713646 <_> <_> <_> 19 1 3 4 -1. <_> 19 2 3 2 2. 0 -0.0142661100253463 0.1904101967811585 -0.0373262614011765 <_> <_> <_> 3 1 3 4 -1. <_> 3 2 3 2 2. 0 2.0738251041620970e-003 -0.0940800234675407 0.1367546021938324 <_> <_> <_> 10 1 10 2 -1. <_> 10 1 5 2 2. 0 -0.0127805396914482 0.0790209397673607 -0.0321417711675167 <_> <_> <_> 5 0 8 3 -1. <_> 9 0 4 3 2. 0 8.7420884519815445e-003 -0.0805833786725998 0.1433219015598297 <_> <_> <_> 21 0 2 1 -1. <_> 21 0 1 1 2. 1 6.9780537160113454e-005 -0.1539752036333084 0.0694082602858543 <_> <_> <_> 2 8 4 2 -1. <_> 3 9 2 2 2. 1 -7.9981610178947449e-003 -0.4497911930084229 0.0232297703623772 <_> <_> <_> 21 0 2 1 -1. <_> 21 0 1 1 2. 1 5.3804512135684490e-003 0.0246548391878605 -0.1725358963012695 <_> <_> <_> 2 0 21 1 -1. <_> 9 0 7 1 3. 0 -0.0200069397687912 0.1652639061212540 -0.0625987574458122 <_> <_> <_> 21 0 2 1 -1. <_> 21 0 1 1 2. 1 -4.4656409882009029e-003 -0.3730463087558746 0.0105512700974941 <_> <_> <_> 4 0 1 2 -1. <_> 4 0 1 1 2. 1 -3.1919090542942286e-003 -0.4411549866199493 0.0209588091820478 <_> <_> <_> 1 11 24 4 -1. <_> 13 11 12 2 2. <_> 1 13 12 2 2. 0 -0.0622704289853573 -0.5413467884063721 0.0132205402478576 <_> <_> <_> 0 11 24 4 -1. <_> 0 11 12 2 2. <_> 12 13 12 2 2. 0 -0.0449563488364220 -0.4331294000148773 0.0206683203577995 <_> <_> <_> 16 5 2 2 -1. <_> 17 5 1 1 2. <_> 16 6 1 1 2. 0 1.1595709947869182e-003 -0.0236924402415752 0.1087998002767563 <_> <_> <_> 7 5 2 2 -1. <_> 7 5 1 1 2. <_> 8 6 1 1 2. 0 -8.8405620772391558e-004 0.1649617999792099 -0.0524947308003902 <_> <_> <_> 18 1 6 2 -1. <_> 18 1 3 2 2. 0 0.0266917701810598 0.0148458201438189 -0.5571644902229309 <_> <_> <_> 2 0 21 2 -1. <_> 9 0 7 2 3. 0 0.0182767305523157 -0.0662862136960030 0.1257701069116592 <_> <_> <_> 13 0 10 15 -1. <_> 13 0 5 15 2. 0 -0.0809113383293152 0.1131376996636391 -0.0498078204691410 <_> <_> <_> 6 0 13 4 -1. <_> 6 1 13 2 2. 0 -0.0364037007093430 0.2336605936288834 -0.0383339710533619 <_> <_> <_> 11 3 9 3 -1. <_> 11 4 9 1 3. 0 -0.0139478798955679 0.0991646125912666 -0.0678260922431946 <_> <_> <_> 3 2 10 3 -1. <_> 2 3 10 1 3. 1 -0.0224205106496811 0.1904506981372833 -0.0484246909618378 <_> <_> <_> 6 6 16 8 -1. <_> 6 6 8 8 2. 0 0.0995163321495056 -0.0482200607657433 0.2056124061346054 <_> <_> <_> 5 0 12 15 -1. <_> 8 0 6 15 2. 0 0.1495629996061325 0.0141723398119211 -0.6450886726379395 <_> <_> <_> 23 8 2 4 -1. <_> 23 8 1 4 2. 0 9.6693442901596427e-004 -0.0378436110913754 0.0635498985648155 <_> <_> <_> 0 5 3 3 -1. <_> 0 6 3 1 3. 0 0.0120417503640056 0.0180350895971060 -0.4774137139320374 <_> <_> <_> 21 5 4 2 -1. <_> 22 5 2 2 2. 0 2.3097700905054808e-003 -0.0415334291756153 0.1302794069051743 <_> <_> <_> 0 5 4 2 -1. <_> 1 5 2 2 2. 0 2.2019869647920132e-003 -0.0514689311385155 0.1736146062612534 <_> <_> <_> 21 2 3 4 -1. <_> 22 3 1 4 3. 1 0.0272558908909559 -0.0153390001505613 0.3625235855579376 <_> <_> <_> 4 2 4 3 -1. <_> 3 3 4 1 3. 1 8.8747506961226463e-003 -0.0426916293799877 0.2076780050992966 <_> <_> <_> 23 2 2 2 -1. <_> 23 2 2 1 2. 1 4.7241621650755405e-003 -0.0500567816197872 0.0873611792922020 <_> <_> <_> 0 5 4 4 -1. <_> 0 6 4 2 2. 0 7.3167313530575484e-005 -0.1244131028652191 0.0726777836680412 <_> <_> <_> 23 7 2 5 -1. <_> 23 7 1 5 2. 0 -1.2639940250664949e-003 0.0776199027895927 -0.0404986217617989 <_> <_> <_> 0 0 1 4 -1. <_> 0 1 1 2 2. 0 3.6909559275954962e-003 0.0311388503760099 -0.3086219131946564 <_> <_> <_> 23 1 2 4 -1. <_> 23 3 2 2 2. 0 -0.0283522401005030 -0.3550184071063995 0.0135328602045774 <_> <_> <_> 0 1 2 4 -1. <_> 0 3 2 2 2. 0 -9.6667202888056636e-004 0.0676028430461884 -0.1432974934577942 <_> <_> <_> 19 3 5 4 -1. <_> 19 4 5 2 2. 0 -0.0587403103709221 -0.5506312847137451 4.2741261422634125e-003 <_> <_> <_> 12 1 6 2 -1. <_> 12 1 6 1 2. 1 -0.0272757392376661 -0.6493160724639893 0.0125345299020410 <_> <_> <_> 19 11 6 4 -1. <_> 19 12 6 2 2. 0 -0.0117558799684048 -0.5648565292358398 0.0137637602165341 <_> <_> <_> 1 3 6 4 -1. <_> 1 4 6 2 2. 0 7.5923758558928967e-003 -0.0431140698492527 0.2005586028099060 <_> <_> <_> 23 0 2 1 -1. <_> 23 0 1 1 2. 1 -7.1979401400312781e-004 -0.1374174952507019 0.0340671092271805 <_> <_> <_> 2 0 1 2 -1. <_> 2 0 1 1 2. 1 4.1190441697835922e-003 0.0367105789482594 -0.2477497011423111 <_> <_> <_> 19 0 4 2 -1. <_> 20 0 2 2 2. 0 7.5443051755428314e-003 7.2344779036939144e-003 -0.4473736882209778 <_> <_> <_> 0 0 2 12 -1. <_> 0 0 1 6 2. <_> 1 6 1 6 2. 0 -5.2358289249241352e-003 0.2173164039850235 -0.0386803299188614 <_> <_> <_> 22 4 2 8 -1. <_> 23 4 1 4 2. <_> 22 8 1 4 2. 0 7.4686598964035511e-004 -0.0371707193553448 0.0385193713009357 <_> <_> <_> 1 4 2 8 -1. <_> 1 4 1 4 2. <_> 2 8 1 4 2. 0 8.8468490866944194e-004 -0.1020980030298233 0.0926149412989616 <_> <_> <_> 17 9 4 1 -1. <_> 17 9 2 1 2. 0 -1.1738609755411744e-003 0.1108791977167130 -0.0856960415840149 <_> <_> <_> 12 2 5 8 -1. <_> 10 4 5 4 2. 1 -0.0989599674940109 -0.4499149918556213 0.0212421305477619 <_> <_> <_> 18 13 2 2 -1. <_> 19 13 1 1 2. <_> 18 14 1 1 2. 0 8.8248471729457378e-004 0.0228975899517536 -0.1995048969984055 <_> <_> <_> 6 9 13 6 -1. <_> 6 11 13 2 3. 0 -0.0413776896893978 0.1549389958381653 -0.0591393709182739 <_> <_> <_> 6 10 13 4 -1. <_> 6 11 13 2 2. 0 6.7946789786219597e-003 -0.0783610120415688 0.1739570051431656 <_> <_> <_> 0 8 24 4 -1. <_> 0 8 12 2 2. <_> 12 10 12 2 2. 0 0.0447585098445416 0.0260890107601881 -0.3311159014701843 <_> <_> <_> 17 10 8 3 -1. <_> 17 11 8 1 3. 0 2.9978479724377394e-003 0.0459281504154205 -0.1491470038890839 <_> <_> <_> 4 0 16 8 -1. <_> 4 0 8 4 2. <_> 12 4 8 4 2. 0 -0.0595893599092960 -0.2485350966453552 0.0325236506760120 <_> <_> <_> 14 0 1 2 -1. <_> 14 1 1 1 2. 0 9.4199320301413536e-004 -0.0425546802580357 0.1344856023788452 <_> <_> <_> 3 9 6 6 -1. <_> 5 9 2 6 3. 0 -0.0239475108683109 -0.4583190977573395 0.0178181305527687 <_> <_> <_> 13 10 12 3 -1. <_> 16 10 6 3 2. 0 7.4462359771132469e-003 -0.0423585288226604 0.0580310709774494 <_> <_> <_> 0 10 12 3 -1. <_> 3 10 6 3 2. 0 -0.0129095697775483 0.1973039060831070 -0.0445232689380646 <_> <_> <_> 19 8 5 3 -1. <_> 19 9 5 1 3. 0 2.8930921107530594e-003 0.0428810603916645 -0.1371746063232422 <_> <_> <_> 7 1 3 1 -1. <_> 8 1 1 1 3. 0 -6.8186258431524038e-004 0.1337869018316269 -0.0565496906638145 <_> <_> <_> 15 1 3 1 -1. <_> 16 1 1 1 3. 0 9.0884382370859385e-004 -0.0361675098538399 0.1220118999481201 <_> <_> <_> 7 1 3 1 -1. <_> 8 1 1 1 3. 0 4.2305429815314710e-004 -0.0695094764232636 0.1302513927221298 <_> <_> <_> 20 8 2 3 -1. <_> 20 9 2 1 3. 0 -1.6460029873996973e-003 -0.1300535947084427 0.0327382087707520 <_> <_> <_> 2 0 4 2 -1. <_> 3 0 2 2 2. 0 7.2493818588554859e-003 0.0122888395562768 -0.6227869987487793 <_> <_> <_> 19 8 5 3 -1. <_> 19 9 5 1 3. 0 7.8207803890109062e-003 7.4369488283991814e-003 -0.1486981958150864 <_> <_> <_> 4 1 6 11 -1. <_> 6 1 2 11 3. 0 0.0359272807836533 0.0188675802201033 -0.3921496868133545 <_> <_> <_> 16 9 2 1 -1. <_> 16 9 1 1 2. 0 -6.1618811741936952e-005 0.0568877793848515 -0.0677392184734344 <_> <_> <_> 5 2 15 4 -1. <_> 5 3 15 2 2. 0 0.0374080687761307 -0.0385471209883690 0.2218790054321289 <_> <_> <_> 11 2 3 3 -1. <_> 11 3 3 1 3. 0 -5.2155661396682262e-003 0.1363334953784943 -0.0673948600888252 <_> <_> <_> 2 7 18 6 -1. <_> 11 7 9 6 2. 0 -0.0935681909322739 0.1743745058774948 -0.0487747117877007 <_> <_> <_> 1 6 24 9 -1. <_> 7 6 12 9 2. 0 0.0762281417846680 -0.0574758499860764 0.1471180021762848 <_> <_> <_> 0 0 1 10 -1. <_> 0 5 1 5 2. 0 -0.0200377702713013 -0.4157789945602417 0.0179230198264122 <_> <_> <_> 9 3 10 2 -1. <_> 9 4 10 1 2. 0 -0.0118243796750903 0.1144623011350632 -0.0700482204556465 <_> <_> <_> 12 6 1 3 -1. <_> 12 7 1 1 3. 0 -1.6057320171967149e-003 0.1678820997476578 -0.0499466583132744 <_> <_> <_> 16 9 2 1 -1. <_> 16 9 1 1 2. 0 -2.5517439935356379e-003 -0.3828516900539398 0.0113612702116370 <_> <_> <_> 7 9 2 1 -1. <_> 8 9 1 1 2. 0 -9.9515629699453712e-005 0.0925496816635132 -0.0903496667742729 <_> <_> <_> 16 7 6 6 -1. <_> 19 7 3 3 2. <_> 16 10 3 3 2. 0 -0.0167104993015528 0.1787143051624298 -0.0413177497684956 <_> <_> <_> 10 10 2 2 -1. <_> 10 10 1 1 2. <_> 11 11 1 1 2. 0 -9.6687301993370056e-004 -0.2522006928920746 0.0305528100579977 <_> <_> <_> 16 9 2 2 -1. <_> 17 9 1 1 2. <_> 16 10 1 1 2. 0 -6.0828930145362392e-005 0.0542593784630299 -0.0474381409585476 <_> <_> <_> 7 9 2 2 -1. <_> 7 9 1 1 2. <_> 8 10 1 1 2. 0 -8.6335372179746628e-004 0.1779994070529938 -0.0423120781779289 <_> <_> <_> 13 10 2 2 -1. <_> 14 10 1 1 2. <_> 13 11 1 1 2. 0 -8.9218461653217673e-004 -0.1845878958702087 0.0251416098326445 <_> <_> <_> 11 7 2 3 -1. <_> 11 8 2 1 3. 0 -3.4870179370045662e-003 0.1677664965391159 -0.0460440590977669 <_> <_> <_> 19 0 6 3 -1. <_> 19 1 6 1 3. 0 0.0195988900959492 0.0180558506399393 -0.3022567927837372 <_> <_> <_> 0 0 6 3 -1. <_> 0 1 6 1 3. 0 -0.0109872100874782 -0.3727653026580811 0.0197681505233049 <_> <_> <_> 24 0 1 2 -1. <_> 24 1 1 1 2. 0 -6.6390639403834939e-005 0.0768569633364677 -0.1268360018730164 <_> <_> <_> 0 0 16 1 -1. <_> 4 0 8 1 2. 0 -4.2606238275766373e-003 0.1132820025086403 -0.0696604028344154 <_> <_> <_> 19 11 6 4 -1. <_> 19 12 6 2 2. 0 7.3147160001099110e-003 0.0329976715147495 -0.2646273076534271 <_> <_> <_> 0 11 6 4 -1. <_> 0 12 6 2 2. 0 -0.0101194800809026 -0.4706184864044190 0.0138464700430632 <_> <_> <_> 5 3 15 6 -1. <_> 5 6 15 3 2. 0 0.0921443328261375 -0.0886306688189507 0.0808285027742386 <_> <_> <_> 8 3 9 3 -1. <_> 8 4 9 1 3. 0 0.0118425898253918 -0.0542713403701782 0.1590622961521149 <_> <_> <_> 12 0 1 12 -1. <_> 12 3 1 6 2. 0 0.0260604508221149 0.0202190801501274 -0.3709642887115479 <_> <_> <_> 1 3 14 8 -1. <_> 1 7 14 4 2. 0 0.2863250076770783 0.0171639006584883 -0.3946934938430786 <_> <_> <_> 15 0 6 4 -1. <_> 17 0 2 4 3. 0 -0.0193374603986740 -0.2173891961574554 0.0148878796026111 <_> <_> <_> 3 7 4 2 -1. <_> 3 7 2 1 2. <_> 5 8 2 1 2. 0 6.8996037589386106e-004 -0.0642509534955025 0.1074123978614807 <_> <_> <_> 14 5 1 8 -1. <_> 14 9 1 4 2. 0 0.0273154806345701 5.0893737934529781e-003 -0.5541477799415588 <_> <_> <_> 0 7 3 3 -1. <_> 0 8 3 1 3. 0 -7.3149320669472218e-003 -0.5788456201553345 0.0114226602017879 <_> <_> <_> 11 12 6 3 -1. <_> 13 12 2 3 3. 0 0.0134929800406098 6.9531891494989395e-003 -0.3359794020652771 <_> <_> <_> 8 12 6 3 -1. <_> 10 12 2 3 3. 0 0.0170349292457104 9.6587073057889938e-003 -0.6638085842132568 <_> <_> <_> 16 5 6 10 -1. <_> 19 5 3 5 2. <_> 16 10 3 5 2. 0 -0.0495363213121891 -0.1099594011902809 7.1444557979702950e-003 <_> <_> <_> 3 5 6 10 -1. <_> 3 5 3 5 2. <_> 6 10 3 5 2. 0 -0.0326232202351093 0.1888170987367630 -0.0416569598019123 <_> <_> <_> 17 8 8 1 -1. <_> 19 8 4 1 2. 0 2.5752598885446787e-003 -0.0510260090231895 0.1057118028402329 <_> <_> <_> 0 8 8 1 -1. <_> 2 8 4 1 2. 0 2.4968909565359354e-003 -0.0559858083724976 0.1347001940011978 <_> <_> <_> 9 13 14 2 -1. <_> 9 13 7 2 2. 0 -0.0116916997358203 0.0694792568683624 -0.0498108491301537 <_> <_> <_> 1 14 20 1 -1. <_> 6 14 10 1 2. 0 5.0966278649866581e-003 -0.0719841867685318 0.1201341003179550 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 8.6429098155349493e-004 -0.0280915908515453 0.1105908975005150 <_> <_> <_> 0 8 2 2 -1. <_> 0 9 2 1 2. 0 -3.0658349860459566e-003 -0.4070394039154053 0.0187105592340231 <_> <_> <_> 17 7 2 2 -1. <_> 18 7 1 1 2. <_> 17 8 1 1 2. 0 -5.5272910685744137e-005 0.0707912817597389 -0.0700317397713661 <_> <_> <_> 6 7 2 2 -1. <_> 6 7 1 1 2. <_> 7 8 1 1 2. 0 6.5698497928678989e-004 -0.0492957085371017 0.1548248976469040 <_> <_> <_> 13 10 2 2 -1. <_> 14 10 1 1 2. <_> 13 11 1 1 2. 0 5.3707341430708766e-004 0.0302961803972721 -0.1238510981202126 <_> <_> <_> 4 0 6 4 -1. <_> 6 0 2 4 3. 0 -0.0272689107805490 -0.4674024879932404 0.0149874398484826 <_> <_> <_> 10 0 6 2 -1. <_> 12 0 2 2 3. 0 -2.6138951070606709e-003 0.1166682019829750 -0.0615368783473969 <_> <_> <_> 8 1 8 3 -1. <_> 10 1 4 3 2. 0 -0.0277075897902250 -0.6434546709060669 0.0120052499696612 <_> <_> <_> 14 6 7 2 -1. <_> 14 6 7 1 2. 1 -0.0200542695820332 -0.3493579030036926 0.0109763201326132 <_> <_> <_> 8 10 4 1 -1. <_> 9 10 2 1 2. 0 6.9170317146927118e-004 0.0442647784948349 -0.1491888016462326 <_> <_> <_> 16 11 2 2 -1. <_> 17 11 1 1 2. <_> 16 12 1 1 2. 0 6.4560663304291666e-005 -0.0422041602432728 0.0473436005413532 <_> <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. 0 -8.8378103100694716e-005 0.1016054973006249 -0.0740641728043556 <_> <_> <_> 16 11 2 2 -1. <_> 17 11 1 1 2. <_> 16 12 1 1 2. 0 -6.6106527810916305e-005 0.0759406536817551 -0.0495208092033863 <_> <_> <_> 7 11 2 2 -1. <_> 7 11 1 1 2. <_> 8 12 1 1 2. 0 4.2288508848287165e-004 -0.0588600113987923 0.1385688036680222 <_> <_> <_> 17 9 4 1 -1. <_> 17 9 2 1 2. 0 2.5251980405300856e-003 -0.0302844792604446 0.1643659025430679 <_> <_> <_> 4 9 4 1 -1. <_> 6 9 2 1 2. 0 -9.0347938239574432e-003 -0.6502289175987244 0.0117079298943281 <_> <_> <_> 11 8 3 4 -1. <_> 11 9 3 2 2. 0 -4.2698681354522705e-003 0.1213309019804001 -0.0608336813747883 <_> <_> <_> 9 6 3 2 -1. <_> 10 7 1 2 3. 1 0.0166539791971445 0.0145571101456881 -0.5031678080558777 <_> <_> <_> 21 0 4 8 -1. <_> 19 2 4 4 2. 1 -0.1178558021783829 -0.3486539125442505 5.8299610391259193e-003 <_> <_> <_> 4 0 8 4 -1. <_> 6 2 4 4 2. 1 -0.0389890410006046 0.1082129999995232 -0.0824354067444801 <_> <_> <_> 20 1 5 2 -1. <_> 20 1 5 1 2. 1 -6.9744870997965336e-003 0.0920993909239769 -0.0447417609393597 <_> <_> <_> 0 6 6 4 -1. <_> 0 7 6 2 2. 0 0.0154374102130532 0.0294817406684160 -0.2408691942691803 <_> <_> <_> 20 6 5 4 -1. <_> 20 7 5 2 2. 0 -5.9599988162517548e-003 -0.2254153043031693 0.0256420802325010 <_> <_> <_> 6 8 3 1 -1. <_> 7 8 1 1 3. 0 -5.3358142031356692e-004 0.1183808967471123 -0.0571242086589336 <_> <_> <_> 1 8 24 2 -1. <_> 13 8 12 1 2. <_> 1 9 12 1 2. 0 0.0176937691867352 0.0266077890992165 -0.3055857121944428 <_> <_> <_> 8 8 8 3 -1. <_> 8 9 8 1 3. 0 5.3599448874592781e-003 -0.0569497905671597 0.1210888996720314 <_> <_> <_> 17 11 6 4 -1. <_> 19 11 2 4 3. 0 0.0158548094332218 0.0215572193264961 -0.2521420121192932 <_> <_> <_> 0 0 18 1 -1. <_> 9 0 9 1 2. 0 0.0549633502960205 0.0106362197548151 -0.5730599761009216 <_> <_> <_> 14 6 3 2 -1. <_> 15 7 1 2 3. 1 -3.7383600138127804e-003 0.0774415433406830 -0.0306048095226288 <_> <_> <_> 5 6 13 2 -1. <_> 5 7 13 1 2. 0 0.0182623900473118 -0.0549028292298317 0.1176588013768196 <_> <_> <_> 14 6 3 2 -1. <_> 15 7 1 2 3. 1 -0.0318278707563877 -0.9110031723976135 1.3938200427219272e-003 <_> <_> <_> 10 6 2 6 -1. <_> 10 8 2 2 3. 0 -3.6466179881244898e-003 0.1085240989923477 -0.0722526162862778 <_> <_> <_> 20 1 5 2 -1. <_> 20 1 5 1 2. 1 -0.0517431795597076 -0.9186943173408508 1.8797840457409620e-003 <_> <_> <_> 5 1 2 5 -1. <_> 5 1 1 5 2. 1 -9.0449545532464981e-003 0.1787680983543396 -0.0388442091643810 <_> <_> <_> 24 7 1 8 -1. <_> 24 9 1 4 2. 0 -4.5340228825807571e-003 -0.2472573071718216 0.0297267790883780 <_> <_> <_> 7 7 11 3 -1. <_> 7 8 11 1 3. 0 6.8734101951122284e-003 -0.0675214827060699 0.1065412983298302 <_> <_> <_> 13 11 2 2 -1. <_> 14 11 1 1 2. <_> 13 12 1 1 2. 0 7.7327789040282369e-004 0.0221925694495440 -0.1398307979106903 <_> <_> <_> 10 11 3 1 -1. <_> 11 11 1 1 3. 0 -8.5252941062208265e-005 0.0903024971485138 -0.0786189734935761 <_> <_> <_> 24 7 1 8 -1. <_> 24 9 1 4 2. 0 4.8931739293038845e-003 0.0311242006719112 -0.1617130041122437 <_> <_> <_> 10 5 2 4 -1. <_> 10 5 2 2 2. 1 -0.0357618294656277 -0.3406237065792084 0.0201859101653099 <_> <_> <_> 22 1 2 3 -1. <_> 21 2 2 1 3. 1 -0.0110698901116848 0.1165141984820366 -0.0340334698557854 <_> <_> <_> 3 1 3 2 -1. <_> 4 2 1 2 3. 1 3.4201510716229677e-003 -0.0530161187052727 0.1339436024427414 <_> <_> <_> 16 4 3 3 -1. <_> 17 5 1 1 9. 0 -0.0499692708253860 -0.8493295907974243 2.7547380886971951e-003 <_> <_> <_> 3 0 3 2 -1. <_> 3 0 3 1 2. 1 -1.1221430031582713e-003 -0.1629413068294525 0.0413381010293961 <_> <_> <_> 17 0 8 3 -1. <_> 17 0 4 3 2. 0 0.0371481291949749 0.0171750299632549 -0.2840433120727539 <_> <_> <_> 0 12 4 3 -1. <_> 0 13 4 1 3. 0 2.3847341071814299e-003 0.0348382107913494 -0.1844726949930191 <_> <_> <_> 2 3 21 3 -1. <_> 9 3 7 3 3. 0 0.1431124955415726 0.0252217296510935 -0.2543725967407227 <_> <_> <_> 8 1 2 5 -1. <_> 8 1 1 5 2. 1 -0.0119188595563173 0.1655784994363785 -0.0447442717850208 <_> <_> <_> 19 7 6 4 -1. <_> 22 7 3 2 2. <_> 19 9 3 2 2. 0 6.4779450185596943e-003 -0.0250237993896008 0.0799132883548737 <_> <_> <_> 0 7 6 4 -1. <_> 0 7 3 2 2. <_> 3 9 3 2 2. 0 1.4581739669665694e-003 -0.0797923728823662 0.0829188674688339 <_> <_> <_> 24 4 1 4 -1. <_> 24 5 1 2 2. 0 6.2418850138783455e-003 0.0132909296080470 -0.2995111048221588 <_> <_> <_> 4 7 3 4 -1. <_> 3 8 3 2 2. 1 -0.0227145906537771 0.4398984909057617 -0.0150371296331286 <_> <_> <_> 17 9 4 1 -1. <_> 18 9 2 1 2. 0 -4.3001482263207436e-003 -0.3546585142612457 7.9521266743540764e-003 <_> <_> <_> 4 9 4 1 -1. <_> 5 9 2 1 2. 0 1.0604769922792912e-003 0.0385937690734863 -0.1762923002243042 <_> <_> <_> 23 6 2 2 -1. <_> 23 7 2 1 2. 0 4.3205441907048225e-003 0.0171245392411947 -0.1075016036629677 <_> <_> <_> 0 6 2 2 -1. <_> 0 7 2 1 2. 0 -3.8217399269342422e-003 -0.4589209854602814 0.0141258295625448 <_> <_> <_> 12 0 3 1 -1. <_> 13 0 1 1 3. 0 9.7336847102269530e-004 -0.0361551195383072 0.1268056929111481 <_> <_> <_> 1 7 2 2 -1. <_> 1 7 1 1 2. <_> 2 8 1 1 2. 0 -7.9081847798079252e-004 0.1707147061824799 -0.0376146212220192 <_> <_> <_> 22 7 2 2 -1. <_> 23 7 1 1 2. <_> 22 8 1 1 2. 0 -7.6159887248650193e-004 0.2311398983001709 -0.0603629797697067 <_> <_> <_> 2 11 6 4 -1. <_> 4 11 2 4 3. 0 -0.0210315398871899 -0.4918564856052399 0.0156012997031212 <_> <_> <_> 14 1 10 4 -1. <_> 19 1 5 2 2. <_> 14 3 5 2 2. 0 0.0180973205715418 -0.0467358492314816 0.1050693020224571 <_> <_> <_> 6 2 12 2 -1. <_> 6 3 12 1 2. 0 -0.0131208598613739 0.1018344014883041 -0.0857265591621399 <_> <_> <_> 9 6 8 9 -1. <_> 9 9 8 3 3. 0 0.2012819051742554 -9.4874696806073189e-003 0.5418189764022827 <_> <_> <_> 3 8 3 3 -1. <_> 4 9 1 1 9. 0 7.3326090350747108e-003 0.0282447207719088 -0.2452981024980545 <_> <_> <_> 22 7 2 2 -1. <_> 23 7 1 1 2. <_> 22 8 1 1 2. 0 9.0540642850100994e-004 -0.0559650883078575 0.2322594970464706 <_> <_> <_> 11 10 2 2 -1. <_> 11 10 1 1 2. <_> 12 11 1 1 2. 0 5.3532002493739128e-004 0.0432194508612156 -0.1652047038078308 <_> <_> <_> 22 7 2 2 -1. <_> 23 7 1 1 2. <_> 22 8 1 1 2. 0 -8.0239711678586900e-005 0.0588538907468319 -0.0475415214896202 <_> <_> <_> 4 13 10 1 -1. <_> 9 13 5 1 2. 0 4.8403399996459484e-003 -0.0541158504784107 0.1303326934576035 <_> <_> <_> 3 0 20 15 -1. <_> 3 0 10 15 2. 0 0.6619219779968262 -0.0147952698171139 0.5785722732543945 <_> <_> <_> 0 13 24 1 -1. <_> 6 13 12 1 2. 0 -8.5441237315535545e-003 0.1165743991732597 -0.0628988370299339 <_> <_> <_> 22 7 2 2 -1. <_> 23 7 1 1 2. <_> 22 8 1 1 2. 0 5.4021849791752174e-005 -0.0602008998394012 0.0699716731905937 -1.2540320158004761 15 -1 ================================================ FILE: OpenCVComponent/OpenCVComponent.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "pch.h" #include "OpenCVComponent.h" #include #include #include #include #include #include #include #include using namespace OpenCVComponent; using namespace Platform; using namespace concurrency; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; // Name of the resource classifier used to detect human faces (frontal) cv::String face_cascade_name = "haarcascade_frontalface_alt.xml"; // Name of the resource classifier used to detect human eyes (frontal) cv::String eye_cascade_name = "haarcascade_eye.xml"; // Name of the resource classifier used to detect human mouth (frontal) cv::String mouth_cascade_name = "haarcascade_mouth.xml"; void CopyIVectorToMatrix(IVector^ input, cv::Mat& mat, int size); void CopyMatrixToVector(const cv::Mat& mat, std::vector& vector, int size); OpenCVLib::OpenCVLib() { } void OpenCVLib::Load() { if (face_cascade.empty()) { if (!face_cascade.load(face_cascade_name)) { auto e = ref new Exception(-100, "Couldn't load face detector"); throw e; //Windows::UI::Popups::MessageDialog("Couldn't load face detector \n").ShowAsync(); } } if (eye_cascade.empty()) { if (!eye_cascade.load(eye_cascade_name)) { auto e = ref new Exception(-100, "Couldn't load eye detector"); throw e; //Windows::UI::Popups::MessageDialog("Couldn't load eye detector \n").ShowAsync(); } } if (mouth_cascade.empty()) { if (!mouth_cascade.load(mouth_cascade_name)) { auto e = ref new Exception(-100, "Couldn't load mouth detector"); throw e; //Windows::UI::Popups::MessageDialog("Couldn't load mouth detector \n").ShowAsync(); } } } void OutputDebugString(std::string output, LARGE_INTEGER start, LARGE_INTEGER frequency) { #ifdef DEBUG LARGE_INTEGER end; if (::QueryPerformanceCounter(&end) == FALSE) throw "foo"; double interval = static_cast(end.QuadPart - start.QuadPart) / frequency.QuadPart; OutputDebugStringA((output + " " + std::to_string(interval) + "\n").c_str()); #endif } IAsyncOperation^ OpenCVLib::ProcessImageAsync(String^ fileName) { return concurrency::create_async([=]() -> FacesImage^ { LARGE_INTEGER frequency; if (::QueryPerformanceFrequency(&frequency) == FALSE) throw "foo"; LARGE_INTEGER start; if (::QueryPerformanceCounter(&start) == FALSE) throw "foo"; Load(); OutputDebugString("load", start, frequency); IVector^ fs = ref new Platform::Collections::Vector(); std::wstring fooW(fileName->Begin()); std::string fooA(fooW.begin(), fooW.end()); cv::String fileNameCV(fooA); cv::Mat image = cv::imread(fileNameCV.c_str()); OutputDebugString("cv::imread " + std::to_string(image.cols) + "x" + std::to_string(image.rows), start, frequency); groupFaces = cv::Mat(image.rows, image.cols, CV_8UC4); cv::cvtColor(image, groupFaces, CV_BGR2BGRA); if (!groupFaces.empty()) { std::vector facesColl; cv::Mat frame_gray; OutputDebugString("start", start, frequency); cvtColor(groupFaces, frame_gray, CV_BGR2GRAY); //UpdateImage(img2, frame_gray); OutputDebugString("cvtColor", start, frequency); cv::equalizeHist(frame_gray, frame_gray); OutputDebugString("cv::equalizeHist", start, frequency); //UpdateImage(img2, frame_gray); // Detect faces face_cascade.detectMultiScale(frame_gray, facesColl, 1.2, 3, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(30, 30)); OutputDebugString("face_cascade.detectMultiScale", start, frequency); for (unsigned int i = 0; i < facesColl.size(); i++) { auto face = facesColl[i]; auto f = ref new Face(Rect(face.x, face.y, face.width, face.height)); fs->Append(f); cv::rectangle(groupFaces, face, cv::Scalar(255, 0, 0), 1); facesColl[i].height = facesColl[i].height / 2; cv::Mat faceROI = frame_gray(facesColl[i]); std::vector eyesColl; std::vector eyesCenterColl; int eyeWidth = face.width / 6; eye_cascade.detectMultiScale(faceROI, eyesColl, 1.1, 3, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(eyeWidth, eyeWidth)); OutputDebugString("eye_cascade.detectMultiScale", start, frequency); for (unsigned int j = 0; j < eyesColl.size(); j++) { auto eye = eyesColl[j]; eye.x += face.x; eye.y += face.y; cv::rectangle(groupFaces, eye, cv::Scalar(255, 0, 0), 1); auto eyeRect = Rect(eye.x, eye.y, eye.width, eye.height); f->Eye->Append(eyeRect); // eye center auto eyeCenter = cv::Point(eye.x + eye.width / 2, eye.y + eye.height / 2); eyesCenterColl.push_back(eyeCenter); cv::circle(groupFaces, eyeCenter, 3, cv::Scalar(0, 255, 0), -1); } std::vector mouthsColl; std::vector mouthsCenterColl; facesColl[i].height = facesColl[i].height / 2; facesColl[i].y += facesColl[i].height * 3; faceROI = frame_gray(facesColl[i]); int mouthWidth = 30; mouth_cascade.detectMultiScale(faceROI, mouthsColl, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(mouthWidth, mouthWidth)); OutputDebugString("mouth_cascade.detectMultiScale", start, frequency); for (unsigned int j = 0; j < mouthsColl.size() && j < 10; j++) { auto mouth = mouthsColl[j]; mouth.x += facesColl[i].x; mouth.y += facesColl[i].y; cv::rectangle(groupFaces, mouth, cv::Scalar(255, 0, 0), 1); auto mouthRect = Rect(mouth.x, mouth.y, mouth.width, mouth.height); f->Mouth->Append(mouthRect); auto mouthCenter = cv::Point(mouth.x + mouth.width / 2, mouth.y + mouth.height / 4); mouthsCenterColl.push_back(mouthCenter); cv::circle(groupFaces, mouthCenter, 3, cv::Scalar(0, 255, 0), -1); } // forehead, chin if (eyesCenterColl.size() >= 2) { auto eyesDistanceX = abs(eyesCenterColl[1].x - eyesCenterColl[0].x); auto eyesDistanceY = abs(eyesCenterColl[1].y - eyesCenterColl[0].y); auto leftEye = eyesCenterColl[0]; if (leftEye.x > eyesCenterColl[1].x) { leftEye = eyesCenterColl[1]; } auto eyesCenter = cv::Point(leftEye.x + eyesDistanceX / 2, leftEye.y + eyesDistanceY / 2); cv::circle(groupFaces, eyesCenter, 3, cv::Scalar(0, 255, 0), -1); auto foreheadCenter = cv::Point(eyesCenter.x, eyesCenter.y - 0.7 * eyesDistanceX); cv::circle(groupFaces, foreheadCenter, 3, cv::Scalar(0, 255, 0), -1); if (mouthsCenterColl.size() >= 1) { auto chinCenter = cv::Point(eyesCenter.x, mouthsCenterColl[0].y + 0.55 * eyesDistanceX); cv::circle(groupFaces, chinCenter, 3, cv::Scalar(0, 255, 0), -1); } } } //UpdateImage(img1, groupFaces); } std::vector output; CopyMatrixToVector(groupFaces, output, image.rows * image.cols); //Return the outputs as a VectorView //return ref new Platform::Collections::VectorView(output); auto facesImage = ref new FacesImage(); facesImage->Width = image.cols; facesImage->Height = image.rows; facesImage->Faces = fs; facesImage->Image = ref new Platform::Collections::VectorView(output); OutputDebugString("stop", start, frequency); return facesImage; }); } IAsyncOperation^>^ OpenCVLib::ProcessAsync(IVector^ input, int width, int height) { return create_async([=]() -> IVectorView^ { int size = input->Size; cv::Mat mat(width, height, CV_8UC4); CopyIVectorToMatrix(input, mat, size); // convert to grayscale cv::Mat intermediateMat; cv::cvtColor(mat, intermediateMat, CV_RGB2GRAY); // convert to BGRA cv::cvtColor(intermediateMat, mat, CV_GRAY2BGRA); std::vector output; CopyMatrixToVector(mat, output, size); // Return the outputs as a VectorView return ref new Platform::Collections::VectorView(output); }); } void CopyIVectorToMatrix(IVector^ input, cv::Mat& mat, int size) { unsigned char* data = mat.data; for (int i = 0; i < size; i++) { int value = input->GetAt(i); memcpy(data, (void*) &value, 4); data += 4; } } void CopyMatrixToVector(const cv::Mat& mat, std::vector& vector, int size) { int* data = (int*) mat.data; for (int i = 0; i < size; i++) { vector.push_back(data[i]); } } ================================================ FILE: OpenCVComponent/OpenCVComponent.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once #include #include #include #include namespace OpenCVComponent { using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Platform; public ref class Face sealed { private: public: property IVector^ Eye; property IVector^ Mouth; property Rect Position; Face(Rect position) { Eye = ref new Platform::Collections::Vector(); Mouth = ref new Platform::Collections::Vector(); Position = position; } }; public ref class FacesImage sealed { public: property int Width; property int Height; property IVectorView^ Image; property IVector^ Faces; }; public ref class OpenCVLib sealed { private: cv::Mat groupFaces; cv::CascadeClassifier face_cascade; cv::CascadeClassifier eye_cascade; cv::CascadeClassifier mouth_cascade; void Load(); public: OpenCVLib(); IAsyncOperation^ ProcessImageAsync(String^ fileName); IAsyncOperation^>^ ProcessAsync(IVector^ input, int width, int height); }; } ================================================ FILE: OpenCVComponent/OpenCVComponent.vcxproj ================================================  Debug Win32 Debug ARM Release Win32 Release ARM {eadff7b8-e6c3-4f34-9b33-014b3035c595} OpenCVComponent en-US 11.0 true DynamicLibrary true v110_wp80 DynamicLibrary true v110_wp80 DynamicLibrary false true v110_wp80 DynamicLibrary false true v110_wp80 false false _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_WINRT_DLL;%(PreprocessorDefinitions) Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) true Console false ole32.lib;%(IgnoreSpecificDefaultLibraries) true _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) true Console false ole32.lib;%(IgnoreSpecificDefaultLibraries) true _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_WINRT_DLL;%(PreprocessorDefinitions) Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) true Console false ole32.lib;%(IgnoreSpecificDefaultLibraries) true _CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_WINRT_DLL;NDEBUG;%(PreprocessorDefinitions) Use pch.h $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) true Console false ole32.lib;%(IgnoreSpecificDefaultLibraries) true true false Create ================================================ FILE: OpenCVComponent/OpenCVComponent.vcxproj.filters ================================================  5fd0e509-b6ae-4f29-bd2a-4d2cc10f3aa0 rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {9c92a94c-8b61-4fe3-9856-7d35d5216ed6} Cascades Cascades Cascades ================================================ FILE: OpenCVComponent/opencv.props ================================================  $(OPENCV_WINRT_INSTALL_DIR)\WP\8.0\$(PlatformTarget)\$(PlatformTarget)\vc11\bin\ $(OPENCV_WINRT_INSTALL_DIR)\WP\8.0\$(PlatformTarget)\$(PlatformTarget)\vc11\lib\ $(OPENCV_WINRT_INSTALL_DIR)\WP\8.0\$(PlatformTarget)\include\ d true true true true true true true true $(OpenCV_Include);%(AdditionalIncludeDirectories); opencv_core300$(DebugSuffix).lib;opencv_features2d300$(DebugSuffix).lib;opencv_flann300$(DebugSuffix).lib;opencv_imgcodecs300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;opencv_ml300$(DebugSuffix).lib;opencv_objdetect300$(DebugSuffix).lib;WindowsPhoneCore.lib;RuntimeObject.lib;PhoneAppModelHost.lib;%(AdditionalDependencies) $(OpenCV_Lib);%(AdditionalLibraryDirectories); ================================================ FILE: OpenCVComponent/pch.cpp ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #include "pch.h" ================================================ FILE: OpenCVComponent/pch.h ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #pragma once ================================================ FILE: README.md ================================================ # telegram-wp ================================================ FILE: Telegram.Api/Aggregator/EventAggregator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; namespace Telegram.Api.Aggregator { /// /// A marker interface for classes that subscribe to messages. /// public interface IHandle { } /// /// Denotes a class which can handle a particular type of message. /// /// The type of message to handle. public interface IHandle : IHandle { //don't use contravariance here /// /// Handles the message. /// /// The message. void Handle(TMessage message); } /// /// Enables loosely-coupled publication of and subscription to events. /// public interface ITelegramEventAggregator { /// /// Gets or sets the default publication thread marshaller. /// /// /// The default publication thread marshaller. /// Action PublicationThreadMarshaller { get; set; } /// /// Searches the subscribed handlers to check if we have a handler for /// the message type supplied. /// /// The message type to check with /// True if any handler is found, false if not. bool HandlerExistsFor(Type messageType); /// /// Subscribes an instance to all events declared through implementations of /// /// The instance to subscribe for event publication. void Subscribe(object subscriber); /// /// Unsubscribes the instance from all events. /// /// The instance to unsubscribe. void Unsubscribe(object subscriber); /// /// Publishes a message. /// /// The message instance. /// /// Uses the default thread marshaller during publication. /// void Publish(object message); /// /// Publishes a message. /// /// The message instance. /// Allows the publisher to provide a custom thread marshaller for the message publication. void Publish(object message, Action marshal); } /// /// Enables loosely-coupled publication of and subscription to events. /// public class TelegramEventAggregator : ITelegramEventAggregator { readonly List handlers = new List(); /// /// The default thread marshaller used for publication; /// public static Action DefaultPublicationThreadMarshaller = action => action(); /// /// Processing of handler results on publication thread. /// public static Action HandlerResultProcessing = (target, result) => { }; public static ITelegramEventAggregator Instance { get; protected set; } /// /// Initializes a new instance of the class. /// public TelegramEventAggregator() { PublicationThreadMarshaller = DefaultPublicationThreadMarshaller; Instance = this; } /// /// Gets or sets the default publication thread marshaller. /// /// /// The default publication thread marshaller. /// public Action PublicationThreadMarshaller { get; set; } /// /// Searches the subscribed handlers to check if we have a handler for /// the message type supplied. /// /// The message type to check with /// True if any handler is found, false if not. public bool HandlerExistsFor(Type messageType) { return handlers.Any(handler => handler.Handles(messageType) & !handler.IsDead); } /// /// Subscribes an instance to all events declared through implementations of /// /// The instance to subscribe for event publication. public virtual void Subscribe(object subscriber) { if (subscriber == null) { throw new ArgumentNullException("subscriber"); } lock(handlers) { if (handlers.Any(x => x.Matches(subscriber))) { return; } handlers.Add(new Handler(subscriber)); } } /// /// Unsubscribes the instance from all events. /// /// The instance to unsubscribe. public virtual void Unsubscribe(object subscriber) { if (subscriber == null) { throw new ArgumentNullException("subscriber"); } lock(handlers) { var found = handlers.FirstOrDefault(x => x.Matches(subscriber)); if (found != null) { handlers.Remove(found); } } } public static bool LogPublish { get; set; } /// /// Publishes a message. /// /// The message instance. /// /// Does not marshall the the publication to any special thread by default. /// public virtual void Publish(object message) { if (message == null) { throw new ArgumentNullException("message"); } #if DEBUG if (LogPublish) { Debug.WriteLine("Publish " + message.GetType()); } #endif Publish(message, PublicationThreadMarshaller); } /// /// Publishes a message. /// /// The message instance. /// Allows the publisher to provide a custom thread marshaller for the message publication. public virtual void Publish(object message, Action marshal) { if (message == null){ throw new ArgumentNullException("message"); } if (marshal == null) { throw new ArgumentNullException("marshal"); } Handler[] toNotify; lock (handlers) { toNotify = handlers.ToArray(); } marshal(() => { var messageType = message.GetType(); var dead = toNotify .Where(handler => !handler.Handle(messageType, message)) .ToList(); if(dead.Any()) { lock(handlers) { dead.Apply(x => handlers.Remove(x)); } } }); } class Handler { readonly WeakReference reference; readonly Dictionary supportedHandlers = new Dictionary(); public bool IsDead { get { return reference.Target == null; } } public Handler(object handler) { reference = new WeakReference(handler); #if WIN_RT var handlerInfo = typeof(IHandle).GetTypeInfo(); var interfaces = handler.GetType().GetTypeInfo().ImplementedInterfaces .Where(x => handlerInfo.IsAssignableFrom(x.GetTypeInfo()) && x.GetTypeInfo().IsGenericType); foreach (var @interface in interfaces) { var type = @interface.GenericTypeArguments[0]; var method = @interface.GetTypeInfo().DeclaredMethods.First(x => x.Name == "Handle"); supportedHandlers[type] = method; } #else var interfaces = handler.GetType().GetInterfaces() .Where(x => typeof(IHandle).IsAssignableFrom(x) && x.IsGenericType); foreach(var @interface in interfaces) { var type = @interface.GetGenericArguments()[0]; var method = @interface.GetMethod("Handle"); supportedHandlers[type] = method; } #endif } public bool Matches(object instance) { return reference.Target == instance; } public bool Handle(Type messageType, object message) { var target = reference.Target; if (target == null) { return false; } foreach(var pair in supportedHandlers) { if(pair.Key.IsAssignableFrom(messageType)) { var result = pair.Value.Invoke(target, new[] { message }); if (result != null) { HandlerResultProcessing(target, result); } } } return true; } public bool Handles(Type messageType) { return supportedHandlers.Any(pair => pair.Key.IsAssignableFrom(messageType)); } } } } ================================================ FILE: Telegram.Api/Aggregator/ExtensionMethods.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; namespace Telegram.Api.Aggregator { /// /// Generic extension methods used by the framework. /// public static class ExtensionMethods { /// /// Get's the name of the assembly. /// /// The assembly. /// The assembly's name. public static string GetAssemblyName(this Assembly assembly) { return assembly.FullName.Remove(assembly.FullName.IndexOf(',')); } /// /// Gets all the attributes of a particular type. /// /// The type of attributes to get. /// The member to inspect for attributes. /// Whether or not to search for inherited attributes. /// The list of attributes found. public static IEnumerable GetAttributes(this MemberInfo member, bool inherit) { #if WIN_RT return member.GetCustomAttributes(inherit).OfType(); #else return Attribute.GetCustomAttributes(member, inherit).OfType(); #endif } /// /// Applies the action to each element in the list. /// /// The enumerable item's type. /// The elements to enumerate. /// The action to apply to each item in the list. public static void Apply(this IEnumerable enumerable, Action action) { foreach(var item in enumerable) { action(item); } } /// /// Converts an expression into a . /// /// The expression to convert. /// The member info. public static MemberInfo GetMemberInfo(this Expression expression) { var lambda = (LambdaExpression)expression; MemberExpression memberExpression; if (lambda.Body is UnaryExpression) { var unaryExpression = (UnaryExpression)lambda.Body; memberExpression = (MemberExpression)unaryExpression.Operand; } else { memberExpression = (MemberExpression)lambda.Body; } return memberExpression.Member; } #if WINDOWS_PHONE && !WP8 //Method missing in WP7.1 Linq /// /// Merges two sequences by using the specified predicate function. /// /// The type of the elements of the first input sequence. /// The type of the elements of the second input sequence. /// The type of the elements of the result sequence. /// The first sequence to merge. /// The second sequence to merge. /// A function that specifies how to merge the elements from the two sequences. /// An System.Collections.Generic.IEnumerable<T> that contains merged elements of two input sequences. public static IEnumerable Zip(this IEnumerable first, IEnumerable second, Func resultSelector) { if (first == null) { throw new ArgumentNullException("first"); } if (second == null) { throw new ArgumentNullException("second"); } if (resultSelector == null) { throw new ArgumentNullException("resultSelector"); } var enumFirst = first.GetEnumerator(); var enumSecond = second.GetEnumerator(); while (enumFirst.MoveNext() && enumSecond.MoveNext()) { yield return resultSelector(enumFirst.Current, enumSecond.Current); } } #endif #if WIN_RT /// /// Gets a collection of the public types defined in this assembly that are visible outside the assembly. /// /// The assembly. /// A collection of the public types defined in this assembly that are visible outside the assembly. /// public static IEnumerable GetExportedTypes(this Assembly assembly) { if (assembly == null) throw new ArgumentNullException("assembly"); return assembly.ExportedTypes; } /// /// Returns a value that indicates whether the specified type can be assigned to the current type. /// /// The target type /// The type to check. /// true if the specified type can be assigned to this type; otherwise, false. public static bool IsAssignableFrom(this Type target, Type type) { return target.GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()); } #endif } } ================================================ FILE: Telegram.Api/Compression/GZipDeflateStream.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #if WINDOWS_PHONE using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Windows; using System.Windows.Resources; namespace SharpGIS { internal sealed class GZipInflateStream : Stream { private readonly Stream _deflatedStream; private Stream _inflatedStream; public GZipInflateStream(System.IO.Stream deflatedStream) { _deflatedStream = deflatedStream; ProcessStream(); } private void ProcessStream() { int firstByte = _deflatedStream.ReadByte(); if (firstByte == -1) { _inflatedStream = new MemoryStream(); return; } if ((0x1f != firstByte) || // ID1 (0x8b != _deflatedStream.ReadByte()) || // ID2 (8 != _deflatedStream.ReadByte())) // CM (8 == deflate) { throw new NotSupportedException("Compressed data not in the expected format."); } // Read flags var flg = _deflatedStream.ReadByte(); // FLG var fhcrc = 0 != (0x2 & flg); // CRC16 present before compressed data var fextra = 0 != (0x4 & flg); // extra fields present var fname = 0 != (0x8 & flg); // original file name present var fcomment = 0 != (0x10 & flg); // file comment present // Skip unsupported fields if (_deflatedStream.CanSeek) _deflatedStream.Seek(6, SeekOrigin.Current); else { _deflatedStream.ReadByte(); _deflatedStream.ReadByte(); _deflatedStream.ReadByte(); _deflatedStream.ReadByte(); // MTIME _deflatedStream.ReadByte(); // XFL _deflatedStream.ReadByte(); // OS } if (fextra) { // Skip XLEN bytes of data var xlen = _deflatedStream.ReadByte() | (_deflatedStream.ReadByte() << 8); while (0 < xlen) { _deflatedStream.ReadByte(); xlen--; } } if (fname) { // Skip 0-terminated file name while (0 != _deflatedStream.ReadByte()) { } } if (fcomment) { // Skip 0-terminated file comment while (0 != _deflatedStream.ReadByte()) { } } if (fhcrc) { _deflatedStream.ReadByte(); _deflatedStream.ReadByte(); // CRC16 } // Read compressed data const int zipHeaderSize = 30 + 1; // 30 bytes + 1 character for file name const int zipFooterSize = 68 + 1; // 68 bytes + 1 character for file name // Download unknown amount of compressed data efficiently (note: Content-Length header is not always reliable) var buffers = new List(); var buffer = new byte[4096]; var bytesInBuffer = 0; var totalBytes = 0; var bytesRead = 0; do { if (buffer.Length == bytesInBuffer) { // Full, allocate another buffers.Add(buffer); buffer = new byte[buffer.Length]; bytesInBuffer = 0; } Debug.Assert(bytesInBuffer < buffer.Length); bytesRead = _deflatedStream.Read(buffer, bytesInBuffer, buffer.Length - bytesInBuffer); bytesInBuffer += bytesRead; totalBytes += bytesRead; } while (0 < bytesRead); buffers.Add(buffer); // "Trim" crc32 and isize fields off the end var compressedSize = totalBytes - 4 - 4; if (compressedSize < 0) { throw new NotSupportedException("Compressed data not in the expected format."); } // Create contiguous buffer var compressedBytes = new byte[zipHeaderSize + compressedSize + zipFooterSize]; var offset = zipHeaderSize; var remainingBytes = totalBytes; foreach (var b in buffers) { var length = Math.Min(b.Length, remainingBytes); Array.Copy(b, 0, compressedBytes, offset, length); offset += length; remainingBytes -= length; } Debug.Assert(0 == remainingBytes); // Read footer from end of compressed bytes (note: footer is within zipFooterSize; will be overwritten below) Debug.Assert(totalBytes <= compressedSize + zipFooterSize); offset = zipHeaderSize + compressedSize; var crc32 = compressedBytes[offset + 0] | (compressedBytes[offset + 1] << 8) | (compressedBytes[offset + 2] << 16) | (compressedBytes[offset + 3] << 24); var isize = compressedBytes[offset + 4] | (compressedBytes[offset + 5] << 8) | (compressedBytes[offset + 6] << 16) | (compressedBytes[offset + 7] << 24); if (0 == isize) // HACK to handle compressed 0-byte streams without figuring out what's really going wrong { _inflatedStream = new MemoryStream(); return; } // Create ZIP file stream const string fileName = "f"; // MUST be 1 character (offsets below assume this) Debug.Assert(1 == fileName.Length); var zipFileMemoryStream = new MemoryStream(compressedBytes); var writer = new BinaryWriter(zipFileMemoryStream); // Local file header writer.Write((uint)0x04034b50); // local file header signature writer.Write((ushort)20); // version needed to extract (2.0 == compressed using deflate) writer.Write((ushort)0); // general purpose bit flag writer.Write((ushort)8); // compression method (8: deflate) writer.Write((ushort)0); // last mod file time writer.Write((ushort)0); // last mod file date writer.Write(crc32); // crc-32 writer.Write(compressedSize); // compressed size writer.Write(isize); // uncompressed size writer.Write((ushort)1); // file name length writer.Write((ushort)0); // extra field length writer.Write((byte)fileName[0]); // file name // File data (already present) zipFileMemoryStream.Seek(compressedSize, SeekOrigin.Current); // Central directory structure writer.Write((uint)0x02014b50); // central file header signature writer.Write((ushort)20); // version made by writer.Write((ushort)20); // version needed to extract (2.0 == compressed using deflate) writer.Write((ushort)0); // general purpose bit flag writer.Write((ushort)8); // compression method writer.Write((ushort)0); // last mod file time writer.Write((ushort)0); // last mod file date writer.Write(crc32); // crc-32 writer.Write(compressedSize); // compressed size writer.Write(isize); // uncompressed size writer.Write((ushort)1); // file name length writer.Write((ushort)0); // extra field length writer.Write((ushort)0); // file comment length writer.Write((ushort)0); // disk number start writer.Write((ushort)0); // internal file attributes writer.Write((uint)0); // external file attributes writer.Write((uint)0); // relative offset of local header writer.Write((byte)fileName[0]); // file name // End of central directory record writer.Write((uint)0x06054b50); // end of central dir signature writer.Write((ushort)0); // number of this disk writer.Write((ushort)0); // number of the disk with the start of the central directory writer.Write((ushort)1); // total number of entries in the central directory on this disk writer.Write((ushort)1); // total number of entries in the central directory writer.Write((uint)(46 + 1)); // size of the central directory (46 bytes + 1 character for file name) writer.Write((uint)(zipHeaderSize + compressedSize)); // offset of start of central directory with respect to the starting disk number writer.Write((ushort)0); // .ZIP file comment length // Reset ZIP file stream to beginning zipFileMemoryStream.Seek(0, SeekOrigin.Begin); // Return the decompressed stream _inflatedStream = Application.GetResourceStream( new StreamResourceInfo(zipFileMemoryStream, null), new Uri(fileName, UriKind.Relative)) .Stream; } public override bool CanRead { get { return _inflatedStream.CanRead; } } public override bool CanSeek { get { return _inflatedStream.CanSeek; } } public override bool CanWrite { get { return _inflatedStream.CanWrite; } } public override void Flush() { _inflatedStream.Flush(); } public override long Length { get { return _inflatedStream.Length; } } public override long Position { get { return _inflatedStream.Position; } set { _inflatedStream.Position = value; } } public override int Read(byte[] buffer, int offset, int count) { return _inflatedStream.Read(buffer, offset, count); } public override long Seek(long offset, SeekOrigin origin) { return _inflatedStream.Seek(offset, origin); } public override void SetLength(long value) { _inflatedStream.SetLength(value); } public override void Write(byte[] buffer, int offset, int count) { throw new NotSupportedException(); } public override void Close() { _deflatedStream.Close(); _inflatedStream.Close(); } protected override void Dispose(bool disposing) { _deflatedStream.Dispose(); _inflatedStream.Dispose(); } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { return _inflatedStream.BeginRead(buffer, offset, count, callback, state); } public override int ReadByte() { return _inflatedStream.ReadByte(); } public override int EndRead(IAsyncResult asyncResult) { return _inflatedStream.EndRead(asyncResult); } public override int ReadTimeout { get { return _inflatedStream.ReadTimeout; } set { _inflatedStream.ReadTimeout = value; } } public override bool CanTimeout { get { return _inflatedStream.CanTimeout; } } } } #endif ================================================ FILE: Telegram.Api/Compression/GZipWebClient.cs ================================================ // (c) Copyright Morten Nielsen. // This source is subject to the Microsoft Public License (Ms-PL). // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. #if SILVERLIGHT using System; using System.Net; using System.Security; using System.IO; using System.Linq; namespace SharpGIS { /// /// This is an explicit web client class for doing webrequests. /// If you want to opt in for gzip support on all existing WebClients, consider /// using the /// public class GZipWebClient : WebClient { /// /// Initializes a new instance of the class. /// [SecuritySafeCritical] public GZipWebClient() { } /// /// Returns a object for the specified resource. /// /// A that identifies the resource to request. /// /// A new object for the specified resource. /// protected override WebRequest GetWebRequest(Uri address) { var req = base.GetWebRequest(address); req.Headers[HttpRequestHeader.AcceptEncoding] = "gzip"; //Set GZIP header return req; } /// /// Returns the for the specified using the specified . /// /// A that is used to obtain the response. /// An object obtained from a previous call to . /// /// A containing the response for the specified . /// protected override WebResponse GetWebResponse(WebRequest request, IAsyncResult result) { try { WebResponse response = base.GetWebResponse(request, result); if (!(response is GZipWebResponse) && //this would be the case if WebRequestCreator was also used (response.Headers[HttpRequestHeader.ContentEncoding] == "gzip") && response is HttpWebResponse) return new GZipWebResponse(response as HttpWebResponse); //If gzipped response, uncompress else return response; } catch { return null; } } internal sealed class GZipWebResponse : HttpWebResponse { private readonly HttpWebResponse _response; private readonly SharpGIS.GZipInflateStream _stream; internal GZipWebResponse(HttpWebResponse resp) { _response = resp; _stream = new GZipInflateStream(_response.GetResponseStream()); } public override System.IO.Stream GetResponseStream() { return _stream; } public override void Close() { _response.Close(); _stream.Close(); } public override long ContentLength { get { return _stream.Length; } } public override string ContentType { get { return _response.ContentType; } } public override WebHeaderCollection Headers { get { return _response.Headers; } } public override Uri ResponseUri { get { return _response.ResponseUri; } } public override bool SupportsHeaders { get { return _response.SupportsHeaders; } } public override string Method { get { return _response.Method; } } public override HttpStatusCode StatusCode { get { return _response.StatusCode; } } public override string StatusDescription { get { return _response.StatusDescription; } } public override CookieCollection Cookies { get { return _response.Cookies; } } } } } #endif ================================================ FILE: Telegram.Api/Constants.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // //#define TEST_SERVER namespace Telegram.Api { public static class Constants { public const int ApiId = https://core.telegram.org/api/obtaining_api_id public const string ApiHash = https://core.telegram.org/api/obtaining_api_id #if TEST_SERVER public const int FirstServerDCId = 1; public const int FirstServerPort = 443; public const string FirstServerIpAddress = "149.154.175.40"; // dc1 //"149.154.167.40"; // dc2 //"149.154.175.117"; // dc3 public const bool IsTestServer = true; #else public const int FirstServerDCId = 2; // [1, 2, 3, 4, 5] public const int FirstServerPort = 443; public const string FirstServerIpAddress = //"149.154.175.50"; // dc1 "149.154.167.51"; // dc2 //"174.140.142.6"; // dc3 //"149.154.167.90"; // dc4 //"149.154.171.5"; // dc5 public const bool IsTestServer = false; #endif public const int SupportedLayer = 85; public const int MinSecretSupportedLayer = 46; public const int SecretSupportedLayer = 73; public const int LongPollReattemptDelay = 5000; //ms public const double MessageSendingInterval = #if DEBUG 300; //seconds (5 minutes - 30 seconds(max delay: 25)) #else 180; //seconds (5 minutes - 30 seconds(max delay: 25)) #endif public const double ResendMessageInterval = 5.0; //seconds public const int CommitDBInterval = 3; //seconds public const int GetConfigInterval = 60 * 60; //seconds public const int TimeoutInterval = 25; //seconds public const double DelayedTimeoutInterval = 45.0; //seconds public const double NonEncryptedTimeoutInterval = 15.0; //seconds public const bool IsLongPollEnabled = false; public const int CachedDialogsCount = 20; public const int CachedMessagesCount = 25; public const int WorkersNumber = 4; public static int BigFileWorkersNumber = 4; public const string ConfigKey = "Config"; public const string ConfigFileName = "config.xml"; public static double CheckSendingMesagesInterval = 5.0; //seconds public static double CheckGetConfigInterval = #if DEBUG 10.0; #else 1 * 60.0; //seconds (1 min) #endif public static double CheckPingInterval = 20.0; //seconds public static double UpdateStatusInterval = 2.0; public static int VideoUploadersCount = 3; public static int DocumentUploadersCount = 3; public static int AudioDownloadersCount = 3; public static int MaximumChunksCount = 3000; public static int DownloadedChunkSize = 32 * 1024; // 1MB % DownloadedChunkSize = 0 && DownloadedChunkSize % 1KB = 0 public static int DownloadedBigChunkSize = 128 * 1024; // 1MB % DownloadedChunkSize = 0 && DownloadedChunkSize % 1KB = 0 public static ulong MaximumUploadedFileSize = 512 * 1024 * 3000; // 1,5GB public static string StateFileName = "state.dat"; public static string TempStateFileName = "temp_state.dat"; public static string ActionQueueFileName = "action_queue.dat"; public static string SentQueueIdFileName = "sent_queue_id.dat"; public const string IsAuthorizedKey = "IsAuthorized"; public const int StickerMaxSize = 256 * 1024; // 256 KB public const int GifMaxSize = 10 * 1014 * 1024; // 10 MB public const int AutoDownloadGifMaxSize = 2 * 1014 * 1024; // 1 MB public const int SmallFileMaxSize = 32 * 1024; //10 * 1024 * 1024; // 10 MB public const string BackgroundTaskSettingsFileName = "background_task_settings.dat"; public const string DifferenceFileName = "difference.dat"; public const string TempDifferenceFileName = "temp_difference.dat"; public const string DifferenceTimeFileName = "difference_time.dat"; public const string TelegramMessengerMutexName = "TelegramMessenger"; public const double DifferenceMinInterval = 10.0; //seconds public const string InitConnectionFileName = "init_connection.dat"; public const string DisableNotificationsFileName = "disable_notifications.dat"; public const int MinRandomBytesLength = 15; public static int MinSecretChatWithExtendedKeyVisualizationLayer = 46; public static int MinSecretChatWithMTProto2Layer = 46; public const string ProxyConfigFileName = "proxy_config.dat"; public const string CdnConfigFileName = "cdn_config.dat"; public const string LiveLocationsFileName = "live_locations.dat"; public const int CheckConfigTimeout = #if DEBUG 10; #else 7; #endif } } ================================================ FILE: Telegram.Api/Extensions/ActionExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.Extensions { public static class ActionExtensions { public static void SafeInvoke(this Action action) { if (action != null) { action.Invoke(); } } public static void SafeInvoke(this Action action, T param) { if (action != null) { action.Invoke(param); } } public static void SafeInvoke(this Action action, T1 param1, T2 param2) { if (action != null) { action.Invoke(param1, param2); } } public static void SafeInvoke(this Action action, T1 param1, T2 param2, T3 param3) { if (action != null) { action.Invoke(param1, param2, param3); } } public static void SafeInvoke(this Action action, T1 param1, T2 param2, T3 param3, T4 param4) { if (action != null) { action.Invoke(param1, param2, param3, param4); } } } } ================================================ FILE: Telegram.Api/Extensions/HttpWebRequestExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Net; using Telegram.Api.TL; namespace Telegram.Api.Extensions { public static class HttpWebRequestExtensions { public static void BeginAsync(this HttpWebRequest request, byte[] data, Action callback, Action faultCallback) { request.BeginGetRequestStream(ar => GetRequestStreamCallback(data, ar, ar2 => EndAsync(ar2, callback, faultCallback)), request); } public static void BeginAsync(this HttpWebRequest request, byte[] data, Action onCompleted) { request.BeginGetRequestStream(ar => GetRequestStreamCallback(data, ar, onCompleted), request); } private static void GetRequestStreamCallback(byte[] data, IAsyncResult asynchronousResult, Action onCompleted) { var request = (HttpWebRequest)asynchronousResult.AsyncState; // End the operation var postStream = request.EndGetRequestStream(asynchronousResult); // Convert the string into a byte array. var byteArray = data; // Write to the request stream. postStream.Write(byteArray, 0, data.Length); postStream.Dispose(); // Start the asynchronous operation to get the response request.BeginGetResponse(x => onCompleted(x), request); } private static void EndAsync(IAsyncResult asynchronousResult, Action callback, Action faultCallback) { //try { try { var request = (HttpWebRequest)asynchronousResult.AsyncState; HttpWebResponse response; using (response = (HttpWebResponse)request.EndGetResponse(asynchronousResult)) { using (var dataStream = response.GetResponseStream()) { var buffer = new byte[Int32.Parse(response.Headers["Content-Length"])]; var bytesRead = 0; var totalBytesRead = bytesRead; while (totalBytesRead < buffer.Length) { bytesRead = dataStream.Read(buffer, bytesRead, buffer.Length - bytesRead); totalBytesRead += bytesRead; } callback(buffer); } } } catch (Exception ex) { TLUtils.WriteException(ex); faultCallback(); //response = (HttpWebResponse)ex.Response; //if (response == null) //{ // if (faultCallback != null) faultCallback(); // return; //} //if (response.StatusCode == HttpStatusCode.BadGateway // || response.StatusCode == HttpStatusCode.NotFound) //{ // if (faultCallback != null) faultCallback(); // return; //} } } } } } ================================================ FILE: Telegram.Api/Extensions/StreamExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; namespace Telegram.Api.Extensions { public static class StreamExtensions { public static void Write(this Stream output, byte[] buffer) { output.Write(buffer, 0, buffer.Length); } } } ================================================ FILE: Telegram.Api/Extensions/TLObjectExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.TL; namespace Telegram.Api.Extensions { public static class TLObjectExtensions { public static void NullableToStream(this TLObject obj, Stream output) { if (obj == null) { output.Write(new TLNull().ToBytes()); } else { obj.ToStream(output); } } public static T NullableFromStream(Stream input) where T : TLObject { var obj = TLObjectGenerator.GetNullableObject(input); if (obj == null) return null; return (T)obj.FromStream(input); } } } ================================================ FILE: Telegram.Api/Hash/CRC32/CRC.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #if WINDOWS_PHONE using System; using System.Security.Cryptography; namespace Telegram.Api { /// /// HashAlgorithm implementation for CRC-32. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "CRC", Justification = "Matching algorithm acronym.")] public class CRC32 : HashAlgorithm { // Shared, pre-computed lookup table for efficiency private static readonly uint[] _crc32Table; /// /// Initializes the shared lookup table. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Table values must be computed; not possible to remove the static constructor.")] static CRC32() { // Allocate table _crc32Table = new uint[256]; // For each byte for (uint n = 0; n < 256; n++) { // For each bit uint c = n; for (int k = 0; k < 8; k++) { // Compute value if (0 != (c & 1)) { c = 0xedb88320 ^ (c >> 1); } else { c = c >> 1; } } // Store result in table _crc32Table[n] = c; } } // Current hash value private uint _crc32Value; // True if HashCore has been called private bool _hashCoreCalled; // True if HashFinal has been called private bool _hashFinalCalled; /// /// Initializes a new instance. /// public CRC32() { InitializeVariables(); } /// /// Initializes internal state. /// public override void Initialize() { InitializeVariables(); } /// /// Initializes variables. /// private void InitializeVariables() { _crc32Value = uint.MaxValue; _hashCoreCalled = false; _hashFinalCalled = false; } /// /// Updates the hash code for the provided data. /// /// Data. /// Start position. /// Number of bytes. protected override void HashCore(byte[] array, int ibStart, int cbSize) { if (null == array) { throw new ArgumentNullException("array"); } if (_hashFinalCalled) { throw new CryptographicException( "Hash not valid for use in specified state."); } _hashCoreCalled = true; for (int i = ibStart; i < ibStart + cbSize; i++) { byte index = (byte)(_crc32Value ^ array[i]); _crc32Value = _crc32Table[index] ^ ((_crc32Value >> 8) & 0xffffff); } } /// /// Finalizes the hash code and returns it. /// /// protected override byte[] HashFinal() { _hashFinalCalled = true; return Hash; } /// /// Returns the hash as an array of bytes. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations", Justification = "Matching .NET behavior by throwing here.")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "Matching .NET behavior by throwing NullReferenceException.")] public override byte[] Hash { get { if (!_hashCoreCalled) { throw new NullReferenceException(); } if (!_hashFinalCalled) { // Note: Not CryptographicUnexpectedOperationException because // that can't be instantiated on Silverlight 4 throw new CryptographicException( "Hash must be finalized before the hash value is retrieved."); } // Convert complement of hash code to byte array byte[] bytes = BitConverter.GetBytes(~_crc32Value); // Reverse for proper endianness, and return Array.Reverse(bytes); return bytes; } } // Return size of hash in bits. public override int HashSize { get { return 4 * 8; } } } } #endif ================================================ FILE: Telegram.Api/Hash/MD5/MD5.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Text; // Simple struct for the (a,b,c,d) which is used to compute the mesage digest. struct ABCDStruct { public uint A; public uint B; public uint C; public uint D; } public sealed class MD5Core { //Prevent CSC from adding a default public constructor private MD5Core() {} public static byte[] GetHash(string input, Encoding encoding) { if (null == input) throw new System.ArgumentNullException("input", "Unable to calculate hash over null input data"); if (null == encoding) throw new System.ArgumentNullException("encoding", "Unable to calculate hash over a string without a default encoding. Consider using the GetHash(string) overload to use UTF8 Encoding"); byte[] target = encoding.GetBytes(input); return GetHash(target); } public static byte[] GetHash(string input) { return GetHash(input, new UTF8Encoding()); } public static string GetHashString(byte[] input) { if (null == input) throw new System.ArgumentNullException("input", "Unable to calculate hash over null input data"); string retval = BitConverter.ToString(GetHash(input)); retval = retval.Replace("-", ""); return retval; } public static string GetHashString(string input, Encoding encoding) { if (null == input) throw new System.ArgumentNullException("input", "Unable to calculate hash over null input data"); if (null == encoding) throw new System.ArgumentNullException("encoding", "Unable to calculate hash over a string without a default encoding. Consider using the GetHashString(string) overload to use UTF8 Encoding"); byte[] target = encoding.GetBytes(input); return GetHashString(target); } public static string GetHashString(string input) { return GetHashString(input, new UTF8Encoding()); } public static byte[] GetHash(byte[] input) { if (null == input) throw new System.ArgumentNullException("input", "Unable to calculate hash over null input data"); //Intitial values defined in RFC 1321 ABCDStruct abcd = new ABCDStruct(); abcd.A = 0x67452301; abcd.B = 0xefcdab89; abcd.C = 0x98badcfe; abcd.D = 0x10325476; //We pass in the input array by block, the final block of data must be handled specialy for padding & length embeding int startIndex = 0; while (startIndex <= input.Length - 64) { MD5Core.GetHashBlock(input, ref abcd, startIndex); startIndex += 64; } // The final data block. return MD5Core.GetHashFinalBlock(input, startIndex, input.Length - startIndex, abcd, (Int64)input.Length * 8); } internal static byte[] GetHashFinalBlock(byte[] input, int ibStart, int cbSize, ABCDStruct ABCD, Int64 len) { byte[] working = new byte[64]; byte[] length = BitConverter.GetBytes(len); //Padding is a single bit 1, followed by the number of 0s required to make size congruent to 448 modulo 512. Step 1 of RFC 1321 //The CLR ensures that our buffer is 0-assigned, we don't need to explicitly set it. This is why it ends up being quicker to just //use a temporary array rather then doing in-place assignment (5% for small inputs) Array.Copy(input, ibStart, working, 0, cbSize); working[cbSize] = 0x80; //We have enough room to store the length in this chunk if (cbSize < 56) { Array.Copy(length, 0, working, 56, 8); GetHashBlock(working, ref ABCD, 0); } else //We need an aditional chunk to store the length { GetHashBlock(working, ref ABCD, 0); //Create an entirely new chunk due to the 0-assigned trick mentioned above, to avoid an extra function call clearing the array working = new byte[64]; Array.Copy(length, 0, working, 56, 8); GetHashBlock(working, ref ABCD, 0); } byte[] output = new byte[16]; Array.Copy(BitConverter.GetBytes(ABCD.A), 0, output, 0, 4); Array.Copy(BitConverter.GetBytes(ABCD.B), 0, output, 4, 4); Array.Copy(BitConverter.GetBytes(ABCD.C), 0, output, 8, 4); Array.Copy(BitConverter.GetBytes(ABCD.D), 0, output, 12, 4); return output; } // Performs a single block transform of MD5 for a given set of ABCD inputs /* If implementing your own hashing framework, be sure to set the initial ABCD correctly according to RFC 1321: // A = 0x67452301; // B = 0xefcdab89; // C = 0x98badcfe; // D = 0x10325476; */ internal static void GetHashBlock(byte[] input, ref ABCDStruct ABCDValue, int ibStart) { uint[] temp = Converter(input, ibStart); uint a = ABCDValue.A; uint b = ABCDValue.B; uint c = ABCDValue.C; uint d = ABCDValue.D; a = r1(a, b, c, d, temp[0 ], 7, 0xd76aa478); d = r1(d, a, b, c, temp[1 ], 12, 0xe8c7b756); c = r1(c, d, a, b, temp[2 ], 17, 0x242070db); b = r1(b, c, d, a, temp[3 ], 22, 0xc1bdceee); a = r1(a, b, c, d, temp[4 ], 7, 0xf57c0faf); d = r1(d, a, b, c, temp[5 ], 12, 0x4787c62a); c = r1(c, d, a, b, temp[6 ], 17, 0xa8304613); b = r1(b, c, d, a, temp[7 ], 22, 0xfd469501); a = r1(a, b, c, d, temp[8 ], 7, 0x698098d8); d = r1(d, a, b, c, temp[9 ], 12, 0x8b44f7af); c = r1(c, d, a, b, temp[10], 17, 0xffff5bb1); b = r1(b, c, d, a, temp[11], 22, 0x895cd7be); a = r1(a, b, c, d, temp[12], 7, 0x6b901122); d = r1(d, a, b, c, temp[13], 12, 0xfd987193); c = r1(c, d, a, b, temp[14], 17, 0xa679438e); b = r1(b, c, d, a, temp[15], 22, 0x49b40821); a = r2(a, b, c, d, temp[1 ], 5, 0xf61e2562); d = r2(d, a, b, c, temp[6 ], 9, 0xc040b340); c = r2(c, d, a, b, temp[11], 14, 0x265e5a51); b = r2(b, c, d, a, temp[0 ], 20, 0xe9b6c7aa); a = r2(a, b, c, d, temp[5 ], 5, 0xd62f105d); d = r2(d, a, b, c, temp[10], 9, 0x02441453); c = r2(c, d, a, b, temp[15], 14, 0xd8a1e681); b = r2(b, c, d, a, temp[4 ], 20, 0xe7d3fbc8); a = r2(a, b, c, d, temp[9 ], 5, 0x21e1cde6); d = r2(d, a, b, c, temp[14], 9, 0xc33707d6); c = r2(c, d, a, b, temp[3 ], 14, 0xf4d50d87); b = r2(b, c, d, a, temp[8 ], 20, 0x455a14ed); a = r2(a, b, c, d, temp[13], 5, 0xa9e3e905); d = r2(d, a, b, c, temp[2 ], 9, 0xfcefa3f8); c = r2(c, d, a, b, temp[7 ], 14, 0x676f02d9); b = r2(b, c, d, a, temp[12], 20, 0x8d2a4c8a); a = r3(a, b, c, d, temp[5 ], 4, 0xfffa3942); d = r3(d, a, b, c, temp[8 ], 11, 0x8771f681); c = r3(c, d, a, b, temp[11], 16, 0x6d9d6122); b = r3(b, c, d, a, temp[14], 23, 0xfde5380c); a = r3(a, b, c, d, temp[1 ], 4, 0xa4beea44); d = r3(d, a, b, c, temp[4 ], 11, 0x4bdecfa9); c = r3(c, d, a, b, temp[7 ], 16, 0xf6bb4b60); b = r3(b, c, d, a, temp[10], 23, 0xbebfbc70); a = r3(a, b, c, d, temp[13], 4, 0x289b7ec6); d = r3(d, a, b, c, temp[0 ], 11, 0xeaa127fa); c = r3(c, d, a, b, temp[3 ], 16, 0xd4ef3085); b = r3(b, c, d, a, temp[6 ], 23, 0x04881d05); a = r3(a, b, c, d, temp[9 ], 4, 0xd9d4d039); d = r3(d, a, b, c, temp[12], 11, 0xe6db99e5); c = r3(c, d, a, b, temp[15], 16, 0x1fa27cf8); b = r3(b, c, d, a, temp[2 ], 23, 0xc4ac5665); a = r4(a, b, c, d, temp[0 ], 6, 0xf4292244); d = r4(d, a, b, c, temp[7 ], 10, 0x432aff97); c = r4(c, d, a, b, temp[14], 15, 0xab9423a7); b = r4(b, c, d, a, temp[5 ], 21, 0xfc93a039); a = r4(a, b, c, d, temp[12], 6, 0x655b59c3); d = r4(d, a, b, c, temp[3 ], 10, 0x8f0ccc92); c = r4(c, d, a, b, temp[10], 15, 0xffeff47d); b = r4(b, c, d, a, temp[1 ], 21, 0x85845dd1); a = r4(a, b, c, d, temp[8 ], 6, 0x6fa87e4f); d = r4(d, a, b, c, temp[15], 10, 0xfe2ce6e0); c = r4(c, d, a, b, temp[6 ], 15, 0xa3014314); b = r4(b, c, d, a, temp[13], 21, 0x4e0811a1); a = r4(a, b, c, d, temp[4 ], 6, 0xf7537e82); d = r4(d, a, b, c, temp[11], 10, 0xbd3af235); c = r4(c, d, a, b, temp[2 ], 15, 0x2ad7d2bb); b = r4(b, c, d, a, temp[9 ], 21, 0xeb86d391); ABCDValue.A = unchecked(a + ABCDValue.A); ABCDValue.B = unchecked(b + ABCDValue.B); ABCDValue.C = unchecked(c + ABCDValue.C); ABCDValue.D = unchecked(d + ABCDValue.D); return; } //Manually unrolling these equations nets us a 20% performance improvement private static uint r1(uint a, uint b, uint c, uint d, uint x, int s, uint t) { // (b + LSR((a + F(b, c, d) + x + t), s)) //F(x, y, z) ((x & y) | ((x ^ 0xFFFFFFFF) & z)) return unchecked(b + LSR((a + ((b & c) | ((b ^ 0xFFFFFFFF) & d)) + x + t), s)); } private static uint r2(uint a, uint b, uint c, uint d, uint x, int s, uint t) { // (b + LSR((a + G(b, c, d) + x + t), s)) //G(x, y, z) ((x & z) | (y & (z ^ 0xFFFFFFFF))) return unchecked(b + LSR((a + ((b & d) | (c & (d ^ 0xFFFFFFFF))) + x + t), s)); } private static uint r3(uint a, uint b, uint c, uint d, uint x, int s, uint t) { // (b + LSR((a + H(b, c, d) + k + i), s)) //H(x, y, z) (x ^ y ^ z) return unchecked(b + LSR((a + (b ^ c ^ d) + x + t), s)); } private static uint r4(uint a, uint b, uint c, uint d, uint x, int s, uint t) { // (b + LSR((a + I(b, c, d) + k + i), s)) //I(x, y, z) (y ^ (x | (z ^ 0xFFFFFFFF))) return unchecked(b + LSR((a + (c ^ (b | (d ^ 0xFFFFFFFF))) + x + t), s)); } // Implementation of left rotate // s is an int instead of a uint becuase the CLR requires the argument passed to >>/<< is of // type int. Doing the demoting inside this function would add overhead. private static uint LSR(uint i, int s) { return ((i << s) | (i >> (32-s))); } //Convert input array into array of UInts private static uint[] Converter(byte[] input, int ibStart) { if(null == input) throw new System.ArgumentNullException("input", "Unable convert null array to array of uInts"); uint[] result = new uint[16]; for (int i = 0; i < 16; i++) { result[i] = (uint)input[ibStart + i * 4]; result[i] += (uint)input[ibStart + i * 4 + 1] << 8; result[i] += (uint)input[ibStart + i * 4 + 2] << 16; result[i] += (uint)input[ibStart + i * 4 + 3] << 24; } return result; } } ================================================ FILE: Telegram.Api/Hash/MD5/MD5CryptoServiceProvider.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Text; namespace Telegram.Api.MD5 { public class MD5CryptoServiceProvider : MD5 { public MD5CryptoServiceProvider() : base() { } } public class MD5 : IDisposable { static public MD5 Create(string hashName) { if (hashName == "MD5") return new MD5(); else throw new NotSupportedException(); } static public string GetMd5String(String source) { MD5 md = MD5CryptoServiceProvider.Create(); byte[] hash; //Create a new instance of ASCIIEncoding to //convert the string into an array of Unicode bytes. UTF8Encoding enc = new UTF8Encoding(); // ASCIIEncoding enc = new ASCIIEncoding(); //Convert the string into an array of bytes. byte[] buffer = enc.GetBytes(source); //Create the hash value from the array of bytes. hash = md.ComputeHash(buffer); StringBuilder sb = new StringBuilder(); foreach (byte b in hash) sb.Append(b.ToString("x2")); return sb.ToString(); } static public MD5 Create() { return new MD5(); } #region base implementation of the MD5 #region constants private const byte S11 = 7; private const byte S12 = 12; private const byte S13 = 17; private const byte S14 = 22; private const byte S21 = 5; private const byte S22 = 9; private const byte S23 = 14; private const byte S24 = 20; private const byte S31 = 4; private const byte S32 = 11; private const byte S33 = 16; private const byte S34 = 23; private const byte S41 = 6; private const byte S42 = 10; private const byte S43 = 15; private const byte S44 = 21; static private byte[] PADDING = new byte[] { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #endregion #region F, G, H and I are basic MD5 functions. static private uint F(uint x, uint y, uint z) { return (((x) & (y)) | ((~x) & (z))); } static private uint G(uint x, uint y, uint z) { return (((x) & (z)) | ((y) & (~z))); } static private uint H(uint x, uint y, uint z) { return ((x) ^ (y) ^ (z)); } static private uint I(uint x, uint y, uint z) { return ((y) ^ ((x) | (~z))); } #endregion #region rotates x left n bits. /// /// rotates x left n bits. /// /// /// /// static private uint ROTATE_LEFT(uint x, byte n) { return (((x) << (n)) | ((x) >> (32 - (n)))); } #endregion #region FF, GG, HH, and II transformations /// FF, GG, HH, and II transformations /// for rounds 1, 2, 3, and 4. /// Rotation is separate from addition to prevent recomputation. static private void FF(ref uint a, uint b, uint c, uint d, uint x, byte s, uint ac) { (a) += F((b), (c), (d)) + (x) + (uint)(ac); (a) = ROTATE_LEFT((a), (s)); (a) += (b); } static private void GG(ref uint a, uint b, uint c, uint d, uint x, byte s, uint ac) { (a) += G((b), (c), (d)) + (x) + (uint)(ac); (a) = ROTATE_LEFT((a), (s)); (a) += (b); } static private void HH(ref uint a, uint b, uint c, uint d, uint x, byte s, uint ac) { (a) += H((b), (c), (d)) + (x) + (uint)(ac); (a) = ROTATE_LEFT((a), (s)); (a) += (b); } static private void II(ref uint a, uint b, uint c, uint d, uint x, byte s, uint ac) { (a) += I((b), (c), (d)) + (x) + (uint)(ac); (a) = ROTATE_LEFT((a), (s)); (a) += (b); } #endregion #region context info /// /// state (ABCD) /// uint[] state = new uint[4]; /// /// number of bits, modulo 2^64 (lsb first) /// uint[] count = new uint[2]; /// /// input buffer /// byte[] buffer = new byte[64]; #endregion internal MD5() { Initialize(); } /// /// MD5 initialization. Begins an MD5 operation, writing a new context. /// /// /// The RFC named it "MD5Init" /// public virtual void Initialize() { count[0] = count[1] = 0; // Load magic initialization constants. state[0] = 0x67452301; state[1] = 0xefcdab89; state[2] = 0x98badcfe; state[3] = 0x10325476; } /// /// MD5 block update operation. Continues an MD5 message-digest /// operation, processing another message block, and updating the /// context. /// /// /// /// /// The RFC Named it MD5Update protected virtual void HashCore(byte[] input, int offset, int count) { int i; int index; int partLen; // Compute number of bytes mod 64 index = (int)((this.count[0] >> 3) & 0x3F); // Update number of bits if ((this.count[0] += (uint)((uint)count << 3)) < ((uint)count << 3)) this.count[1]++; this.count[1] += ((uint)count >> 29); partLen = 64 - index; // Transform as many times as possible. if (count >= partLen) { Buffer.BlockCopy(input, offset, this.buffer, index, partLen); Transform(this.buffer, 0); for (i = partLen; i + 63 < count; i += 64) Transform(input, offset + i); index = 0; } else i = 0; // Buffer remaining input Buffer.BlockCopy(input, offset + i, this.buffer, index, count - i); } /// /// MD5 finalization. Ends an MD5 message-digest operation, writing the /// the message digest and zeroizing the context. /// /// message digest /// The RFC named it MD5Final protected virtual byte[] HashFinal() { byte[] digest = new byte[16]; byte[] bits = new byte[8]; int index, padLen; // Save number of bits Encode(bits, 0, this.count, 0, 8); // Pad out to 56 mod 64. index = (int)((uint)(this.count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); HashCore(PADDING, 0, padLen); // Append length (before padding) HashCore(bits, 0, 8); // Store state in digest Encode(digest, 0, state, 0, 16); // Zeroize sensitive information. count[0] = count[1] = 0; state[0] = 0; state[1] = 0; state[2] = 0; state[3] = 0; // initialize again, to be ready to use Initialize(); return digest; } /// /// MD5 basic transformation. Transforms state based on 64 bytes block. /// /// /// private void Transform(byte[] block, int offset) { uint a = state[0], b = state[1], c = state[2], d = state[3]; uint[] x = new uint[16]; Decode(x, 0, block, offset, 64); // Round 1 FF(ref a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ FF(ref d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ FF(ref c, d, a, b, x[2], S13, 0x242070db); /* 3 */ FF(ref b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ FF(ref a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ FF(ref d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ FF(ref c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ FF(ref b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ FF(ref a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ FF(ref d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ FF(ref c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF(ref b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF(ref a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF(ref d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF(ref c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF(ref b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ // Round 2 GG(ref a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ GG(ref d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ GG(ref c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG(ref b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ GG(ref a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ GG(ref d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG(ref c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG(ref b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ GG(ref a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ GG(ref d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG(ref c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ GG(ref b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ GG(ref a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG(ref d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ GG(ref c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ GG(ref b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ // Round 3 HH(ref a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ HH(ref d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ HH(ref c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH(ref b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH(ref a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ HH(ref d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ HH(ref c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ HH(ref b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH(ref a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH(ref d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ HH(ref c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ HH(ref b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ HH(ref a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ HH(ref d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH(ref c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH(ref b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ // Round 4 II(ref a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ II(ref d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ II(ref c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II(ref b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ II(ref a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II(ref d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ II(ref c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II(ref b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ II(ref a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ II(ref d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II(ref c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ II(ref b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II(ref a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ II(ref d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II(ref c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ II(ref b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; // Zeroize sensitive information. for (int i = 0; i < x.Length; i++) x[i] = 0; } /// /// Encodes input (uint) into output (byte). Assumes len is /// multiple of 4. /// /// /// /// /// /// private static void Encode(byte[] output, int outputOffset, uint[] input, int inputOffset, int count) { int i, j; int end = outputOffset + count; for (i = inputOffset, j = outputOffset; j < end; i++, j += 4) { output[j] = (byte)(input[i] & 0xff); output[j + 1] = (byte)((input[i] >> 8) & 0xff); output[j + 2] = (byte)((input[i] >> 16) & 0xff); output[j + 3] = (byte)((input[i] >> 24) & 0xff); } } /// /// Decodes input (byte) into output (uint). Assumes len is /// a multiple of 4. /// /// /// /// /// /// static private void Decode(uint[] output, int outputOffset, byte[] input, int inputOffset, int count) { int i, j; int end = inputOffset + count; for (i = outputOffset, j = inputOffset; j < end; i++, j += 4) output[i] = ((uint)input[j]) | (((uint)input[j + 1]) << 8) | (((uint)input[j + 2]) << 16) | (((uint)input[j + 3]) << 24); } #endregion #region expose the same interface as the regular MD5 object protected byte[] HashValue; protected int State; public virtual bool CanReuseTransform { get { return true; } } public virtual bool CanTransformMultipleBlocks { get { return true; } } public virtual byte[] Hash { get { if (this.State != 0) throw new InvalidOperationException(); return (byte[])HashValue.Clone(); } } public virtual int HashSize { get { return HashSizeValue; } } protected int HashSizeValue = 128; public virtual int InputBlockSize { get { return 1; } } public virtual int OutputBlockSize { get { return 1; } } public void Clear() { Dispose(true); } public byte[] ComputeHash(byte[] buffer) { return ComputeHash(buffer, 0, buffer.Length); } public byte[] ComputeHash(byte[] buffer, int offset, int count) { Initialize(); HashCore(buffer, offset, count); HashValue = HashFinal(); return (byte[])HashValue.Clone(); } public byte[] ComputeHash(Stream inputStream) { Initialize(); int count; byte[] buffer = new byte[4096]; while (0 < (count = inputStream.Read(buffer, 0, 4096))) { HashCore(buffer, 0, count); } HashValue = HashFinal(); return (byte[])HashValue.Clone(); } public int TransformBlock( byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset ) { if (inputBuffer == null) { throw new ArgumentNullException("inputBuffer"); } if (inputOffset < 0) { throw new ArgumentOutOfRangeException("inputOffset"); } if ((inputCount < 0) || (inputCount > inputBuffer.Length)) { throw new ArgumentException("inputCount"); } if ((inputBuffer.Length - inputCount) < inputOffset) { throw new ArgumentOutOfRangeException("inputOffset"); } if (this.State == 0) { Initialize(); this.State = 1; } HashCore(inputBuffer, inputOffset, inputCount); if ((inputBuffer != outputBuffer) || (inputOffset != outputOffset)) { Buffer.BlockCopy(inputBuffer, inputOffset, outputBuffer, outputOffset, inputCount); } return inputCount; } public byte[] TransformFinalBlock( byte[] inputBuffer, int inputOffset, int inputCount ) { if (inputBuffer == null) { throw new ArgumentNullException("inputBuffer"); } if (inputOffset < 0) { throw new ArgumentOutOfRangeException("inputOffset"); } if ((inputCount < 0) || (inputCount > inputBuffer.Length)) { throw new ArgumentException("inputCount"); } if ((inputBuffer.Length - inputCount) < inputOffset) { throw new ArgumentOutOfRangeException("inputOffset"); } if (this.State == 0) { Initialize(); } HashCore(inputBuffer, inputOffset, inputCount); HashValue = HashFinal(); byte[] buffer = new byte[inputCount]; Buffer.BlockCopy(inputBuffer, inputOffset, buffer, 0, inputCount); this.State = 0; return buffer; } #endregion protected virtual void Dispose(bool disposing) { if (!disposing) Initialize(); } public void Dispose() { Dispose(true); } } } ================================================ FILE: Telegram.Api/Hash/MD5/MD5Managed.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #if !WIN_RT using System; using System.Security.Cryptography; #if WINDOWS_PHONE public class MD5Managed : HashAlgorithm #else public class MD5Managed : MD5 #endif { private byte[] _data; private ABCDStruct _abcd; private Int64 _totalLength; private int _dataSize; public MD5Managed() { base.HashSizeValue = 0x80; this.Initialize(); } public override void Initialize() { _data = new byte[64]; _dataSize = 0; _totalLength = 0; _abcd = new ABCDStruct(); //Intitial values as defined in RFC 1321 _abcd.A = 0x67452301; _abcd.B = 0xefcdab89; _abcd.C = 0x98badcfe; _abcd.D = 0x10325476; } protected override void HashCore(byte[] array, int ibStart, int cbSize) { int startIndex = ibStart; int totalArrayLength = _dataSize + cbSize; if (totalArrayLength >= 64) { Array.Copy(array, startIndex, _data, _dataSize, 64 - _dataSize); // Process message of 64 bytes (512 bits) MD5Core.GetHashBlock(_data, ref _abcd, 0); startIndex += 64 - _dataSize; totalArrayLength -= 64; while (totalArrayLength >= 64) { Array.Copy(array, startIndex, _data, 0, 64); MD5Core.GetHashBlock(array, ref _abcd, startIndex); totalArrayLength -= 64; startIndex += 64; } _dataSize = totalArrayLength; Array.Copy(array, startIndex, _data, 0, totalArrayLength); } else { Array.Copy(array, startIndex, _data, _dataSize, cbSize); _dataSize = totalArrayLength; } _totalLength += cbSize; } protected override byte[] HashFinal() { base.HashValue = MD5Core.GetHashFinalBlock(_data, 0, _dataSize, _abcd, _totalLength * 8); return base.HashValue; } } #endif ================================================ FILE: Telegram.Api/Helpers/AuthorizationHelper.cs ================================================ using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Numerics; using System.Security.Cryptography; using Telegram.Api.TL; using Telegram.Api.Transport; namespace Telegram.Api.Helpers { /*public class AuthorizationHelper : IAuthorizationHelper { public static byte[] AuthKey { get; set; } public static TLLong Salt { get; set; } public static TLLong SessionId { get; set; } private readonly ITransport _transport; public AuthorizationHelper(ITransport transport) { _transport = transport; } public void InitAsync(Action> callback, Action faultCallback = null) { var authTime = Stopwatch.StartNew(); // 1 stage var authRequest = ComposeBeginAuthRequest(); var message = CreatePlainMessageBody(authRequest); var guid = 1; _transport.SendBytesAsync("resPQ " + guid, message, x1 => { var buffer = x1; // 2 stage var authResponse = AuthResponse.Parse(buffer); // 3 stage TLUtils.WriteLine("pq: " + authResponse.pq); var pqCalcTime = Stopwatch.StartNew(); var tuple = Utils.GetPQPollard(authResponse.pq); pqCalcTime.Stop(); TLUtils.WriteLineAtBegin("pqCalc time: " + pqCalcTime.Elapsed); var p = tuple.Item1; var q = tuple.Item2; TLUtils.WriteLine("p: " + tuple.Item1); var pStr = TLString.FromUInt64(tuple.Item1); //TLUtils.WriteLine("p bytes: " + BitConverter.ToString(pStr.ToBytes(8))); var qStr = TLString.FromUInt64(tuple.Item2); TLUtils.WriteLine("q: " + tuple.Item2); //TLUtils.WriteLine("q bytes: " + BitConverter.ToString(qStr.ToBytes(8))); // 4 stage var random1 = new Random(); var newNonce = new byte[32]; random1.NextBytes(newNonce); var data = ComposeData(authResponse, p, q, newNonce); //newNonce 32 //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("data [{1}]: {0}", BitConverter.ToString(data), data.Length)); //TLUtils.WriteLine("-----------------------------------------"); SHA1 sha = new SHA1Managed(); var sha1 = sha.ComputeHash(data); // data 96 //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("SHA1 data [{1}]: {0}", BitConverter.ToString(sha1), sha1.Length)); //TLUtils.WriteLine("-----------------------------------------"); var dataWithHash = sha1.Concat(data).ToArray(); //116 var data255 = new byte[255]; var random = new Random(); random.NextBytes(data255); Array.Copy(dataWithHash, data255, dataWithHash.Length); //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("data with hash [{1}]: {0}", BitConverter.ToString(data255), data255.Length)); //TLUtils.WriteLine("-----------------------------------------"); var rsa = GetRSABytes(data255); //data255 255 bytes var dhRequest = ComposeBeginDHRequest(authResponse, p, q, rsa); //rsa 256 bytes var dhMessage = CreatePlainMessageBody(dhRequest); //dhRequest 320 bytes guid = 2; _transport.SendBytesAsync("req_DH_params " + guid, dhMessage, dhResponseBuffer => { var dhResponse = BeginDHResponse.Parse(dhResponseBuffer); var aesParams = GetAesKeyIV(authResponse.ServerNonce, newNonce); var decryptedAnswerWithHash = Utils.AesIge(dhResponse.EncryptedAnswer, aesParams.Item1, aesParams.Item2, false); TLUtils.WriteLine("---Decrypted answer with hash----------------"); TLUtils.WriteLine(BitConverter.ToString(decryptedAnswerWithHash)); //var encryptedAnswerWithHash = Utils.AesIge(dhResponse.EncryptedAnswer, aesParams.Item1, aesParams.Item2, true); var answer = Answer.Parse(decryptedAnswerWithHash.Skip(20).ToArray()); var bBytes = new byte[256]; //big endian B random.NextBytes(bBytes); //TLUtils.WriteLine("B bytes: " + BitConverter.ToString(bBytes)); var g_bBytes = GetG_B(bBytes, answer.G, answer.DHPrime); // big-endian g_b //TLUtils.WriteLine("--G_B big endian bytes----------------------"); //TLUtils.WriteLine(BitConverter.ToString(g_bBytes)); var client_DH_inner_data = ComposeClientDHInnerData(g_bBytes, authResponse); var client_DH_inner_dataWithHash = sha.ComputeHash(client_DH_inner_data).Concat(client_DH_inner_data).ToArray(); var addedBytesLength = 16 - (client_DH_inner_dataWithHash.Length % 16); if (addedBytesLength > 0 && addedBytesLength < 16) { var addedBytes = new byte[addedBytesLength]; random.NextBytes(addedBytes); client_DH_inner_dataWithHash = client_DH_inner_dataWithHash.Concat(addedBytes).ToArray(); //TLUtils.WriteLine(string.Format("Added {0} bytes", addedBytesLength)); } var aesEncryptClientDHInnerDataWithHash = Utils.AesIge(client_DH_inner_dataWithHash, aesParams.Item1, aesParams.Item2, true); //TLUtils.WriteLine("--Last encrypted data------------------"); //TLUtils.WriteLine(BitConverter.ToString(aesEncryptClientDHInnerDataWithHash)); var requestSetClientDHParams = ComposeRequestSetClientDHParams(authResponse, aesEncryptClientDHInnerDataWithHash); var requestSetClientDHParamsMessage = CreatePlainMessageBody(requestSetClientDHParams); guid = 3; _transport.SendBytesAsync("set_client_DH_params " + guid, requestSetClientDHParamsMessage, x2 => { authTime.Stop(); TLUtils.WriteLineAtBegin("pqCalc time: " + pqCalcTime.Elapsed); TLUtils.WriteLineAtBegin("Auth time: " + authTime.Elapsed); TLUtils.WriteLineAtBegin("Auth - pqCalc time: " + (authTime.Elapsed - pqCalcTime.Elapsed)); buffer = x2; var endAuthResponse = EndAuthResponse.Parse(buffer); var authKey = GetAuthKey(bBytes, answer.G_A, answer.DHPrime); TLUtils.WriteLine("-Big endian auth key----------------------------------"); TLUtils.WriteLine(BitConverter.ToString(authKey)); TLUtils.WriteLine("-Big endian auth key----------------------------------"); #if !SILVERLIGHT using (StreamWriter w = File.AppendText("log.txt")) { w.WriteLine(DateTime.Now); w.WriteLine(BitConverter.ToString(authKey)); } #endif //newNonce - little endian //authResponse.ServerNonce - little endian var salt = GetSalt(newNonce, authResponse.ServerNonce); var sessionId = new byte[8]; random.NextBytes(sessionId); AuthKey = authKey; Salt = new TLLong(BitConverter.ToInt64(salt, 0)); SessionId = new TLLong(BitConverter.ToInt64(sessionId, 0)); TLUtils.WriteLine("Salt " + Salt + " (" + BitConverter.ToString(salt) + ")"); TLUtils.WriteLine("Session id " +SessionId + " (" + BitConverter.ToString(sessionId) + ")"); callback(new Tuple(authKey, salt, sessionId)); }, () => { if (faultCallback != null) faultCallback(null); }); }, () => { if (faultCallback != null) faultCallback(null); }); // dhMessage340bytes 404 here }, () => { if (faultCallback != null) faultCallback(null); }); } public Tuple Init() { // 1 stage var authRequest = ComposeBeginAuthRequest(); var message = CreatePlainMessageBody(authRequest); var buffer = _transport.SendBytes(message); // 2 stage var authResponse = AuthResponse.Parse(buffer); // 3 stage TLUtils.WriteLine("pq: ", authResponse.pq); var time = Stopwatch.StartNew(); var tuple = Utils.GetPQ(authResponse.pq); var p = tuple.Item1; var q = tuple.Item2; TLUtils.WriteLine("p: " + tuple.Item1); var pStr = TLString.FromUInt64(tuple.Item1); //TLUtils.WriteLine("p bytes: " + BitConverter.ToString(pStr.ToBytes(8))); var qStr = TLString.FromUInt64(tuple.Item2); TLUtils.WriteLine("q: " + tuple.Item2); //TLUtils.WriteLine("q bytes: " + BitConverter.ToString(qStr.ToBytes(8))); TLUtils.WriteLine("Calculation time: " + time.ElapsedMilliseconds); // 4 stage var random1 = new Random(); var newNonce = new byte[32]; random1.NextBytes(newNonce); var data = ComposeData(authResponse, p, q, newNonce); //newNonce 32 //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("data [{1}]: {0}", BitConverter.ToString(data), data.Length)); //TLUtils.WriteLine("-----------------------------------------"); SHA1 sha = new SHA1Managed(); var sha1 = sha.ComputeHash(data); // data 96 //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("SHA1 data [{1}]: {0}", BitConverter.ToString(sha1), sha1.Length)); //TLUtils.WriteLine("-----------------------------------------"); var dataWithHash = sha1.Concat(data).ToArray(); //116 var data255 = new byte[255]; var random = new Random(); random.NextBytes(data255); Array.Copy(dataWithHash, data255, dataWithHash.Length); //TLUtils.WriteLine("-----------------------------------------"); //TLUtils.WriteLine(string.Format("data with hash [{1}]: {0}", BitConverter.ToString(data255), data255.Length)); //TLUtils.WriteLine("-----------------------------------------"); var rsa = GetRSABytes(data255); //data255 255 bytes var dhRequest = ComposeBeginDHRequest(authResponse, p, q, rsa); //rsa 256 bytes var dhMessage = CreatePlainMessageBody(dhRequest); //dhRequest 320 bytes var stamp = Stopwatch.StartNew(); var dhResponseBuffer = _transport.SendBytes(dhMessage); // dhMessage340bytes 404 here var dhResponse = BeginDHResponse.Parse(dhResponseBuffer); var aesParams = GetAesKeyIV(authResponse.ServerNonce, newNonce); var decryptedAnswerWithHash = Utils.AesIge(dhResponse.EncryptedAnswer, aesParams.Item1, aesParams.Item2, false); //TLUtils.WriteLine("---Decrypted answer with hash----------------"); //TLUtils.WriteLine(BitConverter.ToString(decryptedAnswerWithHash)); //var encryptedAnswerWithHash = Utils.AesIge(dhResponse.EncryptedAnswer, aesParams.Item1, aesParams.Item2, true); var answer = Answer.Parse(decryptedAnswerWithHash.Skip(20).ToArray()); var bBytes = new byte[256]; //big endian B random.NextBytes(bBytes); //TLUtils.WriteLine("B bytes: " + BitConverter.ToString(bBytes)); var g_bBytes = GetG_B(bBytes, answer.G, answer.DHPrime); // big-endian g_b //TLUtils.WriteLine("--G_B big endian bytes----------------------"); //TLUtils.WriteLine(BitConverter.ToString(g_bBytes)); var client_DH_inner_data = ComposeClientDHInnerData(g_bBytes, authResponse); var client_DH_inner_dataWithHash = sha.ComputeHash(client_DH_inner_data).Concat(client_DH_inner_data).ToArray(); var addedBytesLength = 16 - (client_DH_inner_dataWithHash.Length % 16); if (addedBytesLength > 0 && addedBytesLength < 16) { var addedBytes = new byte[addedBytesLength]; random.NextBytes(addedBytes); client_DH_inner_dataWithHash = client_DH_inner_dataWithHash.Concat(addedBytes).ToArray(); //TLUtils.WriteLine(string.Format("Added {0} bytes", addedBytesLength)); } var aesEncryptClientDHInnerDataWithHash = Utils.AesIge(client_DH_inner_dataWithHash, aesParams.Item1, aesParams.Item2, true); //TLUtils.WriteLine("--Last encrypted data------------------"); //TLUtils.WriteLine(BitConverter.ToString(aesEncryptClientDHInnerDataWithHash)); var requestSetClientDHParams = ComposeRequestSetClientDHParams(authResponse, aesEncryptClientDHInnerDataWithHash); var requestSetClientDHParamsMessage = CreatePlainMessageBody(requestSetClientDHParams); buffer = _transport.SendBytes(requestSetClientDHParamsMessage); //TLUtils.WriteLine("--RESPONSE--------------"); //TLUtils.WriteLine(BitConverter.ToString(buffer)); var endAuthResponse = EndAuthResponse.Parse(buffer); var authKey = GetAuthKey(bBytes, answer.G_A, answer.DHPrime); TLUtils.WriteLine("-Big endian auth key----------------------------------"); TLUtils.WriteLine(BitConverter.ToString(authKey)); TLUtils.WriteLine("-Big endian auth key----------------------------------"); using (StreamWriter w = File.AppendText("log.txt")) { w.WriteLine(DateTime.Now); w.WriteLine(BitConverter.ToString(authKey)); } // II saveDeveloperInfo //var saveDeveloperInfoRequest = ComposeSaveDeveloperInfoRequest(); //newNonce - little endian //authResponse.ServerNonce - little endian var salt = GetSalt(newNonce, authResponse.ServerNonce); TLUtils.WriteLine("Salt " + BitConverter.ToString(salt)); var sessionId = new byte[8]; random.NextBytes(sessionId); TLUtils.WriteLine("Session id " + BitConverter.ToString(sessionId)); AuthKey = authKey; Salt = new TLLong(BitConverter.ToInt64(salt, 0)); SessionId = new TLLong(BitConverter.ToInt64(sessionId, 0)); return new Tuple(authKey, salt, sessionId); } public static byte[] GetSalt(byte[] newNonce, byte[] serverNonce) { var newNonceBytes = newNonce.Take(8).ToArray(); var serverNonceBytes = serverNonce.Take(8).ToArray(); //TLUtils.WriteLine("--Generate salt--"); //TLUtils.WriteLine("NewNonce little endian " + BitConverter.ToString(newNonce)); //TLUtils.WriteLine("ServerNonce little endian " + BitConverter.ToString(serverNonce)); //TLUtils.WriteLine("Getted 8 first bytes"); //TLUtils.WriteLine("NewNonce " + BitConverter.ToString(newNonceBytes)); //TLUtils.WriteLine("ServerNonce " + BitConverter.ToString(serverNonceBytes)); var returnBytes = new byte[8]; for (int i = 0; i < returnBytes.Length; i++) { returnBytes[i] = (byte)(newNonceBytes[i] ^ serverNonceBytes[i]); } return returnBytes; } private static byte[] ComposeBeginAuthRequest() { byte[] res_pq = { 0x60, 0x46, 0x97, 0x78 }; var randomNumber = new byte[16]; var random = new Random(); random.NextBytes(randomNumber); return res_pq.Reverse() .Concat(randomNumber).ToArray(); } static byte[] CreatePlainMessageBody(byte[] data) { byte[] authKeyId = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var now = DateTime.Now; var fullTimeBytes = BitConverter.GetBytes((long)Utils.DateTimeToUnixTimestamp(now)); var unixTime = (long)Utils.DateTimeToUnixTimestamp(now) << 32; byte[] date = //{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; BitConverter.GetBytes(unixTime); var messageBodyLength = BitConverter.GetBytes(data.Length); return authKeyId .Concat(date) .Concat(messageBodyLength) .Concat(data).ToArray(); } // return big-endian authKey public static byte[] GetAuthKey(byte[] bBytes, byte[] g_aData, byte[] dhPrimeData) { int position = 0; var b = new BigInteger(bBytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var dhPrime = TLObject.GetObject(dhPrimeData, ref position).ToBigInteger(); position = 0; var g_a = TLObject.GetObject(g_aData, ref position).ToBigInteger(); var authKey = BigInteger.ModPow(g_a, b, dhPrime).ToByteArray(); // little endian + (may be) zero last byte //remove last zero byte if (authKey[authKey.Length - 1] == 0x00) { authKey = authKey.SubArray(0, authKey.Length - 1); } return authKey.Reverse().ToArray(); } // b - big endian bytes // g - serialized data // dhPrime - serialized data // returns big-endian G_B public static byte[] GetG_B(byte[] bBytes, byte[] gData, byte[] dhPrimeData) { //var bBytes = new byte[256]; // big endian bytes //var random = new Random(); //random.NextBytes(bBytes); int position = 0; var g = new BigInteger(gData); var dhPrime = TLObject.GetObject(dhPrimeData, ref position).ToBigInteger(); var b = new BigInteger(bBytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var g_b = BigInteger.ModPow(g, b, dhPrime).ToByteArray(); // little endian + (may be) zero last byte //remove last zero byte if (g_b[g_b.Length - 1] == 0x00) { g_b = g_b.SubArray(0, g_b.Length - 1); } return g_b.Reverse().ToArray(); } public static Tuple GetAesKeyIV(byte[] serverNonce, byte[] newNonce) { SHA1 sha = new SHA1Managed(); var newNonceServerNonce = newNonce.Concat(serverNonce).ToArray(); var serverNonceNewNonce = serverNonce.Concat(newNonce).ToArray(); var key = sha.ComputeHash(newNonceServerNonce) .Concat(sha.ComputeHash(serverNonceNewNonce).SubArray(0, 12)); var im = sha.ComputeHash(serverNonceNewNonce).SubArray(12, 8) .Concat(sha.ComputeHash(newNonce.Concat(newNonce).ToArray())) .Concat(newNonce.SubArray(0, 4)); return new Tuple(key.ToArray(), im.ToArray()); } // encryptedData - big-endian number private static byte[] ComposeBeginDHRequest(AuthResponse response, UInt64 p, UInt64 q, byte[] encryptedData) { //TLUtils.WriteLine("---------------------------------"); //TLUtils.WriteLine("Begin DH"); //TLUtils.WriteLine("---------------------------------"); var req_DH_params = new byte[] { 0xd7, 0x12, 0xe4, 0xbe }; var nonce = response.Nonce; //TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(response.Nonce)); var serverNonce = response.ServerNonce; //TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(response.ServerNonce)); var pBytes = TLString.FromUInt64(p).ToBytes(); // 8 //TLUtils.WriteLine("p: " + BitConverter.ToString(pBytes)); var qBytes = TLString.FromUInt64(q).ToBytes(); // 8 //TLUtils.WriteLine("q: " + BitConverter.ToString(qBytes)); var fingerPrints = response.FingerPrints; //TLUtils.WriteLine("FingerPrints: " + BitConverter.ToString(response.FingerPrints)); var encryptedDataBytes = new byte[] { 0xFE, 0x00, 0x01, 0x00 }.Concat(encryptedData).ToArray(); //TLUtils.WriteLine("encryptedDataBytes: " + BitConverter.ToString(encryptedDataBytes)); return req_DH_params.Reverse() .Concat(nonce) .Concat(serverNonce) .Concat(pBytes) .Concat(qBytes) .Concat(fingerPrints) .Concat(encryptedDataBytes).ToArray(); } private static byte[] ComposeRequestSetClientDHParams(AuthResponse response, byte[] encryptedData) { //TLUtils.WriteLine("----Compose SetClientDHParams-------------"); var set_client_DH_params = new byte[] { 0x1f, 0x5f, 0x04, 0xf5 }; //TLUtils.WriteLine("set_client_DH_params " + BitConverter.ToString(set_client_DH_params)); var nonce = response.Nonce; //TLUtils.WriteLine("Nonce " + BitConverter.ToString(nonce)); var serverNonce = response.ServerNonce; //TLUtils.WriteLine("Server nonce " + BitConverter.ToString(serverNonce)); var encryptedDataStr = TLString.FromBigEndianData(encryptedData); //TLUtils.WriteLine("encrypted data serialized"); //TLUtils.WriteLine(BitConverter.ToString(encryptedDataStr.ToBytes(340))); return set_client_DH_params .Concat(nonce) .Concat(serverNonce) .Concat(encryptedDataStr.ToBytes()) // 340 .ToArray(); } public static byte[] ComposeClientDHInnerData(byte[] g_bBigEndianBytes, AuthResponse response) { //TLUtils.WriteLine("----Compose ClientDHInnerData-------------"); var client_DH_inner_data = new byte[] { 0x54, 0xb6, 0x43, 0x66 }; //TLUtils.WriteLine("client_DH_inner_data " + BitConverter.ToString(client_DH_inner_data)); var nonce = response.Nonce; //TLUtils.WriteLine("Nonce " + BitConverter.ToString(nonce)); var serverNonce = response.ServerNonce; //TLUtils.WriteLine("Server nonce " + BitConverter.ToString(serverNonce)); Int64 retryId = 0; var retryIdBytes = BitConverter.GetBytes(retryId); //TLUtils.WriteLine("Retry id " + BitConverter.ToString(retryIdBytes)); var strG_b = TLString.FromBigEndianData(g_bBigEndianBytes); //TLUtils.WriteLine("g_b serialized"); //TLUtils.WriteLine(BitConverter.ToString(strG_b.ToBytes(260))); return client_DH_inner_data .Concat(nonce) .Concat(serverNonce) .Concat(retryIdBytes) .Concat(strG_b.ToBytes()).ToArray(); // 260 } private static byte[] GetRSABytes(byte[] bytes) { // big-endian exponent and modulus const string exponentString = "010001"; const string modulusString = "C150023E2F70DB7985DED064759CFECF" + "0AF328E69A41DAF4D6F01B538135A6F91F8F8B2A0EC9BA9720CE352EFCF6C5680FFC424BD6348649" + "02DE0B4BD6D49F4E580230E3AE97D95C8B19442B3C0A10D8F5633FECEDD6926A7F6DAB0DDB7D457F" + "9EA81B8465FCD6FFFEED114011DF91C059CAEDAF97625F6C96ECC74725556934EF781D866B34F011" + "FCE4D835A090196E9A5F0E4449AF7EB697DDB9076494CA5F81104A305B6DD27665722C46B60E5DF6" + "80FB16B210607EF217652E60236C255F6A28315F4083A96791D7214BF64C1DF4FD0DB1944FB26A2A" + "57031B32EEE64AD15A8BA68885CDE74A5BFC920F6ABF59BA5C75506373E7130F9042DA922179251F"; var modulusBytes = Utils.StringToByteArray(modulusString); var exponentBytes = Utils.StringToByteArray(exponentString); var modulus = new BigInteger(modulusBytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var exponent = new BigInteger(exponentBytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var num = new BigInteger(bytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var rsa = BigInteger.ModPow(num, exponent, modulus).ToByteArray().Reverse().ToArray(); if (rsa.Length == 257) { if (rsa[0] != 0x00) throw new Exception("rsa last byte is " + rsa[0]); TLUtils.WriteLine("First RSA byte removes: byte value is " + rsa[0]); rsa = rsa.SubArray(1, 256); } return rsa; } public static byte[] ComposeData(AuthResponse response, UInt64 p, UInt64 q, byte[] newNonce) { var pqInnerData = new byte[] { 0x83, 0xc9, 0x5a, 0xec }; var pq = response.pqString.ToBytes(); //12 var pBytes = TLString.FromUInt64(p).ToBytes(); //8 var qBytes = TLString.FromUInt64(q).ToBytes(); //8 var nonce = response.Nonce; var serverNonce = response.ServerNonce; return pqInnerData.Reverse().ToArray() .Concat(pq).ToArray() .Concat(pBytes).ToArray() .Concat(qBytes).ToArray() .Concat(nonce).ToArray() .Concat(serverNonce).ToArray() .Concat(newNonce).ToArray(); } } public class AuthResponse { public byte[] AuthKeyId { get; set; } public byte[] MessageId { get; set; } public Int32 MessageLength { get; set; } public byte[] Nonce { get; set; } public byte[] ServerNonce { get; set; } public byte[] FingerPrints { get; set; } public UInt64 pq { get; set; } public TLString pqString { get; set; } public static AuthResponse Parse(byte[] bytes) { var response = new AuthResponse(); response.AuthKeyId = bytes.SubArray(0, 8); //TLUtils.WriteLine("AuthKeyId: " + BitConverter.ToString(response.AuthKeyId)); response.MessageId = bytes.SubArray(8, 8); var unixTime = BitConverter.ToInt64(response.MessageId, 0) >> 32; //var serverDate = Utils.UnixTimestampToDateTime(unixTime); //TLUtils.WriteLine("Server time: " + serverDate); //TLUtils.WriteLine("MessageId: " + BitConverter.ToString(response.MessageId)); response.MessageLength = BitConverter.ToInt32(bytes.SubArray(16, 4), 0); //TLUtils.WriteLine("MessageLength: " + response.MessageLength); response.Nonce = bytes.SubArray(24, 16); //TLUtils.WriteLine("Nonce: " + BitConverter.ToString(response.Nonce)); response.ServerNonce = bytes.SubArray(40, 16); //TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(response.ServerNonce)); var pqBytes = //new byte[] { 0x08, 0x17, 0xED, 0x48, 0x94, 0x1A, 0x08, 0xF9, 0x81, 0x00, 0x00, 0x00 }; bytes.SubArray(56, 12); //TLUtils.WriteLine("pq bytes: " + BitConverter.ToString(pqBytes)); int position = 0; response.pqString = TLObject.GetObject(pqBytes, ref position); response.pq = BitConverter.ToUInt64(response.pqString.Data, 0); //TLUtils.WriteLine("pq: " + response.pq); response.FingerPrints = bytes.SubArray(76, 8); //TLUtils.WriteLine("FingerPrints: " + BitConverter.ToString(response.FingerPrints)); return response; } } internal class EndAuthResponse { public byte[] AuthKeyId { get; set; } public byte[] MessageId { get; set; } public Int32 MessageLength { get; set; } public byte[] Status { get; set; } public byte[] Nonce { get; set; } public byte[] ServerNonce { get; set; } public byte[] NewNonceSHA1 { get; set; } public static EndAuthResponse Parse(byte[] bytes) { TLUtils.WriteLine("----------------------------"); TLUtils.WriteLine("--Parse end auth response---"); TLUtils.WriteLine("----------------------------"); var response = new EndAuthResponse(); response.AuthKeyId = bytes.SubArray(0, 8); TLUtils.WriteLine("AuthKeyId: " + BitConverter.ToString(response.AuthKeyId)); response.MessageId = bytes.SubArray(8, 8); var unixTime = BitConverter.ToInt64(response.MessageId, 0) >> 32; var serverDate = Utils.UnixTimestampToDateTime(unixTime); TLUtils.WriteLine("Server time: " + serverDate); TLUtils.WriteLine(" MESSAGEID: " + BitConverter.ToString(response.MessageId)); response.MessageLength = BitConverter.ToInt32(bytes.SubArray(16, 4), 0); TLUtils.WriteLine("MessageLength: " + response.MessageLength); response.Status = bytes.SubArray(20, 4); TLUtils.WriteLine("Status " + BitConverter.ToString(response.Status)); TLUtils.WriteLine(string.Equals(BitConverter.ToString(response.Status), "34-f7-cb-3b", StringComparison.OrdinalIgnoreCase) ? "Auth OK" : "Auth Fail"); response.Nonce = bytes.SubArray(24, 16); TLUtils.WriteLine("Nonce: " + BitConverter.ToString(response.Nonce)); response.ServerNonce = bytes.SubArray(40, 16); TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(response.ServerNonce)); response.NewNonceSHA1 = bytes.SubArray(56, 16); TLUtils.WriteLine("NewNonceSHA1: " + BitConverter.ToString(response.NewNonceSHA1)); return response; } } internal class Answer { public byte[] Status { get; set; } public byte[] Nonce { get; set; } public byte[] ServerNonce { get; set; } public byte[] G { get; set; } public byte[] DHPrime { get; set; } public byte[] G_A { get; set; } public byte[] ServerTime { get; set; } public static Answer Parse(byte[] bytes) { //TLUtils.WriteLine("----------------------------"); //TLUtils.WriteLine("--Server_DH_inner_dat-------"); //TLUtils.WriteLine("----------------------------"); var answer = new Answer(); answer.Status = bytes.SubArray(0, 4); //TLUtils.WriteLine(string.Equals(BitConverter.ToString(answer.Status), "BA-0D-89-B5", // StringComparison.OrdinalIgnoreCase) // ? "Server_DH_inner_dat OK" // : "Server_DH_inner_dat Fail"); answer.Nonce = bytes.SubArray(4, 16); TLUtils.WriteLine("Nonce: " + BitConverter.ToString(answer.Nonce)); answer.ServerNonce = bytes.SubArray(20, 16); TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(answer.ServerNonce)); answer.G = bytes.SubArray(36, 4); //TLUtils.WriteLine("G: " + BitConverter.ToString(answer.G)); answer.DHPrime = bytes.SubArray(40, 260); //TLUtils.WriteLine("DHPrime: " + BitConverter.ToString(answer.DHPrime)); //TLUtils.WriteLine(); answer.G_A = bytes.SubArray(300, 260); //TLUtils.WriteLine("G_A: " + BitConverter.ToString(answer.DHPrime)); answer.ServerTime = bytes.SubArray(560, 4); var unixTime = BitConverter.ToInt32(answer.ServerTime, 0); var serverDate = Utils.UnixTimestampToDateTime(unixTime); //TLUtils.WriteLine("Server time: " + serverDate); return answer; } } internal class BeginDHResponse { public byte[] AuthKeyId { get; set; } public byte[] MessageId { get; set; } public Int32 MessageLength { get; set; } public byte[] Status { get; set; } public byte[] Nonce { get; set; } public byte[] ServerNonce { get; set; } public byte[] EncryptedAnswer { get; set; } public static BeginDHResponse Parse(byte[] bytes) { //TLUtils.WriteLine("----------------------------"); //TLUtils.WriteLine("--server_DH_params----------"); //TLUtils.WriteLine("----------------------------"); var response = new BeginDHResponse(); response.AuthKeyId = bytes.SubArray(0, 8); //TLUtils.WriteLine("AuthKeyId: " + BitConverter.ToString(response.AuthKeyId)); response.MessageId = bytes.SubArray(8, 8); var unixTime = BitConverter.ToInt64(response.MessageId, 0) >> 32; var serverDate = Utils.UnixTimestampToDateTime(unixTime); //TLUtils.WriteLine("Server time: " + serverDate); //TLUtils.WriteLine("MessageId: " + BitConverter.ToString(response.MessageId)); response.MessageLength = BitConverter.ToInt32(bytes.SubArray(16, 4), 0); //TLUtils.WriteLine("MessageLength: " + response.MessageLength); response.Status = bytes.SubArray(20, 4); //TLUtils.WriteLine(string.Equals(BitConverter.ToString(response.Status), "5c-07-e8-d0", // StringComparison.OrdinalIgnoreCase) // ? "DH Params OK" // : "DH Params Fail"); response.Nonce = bytes.SubArray(24, 16); //TLUtils.WriteLine("Nonce: " + BitConverter.ToString(response.Nonce)); response.ServerNonce = bytes.SubArray(40, 16); //TLUtils.WriteLine("ServerNonce: " + BitConverter.ToString(response.ServerNonce)); response.EncryptedAnswer = bytes.SubArray(60, 592); //TLUtils.WriteLine("EncryptedAnswer: "); //TLUtils.WriteLine(BitConverter.ToString(response.EncryptedAnswer)); return response; } }*/ } ================================================ FILE: Telegram.Api/Helpers/Execute.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Threading; #if WIN_RT using Windows.UI.Core; using Windows.UI.Popups; using System.Threading.Tasks; using Windows.System.Threading; #else using System.Windows; #endif using Telegram.Api.Extensions; using Telegram.Api.TL; namespace Telegram.Api.Helpers { public static class Execute { public static void BeginOnThreadPool(TimeSpan delay, Action action) { #if WIN_RT Task.Run(async () => { await Task.Delay(delay); try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #else ThreadPool.QueueUserWorkItem(state => { Thread.Sleep(delay); try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #endif } public static void BeginOnThreadPool(Action action) { #if WIN_RT Task.Run(() => { try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #else ThreadPool.QueueUserWorkItem(state => { try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #endif } public static void BeginOnUIThread(Action action) { #if WIN_RT var coreWindow = CoreWindow.GetForCurrentThread(); if (coreWindow == null) return; var dispatcher = coreWindow.Dispatcher; if (dispatcher == null) return; dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #else Deployment.Current.Dispatcher.BeginInvoke(() => { try { action.SafeInvoke(); } catch (Exception ex) { TLUtils.WriteException(ex); } }); #endif } public static void BeginOnUIThread(TimeSpan delay, Action action) { BeginOnThreadPool(delay, () => { BeginOnUIThread(action); }); } public static bool CheckAccess() { #if WIN_RT var coreWindow = CoreWindow.GetForCurrentThread(); if (coreWindow == null) return true; var dispatcher = coreWindow.Dispatcher; if (dispatcher == null) return true; return dispatcher.HasThreadAccess; #else return Deployment.Current.Dispatcher.CheckAccess(); #endif } public static void OnUIThread(Action action) { if (CheckAccess()) { action(); } else { var waitHandle = new ManualResetEvent(false); BeginOnUIThread((() => { action(); waitHandle.Set(); })); waitHandle.WaitOne(); } } public static void ShowMessageBox(string message) { #if SILVERLIGHT MessageBox.Show(message); #elif WIN_RT new MessageDialog(message).ShowAsync(); #else Console.WriteLine(message); #endif } public static bool IsForegroundApp { get; set; } public static void ShowDebugMessage(string message) { #if DEBUG if (!IsForegroundApp) return; BeginOnUIThread(() => ShowMessageBox(message)); #endif } } } ================================================ FILE: Telegram.Api/Helpers/FileUtils.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.Search; using Windows.Storage.Streams; using Telegram.Api.Aggregator; using Telegram.Api.Services.FileManager; #if WIN_RT using Windows.Storage.Streams; using Windows.Storage; #else using Microsoft.Phone.Shell; using System.IO.IsolatedStorage; using System.IO; #endif using Telegram.Api.TL; namespace Telegram.Api.Helpers { public static class FileUtils { public static async Task MergePartsToFileAsync(Func getPartName, IEnumerable parts, string fileName) { using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(fileName, CreationCollisionOption.ReplaceExisting)) { foreach (var part in parts) { var partFileName = getPartName(part); var partFile = await ApplicationData.Current.LocalFolder.GetFileAsync(partFileName); using (var partStream = await partFile.OpenStreamForReadAsync()) { // append var buffer = new byte[partStream.Length]; stream.Seek(0, SeekOrigin.End); await stream.WriteAsync(buffer, 0, buffer.Length); } await partFile.DeleteAsync(StorageDeleteOption.PermanentDelete); } } } public static void MergePartsToFile(Func getPartName, IEnumerable parts, string fileName) { #if WINDOWS_PHONE using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { using (var stream = new IsolatedStorageFileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, store)) { foreach (var part in parts) { var partFileName = getPartName(part); using (var partStream = new IsolatedStorageFileStream(partFileName, FileMode.OpenOrCreate, FileAccess.Read, store)) { var bytes = new byte[partStream.Length]; partStream.Read(bytes, 0, bytes.Length); stream.Position = stream.Length; stream.Write(bytes, 0, bytes.Length); } store.DeleteFile(partFileName); } } } else { foreach (var part in parts) { var partFileName = getPartName(part); if (store.FileExists(partFileName)) { store.DeleteFile(partFileName); } } } } #else MergePartsToFileAsync(getPartName, parts, fileName).RunSynchronously(); #endif } public static bool Delete(object syncRoot, string fileName) { try { lock (syncRoot) { #if WIN_RT var getFileOperation = ApplicationData.Current.LocalFolder.GetFileAsync(fileName); getFileOperation.AsTask().Wait(); var file = getFileOperation.GetResults(); Delete(file); #elif WINDOWS_PHONE var storage = IsolatedStorageFile.GetUserStoreForApplication(); if (storage.FileExists(fileName)) { storage.DeleteFile(fileName); } #endif } return true; } catch (Exception e) { TLUtils.WriteLine("FILE ERROR: cannot delete " + fileName, LogSeverity.Error); TLUtils.WriteException(e); } return false; } public static void Copy(object syncRoot, string fileName, string destinationFileName) { try { lock (syncRoot) { #if WIN_RT var getFileOperation = ApplicationData.Current.LocalFolder.GetFileAsync(fileName); getFileOperation.AsTask().Wait(); var file = getFileOperation.GetResults(); var copyFileOperation = file.CopyAsync(ApplicationData.Current.LocalFolder, destinationFileName, NameCollisionOption.ReplaceExisting); copyFileOperation.AsTask().Wait(); var destinationFile = copyFileOperation.GetResults(); #elif WINDOWS_PHONE var file = IsolatedStorageFile.GetUserStoreForApplication(); file.CopyFile(fileName, destinationFileName, true); #endif } } catch (Exception e) { TLUtils.WriteLine("DB ERROR: cannot copy " + fileName, LogSeverity.Error); TLUtils.WriteException(e); } } public static void NotifyProgress(object itemsSyncRoot, IList items, UploadablePart part, ITelegramEventAggregator eventAggregator) { bool isComplete = false; bool isCanceled; var progress = 0.0; lock (itemsSyncRoot) { part.Status = PartStatus.Processed; isCanceled = part.ParentItem.Canceled; if (!isCanceled) { isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { double uploadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); double totalCount = part.ParentItem.Parts.Count; progress = uploadedCount / totalCount; } else { items.Remove(part.ParentItem); } } } if (!isCanceled) { if (isComplete) { SwitchIdleDetectionMode(true); Execute.BeginOnThreadPool(() => eventAggregator.Publish(part.ParentItem)); } else { if (part.ParentItem.FileNotFound) { return; } var args = new UploadProgressChangedEventArgs(part.ParentItem, progress); Execute.BeginOnThreadPool(() => eventAggregator.Publish(args)); } } } public static void SwitchIdleDetectionMode(bool enabled) { #if WINDOWS_PHONE var mode = enabled ? IdleDetectionMode.Enabled : IdleDetectionMode.Disabled; try { PhoneApplicationService.Current.UserIdleDetectionMode = mode; } catch (Exception ex) { Execute.ShowDebugMessage("UploadVideoFileManager UserIdleDetectionMode=" + mode + Environment.NewLine + ex); } #endif } public static int GetChunkSize(long totalSize) { int chunkSize = 32 * 1024; // 32Kb if (totalSize > 256 * 1024 * Constants.MaximumChunksCount) { chunkSize = 512 * 1024; } else if (totalSize > 128 * 1024 * Constants.MaximumChunksCount) { chunkSize = 256 * 1024; } else if (totalSize > 64 * 1024 * Constants.MaximumChunksCount) { chunkSize = 128 * 1024; } else if (totalSize > 32 * 1024 * Constants.MaximumChunksCount) { chunkSize = 64 * 1024; } return chunkSize; } public static int GetPartsCount(long totalSize, int chunkSize) { return (int)(totalSize / chunkSize + (totalSize % chunkSize > 0 ? 1 : 0)); } public static int GetLocalFileLength(string fileName) { #if WINDOWS_PHONE using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { using (var file = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { return (int)file.Length; } } } return -1; #else var file = GetLocalFile(fileName); if (file != null) { var getBasicPropertiesOperation = file.GetBasicPropertiesAsync(); getBasicPropertiesOperation.AsTask().Wait(); var basicProperties = getBasicPropertiesOperation.GetResults(); return (int)basicProperties.Size; } return -1; #endif } public static StorageFile GetLocalFile(string fileName) { StorageFile file = null; try { var getFileOperation = ApplicationData.Current.LocalFolder.GetFileAsync(fileName); getFileOperation.AsTask().Wait(); file = getFileOperation.GetResults(); } catch (Exception ex) { } return file; } private static StorageFile CreateLocalFile(string fileName) { var createFileOperation = ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); createFileOperation.AsTask().Wait(); var file = createFileOperation.GetResults(); return file; } private static void Delete(StorageFile file) { if (file != null) { var deleteFileOperation = file.DeleteAsync(); deleteFileOperation.AsTask().Wait(); deleteFileOperation.GetResults(); } } public static void CheckMissingPart(object syncRoot, DownloadablePart part, string partName) { #if WINDOWS_PHONE if (part.Offset.Value == 0) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(partName)) { store.DeleteFile(partName); } } } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(partName)) { store.DeleteFile(partName); } using (var stream = new IsolatedStorageFileStream(partName, FileMode.OpenOrCreate, FileAccess.Write, store)) { var data = part.File.Bytes.Data; part.File.Bytes = new TLString(); stream.Position = stream.Length; stream.Write(data, 0, data.Length); if (data.Length < part.Limit.Value && (part.Number + 1) != part.ParentItem.Parts.Count) { lock (syncRoot) { var complete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!complete) { var emptyBufferSize = part.Limit.Value - data.Length; var position = stream.Position; var missingPart = new DownloadablePart(part.ParentItem, new TLInt((int)position), new TLInt(emptyBufferSize), -part.Number); var currentItemIndex = part.ParentItem.Parts.IndexOf(part); part.ParentItem.Parts.Insert(currentItemIndex + 1, missingPart); } } } } } #else CheckMissingPartAsync(syncRoot, part, partName).RunSynchronously(); #endif } private static async Task CheckMissingPartAsync(object syncRoot, DownloadablePart part, string partName) { try { var file = await ApplicationData.Current.LocalFolder.GetFileAsync(partName); await file.DeleteAsync(StorageDeleteOption.PermanentDelete); } catch (Exception ex) { } using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(partName, CreationCollisionOption.ReplaceExisting)) { var data = part.File.Bytes.Data; part.File.Bytes = new TLString(); stream.Position = stream.Length; stream.Write(data, 0, data.Length); if (data.Length < part.Limit.Value && (part.Number + 1) != part.ParentItem.Parts.Count) { lock (syncRoot) { var complete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!complete) { var emptyBufferSize = part.Limit.Value - data.Length; var position = stream.Position; var missingPart = new DownloadablePart(part.ParentItem, new TLInt((int)position), new TLInt(emptyBufferSize), -part.Number); var currentItemIndex = part.ParentItem.Parts.IndexOf(part); part.ParentItem.Parts.Insert(currentItemIndex + 1, missingPart); } } } } } public static void WriteBytes(string fileName, byte[] bytes) { #if WINDOWS_PHONE using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var fileStream = store.OpenFile(fileName, FileMode.Create, FileAccess.Write)) { fileStream.Write(bytes, 0, bytes.Length); } } #else var file = CreateLocalFile(fileName); WriteBytes(file, bytes); #endif } #if WIN_RT private static void WriteBytes(StorageFile file, byte[] data) { var writeBytesOperation = FileIO.WriteBytesAsync(file, data); writeBytesOperation.AsTask().Wait(); writeBytesOperation.GetResults(); } #endif public static byte[] ReadBytes(string fileName, long position, long length) { #if WINDOWS_PHONE byte[] bytes = null; using (var storage = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = storage.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Position = position; bytes = new byte[length]; stream.Read(bytes, 0, (int)length); } } return bytes; #else var file = GetLocalFile(fileName); return file != null? ReadBytesAsync(file, position, length).Result : null; #endif } private static async Task ReadBytesAsync(StorageFile file, long position, long length) { using (var fs = await file.OpenAsync(FileAccessMode.Read)) { using (var inStream = fs.GetInputStreamAt((ulong)position)) { using (var reader = new DataReader(inStream)) { await reader.LoadAsync((uint)length); var data = new byte[length]; reader.ReadBytes(data); reader.DetachStream(); return data; } } } } #if WP8 public static async Task> FillBuffer(IStorageFile file, UploadablePart part) { try { if (part.ParentItem.FileNotFound) { return new Tuple(false, null); } System.Diagnostics.Debug.WriteLine("FillBuffer part=" + part.FilePart); using (var inStream = await file.OpenSequentialReadAsync()) { using (var stream = inStream.AsStreamForRead()) //using (var inStream = stream.GetInputStreamAt((ulong) part.Position)) { stream.Seek(part.Position, SeekOrigin.Begin); var bytes = new byte[part.Count]; stream.Read(bytes, 0, bytes.Length); //using (var reader = new DataReader(inStream)) //{ // await reader.LoadAsync((uint) bytes.Length); // reader.ReadBytes(bytes); //} // encrypting part if (part.ParentItem.Key != null && part.ParentItem.IV != null) { var key = part.ParentItem.Key; var iv = part.FilePart.Value == 0 ? part.ParentItem.IV : part.IV; if (iv == null) { return new Tuple(true, null); } byte[] nextIV; var encryptedBytes = Utils.AesIge(bytes, key.Data, iv.Data, true, out nextIV); bytes = encryptedBytes; var nextPartId = part.FilePart.Value + 1; if (part.ParentItem.Parts.Count > nextPartId) { part.ParentItem.Parts[nextPartId].IV = TLString.FromBigEndianData(nextIV); } } return new Tuple(true, bytes); } } } catch (FileNotFoundException ex) { Logs.Log.Write(string.Format("FileUtils.FillBuffer bytes=null position={0} count={1} ex={2}", part.Position, part.Count, ex)); Execute.ShowDebugMessage("FillBuffer FileNotFoundException\n" + ex); return new Tuple(false, null); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("FillBuffer ex part=" + part.FilePart); Logs.Log.Write(string.Format("FileUtils.FillBuffer bytes=null position={0} count={1} ex={2}", part.Position, part.Count, ex)); Execute.ShowDebugMessage("FillBuffer Exception\n" + ex); return new Tuple(true, null); } } public static UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, StorageFile file) { return GetUploadableItem(fileId, owner, file, null, null); } public static UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, StorageFile file, TLString key, TLString iv) { var item = new UploadableItem(fileId, owner, file, key, iv); var task = file.GetBasicPropertiesAsync().AsTask(); task.Wait(); var propertie = task.Result; var size = propertie.Size; item.Parts = GetItemParts(item, (int)size); return item; } private static List GetItemParts(UploadableItem item, int size) { var chunkSize = GetChunkSize(size); var partsCount = GetPartsCount(size, chunkSize); var parts = new List(partsCount); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), i * chunkSize, Math.Min(chunkSize, (long)size - i * chunkSize)); parts.Add(part); } item.IsSmallFile = size < Constants.SmallFileMaxSize; // size < chunkSize; return parts; } #endif public static void Write(object syncRoot, string directoryName, string fileName, string str) { #if WINDOWS_PHONE lock (syncRoot) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.DirectoryExists(directoryName)) { store.CreateDirectory(directoryName); } using (var file = store.OpenFile(Path.Combine(directoryName, fileName), FileMode.Append)) { var bytes = Encoding.UTF8.GetBytes(str); file.Write(bytes, 0, bytes.Length); } } } #else lock (syncRoot) { var task = Task.Run(async () => await WriteAsync(directoryName, fileName, str)); task.Wait(); } #endif } private static async Task WriteAsync(string directoryName, string fileName, string str) { var logFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(directoryName, CreationCollisionOption.OpenIfExists); var logFile = await logFolder.CreateFileAsync(fileName, CreationCollisionOption.OpenIfExists); using (var stream = await logFile.OpenStreamForWriteAsync()) { // append var buffer = Encoding.UTF8.GetBytes(str); stream.Seek(0, SeekOrigin.End); await stream.WriteAsync(buffer, 0, buffer.Length); } } public static void Clear(object syncRoot, string directoryName) { #if WINDOWS_PHONE lock (syncRoot) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { var fileNames = store.GetFileNames(Path.Combine(directoryName, "*.txt")); foreach (var fileName in fileNames) { try { store.DeleteFile(Path.Combine(directoryName, fileName)); } catch (Exception ex) { TLUtils.WriteException(ex); } } } } #else lock (syncRoot) { ClearAsync(directoryName).RunSynchronously(); } #endif } private static async Task ClearAsync(string directoryName) { var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(directoryName, CreationCollisionOption.OpenIfExists); var files = await folder.GetFilesAsync(); foreach (var file in files) { try { await file.DeleteAsync(StorageDeleteOption.PermanentDelete); } catch (Exception ex) { TLUtils.WriteException(ex); } } } public static void CopyLog(object syncRoot, string fromDirectoryName, string fromFileName, string toFileName, bool isEnabled) { #if WINDOWS_PHONE lock (syncRoot) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(Path.Combine(fromDirectoryName, fromFileName))) { store.CopyFile(Path.Combine(fromDirectoryName, fromFileName), toFileName); } else { using (var file = store.OpenFile(toFileName, FileMode.Append)) { var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); var bytes = Encoding.UTF8.GetBytes(string.Format("{0} {1}{2}", timestamp, "Log.IsEnabled=" + isEnabled, Environment.NewLine)); file.Write(bytes, 0, bytes.Length); } } } } #else lock (syncRoot) { CopyLogAsync(syncRoot, fromDirectoryName, fromFileName, toFileName, isEnabled).RunSynchronously(); } #endif } private static async Task CopyLogAsync(object syncRoot, string fromDirectoryName, string fromFileName, string toFileName, bool isEnabled) { var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(fromDirectoryName, CreationCollisionOption.OpenIfExists); StorageFile logFile = null; try { logFile = await folder.GetFileAsync(fromFileName); } catch (Exception ex) { } if (logFile != null) { await logFile.CopyAsync(ApplicationData.Current.LocalFolder, toFileName); } else { var logFolder = ApplicationData.Current.LocalFolder; logFile = await logFolder.CreateFileAsync(toFileName); using (var stream = await logFile.OpenStreamForReadAsync()) { // append var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); var buffer = Encoding.UTF8.GetBytes(string.Format("{0} {1}{2}", timestamp, "Log.IsEnabled=" + isEnabled, Environment.NewLine)); stream.Seek(0, SeekOrigin.End); await stream.WriteAsync(buffer, 0, buffer.Length); } } } public static Stream GetLocalFileStreamForRead(string fileName) { #if WINDOWS_PHONE var store = IsolatedStorageFile.GetUserStoreForApplication(); return new IsolatedStorageFileStream(fileName, FileMode.OpenOrCreate, store); #else var openFileOperation = ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.OpenIfExists); openFileOperation.AsTask().Wait(); var file = openFileOperation.GetResults(); return file.OpenStreamForReadAsync().Result; #endif } public static Stream GetLocalFileStreamForWrite(string fileName) { #if WINDOWS_PHONE var store = IsolatedStorageFile.GetUserStoreForApplication(); return new IsolatedStorageFileStream(fileName, FileMode.Create, store); #else var openFileOperation = ApplicationData.Current.LocalFolder.CreateFileAsync(fileName, CreationCollisionOption.OpenIfExists); openFileOperation.AsTask().Wait(); var file = openFileOperation.GetResults(); return file.OpenStreamForWriteAsync().Result; #endif } public static void SaveWithTempFile(string fileName, T data) where T : TLObject { #if WINDOWS_PHONE using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { var tempFileName = fileName + ".temp"; using (var fileStream = new IsolatedStorageFileStream(tempFileName, FileMode.Create, store)) { data.ToStream(fileStream); } //var stopwatch = Stopwatch.StartNew(); store.CopyFile(tempFileName, fileName, true); //store.DeleteFile(fileName); //store.MoveFile(tempFileName, fileName); //store.DeleteFile(tempFileName); //WritePerformance("MoveFile time: " + stopwatch.Elapsed); } #else var tempFileName = fileName + ".temp"; var openFileOperation = ApplicationData.Current.LocalFolder.CreateFileAsync(tempFileName, CreationCollisionOption.OpenIfExists); openFileOperation.AsTask().Wait(); var tempFile = openFileOperation.GetResults(); using (var fileStream = tempFile.OpenStreamForWriteAsync().Result) { data.ToStream(fileStream); } var copyOperation = tempFile.CopyAsync(ApplicationData.Current.LocalFolder, fileName, NameCollisionOption.ReplaceExisting); copyOperation.AsTask().Wait(); copyOperation.GetResults(); #endif } } } ================================================ FILE: Telegram.Api/Helpers/IAuthorizationHelper.cs ================================================ using System; using Telegram.Api.TL; namespace Telegram.Api.Helpers { //public interface IAuthorizationHelper //{ // /// // /// Initializes and return authKey, salt and sessionId // /// // /// // Tuple Init(); // void InitAsync(Action> callback, Action faultCallback = null); //} } ================================================ FILE: Telegram.Api/Helpers/Notifications.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Helpers { public static class Notifications { private static readonly object _notificatonsSyncRoot = new object(); public static bool IsDisabled { get { var result = TLUtils.OpenObjectFromMTProtoFile(_notificatonsSyncRoot, Constants.DisableNotificationsFileName); return result != null; } } public static void Disable() { TLUtils.SaveObjectToMTProtoFile(_notificatonsSyncRoot, Constants.DisableNotificationsFileName, TLBool.True); } public static void Enable() { FileUtils.Delete(_notificatonsSyncRoot, Constants.DisableNotificationsFileName); } } } ================================================ FILE: Telegram.Api/Helpers/PhoneHelper.cs ================================================ using System; using System.Collections.Generic; using System.Xml; #if WINDOWS_PHONE using Microsoft.Phone.Info; #endif namespace Telegram.Api.Helpers { public class PhoneHelper { const string AppManifestName = "WMAppManifest.xml"; const string AppNodeName = "App"; public const string AppVersion = "Version"; public static bool IsLowMemoryDevice() { #if WINDOWS_PHONE try { var result = (long)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit"); if (result < 94371840L) { return true; } return false; } catch (ArgumentOutOfRangeException) { // The device does not support querying for this value. This occurs // on Windows Phone OS 7.1 and older phones without OS updates. return true; } #else return false; #endif } public static string GetOSVersion() { #if WINDOWS_PHONE return Environment.OSVersion.Version.ToString(); #else return "TestWinRT"; #endif } public static string GetAppVersion() { return GetAppAttribute(AppVersion); } /// /// Gets the value from the WMAppManifest in runtime /// Example: PhoneHelper.GetAppAttribute("Title"); /// /// http://stackoverflow.com/questions/3411377/get-the-windows-phone-7-application-title-from-code /// /// /// public static string GetAppAttribute(string attributeName) { #if WINDOWS_PHONE try { var settings = new XmlReaderSettings { XmlResolver = new XmlXapResolver() }; using (var rdr = XmlReader.Create(AppManifestName, settings)) { rdr.ReadToDescendant(AppNodeName); if (!rdr.IsStartElement()) { throw new FormatException(AppManifestName + " is missing " + AppNodeName); } return rdr.GetAttribute(attributeName); } } catch (Exception) { return ""; } #else return "TestWinRT"; #endif } public static string GetDeviceFullName() { #if WINDOWS_PHONE return (string)DeviceExtendedProperties.GetValue("DeviceName"); #else return "TestWinRT"; #endif } public static bool IsWiFiEnabled() { #if WINDOWS_PHONE return Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsWiFiEnabled; #else return true; #endif } public static bool IsCellularDataEnabled() { #if WINDOWS_PHONE return Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsCellularDataEnabled; #else return true; #endif } public static string GetShortPhoneModel(string phoneCode) { var cleanCode = phoneCode.Replace("-", string.Empty).ToLowerInvariant(); foreach (var model in _models) { if (cleanCode.StartsWith(model.Key)) { return model.Value; } } return string.Empty; } private static Dictionary _models = new Dictionary { {"rm923", "Lumia505"}, {"rm898", "Lumia510"}, {"rm889", "Lumia510"}, {"rm915", "Lumia520"}, {"rm917", "Lumia521"}, {"rm998", "Lumia525"}, {"rm997", "Lumia526"}, {"rm1017", "Lumia530"}, {"rm1018", "Lumia530"}, {"rm1019", "Lumia530"}, {"rm1020", "Lumia530"}, {"rm1090", "Lumia535"}, {"rm836", "Lumia610"}, {"rm849", "Lumia610"}, {"rm846", "Lumia620"}, {"rm941", "Lumia625"}, {"rm942", "Lumia625"}, {"rm943", "Lumia625"}, {"rm974", "Lumia630"}, {"rm976", "Lumia630"}, {"rm977", "Lumia630"}, {"rm978", "Lumia630"}, {"rm975", "Lumia635"}, {"rm803", "Lumia710"}, {"rm809", "Lumia710"}, {"rm885", "Lumia720"}, {"rm887", "Lumia720"}, {"rm1038", "Lumia730"}, {"rm801", "Lumia800"}, {"rm802", "Lumia800"}, {"rm819", "Lumia800"}, {"rm878", "Lumia810"}, {"rm824", "Lumia820"}, {"rm825", "Lumia820"}, {"rm826", "Lumia820"}, {"rm845", "Lumia822"}, {"rm983", "Lumia830"}, {"rm984", "Lumia830"}, {"rm985", "Lumia830"}, {"rm808", "Lumia900"}, {"rm823", "Lumia900"}, {"rm820", "Lumia920"}, {"rm821", "Lumia920"}, {"rm822", "Lumia920"}, {"rm867", "Lumia920"}, {"rm892", "Lumia925"}, {"rm893", "Lumia925"}, {"rm910", "Lumia925"}, {"rm955", "Lumia925"}, {"rm860", "Lumia928"}, {"rm1045", "Lumia930"}, {"rm875", "Lumia1020"}, {"rm876", "Lumia1020"}, {"rm877", "Lumia1020"}, {"rm994", "Lumia1320"}, {"rm995", "Lumia1320"}, {"rm996", "Lumia1320"}, {"rm937", "Lumia1520"}, {"rm938", "Lumia1520"}, {"rm939", "Lumia1520"}, {"rm940", "Lumia1520"}, {"rm927", "LumiaIcon"}, }; } } ================================================ FILE: Telegram.Api/Helpers/RequestHelper.cs ================================================ using System; using System.Linq; using System.Security.Cryptography; using Telegram.Api.Services; using Telegram.Api.TL; using Telegram.Api.Transport; namespace Telegram.Api.Helpers { class RequestHelper { private readonly ITransport _transport; public RequestHelper(ITransport transport) { _transport = transport; } public TLResponse Send(string caption, int seqNo, Func getData) { var authKey = MTProtoService.AuthKey; var salt = MTProtoService.Salt; var sessionId = MTProtoService.SessionId; TLUtils.WriteLine(); TLUtils.WriteLine("------------------------"); TLUtils.WriteLine(String.Format("--{0}--", caption)); TLUtils.WriteLine("------------------------"); SHA1 sha = new SHA1Managed(); var random = new Random(); var request = getData(); TLUtils.WriteLine("Salt: " + salt); TLUtils.WriteLine("SessionId: " + sessionId); var messageId = TLUtils.GenerateMessageId(); TLUtils.WriteLine("->MESSAGEID: " + TLUtils.MessageIdString(messageId)); TLUtils.WriteLine(" SEQUENCENUMBER: " + seqNo); //var seqNo = BitConverter.GetBytes(3); var data = salt.ToBytes() .Concat(sessionId.ToBytes()) .Concat(messageId.ToBytes()) .Concat(BitConverter.GetBytes(seqNo)) .Concat(BitConverter.GetBytes(request.Length)) .Concat(request) .ToArray(); var length = data.Length; var padding = 16 - (length % 16); byte[] paddingBytes = null; if (padding > 0 && padding < 16) { paddingBytes = new byte[padding]; random.NextBytes(paddingBytes); } byte[] dataWithPadding = data; if (paddingBytes != null) { dataWithPadding = data.Concat(paddingBytes).ToArray(); } var msgKey = TLUtils.GetMsgKey(data); var keyIV = Utils.GetEncryptKeyIV(authKey, msgKey); var encryptedData = Utils.AesIge(dataWithPadding, keyIV.Item1, keyIV.Item2, true); //TLUtils.WriteLine("--Compute auth key sha1--"); var authKeyHash = sha.ComputeHash(authKey); var authKeyId = authKeyHash.SubArray(12, 8); //TLUtils.WriteLine("Auth key sha1: " + BitConverter.ToString(authKeyHash)); //TLUtils.WriteLine("Auth key little 8 bytes: " + BitConverter.ToString(authKeyId)); //TLUtils.WriteLine("--Check phone request--"); var reqBytes = authKeyId.Concat(msgKey).Concat(encryptedData).ToArray(); return null; // var buffer = _transport.SendBytes(reqBytes); //TLUtils.WriteLine("Buffer:"); //TLUtils.WriteLine(BitConverter.ToString(buffer)); //Console.ReadKey(); //return TLResponse.Parse(buffer, authKey); } } } ================================================ FILE: Telegram.Api/Helpers/SettingsHelper.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Xml; using Telegram.Api; using Telegram.Api.TL; #if WINDOWS_PHONE using System.Windows; using System.IO.IsolatedStorage; #else using System.Threading.Tasks; using TelegramClient.ViewModels.Additional; using Windows.UI.Xaml; using Windows.Storage; #endif namespace Telegram.Api.Helpers { #if WINDOWS_PHONE public static class SettingsHelper { private static readonly object SyncLock = new object(); public static void CrossThreadAccess(Action action) { lock (SyncLock) { try { action(IsolatedStorageSettings.ApplicationSettings); } catch (Exception e) { Execute.ShowDebugMessage("SettingsHelper.CrossThreadAccess" + e); } } } public static T GetValue(string key) { T result; lock (SyncLock) // critical for wp7 devices { try { if (IsolatedStorageSettings.ApplicationSettings.TryGetValue(key, out result)) { return result; } result = default(T); } catch (Exception e) { Logs.Log.Write("SettingsHelper.GetValue " + e); result = default(T); } } return result; } public static object GetValue(string key) { object result; lock (SyncLock) //critical for wp7 devices { try { if (IsolatedStorageSettings.ApplicationSettings.TryGetValue(key, out result)) { return result; } result = null; } catch (Exception e) { Logs.Log.Write("SettingsHelper.GetValue " + e); result = null; } } return result; } private static readonly object _backgroundTaskSettingsSyncRoot = new object(); public static void SetValue(string key, object value) { lock (SyncLock) { IsolatedStorageSettings.ApplicationSettings[key] = value; IsolatedStorageSettings.ApplicationSettings.Save(); //var backgroundSettings = new Dictionary(); //foreach (var settings in IsolatedStorageSettings.ApplicationSettings) //{ // if (settings.Value.GetType().Assembly.GetName().Name != "Telegram.Api") // { // continue; // } // backgroundSettings[settings.Key] = settings.Value; //} //SaveBackgroundSettingsAsync(_backgroundTaskSettingsSyncRoot, Constants.BackgroundTaskSettingsFileName, backgroundSettings); } } private static void SaveBackgroundSettingsAsync(object syncRoot, string fileName, Dictionary settings) { Execute.BeginOnThreadPool(() => { TLUtils.SaveObjectToFile(syncRoot, fileName, settings); }); } public static void RemoveValue(string key) { lock (SyncLock) { IsolatedStorageSettings.ApplicationSettings.Remove(key); } } } #elif WIN_RT public static class SettingsHelper { private static readonly object SyncLock = new object(); public static void CrossThreadAccess(Action> action) { lock (SyncLock) { try { action(LocalSettings); } catch (Exception e) { Execute.ShowDebugMessage("SettingsHelper.CrossThreadAccess" + e); } } } public static T GetValue(string key) { object result; lock (SyncLock) // critical for wp7 devices { try { if (LocalSettings.TryGetValue(key, out result)) { return (T)result; } result = default(T); } catch (Exception e) { Logs.Log.Write("SettingsHelper.GetValue " + e); result = default(T); } } return (T)result; } public static object GetValue(string key) { object result; lock (SyncLock) //critical for wp7 devices { try { if (LocalSettings.TryGetValue(key, out result)) { return result; } result = null; } catch (Exception e) { Logs.Log.Write("SettingsHelper.GetValue " + e); result = null; } } return result; } public static void SetValue(string key, object value) { lock (SyncLock) { LocalSettings[key] = value; } } public static void RemoveValue(string key) { lock (SyncLock) { LocalSettings.Remove(key); } } private static Dictionary _settings; public static Dictionary LocalSettings { get { if (_settings == null) { _settings = GetValuesAsync().Result; } return _settings; } } public static async Task> GetValuesAsync() { try { using (var fileStream = await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("__ApplicationSettings")) { //var stringReader = new StreamReader(fileStream); //var str = stringReader.ReadToEnd(); using (var streamReader = new StreamReader(fileStream)) { var line = streamReader.ReadLine() ?? string.Empty; var knownTypes = line.Split('\0') .Where(x => !string.IsNullOrEmpty(x)) .Select(Type.GetType) .ToList(); ReplaceNonPclTypes(knownTypes); fileStream.Position = line.Length + Environment.NewLine.Length; var serializer = new DataContractSerializer(typeof(Dictionary), knownTypes); return (Dictionary)serializer.ReadObject(fileStream); } } } catch(Exception ex) { Logs.Log.Write("SettingsHelper.GetValuesAsync exception " + ex); return new Dictionary(); } } private static void ReplaceNonPclTypes(List knownTypes) { for (var i = 0; i < knownTypes.Count; i++) { if (knownTypes[i].Name == typeof(TLConfig82).Name) { knownTypes[i] = typeof(TLConfig82); } else if (knownTypes[i].Name == typeof(TLConfig78).Name) { knownTypes[i] = typeof(TLConfig78); } else if (knownTypes[i].Name == typeof(TLConfig76).Name) { knownTypes[i] = typeof(TLConfig76); } else if (knownTypes[i].Name == typeof(TLConfig72).Name) { knownTypes[i] = typeof(TLConfig72); } else if (knownTypes[i].Name == typeof(TLConfig71).Name) { knownTypes[i] = typeof(TLConfig71); } else if (knownTypes[i].Name == typeof(TLConfig67).Name) { knownTypes[i] = typeof(TLConfig67); } else if (knownTypes[i].Name == typeof(TLConfig63).Name) { knownTypes[i] = typeof(TLConfig63); } else if (knownTypes[i].Name == typeof(TLConfig61).Name) { knownTypes[i] = typeof(TLConfig61); } else if (knownTypes[i].Name == typeof(TLConfig60).Name) { knownTypes[i] = typeof(TLConfig60); } else if (knownTypes[i].Name == typeof(TLConfig55).Name) { knownTypes[i] = typeof(TLConfig55); } else if (knownTypes[i].Name == typeof(TLConfig54).Name) { knownTypes[i] = typeof(TLConfig54); } else if (knownTypes[i].Name == typeof(TLConfig52).Name) { knownTypes[i] = typeof(TLConfig52); } else if (knownTypes[i].Name == typeof(TLConfig48).Name) { knownTypes[i] = typeof(TLConfig48); } else if (knownTypes[i].Name == typeof(TLConfig44).Name) { knownTypes[i] = typeof(TLConfig44); } else if (knownTypes[i].Name == typeof(TLConfig41).Name) { knownTypes[i] = typeof(TLConfig41); } else if (knownTypes[i].Name == typeof(TLConfig28).Name) { knownTypes[i] = typeof(TLConfig28); } else if (knownTypes[i].Name == typeof(BackgroundItem).Name) { knownTypes[i] = typeof(BackgroundItem); } } } } #endif } #if WIN_RT namespace TelegramClient.ViewModels.Additional { public class BackgroundItem { } } #endif ================================================ FILE: Telegram.Api/Helpers/Utils.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Storage.Streams; using Org.BouncyCastle.OpenSsl; #if WINDOWS_PHONE using System.Threading; using System.Security.Cryptography; using System.Windows; #elif WIN_RT using Windows.Security.Cryptography; using System.Runtime.InteropServices.WindowsRuntime; #endif using System.Text; using Windows.Security.Cryptography.Core; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; using Telegram.Api.TL; using Buffer = System.Buffer; namespace Telegram.Api.Helpers { public class PollardRhoLong { public static long Gcd(long ths, long val) { if (val == 0) return Math.Abs(ths); if (ths == 0) return Math.Abs(val); long r; long u = ths; long v = val; while (v != 0) { r = u % v; u = v; v = r; } return u; } public static long Rho(long N) { var random = new Random(); long divisor; var bytes = new byte[8]; random.NextBytes(bytes); var c = BitConverter.ToInt64(bytes, 0); random.NextBytes(bytes); var x = BitConverter.ToInt64(bytes, 0); var xx = x; // check divisibility by 2 if (N % 2 == 0) return 2; do { x = (x * x % N + c) % N; xx = (xx * xx % N + c) % N; xx = (xx * xx % N + c) % N; divisor = Gcd(x - xx, N); } while (divisor == 1); return divisor; } } public class PollardRho { private static readonly BigInteger ZERO = new BigInteger("0"); private static readonly BigInteger ONE = new BigInteger("1"); private static readonly BigInteger TWO = new BigInteger("2"); private static readonly SecureRandom random = new SecureRandom(); public static BigInteger Rho(BigInteger N) { BigInteger divisor; var c = new BigInteger(N.BitLength, random); var x = new BigInteger(N.BitLength, random); var xx = x; // check divisibility by 2 if (N.Mod(TWO).CompareTo(ZERO) == 0) return TWO; do { x = x.Multiply(x).Mod(N).Add(c).Mod(N); xx = xx.Multiply(xx).Mod(N).Add(c).Mod(N); xx = xx.Multiply(xx).Mod(N).Add(c).Mod(N); divisor = x.Subtract(xx).Gcd(N); } while ((divisor.CompareTo(ONE)) == 0); return divisor; } public static WindowsPhone.Tuple Factor(BigInteger N) { var divisor = Rho(N); var divisor2 = N.Divide(divisor); return divisor.CompareTo(divisor2) > 0 ? new WindowsPhone.Tuple(divisor2, divisor) : new WindowsPhone.Tuple(divisor, divisor2); } } public static class Utils { #if !WIN_RT public static bool XapContentFileExists(string relativePath) { return Application.GetResourceStream(new Uri(relativePath, UriKind.Relative)) != null; } #endif public static long GetRSAFingerprint(string key) { using (var text = new StringReader(key)) { var reader = new PemReader(text); var parameter = reader.ReadObject() as RsaKeyParameters; if (parameter != null) { var modulus = parameter.Modulus.ToByteArray(); var exponent = parameter.Exponent.ToByteArray(); if (modulus.Length > 256) { var corrected = new byte[256]; Buffer.BlockCopy(modulus, modulus.Length - 256, corrected, 0, 256); modulus = corrected; } else if (modulus.Length < 256) { var corrected = new byte[256]; Buffer.BlockCopy(modulus, 0, corrected, 256 - modulus.Length, modulus.Length); for (int a = 0; a < 256 - modulus.Length; a++) { modulus[a] = 0; } modulus = corrected; } using (var stream = new MemoryStream()) { var modulusString = TLString.FromBigEndianData(modulus); var exponentString = TLString.FromBigEndianData(exponent); modulusString.ToStream(stream); exponentString.ToStream(stream); var hash = ComputeSHA1(stream.ToArray()); var fingerprint = (((ulong)hash[19]) << 56) | (((ulong)hash[18]) << 48) | (((ulong)hash[17]) << 40) | (((ulong)hash[16]) << 32) | (((ulong)hash[15]) << 24) | (((ulong)hash[14]) << 16) | (((ulong)hash[13]) << 8) | ((ulong)hash[12]); return (long)fingerprint; } } } return -1; } public static byte[] GetRSABytes(byte[] bytes, string key) { using (var text = new StringReader(key)) { var reader = new PemReader(text); var parameter = reader.ReadObject() as RsaKeyParameters; if (parameter != null) { var modulus = parameter.Modulus; var exponent = parameter.Exponent; var num = new BigInteger(TLUtils.Combine(new byte[] { 0x00 }, bytes)); var rsa = num.ModPow(exponent, modulus).ToByteArray(); #if LOG_REGISTRATION TLUtils.WriteLog("RSA bytes length " + rsa.Length); #endif if (rsa.Length == 257) { if (rsa[0] != 0x00) throw new Exception("rsa last byte is " + rsa[0]); #if LOG_REGISTRATION TLUtils.WriteLog("First RSA byte removes: byte value is " + rsa[0]); #endif rsa = rsa.SubArray(1, 256); } else if (rsa.Length < 256) { var correctedRsa = new byte[256]; Array.Copy(rsa, 0, correctedRsa, 256 - rsa.Length, rsa.Length); for (var i = 0; i < 256 - rsa.Length; i++) { correctedRsa[i] = 0; #if LOG_REGISTRATION TLUtils.WriteLog("First RSA bytes added i=" + i + " " + correctedRsa[i]); #endif } rsa = correctedRsa; } return rsa; } } return null; } private static UInt64 GetP(UInt64 data) { var sqrt = (UInt64)Math.Sqrt(data); if (sqrt % 2 == 0) sqrt++; for (UInt64 i = sqrt; i >= 1; i = i - 2) { if (data % i == 0) return i; } return data; } public static WindowsPhone.Tuple GetPQ(UInt64 pq) { var p = GetP(pq); var q = pq / p; if (p > q) { var temp = p; p = q; q = temp; } return new WindowsPhone.Tuple(p, q); } public static WindowsPhone.Tuple GetPQPollard(UInt64 pq) { var n = new BigInteger(BitConverter.GetBytes(pq).Reverse().ToArray()); var result = PollardRho.Factor(n); return new WindowsPhone.Tuple((UInt64)result.Item1.LongValue, (UInt64)result.Item2.LongValue); } public static WindowsPhone.Tuple GetFastPQ(UInt64 pq) { var first = FastFactor((long)pq); var second = (long)pq / first; return first < second ? new WindowsPhone.Tuple((UInt64)first, (UInt64)second) : new WindowsPhone.Tuple((UInt64)second, (UInt64)first); } public static long GCD(long a, long b) { while (a != 0 && b != 0) { while ((b & 1) == 0) { b >>= 1; } while ((a & 1) == 0) { a >>= 1; } if (a > b) { a -= b; } else { b -= a; } } return b == 0 ? a : b; } public static long FastFactor(long what) { Random r = new Random(); long g = 0; int it = 0; for (int i = 0; i < 3; i++) { int q = (r.Next(128) & 15) + 17; long x = r.Next(1000000000) + 1, y = x; int lim = 1 << (i + 18); for (int j = 1; j < lim; j++) { ++it; long a = x, b = x, c = q; while (b != 0) { if ((b & 1) != 0) { c += a; if (c >= what) { c -= what; } } a += a; if (a >= what) { a -= what; } b >>= 1; } x = c; long z = x < y ? y - x : x - y; g = GCD(z, what); if (g != 1) { break; } if ((j & (j - 1)) == 0) { y = x; } } if (g > 1) { break; } } long p = what / g; return Math.Min(p, g); } private static byte[] XorArrays(byte[] first, byte[] second) { var bytes = new byte[16]; for (int i = 0; i < bytes.Length; i++) { bytes[i] = (byte)(first[i] ^ second[i]); } return bytes; } #if WINDOWS_PHONE || WIN_RT public static Stream AesIge(Stream data, byte[] key, byte[] iv, bool encrypt) { var cipher = CipherUtilities.GetCipher("AES/ECB/NOPADDING"); var param = new KeyParameter(key); cipher.Init(encrypt, param); var inData = data; var outStream = new MemoryStream(); var position = 0; byte[] xOld = new byte[16], yOld = new byte[16], x = new byte[16]; Array.Copy(iv, 0, encrypt ? yOld : xOld, 0, 16); Array.Copy(iv, 16, encrypt ? xOld : yOld, 0, 16); while (position < inData.Length) { long length; if ((position + 16) < inData.Length) { length = 16; } else { length = inData.Length - position; } inData.Read(x, 0, (int)length); //Array.Copy(inData, position, x, 0, length); var processedBytes = cipher.ProcessBytes(XorArrays(x, yOld)); byte[] y = XorArrays(processedBytes, xOld); xOld = (byte[])x.Clone(); //xOld = new byte[x.Length]; //Array.Copy(x, xOld, x.Length); yOld = y; outStream.Write(y, 0, y.Length); //outData = TLUtils.Combine(outData, y); position += 16; } return outStream; //return outData; } public static byte[] AesIge(byte[] data, byte[] key, byte[] iv, bool encrypt) { byte[] nextIV; return AesIge(data, key, iv, encrypt, out nextIV); } #if WIN_RT public static byte[] AesIgeWinRT(byte[] data, byte[] key, byte[] iv, bool encrypt) { byte[] nextIV; return AesIge2(data, key, iv, encrypt, out nextIV); } public static byte[] AesIge2(byte[] data, byte[] key, byte[] iv, bool encrypt, out byte[] nextIV) { var cipher = SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithmNames.AesEcb); var keyMaterial = CryptographicBuffer.CreateFromByteArray(key); var param = cipher.CreateSymmetricKey(keyMaterial); var inData = data; //var outData = new byte[]{}; var outStream = new MemoryStream(); var position = 0; byte[] xOld = new byte[16], yOld = new byte[16], x = new byte[16], y = new byte[16]; Array.Copy(iv, 0, encrypt ? yOld : xOld, 0, 16); Array.Copy(iv, 16, encrypt ? xOld : yOld, 0, 16); while (position < inData.Length) { int length; if ((position + 16) < inData.Length) { length = 16; } else { length = inData.Length - position; } Array.Copy(inData, position, x, 0, length); y = XorArrays(x, yOld); var processedBytes = encrypt ? CryptographicEngine.Encrypt(param, CryptographicBuffer.CreateFromByteArray(y), null) : CryptographicEngine.Decrypt(param, CryptographicBuffer.CreateFromByteArray(y), null); y = XorArrays(processedBytes.ToArray(), xOld); xOld = (byte[])x.Clone(); //xOld = new byte[x.Length]; //Array.Copy(x, xOld, x.Length); yOld = y; outStream.Write(y, 0, y.Length); //outData = TLUtils.Combine(outData, y); position += 16; } nextIV = encrypt ? TLUtils.Combine(yOld, xOld) : TLUtils.Combine(xOld, yOld); return outStream.ToArray(); //return outData; } #endif public static byte[] AesIge(byte[] data, byte[] key, byte[] iv, bool encrypt, out byte[] nextIV) { var cipher = CipherUtilities.GetCipher("AES/ECB/NOPADDING"); var param = new KeyParameter(key); cipher.Init(encrypt, param); var inData = data; //var outData = new byte[]{}; var outStream = new MemoryStream(); var position = 0; byte[] xOld = new byte[16], yOld = new byte[16], x = new byte[16]; Array.Copy(iv, 0, encrypt ? yOld : xOld, 0, 16); Array.Copy(iv, 16, encrypt ? xOld : yOld, 0, 16); while (position < inData.Length) { int length; if ((position + 16) < inData.Length) { length = 16; } else { length = inData.Length - position; } Array.Copy(inData, position, x, 0, length); var processedBytes = cipher.ProcessBytes(XorArrays(x, yOld)); byte[] y = XorArrays(processedBytes, xOld); xOld = (byte[])x.Clone(); //xOld = new byte[x.Length]; //Array.Copy(x, xOld, x.Length); yOld = y; outStream.Write(y, 0, y.Length); //outData = TLUtils.Combine(outData, y); position += 16; } nextIV = encrypt ? TLUtils.Combine(yOld, xOld) : TLUtils.Combine(xOld, yOld); return outStream.ToArray(); //return outData; } private static System.Numerics.BigInteger MaxIvec = new System.Numerics.BigInteger(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }); // Note: ivec - big-endian, but BigInterger.ctor and BigInteger.ToByteArray return little-endian public static byte[] AES_ctr128_encrypt(byte[] input, byte[] key, ref byte[] ivec, ref byte[] ecount_buf, ref uint num) { uint n; var output = new byte[input.Length]; n = num; var cipher = CipherUtilities.GetCipher("AES/ECB/NOPADDING"); var param = new KeyParameter(key); cipher.Init(true, param); for (uint i = 0; i < input.Length; i++) { if (n == 0) { ecount_buf = cipher.DoFinal(ivec); Array.Reverse(ivec); var bi = new System.Numerics.BigInteger(TLUtils.Combine(ivec, new byte[] { 0x00 })); bi = (bi + 1); var biArray = bi.ToByteArray(); var b = new byte[16]; Buffer.BlockCopy(biArray, 0, b, 0, Math.Min(b.Length, biArray.Length)); //System.Diagnostics.Debug.WriteLine(bi); Array.Reverse(b); ivec = b; } output[i] = (byte)(input[i] ^ ecount_buf[n]); n = (n + 1) % 16; } num = n; return output; } public static byte[] AES_ctr128_encrypt2(byte[] input, byte[] key, ref byte[] ivec, ref byte[] ecount_buf, ref uint num) { uint n; var output = new byte[input.Length]; n = num; var cipher = CipherUtilities.GetCipher("AES/ECB/NOPADDING"); var param = new KeyParameter(key); cipher.Init(true, param); for (uint i = 0; i < input.Length; i++) { if (n == 0) { ecount_buf = cipher.DoFinal(ivec); Array.Reverse(ivec); var bi = new System.Numerics.BigInteger(TLUtils.Combine(ivec, new byte[] { 0x00 })); bi = (bi + 1); var biArray = bi.ToByteArray(); var b = new byte[16]; Buffer.BlockCopy(biArray, 0, b, 0, Math.Min(b.Length, biArray.Length)); //System.Diagnostics.Debug.WriteLine(bi); Array.Reverse(b); ivec = b; } output[i] = (byte)(input[i] ^ ecount_buf[n]); n = (n + 1) % 16; } num = n; return output; } //public static byte[] AesCtr(byte[] data, byte[] key, byte[] iv, bool encrypt) //{ // var cipher = CipherUtilities.GetCipher("AES/CTR/NOPADDING"); // var keyIv = new ParametersWithIV(new KeyParameter(key), iv); // cipher.Init(encrypt, keyIv); // //cipher.Init(encrypt, new ParametersWithIV(ParameterUtilities.CreateKeyParameter("AES", key), iv)); // var outData = cipher.DoFinal(data); // if (outData.Length != data.Length) // { // Execute.ShowDebugMessage(string.Format("Utils.AesCtr outData.Length!=data.Length outData={0} data={1}", outData.Length, data.Length)); // } // return outData; //} #else public static byte[] AesIge(byte[] data, byte[] key, byte[] iv, bool encrypt) { throw new NotImplementedException(); } public static byte[] AesCtr(byte[] data, byte[] key, byte[] iv, bool encrypt) { var cipher = CipherUtilities.GetCipher("AES/CTR/NOPADDING"); cipher.Init(encrypt, new ParametersWithIV(ParameterUtilities.CreateKeyParameter("AES", key), iv)); var outData = cipher.DoFinal(data); if (outData.Length != data.Length) { Execute.ShowDebugMessage(string.Format("Utils.AesCtr outData.Length!=data.Length outData={0} data={1}", outData.Length, data.Length)); } return outData; } #endif public static byte[] StringToByteArray(String hex) { int NumberChars = hex.Length / 2; byte[] bytes = new byte[NumberChars]; StringReader sr = new StringReader(hex); for (int i = 0; i < NumberChars; i++) bytes[i] = Convert.ToByte(new string(new char[2] { (char)sr.Read(), (char)sr.Read() }), 16); sr.Dispose(); return bytes; } public static T[] SubArray(this T[] data, int index, int length) { if (index == 0 && length == data.Length) { return data; } var result = new T[length]; Array.Copy(data, index, result, 0, length); return result; } public static double DateTimeToUnixTimestamp(DateTime dateTime) { // From local DateTime to UTC0 UnixTime var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime.SpecifyKind(dtDateTime, DateTimeKind.Utc); return (dateTime.ToUniversalTime() - dtDateTime).TotalSeconds; } public static DateTime UnixTimestampToDateTime(double unixTimeStamp) { // From UTC0 UnixTime to local DateTime var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0); DateTime.SpecifyKind(dtDateTime, DateTimeKind.Utc); dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime(); return dtDateTime; } public static byte[] ComputeSHA1(byte[] data) { #if WINDOWS_PHONE //var sha1 = new SHA1Managed(); // to avoid thread sync problems http://stackoverflow.com/questions/12644257/sha1managed-computehash-occasionally-different-on-different-servers //return sha1.ComputeHash(data); var sha1 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1); return sha1.HashData(data.AsBuffer()).ToArray(); #elif WIN_RT var sha1 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1); return sha1.HashData(data.AsBuffer()).ToArray(); #endif } public static byte[] ComputeSHA256(byte[] data) { #if WINDOWS_PHONE //var sha256 = new SHA256Managed(); // to avoid thread sync problems http://stackoverflow.com/questions/12644257/sha1managed-computehash-occasionally-different-on-different-servers //return sha256.ComputeHash(data); var sha256 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); return sha256.HashData(data.AsBuffer()).ToArray(); #elif WIN_RT var sha1 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256); return sha1.HashData(data.AsBuffer()).ToArray(); #endif } public static byte[] ComputeMD5(byte[] data) { #if WINDOWS_PHONE //var md5 = new MD5Managed(); //return md5.ComputeHash(data); var md5 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5); return md5.HashData(data.AsBuffer()).ToArray(); #elif WIN_RT var md5 = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Md5); return md5.HashData(data.AsBuffer()).ToArray(); #endif } public static byte[] ComputeCRC32(string data) { byte[] utf16Bytes = Encoding.Unicode.GetBytes(data); byte[] utf8Bytes = Encoding.Convert(Encoding.Unicode, Encoding.UTF8, utf16Bytes); return ComputeCRC32(utf8Bytes); } public static byte[] ComputeCRC32(byte[] data) { var crc = new CRC32(); var hash = crc.ComputeHash(data); return hash; } public static string CurrentUICulture() { #if WIN_RT return Windows.Globalization.Language.CurrentInputMethodLanguageTag; #elif WINDOWS_PHONE return Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; #endif } } } ================================================ FILE: Telegram.Api/Logs/Log.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Text; using System.Threading; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Execute = Telegram.Api.Helpers.Execute; namespace Telegram.Logs { public class Log { public static bool IsPrivateBeta { get { #if DEBUG return true; #endif #if WP81 return Windows.ApplicationModel.Package.Current.Id.Name == "TelegramMessengerLLP.TelegramMessengerPreview"; #endif return true; } } public static bool WriteSync { get; set; } public static bool IsEnabled { get { return IsPrivateBeta; } } public static void Write(string str, Action callback = null) { if (!IsEnabled) { return; } if (WriteSync) { WriteInternal(str, callback); } else { Execute.BeginOnThreadPool(() => { WriteInternal(str, callback); }); } } public static void SyncWrite(string str, Action callback = null) { if (!IsEnabled) { return; } //if (WriteSync) { WriteInternal(str, callback); } } private static readonly object _fileSyncRoot = new object(); private static void WriteInternal(string str, Action callback = null) { var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); str = string.Format("{0} {1}{2}", timestamp, str, Environment.NewLine); using (var mutex = new Mutex(false, "Telegram.Log")) { mutex.WaitOne(); FileUtils.Write(_fileSyncRoot, DirectoryName, FileName, str); mutex.ReleaseMutex(); } callback.SafeInvoke(); } private const string DirectoryName = "Logs"; public static string FileName { get { return DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt"; } } public static void CopyTo(string fileName, Action callback) { Execute.BeginOnThreadPool(() => { using (var mutex = new Mutex(false, "Telegram.Log")) { mutex.WaitOne(); FileUtils.CopyLog(_fileSyncRoot, DirectoryName, FileName, fileName, IsEnabled); mutex.ReleaseMutex(); } callback.SafeInvoke(fileName); }); } public static void Clear(Action callback) { Execute.BeginOnThreadPool(() => { using (var mutex = new Mutex(false, "Telegram.Log")) { mutex.WaitOne(); FileUtils.Clear(_fileSyncRoot, DirectoryName); mutex.ReleaseMutex(); } callback.SafeInvoke(); }); } } } ================================================ FILE: Telegram.Api/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Api")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Api")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("0c2f1b61-a8fe-45fb-8538-aa6925a415b6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")] ================================================ FILE: Telegram.Api/Services/Cache/Context.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; namespace Telegram.Api.Services.Cache { public class Context : Dictionary { public Context() { } public Context(IEnumerable items, Func keyFunc) { foreach (var item in items) { this[keyFunc(item)] = item; } } public new T this[long index] { get { T val; return TryGetValue(index, out val) ? val : default(T); } set { base[index] = value; } } } } ================================================ FILE: Telegram.Api/Services/Cache/EventArgs/DialogAddedEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.Cache.EventArgs { public class MessagesRemovedEventArgs { public TLDialogBase Dialog { get; protected set; } public IList Messages { get; protected set; } public TLDecryptedMessageBase DecryptedMessage { get; protected set; } public MessagesRemovedEventArgs(TLDialogBase dialog, TLMessageBase message) { Dialog = dialog; Messages = new List {message}; } public MessagesRemovedEventArgs(TLDialogBase dialog, IList messages) { Dialog = dialog; Messages = messages; } public MessagesRemovedEventArgs(TLDialogBase dialog, TLDecryptedMessageBase message) { Dialog = dialog; DecryptedMessage = message; } } public class DialogAddedEventArgs { public TLDialogBase Dialog { get; protected set; } public DialogAddedEventArgs(TLDialogBase dialog) { Dialog = dialog; } } public class DialogRemovedEventArgs { public TLDialogBase Dialog { get; protected set; } public DialogRemovedEventArgs(TLDialogBase dialog) { Dialog = dialog; } } public class ChannelAvailableMessagesEventArgs { public TLDialogBase Dialog { get; protected set; } public TLInt AvailableMinId { get; set; } public ChannelAvailableMessagesEventArgs(TLDialogBase dialog, TLInt availableMinId) { Dialog = dialog; AvailableMinId = availableMinId; } } } ================================================ FILE: Telegram.Api/Services/Cache/EventArgs/TopMessageUpdatedEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.Cache.EventArgs { public class TopMessageUpdatedEventArgs : System.EventArgs { public TLPeerBase Peer { get; protected set; } public TLDialogBase Dialog { get; protected set; } public TLMessageBase Message { get; protected set; } public TLDecryptedMessageBase DecryptedMessage { get; protected set; } public bool NotifyPinned { get; set; } public TopMessageUpdatedEventArgs(TLPeerBase peer) { Peer = peer; } public TopMessageUpdatedEventArgs(TLDialogBase dialog, TLMessageBase message) { Dialog = dialog; Message = message; } public TopMessageUpdatedEventArgs(TLDialogBase dialog, TLDecryptedMessageBase message) { Dialog = dialog; DecryptedMessage = message; } } } ================================================ FILE: Telegram.Api/Services/Cache/ICacheService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using Telegram.Api.TL; namespace Telegram.Api.Services.Cache { public interface ICacheService { ExceptionInfo LastSyncMessageException { get; } void ClearLocalFileNames(); void CompressAsync(Action callback); void Commit(); bool TryCommit(); void SaveSnapshot(string toDirectoryName); void SaveTempSnapshot(string toDirectoryName); void LoadSnapshot(string fromDirectoryName); //event EventHandler DialogAdded; //event EventHandler TopMessageUpdated; TLUserBase GetUser(TLInt id); TLUserBase GetUser(string username); TLUserBase GetUser(TLUserProfilePhoto photo); TLMessageBase GetMessage(TLInt id, TLInt channelId = null); TLMessageBase GetMessage(TLLong randomId); TLMessageBase GetMessage(TLWebPageBase webPage); TLDecryptedMessageBase GetDecryptedMessage(TLInt chatId, TLLong randomId); TLDialog GetDialog(TLMessageCommon message); TLDialog GetDialog(TLPeerBase peer); TLDialogBase GetEncryptedDialog(TLInt chatId); TLChat GetChat(TLChatPhoto chatPhoto); TLChannel GetChannel(string username); TLChannel GetChannel(TLChatPhoto channelPhoto); TLChatBase GetChat(TLInt id); TLBroadcastChat GetBroadcast(TLInt id); IList GetMessages(); IList GetSendingMessages(); IList GetResendingMessages(); void GetHistoryAsync(TLPeerBase peer, Action> callback, int limit = Constants.CachedMessagesCount); IList GetHistory(TLPeerBase peer, int limit = Constants.CachedMessagesCount); IList GetHistory(TLPeerBase peer, int maxId, int limit = Constants.CachedMessagesCount); //IList GetUnreadHistory(TLInt currentUserId, TLPeerBase peer, int limit = Constants.CachedMessagesCount); IList GetHistory(int dialogId); IList GetDecryptedHistory(int dialogId, int limit = Constants.CachedMessagesCount); IList GetDecryptedHistory(int dialogId, long randomId, int limit = Constants.CachedMessagesCount); IList GetUnreadDecryptedHistory(int dialogId); void GetDialogsAsync(Action> callback); IList GetDialogs(); void GetContactsAsync(Action> callback); List GetContacts(); List GetUsersForSearch(IList nonCachedDialogs); List GetUsers(); List GetChats(); void GetChatsAsync(Action> callback); void ClearAsync(Action callback = null); void SyncMessage(TLMessageBase message, Action callback); void SyncMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback); void SyncEditedMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback); void SyncSendingMessage(TLMessageCommon message, TLMessageBase previousMessage, Action callback); void SyncSendingMessages(IList messages, TLMessageBase previousMessage, Action> callback); void SyncSendingMessageId(TLLong randomId, TLInt id, Action callback); void SyncPeerMessages(TLPeerBase peer, TLMessagesBase messages, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback); void AddMessagesToContext(TLMessagesBase messages, Action callback); void SyncDialogs(Stopwatch stopwatch, TLDialogsBase dialogs, Action callback); void SyncProxyData(TLProxyDataBase proxyData, Action callback); void SyncChannelDialogs(TLDialogsBase dialogs, Action callback); void MergeMessagesAndChannels(TLDialogsBase dialogs); void SyncUser(TLUserBase user, Action callback); void SyncUser(TLUserFull userFull, Action callback); void SyncUsers(TLVector users, Action> callback); void AddUsers(TLVector users, Action> callback); void SyncUsersAndChats(TLVector users, TLVector chats, Action, TLVector>> callback); void SyncUserLink(TLLinkBase link, Action callback); void SyncContacts(TLContactsBase contacts, Action callback); void SyncContacts(TLImportedContacts contacts, Action callback); void ClearDialog(TLPeerBase peer); void DeleteDialog(TLDialogBase dialog); void DeleteMessages(TLVector ids); void DeleteChannelMessages(TLInt channelId, TLVector ids); void DeleteMessages(TLPeerBase peer, TLMessageBase lastItem, TLVector messages); void DeleteMessages(TLVector ids); void DeleteDecryptedMessages(TLVector ids); void ClearDecryptedHistoryAsync(TLInt chatId); void ClearBroadcastHistoryAsync(TLInt chatId); void SyncStatedMessage(TLStatedMessageBase statedMessage, Action callback); void SyncStatedMessages(TLStatedMessagesBase statedMessages, Action callback); void GetConfigAsync(Action config); TLConfig GetConfig(); void SetConfig(TLConfig config); void GetCdnConfigAsync(Action cdnConfig); TLCdnConfig GetCdnConfig(); void SetCdnCofig(TLCdnConfig cdnConfig); void ClearConfigImportAsync(); void SyncChat(TLMessagesChatFull messagesChatFull, Action callback); void AddChats(TLVector chats, Action> callback); void SyncBroadcast(TLBroadcastChat broadcast, Action callback); TLEncryptedChatBase GetEncryptedChat(TLInt id); void SyncEncryptedChat(TLEncryptedChatBase encryptedChat, Action callback); void SyncDecryptedMessage(TLDecryptedMessageBase message, TLEncryptedChatBase peer, Action callback); void SyncDecryptedMessages(IList> tuples, TLEncryptedChatBase peer, Action>> callback); void SyncSendingDecryptedMessage(TLInt chatId, TLInt date, TLLong randomId, Action callback); void Init(); void SyncDifference(TLDifference difference, Action result, IList exceptions); void SyncDifferenceWithoutUsersAndChats(TLDifference difference, Action result, IList exceptions); void SyncStatuses(TLVector contacts, Action> callback); void DeleteUser(TLInt id); void DeleteChat(TLInt id); void DeleteUserHistory(TLPeerChannel channel, TLPeerUser peer); void UpdateDialogPinned(TLPeerBase peer, bool pinned); void UpdatePinnedDialogs(TLVector order); void UpdateChannelAvailableMessages(TLInt channelId, TLInt availableMinId); void UpdateDialogPromo(TLDialogBase dialogBase, bool promo); TLProxyDataBase GetProxyData(); void UpdateProxyData(TLProxyDataBase proxyData); } public class ExceptionInfo { public Exception Exception { get; set; } public DateTime Timestamp { get; set; } public string Caption { get; set; } public override string ToString() { return string.Format("Caption={2}\nTimestamp={0}\nException={1}", Timestamp, Exception, Caption); } } } ================================================ FILE: Telegram.Api/Services/Cache/InMemoryCacheService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.Services.Cache.EventArgs; using Telegram.Api.Services.Updates; using Telegram.Api.TL; using Action = System.Action; namespace Telegram.Api.Services.Cache { public class MockupCacheService : ICacheService { public ExceptionInfo LastSyncMessageException { get; private set; } public void SyncProxyData(TLProxyDataBase proxyData, Action callback) { throw new NotImplementedException(); } public void ClearLocalFileNames() { } public void CompressAsync(Action callback) { callback.SafeInvoke(); } public void Commit() { } public bool TryCommit() { return true; } public void SaveSnapshot(string toDirectoryName) { } public void SaveTempSnapshot(string toDirectoryName) { } public void LoadSnapshot(string fromDirectoryName) { } public TLUserBase GetUser(TLInt id) { throw new NotImplementedException(); } public TLUserBase GetUser(string username) { throw new NotImplementedException(); } public TLUserBase GetUser(TLUserProfilePhoto photo) { throw new NotImplementedException(); } public TLMessageBase GetMessage(TLInt id, TLInt channelId = null) { throw new NotImplementedException(); } public TLMessageBase GetMessage(TLLong randomId) { throw new NotImplementedException(); } public TLMessageBase GetMessage(TLWebPageBase webPage) { throw new NotImplementedException(); } public TLDecryptedMessageBase GetDecryptedMessage(TLInt chatId, TLLong randomId) { throw new NotImplementedException(); } public TLDialog GetDialog(TLMessageCommon message) { throw new NotImplementedException(); } public TLDialog GetDialog(TLPeerBase peer) { throw new NotImplementedException(); } public TLDialogBase GetEncryptedDialog(TLInt chatId) { throw new NotImplementedException(); } public TLChat GetChat(TLChatPhoto chatPhoto) { throw new NotImplementedException(); } public TLChannel GetChannel(string username) { throw new NotImplementedException(); } public TLChannel GetChannel(TLChatPhoto channelPhoto) { throw new NotImplementedException(); } public TLChatBase GetChat(TLInt id) { throw new NotImplementedException(); } public TLBroadcastChat GetBroadcast(TLInt id) { throw new NotImplementedException(); } public IList GetMessages() { throw new NotImplementedException(); } public IList GetSendingMessages() { throw new NotImplementedException(); } public IList GetResendingMessages() { throw new NotImplementedException(); } public void GetHistoryAsync(TLPeerBase peer, Action> callback, int limit = Constants.CachedMessagesCount) { callback.SafeInvoke(null); } public IList GetHistory(TLPeerBase peer, int limit = Constants.CachedMessagesCount) { throw new NotImplementedException(); } public IList GetHistory(TLPeerBase peer, int maxId, int limit = Constants.CachedMessagesCount) { throw new NotImplementedException(); } public IList GetHistory(int dialogId) { throw new NotImplementedException(); } public IList GetDecryptedHistory(int dialogId, int limit = Constants.CachedMessagesCount) { throw new NotImplementedException(); } public IList GetDecryptedHistory(int dialogId, long randomId, int limit = Constants.CachedMessagesCount) { throw new NotImplementedException(); } public IList GetUnreadDecryptedHistory(int dialogId) { throw new NotImplementedException(); } public void GetDialogsAsync(Action> callback) { throw new NotImplementedException(); } public IList GetDialogs() { throw new NotImplementedException(); } public void GetContactsAsync(Action> callback) { throw new NotImplementedException(); } public List GetContacts() { throw new NotImplementedException(); } public List GetUsersForSearch(IList nonCachedDialogs) { throw new NotImplementedException(); } public List GetUsers() { throw new NotImplementedException(); } public List GetChats() { throw new NotImplementedException(); } public void GetChatsAsync(Action> callback) { throw new NotImplementedException(); } public void ClearAsync(Action callback = null) { throw new NotImplementedException(); } public void SyncMessage(TLMessageBase message, Action callback) { throw new NotImplementedException(); } public void SyncMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { throw new NotImplementedException(); } public void SyncEditedMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { throw new NotImplementedException(); } public void SyncSendingMessage(TLMessageCommon message, TLMessageBase previousMessage, Action callback) { throw new NotImplementedException(); } public void SyncSendingMessages(IList messages, TLMessageBase previousMessage, Action> callback) { throw new NotImplementedException(); } public void SyncSendingMessageId(TLLong randomId, TLInt id, Action callback) { throw new NotImplementedException(); } public void SyncPeerMessages(TLPeerBase peer, TLMessagesBase messages, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { throw new NotImplementedException(); } public void AddMessagesToContext(TLMessagesBase messages, Action callback) { throw new NotImplementedException(); } public void SyncDialogs(Stopwatch stopwatch, TLDialogsBase dialogs, Action callback) { throw new NotImplementedException(); } public void SyncChannelDialogs(TLDialogsBase dialogs, Action callback) { throw new NotImplementedException(); } public void MergeMessagesAndChannels(TLDialogsBase dialogs) { throw new NotImplementedException(); } public void SyncUser(TLUserBase user, Action callback) { throw new NotImplementedException(); } public void SyncUser(TLUserFull userFull, Action callback) { throw new NotImplementedException(); } public void SyncUsers(TLVector users, Action> callback) { throw new NotImplementedException(); } public void AddUsers(TLVector users, Action> callback) { throw new NotImplementedException(); } public void SyncUsersAndChats(TLVector users, TLVector chats, Action, TLVector>> callback) { throw new NotImplementedException(); } public void SyncUserLink(TLLinkBase link, Action callback) { throw new NotImplementedException(); } public void SyncContacts(TLContactsBase contacts, Action callback) { throw new NotImplementedException(); } public void SyncContacts(TLImportedContacts contacts, Action callback) { throw new NotImplementedException(); } public void ClearDialog(TLPeerBase peer) { throw new NotImplementedException(); } public void DeleteDialog(TLDialogBase dialog) { throw new NotImplementedException(); } public void DeleteMessages(TLVector ids) { throw new NotImplementedException(); } public void DeleteChannelMessages(TLInt channelId, TLVector ids) { throw new NotImplementedException(); } public void DeleteMessages(TLPeerBase peer, TLMessageBase lastItem, TLVector messages) { throw new NotImplementedException(); } public void DeleteMessages(TLVector ids) { throw new NotImplementedException(); } public void DeleteDecryptedMessages(TLVector ids) { throw new NotImplementedException(); } public void ClearDecryptedHistoryAsync(TLInt chatId) { throw new NotImplementedException(); } public void ClearBroadcastHistoryAsync(TLInt chatId) { throw new NotImplementedException(); } public void SyncStatedMessage(TLStatedMessageBase statedMessage, Action callback) { throw new NotImplementedException(); } public void SyncStatedMessages(TLStatedMessagesBase statedMessages, Action callback) { throw new NotImplementedException(); } private TLCdnConfig _cdnConfig; private readonly object _cdnConfigSyncRoot = new object(); public void GetCdnConfigAsync(Action callback) { if (_cdnConfig == null) { _cdnConfig = TLUtils.OpenObjectFromMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName); } callback.SafeInvoke(_cdnConfig); } public TLCdnConfig GetCdnConfig() { if (_cdnConfig == null) { _cdnConfig = TLUtils.OpenObjectFromMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName); } return _cdnConfig; } public void SetCdnCofig(TLCdnConfig cdnConfig) { _cdnConfig = cdnConfig; TLUtils.SaveObjectToMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName, _cdnConfig); } private TLConfig _config; public TLConfig GetConfig() { #if SILVERLIGHT || WIN_RT if (_config == null) { _config = SettingsHelper.GetValue(Constants.ConfigKey) as TLConfig; } #endif return _config; } public void GetConfigAsync(Action callback) { #if SILVERLIGHT || WIN_RT if (_config == null) { _config = SettingsHelper.GetValue(Constants.ConfigKey) as TLConfig; } #endif callback.SafeInvoke(_config); } public void SetConfig(TLConfig config) { _config = config; #if SILVERLIGHT || WIN_RT SettingsHelper.SetValue(Constants.ConfigKey, config); #endif } public void ClearConfigImportAsync() { throw new NotImplementedException(); } public void SyncChat(TLMessagesChatFull messagesChatFull, Action callback) { throw new NotImplementedException(); } public void AddChats(TLVector chats, Action> callback) { throw new NotImplementedException(); } public void SyncBroadcast(TLBroadcastChat broadcast, Action callback) { throw new NotImplementedException(); } public TLEncryptedChatBase GetEncryptedChat(TLInt id) { throw new NotImplementedException(); } public void SyncEncryptedChat(TLEncryptedChatBase encryptedChat, Action callback) { throw new NotImplementedException(); } public void SyncDecryptedMessage(TLDecryptedMessageBase message, TLEncryptedChatBase peer, Action callback) { throw new NotImplementedException(); } public void SyncDecryptedMessages(IList> tuples, TLEncryptedChatBase peer, Action>> callback) { throw new NotImplementedException(); } public void SyncSendingDecryptedMessage(TLInt chatId, TLInt date, TLLong randomId, Action callback) { throw new NotImplementedException(); } public void Init() { throw new NotImplementedException(); } public void SyncDifference(TLDifference difference, Action result, IList exceptions) { throw new NotImplementedException(); } public void SyncDifferenceWithoutUsersAndChats(TLDifference difference, Action result, IList exceptions) { throw new NotImplementedException(); } public void SyncStatuses(TLVector contacts, Action> callback) { throw new NotImplementedException(); } public void DeleteUser(TLInt id) { throw new NotImplementedException(); } public void DeleteChat(TLInt id) { throw new NotImplementedException(); } public void DeleteUserHistory(TLPeerChannel channel, TLPeerUser peer) { throw new NotImplementedException(); } public void UpdateDialogPinned(TLPeerBase peer, bool pinned) { throw new NotImplementedException(); } public void UpdatePinnedDialogs(TLVector order) { throw new NotImplementedException(); } public void UpdateChannelAvailableMessages(TLInt channelId, TLInt availableMinId) { throw new NotImplementedException(); } public void UpdateDialogPromo(TLDialogBase dialogBase, bool promo) { throw new NotImplementedException(); } public TLProxyDataBase GetProxyData() { throw new NotImplementedException(); } public void UpdateProxyData(TLProxyDataBase proxyData) { throw new NotImplementedException(); } } public class InMemoryCacheService : ICacheService { private readonly object _databaseSyncRoot = new object(); private InMemoryDatabase _database; private Context UsersContext { get { return _database != null ? _database.UsersContext : null; } } private Context ChatsContext { get { return _database != null ? _database.ChatsContext : null; } } private Context BroadcastsContext { get { return _database != null ? _database.BroadcastsContext : null; } } private Context EncryptedChatsContext { get { return _database != null ? _database.EncryptedChatsContext : null; } } private Context MessagesContext { get { return _database != null ? _database.MessagesContext : null; } } private Context> ChannelsContext { get { return _database != null ? _database.ChannelsContext : null; } } private Context DecryptedMessagesContext { get { return _database != null ? _database.DecryptedMessagesContext : null; } } private Context RandomMessagesContext { get { return _database != null ? _database.RandomMessagesContext : null; } } private Context DialogsContext { get { return _database != null ? _database.DialogsContext : null; } } public void Init() { var stopwatch = Stopwatch.StartNew(); _database = new InMemoryDatabase(_eventAggregator); _database.Open(); Debug.WriteLine("{0} {1}", stopwatch.Elapsed, "open database time"); } private readonly ITelegramEventAggregator _eventAggregator; public static ICacheService Instance { get; protected set; } public InMemoryCacheService(ITelegramEventAggregator eventAggregator) { _eventAggregator = eventAggregator; Instance = this; } public IList GetDialogs() { var result = new List(); if (_database == null) Init(); if (DialogsContext == null) { return result; } var timer = Stopwatch.StartNew(); IList dialogs = new List(); try { dialogs = new List(_database.Dialogs); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteLine(e.ToString(), LogSeverity.Error); } TLUtils.WritePerformance(string.Format("GetCachedDialogs time ({0} from {1}): {2}", dialogs.Count, _database.CountRecords(), timer.Elapsed)); return dialogs.OrderByDescending(x => x.GetDateIndex()).ToList(); } public void GetDialogsAsync(Action> callback) { Execute.BeginOnThreadPool( () => { var result = new List(); if (_database == null) Init(); if (DialogsContext == null) { callback(result); return; } var timer = Stopwatch.StartNew(); IList dialogs = new List(); try { dialogs = new List(_database.Dialogs); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteLine(e.ToString(), LogSeverity.Error); } TLUtils.WritePerformance(string.Format("GetCachedDialogs time ({0} from {1}): {2}", dialogs.Count, _database.CountRecords(), timer.Elapsed)); callback(dialogs.OrderByDescending(x => x.GetDateIndex()).ToList()); }); } public List GetUsers() { var result = new List(); if (_database == null) Init(); if (UsersContext == null) { return result; } var timer = Stopwatch.StartNew(); var contacts = new List(); try { contacts = _database.UsersContext.Values.ToList(); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } TLUtils.WritePerformance(string.Format("GetCachedContacts time ({0} from {1}): {2}", contacts.Count, _database.CountRecords(), timer.Elapsed)); return contacts; } public List GetContacts() { var result = new List(); if (_database == null) Init(); if (UsersContext == null) { return result; } var timer = Stopwatch.StartNew(); var contacts = new List(); try { contacts = _database.UsersContext.Values.Where(x => x != null && (x.IsContact || x.IsSelf)).ToList(); //contacts = _database.UsersContext.Values.Where(x => x.Contact != null).ToList(); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } TLUtils.WritePerformance(string.Format("GetCachedContacts time ({0} from {1}): {2}", contacts.Count, _database.CountRecords(), timer.Elapsed)); return contacts; } public List GetUsersForSearch(IList nonCachedDialogs) { var result = new List(); if (_database == null) Init(); if (UsersContext == null) { return result; } var contacts = new List(); try { var usersCache = new Dictionary(); if (nonCachedDialogs != null) { for (var i = 0; i < nonCachedDialogs.Count; i++) { var dialog = nonCachedDialogs[i] as TLDialog; if (dialog != null) { var user = nonCachedDialogs[i].With as TLUserBase; if (user != null) { if (!usersCache.ContainsKey(user.Index)) { usersCache[user.Index] = user.Index; contacts.Add(user); } } } } } var dialogs = new List(_database.Dialogs); for (var i = 0; i < dialogs.Count; i++) { var dialog = dialogs[i] as TLDialog; if (dialog != null) { var user = dialogs[i].With as TLUserBase; if (user != null) { if (!usersCache.ContainsKey(user.Index)) { usersCache[user.Index] = user.Index; contacts.Add(user); } } } } var unsortedContacts = _database.UsersContext.Values.Where(x => x != null && x.IsContact).ToList(); for (var i = 0; i < unsortedContacts.Count; i++) { var user = unsortedContacts[i]; if (!usersCache.ContainsKey(user.Index)) { usersCache[user.Index] = user.Index; contacts.Add(user); } } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } return contacts; } public void GetContactsAsync(Action> callback) { Execute.BeginOnThreadPool( () => { var result = new List(); if (_database == null) Init(); if (UsersContext == null) { callback(result); return; } var timer = Stopwatch.StartNew(); IList contacts = new List(); try { contacts = _database.UsersContext.Values.Where(x => x != null && x.IsContact).ToList(); //contacts = _database.UsersContext.Values.Where(x => x.Contact != null).ToList(); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } TLUtils.WritePerformance(string.Format("GetCachedContacts time ({0} from {1}): {2}", contacts.Count, _database.CountRecords(), timer.Elapsed)); callback(contacts); }); } public List GetChats() { var result = new List(); if (_database == null) Init(); if (ChatsContext == null) { return result; } var timer = Stopwatch.StartNew(); IList chats = new List(); try { result = _database.ChatsContext.Values.ToList(); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } TLUtils.WritePerformance(string.Format("GetCachedChats time ({0} from {1}): {2}", chats.Count, _database.CountRecords(), timer.Elapsed)); return result; } public void GetChatsAsync(Action> callback) { Execute.BeginOnThreadPool( () => { var result = new List(); if (_database == null) Init(); if (ChatsContext == null) { callback(result); return; } var timer = Stopwatch.StartNew(); IList chats = new List(); try { chats = _database.ChatsContext.Values.ToList(); } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } TLUtils.WritePerformance(string.Format("GetCachedChats time ({0} from {1}): {2}", chats.Count, _database.CountRecords(), timer.Elapsed)); callback(chats); }); } public TLChatBase GetChat(TLInt id) { if (_database == null) { Init(); } return ChatsContext[id.Value]; } public TLBroadcastChat GetBroadcast(TLInt id) { if (_database == null) { Init(); } return BroadcastsContext[id.Value]; } public TLEncryptedChatBase GetEncryptedChat(TLInt id) { if (_database == null) { Init(); } return EncryptedChatsContext[id.Value]; } public TLUserBase GetUser(TLInt id) { if (_database == null) { Init(); } return UsersContext[id.Value]; } public TLUserBase GetUser(TLUserProfilePhoto photo) { var usersShapshort = new List(UsersContext.Values); return usersShapshort.FirstOrDefault(x => x.Photo == photo); } public TLUserBase GetUser(string username) { var usersShapshort = new List(UsersContext.Values); return usersShapshort.FirstOrDefault(x => x is IUserName && ((IUserName)x).UserName != null && string.Equals(((IUserName)x).UserName.ToString(), username, StringComparison.OrdinalIgnoreCase)); } public TLMessageBase GetMessage(TLInt id, TLInt channelId = null) { if (channelId != null) { var channelContext = ChannelsContext[channelId.Value]; if (channelContext != null) { return channelContext[id.Value]; } return null; } return MessagesContext[id.Value]; } public TLMessageBase GetMessage(TLLong randomId) { return RandomMessagesContext[randomId.Value]; } public TLMessageBase GetMessage(TLWebPageBase webPageBase) { var m = MessagesContext.Values.FirstOrDefault(x => { var message = x as TLMessage; if (message != null) { var webPageMedia = message.Media as TLMessageMediaWebPage; if (webPageMedia != null) { var currentWebPage = webPageMedia.WebPage; if (currentWebPage != null && currentWebPage.Id.Value == webPageBase.Id.Value) { return true; } } } return false; }); if (m != null) return m; foreach (var channelContext in ChannelsContext.Values) { foreach (var x in channelContext.Values) { var message = x as TLMessage; if (message != null) { var webPageMedia = message.Media as TLMessageMediaWebPage; if (webPageMedia != null) { var currentWebPage = webPageMedia.WebPage; if (currentWebPage != null && currentWebPage.Id.Value == webPageBase.Id.Value) { m = message; break; } } } } } if (m != null) return m; m = RandomMessagesContext.Values.FirstOrDefault(x => { var message = x as TLMessage; if (message != null) { var webPageMedia = message.Media as TLMessageMediaWebPage; if (webPageMedia != null) { var currentWebPage = webPageMedia.WebPage; if (currentWebPage != null && currentWebPage.Id.Value == webPageBase.Id.Value) { return true; } } } return false; }); return m; } public TLDialog GetDialog(TLMessageCommon message) { TLPeerBase peer; if (message.ToId is TLPeerChat) { peer = message.ToId; } else { peer = message.Out.Value ? message.ToId : new TLPeerUser { Id = message.FromId }; } return GetDialog(peer); } public TLDialog GetDialog(TLPeerBase peer) { return _database.GetDialog(peer) as TLDialog; //return _database.Dialogs.OfType().FirstOrDefault(x => x.WithId == peer.Id.Value && x.IsChat == peer is TLPeerChat); } public TLDialogBase GetEncryptedDialog(TLInt chatId) { return _database.Dialogs.OfType().FirstOrDefault(x => x.Index == chatId.Value); } public TLChat GetChat(TLChatPhoto chatPhoto) { return _database.ChatsContext.Values.FirstOrDefault(x => x is TLChat && ((TLChat)x).Photo == chatPhoto) as TLChat; } public TLChannel GetChannel(string username) { var chatsSnapshort = new List(_database.ChatsContext.Values); return chatsSnapshort.FirstOrDefault(x => x is TLChannel && ((TLChannel)x).UserName != null && string.Equals(((TLChannel)x).UserName.ToString(), username, StringComparison.OrdinalIgnoreCase)) as TLChannel; } public TLChannel GetChannel(TLChatPhoto chatPhoto) { var chatsSnapshort = new List(_database.ChatsContext.Values); return chatsSnapshort.FirstOrDefault(x => x is TLChannel && ((TLChannel)x).Photo == chatPhoto) as TLChannel; } public IList GetHistory(int dialogIndex) { var result = new List(); if (_database == null) Init(); if (DecryptedMessagesContext == null || DialogsContext == null) { return result; } var timer = Stopwatch.StartNew(); IList msgs = new List(); try { var dialog = DialogsContext[dialogIndex] as TLDialog; if (dialog != null) { msgs = dialog.Messages .OfType() //.Where(x => //x.FromId.Value == currentUserId.Value && x.ToId.Id.Value == peer.Id.Value // to peer from current //|| x.FromId.Value == peer.Id.Value && x.ToId.Id.Value == currentUserId.Value) // from peer to current .Cast() .ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } //TLUtils.WritePerformance(string.Format("GetCachedHistory time ({0}): {1}", _database.CountRecords(), timer.Elapsed)); return msgs.Take(Constants.CachedMessagesCount).ToList(); } public TLDecryptedMessageBase GetDecryptedMessage(TLInt chatId, TLLong randomId) { TLDecryptedMessageBase result = null; if (_database == null) Init(); if (MessagesContext == null || DialogsContext == null) { return result; } IList msgs = new List(); try { var dialog = DialogsContext[chatId.Value] as TLEncryptedDialog; if (dialog != null) { msgs = dialog.Messages.ToList(); foreach (var message in msgs) { if (message.RandomIndex == randomId.Value) { return message; } } } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } return result; } public IList GetDecryptedHistory(int dialogIndex, int limit = Constants.CachedMessagesCount) { var result = new List(); if (_database == null) Init(); if (MessagesContext == null || DialogsContext == null) { return result; } IList msgs = new List(); try { var dialog = DialogsContext[dialogIndex] as TLEncryptedDialog; if (dialog != null) { msgs = dialog.Messages.ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } var returnedMessages = new List(); var count = 0; for (var i = 0; i < msgs.Count && count < limit; i++) { returnedMessages.Add(msgs[i]); if (TLUtils.IsDisplayedDecryptedMessage(msgs[i])) { count++; } } return returnedMessages; } public IList GetUnreadDecryptedHistory(int dialogIndex) { var result = new List(); if (_database == null) Init(); if (MessagesContext == null || DialogsContext == null) { return result; } IList msgs = new List(); try { var dialog = DialogsContext[dialogIndex] as TLEncryptedDialog; if (dialog != null) { msgs = dialog.Messages.ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } var returnedMessages = new List(); for (var i = 0; i < msgs.Count; i++) { if (!msgs[i].Out.Value && msgs[i].Unread.Value) { returnedMessages.Add(msgs[i]); } } return returnedMessages; } public IList GetDecryptedHistory(int dialogIndex, long randomId, int limit = Constants.CachedMessagesCount) { var result = new List(); if (_database == null) Init(); if (MessagesContext == null || DialogsContext == null) { return result; } IList msgs = new List(); try { var dialog = DialogsContext[dialogIndex] as TLEncryptedDialog; if (dialog != null) { msgs = dialog.Messages.ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } var skipCount = 0; if (randomId != 0) { skipCount = 1; for (var i = 0; i < msgs.Count; i++) { if (msgs[i].RandomIndex != randomId) { skipCount++; } else { break; } } } var returnedMessages = new List(); var count = 0; for (var i = skipCount; i < msgs.Count && count < limit; i++) { returnedMessages.Add(msgs[i]); if (TLUtils.IsDisplayedDecryptedMessage(msgs[i])) { count++; } } return returnedMessages; } public IList GetHistory(TLPeerBase peer, int maxId, int limit = Constants.CachedMessagesCount) { var result = new List(); if (_database == null) Init(); if (MessagesContext == null) { return result; } IList msgs = new List(); try { var withId = peer.Id.Value; var dialogBase = _database.Dialogs.FirstOrDefault(x => x.WithId == withId && peer.GetType() == x.Peer.GetType()); var dialog = dialogBase as TLDialog; if (dialog != null) { msgs = dialog.Messages .OfType() .Cast() .ToList(); } var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { msgs = broadcast.Messages .OfType() .Cast() .ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } var count = 0; var startPosition = -1; var resultMsgs = new List(); for (var i = 0; i < msgs.Count && count < limit; i++) { var msg = msgs[i]; if (startPosition == -1) { if (msg.Index == 0 || msg.Index > maxId) { continue; } if (msg.Index == maxId) { startPosition = i; } if (msg.Index < maxId) { break; } } resultMsgs.Add(msg); count++; } return resultMsgs; } public IList GetHistory(TLPeerBase peer, int limit = Constants.CachedMessagesCount) { var result = new List(); if (_database == null) Init(); if (MessagesContext == null) { return result; } var timer = Stopwatch.StartNew(); IList msgs = new List(); try { var withId = peer.Id.Value; var dialogBase = _database.Dialogs.FirstOrDefault(x => x.WithId == withId && peer.GetType() == x.Peer.GetType()); var dialog = dialogBase as TLDialog; if (dialog != null) { msgs = dialog.Messages .OfType() //.Where(x => //x.FromId.Value == currentUserId.Value && x.ToId.Id.Value == peer.Id.Value // to peer from current //|| x.FromId.Value == peer.Id.Value && x.ToId.Id.Value == currentUserId.Value) // from peer to current .Cast() .ToList(); } var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { msgs = broadcast.Messages .OfType() //.Where(x => //x.FromId.Value == currentUserId.Value && x.ToId.Id.Value == peer.Id.Value // to peer from current //|| x.FromId.Value == peer.Id.Value && x.ToId.Id.Value == currentUserId.Value) // from peer to current .Cast() .ToList(); } } catch (Exception e) { TLUtils.WriteLine("DB ERROR:", LogSeverity.Error); TLUtils.WriteException(e); } // TLUtils.WritePerformance(string.Format("GetCachedHistory time ({0}): {1}", _database.CountRecords(), timer.Elapsed)); return msgs.Take(limit).ToList(); } public void GetHistoryAsync(TLPeerBase peer, Action> callback, int limit = Constants.CachedMessagesCount) { Execute.BeginOnThreadPool( () => { var history = GetHistory(peer, limit); callback.SafeInvoke(history); }); } public void ClearAsync(Action callback = null) { Execute.BeginOnThreadPool( () => { lock (_databaseSyncRoot) { if (_database != null) _database.Clear(); } callback.SafeInvoke(); }); } #region Messages private TLMessageBase GetCachedMessage(TLMessageBase message) { TLPeerChannel peerChannel; var isChannelMessage = TLUtils.IsChannelMessage(message, out peerChannel); if (isChannelMessage) { if (message.Index != 0 && ChannelsContext != null && ChannelsContext.ContainsKey(peerChannel.Id.Value)) { var channelContext = ChannelsContext[peerChannel.Id.Value]; if (channelContext != null) { return channelContext[message.Index]; } } return null; } if (message.Index != 0 && MessagesContext != null && MessagesContext.ContainsKey(message.Index)) { return MessagesContext[message.Index]; } if (message.RandomIndex != 0 && RandomMessagesContext != null && RandomMessagesContext.ContainsKey(message.RandomIndex)) { return RandomMessagesContext[message.RandomIndex]; } return null; } private TLDecryptedMessageBase GetCachedDecryptedMessage(TLLong randomId) { if (randomId != null && DecryptedMessagesContext != null && DecryptedMessagesContext.ContainsKey(randomId.Value)) { return DecryptedMessagesContext[randomId.Value]; } return null; } private TLDecryptedMessageBase GetCachedDecryptedMessage(TLDecryptedMessageBase message) { if (message.RandomId != null && DecryptedMessagesContext != null && DecryptedMessagesContext.ContainsKey(message.RandomIndex)) { return DecryptedMessagesContext[message.RandomIndex]; } //if (message.RandomIndex != 0 && RandomMessagesContext != null && RandomMessagesContext.ContainsKey(message.RandomIndex)) //{ // return RandomMessagesContext[message.RandomIndex]; //} return null; } public void SyncSendingMessages(IList messages, TLMessageBase previousMessage, Action> callback) { if (messages == null) { callback(null); return; } var message73 = previousMessage as TLMessage73; if (message73 != null) { var mediaGroup = message73.Media as TLMessageMediaGroup; if (mediaGroup != null) { previousMessage = mediaGroup.Group.LastOrDefault(); } } var timer = Stopwatch.StartNew(); var result = new List(); if (_database == null) Init(); for (var i = 0; i < messages.Count; i++) { var message = messages[i]; var cachedMessage = GetCachedMessage(message) as TLMessage; if (cachedMessage != null) { _database.UpdateSendingMessage(message, cachedMessage); result.Add(cachedMessage); } else { var previousMsg = i == 0 ? previousMessage : messages[i - 1]; var isLastMsg = i == messages.Count - 1; _database.AddSendingMessage(message, previousMsg, isLastMsg, isLastMsg); result.Add(message); } } _database.Commit(); TLUtils.WritePerformance("SyncSendingMessages time: " + timer.Elapsed); callback(result); } public void SyncSendingMessageId(TLLong randomId, TLInt id, Action callback) { var timer = Stopwatch.StartNew(); TLMessage result = null; if (_database == null) Init(); var cachedMessage = GetMessage(randomId) as TLMessage; if (cachedMessage != null) { cachedMessage.Id = id; _database.UpdateSendingMessageContext(cachedMessage); result = cachedMessage; // send at background task and GetDialogs was invoked before getDifference // remove duplicates var dialog = GetDialog(cachedMessage); if (dialog != null) { lock (dialog.MessagesSyncRoot) { var count = 0; for (int i = 0; i < dialog.Messages.Count; i++) { if (dialog.Messages[i].Index == id.Value) { count++; if (count > 1) { dialog.Messages.RemoveAt(i--); } } } } } } _database.Commit(); TLUtils.WritePerformance("SyncSendingMessageId time: " + timer.Elapsed); callback(result); } public void SyncSendingMessage(TLMessageCommon message, TLMessageBase previousMessage, Action callback) { if (message == null) { callback(null); return; } var message73 = previousMessage as TLMessage73; if (message73 != null) { var mediaGroup = message73.Media as TLMessageMediaGroup; if (mediaGroup != null) { previousMessage = mediaGroup.Group.LastOrDefault(); } } var timer = Stopwatch.StartNew(); var result = message; if (_database == null) Init(); var cachedMessage = GetCachedMessage(message); if (cachedMessage != null) { _database.UpdateSendingMessage(message, cachedMessage); result = (TLMessage)cachedMessage; } else { _database.AddSendingMessage(message, previousMessage); // forwarding var messagesContainer = message.Reply as TLMessagesContainter; if (messagesContainer != null) { var messages = messagesContainer.FwdMessages; if (messages != null) { for (var i = 0; i < messages.Count; i++) { var fwdMessage = messages[i]; var previousMsg = i == 0 ? message : messages[i - 1]; var isLastMsg = i == messages.Count - 1; _database.AddSendingMessage(fwdMessage, previousMsg, isLastMsg, isLastMsg); } } } } _database.Commit(); TLUtils.WritePerformance("SyncSendingMessage time: " + timer.Elapsed); callback(result); } public void SyncSendingDecryptedMessage(TLInt chatId, TLInt date, TLLong randomId, Action callback) { TLDecryptedMessageBase result = null; if (_database == null) Init(); if (DecryptedMessagesContext != null) { result = GetCachedDecryptedMessage(randomId); } if (result == null) { callback(null); return; } _database.UpdateSendingDecryptedMessage(chatId, date, result); _database.Commit(); callback(result); } public void SyncDecryptedMessages(IList> tuples, TLEncryptedChatBase peer, Action>> callback) { if (tuples == null) { callback(null); return; } var timer = Stopwatch.StartNew(); var result = tuples; if (_database == null) Init(); foreach (var tuple in tuples) { TLDecryptedMessageBase cachedMessage = null; if (DecryptedMessagesContext != null) { cachedMessage = GetCachedDecryptedMessage(tuple.Item1); } if (cachedMessage != null) { // update fields if (tuple.Item1.GetType() == cachedMessage.GetType()) { cachedMessage.Update(tuple.Item1); } tuple.Item1 = cachedMessage; } else { // add object to cache _database.AddDecryptedMessage(tuple.Item1, peer); } } _database.Commit(); TLUtils.WritePerformance("Sync DecryptedMessage time: " + timer.Elapsed); callback(result); } public void SyncDecryptedMessage(TLDecryptedMessageBase message, TLEncryptedChatBase peer, Action callback) { if (message == null) { callback(null); return; } var timer = Stopwatch.StartNew(); var result = message; if (_database == null) Init(); TLDecryptedMessageBase cachedMessage = null; if (DecryptedMessagesContext != null) { cachedMessage = GetCachedDecryptedMessage(message); } if (cachedMessage != null) { // update fields if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Update(message); } result = cachedMessage; } else { // add object to cache _database.AddDecryptedMessage(message, peer); } _database.Commit(); TLUtils.WritePerformance("Sync DecryptedMessage time: " + timer.Elapsed); callback(result); } public ExceptionInfo LastSyncMessageException { get; set; } public void SyncMessage(TLMessageBase message, Action callback) { SyncMessage(message, true, true, callback); } public void SyncEditedMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { try { if (message == null) { callback(null); return; } var result = message; if (_database == null) Init(); var cachedMessage = GetCachedMessage(message); if (cachedMessage != null) { if (cachedMessage.RandomId != null) { _database.RemoveMessageFromContext(cachedMessage); if (cachedMessage.Index != 0) { cachedMessage.RandomId = null; } _database.AddMessageToContext(cachedMessage); } if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Edit(message); } else { _database.RemoveMessageFromContext(cachedMessage); _database.AddMessage(message, notifyNewDialog, notifyTopMessageUpdated); } result = cachedMessage; } _database.Commit(); callback(result); } catch (Exception ex) { LastSyncMessageException = new ExceptionInfo { Caption = "CacheService.SyncMessage", Exception = ex, Timestamp = DateTime.Now }; TLUtils.WriteException("CacheService.SyncMessage", ex); } } public void SyncMessage(TLMessageBase message, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { try { if (message == null) { callback(null); return; } var result = message; if (_database == null) Init(); var cachedMessage = GetCachedMessage(message); if (cachedMessage != null) { if (cachedMessage.RandomId != null) { _database.RemoveMessageFromContext(cachedMessage); if (cachedMessage.Index != 0) { cachedMessage.RandomId = null; } _database.AddMessageToContext(cachedMessage); } if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Update(message); } else { _database.DeleteMessage(cachedMessage); _database.AddMessage(message, notifyNewDialog, notifyTopMessageUpdated); } result = cachedMessage; } else { try { _database.AddMessage(message, notifyNewDialog, notifyTopMessageUpdated); } catch (Exception ex) { LastSyncMessageException = new ExceptionInfo { Exception = ex, Timestamp = DateTime.Now }; Helpers.Execute.ShowDebugMessage("SyncMessage ex:\n" + ex); } } _database.Commit(); callback(result); } catch (Exception ex) { LastSyncMessageException = new ExceptionInfo { Caption = "CacheService.SyncMessage", Exception = ex, Timestamp = DateTime.Now }; TLUtils.WriteException("CacheService.SyncMessage", ex); } } public void SyncPeerMessages(TLPeerBase peer, TLMessagesBase messages, bool notifyNewDialog, bool notifyTopMessageUpdated, Action callback) { if (messages == null) { callback(new TLMessages()); return; } var timer = Stopwatch.StartNew(); var result = messages.GetEmptyObject(); if (_database == null) Init(); ProcessPeerReading(peer, messages); SyncChatsInternal(messages.Chats, result.Chats); SyncUsersInternal(messages.Users, result.Users); SyncMessagesInternal(peer, messages.Messages, result.Messages, notifyNewDialog, notifyTopMessageUpdated); _database.Commit(); //TLUtils.WritePerformance("SyncPeerMessages time: " + timer.Elapsed); callback(result); } private void ProcessPeerReading(TLPeerBase peer, TLMessagesBase messages) { IReadMaxId readMaxId = null; if (peer is TLPeerUser) { readMaxId = GetUser(peer.Id) as IReadMaxId; } else if (peer is TLPeerChat) { readMaxId = GetChat(peer.Id) as IReadMaxId; } else if (peer is TLPeerChannel) { readMaxId = GetChat(peer.Id) as IReadMaxId; } if (readMaxId != null) { foreach (var message in messages.Messages) { var messageCommon = message as TLMessageCommon; if (messageCommon != null) { if (messageCommon.Out.Value && readMaxId.ReadOutboxMaxId != null && readMaxId.ReadOutboxMaxId.Value >= 0 && readMaxId.ReadOutboxMaxId.Value < messageCommon.Index) { messageCommon.SetUnreadSilent(TLBool.True); } else if (!messageCommon.Out.Value && readMaxId.ReadInboxMaxId != null && readMaxId.ReadInboxMaxId.Value >= 0 && readMaxId.ReadInboxMaxId.Value < messageCommon.Index) { messageCommon.SetUnreadSilent(TLBool.True); } } } } } public void AddMessagesToContext(TLMessagesBase messages, Action callback) { if (messages == null) { callback(new TLMessages()); return; } var timer = Stopwatch.StartNew(); var result = messages.GetEmptyObject(); if (_database == null) Init(); SyncChatsInternal(messages.Chats, result.Chats); SyncUsersInternal(messages.Users, result.Users); foreach (var message in messages.Messages) { if (GetCachedMessage(message) == null) { _database.AddMessageToContext(message); } } _database.Commit(); //TLUtils.WritePerformance("SyncPeerMessages time: " + timer.Elapsed); callback(result); } public void SyncStatuses(TLVector contactStatuses, Action> callback) { if (contactStatuses == null) { callback(new TLVector()); return; } var timer = Stopwatch.StartNew(); var result = contactStatuses; if (_database == null) Init(); foreach (var contactStatus in contactStatuses) { var contactStatus19 = contactStatus as TLContactStatus19; if (contactStatus19 != null) { var userId = contactStatus.UserId; var user = GetUser(userId); if (user != null) { user._status = contactStatus19.Status; } } } _database.Commit(); //TLUtils.WritePerformance("SyncPeerMessages time: " + timer.Elapsed); callback(result); } public void SyncDifference(TLDifference difference, Action callback, IList exceptions) { if (difference == null) { callback(new TLDifference()); return; } var timer = Stopwatch.StartNew(); var result = (TLDifference)difference.GetEmptyObject(); if (_database == null) Init(); SyncChatsInternal(difference.Chats, result.Chats, exceptions); SyncUsersInternal(difference.Users, result.Users, exceptions); SyncMessagesInternal(null, difference.NewMessages, result.NewMessages, false, false, exceptions); SyncEncryptedMessagesInternal(difference.State.Qts, difference.NewEncryptedMessages, result.NewEncryptedMessages, exceptions); _database.Commit(); //TLUtils.WritePerformance("Sync difference time: " + timer.Elapsed); callback(result); } public void SyncDifferenceWithoutUsersAndChats(TLDifference difference, Action callback, IList exceptions) { if (difference == null) { callback(new TLDifference()); return; } var timer = Stopwatch.StartNew(); var result = (TLDifference)difference.GetEmptyObject(); if (_database == null) Init(); //SyncChatsInternal(difference.Chats, result.Chats, exceptions); //SyncUsersInternal(difference.Users, result.Users, exceptions); foreach (var messageBase in difference.NewMessages) { MTProtoService.ProcessSelfMessage(messageBase); } SyncMessagesInternal(null, difference.NewMessages, result.NewMessages, false, false, exceptions); SyncEncryptedMessagesInternal(difference.State.Qts, difference.NewEncryptedMessages, result.NewEncryptedMessages, exceptions); _database.Commit(); //TLUtils.WritePerformance("Sync difference time: " + timer.Elapsed); callback(result); } private void SyncMessageInternal(TLPeerBase peer, TLMessageBase message, out TLMessageBase result) { TLMessageCommon cachedMessage = null; //if (MessagesContext != null) { cachedMessage = (TLMessageCommon)GetCachedMessage(message); //cachedMessage = (TLMessageCommon)MessagesContext[message.Index]; } if (cachedMessage != null) { if (cachedMessage.RandomId != null) { _database.RemoveMessageFromContext(cachedMessage); cachedMessage.RandomId = null; _database.AddMessageToContext(cachedMessage); } // update fields if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Update(message); //_database.Storage.Modify(cachedMessage); } // or replace object else { _database.DeleteMessage(cachedMessage); _database.AddMessage(message); } result = cachedMessage; } else { // add object to cache result = message; _database.AddMessage(message); } } private void SyncMessagesInternal(TLPeerBase peer, IEnumerable messages, TLVector result, bool notifyNewDialogs, bool notifyTopMessageUpdated, IList exceptions = null) { TLChannel channel = null; TLInt readInboxMaxId; if (peer is TLPeerChannel) { channel = GetChat(peer.Id) as TLChannel; } foreach (var message in messages) { try { // for updates we have input message only and set peer to null by default if (peer == null) { peer = TLUtils.GetPeerFromMessage(message); if (peer is TLPeerChannel) { channel = GetChat(peer.Id) as TLChannel; if (channel != null) { readInboxMaxId = channel.ReadInboxMaxId; if (readInboxMaxId != null) { var messageCommon = message as TLMessageCommon; if (messageCommon != null && !messageCommon.Out.Value && messageCommon.Index > readInboxMaxId.Value) { messageCommon.SetUnreadSilent(TLBool.True); } } } } } var cachedMessage = (TLMessageCommon)GetCachedMessage(message); if (cachedMessage != null) { if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Update(message); } else { _database.DeleteMessage(cachedMessage); _database.AddMessage(message); } result.Add(cachedMessage); } else { if (peer != null) { if (channel != null) { readInboxMaxId = channel.ReadInboxMaxId; if (readInboxMaxId != null) { var messageCommon = message as TLMessageCommon; if (messageCommon != null && !messageCommon.Out.Value && messageCommon.Index > readInboxMaxId.Value) { messageCommon.SetUnreadSilent(TLBool.True); } } } } result.Add(message); _database.AddMessage(message, notifyNewDialogs, notifyTopMessageUpdated); } } catch (Exception ex) { if (exceptions != null) { exceptions.Add(new ExceptionInfo { Caption = "UpdatesService.ProcessDifference Messages", Exception = ex, Timestamp = DateTime.Now }); } TLUtils.WriteException("UpdatesService.ProcessDifference Messages", ex); } } } #endregion #region Dialogs private void SyncDialogsInternal(Stopwatch stopwatch2, TLDialogsBase dialogs, TLDialogsBase result) { MergeMessagesAndChannels(dialogs); //Debug.WriteLine("messages.getDialogs sync dialogs merge messages and channels elapsed=" + stopwatch.Elapsed); foreach (TLDialog dialog in dialogs.Dialogs) { //Debug.WriteLine("messages.getDialogs sync dialogs start get cached elapsed=" + stopwatch.Elapsed); TLDialog cachedDialog = null; if (DialogsContext != null) { cachedDialog = DialogsContext[dialog.Index] as TLDialog; } //Debug.WriteLine("messages.getDialogs sync dialogs stop get cached elapsed=" + stopwatch.Elapsed); if (cachedDialog != null) { //Debug.WriteLine("messages.getDialogs sync dialogs start update cached elapsed=" + stopwatch.Elapsed); var raiseTopMessageUpdated = cachedDialog.TopMessageId == null || cachedDialog.TopMessageId.Value != dialog.TopMessageId.Value; cachedDialog.Update(dialog); //Debug.WriteLine("messages.getDialogs sync dialogs stop update cached elapsed=" + stopwatch.Elapsed); if (raiseTopMessageUpdated) { if (_eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(cachedDialog, cachedDialog.TopMessage)); } } result.Dialogs.Add(cachedDialog); } else { result.Dialogs.Add(dialog); // skip left and not promo dialogs var peerChannel = dialog.Peer as TLPeerChannel; if (peerChannel != null) { var channel = GetChat(peerChannel.Id) as TLChannel; var dialog71 = dialog as TLDialog71; if (channel != null && channel.Left.Value && dialog71 != null && !dialog71.IsPromo) { continue; } } //Debug.WriteLine("messages.getDialogs sync dialogs start add none cached elapsed=" + stopwatch.Elapsed); // add object to cache _database.AddDialog(dialog); //Debug.WriteLine("messages.getDialogs sync dialogs stop add none cached elapsed=" + stopwatch.Elapsed); } } //Debug.WriteLine("messages.getDialogs sync dialogs foreach elapsed=" + stopwatch.Elapsed); result.Messages = dialogs.Messages; } private void SyncChannelDialogsInternal(TLDialogsBase dialogs, TLDialogsBase result) { // set TopMessage properties var timer = Stopwatch.StartNew(); MergeMessagesAndChannels(dialogs); //TLUtils.WritePerformance("Dialogs:: merge dialogs and messages " + timer.Elapsed); timer = Stopwatch.StartNew(); foreach (TLDialog dialog in dialogs.Dialogs) { TLDialog cachedDialog = null; if (DialogsContext != null) { cachedDialog = DialogsContext[dialog.Index] as TLDialog; } if (cachedDialog != null) { var raiseTopMessageUpdated = cachedDialog.TopMessageId == null || cachedDialog.TopMessageId.Value != dialog.TopMessageId.Value; cachedDialog.Update(dialog); if (raiseTopMessageUpdated) { if (_eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(cachedDialog, cachedDialog.TopMessage)); } } result.Dialogs.Add(cachedDialog); } else { // add object to cache result.Dialogs.Add(dialog); _database.AddDialog(dialog); } } //TLUtils.WritePerformance("Dialogs:: foreach dialogs " + timer.Elapsed); result.Messages = dialogs.Messages; } public void SyncDialogs(Stopwatch stopwatch, TLDialogsBase dialogs, Action callback) { if (dialogs == null) { callback(new TLDialogs()); return; } var result = dialogs.GetEmptyObject(); if (_database == null) Init(); //Debug.WriteLine("messages.getDialogs after init elapsed=" + stopwatch.Elapsed); MergeReadMaxIdAndNotifySettings(dialogs); //Debug.WriteLine("messages.getDialogs merge notify settings elapsed=" + stopwatch.Elapsed); SyncChatsInternal(dialogs.Chats, result.Chats); //Debug.WriteLine("messages.getDialogs sync chats elapsed=" + stopwatch.Elapsed); SyncUsersInternal(dialogs.Users, result.Users); //Debug.WriteLine("messages.getDialogs sync users elapsed=" + stopwatch.Elapsed); SyncDialogsInternal(stopwatch, dialogs, result); //Debug.WriteLine("messages.getDialogs end sync dialogs elapsed=" + stopwatch.Elapsed); _database.Commit(); //Debug.WriteLine("messages.getDialogs after commit elapsed=" + stopwatch.Elapsed); callback.SafeInvoke(result); } public void SyncProxyData(TLProxyDataBase proxyData, Action callback) { var result = proxyData != null ? proxyData.GetEmptyObject() : null; var proxyDataPromo = proxyData as TLProxyDataPromo; if (proxyDataPromo != null) { SyncChatsInternal(proxyDataPromo.Chats, ((TLProxyDataPromo)result).Chats); SyncUsersInternal(proxyDataPromo.Users, ((TLProxyDataPromo)result).Users); } _database.UpdateProxyData(proxyData); _database.Commit(); callback.SafeInvoke(result); } public void SyncChannelDialogs(TLDialogsBase dialogs, Action callback) { if (dialogs == null) { callback(new TLDialogs()); return; } var result = dialogs.GetEmptyObject(); if (_database == null) Init(); MergeReadMaxIdAndNotifySettings(dialogs); // add or update chats, users and messages var timer = Stopwatch.StartNew(); SyncChatsInternal(dialogs.Chats, result.Chats); //TLUtils.WritePerformance("Dialogs:: sync chats " + timer.Elapsed); timer = Stopwatch.StartNew(); SyncUsersInternal(dialogs.Users, result.Users); //TLUtils.WritePerformance("Dialogs:: sync users " + timer.Elapsed); //SyncMessagesInternal(dialogs.Messages, result.Messages); timer = Stopwatch.StartNew(); SyncChannelDialogsInternal(dialogs, result); //TLUtils.WritePerformance("Dialogs:: sync dialogs " + timer.Elapsed); _database.Commit(); TLUtils.WritePerformance("SyncDialogs time: " + timer.Elapsed); callback.SafeInvoke(result); } private void MergeReadMaxIdAndNotifySettings(TLDialogsBase dialogs) { var chatsIndex = new Dictionary(); foreach (var chat in dialogs.Chats) { chatsIndex[chat.Index] = chat; } var usersIndex = new Dictionary(); foreach (var user in dialogs.Users) { usersIndex[user.Index] = user; } foreach (var dialog in dialogs.Dialogs) { if (dialog.NotifySettings != null) { if (dialog.Peer is TLPeerChannel) { TLChatBase chat; if (chatsIndex.TryGetValue(dialog.Index, out chat)) { chat.NotifySettings = dialog.NotifySettings; } } else if (dialog.Peer is TLPeerChat) { TLChatBase chat; if (chatsIndex.TryGetValue(dialog.Index, out chat)) { chat.NotifySettings = dialog.NotifySettings; } } else if (dialog.Peer is TLPeerUser) { TLUserBase user; if (usersIndex.TryGetValue(dialog.Index, out user)) { user.NotifySettings = dialog.NotifySettings; } } } var dialog53 = dialog as IReadMaxId; if (dialog53 != null) { if (dialog.Peer is TLPeerChannel) { TLChatBase chatBase; if (chatsIndex.TryGetValue(dialog.Index, out chatBase)) { var chat = chatBase as IReadMaxId; if (chat != null) { chat.ReadInboxMaxId = dialog53.ReadInboxMaxId; chat.ReadOutboxMaxId = dialog53.ReadOutboxMaxId; } } } else if (dialog.Peer is TLPeerChat) { TLChatBase chatBase; if (chatsIndex.TryGetValue(dialog.Index, out chatBase)) { var chat = chatBase as IReadMaxId; if (chat != null) { chat.ReadInboxMaxId = dialog53.ReadInboxMaxId; chat.ReadOutboxMaxId = dialog53.ReadOutboxMaxId; } } } else if (dialog.Peer is TLPeerUser) { TLUserBase userBase; if (usersIndex.TryGetValue(dialog.Index, out userBase)) { var user = userBase as IReadMaxId; if (user != null) { user.ReadInboxMaxId = dialog53.ReadInboxMaxId; user.ReadOutboxMaxId = dialog53.ReadOutboxMaxId; } } } } } } public void MergeMessagesAndChannels(TLDialogsBase dialogs) { var dialogsCache = new Context(); var messagesCache = new Context>(); try { foreach (var dialogBase in dialogs.Dialogs) { var dialog = dialogBase as TLDialog; if (dialog != null) { var peerId = dialog.Peer.Id.Value; dialogsCache[peerId] = dialog; } } foreach (var messageBase in dialogs.Messages) { var message = messageBase as TLMessageCommon; if (message != null) { var peerId = message.ToId is TLPeerUser && !message.Out.Value ? message.FromId.Value : message.ToId.Id.Value; if (!message.Out.Value) { TLDialog dialog; if (dialogsCache.TryGetValue(peerId, out dialog)) { var dialogChannel = dialog as TLDialogChannel; if (dialogChannel != null && dialogChannel.ReadInboxMaxId.Value < message.Index) { message.SetUnreadSilent(TLBool.True); } } } Context dialogContext; if (!messagesCache.TryGetValue(peerId, out dialogContext)) { dialogContext = new Context(); messagesCache[peerId] = dialogContext; } dialogContext[message.Index] = message; } } } catch (Exception ex) { } try { foreach (var dialogCache in messagesCache.Values) { foreach (var message in dialogCache.Values) { TLMessageCommon cachedMessage = null; //if (MessagesContext != null) { cachedMessage = (TLMessageCommon)GetCachedMessage(message); //cachedMessage = (TLMessageCommon)MessagesContext[message.Index]; } if (cachedMessage != null) { // update fields if (message.GetType() == cachedMessage.GetType()) { cachedMessage.Update(message); //_database.Storage.Modify(cachedMessage); } // or replace object else { _database.AddMessageToContext(message); } } else { // add object to cache _database.AddMessageToContext(message); } } } } catch (Exception ex) { } try { foreach (var dialogBase in dialogs.Dialogs) { var peer = dialogBase.Peer; if (peer is TLPeerUser) { dialogBase._with = UsersContext[peer.Id.Value]; } else if (peer is TLPeerChat) { dialogBase._with = ChatsContext[peer.Id.Value]; } else if (peer is TLPeerChannel) { dialogBase._with = ChatsContext[peer.Id.Value]; } var dialogFeed = dialogBase as TLDialogFeed; if (dialogFeed != null) { var channels = new TLVector(); foreach (var channelId in dialogFeed.FeedOtherChannels) { var ch = ChatsContext[channelId.Value]; if (ch != null) { channels.Add(ch); } } dialogFeed._with = channels; } var dialog = dialogBase as TLDialog; if (dialog != null) { dialog._topMessage = messagesCache[peer.Id.Value][dialogBase.TopMessageId.Value]; dialog.Messages = new ObservableCollection { dialog.TopMessage }; } //var dialogChannel = dialogBase as TLDialogChannel; //if (dialog != null) //{ // dialog._topMessage = messagesCache[peer.Id.Value][dialogBase.TopMessageId.Value]; // dialog.Messages = new ObservableCollection { dialog.TopMessage }; //} } } catch (Exception ex) { } } #endregion #region Users public void SyncUserLink(TLLinkBase link, Action callback) { if (link == null) { callback(null); return; } var timer = Stopwatch.StartNew(); TLUserBase result; if (_database == null) Init(); SyncUserInternal(link.User, out result); link.User = result; _database.Commit(); TLUtils.WritePerformance("SyncUser time: " + timer.Elapsed); callback(link); } public void SyncUser(TLUserFull userFull, Action callback) { if (userFull == null) { callback(null); return; } var timer = Stopwatch.StartNew(); TLUserBase result; if (_database == null) Init(); SyncUserInternal(userFull.ToUser(), out result); userFull.User = result; var dialog = GetDialog(new TLPeerUser { Id = userFull.User.Id }); if (dialog != null) { dialog.NotifySettings = userFull.NotifySettings; } _database.Commit(); //TLUtils.WritePerformance("SyncUserFull time: " + timer.Elapsed); callback.SafeInvoke(userFull); } public void SyncUser(TLUserBase user, Action callback) { if (user == null) { callback(null); return; } var timer = Stopwatch.StartNew(); TLUserBase result; if (_database == null) Init(); SyncUserInternal(user, out result); _database.Commit(); TLUtils.WritePerformance("SyncUser time: " + timer.Elapsed); callback(result); } public void SyncUsers(TLVector users, Action> callback) { if (users == null) { callback(new TLVector()); return; } var timer = Stopwatch.StartNew(); var result = new TLVector(); if (_database == null) Init(); SyncUsersInternal(users, result); _database.Commit(); TLUtils.WritePerformance("SyncUsers time: " + timer.Elapsed); callback(result); } public void SyncUsersAndChats(TLVector users, TLVector chats, Action, TLVector>> callback) { if (users == null && chats == null) { callback(new WindowsPhone.Tuple, TLVector>(null, null)); return; } var timer = Stopwatch.StartNew(); var usersResult = new TLVector(); var chatsResult = new TLVector(); if (_database == null) Init(); SyncUsersInternal(users, usersResult); SyncChatsInternal(chats, chatsResult); _database.Commit(); TLUtils.WritePerformance("SyncUsersAndChats time: " + timer.Elapsed); callback(new WindowsPhone.Tuple, TLVector>(usersResult, chatsResult)); } private void SyncUserInternal(TLUserBase user, out TLUserBase result) { TLUserBase cachedUser = null; if (UsersContext != null) { cachedUser = UsersContext[user.Index]; } if (cachedUser != null) { var user45 = user as TLUser45; var isMinUser = user45 != null && user45.Min; // update fields if (user.GetType() == cachedUser.GetType()) { cachedUser.Update(user); result = cachedUser; } else if (isMinUser) { result = cachedUser; } // or replace object else { _database.ReplaceUser(user.Index, user); result = user; } } else { // add object to cache result = user; _database.AddUser(user); } } private void SyncUsersInternal(TLVector users, TLVector result, IList exceptions = null) { foreach (var user in users) { try { TLUserBase cachedUser = null; if (UsersContext != null) { cachedUser = UsersContext[user.Index]; } if (cachedUser != null) { var user45 = user as TLUser45; var isMinUser = user45 != null && user45.Min; // update fields if (user.GetType() == cachedUser.GetType()) { cachedUser.Update(user); result.Add(cachedUser); } else if (isMinUser) { result.Add(cachedUser); } // or replace object else { _database.ReplaceUser(user.Index, user); result.Add(user); } } else { // add object to cache result.Add(user); _database.AddUser(user); } } catch (Exception ex) { if (exceptions != null) { exceptions.Add(new ExceptionInfo { Caption = "UpdatesService.ProcessDifference Users", Exception = ex, Timestamp = DateTime.Now }); } TLUtils.WriteException("UpdatesService.ProcessDifference Users", ex); } } } #endregion #region SecretChats private void SyncEncryptedChatInternal(TLEncryptedChatBase chat, out TLEncryptedChatBase result) { try { TLEncryptedChatBase cachedChat = null; if (EncryptedChatsContext != null) { cachedChat = EncryptedChatsContext[chat.Index]; } if (cachedChat != null) { // update fields if (chat.GetType() == cachedChat.GetType()) { cachedChat.Update(chat); result = cachedChat; } // or replace object else { var chatWaiting = cachedChat as TLEncryptedChatWaiting; if (chatWaiting != null) { var encryptedChat = chat as TLEncryptedChat; if (encryptedChat != null) { chat.A = cachedChat.A; chat.P = cachedChat.P; chat.G = cachedChat.G; if (!TLUtils.CheckGaAndGb(encryptedChat.GAorB.Data, chat.P.Data)) { result = chat; return; } var gbBytes = encryptedChat.GAorB.ToBytes(); var authKey = MTProtoService.GetAuthKey(chat.A.Data, gbBytes, chat.P.ToBytes()); chat.Key = TLString.FromBigEndianData(authKey); var authKeyFingerprint = Utils.ComputeSHA1(authKey); chat.KeyFingerprint = new TLLong(BitConverter.ToInt64(authKeyFingerprint, 12)); } else { if (cachedChat.Key != null) chat.Key = cachedChat.Key; if (cachedChat.KeyFingerprint != null) chat.KeyFingerprint = cachedChat.KeyFingerprint; } } //chat.A = cachedChat.A; //chat.P = cachedChat.P; //chat.G = cachedChat.G; //var encryptedChat = chat as TLEncryptedChat; //if (encryptedChat != null) //{ // var gbBytes = encryptedChat.GAorB.ToBytes(); // var authKey = MTProtoService.GetAuthKey(chat.A.Data, gbBytes, chat.P.ToBytes()); // chat.Key = TLString.FromBigEndianData(authKey); // var authKeyFingerprint = Utils.ComputeSHA1(authKey); // chat.KeyFingerprint = new TLLong(BitConverter.ToInt64(authKeyFingerprint, 12)); //} //else //{ // if (cachedChat.Key != null) chat.Key = cachedChat.Key; // if (cachedChat.KeyFingerprint != null) chat.KeyFingerprint = cachedChat.KeyFingerprint; //} //Helpers.Execute.ShowDebugMessage(string.Format("InMemoryCacheService.SyncEncryptedChatInternal {0}!={1}", cachedChat.GetType(), chat.GetType())); _database.ReplaceEncryptedChat(chat.Index, chat); result = chat; } } else { // add object to cache result = chat; _database.AddEncryptedChat(chat); } } catch (Exception ex) { result = null; } } public void SyncEncryptedChat(TLEncryptedChatBase encryptedChat, Action callback) { if (encryptedChat == null) { callback(null); return; } TLEncryptedChatBase chatResult; if (_database == null) Init(); SyncEncryptedChatInternal(encryptedChat, out chatResult); _database.Commit(); callback.SafeInvoke(chatResult); } public void SyncEncryptedMessagesInternal(TLInt qts, TLVector messages, TLVector result, IList exceptions = null) { foreach (var message in messages) { try { var encryptedChatBase = GetEncryptedChat(message.ChatId); var encryptedChat = encryptedChatBase as TLEncryptedChat; if (encryptedChat == null) { result.Add(message); Execute.ShowDebugMessage(string.Format("SyncEncryptedMessagesInternal skip decrypted message chatId={0} chat_type={1}", encryptedChatBase != null ? encryptedChatBase.Id.ToString() : "null", encryptedChatBase != null ? encryptedChatBase.GetType().ToString() : "null")); continue; } bool commitChat; var decryptedMessage = UpdatesService.GetDecryptedMessage(MTProtoService.Instance.CurrentUserId, encryptedChat, message, qts, out commitChat); if (commitChat) { Commit(); } if (decryptedMessage == null) { continue; } var seqNoMessage = decryptedMessage as ISeqNo; var encryptedChat17 = encryptedChat as TLEncryptedChat17; if (seqNoMessage != null && encryptedChat17 != null) { var chatRawInSeqNo = encryptedChat17.RawInSeqNo.Value; var messageRawInSeqNo = UpdatesService.GetRawInFromReceivedMessage(MTProtoService.Instance.CurrentUserId, encryptedChat17, seqNoMessage); if (chatRawInSeqNo <= messageRawInSeqNo) { if (messageRawInSeqNo > chatRawInSeqNo) { Execute.ShowDebugMessage(string.Format("SyncEncryptedMessagesInternal decrypted message gap chatId={0} chatRawInSeqNo={1} messageRawInSeqNo={2}", encryptedChat17.Id, chatRawInSeqNo, messageRawInSeqNo)); } encryptedChat17.RawInSeqNo = new TLInt(chatRawInSeqNo + 1); SyncEncryptedChat(encryptedChat17, r => { }); } else { Execute.ShowDebugMessage(string.Format("SyncEncryptedMessagesInternal skip old decrypted message chatId={0} chatRawInSeqNo={1} messageRawInSeqNo={2}", encryptedChat17.Id, chatRawInSeqNo, messageRawInSeqNo)); continue; } } Execute.BeginOnThreadPool(() => _eventAggregator.Publish(decryptedMessage)); SyncDecryptedMessage(decryptedMessage, encryptedChat, cachedMessage => { var decryptedMessageService = decryptedMessage as TLDecryptedMessageService; if (decryptedMessageService != null) { var readMessagesAction = decryptedMessageService.Action as TLDecryptedMessageActionReadMessages; if (readMessagesAction != null) { var items = GetDecryptedHistory(encryptedChat.Id.Value, 100); foreach (var randomId in readMessagesAction.RandomIds) { foreach (var item in items) { if (item.RandomId.Value == randomId.Value) { item.Status = MessageStatus.Read; if (item.TTL != null && item.TTL.Value > 0) { item.DeleteDate = new TLLong(DateTime.Now.Ticks + encryptedChat.MessageTTL.Value * TimeSpan.TicksPerSecond); } var m = item as TLDecryptedMessage17; if (m != null) { var decryptedMediaPhoto = m.Media as TLDecryptedMessageMediaPhoto; if (decryptedMediaPhoto != null) { if (decryptedMediaPhoto.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = m.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = m.Out.Value; decryptedMediaPhoto._ttlParams = ttlParams; } } var decryptedMediaVideo17 = m.Media as TLDecryptedMessageMediaVideo17; if (decryptedMediaVideo17 != null) { if (decryptedMediaVideo17.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = m.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = m.Out.Value; decryptedMediaVideo17._ttlParams = ttlParams; } } var decryptedMediaAudio17 = m.Media as TLDecryptedMessageMediaAudio17; if (decryptedMediaAudio17 != null) { if (decryptedMediaAudio17.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = m.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = m.Out.Value; decryptedMediaAudio17._ttlParams = ttlParams; } } var decryptedMediaDocument45 = m.Media as TLDecryptedMessageMediaDocument45; if (decryptedMediaDocument45 != null && (m.IsVoice() || m.IsVideo())) { if (decryptedMediaDocument45.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = m.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = m.Out.Value; decryptedMediaDocument45._ttlParams = ttlParams; } var message45 = m as TLDecryptedMessage45; if (message45 != null) { message45.SetListened(); } decryptedMediaDocument45.NotListened = false; } } break; } } } } } var isDisplayedMessage = TLUtils.IsDisplayedDecryptedMessageInternal(decryptedMessage); if (!isDisplayedMessage) { decryptedMessage.Unread = TLBool.False; } UpdatesService.ProcessPFS(MTProtoService.Instance.SendEncryptedServiceAsync, this, _eventAggregator, encryptedChat, decryptedMessageService); UpdatesService.ProcessNewLayer(MTProtoService.Instance.SendEncryptedServiceAsync, this, _eventAggregator, encryptedChat, decryptedMessage); if (decryptedMessageService != null) { var resendAction = decryptedMessageService.Action as TLDecryptedMessageActionResend; if (resendAction != null) { Execute.ShowDebugMessage(string.Format("SyncEncryptedMessagesInternal TLDecryptedMessageActionResend start_seq_no={0} end_seq_no={1}", resendAction.StartSeqNo, resendAction.EndSeqNo)); } } }); result.Add(message); } catch (Exception ex) { if (exceptions != null) { exceptions.Add(new ExceptionInfo { Caption = "UpdatesService.ProcessDifference EncryptedMessages", Exception = ex, Timestamp = DateTime.Now }); } TLUtils.WriteException("UpdatesService.ProcessDifference EncryptedMessages", ex); } } } #endregion #region Chats public void AddChats(TLVector chats, Action> callback) { if (chats == null) { callback(null); return; } if (_database == null) Init(); foreach (var chat in chats) { TLChatBase cachedChat = null; if (ChatsContext != null) { cachedChat = ChatsContext[chat.Index]; } if (cachedChat == null) { _database.AddChat(chat); } } _database.Commit(); callback.SafeInvoke(chats); } public void SyncChat(TLMessagesChatFull messagesChatFull, Action callback) { if (messagesChatFull == null) { callback(null); return; } var usersResult = new TLVector(messagesChatFull.Users.Count); var chatsResult = new TLVector(messagesChatFull.Chats.Count); var currentChat = messagesChatFull.Chats.First(x => x.Index == messagesChatFull.FullChat.Id.Value); TLChatBase chatResult; if (_database == null) Init(); SyncUsersInternal(messagesChatFull.Users, usersResult); messagesChatFull.Users = usersResult; SyncChatsInternal(messagesChatFull.Chats, chatsResult); messagesChatFull.Chats = chatsResult; SyncChatInternal(messagesChatFull.FullChat.ToChat(currentChat), out chatResult); var channel = currentChat as TLChannel; var dialog = GetDialog(channel != null ? (TLPeerBase)new TLPeerChannel { Id = messagesChatFull.FullChat.Id } : new TLPeerChat { Id = messagesChatFull.FullChat.Id }); if (dialog != null) { dialog.NotifySettings = messagesChatFull.FullChat.NotifySettings; } _database.Commit(); //TLUtils.WritePerformance("SyncChatFull time: " + timer.Elapsed); callback.SafeInvoke(messagesChatFull); } public void SyncChats(TLVector chats, Action> callback) { if (chats == null) { callback(new TLVector()); return; } var timer = Stopwatch.StartNew(); var result = new TLVector(); if (_database == null) Init(); SyncChatsInternal(chats, result); _database.Commit(); TLUtils.WritePerformance("SyncChats time: " + timer.Elapsed); callback(result); } private void SyncChatsInternal(TLVector chats, TLVector result, IList exceptions = null) { foreach (var chat in chats) { try { TLChatBase cachedChat = null; if (ChatsContext != null) { cachedChat = ChatsContext[chat.Index]; } if (cachedChat != null) { var channel49 = chat as TLChannel49; var isMinChannel = channel49 != null && channel49.Min; // update fields if (chat.GetType() == cachedChat.GetType()) { cachedChat.Update(chat); } else if (isMinChannel) { } // or replace object else { _database.ReplaceChat(chat.Index, chat); } result.Add(cachedChat); } else { // add object to cache result.Add(chat); _database.AddChat(chat); } } catch (Exception ex) { if (exceptions != null) { exceptions.Add(new ExceptionInfo { Caption = "UpdatesService.ProcessDifference Chats", Exception = ex, Timestamp = DateTime.Now }); } TLUtils.WriteException("UpdatesService.ProcessDifference Chats", ex); } } } private void SyncChatInternal(TLChatBase chat, out TLChatBase result) { TLChatBase cachedChat = null; if (ChatsContext != null) { cachedChat = ChatsContext[chat.Index]; } if (cachedChat != null) { var channel49 = chat as TLChannel49; var isMinChannel = channel49 != null && channel49.Min; // update fields if (chat.GetType() == cachedChat.GetType()) { cachedChat.Update(chat); } else if (isMinChannel) { } // or replace object else { _database.ReplaceChat(chat.Index, chat); } result = cachedChat; } else { // add object to cache result = chat; _database.AddChat(chat); } } #endregion #region Broadcasts public void SyncBroadcast(TLBroadcastChat broadcast, Action callback) { if (broadcast == null) { callback(null); return; } var timer = Stopwatch.StartNew(); TLBroadcastChat result; if (_database == null) Init(); SyncBroadcastInternal(broadcast, out result); _database.Commit(); TLUtils.WritePerformance("SyncBroadcast time: " + timer.Elapsed); callback(result); } private void SyncBroadcastInternal(TLBroadcastChat chat, out TLBroadcastChat result) { TLBroadcastChat cachedBroadcast = null; if (BroadcastsContext != null) { cachedBroadcast = BroadcastsContext[chat.Index]; } if (cachedBroadcast != null) { // update fields if (chat.GetType() == cachedBroadcast.GetType()) { cachedBroadcast.Update(chat); } // or replace object else { _database.ReplaceBroadcast(chat.Index, chat); } result = cachedBroadcast; } else { // add object to cache result = chat; _database.AddBroadcast(chat); } } #endregion #region Contacts public void AddUsers(TLVector users, Action> callback) { if (users == null) { callback(null); return; } if (_database == null) Init(); foreach (var user in users) { TLUserBase cachedUser = null; if (UsersContext != null) { cachedUser = UsersContext[user.Index]; } if (cachedUser == null) { _database.AddUser(user); } } _database.Commit(); callback.SafeInvoke(users); } public void SyncContacts(TLImportedContacts contacts, Action callback) { if (contacts == null) { callback(new TLImportedContacts69()); return; } var timer = Stopwatch.StartNew(); var result = contacts.GetEmptyObject(); if (_database == null) Init(); SyncContactsInternal(contacts, result); _database.Commit(); TLUtils.WritePerformance("SyncImportedContacts time: " + timer.Elapsed); callback(result); } public void SyncStatedMessage(TLStatedMessageBase statedMessage, Action callback) { if (statedMessage == null) { callback(null); return; } var timer = Stopwatch.StartNew(); var result = statedMessage.GetEmptyObject(); if (_database == null) Init(); SyncChatsInternal(statedMessage.Chats, result.Chats); SyncUsersInternal(statedMessage.Users, result.Users); TLMessageBase message; SyncMessageInternal(TLUtils.GetPeerFromMessage(statedMessage.Message), statedMessage.Message, out message); result.Message = message; var messageCommon = message as TLMessageCommon; if (messageCommon != null) { var dialog = GetDialog(messageCommon); if (dialog != null) { var oldMessage = dialog.Messages.FirstOrDefault(x => x.Index == message.Index); if (oldMessage != null) { dialog.Messages.Remove(oldMessage); dialog.Messages.Insert(0, message); dialog._topMessage = message; dialog.TopMessageId = message.Id; dialog.TopMessageRandomId = message.RandomId; _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, message)); } } } _database.Commit(); TLUtils.WritePerformance("SyncStatedMessage time: " + timer.Elapsed); callback(result); } public void SyncStatedMessages(TLStatedMessagesBase statedMessages, Action callback) { if (statedMessages == null) { callback(null); return; } var timer = Stopwatch.StartNew(); var result = statedMessages.GetEmptyObject(); if (_database == null) Init(); SyncChatsInternal(statedMessages.Chats, result.Chats); SyncUsersInternal(statedMessages.Users, result.Users); foreach (var m in statedMessages.Messages) { TLMessageBase message; SyncMessageInternal(TLUtils.GetPeerFromMessage(m), m, out message); result.Messages.Add(message); } _database.Commit(); TLUtils.WritePerformance("SyncStatedMessages time: " + timer.Elapsed); callback(result); } public void UpdateDialogPinned(TLPeerBase peer, bool pinned) { if (_database == null) Init(); _database.UpdateDialogPinned(peer, pinned); _database.Commit(); } public void UpdatePinnedDialogs(TLVector order) { if (_database == null) Init(); _database.Commit(); } public TLProxyDataBase GetProxyData() { if (_database == null) Init(); return _database.ProxyData; } public void UpdateProxyData(TLProxyDataBase proxyData) { if (_database == null) Init(); _database.UpdateProxyData(proxyData); _database.Commit(); } public void UpdateChannelAvailableMessages(TLInt channelId, TLInt availableMinId) { if (_database == null) Init(); _database.UpdateChannelAvailableMessages(new TLPeerChannel { Id = channelId }, availableMinId); _database.Commit(); } public void UpdateDialogPromo(TLDialogBase dialogBase, bool promo) { if (_database == null) Init(); _database.UpdateDialogPromo(dialogBase, promo); _database.Commit(); } public void DeleteDialog(TLDialogBase dialog) { if (dialog != null) { _database.DeleteDialog(dialog); _database.Commit(); } } public void ClearDialog(TLPeerBase peer) { if (peer != null) { _database.ClearDialog(peer); _database.Commit(); } } public void DeleteUser(TLInt id) { _database.DeleteUser(id); _database.Commit(); } public void DeleteChat(TLInt id) { _database.DeleteChat(id); _database.Commit(); } public void DeleteMessages(TLVector randomIds) { if (randomIds == null || randomIds.Count == 0) return; foreach (var id in randomIds) { var message = _database.RandomMessagesContext[id.Value]; if (message != null) { var peer = TLUtils.GetPeerFromMessage(message); if (peer != null) { _database.DeleteMessage(message); } } } _database.Commit(); } public void DeleteDecryptedMessages(TLVector randomIds) { foreach (var id in randomIds) { var message = _database.DecryptedMessagesContext[id.Value]; if (message != null) { var peer = TLUtils.GetPeerFromMessage(message); if (peer != null) { _database.DeleteDecryptedMessage(message, peer); } } } _database.Commit(); } public void ClearDecryptedHistoryAsync(TLInt chatId) { _database.ClearDecryptedHistory(chatId); _database.Commit(); } public void ClearBroadcastHistoryAsync(TLInt chatId) { _database.ClearBroadcastHistory(chatId); _database.Commit(); } public void DeleteMessages(TLPeerBase peer, TLMessageBase lastItem, TLVector messages) { if (messages == null || messages.Count == 0) return; _database.DeleteMessages(peer, lastItem, messages); _database.Commit(); } public void DeleteMessages(TLVector ids) { if (ids == null || ids.Count == 0) return; foreach (var id in ids) { var message = _database.MessagesContext[id.Value]; if (message != null) { _database.DeleteMessage(message); } } _database.Commit(); } public void DeleteUserHistory(TLPeerChannel channel, TLPeerUser user) { if (channel == null || user == null) return; _database.DeleteUserHistory(channel, user); _database.Commit(); } public void DeleteChannelMessages(TLInt channelId, TLVector ids) { if (ids == null || ids.Count == 0) return; var channelContext = _database.ChannelsContext[channelId.Value]; if (channelContext != null) { var peer = new TLPeerChannel { Id = channelId }; var messages = new List(); foreach (var id in ids) { var message = channelContext[id.Value]; if (message != null) { messages.Add(message); } } _database.DeleteMessages(messages, peer); } _database.Commit(); } private void SyncContactsInternal(TLImportedContacts contacts, TLImportedContacts result) { var cache = contacts.Users.ToDictionary(x => x.Index); foreach (var importedContact in contacts.Imported) { if (cache.ContainsKey(importedContact.UserId.Value)) { cache[importedContact.UserId.Value].ClientId = importedContact.ClientId; } } foreach (var user in contacts.Users) { TLUserBase cachedUser = null; if (UsersContext != null) { cachedUser = UsersContext[user.Index]; } if (cachedUser != null) { var user45 = user as TLUser45; var isMinUser = user45 != null && user45.Min; // update fields if (user.GetType() == cachedUser.GetType()) { cachedUser.Update(user); result.Users.Add(cachedUser); } else if (isMinUser) { result.Users.Add(cachedUser); } // or replace object else { _database.ReplaceUser(user.Index, user); result.Users.Add(user); } } else { // add object to cache result.Users.Add(user); _database.AddUser(user); } } result.Imported = contacts.Imported; } public void SyncContacts(TLContactsBase contacts, Action callback) { if (contacts == null) { callback(new TLContacts()); return; } if (contacts is TLContactsNotModified) { callback(contacts); return; } var timer = Stopwatch.StartNew(); var result = contacts.GetEmptyObject(); if (_database == null) Init(); SyncContactsInternal((TLContacts)contacts, (TLContacts)result); _database.Commit(); TLUtils.WritePerformance("SyncContacts time: " + timer.Elapsed); callback(result); } private void SyncContactsInternal(TLContacts contacts, TLContacts result) { var contactsCache = new Dictionary(); foreach (var contact in contacts.Contacts) { contactsCache[contact.UserId.Value] = contact; } foreach (var user in contacts.Users) { user.Contact = contactsCache[user.Index]; TLUserBase cachedUser = null; if (UsersContext != null) { cachedUser = UsersContext[user.Index]; } if (cachedUser != null) { var user45 = user as TLUser45; var isMinUser = user45 != null && user45.Min; // update fields if (user.GetType() == cachedUser.GetType()) { cachedUser.Update(user); result.Users.Add(cachedUser); } else if (isMinUser) { result.Users.Add(cachedUser); } // or replace object else { _database.ReplaceUser(user.Index, user); result.Users.Add(user); } } else { // add object to cache result.Users.Add(user); _database.AddUser(user); } } result.Contacts = contacts.Contacts; } #endregion #region Config private TLCdnConfig _cdnConfig; private readonly object _cdnConfigSyncRoot = new object(); public void GetCdnConfigAsync(Action callback) { if (_cdnConfig == null) { _cdnConfig = TLUtils.OpenObjectFromMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName); } callback.SafeInvoke(_cdnConfig); } public TLCdnConfig GetCdnConfig() { if (_cdnConfig == null) { _cdnConfig = TLUtils.OpenObjectFromMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName); } return _cdnConfig; } public void SetCdnCofig(TLCdnConfig cdnConfig) { _cdnConfig = cdnConfig; TLUtils.SaveObjectToMTProtoFile(_cdnConfigSyncRoot, Constants.CdnConfigFileName, _cdnConfig); } private TLConfig _config; public TLConfig GetConfig() { #if SILVERLIGHT || WIN_RT if (_config == null) { _config = SettingsHelper.GetValue(Constants.ConfigKey) as TLConfig; } #endif return _config; } public void GetConfigAsync(Action callback) { GetConfig(); callback.SafeInvoke(_config); } public void SetConfig(TLConfig config) { _config = config; #if SILVERLIGHT || WIN_RT SettingsHelper.SetValue(Constants.ConfigKey, config); #endif } public void ClearConfigImportAsync() { GetConfigAsync(config => { foreach (var option in config.DCOptions) { option.IsAuthorized = false; //if (config.ThisDC.Value != option.Id.Value) //{ // option.IsAuthorized = false; //} //else //{ // option.IsAuthorized = true; //} } SetConfig(config); }); } #endregion public IList GetSendingMessages() { return RandomMessagesContext.Values.ToList(); } public IList GetResendingMessages() { return _database.ResendingMessages; } public IList GetMessages() { var result = new List(); foreach (var d in _database.Dialogs) { var dialog = d as TLDialog; if (dialog != null) { foreach (var message in dialog.Messages) { result.Add(message); } } else { //var encryptedDialog = d as TLEncryptedDialog; //if (encryptedDialog != null) //{ // foreach (var message in encryptedDialog.Messages) // { // result.Add(message); // } //} } } return result; } public void Commit() { if (_database != null) { _database.Commit(); } } public void CompressAsync(Action callback) { if (_database != null) { Execute.BeginOnThreadPool(() => { _database.Compress(); callback.SafeInvoke(); }); } } public void ClearLocalFileNames() { if (_database != null) { _database.ClearLocalFileNames(); } } public bool TryCommit() { if (_database != null && _database.HasChanges) { _database.CommitInternal(); //Helpers.Execute.ShowDebugMessage("TryCommit result=true"); return true; } return false; } public void SaveSnapshot(string toDirectoryName) { if (_database != null) { _database.SaveSnapshot(toDirectoryName); } } public void SaveTempSnapshot(string toDirectoryName) { if (_database != null) { _database.SaveTempSnapshot(toDirectoryName); } } public void LoadSnapshot(string fromDirectoryName) { if (_database != null) { _database.LoadSnapshot(fromDirectoryName); _database.Open(); } } } } ================================================ FILE: Telegram.Api/Services/Cache/InMemoryDatabase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reactive.Linq; using System.Threading; using System.Threading.Tasks; using Org.BouncyCastle.Security; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.Services.Cache.EventArgs; using Telegram.Api.TL; namespace Telegram.Api.Services.Cache { public class InMemoryDatabase : IDisposable { private volatile bool _isOpened; public const string ProxyDataMTProtoFileName = "proxy_data.dat"; public const string DialogsMTProtoFileName = "dialogs.dat"; public const string UsersMTProtoFileName = "users.dat"; public const string ChatsMTProtoFileName = "chats.dat"; public const string BroadcastsMTProtoFileName = "broadcasts.dat"; public const string EncryptedChatsMTProtoFileName = "encryptedChats.dat"; public const string TempProxyDataMTProtoFileName = "temp_proxy_data.dat"; public const string TempDialogsMTProtoFileName = "temp_dialogs.dat"; public const string TempUsersMTProtoFileName = "temp_users.dat"; public const string TempChatsMTProtoFileName = "temp_chats.dat"; public const string TempBroadcastsMTProtoFileName = "temp_broadcasts.dat"; public const string TempEncryptedChatsMTProtoFileName = "temp_encryptedChats.dat"; private readonly object _proxyDataSyncRoot = new object(); private readonly object _dialogsFileSyncRoot = new object(); private readonly object _usersSyncRoot = new object(); private readonly object _chatsSyncRoot = new object(); private readonly object _broadcastsSyncRoot = new object(); private readonly object _encryptedChatsSyncRoot = new object(); public Context MessagesContext = new Context(); public Context> ChannelsContext = new Context>(); public Context DecryptedMessagesContext = new Context(); public Context RandomMessagesContext = new Context(); public Context DialogsContext = new Context(); public Context UsersContext = new Context(); public Context ChatsContext = new Context(); public Context BroadcastsContext = new Context(); public Context EncryptedChatsContext = new Context(); public TLProxyDataBase ProxyData { get; set; } private readonly object _dialogsSyncRoot = new object(); public ObservableCollection Dialogs { get; set; } private readonly ITelegramEventAggregator _eventAggregator; private readonly IDisposable _commitSubscription; public volatile bool HasChanges; public InMemoryDatabase(ITelegramEventAggregator eventAggregator) { var commitEvents = Observable.FromEventPattern( keh => { CommitInvoked += keh; }, keh => { CommitInvoked -= keh; }); _commitSubscription = commitEvents .Throttle(TimeSpan.FromSeconds(Constants.CommitDBInterval)) .Subscribe(e => CommitInternal()); //commitEvents.Publish() Dialogs = new ObservableCollection(); _eventAggregator = eventAggregator; } public void AddDialog(TLDialog dialog) { if (dialog != null) { DialogsContext[dialog.Index] = dialog; var topMessage = (TLMessageCommon)dialog.TopMessage; // add in desc order by Date var isAdded = false; lock (_dialogsSyncRoot) { for (var i = 0; i < Dialogs.Count; i++) { var d = Dialogs[i] as TLDialog; var ed = Dialogs[i] as TLEncryptedDialog; if (d != null) { var currentDateIndex = d.GetDateIndex(); if (currentDateIndex != 0 && currentDateIndex < dialog.GetDateIndex()) { isAdded = true; Dialogs.Insert(i, dialog); break; } } else if (ed != null) { var currentDateIndex = ed.GetDateIndex(); if (currentDateIndex != 0 && currentDateIndex < dialog.GetDateIndex()) { isAdded = true; Dialogs.Insert(i, dialog); break; } } } if (!isAdded) { Dialogs.Add(dialog); } } //sync topMessage AddMessageToContext(topMessage); //MessagesContext[topMessage.Index] = topMessage; } } //private TLMessageBase GetMessageFromContext(long commonId) //{ // if (RandomMessagesContext.ContainsKey(commonId)) // { // return RandomMessagesContext[commonId]; // } // if (MessagesContext.ContainsKey(commonId)) // { // return MessagesContext[commonId]; // } // return null; //} public void RemoveMessageFromContext(TLMessageBase message) { if (message.Index != 0) { TLPeerChannel peerChannel; if (TLUtils.IsChannelMessage(message, out peerChannel)) { var channelContext = ChannelsContext[peerChannel.Id.Value]; if (channelContext != null) { channelContext.Remove(message.Index); } } else { MessagesContext.Remove(message.Index); } } if (message.RandomIndex != 0) { RandomMessagesContext.Remove(message.RandomIndex); } } public void RemoveDecryptedMessageFromContext(TLDecryptedMessageBase message) { if (message.RandomIndex != 0) { DecryptedMessagesContext.Remove(message.RandomIndex); } //if (message.RandomIndex != 0) //{ // RandomMessagesContext.Remove(message.RandomIndex); //} } public void AddMessageToContext(TLMessageBase message) { if (message.Index != 0) { TLPeerChannel peerChannel; if (TLUtils.IsChannelMessage(message, out peerChannel)) { var channelContext = ChannelsContext[peerChannel.Id.Value]; if (channelContext == null) { channelContext = new Context(); ChannelsContext[peerChannel.Id.Value] = channelContext; } channelContext[message.Index] = message; } else { MessagesContext[message.Index] = message; } } else if (message.RandomIndex != 0) { RandomMessagesContext[message.RandomIndex] = message; } else { Execute.ShowDebugMessage("MsgId and RandomMsgId are zero"); //throw new Exception("MsgId and RandomMsgId are zero"); } } public void AddDecryptedMessageToContext(TLDecryptedMessageBase message) { if (message.RandomIndex != 0) { DecryptedMessagesContext[message.RandomIndex] = message; } else { throw new Exception("RandomId is zero for DecryptedMessage"); } } public void AddUser(TLUserBase user) { if (user != null) { UsersContext[user.Index] = user; } } public void AddChat(TLChatBase chat) { if (chat != null) { ChatsContext[chat.Index] = chat; } } public void AddEncryptedChat(TLEncryptedChatBase chat) { if (chat != null) { EncryptedChatsContext[chat.Index] = chat; } } public void AddBroadcast(TLBroadcastChat broadcast) { if (broadcast != null) { BroadcastsContext[broadcast.Index] = broadcast; } } public void SaveSnapshot(string toDirectoryName) { var timer = Stopwatch.StartNew(); CopyInternal(_usersSyncRoot, UsersMTProtoFileName, Path.Combine(toDirectoryName, UsersMTProtoFileName)); CopyInternal(_chatsSyncRoot, ChatsMTProtoFileName, Path.Combine(toDirectoryName, ChatsMTProtoFileName)); CopyInternal(_broadcastsSyncRoot, BroadcastsMTProtoFileName, Path.Combine(toDirectoryName, BroadcastsMTProtoFileName)); CopyInternal(_encryptedChatsSyncRoot, EncryptedChatsMTProtoFileName, Path.Combine(toDirectoryName, EncryptedChatsMTProtoFileName)); CopyInternal(_dialogsFileSyncRoot, DialogsMTProtoFileName, Path.Combine(toDirectoryName, DialogsMTProtoFileName)); CopyInternal(_proxyDataSyncRoot, ProxyDataMTProtoFileName, Path.Combine(toDirectoryName, ProxyDataMTProtoFileName)); TLUtils.WritePerformance("Save DB snapshot time: " + timer.Elapsed); } public void SaveTempSnapshot(string toDirectoryName) { var timer = Stopwatch.StartNew(); CopyInternal(_usersSyncRoot, TempUsersMTProtoFileName, Path.Combine(toDirectoryName, UsersMTProtoFileName)); CopyInternal(_chatsSyncRoot, TempChatsMTProtoFileName, Path.Combine(toDirectoryName, ChatsMTProtoFileName)); CopyInternal(_broadcastsSyncRoot, TempBroadcastsMTProtoFileName, Path.Combine(toDirectoryName, BroadcastsMTProtoFileName)); CopyInternal(_encryptedChatsSyncRoot, TempEncryptedChatsMTProtoFileName, Path.Combine(toDirectoryName, EncryptedChatsMTProtoFileName)); CopyInternal(_dialogsFileSyncRoot, TempDialogsMTProtoFileName, Path.Combine(toDirectoryName, DialogsMTProtoFileName)); CopyInternal(_proxyDataSyncRoot, TempProxyDataMTProtoFileName, Path.Combine(toDirectoryName, ProxyDataMTProtoFileName)); TLUtils.WritePerformance("Save DB snapshot time: " + timer.Elapsed); } private void CopyInternal(object syncRoot, string fileName, string destinationFileName) { FileUtils.Copy(syncRoot, fileName, destinationFileName); } public void LoadSnapshot(string fromDirectoryName) { var timer = Stopwatch.StartNew(); CopyInternal(_usersSyncRoot, Path.Combine(fromDirectoryName, UsersMTProtoFileName), UsersMTProtoFileName); CopyInternal(_chatsSyncRoot, Path.Combine(fromDirectoryName, ChatsMTProtoFileName), ChatsMTProtoFileName); CopyInternal(_broadcastsSyncRoot, Path.Combine(fromDirectoryName, BroadcastsMTProtoFileName), BroadcastsMTProtoFileName); CopyInternal(_encryptedChatsSyncRoot, Path.Combine(fromDirectoryName, EncryptedChatsMTProtoFileName), EncryptedChatsMTProtoFileName); CopyInternal(_dialogsFileSyncRoot, Path.Combine(fromDirectoryName, DialogsMTProtoFileName), DialogsMTProtoFileName); CopyInternal(_proxyDataSyncRoot, Path.Combine(fromDirectoryName, ProxyDataMTProtoFileName), ProxyDataMTProtoFileName); TLUtils.WritePerformance("Load DB snapshot time: " + timer.Elapsed); } public void Clear() { var timer = Stopwatch.StartNew(); Dialogs.Clear(); UsersContext.Clear(); ChatsContext.Clear(); BroadcastsContext.Clear(); EncryptedChatsContext.Clear(); DialogsContext.Clear(); ProxyData = null; ClearInternal(_usersSyncRoot, UsersMTProtoFileName); ClearInternal(_chatsSyncRoot, ChatsMTProtoFileName); ClearInternal(_broadcastsSyncRoot, BroadcastsMTProtoFileName); ClearInternal(_encryptedChatsSyncRoot, EncryptedChatsMTProtoFileName); ClearInternal(_dialogsFileSyncRoot, DialogsMTProtoFileName); ClearInternal(_proxyDataSyncRoot, ProxyDataMTProtoFileName); TLUtils.WritePerformance("Clear DB time: " + timer.Elapsed); } private void ClearInternal(object syncRoot, string fileName) { FileUtils.Delete(syncRoot, fileName); } private void AddDecryptedMessageCommon(TLDecryptedMessageBase message, TLEncryptedChatBase p, bool notifyNewDialogs, Func, bool> insertAction) { if (message != null) { AddDecryptedMessageToContext(message); var isUnread = !message.Out.Value && message.Unread.Value; var dialog = GetEncryptedDialog(message); if (dialog != null) { if (dialog.Messages.Count > 0) { var isAdded = insertAction(dialog.Messages); if (!isAdded) { dialog.Messages.Add(message); } } else { dialog.Messages.Add(message); } if (isUnread) { var isDisplayedMessage = TLUtils.IsDisplayedDecryptedMessage(message); if (isDisplayedMessage) { dialog.UnreadCount = new TLInt(dialog.UnreadCount.Value + 1); } } CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); if (dialog.Messages[0] == message) { dialog.TopMessage = message; dialog.TopDecryptedMessageRandomId = message.RandomId; if (_eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, message)); } } } else { var currentUserId = MTProtoService.Instance.CurrentUserId; TLInt withId; TLObject with = null; var encryptedChatCommmon = p as TLEncryptedChatCommon; if (encryptedChatCommmon != null) { withId = encryptedChatCommmon.AdminId.Value == currentUserId.Value ? encryptedChatCommmon.ParticipantId : encryptedChatCommmon.AdminId; with = UsersContext[withId.Value]; } TLPeerBase peer = new TLPeerEncryptedChat { Id = message.ChatId }; int index = 0; var addingDialog = new TLEncryptedDialog { Peer = peer, With = with, Messages = new ObservableCollection { message }, TopDecryptedMessageRandomId = message.RandomId, TopMessage = message, UnreadCount = isUnread ? new TLInt(1) : new TLInt(0) }; lock (_dialogsSyncRoot) { for (var i = 0; i < Dialogs.Count; i++) { if (Dialogs[i].GetDateIndex() < message.DateIndex) { index = i; break; } } Dialogs.Insert(index, addingDialog); DialogsContext[addingDialog.Index] = addingDialog; } if (_eventAggregator != null && notifyNewDialogs) { _eventAggregator.Publish(new DialogAddedEventArgs(addingDialog)); } } } else { throw new NotImplementedException(); } } private void CorrectDialogOrder(TLDialogBase dialog, int dateIndex, int messageId) { var isInserted = false; lock (_dialogsSyncRoot) { Dialogs.Remove(dialog); for (var i = 0; i < Dialogs.Count; i++) { if (Dialogs[i].GetDateIndex() < dateIndex) { Dialogs.Insert(i, dialog); isInserted = true; break; } // в бродкастах дата у всех сообщений совпадает: правильный порядок можно определить по индексу сообщения if (Dialogs[i].GetDateIndex() == dateIndex) { var currentMessageId = Dialogs[i].TopMessageId != null ? Dialogs[i].TopMessageId.Value : 0; if (currentMessageId != 0 && messageId != 0) { if (currentMessageId < messageId) { Dialogs.Insert(i, dialog); isInserted = true; break; } Dialogs.Insert(i + 1, dialog); isInserted = true; break; } } } if (!isInserted) { Dialogs.Add(dialog); } } } private void AddMessageCommon(TLMessageBase message, bool notifyNewDialogs, bool notifyTopMessageUpdated, Func, bool> insertAction) { if (message != null) { AddMessageToContext(message); var commonMessage = message as TLMessageCommon; if (commonMessage != null) { var message70 = commonMessage as TLMessage70; var isUnread = !commonMessage.Out.Value && commonMessage.Unread.Value; var isUnreadMention = isUnread && message70 != null && message70.IsMention && message70.FwdHeader == null; var dialogBase = GetDialog(commonMessage); if (dialogBase != null) { var dialog = dialogBase as TLDialog; if (dialog != null) { if (dialog.Messages.Count > 0) { var isAdded = insertAction(dialog.Messages); if (!isAdded) { dialog.Messages.Add(commonMessage); } } else { dialog.Messages.Add(commonMessage); } if (isUnread && dialog.TopMessage != null && dialog.TopMessage.Index < commonMessage.Index) { dialogBase.UnreadCount = new TLInt(dialogBase.UnreadCount.Value + 1); if (isUnreadMention) { var dialog71 = dialogBase as TLDialog71; if (dialog71 != null) { dialog71.UnreadMentionsCount = new TLInt(dialog71.UnreadMentionsCount.Value + 1); } } } if (dialog.TopMessage != null) { CorrectDialogOrder(dialogBase, dialog.GetDateIndex(), dialog.TopMessage.Index); } if (dialog.Messages[0] == commonMessage) { if (notifyTopMessageUpdated) { dialog._topMessage = commonMessage; Helpers.Execute.BeginOnUIThread(() => dialog.NotifyOfPropertyChange(() => dialog.TopMessage)); } else { dialog._topMessage = commonMessage; } dialog.TopMessageId = commonMessage.Id; dialog.TopMessageRandomId = commonMessage.RandomId; if (_eventAggregator != null && notifyTopMessageUpdated) { Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, commonMessage))); } } } var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { if (broadcast.Messages.Count > 0) { var isAdded = insertAction(broadcast.Messages); if (!isAdded) { broadcast.Messages.Add(commonMessage); } } else { broadcast.Messages.Add(commonMessage); } if (isUnread && broadcast.TopMessage != null && broadcast.TopMessage.Index < commonMessage.Index) { dialogBase.UnreadCount = new TLInt(dialogBase.UnreadCount.Value + 1); } if (broadcast.TopMessage != null) { CorrectDialogOrder(dialogBase, broadcast.GetDateIndex(), broadcast.TopMessage.Index); } if (broadcast.Messages[0] == commonMessage) { if (notifyTopMessageUpdated) { broadcast._topMessage = commonMessage; Helpers.Execute.BeginOnUIThread(() => broadcast.NotifyOfPropertyChange(() => broadcast.TopMessage)); } else { broadcast._topMessage = commonMessage; } broadcast.TopMessageId = commonMessage.Id; broadcast.TopMessageRandomId = commonMessage.RandomId; if (_eventAggregator != null && notifyTopMessageUpdated) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, commonMessage)); } } } } else { TLObject with; TLPeerBase peer; if (commonMessage.ToId is TLPeerChannel) { peer = commonMessage.ToId; } else if (commonMessage.ToId is TLPeerBroadcast) { peer = commonMessage.ToId; } else if (commonMessage.ToId is TLPeerChat) { peer = commonMessage.ToId; } else { if (commonMessage.Out.Value) { peer = commonMessage.ToId; } else { peer = new TLPeerUser { Id = commonMessage.FromId }; } } if (peer is TLPeerChannel) { with = ChatsContext[peer.Id.Value]; } else if (peer is TLPeerBroadcast) { with = BroadcastsContext[peer.Id.Value]; } else if (peer is TLPeerChat) { with = ChatsContext[peer.Id.Value]; } else { with = UsersContext[peer.Id.Value]; } int index = 0; TLDialogBase addingDialog; if (peer is TLPeerBroadcast) { addingDialog = new TLBroadcastDialog { Peer = peer, With = with, Messages = new ObservableCollection { commonMessage }, TopMessageId = commonMessage.Id, TopMessageRandomId = commonMessage.RandomId, TopMessage = commonMessage, UnreadCount = isUnread ? new TLInt(1) : new TLInt(0) }; } else if (peer is TLPeerChannel) { addingDialog = new TLDialog71 { Flags = new TLInt(0), Peer = peer, With = with, Messages = new ObservableCollection { commonMessage }, TopMessageId = commonMessage.Id, TopMessageRandomId = commonMessage.RandomId, TopMessage = commonMessage, UnreadCount = isUnread ? new TLInt(1) : new TLInt(0), UnreadMentionsCount = isUnreadMention ? new TLInt(1) : new TLInt(0), ReadInboxMaxId = new TLInt(0), ReadOutboxMaxId = new TLInt(0), Pts = new TLInt(0) }; } else { addingDialog = new TLDialog71 { Flags = new TLInt(0), Peer = peer, With = with, Messages = new ObservableCollection { commonMessage }, TopMessageId = commonMessage.Id, TopMessageRandomId = commonMessage.RandomId, TopMessage = commonMessage, UnreadCount = isUnread ? new TLInt(1) : new TLInt(0), UnreadMentionsCount = isUnreadMention ? new TLInt(1) : new TLInt(0), ReadInboxMaxId = new TLInt(0), ReadOutboxMaxId = new TLInt(0) }; } lock (_dialogsSyncRoot) { for (var i = 0; i < Dialogs.Count; i++) { if (Dialogs[i].GetDateIndex() < message.DateIndex) { index = i; break; } } Dialogs.Insert(index, addingDialog); DialogsContext[addingDialog.Index] = addingDialog; } if (_eventAggregator != null && notifyNewDialogs) { _eventAggregator.Publish(new DialogAddedEventArgs(addingDialog)); } } } } else { } } private TLEncryptedDialog GetEncryptedDialog(TLInt id) { lock (_dialogsSyncRoot) { foreach (var d in Dialogs) { if (d.Peer is TLPeerEncryptedChat && d.Peer.Id.Value == id.Value) { return d as TLEncryptedDialog; } } } return null; } private TLEncryptedDialog GetEncryptedDialog(TLEncryptedChatBase peer) { lock (_dialogsSyncRoot) { foreach (var d in Dialogs) { if (d.Peer is TLPeerEncryptedChat && d.Peer.Id.Value == peer.Id.Value) { return d as TLEncryptedDialog; } } } return null; } private TLEncryptedDialog GetEncryptedDialog(TLDecryptedMessageBase commonMessage) { lock (_dialogsSyncRoot) { foreach (var d in Dialogs) { if (d.Peer is TLPeerEncryptedChat //&& message.ToId is TLPeerChat && d.Peer.Id.Value == commonMessage.ChatId.Value) { return d as TLEncryptedDialog; } } //dialog = Dialogs.FirstOrDefault(x => x.WithId == peer.Id.Value && x.IsChat == peer is TLPeerChat); } return null; } public TLDialogBase GetDialog(TLPeerBase peer) { TLDialogBase result = null; lock (_dialogsSyncRoot) { foreach (var d in Dialogs) { if (d.Peer.Id.Value == peer.Id.Value) { if (d.Peer is TLPeerChannel && peer is TLPeerChannel) { result = d as TLDialog; if (result != null) break; } if (d.Peer is TLPeerChat && peer is TLPeerChat) { result = d as TLDialog; if (result != null) break; } if (d.Peer is TLPeerUser && peer is TLPeerUser) { result = d as TLDialog; if (result != null) break; } if (d.Peer is TLPeerBroadcast && peer is TLPeerBroadcast) { result = d as TLBroadcastDialog; if (result != null) break; } } } } return result; } private TLDialogBase GetDialog(TLMessageCommon commonMessage) { lock (_dialogsSyncRoot) { foreach (var d in Dialogs) { if (d.Peer is TLPeerChat && commonMessage.ToId is TLPeerChat && d.Peer.Id.Value == commonMessage.ToId.Id.Value) { return d as TLDialog; } if (d.Peer is TLPeerUser && commonMessage.ToId is TLPeerUser && commonMessage.Out.Value && d.Peer.Id.Value == commonMessage.ToId.Id.Value) { return d as TLDialog; } if (d.Peer is TLPeerUser && commonMessage.ToId is TLPeerUser && !commonMessage.Out.Value && d.Peer.Id.Value == commonMessage.FromId.Value) { return d as TLDialog; } if (d.Peer is TLPeerBroadcast && commonMessage.ToId is TLPeerBroadcast && d.Peer.Id.Value == commonMessage.ToId.Id.Value) { return d as TLBroadcastDialog; } if (d.Peer is TLPeerChannel && commonMessage.ToId is TLPeerChannel && d.Peer.Id.Value == commonMessage.ToId.Id.Value) { return d as TLDialogBase; } } //dialog = Dialogs.FirstOrDefault(x => x.WithId == peer.Id.Value && x.IsChat == peer is TLPeerChat); } return null; } public void UpdateSendingMessageContext(TLMessageBase message) { RemoveMessageFromContext(message); message.RandomId = null; AddMessageToContext(message); } public void UpdateSendingMessage(TLMessageBase message, TLMessageBase cachedMessage) { RemoveMessageFromContext(cachedMessage); cachedMessage.Update(message); cachedMessage.RandomId = null; AddMessageToContext(cachedMessage); var commonMessage = message as TLMessageCommon; if (commonMessage == null) { return; } var dialog = GetDialog(commonMessage) as TLDialog; if (dialog != null) { bool notify = false; lock (dialog.MessagesSyncRoot) { var oldMessage = dialog.Messages.FirstOrDefault(x => x.Index == cachedMessage.Index); if (oldMessage != null) { dialog.Messages.Remove(oldMessage); TLDialog.InsertMessageInOrder(dialog.Messages, cachedMessage); if (dialog.TopMessageId == null || dialog.TopMessageId.Value < cachedMessage.Index) { dialog._topMessage = cachedMessage; dialog.TopMessageId = cachedMessage.Id; dialog.TopMessageRandomId = cachedMessage.RandomId; notify = true; } } } if (notify) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, cachedMessage)); } } } public void UpdateSendingDecryptedMessage(TLInt chatId, TLInt date, TLDecryptedMessageBase cachedMessage) { RemoveDecryptedMessageFromContext(cachedMessage); cachedMessage.Date = date; AddDecryptedMessageToContext(cachedMessage); var dialog = GetEncryptedDialog(chatId); if (dialog != null) { var oldMessage = dialog.Messages.FirstOrDefault(x => x.RandomIndex == cachedMessage.RandomIndex); if (oldMessage != null) { dialog.Messages.Remove(oldMessage); TLEncryptedDialog.InsertMessageInOrder(dialog.Messages, cachedMessage); if (dialog.TopDecryptedMessageRandomId == null || dialog.TopDecryptedMessageRandomId.Value != cachedMessage.RandomIndex) { dialog._topMessage = cachedMessage; dialog.TopDecryptedMessageRandomId = cachedMessage.RandomId; _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, cachedMessage)); } } } } public void AddSendingMessage(TLMessageBase message, TLMessageBase previousMessage) { AddMessageCommon( message, true, true, messages => { if (previousMessage == null) { messages.Insert(0, message); return true; } for (var i = 0; i < messages.Count; i++) { if (messages[i] == previousMessage) { messages.Insert(i, message); return true; } } if (previousMessage.Index > 0) { for (var i = 0; i < messages.Count; i++) { if (messages[i].Index > 0 && previousMessage.Index > messages[i].Index) { messages.Insert(i, message); return true; } } } else { for (var i = 0; i < messages.Count; i++) { if (messages[i].DateIndex > 0 && previousMessage.DateIndex > messages[i].DateIndex) { messages.Insert(i, message); return true; } } } return false; }); } public void AddSendingMessage(TLMessageBase message, TLMessageBase previousMessage, bool notifyNewDialog, bool notifyTopMessageUpdated) { AddMessageCommon( message, notifyNewDialog, notifyTopMessageUpdated, messages => { if (previousMessage == null) { messages.Insert(0, message); return true; } for (var i = 0; i < messages.Count; i++) { if (messages[i] == previousMessage) { messages.Insert(i, message); return true; } } return false; }); } public void AddDecryptedMessage(TLDecryptedMessageBase message, TLEncryptedChatBase peer, bool notifyNewDialogs = true) { AddDecryptedMessageCommon( message, peer, notifyNewDialogs, messages => { for (var i = 0; i < messages.Count; i++) { if (messages[i].DateIndex < message.DateIndex) { messages.Insert(i, message); return true; } if (messages[i].DateIndex == message.DateIndex) { // TODO: fix for randomId and id (messages[i] has only randomId) //if (messages[i].RandomIndex == 0) //{ // messages.Insert(i, message); // return true; //} //if (messages[i].RandomIndex < message.RandomIndex) //{ // messages.Insert(i, message); // return true; //} if (messages[i].RandomIndex == message.RandomIndex) { return true; } messages.Insert(i, message); return true; } } return false; }); } public void AddMessage(TLMessageBase message, bool notifyNewDialogs = true, bool notifyNewMessageUpdated = true) { AddMessageCommon( message, notifyNewDialogs, notifyNewMessageUpdated, messages => { for (var i = 0; i < messages.Count; i++) { if (messages[i].DateIndex < message.DateIndex) { messages.Insert(i, message); return true; } if (messages[i].DateIndex == message.DateIndex) { // TODO: fix for randomId and id (messages[i] can has only randomId) if (messages[i].Index == 0) { messages.Insert(i, message); return true; } if (messages[i].Index < message.Index) { messages.Insert(i, message); return true; } if (messages[i].Index == message.Index) { if (messages[i].GetType() != message.GetType()) { messages[i] = message; } return true; } } } return false; }); } public void ClearDecryptedHistory(TLInt chatId) { var dialog = DialogsContext[chatId.Value] as TLEncryptedDialog; if (dialog != null) { lock (_dialogsSyncRoot) { foreach (var message in dialog.Messages) { RemoveDecryptedMessageFromContext(message); } dialog.Messages.Clear(); var chat = (TLEncryptedChatCommon)InMemoryCacheService.Instance.GetEncryptedChat(chatId); var lastMessage = new TLDecryptedMessageService { RandomId = TLLong.Random(), RandomBytes = TLString.Random(Constants.MinRandomBytesLength), ChatId = chat.Id, Action = new TLDecryptedMessageActionEmpty(), FromId = MTProtoService.Instance.CurrentUserId, Date = chat.Date, Out = new TLBool(false), Unread = new TLBool(false), Status = MessageStatus.Read }; dialog.UnreadCount = new TLInt(0); dialog.Messages.Add(lastMessage); AddDecryptedMessageToContext(lastMessage); dialog.TopMessage = lastMessage; dialog.TopDecryptedMessageRandomId = lastMessage.RandomId; CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); } if (_eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, dialog.TopMessage)); } } } public void ClearBroadcastHistory(TLInt chatId) { var dialog = DialogsContext[chatId.Value] as TLBroadcastDialog; if (dialog != null) { lock (_dialogsSyncRoot) { foreach (var message in dialog.Messages) { RemoveMessageFromContext(message); } dialog.Messages.Clear(); var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage == null) return; var broadcastChat = InMemoryCacheService.Instance.GetBroadcast(chatId); if (broadcastChat == null) return; var serviceMessage = new TLMessageService17 { FromId = topMessage.FromId, ToId = topMessage.ToId, Status = MessageStatus.Confirmed, Out = new TLBool { Value = true }, Date = topMessage.Date, //IsAnimated = true, RandomId = TLLong.Random(), Action = new TLMessageActionChatCreate { Title = broadcastChat.Title, Users = broadcastChat.ParticipantIds } }; serviceMessage.SetUnread(new TLBool(false)); dialog.Messages.Add(serviceMessage); AddMessageToContext(serviceMessage); dialog.TopMessage = serviceMessage; dialog.TopMessageRandomId = serviceMessage.RandomId; CorrectDialogOrder(dialog, dialog.GetDateIndex(), dialog.TopMessage.Index); } if (_eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, dialog.TopMessage)); } } } public void DeleteDecryptedMessage(TLDecryptedMessageBase message, TLPeerBase peer) { if (message != null) { RemoveDecryptedMessageFromContext(message); //MessagesContext.Remove(message.Index); var commonMessage = message; if (commonMessage != null) { //TLDialog dialog; var isMessageRemoved = false; var isDialogRemoved = false; var isTopMessageUpdated = false; var dialog = DialogsContext[peer.Id.Value] as TLEncryptedDialog; if (dialog != null) { lock (_dialogsSyncRoot) { dialog.Messages.Remove(commonMessage); isMessageRemoved = true; if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialog.Index); Dialogs.Remove(dialog); isDialogRemoved = true; } else { dialog.TopMessage = dialog.Messages[0]; dialog.TopDecryptedMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; } CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); } } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialog)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, dialog.TopMessage)); } if (isMessageRemoved && _eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialog, commonMessage)); } } } else { throw new NotImplementedException(); } } public TLMessageBase GetMessage(TLPeerBase peer, TLInt messageId) { if (peer is TLPeerChannel) { var channelContext = ChannelsContext[peer.Id.Value]; if (channelContext != null) { return channelContext[messageId.Value]; } return null; } return MessagesContext[messageId.Value]; } public void DeleteMessages(TLPeerBase peer, TLMessageBase lastMessage, IList messageIds) { if (messageIds != null) { var messages = new List(); for (var i = 0; i < messageIds.Count; i++) { var message = GetMessage(peer, messageIds[i]); if (message != null) { RemoveMessageFromContext(message); messages.Add(message); } } var isDialogRemoved = false; var isTopMessageUpdated = false; var dialogBase = GetDialog(peer); TLMessageBase topMessage = null; lock (_dialogsSyncRoot) { var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { for (var i = 0; i < messageIds.Count; i++) { for (var j = 0; j < broadcast.Messages.Count; j++) { if (messageIds[i].Value == broadcast.Messages[j].Index) { broadcast.Messages.RemoveAt(j); break; } } } if (broadcast.Messages.Count == 0) { if (lastMessage == null) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { broadcast.Messages.Add(lastMessage); broadcast._topMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } } else { broadcast._topMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } CorrectDialogOrder(broadcast, broadcast.GetDateIndex(), broadcast.TopMessage.Index); } var dialog = dialogBase as TLDialog; if (dialog != null) { for (var i = 0; i < messageIds.Count; i++) { for (var j = 0; j < dialog.Messages.Count; j++) { if (messageIds[i].Value == dialog.Messages[j].Index) { dialog.Messages.RemoveAt(j); break; } } } if (dialog.Messages.Count == 0) { if (lastMessage == null) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { dialog.Messages.Add(lastMessage); dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } } else { dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } CorrectDialogOrder(dialog, dialog.GetDateIndex(), dialog.TopMessage.Index); } } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (_eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialogBase, messages)); } } else { throw new NotImplementedException(); } } public void DeleteUserHistory(TLPeerBase channel, TLPeerBase user) { var isMessageRemoved = false; var isDialogRemoved = false; var isTopMessageUpdated = false; TLMessageBase topMessage = null; var dialogBase = GetDialog(channel); var messages = new List(); lock (_dialogsSyncRoot) { var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { for (var j = 0; j < broadcast.Messages.Count; j++) { var messageCommon = broadcast.Messages[j] as TLMessageCommon; if (messageCommon != null && messageCommon.FromId.Value == user.Id.Value) { messages.Add(messageCommon); broadcast.Messages.RemoveAt(j--); } } isMessageRemoved = true; if (broadcast.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { broadcast._topMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } } var dialog = dialogBase as TLDialog; if (dialog != null) { for (var j = 0; j < dialog.Messages.Count; j++) { var messageCommon = dialog.Messages[j] as TLMessageCommon; if (messageCommon != null && messageCommon.FromId.Value == user.Id.Value) { if (messageCommon.Index == 1) { var message = messageCommon as TLMessageService; if (message != null) { var channelMigrateFrom = message.Action as TLMessageActionChannelMigrateFrom; if (channelMigrateFrom != null) { continue; } } } messages.Add(messageCommon); dialog.Messages.RemoveAt(j--); } } isMessageRemoved = true; if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { var dialog71 = dialog as TLDialog71; for (var i = 0; i < messages.Count; i++) { var commonMessage = messages[i] as TLMessageCommon; var message70 = messages[i] as TLMessage70; if (commonMessage != null && !commonMessage.Out.Value && commonMessage.Unread.Value) { dialog.UnreadCount = new TLInt(Math.Max(0, dialog.UnreadCount.Value - 1)); if (dialog71 != null && message70 != null && message70.FwdHeader == null && message70.IsMention) { dialog71.UnreadMentionsCount = new TLInt(Math.Max(0, dialog71.UnreadMentionsCount.Value - 1)); } } } dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } } } for (var i = 0; i < messages.Count; i++) { var message = messages[i]; if (message != null) { RemoveMessageFromContext(message); } } if (topMessage != null) { CorrectDialogOrder(dialogBase, dialogBase.GetDateIndex(), topMessage.Index); } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (isMessageRemoved && _eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialogBase, messages)); } } public void DeleteMessages(IList messages, TLPeerBase peer) { var isMessageRemoved = false; var isDialogRemoved = false; var isTopMessageUpdated = false; TLMessageBase topMessage = null; var dialogBase = GetDialog(peer); for (var i = 0; i < messages.Count; i++) { var message = messages[i]; if (message != null) { RemoveMessageFromContext(message); } } lock (_dialogsSyncRoot) { var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { for (var i = 0; i < messages.Count; i++) { for (var j = 0; j < broadcast.Messages.Count; j++) { if (messages[i].Id.Value == broadcast.Messages[j].Index) { broadcast.Messages.RemoveAt(j); break; } } } isMessageRemoved = true; if (broadcast.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { broadcast._topMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } } var dialog = dialogBase as TLDialog; if (dialog != null) { for (var i = 0; i < messages.Count; i++) { for (var j = 0; j < dialog.Messages.Count; j++) { if (messages[i].Id.Value == dialog.Messages[j].Index) { dialog.Messages.RemoveAt(j); break; } } } isMessageRemoved = true; if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { var dialog71 = dialog as TLDialog71; for (var i = 0; i < messages.Count; i++) { var commonMessage = messages[i] as TLMessageCommon; var message70 = messages[i] as TLMessage70; if (commonMessage != null && !commonMessage.Out.Value && commonMessage.Unread.Value) { dialog.UnreadCount = new TLInt(Math.Max(0, dialog.UnreadCount.Value - 1)); if (dialog71 != null && message70 != null && message70.FwdHeader == null && message70.IsMention) { dialog71.UnreadMentionsCount = new TLInt(Math.Max(0, dialog71.UnreadMentionsCount.Value - 1)); } } } dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } } } if (topMessage != null) { CorrectDialogOrder(dialogBase, dialogBase.GetDateIndex(), topMessage.Index); } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (isMessageRemoved && _eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialogBase, messages)); } } public void DeleteMessage(TLMessageBase message) { if (message != null) { RemoveMessageFromContext(message); //MessagesContext.Remove(message.Index); var commonMessage = message as TLMessageCommon; var message70 = message as TLMessage70; if (commonMessage != null) { //TLDialog dialog; var isMessageRemoved = false; var isDialogRemoved = false; var isTopMessageUpdated = false; var dialogBase = GetDialog(commonMessage); TLMessageBase topMessage = null; lock (_dialogsSyncRoot) { //dialog = Dialogs.FirstOrDefault(x => x.WithId == peer.Id.Value && x.IsChat == peer is TLPeerChat); var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { broadcast.Messages.Remove(commonMessage); isMessageRemoved = true; if (broadcast.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { broadcast.TopMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } CorrectDialogOrder(broadcast, broadcast.GetDateIndex(), broadcast.TopMessage.Index); } var dialog = dialogBase as TLDialog; if (dialog != null) { dialog.Messages.Remove(commonMessage); isMessageRemoved = true; if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { var dialog71 = dialog as TLDialog71; if (!commonMessage.Out.Value && commonMessage.Unread.Value) { dialog.UnreadCount = new TLInt(Math.Max(0, dialog.UnreadCount.Value - 1)); if (dialog71 != null && message70 != null && message70.FwdHeader == null && message70.IsMention) { dialog71.UnreadMentionsCount = new TLInt(Math.Max(0, dialog71.UnreadMentionsCount.Value - 1)); } } dialog.TopMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } CorrectDialogOrder(dialog, dialog.GetDateIndex(), dialog.TopMessage.Index); } } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (isMessageRemoved && _eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialogBase, commonMessage)); } } } else { throw new NotImplementedException(); } } public void ReplaceUser(int index, TLUserBase user) { var cachedUser = UsersContext[index]; if (cachedUser == null) { UsersContext[index] = user; } else { UsersContext[index] = user; lock (_dialogsSyncRoot) { foreach (var dialog in Dialogs) { if (!dialog.IsChat && dialog.WithId == index) { dialog.With = user; } } } } } public void DeleteUser(TLInt id) { UsersContext.Remove(id.Value); } public void DeleteUser(TLUserBase user) { UsersContext.Remove(user.Index); } public void ReplaceChat(int index, TLChatBase chat) { var cachedChat = ChatsContext[index]; if (cachedChat == null) { ChatsContext[index] = chat; } else { ChatsContext[index] = chat; lock (_dialogsSyncRoot) { foreach (var dialog in Dialogs) { if (dialog.IsChat && dialog.WithId == index) { dialog.With = chat; } } } } } public void ReplaceBroadcast(int index, TLBroadcastChat chat) { var cachedChat = BroadcastsContext[index]; if (cachedChat == null) { BroadcastsContext[index] = chat; } else { BroadcastsContext[index] = chat; lock (_dialogsSyncRoot) { foreach (var dialog in Dialogs) { if (dialog.IsChat && dialog.WithId == index) { dialog._with = chat; } } } } } public void ReplaceEncryptedChat(int index, TLEncryptedChatBase chat) { var cachedChat = EncryptedChatsContext[index]; if (cachedChat == null) { EncryptedChatsContext[index] = chat; } else { EncryptedChatsContext[index] = chat; //lock (_encryptedDialogsSyncRoot) //{ // foreach (var dialog in EncryptedDialogs) // { // if (dialog.IsChat // && dialog.WithId == index) // { // dialog.With = chat; // } // } //} } } public void DeleteChat(TLInt id) { ChatsContext.Remove(id.Value); } public void DeleteChat(TLChatBase chat) { ChatsContext.Remove(chat.Index); } public void DeleteDialog(TLDialogBase dialogBase) { lock (_dialogsSyncRoot) { var dialog = Dialogs.FirstOrDefault(x => x.Index == dialogBase.Index); if (dialog != null) { Dialogs.Remove(dialog); DialogsContext.Remove(dialog.Index); } } } public void UpdatePinnedDialogs(TLPeerDialogs peerDialogs) { } public void UpdateProxyData(TLProxyDataBase proxyDaya) { lock (_dialogsSyncRoot) { ProxyData = proxyDaya; } } public void UpdateDialogPinned(TLPeerBase peer, bool pinned) { var dialog = GetDialog(peer) as TLDialog53; if (dialog != null) { lock (_dialogsSyncRoot) { if (pinned) { dialog.IsPinned = true; Dialogs.Remove(dialog); Dialogs.Insert(0, dialog); } else { dialog.IsPinned = false; CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); } var pinnedId = 0; foreach (var d in Dialogs) { var d53 = d as TLDialog53; if (d53 != null) { if (d53.IsPinned) { d53.PinnedId = new TLInt(pinnedId++); } else { d.PinnedId = null; } } } } } } public void UpdateDialogPromo(TLDialogBase dialogBase, bool promo) { var dialog = dialogBase as TLDialog71; if (dialog != null) { lock (_dialogsSyncRoot) { if (promo) { dialog.IsPromo = true; if (dialogBase.Peer is TLPeerChannel) { var channel = ChatsContext[dialogBase.Peer.Id.Value] as TLChannel73; if (channel != null && !channel.Left.Value) { CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, dialog.TopMessage)); } else { Dialogs.Remove(dialog); Dialogs.Insert(0, dialog); _eventAggregator.Publish(new DialogAddedEventArgs(dialog)); } } else { Dialogs.Remove(dialog); Dialogs.Insert(0, dialog); _eventAggregator.Publish(new DialogAddedEventArgs(dialog)); } } else { dialog.IsPromo = false; if (dialogBase.Peer is TLPeerChannel) { var channel = ChatsContext[dialogBase.Peer.Id.Value] as TLChannel73; if (channel != null && !channel.Left.Value) { CorrectDialogOrder(dialog, dialog.GetDateIndex(), 0); _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialog, dialog.TopMessage)); } else { Dialogs.Remove(dialog); _eventAggregator.Publish(new DialogRemovedEventArgs(dialog)); } } else { Dialogs.Remove(dialog); _eventAggregator.Publish(new DialogRemovedEventArgs(dialog)); } } var pinnedId = 0; foreach (var d in Dialogs) { var d53 = d as TLDialog53; if (d53 != null) { if (d53.IsPinned) { d53.PinnedId = new TLInt(pinnedId++); } else { d.PinnedId = null; } } } } } } public void UpdateChannelAvailableMessages(TLPeerBase peer, TLInt availableMinId) { var channel = ChatsContext[peer.Id.Value] as TLChannel68; if (channel != null) { channel.AvailableMinId = availableMinId; } var messages = new List(); var isDialogRemoved = false; var isTopMessageUpdated = false; var dialogBase = GetDialog(peer); TLMessageBase topMessage = null; lock (_dialogsSyncRoot) { var dialog = dialogBase as TLDialog; if (dialog != null) { var updatedIndex = -1; for (var i = 0; i < dialog.Messages.Count; i++) { if (dialog.Messages[i].Index > 0 && dialog.Messages[i].Index <= availableMinId.Value) { if (updatedIndex == -1) { updatedIndex = i; } else { messages.Add(dialog.Messages[i]); dialog.Messages.RemoveAt(i--); } } } if (updatedIndex >= 0 && updatedIndex < dialog.Messages.Count) { var messageCommon = dialog.Messages[updatedIndex] as TLMessageCommon; if (messageCommon != null) { var clearHistoryMessage = new TLMessageService49(); clearHistoryMessage.Flags = new TLInt(0); clearHistoryMessage.Id = messageCommon.Id; clearHistoryMessage.FromId = messageCommon.FromId ?? new TLInt(-1); clearHistoryMessage.ToId = messageCommon.ToId; clearHistoryMessage.Date = messageCommon.Date; clearHistoryMessage.Out = messageCommon.Out; clearHistoryMessage.Action = new TLMessageActionClearHistory(); dialog.Messages[updatedIndex] = clearHistoryMessage; } } dialog.UnreadCount = new TLInt(0); var dialog71 = dialog as TLDialog71; if (dialog71 != null) { dialog71.UnreadMentionsCount = new TLInt(0); } if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } } } for (var i = 0; i < messages.Count; i++) { RemoveMessageFromContext(messages[i]); } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (_eventAggregator != null) { _eventAggregator.Publish(new ChannelAvailableMessagesEventArgs(dialogBase, availableMinId)); } } public void ClearDialog(TLPeerBase peer) { var messages = new List(); var isDialogRemoved = false; var isTopMessageUpdated = false; var dialogBase = GetDialog(peer); TLMessageBase topMessage = null; lock (_dialogsSyncRoot) { var broadcast = dialogBase as TLBroadcastDialog; if (broadcast != null) { for (var i = 1; i < broadcast.Messages.Count; i++) { broadcast.Messages.RemoveAt(i--); } if (broadcast.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { broadcast._topMessage = broadcast.Messages[0]; broadcast.TopMessageId = broadcast.Messages[0].Id; broadcast.TopMessageRandomId = broadcast.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = broadcast.TopMessage; } //CorrectDialogOrder(broadcast, broadcast.TopMessage.DateIndex, broadcast.TopMessage.Index); } var dialog = dialogBase as TLDialog; if (dialog != null) { var updatedIndex = -1; for (var i = 0; i < dialog.Messages.Count; i++) { if (dialog.Messages[i].Index > 0) { if (updatedIndex == -1) { updatedIndex = i; } else { messages.Add(dialog.Messages[i]); dialog.Messages.RemoveAt(i--); } } } if (updatedIndex >= 0 && updatedIndex < dialog.Messages.Count) { var messageCommon = dialog.Messages[updatedIndex] as TLMessageCommon; if (messageCommon != null) { var clearHistoryMessage = new TLMessageService49(); clearHistoryMessage.Flags = new TLInt(0); clearHistoryMessage.Id = messageCommon.Id; clearHistoryMessage.FromId = messageCommon.FromId ?? new TLInt(-1); clearHistoryMessage.ToId = messageCommon.ToId; clearHistoryMessage.Date = messageCommon.Date; clearHistoryMessage.Out = messageCommon.Out; clearHistoryMessage.Action = new TLMessageActionClearHistory(); dialog.Messages[updatedIndex] = clearHistoryMessage; RemoveMessageFromContext(messageCommon); AddMessageToContext(clearHistoryMessage); } } dialog.UnreadCount = new TLInt(0); var dialog71 = dialog as TLDialog71; if (dialog71 != null) { dialog71.UnreadMentionsCount = new TLInt(0); } if (dialog.Messages.Count == 0) { DialogsContext.Remove(dialogBase.Index); Dialogs.Remove(dialogBase); isDialogRemoved = true; } else { dialog._topMessage = dialog.Messages[0]; dialog.TopMessageId = dialog.Messages[0].Id; dialog.TopMessageRandomId = dialog.Messages[0].RandomId; isTopMessageUpdated = true; topMessage = dialog.TopMessage; } //CorrectDialogOrder(dialog, dialog.TopMessage.DateIndex, dialog.TopMessage.Index); } } for (var i = 0; i < messages.Count; i++) { RemoveMessageFromContext(messages[i]); } if (isDialogRemoved && _eventAggregator != null) { _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase)); } if (isTopMessageUpdated && _eventAggregator != null) { _eventAggregator.Publish(new TopMessageUpdatedEventArgs(dialogBase, topMessage)); } if (_eventAggregator != null) { _eventAggregator.Publish(new MessagesRemovedEventArgs(dialogBase, messages)); } } private static bool _logEnabled = true; private static void Log(string str) { if (!_logEnabled) return; Debug.WriteLine(str); } public void Open() { try { Log("InMemoryDatabase.Open"); //TLObject.LogNotify = true; var timer = Stopwatch.StartNew(); var t1 = Task.Factory.StartNew(() => { var usersTimer = Stopwatch.StartNew(); var users = TLUtils.OpenObjectFromMTProtoFile>(_usersSyncRoot, UsersMTProtoFileName) ?? new TLVector(); Log(string.Format("Open users time ({0}) : {1}", users.Count, usersTimer.Elapsed)); foreach (var user in users) { UsersContext[user.Index] = user; } }); var t2 = Task.Factory.StartNew(() => { var chatsTimer = Stopwatch.StartNew(); var chats = TLUtils.OpenObjectFromMTProtoFile>(_chatsSyncRoot, ChatsMTProtoFileName) ?? new TLVector(); Log(string.Format("Open chats time ({0}) : {1}", chats.Count, chatsTimer.Elapsed)); foreach (var chat in chats) { ChatsContext[chat.Index] = chat; } }); var t3 = Task.Factory.StartNew(() => { var broadcastsTimer = Stopwatch.StartNew(); var broadcasts = TLUtils.OpenObjectFromMTProtoFile>(_broadcastsSyncRoot, BroadcastsMTProtoFileName) ?? new TLVector(); Log(string.Format("Open broadcasts time ({0}) : {1}", broadcasts.Count, broadcastsTimer.Elapsed)); foreach (var broadcast in broadcasts) { BroadcastsContext[broadcast.Index] = broadcast; } }); var t4 = Task.Factory.StartNew(() => { var encryptedChatsTimer = Stopwatch.StartNew(); var encryptedChats = TLUtils.OpenObjectFromMTProtoFile>(_encryptedChatsSyncRoot, EncryptedChatsMTProtoFileName) ?? new TLVector(); Log(string.Format("Open encrypted chats time ({0}) : {1}", encryptedChats.Count, encryptedChatsTimer.Elapsed)); foreach (var encryptedChat in encryptedChats) { EncryptedChatsContext[encryptedChat.Index] = encryptedChat; } }); var t5 = Task.Factory.StartNew(() => { var dialogsTimer = Stopwatch.StartNew(); var dialogs = TLUtils.OpenObjectFromMTProtoFile>(_dialogsFileSyncRoot, DialogsMTProtoFileName) ?? new TLVector(); Dialogs = new ObservableCollection(dialogs.Items); Log(string.Format("Open dialogs time ({0}) : {1}", dialogs.Count, dialogsTimer.Elapsed)); foreach (var dialog in dialogs) { DialogsContext[dialog.Index] = dialog; } }); var t6 = Task.Factory.StartNew(() => { var proxyDataTimer = Stopwatch.StartNew(); var proxyData = TLUtils.OpenObjectFromMTProtoFile(_proxyDataSyncRoot, ProxyDataMTProtoFileName); ProxyData = proxyData; Log(string.Format("Open proxy data time : {0}", proxyDataTimer.Elapsed)); }); Task.WaitAll(t1, t2, t3, t4, t5, t6); //TelegramPropertyChangedBase.IsNotifyingGlobal = true; //WaitHandle.WaitAll(handles.ToArray()); Log("Open DB files time: " + timer.Elapsed); MessagesContext.Clear(); ChannelsContext.Clear(); lock (_dialogsSyncRoot) { ResendingMessages = new List(); ResendingDecryptedMessages = new List(); foreach (var d in Dialogs) { var encryptedDialog = d as TLEncryptedDialog; var broadcastDialog = d as TLBroadcastDialog; if (encryptedDialog != null) { //var peer = encryptedDialog.Peer; //if (peer is TLPeerEncryptedChat) //{ // var encryptedChat = EncryptedChatsContext[peer.Id.Value] as TLEncryptedChatCommon; // if (encryptedChat != null) // { // encryptedDialog._with = UsersContext[encryptedChat.ParticipantId.Value]; // } //} encryptedDialog._topMessage = encryptedDialog.Messages.FirstOrDefault(); encryptedDialog.TopDecryptedMessageRandomId = encryptedDialog.TopMessage != null ? encryptedDialog.TopMessage.RandomId : null; if (encryptedDialog.TopMessageId == null) { encryptedDialog.TopMessageRandomId = encryptedDialog.TopMessage != null ? encryptedDialog.TopMessage.RandomId : null; } foreach (var message in encryptedDialog.Messages) { if (message.Status == MessageStatus.Sending || message.Status == MessageStatus.Compressing) { message.Status = MessageStatus.Failed; ResendingDecryptedMessages.Add(message); } if (message.RandomIndex != 0) { DecryptedMessagesContext[message.RandomIndex] = message; } } } else if (broadcastDialog != null) { var dialog = broadcastDialog; var peer = dialog.Peer; var broadcastChat = ChatsContext[peer.Id.Value]; if (broadcastChat != null) { dialog._with = broadcastChat; } else { broadcastChat = dialog.With as TLBroadcastChat; if (broadcastChat != null) { ChatsContext[broadcastChat.Index] = broadcastChat; } } dialog._topMessage = dialog.Messages.FirstOrDefault(); dialog.TopMessageId = dialog.TopMessage != null ? dialog.TopMessage.Id : null; if (dialog.TopMessageId == null) { dialog.TopMessageRandomId = dialog.TopMessage != null ? dialog.TopMessage.RandomId : null; } foreach (var message in dialog.Messages) { if (message.Status == MessageStatus.Sending || message.Status == MessageStatus.Compressing) { message._status = message.Index != 0 ? MessageStatus.Confirmed : MessageStatus.Failed; ResendingMessages.Add(message); } AddMessageToContext(message); if (message.RandomIndex != 0) { RandomMessagesContext[message.RandomIndex] = message; } } } else { var dialog = (TLDialog)d; var peer = dialog.Peer; if (peer is TLPeerUser) { var user = UsersContext[peer.Id.Value]; if (user != null) { dialog._with = user; } else { var userBase = dialog.With as TLUserBase; if (userBase != null) { UsersContext[userBase.Index] = userBase; } } } else if (peer is TLPeerChat) { var chat = ChatsContext[peer.Id.Value]; if (chat != null) { dialog._with = chat; } else { var chatBase = dialog.With as TLChatBase; if (chatBase != null) { ChatsContext[chatBase.Index] = chatBase; } } } else if (peer is TLPeerBroadcast) { var broadcastChat = ChatsContext[peer.Id.Value]; if (broadcastChat != null) { dialog._with = broadcastChat; } else { broadcastChat = dialog.With as TLBroadcastChat; if (broadcastChat != null) { ChatsContext[broadcastChat.Index] = broadcastChat; } } } else if (peer is TLPeerChannel) { var channel = ChatsContext[peer.Id.Value]; if (channel != null) { dialog._with = channel; } else { channel = dialog.With as TLChannel; if (channel != null) { ChatsContext[channel.Index] = channel; } } var dialogFeed = dialog as TLDialogFeed; if (dialogFeed != null) { var channels = new TLVector(); foreach (var channelId in dialogFeed.FeedOtherChannels) { var ch = ChatsContext[channelId.Value]; if (ch != null) { channels.Add(ch); } } dialogFeed._with = channels; } } dialog._topMessage = dialog.Messages.FirstOrDefault(); dialog.TopMessageId = dialog.TopMessage != null ? dialog.TopMessage.Id : null; if (dialog.TopMessageId == null) { dialog.TopMessageRandomId = dialog.TopMessage != null ? dialog.TopMessage.RandomId : null; } foreach (var message in dialog.Messages) { if (message.Status == MessageStatus.Sending || message.Status == MessageStatus.Compressing) { message._status = message.Index != 0 ? MessageStatus.Confirmed : MessageStatus.Failed; ResendingMessages.Add(message); } AddMessageToContext(message); if (message.RandomIndex != 0) { RandomMessagesContext[message.RandomIndex] = message; } } } } } _isOpened = true; //#if DEBUG Execute.BeginOnThreadPool(() => { FileUtils.Copy(_usersSyncRoot, UsersMTProtoFileName, TempUsersMTProtoFileName); FileUtils.Copy(_chatsSyncRoot, ChatsMTProtoFileName, TempChatsMTProtoFileName); FileUtils.Copy(_broadcastsSyncRoot, BroadcastsMTProtoFileName, TempBroadcastsMTProtoFileName); FileUtils.Copy(_encryptedChatsSyncRoot, EncryptedChatsMTProtoFileName, TempEncryptedChatsMTProtoFileName); FileUtils.Copy(_dialogsSyncRoot, DialogsMTProtoFileName, TempDialogsMTProtoFileName); }); //#endif //TLObject.LogNotify = false; Log("Open DB time: " + timer.Elapsed); //TLUtils.WritePerformance("Open DB time: " + timer.Elapsed); } catch (Exception e) { TLUtils.WriteLine("DB ERROR: open DB error", LogSeverity.Error); TLUtils.WriteException(e); } } public IList ResendingMessages { get; protected set; } public IList ResendingDecryptedMessages { get; protected set; } public event EventHandler CommitInvoked; protected virtual void RaiseCommitInvoked() { var handler = CommitInvoked; if (handler != null) handler(this, System.EventArgs.Empty); } public void Commit() { RaiseCommitInvoked(); HasChanges = true; } public void CommitInternal() { //return; //return; if (!_isOpened) return; var timer = Stopwatch.StartNew(); //truncate commiting DB var dialogs = new List(); var messagesCount = 0; lock (_dialogsSyncRoot) { var importantCount = 0; for (var i = 0; i < Dialogs.Count && importantCount < Constants.CachedDialogsCount; i++) { dialogs.Add(Dialogs[i]); var chat = Dialogs[i].With as TLChat41; if (chat == null || !chat.IsMigrated) { importantCount++; } } foreach (var d in dialogs) { var dialog = d as TLDialog; if (dialog != null) { var chat = dialog.With as TLChat41; if (chat != null && chat.IsMigrated) { //dialog.Messages = new ObservableCollection(dialog.Messages.Take(Constants.CachedMessagesCount)); dialog.CommitMessages = dialog.Messages.Take(Constants.CachedMessagesCount).ToList(); } else { //dialog.Messages = new ObservableCollection(dialog.Messages.Take(Constants.CachedMessagesCount)); dialog.CommitMessages = dialog.Messages.Take(Constants.CachedMessagesCount).ToList(); } messagesCount += dialog.Messages.Count; } } } var mtProtoDialogs = new TLVector { Items = dialogs }; if (ProxyData != null) { TLUtils.SaveObjectToMTProtoFile(_proxyDataSyncRoot, ProxyDataMTProtoFileName, ProxyData); } else { FileUtils.Delete(_proxyDataSyncRoot, ProxyDataMTProtoFileName); } TLUtils.SaveObjectToMTProtoFile(_dialogsFileSyncRoot, DialogsMTProtoFileName, mtProtoDialogs); TLUtils.SaveObjectToMTProtoFile(_usersSyncRoot, UsersMTProtoFileName, new TLVector { Items = UsersContext.Values.ToList() }); TLUtils.SaveObjectToMTProtoFile(_chatsSyncRoot, ChatsMTProtoFileName, new TLVector { Items = ChatsContext.Values.ToList() }); TLUtils.SaveObjectToMTProtoFile(_broadcastsSyncRoot, BroadcastsMTProtoFileName, new TLVector { Items = BroadcastsContext.Values.ToList() }); TLUtils.SaveObjectToMTProtoFile(_encryptedChatsSyncRoot, EncryptedChatsMTProtoFileName, new TLVector { Items = EncryptedChatsContext.Values.ToList() }); HasChanges = false; TLUtils.WritePerformance(string.Format("Commit DB time ({0}d, {1}u, {2}c, {6}b, {5}ec, {4}m): {3}", dialogs.Count, UsersContext.Count, ChatsContext.Count, timer.Elapsed, messagesCount, EncryptedChatsContext.Count, BroadcastsContext.Count)); } public int CountRecords() where T : TLObject { var result = 0; if (typeof(T) == typeof(TLMessageBase)) { lock (_dialogsSyncRoot) { foreach (var dialog in Dialogs) { result += dialog.CountMessages(); } } } else if (typeof(T) == typeof(TLDialog)) { result += Dialogs.Count; } else if (typeof(T) == typeof(TLUserBase)) { result += UsersContext.Count; } else if (typeof(T) == typeof(TLBroadcastChat)) { result += BroadcastsContext.Count; } else if (typeof(T) == typeof(TLChatBase)) { result += ChatsContext.Count; } else { throw new NotImplementedException(); } return result; } public void Dispose() { _commitSubscription.Dispose(); } public void Compress() { lock (_dialogsSyncRoot) { MessagesContext.Clear(); for (var i = 0; i < Dialogs.Count; i++) { var dialog = Dialogs[i] as TLDialog; if (dialog != null) { dialog.Messages = new ObservableCollection(dialog.Messages.Take(1)); var message = dialog.Messages.FirstOrDefault(); if (message != null) { AddMessageToContext(message); } } } } CommitInternal(); } public void ClearLocalFileNames() { lock (_dialogsSyncRoot) { MessagesContext.Clear(); for (var i = 0; i < Dialogs.Count; i++) { var dialog = Dialogs[i] as TLDialog; if (dialog != null) { for (var j = 0; j < dialog.Messages.Count; j++) { var message = dialog.Messages[j] as TLMessage; if (message != null) { var media = message.Media as TLMessageMediaDocument; if (media != null) { media.IsoFileName = null; } } } } } } CommitInternal(); } } } ================================================ FILE: Telegram.Api/Services/Connection/ConnectionService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Globalization; using System.Text; using System.Threading; using Telegram.Api.Services.DeviceInfo; #if WP8 || WIN_RT using Windows.Networking.Connectivity; #endif #if WINDOWS_PHONE using Microsoft.Phone.Net.NetworkInformation; #endif using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.Connection { public interface IConnectionService { void Initialize(IMTProtoService mtProtoService); event EventHandler ConnectionLost; } public class ConnectionService : IConnectionService { public event EventHandler ConnectionLost; protected virtual void RaiseConnectionFailed() { var handler = ConnectionLost; if (handler != null) handler(this, EventArgs.Empty); } private IMTProtoService _mtProtoService; public void Initialize(IMTProtoService mtProtoService) { _mtProtoService = mtProtoService; } private Timer _connectionScheduler; private bool _isNetworkAwailable; #if WP8 || WIN_RT private ConnectionProfile _profile; private NetworkConnectivityLevel? _connectivityLevel; #endif public ConnectionService(IDeviceInfoService deviceInfoService) { if (deviceInfoService != null && deviceInfoService.IsBackground) { return; } _connectionScheduler = new Timer(CheckConnectionState, this, TimeSpan.FromSeconds(0.0), TimeSpan.FromSeconds(5.0)); #if WINDOWS_PHONE _isNetworkAwailable = DeviceNetworkInformation.IsNetworkAvailable; #endif #if WP8 || WIN_RT _profile = NetworkInformation.GetInternetConnectionProfile(); _connectivityLevel = _profile != null ? _profile.GetNetworkConnectivityLevel() : (NetworkConnectivityLevel?)null; //var connectivityLevel = _profile.GetNetworkConnectivityLevel(); //_profile.NetworkAdapter.IanaInterfaceType != 71 // mobile data //_profile.GetConnectionCost().Roaming; //Helpers.Execute.ShowDebugMessage(string.Format("InternetConnectionProfile={0}", _profile != null ? _profile.GetNetworkConnectivityLevel().ToString() : "null")); // new solution NetworkInformation.NetworkStatusChanged += sender => { var previousProfile = _profile; var previousConnectivityLevel = _connectivityLevel; _profile = NetworkInformation.GetInternetConnectionProfile(); _connectivityLevel = _profile != null ? _profile.GetNetworkConnectivityLevel() : (NetworkConnectivityLevel?)null; if (_profile != null) { if (_mtProtoService == null) return; var activeTransport = _mtProtoService.GetActiveTransport(); if (activeTransport == null) return; if (activeTransport.AuthKey == null) return; var transportId = activeTransport.Id; var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (!isAuthorized) { return; } var errorDebugString = string.Format("{0} internet connected", DateTime.Now.ToString("HH:mm:ss.fff")); TLUtils.WriteLine(errorDebugString, LogSeverity.Error); var reconnect = _connectivityLevel == NetworkConnectivityLevel.InternetAccess && previousConnectivityLevel != NetworkConnectivityLevel.InternetAccess; if (reconnect) { TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " reconnect t" + transportId, LogSeverity.Error); Logs.Log.Write(string.Format(" Reconnect reason=NetworkStatusChanged profile={0} internet_access={1} previous_profile={2} previous_internet_access={3}", _profile != null ? _profile.ProfileName : "none", _profile != null ? _connectivityLevel.ToString() : "none", previousProfile != null ? previousProfile.ProfileName : "none", previousProfile != null ? previousConnectivityLevel.ToString() : "none")); RaiseConnectionFailed(); return; } } else { var errorDebugString = string.Format("{0} internet disconnected", DateTime.Now.ToString("HH:mm:ss.fff")); TLUtils.WriteLine(errorDebugString, LogSeverity.Error); _mtProtoService.SetMessageOnTime(60.0 * 60, "Waiting for network..."); //Helpers.Execute.ShowDebugMessage(string.Format("NetworkStatusChanged Internet disconnected Profile={0}", _profile)); } }; #endif #if WINDOWS_PHONE // old solution DeviceNetworkInformation.NetworkAvailabilityChanged += (sender, args) => { return; var isNetworkAvailable = _isNetworkAwailable; _isNetworkAwailable = DeviceNetworkInformation.IsNetworkAvailable; //if (isNetworkAvailable != _isNetworkAwailable) { var info = new StringBuilder(); info.AppendLine(); foreach (var networkInterface in new NetworkInterfaceList()) { info.AppendLine(string.Format(" {0} {1} {2}", networkInterface.InterfaceName, networkInterface.InterfaceState, networkInterface.InterfaceType)); } var current = new NetworkInterfaceList(); var ni = NetworkInterface.NetworkInterfaceType; Helpers.Execute.ShowDebugMessage(string.Format("NetworkAwailabilityChanged Interface={0}\n{1}", ni, info.ToString())); } var networkString = string.Format("{0}, {1}, ", args.NotificationType, args.NetworkInterface != null ? args.NetworkInterface.InterfaceState.ToString() : "none"); var mtProtoService = MTProtoService.Instance; if (mtProtoService != null) { if (args.NotificationType == NetworkNotificationType.InterfaceDisconnected) { #if DEBUG var interfaceSubtype = args.NetworkInterface != null ? args.NetworkInterface.InterfaceSubtype.ToString() : "Interface"; mtProtoService.SetMessageOnTime(2.0, DateTime.Now.ToString("HH:mm:ss.fff ", CultureInfo.InvariantCulture) + interfaceSubtype + " disconnected..."); TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff ", CultureInfo.InvariantCulture) + interfaceSubtype + " disconnected", LogSeverity.Error); #else //mtProtoService.SetMessageOnTime(2.0, "No Internet connection"); #endif } else if (args.NotificationType == NetworkNotificationType.InterfaceConnected) { #if DEBUG var interfaceSubtype = args.NetworkInterface != null ? args.NetworkInterface.InterfaceSubtype.ToString() : "Interface"; mtProtoService.SetMessageOnTime(2.0, DateTime.Now.ToString("HH:mm:ss.fff ", CultureInfo.InvariantCulture) + interfaceSubtype + " connected..."); TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff ", CultureInfo.InvariantCulture) + interfaceSubtype + " connected", LogSeverity.Error); #else mtProtoService.SetMessageOnTime(0.0, string.Empty); #endif } else if (args.NotificationType == NetworkNotificationType.CharacteristicUpdate) { //#if DEBUG // mtProtoService.SetMessageOnTime(2.0, "Characteristic update..."); // var networkInterface = args.NetworkInterface; // if (networkInterface != null) // { // var characteristics = new StringBuilder(); // characteristics.AppendLine(); // //characteristics.AppendLine("Description=" + networkInterface.Description); // characteristics.AppendLine("InterfaceName=" + networkInterface.InterfaceName); // characteristics.AppendLine("InterfaceState=" + networkInterface.InterfaceState); // characteristics.AppendLine("InterfaceType=" + networkInterface.InterfaceType); // characteristics.AppendLine("InterfaceSubtype=" + networkInterface.InterfaceSubtype); // characteristics.AppendLine("Bandwidth=" + networkInterface.Bandwidth); // //characteristics.AppendLine("Characteristics=" + networkInterface.Characteristics); // TLUtils.WriteLine(characteristics.ToString(), LogSeverity.Error); // } //#endif } } }; #endif } private void CheckConnectionState(object state) { //#if !WIN_RT && DEBUG // Microsoft.Devices.VibrateController.Default.Start(TimeSpan.FromMilliseconds(50)); //#endif if (Debugger.IsAttached) return; //#if DEBUG // return; //#endif if (_mtProtoService == null) return; var activeTransport = _mtProtoService.GetActiveTransport(); if (activeTransport == null) return; if (activeTransport.AuthKey == null) return; var transportId = activeTransport.Id; var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (!isAuthorized) { return; } var connectionFailed = false; var now = DateTime.Now; if (activeTransport.LastReceiveTime.HasValue) { connectionFailed = Math.Abs((now - activeTransport.LastReceiveTime.Value).TotalSeconds) > Constants.TimeoutInterval; if (connectionFailed) { Logs.Log.Write(string.Format(" Reconnect reason=ConnectionFailed transport={3} now={0} - last_receive_time={1} > timeout={2}", now.ToString("dd-MM-yyyy HH:mm:ss.fff"), activeTransport.LastReceiveTime.Value.ToString("dd-MM-yyyy HH:mm:ss.fff"), Constants.TimeoutInterval, activeTransport.Id)); } } else { if (activeTransport.FirstSendTime.HasValue) { connectionFailed = Math.Abs((now - activeTransport.FirstSendTime.Value).TotalSeconds) > Constants.TimeoutInterval; if (connectionFailed) { Logs.Log.Write(string.Format(" Reconnect reason=ConnectionFailed transport={3} now={0} - first_send_time={1} > timeout={2}", now.ToString("dd-MM-yyyy HH:mm:ss.fff"), activeTransport.FirstSendTime.Value.ToString("dd-MM-yyyy HH:mm:ss.fff"), Constants.TimeoutInterval, activeTransport.Id)); } } } if (connectionFailed) { RaiseConnectionFailed(); TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " reconnect t" + transportId, LogSeverity.Error); return; } var pingRequired = false; var timeFromLastReceive = 0.0; var timeFromFirstSend = 0.0; var pingTimeout = Math.Max(Constants.TimeoutInterval - 10.0, 10.0); if (activeTransport.LastReceiveTime.HasValue) { // что-то уже получали по соединению var lastReceiveTime = activeTransport.LastReceiveTime.Value; timeFromLastReceive = Math.Abs((now - lastReceiveTime).TotalSeconds); pingRequired = timeFromLastReceive > pingTimeout; if (pingRequired) { Logs.Log.Write(string.Format(" CheckReconnect reason=PingRequired transport={3} now={0} - last_receive_time={1} > ping_timeout={2}", now.ToString("HH:mm:ss.fff"), lastReceiveTime.ToString("HH:mm:ss.fff"), pingTimeout, activeTransport.Id)); } } else { // ничего не получали, но что-то отправляли if (activeTransport.FirstSendTime.HasValue) { var firstSendTime = activeTransport.FirstSendTime.Value; timeFromFirstSend = Math.Abs((now - firstSendTime).TotalSeconds); pingRequired = timeFromFirstSend > pingTimeout; if (pingRequired) { Logs.Log.Write(string.Format(" CheckReconnect reason=PingRequired transport={3} now={0} - first_send_time={1} > ping_timeout={2}", now.ToString("HH:mm:ss.fff"), firstSendTime.ToString("HH:mm:ss.fff"), pingTimeout, activeTransport.Id)); } } // хотя бы пинганем для начала else { pingRequired = true; } } if (pingRequired) { var pingId = TLLong.Random(); var pingIdHash = pingId.Value % 1000; var debugString = string.Format("{0} ping t{1} ({2}, {3}) [{4}]", DateTime.Now.ToString("HH:mm:ss.fff"), transportId, timeFromFirstSend.ToString("N"), timeFromLastReceive.ToString("N"), pingIdHash); TLUtils.WriteLine(debugString, LogSeverity.Error); _mtProtoService.PingAsync(pingId, //new TLInt(35), result => { var resultDebugString = string.Format("{0} pong t{1} ({2}, {3}) [{4}]", DateTime.Now.ToString("HH:mm:ss.fff"), transportId, timeFromFirstSend.ToString("N"), timeFromLastReceive.ToString("N"), pingIdHash); TLUtils.WriteLine(resultDebugString, LogSeverity.Error); }, error => { var errorDebugString = string.Format("{0} pong error t{1} ({2}, {3}) [{4}] \nSocketError={5}", DateTime.Now.ToString("HH:mm:ss.fff"), transportId, timeFromFirstSend.ToString("N"), timeFromLastReceive.ToString("N"), pingIdHash, #if WINDOWS_PHONE error.SocketError #else string.Empty #endif ); TLUtils.WriteLine(errorDebugString, LogSeverity.Error); }); } else { var checkDebugString = string.Format("{0} check t{1} ({2}, {3})", DateTime.Now.ToString("HH:mm:ss.fff"), transportId, timeFromFirstSend.ToString("N"), timeFromLastReceive.ToString("N")); //TLUtils.WriteLine(checkDebugString, LogSeverity.Error); } } } } ================================================ FILE: Telegram.Api/Services/Connection/PublicConfigService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Numerics; using System.Runtime.Serialization.Json; #if !WIN_RT using System.Security.Cryptography; #endif using System.Text; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.Connection { public class MockupPublicConfigService : IPublicConfigService { public void GetAsync(Action callback, Action faultCallback = null) { } } public class PublicConfigService : IPublicConfigService { private static void Log(string str) { Logs.Log.Write(string.Format(" PublicConfigService {0}", str)); } public bool Test { get; set; } private int _counter; private void PerformAppRequestAsync(Action callback, Action faultCallback) { Execute.ShowDebugMessage("GetPublicConfig start counter=" + _counter); var counter = _counter; WebRequest request; if (_counter == 0) { request = Test ? WebRequest.Create("https://www.google.pt/resolve?name=tap.stel.com&type=16") : WebRequest.Create("https://www.google.pt/resolve?name=ap.stel.com&type=16"); request.Headers["Host"] = "dns.google.com"; _counter = 1; } else if (_counter == 1) { request = Test ? WebRequest.Create("https://www.google.com/resolve?name=tap.stel.com&type=16") : WebRequest.Create("https://www.google.com/resolve?name=ap.stel.com&type=16"); request.Headers["Host"] = "dns.google.com"; _counter = 2; } else if (_counter == 2) { request = Test ? WebRequest.Create("https://google.pt/resolve?name=tap.stel.com&type=16") : WebRequest.Create("https://google.pt/resolve?name=ap.stel.com&type=16"); request.Headers["Host"] = "dns.google.com"; _counter = 3; } else { request = Test ? WebRequest.Create("https://google.com/resolve?name=tap.stel.com&type=16") : WebRequest.Create("https://google.com/resolve?name=ap.stel.com&type=16"); request.Headers["Host"] = "dns.google.com"; _counter = 0; } /*else if (_counter == 1) { request = Test ? WebRequest.Create("https://google.com/test/") : WebRequest.Create("https://google.com/"); request.Headers["Host"] = "dns-telegram.appspot.com"; _counter = 2; } else { request = Test ? WebRequest.Create("https://software-download.microsoft.com/test/config.txt") : WebRequest.Create("https://software-download.microsoft.com/prod/config.txt"); request.Headers["Host"] = "tcdnb.azureedge.net"; _counter = 0; }*/ Log("Start app request"); request.BeginGetResponse( result => { Log("Stop app request"); try { var response = request.EndGetResponse(result); string dataString; using (var s = response.GetResponseStream()) { using (var readStream = new StreamReader(s)) { dataString = readStream.ReadToEnd(); } } //if (counter == 0) { dataString = ParseDataString(dataString); } var configSimple = DecryptSimpleConfig(dataString); callback.SafeInvoke(configSimple); } catch (Exception ex) { Log("App request exception\n" + ex); faultCallback.SafeInvoke(counter, ex); } }, request); } private void PerformDnsRequestAsync(Action callback, Action faultCallback) { var request = Test ? WebRequest.Create("https://google.com/resolve?name=tap.stel.com&type=16") : WebRequest.Create("https://google.com/resolve?name=ap.stel.com&type=16"); request.Headers["Host"] = "dns.google.com"; Log("Start dns request"); request.BeginGetResponse( result => { Log("Stop dns request"); try { var response = request.EndGetResponse(result); string dataString; using (var s = response.GetResponseStream()) { using (var readStream = new StreamReader(s)) { dataString = readStream.ReadToEnd(); } } dataString = ParseDataString(dataString); var configSimple = DecryptSimpleConfig(dataString); callback.SafeInvoke(configSimple); } catch (Exception ex) { Log("Dns request exception\n" + ex); faultCallback.SafeInvoke(ex); } }, request); } private static TLConfigSimple DecryptSimpleConfig(string dataString) { TLConfigSimple result = null; #if !WIN_RT var base64Chars = dataString.Where(ch => { var isGoodBase64 = (ch == '+') || (ch == '=') || (ch == '/') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9'); return isGoodBase64; }).ToArray(); var cleanDataString = new string(base64Chars); const int kGoodSizeBase64 = 344; if (cleanDataString.Length != kGoodSizeBase64) { Log(string.Format("Bad base64 size {0} required {1}", cleanDataString.Length, kGoodSizeBase64)); return null; } byte[] data = null; try { data = Convert.FromBase64String(cleanDataString); } catch (Exception ex) { Log("Bad base64 bytes"); return null; } const int kGoodSizeData = 256; if (data.Length != kGoodSizeData) { Log(string.Format("Bad data size {0} required {1}", data.Length, kGoodSizeData)); return null; } var xml = "yr+18Rex2ohtVy8sroGPBwXD3DOoKCSpjDqYoXgCqB7ioln4eDCFfOBUlfXUEvM/fnKCpF46VkAftlb4VuPDeQSS/ZxZYEGqHaywlroVnXHIjgqoxiAd192xRGreuXIaUKmkwlM9JID9WS2jUsTpzQ91L8MEPLJ/4zrBwZua8W5fECwCCh2c9G5IzzBm+otMS/YKwmR1olzRCyEkyAEjXWqBI9Ftv5eG8m0VkBzOG655WIYdyV0HfDK/NWcvGqa0w/nriMD6mDjKOryamw0OP9QuYgMN0C9xMW9y8SmP4h92OAWodTYgY1hZCxdv6cs5UnW9+PWvS+WIbkh+GaWYxw==AQAB"; var provider = new RSACryptoServiceProvider(); provider.FromXmlString(xml); var parameters = provider.ExportParameters(false); var modulus = parameters.Modulus; var exponent = parameters.Exponent; var dataBI = new BigInteger(data.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var exponentBI = new BigInteger(exponent.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var modulusBI = new BigInteger(modulus.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var authKey = BigInteger.ModPow(dataBI, exponentBI, modulusBI).ToByteArray(); if (authKey[authKey.Length - 1] == 0x00) { authKey = authKey.SubArray(0, authKey.Length - 1); } authKey = authKey.Reverse().ToArray(); if (authKey.Length > 256) { var correctedAuth = new byte[256]; Array.Copy(authKey, authKey.Length - 256, correctedAuth, 0, 256); authKey = correctedAuth; } else if (authKey.Length < 256) { var correctedAuth = new byte[256]; Array.Copy(authKey, 0, correctedAuth, 256 - authKey.Length, authKey.Length); for (var i = 0; i < 256 - authKey.Length; i++) { authKey[i] = 0; } authKey = correctedAuth; } var key = authKey.SubArray(0, 32); var iv = authKey.SubArray(16, 16); var encryptedData = authKey.SubArray(32, authKey.Length - 32); var cipher = CipherUtilities.GetCipher("AES/CBC/NOPADDING"); var param = new KeyParameter(key); cipher.Init(false, new ParametersWithIV(param, iv)); var decryptedData = cipher.DoFinal(encryptedData); const int kDigestSize = 16; var hash = Utils.ComputeSHA256(decryptedData.SubArray(0, 208)); for (var i = 0; i < kDigestSize; i++) { if (hash[i] != decryptedData[208 + i]) { Log("Bad digest"); return null; } } var position = 4; var length = BitConverter.ToInt32(decryptedData, 0); if (length <= 0 || length > 208 || length % 4 != 0) { Log(string.Format("Bad length {0}", length)); return null; } try { result = TLObject.GetObject(decryptedData, ref position); } catch (Exception ex) { Log("Could not read configSimple"); return null; } if (position != length) { Log(string.Format("Bad read length {0} shoud be {1}", position, length)); return null; } #endif return result; } public void GetAsync(Action callback, Action faultCallback = null) { //#if DEBUG // return; //#endif if (Debugger.IsAttached) { return; } #if !WIN_RT PerformAppRequestAsync( result => { Execute.ShowDebugMessage(result != null ? result.ToString() : "null"); callback.SafeInvoke(result); }, (counter, error) => { Execute.ShowDebugMessage(string.Format("GetPublicConfig counter={0} error={1}", counter, error)); faultCallback.SafeInvoke(error); }); #endif } private static string ParseDataString(string dataString) { var serializer = new DataContractJsonSerializer(typeof(RootObject)); RootObject rootObject; try { using (var stream = new MemoryStream(Encoding.Unicode.GetBytes(dataString))) { rootObject = serializer.ReadObject(stream) as RootObject; } } catch (Exception ex) { Log("Failed to parse dns response JSON, ex\n" + ex); return null; } if (rootObject == null) { Log("Not an object received in dns response JSON"); return null; } if (rootObject.Answer == null) { Log("Could not find Answer in dns response JSON"); return null; } var result = new StringBuilder(); for (int i = rootObject.Answer.Count - 1; i >= 0; i--) { result.Append(rootObject.Answer[i].data); } return result.ToString(); } } public interface IPublicConfigService { void GetAsync(Action callback, Action faultCallback = null); } public class Question { public string name { get; set; } public int type { get; set; } } public class Answer { public string name { get; set; } public int type { get; set; } public int TTL { get; set; } public string data { get; set; } } public class RootObject { public int Status { get; set; } public bool TC { get; set; } public bool RD { get; set; } public bool RA { get; set; } public bool AD { get; set; } public bool CD { get; set; } public List Question { get; set; } public List Answer { get; set; } } } ================================================ FILE: Telegram.Api/Services/DCOptionItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.Services { public class ConnectionParams { public byte[] Salt { get; set; } public byte[] SessionId { get; set; } public byte[] AuthKey { get; set; } } public class DCOptionItem { public ConnectionParams Params { get; set; } public int Id { get; set; } public string Hostname { get; set; } public string IpAddress { get; set; } public int Port { get; set; } } } ================================================ FILE: Telegram.Api/Services/DelayedItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Text; using Telegram.Api.TL; namespace Telegram.Api.Services { class DelayedItem { public string Caption { get; set; } public DateTime SendTime { get; set; } //public DateTime? SendBeforeTime { get; set; } public TLObject Object { get; set; } public Action Callback { get; set; } public Action FaultCallback { get; set; } public Action AttemptFailed { get; set; } public int? MaxAttempt { get; set; } public int CurrentAttempt { get; set; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("DelayedItem"); sb.AppendLine("Caption " + Caption); sb.AppendLine("MaxAttempt " + MaxAttempt); sb.AppendLine("CurrentAttempt " + CurrentAttempt); return sb.ToString(); } } } ================================================ FILE: Telegram.Api/Services/DeviceInfo/EmptyDeviceInfoService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.DeviceInfo { public class DeviceInfoService : IDeviceInfoService { public string Model { get; protected set; } public string AppVersion { get; protected set; } public string SystemVersion { get; protected set; } public bool IsBackground { get; protected set; } public string BackgroundTaskName { get; protected set; } public int BackgroundTaskId { get; protected set; } public DeviceInfoService(string model, string appVersion, string systemVersion, bool isBackground, string backgroundTaskName, int backgroundTaskId) { Model = model; AppVersion = appVersion; SystemVersion = systemVersion; IsBackground = isBackground; BackgroundTaskName = backgroundTaskName; BackgroundTaskId = backgroundTaskId; } public DeviceInfoService(TLInitConnection initConnection, bool isBackground, string backgroundTaskName, int backgroundTaskId) { Model = initConnection.DeviceModel.ToString(); AppVersion = initConnection.AppVersion.ToString(); SystemVersion = initConnection.SystemVersion.ToString(); IsBackground = isBackground; BackgroundTaskName = backgroundTaskName; BackgroundTaskId = backgroundTaskId; } } } ================================================ FILE: Telegram.Api/Services/DeviceInfo/IDeviceInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.Services.DeviceInfo { public interface IDeviceInfoService { string Model { get; } string AppVersion { get; } string SystemVersion { get; } bool IsBackground { get; } string BackgroundTaskName { get; } int BackgroundTaskId { get; } } } ================================================ FILE: Telegram.Api/Services/FileManager/AudioFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class AudioFileManager : FileManagerBase, IAudioFileManager { public AudioFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.AudioDownloadersCount; i++) { var worker = new Worker(OnDownloading, "audioDownloader" + i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { //_eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } var partName = part.ParentItem.InputLocation.GetPartFileName(part.Number, "audio"); var isLastPart = part.Number + 1 == part.ParentItem.Parts.Count; var partLength = FileUtils.GetLocalFileLength(partName); var partExists = partLength > 0; var isCorrectPartLength = isLastPart || partLength == part.Limit.Value; if (!partExists || !isCorrectPartLength) { bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } //part.File = GetFile(part.ParentItem.DCId, (TLInputFileLocationBase) part.ParentItem.InputAudioLocation, part.Offset, part.Limit, out error, out canceled); //while (part.File == null) //{ // part.File = GetFile(part.ParentItem.DCId, (TLInputFileLocationBase) part.ParentItem.InputAudioLocation, part.Offset, part.Limit, out error, out canceled); //} } // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; FileUtils.CheckMissingPart(_itemsSyncRoot, part, partName); isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = downloadedCount / (double)count; } else { _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { var fileName = part.ParentItem.InputLocation.GetFileName("audio", ".mp3"); var getPartName = new Func(x => x.ParentItem.InputLocation.GetPartFileName(x.Number, "audio")); FileUtils.MergePartsToFile(getPartName, part.ParentItem.Parts, fileName); part.ParentItem.IsoFileName = fileName; if (part.ParentItem.Callback != null) { Execute.BeginOnThreadPool(() => part.ParentItem.Callback(part.ParentItem)); } else { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } } else { //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress))); } } } public void DownloadFile(TLInt dcId, TLInputFileLocationBase fileLocation, TLObject owner, TLInt fileSize, Action callback) { var downloadableItem = GetDownloadableItem(dcId, fileLocation, owner, fileSize, callback); var downloadedCount = downloadableItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = downloadableItem.Parts.Count; var isComplete = downloadedCount == count; if (isComplete) { var fileName = downloadableItem.InputLocation.GetFileName("audio", ".mp3"); var getPartName = new Func(x => x.ParentItem.InputLocation.GetPartFileName(x.Number, "audio")); FileUtils.MergePartsToFile(getPartName, downloadableItem.Parts, fileName); downloadableItem.IsoFileName = fileName; _eventAggregator.Publish(downloadableItem); } else { lock (_itemsSyncRoot) { bool addFile = true; foreach (var item in _items) { if (item.InputLocation.LocationEquals(fileLocation) && item.Owner == owner) { addFile = false; break; } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } } private DownloadableItem GetDownloadableItem(TLInt dcId, TLInputFileLocationBase location, TLObject owner, TLInt fileSize, Action callback) { var item = new DownloadableItem { Owner = owner, DCId = dcId, InputLocation = location, Callback = callback, }; item.Parts = GetItemParts(fileSize, item); return item; } } } ================================================ FILE: Telegram.Api/Services/FileManager/DocumentFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class DocumentFileManager : FileManagerBase, IDocumentFileManager { public DocumentFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.BigFileWorkersNumber; i++) { var worker = new Worker(OnDownloading, "documentDownloader" + i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { //_eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } var partName = part.ParentItem.InputLocation.GetPartFileName(part.Number, "document"); bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } //part.File = GetFile(part.ParentItem.DCId, part.ParentItem.InputDocumentLocation, part.Offset, part.Limit); //while (part.File == null) //{ // part.File = GetFile(part.ParentItem.DCId, part.ParentItem.InputDocumentLocation, part.Offset, part.Limit); //} // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; if (!part.ParentItem.SuppressMerge) { FileUtils.CheckMissingPart(_itemsSyncRoot, part, partName); } isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = downloadedCount / (double)count; } else { //var id = part.ParentItem.InputDocumentLocation.Id; //var accessHash = part.ParentItem.InputDocumentLocation.AccessHash; //var fileExtension = Path.GetExtension(part.ParentItem.FileName.ToString()); //var fileName = string.Format("document{0}_{1}{2}", id, accessHash, fileExtension); //if (fileName.EndsWith(".mp4")) //{ // Logs.Log.SyncWrite("FileManager.IsComplete " + fileName + " hash=" + part.ParentItem.GetHashCode()); //} _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { //var id = part.ParentItem.InputDocumentLocation.Id; //var accessHash = part.ParentItem.InputDocumentLocation.AccessHash; //var version = part.ParentItem.InputDocumentLocation.Version; var fileExtension = Path.GetExtension(part.ParentItem.FileName.ToString()); var fileName = part.ParentItem.InputLocation.GetFileName("document", fileExtension); Func getPartName = x => part.ParentItem.InputLocation.GetPartFileName(x.Number, "document"); if (!part.ParentItem.SuppressMerge) { FileUtils.MergePartsToFile(getPartName, part.ParentItem.Parts, fileName); } part.ParentItem.IsoFileName = fileName; if (part.ParentItem.Callback != null) { Execute.BeginOnThreadPool(() => { part.ParentItem.Callback(part.ParentItem); if (part.ParentItem.Callbacks != null) { foreach (var callback in part.ParentItem.Callbacks) { callback.SafeInvoke(part.ParentItem); } } }); } else { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } } else { if (part.NotifyProgress) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress))); } } } } public void DownloadFileAsync(TLString originalFileName, TLInt dcId, TLInputFileLocationBase fileLocation, TLObject owner, TLInt fileSize, Action startCallback, Action callback = null) { Execute.BeginOnThreadPool(() => { var downloadableItem = GetDownloadableItem(originalFileName, dcId, fileLocation, owner, fileSize, callback); var downloadedCount = downloadableItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = downloadableItem.Parts.Count; var isComplete = downloadedCount == count; if (isComplete) { var fileExtension = Path.GetExtension(downloadableItem.FileName.ToString()); var fileName = downloadableItem.InputLocation.GetFileName("document", fileExtension); Func getPartName = x => downloadableItem.InputLocation.GetPartFileName(x.Number, "document"); FileUtils.MergePartsToFile(getPartName, downloadableItem.Parts, fileName); downloadableItem.IsoFileName = fileName; _eventAggregator.Publish(downloadableItem); } else { var progress = downloadedCount/(double) count; startCallback.SafeInvoke(progress); lock (_itemsSyncRoot) { bool addFile = true; foreach (var item in _items) { if (item.InputLocation.LocationEquals(fileLocation)) { //item.SuppressMerge = true; if (callback != null) { if (item.Callbacks == null) { item.Callbacks = new List>(); } item.Callbacks.Add(callback); addFile = false; break; } //item. if (item.Owner == owner) { addFile = false; break; } } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } }); } private DownloadableItem GetDownloadableItem(TLString fileName, TLInt dcId, TLInputFileLocationBase location, TLObject owner, TLInt fileSize, Action callback) { var item = new DownloadableItem { DCId = dcId, FileName = fileName, Owner = owner, InputLocation = location, Callback = callback }; item.Parts = GetItemParts(fileSize, item); return item; } protected override List GetItemParts(TLInt size, DownloadableItem item) { var chunkSize = size.Value > 1024*1024 ? Constants.DownloadedBigChunkSize : Constants.DownloadedChunkSize; var parts = new List(); var partsCount = size.Value / chunkSize + (size.Value % chunkSize > 0 ? 1 : 0); var step = partsCount / 25; for (var i = 0; i < partsCount; i++) { var part = new DownloadablePart(item, new TLInt(i * chunkSize), size.Value == 0 ? new TLInt(1024 * 1024) : new TLInt(chunkSize), i); var partName = item.InputLocation.GetPartFileName(part.Number, "document"); var partLength = FileUtils.GetLocalFileLength(partName); if (partLength >= 0) { var isCompletePart = (part.Number + 1 == partsCount) || partLength == part.Limit.Value; part.Status = isCompletePart ? PartStatus.Processed : PartStatus.Ready; } part.NotifyProgress = part.Status == PartStatus.Ready && (step == 0 || i % step == 0); parts.Add(part); } return parts; } } } ================================================ FILE: Telegram.Api/Services/FileManager/DownloadableItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class DownloadableItem { public TLInt DCId { get; set; } public TLString FileName { get; set; } public TLObject Owner { get; set; } public System.Action Callback { get; set; } public IList> Callbacks { get; set; } public TLInputFileLocationBase InputLocation { get; set; } public List Parts { get; set; } public string IsoFileName { get; set; } public bool Canceled { get; set; } public bool SuppressMerge { get; set; } public TLFileCdnRedirect CdnRedirect { get; set; } #region Http public string SourceUri { get; set; } public string DestFileName { get; set; } public System.Action FaultCallback { get; set; } public IList> FaultCallbacks { get; set; } public double Timeout { get; set; } public void IncreaseTimeout() { Timeout = Timeout * 2.0; if (Timeout == 0.0) { Timeout = 4.0; } if (Timeout >= 32.0) { Timeout = 4.0; } } #endregion } } ================================================ FILE: Telegram.Api/Services/FileManager/DownloadablePart.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public enum PartStatus { Ready, Processing, Processed, } public class DownloadablePart { public int Number { get; protected set; } public DownloadableItem ParentItem { get; protected set; } public TLInt Offset { get; protected set; } public TLInt Limit { get; protected set; } public PartStatus Status { get; set; } public TLFile File { get; set; } public int HttpErrorsCount { get; set; } public bool NotifyProgress { get; set; } public DownloadablePart(DownloadableItem item, TLInt offset, TLInt limit, int number) { ParentItem = item; Offset = offset; Limit = limit; Number = number; NotifyProgress = true; } public override string ToString() { return string.Format("{0} {1} {2}", Number, Offset, Limit); } } } ================================================ FILE: Telegram.Api/Services/FileManager/DownloadingCanceledEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.Services.FileManager { public class DownloadingCanceledEventArgs { public DownloadableItem Item { get; protected set; } public DownloadingCanceledEventArgs(DownloadableItem item) { Item = item; } } } ================================================ FILE: Telegram.Api/Services/FileManager/EncryptedFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class EncryptedFileManager : FileManagerBase, IEncryptedFileManager { public EncryptedFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.BigFileWorkersNumber; i++) { var worker = new Worker(OnDownloading, "encryptedDownloader"+i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { //_eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } var partName = part.ParentItem.InputLocation.GetPartFileName(part.Number, "encrypted"); bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; FileUtils.CheckMissingPart(_itemsSyncRoot, part, partName); isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = downloadedCount / (double)count; } else { _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { var fileName = part.ParentItem.InputLocation.GetFileName("encrypted"); var getPartFileName = new Func(p => p.ParentItem.InputLocation.GetPartFileName(p.Number, "encrypted")); FileUtils.MergePartsToFile(getPartFileName, part.ParentItem.Parts, fileName); part.ParentItem.IsoFileName = fileName; if (part.ParentItem.Callback != null) { part.ParentItem.Callback(part.ParentItem); } else { _eventAggregator.Publish(part.ParentItem); } } else { _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress)); } } } public void DownloadFile(TLEncryptedFile file, TLObject owner, Action callback) { var inputFile = new TLInputEncryptedFileLocation { Id = file.Id, AccessHash = file.AccessHash }; var downloadableItem = GetDownloadableItem(file.DCId, inputFile, owner, file.Size, callback); var downloadedCount = downloadableItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = downloadableItem.Parts.Count; var isComplete = downloadedCount == count; if (isComplete) { var fileName = downloadableItem.InputLocation.GetFileName("encrypted"); Func getPartName = x => downloadableItem.InputLocation.GetPartFileName(x.Number, "encrypted"); FileUtils.MergePartsToFile(getPartName, downloadableItem.Parts, fileName); downloadableItem.IsoFileName = fileName; if (downloadableItem.Callback != null) { downloadableItem.Callback(downloadableItem); } else { _eventAggregator.Publish(downloadableItem); } } else { lock (_itemsSyncRoot) { bool addFile = true; foreach (var item in _items) { if (item.InputLocation.LocationEquals(inputFile)) { addFile = false; break; } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } } private DownloadableItem GetDownloadableItem(TLInt dcId, TLInputFileLocationBase location, TLObject owner, TLInt fileSize, Action callback) { var item = new DownloadableItem { Owner = owner, DCId = dcId, InputLocation = location, Callback = callback }; item.Parts = GetItemParts(fileSize, item); return item; } protected override List GetItemParts(TLInt size, DownloadableItem item) { var chunkSize = size.Value > 1024 * 1024 ? Constants.DownloadedBigChunkSize : Constants.DownloadedChunkSize; var parts = new List(); var partsCount = size.Value / chunkSize + (size.Value % chunkSize > 0 ? 1 : 0); for (var i = 0; i < partsCount; i++) { var part = new DownloadablePart(item, new TLInt(i * chunkSize), size.Value == 0 ? new TLInt(1024 * 1024) : new TLInt(chunkSize), i); var partName = item.InputLocation.GetPartFileName(part.Number, "encrypted"); var partLength = FileUtils.GetLocalFileLength(partName); if (partLength >= 0) { var isCompletePart = (part.Number + 1 == partsCount) || partLength == part.Limit.Value; part.Status = isCompletePart ? PartStatus.Processed : PartStatus.Ready; } parts.Add(part); } return parts; } } } ================================================ FILE: Telegram.Api/Services/FileManager/FileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class FileManager : FileManagerBase, IFileManager { public FileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.WorkersNumber; i++) { var worker = new Worker(OnDownloading, "downloader"+i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new DownloadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; var data = part.File.Bytes.Data; if (data.Length < part.Limit.Value && (part.Number + 1) != part.ParentItem.Parts.Count) { var complete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!complete) { var emptyBufferSize = part.Limit.Value - data.Length; var position = data.Length; var missingPart = new DownloadablePart(part.ParentItem, new TLInt(position), new TLInt(emptyBufferSize), -part.Number); var currentItemIndex = part.ParentItem.Parts.IndexOf(part); part.ParentItem.Parts.Insert(currentItemIndex + 1, missingPart); } } isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = (double)downloadedCount / count; } else { _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { byte[] bytes = { }; foreach (var p in part.ParentItem.Parts) { bytes = TLUtils.Combine(bytes, p.File.Bytes.Data); } //part.ParentItem.Location.Buffer = bytes; var fileName = part.ParentItem.InputLocation.GetFileName("", ".jpg"); StringLocker.Lock(fileName, () => FileUtils.WriteBytes(fileName, bytes)); if (part.ParentItem.Callback != null) { Execute.BeginOnThreadPool(() => { part.ParentItem.Callback.SafeInvoke(part.ParentItem); if (part.ParentItem.Callbacks != null) { foreach (var callback in part.ParentItem.Callbacks) { callback.SafeInvoke(part.ParentItem); } } }); } else { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } } else { //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress))); } } } public void DownloadFile(TLFileLocation file, TLObject owner, TLInt fileSize) { var downloadableItem = GetDownloadableItem(file, owner, fileSize, null); lock (_itemsSyncRoot) { bool addFile = true; var inputFileLocation = file.ToInputFileLocation(); foreach (var item in _items) { if (item.InputLocation.LocationEquals(inputFileLocation) && item.Owner == owner) { addFile = false; break; } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } public void DownloadFile(TLFileLocation file, TLObject owner, TLInt fileSize, Action callback) { var downloadableItem = GetDownloadableItem(file, owner, fileSize, callback); lock (_itemsSyncRoot) { bool addFile = true; var inputFileLocation = file.ToInputFileLocation(); foreach (var item in _items) { if (item.InputLocation.LocationEquals(inputFileLocation)) { if (callback != null) { if (item.Callbacks == null) { item.Callbacks = new List>(); } item.Callbacks.Add(callback); addFile = false; break; } if (item.Owner == owner) { addFile = false; break; } } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } protected DownloadableItem GetDownloadableItem(TLFileLocation location, TLObject owner, TLInt fileSize, Action callback) { var item = new DownloadableItem { Owner = owner, DCId = location.DCId, Callback = callback, InputLocation = location.ToInputFileLocation() }; item.Parts = GetItemParts(fileSize, item); return item; } } public class StringLocker { private static readonly object _syncRoot = new Object(); private static readonly Dictionary _syncRoots = new Dictionary(); public static void Lock(string key, Action action) { object keySyncRoot; lock (_syncRoot) { if (!_syncRoots.TryGetValue(key, out keySyncRoot)) { keySyncRoot = new object(); _syncRoots[key] = keySyncRoot; } } lock (keySyncRoot) { action(); } } } } ================================================ FILE: Telegram.Api/Services/FileManager/FileManagerBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Threading; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public abstract class FileManagerBase { private readonly object _randomRoot = new object(); private readonly Random _random = new Random(); protected readonly object _itemsSyncRoot = new object(); protected readonly List _workers = new List(Constants.WorkersNumber); protected readonly List _items = new List(); protected readonly IMTProtoService _mtProtoService; protected readonly ITelegramEventAggregator _eventAggregator; protected FileManagerBase(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) { _mtProtoService = mtProtoService; _eventAggregator = eventAggregator; } protected void ProcessFilePart(DownloadablePart part, TLInt dcId, TLInputFileLocationBase location, out bool canceled) { do { TLRPCError error; TLFileBase result; if (part.ParentItem.CdnRedirect != null) { TLCdnFileReuploadNeeded cdnFileReuploadNeeded; bool tokenInvalid; result = GetCdnFile(part.ParentItem.CdnRedirect, part.Offset, part.Limit, out cdnFileReuploadNeeded, out error, out canceled, out tokenInvalid); if (cdnFileReuploadNeeded != null) { ReuploadFile(part.ParentItem.CdnRedirect, dcId, cdnFileReuploadNeeded.RequestToken, out error, out canceled, out tokenInvalid); } if (tokenInvalid) { lock (_itemsSyncRoot) { part.ParentItem.CdnRedirect = null; } continue; } } else { result = GetFile(dcId, location, part.Offset, part.Limit, out error, out canceled); var fileCdnRedirect = result as TLFileCdnRedirect; if (fileCdnRedirect != null) { lock (_itemsSyncRoot) { part.ParentItem.CdnRedirect = fileCdnRedirect; } continue; } } part.File = result as TLFile; if (canceled) { return; } } while (part.File == null); } protected TLFileBase GetFile(TLInt dcId, TLInputFileLocationBase location, TLInt offset, TLInt limit, out TLRPCError er, out bool isCanceled) { var manualResetEvent = new ManualResetEvent(false); TLFileBase result = null; TLRPCError outError = null; var outIsCanceled = false; _mtProtoService.GetFileAsync(dcId, location, offset, limit, file => { result = file; manualResetEvent.Set(); }, error => { outError = error; if (error.CodeEquals(ErrorCode.INTERNAL) || (error.CodeEquals(ErrorCode.BAD_REQUEST) && (error.TypeEquals(ErrorType.LOCATION_INVALID) || error.TypeEquals(ErrorType.VOLUME_LOC_NOT_FOUND))) || (error.CodeEquals(ErrorCode.NOT_FOUND) && error.Message != null && error.Message.ToString().StartsWith("Incorrect dhGen"))) { outIsCanceled = true; manualResetEvent.Set(); return; } int delay; lock (_randomRoot) { delay = _random.Next(1000, 3000); } Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(delay), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); er = outError; isCanceled = outIsCanceled; return result; } protected TLVector ReuploadFile(TLFileCdnRedirect redirect, TLInt dcId, TLString requestToken, out TLRPCError er, out bool isCanceled, out bool isTokenInvalid) { var manualResetEvent = new ManualResetEvent(false); TLVector result = null; TLRPCError outError = null; var outIsCanceled = false; var outIsTokenInvalid = false; _mtProtoService.ReuploadCdnFileAsync(dcId, redirect.FileToken, requestToken, callback => { result = callback; manualResetEvent.Set(); }, error => { outError = error; if (error.CodeEquals(ErrorCode.INTERNAL) || (error.CodeEquals(ErrorCode.BAD_REQUEST) && (error.TypeEquals(ErrorType.LOCATION_INVALID) || error.TypeEquals(ErrorType.VOLUME_LOC_NOT_FOUND))) || (error.CodeEquals(ErrorCode.NOT_FOUND) && error.Message != null && error.Message.ToString().StartsWith("Incorrect dhGen"))) { outIsCanceled = true; manualResetEvent.Set(); return; } if (error.CodeEquals(ErrorCode.BAD_REQUEST) && (error.TypeEquals(ErrorType.FILE_TOKEN_INVALID) || error.TypeEquals(ErrorType.REQUEST_TOKEN_INVALID))) { outIsTokenInvalid = true; manualResetEvent.Set(); return; } int delay; lock (_randomRoot) { delay = _random.Next(1000, 3000); } Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(delay), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); er = outError; isCanceled = outIsCanceled; isTokenInvalid = outIsTokenInvalid; return result; } protected byte[] GetIV(byte[] ivec, TLInt offset) { var iv = new byte[ivec.Length]; Buffer.BlockCopy(ivec, 0, iv, 0, ivec.Length); Array.Reverse(iv); var bi = new System.Numerics.BigInteger(TLUtils.Combine(iv, new byte[] { 0x00 })); bi = (bi + offset.Value/16); var biArray = bi.ToByteArray(); var b = new byte[16]; Buffer.BlockCopy(biArray, 0, b, 0, Math.Min(b.Length, biArray.Length)); Array.Reverse(b); return b; } protected TLFileBase GetCdnFile(TLFileCdnRedirect redirect, TLInt offset, TLInt limit, out TLCdnFileReuploadNeeded reuploadNeeded, out TLRPCError er, out bool isCanceled, out bool isTokenInvalid) { var manualResetEvent = new ManualResetEvent(false); TLFileBase result = null; TLCdnFileReuploadNeeded outReuploadNeeded = null; TLRPCError outError = null; var outIsCanceled = false; var outIsTokenInvalid = false; _mtProtoService.GetCdnFileAsync(redirect.DCId, redirect.FileToken, offset, limit, cdnFileBase => { var cdnFile = cdnFileBase as TLCdnFile; if (cdnFile != null) { var iv = GetIV(redirect.EncryptionIV.Data, offset); var counter = offset.Value / 16; iv[15] = (byte)(counter & 0xFF); iv[14] = (byte)((counter >> 8) & 0xFF); iv[13] = (byte)((counter >> 16) & 0xFF); iv[12] = (byte)((counter >> 24) & 0xFF); var key = redirect.EncryptionKey.Data; var ecount_buf = new byte[0]; var num = 0u; var bytes = Utils.AES_ctr128_encrypt(cdnFile.Bytes.Data, key, ref iv, ref ecount_buf, ref num); result = new TLFile { Bytes = TLString.FromBigEndianData(bytes) }; } var cdnFileReuploadNeeded = cdnFileBase as TLCdnFileReuploadNeeded; if (cdnFileReuploadNeeded != null) { outReuploadNeeded = cdnFileReuploadNeeded; } manualResetEvent.Set(); }, error => { outError = error; if (error.CodeEquals(ErrorCode.INTERNAL) || (error.CodeEquals(ErrorCode.BAD_REQUEST) && (error.TypeEquals(ErrorType.LOCATION_INVALID) || error.TypeEquals(ErrorType.VOLUME_LOC_NOT_FOUND))) || (error.CodeEquals(ErrorCode.NOT_FOUND) && error.Message != null && error.Message.ToString().StartsWith("Incorrect dhGen"))) { outIsCanceled = true; manualResetEvent.Set(); return; } if (error.CodeEquals(ErrorCode.BAD_REQUEST) && error.TypeEquals(ErrorType.FILE_TOKEN_INVALID)) { outIsTokenInvalid = true; manualResetEvent.Set(); return; } int delay; lock (_randomRoot) { delay = _random.Next(1000, 3000); } Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(delay), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); reuploadNeeded = outReuploadNeeded; er = outError; isCanceled = outIsCanceled; isTokenInvalid = outIsTokenInvalid; return result; } protected virtual List GetItemParts(TLInt size, DownloadableItem item) { var chunkSize = size.Value > 1024 * 1024? Constants.DownloadedBigChunkSize : Constants.DownloadedChunkSize; var parts = new List(); var partsCount = size.Value / chunkSize + ((size.Value % chunkSize > 0 || size.Value == 0) ? 1 : 0); for (var i = 0; i < partsCount; i++) { var part = new DownloadablePart(item, new TLInt(i * chunkSize), size.Value == 0 ? new TLInt(1024 * 1024) : new TLInt(chunkSize), i); parts.Add(part); } return parts; } public void CancelDownloadFile(TLObject owner) { lock (_itemsSyncRoot) { var items = _items.Where(x => x.Owner == owner); foreach (var item in items) { item.Canceled = true; } } } public void CancelDownloadFileAsync(TLObject owner) { Execute.BeginOnThreadPool(() => CancelDownloadFile(owner)); } protected void StartAwaitingWorkers() { var awaitingWorkers = _workers.Where(x => x.IsWaiting); foreach (var awaitingWorker in awaitingWorkers) { awaitingWorker.Start(); } } } } ================================================ FILE: Telegram.Api/Services/FileManager/IAudioFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IAudioFileManager { void DownloadFile(TLInt dcId, TLInputFileLocationBase file, TLObject owner, TLInt fileSize, System.Action callback = null); void CancelDownloadFile(TLObject owner); } } ================================================ FILE: Telegram.Api/Services/FileManager/IDocumentFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IDocumentFileManager { void DownloadFileAsync(TLString fileName, TLInt dcId, TLInputFileLocationBase file, TLObject owner, TLInt fileSize, Action startCallback, Action callback = null); void CancelDownloadFileAsync(TLObject owner); } } ================================================ FILE: Telegram.Api/Services/FileManager/IEncryptedFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IEncryptedFileManager { void DownloadFile(TLEncryptedFile file, TLObject owner, Action callback = null); void CancelDownloadFile(TLObject owner); } } ================================================ FILE: Telegram.Api/Services/FileManager/IFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IFileManager { void DownloadFile(TLFileLocation file, TLObject owner, TLInt fileSize); void DownloadFile(TLFileLocation file, TLObject owner, TLInt fileSize, System.Action callback); void CancelDownloadFile(TLObject owner); } } ================================================ FILE: Telegram.Api/Services/FileManager/IUploadAudioFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IUploadAudioFileManager { void UploadFile(TLLong fileId, TLObject owner, string fileName); void UploadFile(TLLong fileId, TLObject owner, string fileName, IList parts); void CancelUploadFile(TLLong fileId); } } ================================================ FILE: Telegram.Api/Services/FileManager/IUploadFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #if WP8 using Windows.Storage; #endif using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IUploadFileManager { void UploadFile(TLLong fileId, TLObject owner, byte[] bytes); #if WP8 void UploadFile(TLLong fileId, TLObject owner, StorageFile file); #endif void CancelUploadFile(TLLong fileId); } public interface IUploadDocumentFileManager { void UploadFile(TLLong fileId, TLObject owner, byte[] bytes); #if WP8 void UploadFile(TLLong fileId, TLObject owner, StorageFile file); void UploadFile(TLLong fileId, TLObject owner, StorageFile file, TLString key, TLString iv); #endif void CancelUploadFile(TLLong fileId); } } ================================================ FILE: Telegram.Api/Services/FileManager/IUploadVideoFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; #if WP8 using Windows.Storage; #endif using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IUploadVideoFileManager { void UploadFile(TLLong fileId, TLObject owner, string fileName); void UploadFile(TLLong fileId, TLObject owner, string fileName, IList parts); #if WP8 void UploadFile(TLLong fileId, bool isGif, TLObject owner, StorageFile file); #endif void CancelUploadFile(TLLong fileId); } } ================================================ FILE: Telegram.Api/Services/FileManager/IVideoFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IVideoFileManager { void DownloadFileAsync(TLInt dcId, TLInputFileLocationBase file, TLObject owner, TLInt fileSize, Action callback); void CancelDownloadFileAsync(TLObject owner); } } ================================================ FILE: Telegram.Api/Services/FileManager/ProgressChangedEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.Services.FileManager { public class ProgressChangedEventArgs { public double Progress { get; protected set; } public DownloadableItem Item { get; protected set; } public ProgressChangedEventArgs(DownloadableItem item, double progress) { Item = item; Progress = progress; } } } ================================================ FILE: Telegram.Api/Services/FileManager/UploadAudioFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class UploadAudioFileManager : IUploadAudioFileManager { private readonly object _itemsSyncRoot = new object(); private readonly List _items = new List(); private readonly List _workers = new List(Constants.WorkersNumber); private readonly ITelegramEventAggregator _eventAggregator; private readonly IMTProtoService _mtProtoService; public UploadAudioFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) { _eventAggregator = eventAggregator; _mtProtoService = mtProtoService; var timer = Stopwatch.StartNew(); for (int i = 0; i < Constants.VideoUploadersCount; i++) { var worker = new Worker(OnUploading, "audioUploader" + i); _workers.Add(worker); } TLUtils.WritePerformance("Start workers timer: " + timer.Elapsed); } private void OnUploading(object state) { UploadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part != null) { var bytes = FileUtils.ReadBytes(part.ParentItem.IsoFileName, part.Position, part.Count); part.SetBuffer(bytes); bool result = PutFile(part.ParentItem.FileId, part.FilePart, part.Bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutFile(part.ParentItem.FileId, part.FilePart, part.Bytes); } part.ClearBuffer(); // indicate progress // indicate complete bool isComplete = false; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; isCanceled = part.ParentItem.Canceled; if (!isCanceled) { isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { double uploadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); double totalCount = part.ParentItem.Parts.Count; progress = uploadedCount / totalCount; } else { _items.Remove(part.ParentItem); } } } if (!isCanceled) { if (isComplete) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } else { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new UploadProgressChangedEventArgs(part.ParentItem, progress))); } } } else { var currentWorker = (Worker)state; currentWorker.Stop(); } } private bool PutFile(TLLong fileId, TLInt filePart, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveFilePartAsync(fileId, filePart, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => { Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(1000), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); return result; } public void UploadFile(TLLong fileId, TLObject owner, string fileName) { long fileLength = FileUtils.GetLocalFileLength(fileName); if (fileLength <= 0) return; var item = GetUploadableItem(fileId, owner, fileName, fileLength); var uploadedCount = item.Parts.Count(x => x.Status == PartStatus.Processed); var count = item.Parts.Count; var isComplete = uploadedCount == count; if (isComplete) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(item)); } else { lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } } public void UploadFile(TLLong fileId, TLObject owner, string fileName, IList parts) { long fileLength = FileUtils.GetLocalFileLength(fileName); if (fileLength <= 0) return; var item = GetUploadableItem(fileId, owner, fileName, fileLength, parts); var uploadedCount = item.Parts.Count(x => x.Status == PartStatus.Processed); var count = item.Parts.Count; var isComplete = uploadedCount == count; //if (isComplete) //{ // Execute.BeginOnThreadPool(() => _eventAggregator.Publish(item)); //} //else { lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } } private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, string isoFileName, long isoFileLength, IList parts) { var item = new UploadableItem(fileId, owner, isoFileName, isoFileLength); item.Parts = GetItemParts(item, isoFileLength, parts); return item; } private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, string isoFileName, long isoFileLength) { var item = new UploadableItem(fileId, owner, isoFileName, isoFileLength); item.Parts = GetItemParts(item, isoFileLength); return item; } private List GetItemParts(UploadableItem item, long isoFileLength) { const int partSize = 32 * 1024; // 32 Kb: 1 Kb 1024 Kb var parts = new List(); var partsCount = item.IsoFileLength / partSize + (item.IsoFileLength % partSize > 0 ? 1 : 0); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), i * partSize, Math.Min(partSize, isoFileLength - i * partSize)); parts.Add(part); } return parts; } private List GetItemParts(UploadableItem item, long isoFileLength, IList uploadedParts) { const int partSize = 32 * 1024; foreach (var uploadedPart in uploadedParts) { uploadedPart.SetParentItem(item); } var parts = new List(uploadedParts); var uploadedLength = uploadedParts.Sum(x => x.Count); var uploadingLength = item.IsoFileLength - uploadedLength; if (uploadingLength == 0) { return parts; } var partsCount = uploadingLength / partSize + 1; for (var i = 0; i < partsCount; i++) { var partId = i + uploadedParts.Count; var part = new UploadablePart(item, new TLInt(partId), uploadedLength + i * partSize, Math.Min(partSize, isoFileLength - (uploadedLength + i * partSize))); parts.Add(part); } return parts; } private void StartAwaitingWorkers() { var awaitingWorkers = _workers.Where(x => x.IsWaiting); foreach (var awaitingWorker in awaitingWorkers) { awaitingWorker.Start(); } } public void CancelUploadFile(TLLong fileId) { lock (_itemsSyncRoot) { var item = _items.FirstOrDefault(x => x.FileId.Value == fileId.Value); if (item != null) { item.Canceled = true; //_items.Remove(item); } } } } } ================================================ FILE: Telegram.Api/Services/FileManager/UploadFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; using System.Windows.Input; #if WINDOWS_PHONE using Microsoft.Phone.Shell; #endif #if WP8 using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.Streams; #endif using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.TL; using Execute = Telegram.Api.Helpers.Execute; namespace Telegram.Api.Services.FileManager { public class UploadProgressChangedEventArgs { public double Progress { get; protected set; } public UploadableItem Item { get; protected set; } public UploadProgressChangedEventArgs(UploadableItem item, double progress) { Item = item; Progress = progress; } } public class UploadablePart { public UploadableItem ParentItem { get; protected set; } public TLInt FilePart { get; protected set; } public PartStatus Status { get; set; } public byte[] Bytes { get; protected set; } public long Position { get; protected set; } public long Count { get; protected set; } public TLString IV { get; set; } public void ClearBuffer() { Bytes = null; } public UploadablePart(UploadableItem item, TLInt filePart, byte[] bytes) { ParentItem = item; FilePart = filePart; Bytes = bytes; } public UploadablePart(UploadableItem item, TLInt filePart, long position, long count) { ParentItem = item; FilePart = filePart; Position = position; Count = count; } public UploadablePart(UploadableItem item, TLInt filePart, byte[] bytes, long position, long count) { ParentItem = item; FilePart = filePart; Bytes = bytes; Position = position; Count = count; } public override string ToString() { return string.Format("Part={0}, Status={1}, Position={2}, Count={3}", FilePart, Status, Position, Count); } public void SetBuffer(byte[] bytes) { Bytes = bytes; } public void SetParentItem(UploadableItem item) { ParentItem = item; } } public class UploadableItem { public bool FileNotFound { get; set; } public bool IsSmallFile { get; set; } public TLLong FileId { get; protected set; } public string IsoFileName { get; protected set; } public long IsoFileLength { get; protected set; } public TLObject Owner { get; protected set; } #if WP8 public StorageFile File { get; protected set; } public TLString Key { get; protected set; } public TLString IV { get; protected set; } #endif public byte[] Bytes { get; protected set; } public List Parts { get; set; } public bool Canceled { get; set; } public UploadableItem(TLLong fileId, TLObject owner, byte[] bytes) { FileId = fileId; Owner = owner; Bytes = bytes; } #if WP8 public UploadableItem(TLLong fileId, TLObject owner, StorageFile file) { FileId = fileId; Owner = owner; File = file; } public UploadableItem(TLLong fileId, TLObject owner, StorageFile file, TLString key, TLString iv) { FileId = fileId; Owner = owner; File = file; Key = key; IV = iv; } #endif public UploadableItem(TLLong fileId, TLObject owner, string isoFileName, long isoFileLength) { FileId = fileId; Owner = owner; IsoFileName = isoFileName; IsoFileLength = isoFileLength; } } public class UploadFileManager : IUploadFileManager { private readonly object _itemsSyncRoot = new object(); private readonly List _items = new List(); private readonly List _workers = new List(Constants.WorkersNumber); private readonly ITelegramEventAggregator _eventAggregator; private readonly IMTProtoService _mtProtoService; public UploadFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) { _eventAggregator = eventAggregator; _mtProtoService = mtProtoService; var timer = Stopwatch.StartNew(); for (int i = 0; i < Constants.WorkersNumber; i++) { var worker = new Worker(OnUploading, "uploader"+i); _workers.Add(worker); } TLUtils.WritePerformance("Start workers timer: " + timer.Elapsed); } private void OnUploading(object state) { UploadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part != null) { var bytes = part.Bytes; #if WP8 if (bytes == null) { var file = part.ParentItem.File; if (file != null) { var task = FileUtils.FillBuffer(file, part); task.Wait(); bytes = task.Result.Item2; } if (bytes == null) { part.Status = PartStatus.Ready; return; } } #endif var result = PutFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); } // indicate progress // indicate complete bool isComplete = false; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; isCanceled = part.ParentItem.Canceled; if (!isCanceled) { isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { double uploadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); double totalCount = part.ParentItem.Parts.Count; progress = uploadedCount / totalCount; } else { _items.Remove(part.ParentItem); } } } if (!isCanceled) { if (isComplete) { try { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } catch (Exception e) { TLUtils.WriteLine(e.ToString(), LogSeverity.Error); } } else { try { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new UploadProgressChangedEventArgs(part.ParentItem, progress))); } catch (Exception e) { TLUtils.WriteLine(e.ToString(), LogSeverity.Error); } } } } else { var currentWorker = (Worker)state; currentWorker.Stop(); } } private bool PutFile(TLLong fileId, TLInt filePart, TLInt fileTotalPars, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveFilePartAsync(fileId, filePart, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => Execute.BeginOnThreadPool(TimeSpan.FromSeconds(1.0), () => { Execute.ShowDebugMessage(string.Format("upload.saveFilePart part={0}, bytesCount={1} error\n", filePart.Value, bytes.Length) + error); manualResetEvent.Set(); })); manualResetEvent.WaitOne(); return result; } public void UploadFile(TLLong fileId, TLObject owner, byte[] bytes) { var item = GetUploadableItem(fileId, owner, bytes); lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } #if WP8 public void UploadFile(TLLong fileId, TLObject owner, StorageFile file) { var item = GetUploadableItem(fileId, owner, file); lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, StorageFile file) { var item = new UploadableItem(fileId, owner, file); var task = file.GetBasicPropertiesAsync().AsTask(); task.Wait(); var propertie = task.Result; var size = propertie.Size; item.Parts = GetItemParts(item, (int)size); return item; } private static List GetItemParts(UploadableItem item, int size) { var chunkSize = FileUtils.GetChunkSize(size); var partsCount = FileUtils.GetPartsCount(size, chunkSize); var parts = new List(partsCount); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), i * chunkSize, Math.Min(chunkSize, (long)size - i * chunkSize)); parts.Add(part); } return parts; } #endif private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, byte[] bytes) { var item = new UploadableItem(fileId, owner, bytes); item.Parts = GetItemParts(item); return item; } private static List GetItemParts(UploadableItem item) { var size = item.Bytes.Length; var chunkSize = FileUtils.GetChunkSize(size); var partsCount = FileUtils.GetPartsCount(size, chunkSize); var parts = new List(partsCount); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), item.Bytes.SubArray(i * chunkSize, Math.Min(chunkSize, item.Bytes.Length - i * chunkSize))); parts.Add(part); } return parts; } private void StartAwaitingWorkers() { var awaitingWorkers = _workers.Where(x => x.IsWaiting); foreach (var awaitingWorker in awaitingWorkers) { awaitingWorker.Start(); } } public void CancelUploadFile(TLLong fileId) { lock (_itemsSyncRoot) { var item = _items.FirstOrDefault(x => x.FileId.Value == fileId.Value); if (item != null) { item.Canceled = true; //_items.Remove(item); } } } } public class UploadingCanceledEventArgs { public UploadableItem Item { get; protected set; } public UploadingCanceledEventArgs(UploadableItem item) { Item = item; } } public class UploadDocumentFileManager : IUploadDocumentFileManager { private readonly object _itemsSyncRoot = new object(); private readonly List _items = new List(); private readonly List _workers = new List(Constants.WorkersNumber); private readonly ITelegramEventAggregator _eventAggregator; private readonly IMTProtoService _mtProtoService; public UploadDocumentFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) { _eventAggregator = eventAggregator; _mtProtoService = mtProtoService; var timer = Stopwatch.StartNew(); for (var i = 0; i < Constants.DocumentUploadersCount; i++) { var worker = new Worker(OnUploading, "documentUploader" + i); _workers.Add(worker); } TLUtils.WritePerformance("Start workers timer: " + timer.Elapsed); } private void OnUploading(object state) { UploadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part != null) { var bytes = part.Bytes; #if WP8 if (bytes == null) { var file = part.ParentItem.File; Tuple result = null; if (file != null) { var task = FileUtils.FillBuffer(file, part); task.Wait(); result = task.Result; } if (result == null) { part.Status = PartStatus.Ready; return; } if (result.Item1 && result.Item2 == null) { part.Status = PartStatus.Ready; return; } if (!result.Item1) { part.ParentItem.FileNotFound = true; part.Status = PartStatus.Processed; FileUtils.NotifyProgress(_itemsSyncRoot, _items, part, _eventAggregator); return; } bytes = result.Item2; if (bytes == null) { part.Status = PartStatus.Ready; return; } } #endif if (part.ParentItem.IsSmallFile) { bool result = PutFile(part.ParentItem.FileId, part.FilePart, bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutFile(part.ParentItem.FileId, part.FilePart, bytes); } } else { bool result = PutBigFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutBigFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); } } FileUtils.NotifyProgress(_itemsSyncRoot, _items, part, _eventAggregator); } else { var currentWorker = (Worker)state; currentWorker.Stop(); } } private bool PutBigFile(TLLong fileId, TLInt filePart, TLInt fileTotalPars, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveBigFilePartAsync(fileId, filePart, fileTotalPars, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => Execute.BeginOnThreadPool(TimeSpan.FromSeconds(1.0), () => { Execute.ShowDebugMessage(string.Format("upload.saveBigFilePart part={0}, count={1} error\n", filePart.Value, bytes.Length) + error); manualResetEvent.Set(); })); manualResetEvent.WaitOne(); return result; } private bool PutFile(TLLong fileId, TLInt filePart, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveFilePartAsync(fileId, filePart, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => Execute.BeginOnThreadPool(TimeSpan.FromSeconds(1.0), () => { Execute.ShowDebugMessage(string.Format("upload.saveBigFilePart part={0}, count={1} error\n", filePart.Value, bytes.Length) + error); manualResetEvent.Set(); })); manualResetEvent.WaitOne(); return result; } public void UploadFile(TLLong fileId, TLObject owner, byte[] bytes) { FileUtils.SwitchIdleDetectionMode(false); var item = GetUploadableItem(fileId, owner, bytes); lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } #if WP8 public void UploadFile(TLLong fileId, TLObject owner, StorageFile file) { UploadFile(fileId, owner, file, null, null); } public void UploadFile(TLLong fileId, TLObject owner, StorageFile file, TLString key, TLString iv) { FileUtils.SwitchIdleDetectionMode(false); var item = FileUtils.GetUploadableItem(fileId, owner, file, key, iv); //if (item) //{ // item.IsSmallFile = false; // to void auto convert small video documents to videos on server side //} lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } #endif private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, byte[] bytes) { var item = new UploadableItem(fileId, owner, bytes); item.Parts = GetItemParts(item); return item; } private static List GetItemParts(UploadableItem item) { var size = item.Bytes.Length; var chunkSize = FileUtils.GetChunkSize(size); var partsCount = FileUtils.GetPartsCount(size, chunkSize); var parts = new List(partsCount); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), item.Bytes.SubArray(i * chunkSize, Math.Min(chunkSize, item.Bytes.Length - i * chunkSize))); parts.Add(part); } item.IsSmallFile = size < Constants.SmallFileMaxSize;// size < chunkSize; return parts; } private void StartAwaitingWorkers() { var awaitingWorkers = _workers.Where(x => x.IsWaiting); foreach (var awaitingWorker in awaitingWorkers) { awaitingWorker.Start(); } } public void CancelUploadFile(TLLong fileId) { lock (_itemsSyncRoot) { var item = _items.FirstOrDefault(x => x.FileId.Value == fileId.Value); if (item != null) { item.Canceled = true; //_items.Remove(item); } } } } } ================================================ FILE: Telegram.Api/Services/FileManager/UploadVideoFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using Telegram.Api.Helpers; #if WP8 using Windows.Storage; #endif using Telegram.Api.Aggregator; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class UploadVideoFileManager : IUploadVideoFileManager { private readonly object _itemsSyncRoot = new object(); private readonly List _items = new List(); private readonly List _workers = new List(Constants.WorkersNumber); private readonly ITelegramEventAggregator _eventAggregator; private readonly IMTProtoService _mtProtoService; public UploadVideoFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) { _eventAggregator = eventAggregator; _mtProtoService = mtProtoService; var timer = Stopwatch.StartNew(); for (int i = 0; i < Constants.VideoUploadersCount; i++) { var worker = new Worker(OnUploading, "videoUploader"+i); _workers.Add(worker); } TLUtils.WritePerformance("Start workers timer: " + timer.Elapsed); } private void OnUploading(object state) { UploadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part != null) { var bytes = part.Bytes; var fileName = part.ParentItem.IsoFileName; if (!string.IsNullOrEmpty(fileName)) { bytes = FileUtils.ReadBytes(fileName, part.Position, part.Count); } #if WP8 if (bytes == null) { var file = part.ParentItem.File; Tuple result = null; if (file != null) { var task = FileUtils.FillBuffer(file, part); task.Wait(); result = task.Result; } if (result == null) { part.Status = PartStatus.Ready; return; } if (!result.Item1) { part.ParentItem.FileNotFound = true; part.Status = PartStatus.Processed; FileUtils.NotifyProgress(_itemsSyncRoot, _items, part, _eventAggregator); return; } bytes = result.Item2; if (bytes == null) { part.Status = PartStatus.Ready; return; } } #endif if (bytes == null) { Logs.Log.Write(string.Format("UploadVideoFileManager.OnUploading bytes=null position={0} count={1} fileName={2}", part.Position, part.Count, fileName)); //Execute.ShowDebugMessage(string.Format("UploadVideoFileManager.OnUploading bytes=null position={0} count={1} fileName={2}", part.Position, part.Count, fileName)); } if (part.ParentItem.IsSmallFile) { var result = PutFile(part.ParentItem.FileId, part.FilePart, bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutFile(part.ParentItem.FileId, part.FilePart, bytes); } } else { var result = PutBigFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); while (!result) { if (part.ParentItem.Canceled) { return; } result = PutBigFile(part.ParentItem.FileId, part.FilePart, new TLInt(part.ParentItem.Parts.Count), bytes); } } part.ClearBuffer(); FileUtils.NotifyProgress(_itemsSyncRoot, _items, part, _eventAggregator); } else { var currentWorker = (Worker)state; currentWorker.Stop(); } } private bool PutFile(TLLong fileId, TLInt filePart, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveFilePartAsync(fileId, filePart, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => { Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(1000), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); return result; } private bool PutBigFile(TLLong fileId, TLInt filePart, TLInt fileTotalParts, byte[] bytes) { var manualResetEvent = new ManualResetEvent(false); var result = false; _mtProtoService.SaveBigFilePartAsync(fileId, filePart, fileTotalParts, TLString.FromBigEndianData(bytes), savingResult => { result = true; manualResetEvent.Set(); }, error => { Execute.BeginOnThreadPool(TimeSpan.FromMilliseconds(1000), () => manualResetEvent.Set()); }); manualResetEvent.WaitOne(); return result; } public void UploadFile(TLLong fileId, TLObject owner, string fileName) { var fileLength = FileUtils.GetLocalFileLength(fileName); if (fileLength <= 0) return; var item = GetUploadableItem(fileId, owner, fileName, fileLength); var uploadedCount = item.Parts.Count(x => x.Status == PartStatus.Processed); var count = item.Parts.Count; var isComplete = uploadedCount == count; if (isComplete) { Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(item)); } else { lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } } #if WP8 public void UploadFile(TLLong fileId, bool isGif, TLObject owner, StorageFile file) { FileUtils.SwitchIdleDetectionMode(false); var item = FileUtils.GetUploadableItem(fileId, owner, file); item.IsSmallFile = isGif && item.Parts.Sum(part => part.Count) < Constants.GifMaxSize; lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } #endif public void UploadFile(TLLong fileId, TLObject owner, string fileName, IList parts) { FileUtils.SwitchIdleDetectionMode(false); long fileLength = FileUtils.GetLocalFileLength(fileName); if (fileLength <= 0) return; var item = GetUploadableItem(fileId, owner, fileName, fileLength, parts); var uploadedCount = item.Parts.Count(x => x.Status == PartStatus.Processed); var count = item.Parts.Count; var isComplete = uploadedCount == count; if (isComplete) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(item)); } else { lock (_itemsSyncRoot) { _items.Add(item); } StartAwaitingWorkers(); } } private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, string fileName, long fileLength) { FileUtils.SwitchIdleDetectionMode(false); var item = new UploadableItem(fileId, owner, fileName, fileLength); item.Parts = GetItemParts(item, fileLength); return item; } private UploadableItem GetUploadableItem(TLLong fileId, TLObject owner, string fileName, long fileLength, IList parts) { var item = new UploadableItem(fileId, owner, fileName, fileLength); item.Parts = GetItemParts(item, fileLength, parts); return item; } private List GetItemParts(UploadableItem item, long fileLength) { var chunkSize = FileUtils.GetChunkSize(fileLength); var partsCount = FileUtils.GetPartsCount(fileLength, chunkSize); var parts = new List(); for (var i = 0; i < partsCount; i++) { var part = new UploadablePart(item, new TLInt(i), i * chunkSize, Math.Min(chunkSize, fileLength - i * chunkSize)); parts.Add(part); } item.IsSmallFile = fileLength < chunkSize; return parts; } private List GetItemParts(UploadableItem item, long fileLength, IList uploadedParts) { var chunkSize = FileUtils.GetChunkSize(fileLength); var parts = new List(uploadedParts); foreach (var uploadedPart in uploadedParts) { uploadedPart.SetParentItem(item); } var uploadedLength = uploadedParts.Sum(x => x.Count); var partsCount = FileUtils.GetPartsCount(item.IsoFileLength - uploadedLength, chunkSize); for (var i = 0; i < partsCount; i++) { var partId = i + uploadedParts.Count; var part = new UploadablePart(item, new TLInt(partId), uploadedLength + i * chunkSize, Math.Min(chunkSize, fileLength - (uploadedLength + i * chunkSize))); parts.Add(part); } item.IsSmallFile = fileLength < chunkSize; return parts; } private void StartAwaitingWorkers() { var awaitingWorkers = _workers.Where(x => x.IsWaiting); foreach (var awaitingWorker in awaitingWorkers) { awaitingWorker.Start(); } } public void CancelUploadFile(TLLong fileId) { lock (_itemsSyncRoot) { var item = _items.FirstOrDefault(x => x.FileId.Value == fileId.Value); if (item != null) { item.Canceled = true; //_items.Remove(item); } } } } } ================================================ FILE: Telegram.Api/Services/FileManager/VideoFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class VideoFileManager : FileManagerBase, IVideoFileManager { public VideoFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.BigFileWorkersNumber; i++) { var worker = new Worker(OnDownloading, "videoDownloader"+i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { //_eventAggregator.Publish(new UploadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } var partName = part.ParentItem.InputLocation.GetPartFileName(part.Number, "video"); bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } //part.File = GetFile(part.ParentItem.DCId, (TLInputFileLocationBase)part.ParentItem.InputVideoLocation, part.Offset, part.Limit); //while (part.File == null) //{ // part.File = GetFile(part.ParentItem.DCId, (TLInputFileLocationBase)part.ParentItem.InputVideoLocation, part.Offset, part.Limit); //} // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; FileUtils.CheckMissingPart(_itemsSyncRoot, part, partName); isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = downloadedCount / (double)count; } else { _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { var fileName = part.ParentItem.InputLocation.GetFileName("video", ".mp4"); var getPartName = new Func(x => x.ParentItem.InputLocation.GetPartFileName(x.Number, "video")); FileUtils.MergePartsToFile(getPartName, part.ParentItem.Parts, fileName); part.ParentItem.IsoFileName = fileName; _eventAggregator.Publish(part.ParentItem); } else { _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress)); } } } public void DownloadFileAsync(TLInt dcId, TLInputFileLocationBase fileLocation, TLObject owner, TLInt fileSize, Action callback) { Execute.BeginOnThreadPool(() => { var downloadableItem = GetDownloadableItem(dcId, fileLocation, owner, fileSize); var downloadedCount = downloadableItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = downloadableItem.Parts.Count; var isComplete = downloadedCount == count; if (isComplete) { var fileName = downloadableItem.InputLocation.GetFileName("video", ".mp4"); var getPartName = new Func(x => x.ParentItem.InputLocation.GetPartFileName(x.Number, "video")); FileUtils.MergePartsToFile(getPartName, downloadableItem.Parts, fileName); downloadableItem.IsoFileName = fileName; _eventAggregator.Publish(downloadableItem); } else { var progress = downloadedCount / (double)count; callback.SafeInvoke(progress); lock (_itemsSyncRoot) { bool addFile = true; foreach (var item in _items) { if (item.InputLocation.LocationEquals(fileLocation) && item.Owner == owner) { addFile = false; break; } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } }); } private DownloadableItem GetDownloadableItem(TLInt dcId, TLInputFileLocationBase location, TLObject owner, TLInt fileSize) { var item = new DownloadableItem { Owner = owner, DCId = dcId, InputLocation = location }; item.Parts = GetItemParts(fileSize, item); return item; } protected override List GetItemParts(TLInt size, DownloadableItem item) { var chunkSize = size.Value > 1024 * 1024 ? Constants.DownloadedBigChunkSize : Constants.DownloadedChunkSize; var parts = new List(); var partsCount = size.Value/chunkSize + (size.Value % chunkSize > 0 ? 1 : 0); for (var i = 0; i < partsCount; i++) { var part = new DownloadablePart(item, new TLInt(i * chunkSize), size.Value == 0 ? new TLInt(1024 * 1024) : new TLInt(chunkSize), i); var partName = item.InputLocation.GetPartFileName(part.Number, "video"); var partLength = FileUtils.GetLocalFileLength(partName); if (partLength >= 0) { var isCompletePart = (part.Number + 1 == partsCount) || partLength == part.Limit.Value; part.Status = isCompletePart ? PartStatus.Processed : PartStatus.Ready; } parts.Add(part); } return parts; } } } ================================================ FILE: Telegram.Api/Services/FileManager/Worker.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Threading; #if !WINDOWS_PHONE using System.Threading.Tasks; #endif using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { #if WINDOWS_PHONE public class Worker { private readonly Thread _thread; private readonly ManualResetEvent _resetEvent = new ManualResetEvent(true); public ThreadState ThreadState { get { return _thread.ThreadState; } } public string Name { get { return _thread.Name; } } public Worker(ParameterizedThreadStart start, string name) { _thread = new Thread(state => OnThreadStartInternal(start)); _thread.Name = name; //_thread.IsBackground = true; _thread.Start(this); } private void OnThreadStartInternal(ParameterizedThreadStart start) { while (true) { try { start(this); } catch (Exception e) { TLUtils.WriteException(e); } _resetEvent.WaitOne(); } } public bool IsWaiting { get{ return ThreadState == ThreadState.WaitSleepJoin; } } public void Start() { _resetEvent.Set(); } public void Stop() { _resetEvent.Reset(); } } #else public class Worker { private readonly Task _thread; private readonly ManualResetEvent _resetEvent = new ManualResetEvent(true); public TaskStatus ThreadState { get { return _thread.Status; } } public Worker(Action start, string name) { _thread = new Task(state => OnThreadStartInternal(start, state), this, TaskCreationOptions.LongRunning); //_thread.Name = name; //_thread.IsBackground = true; _thread.Start(); } private bool _isWorking; private void OnThreadStartInternal(Action start, object state) { while (true) { try { start(state); } catch (Exception e) { TLUtils.WriteException(e); } _isWorking = false; _isWorking = _resetEvent.WaitOne(); } } public bool IsWaiting { get { return true; return !_isWorking; } } public void Start() { _resetEvent.Set(); } public void Stop() { _resetEvent.Reset(); } } #endif } ================================================ FILE: Telegram.Api/Services/HistoryItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; namespace Telegram.Api.Services { public enum RequestStatus { Sent, Confirmed, Failed, ReadyToSend } public class HistoryItem { public long Hash { get { return Message != null ? Message.MessageId.Value : 0; } } public TLTransportMessageWithIdBase Message { get; set; } public TLObject Object { get; set; } public string Caption { get; set; } public DateTime SendTime { get; set; } public int TimeToResend { get; set; } public DateTime? SendBeforeTime { get; set; } public RequestStatus Status { get; set; } public Action Callback { get; set; } public Action FastCallback { get; set; } public Action AttemptFailed { get; set; } public Action FaultCallback { get; set; } public Action FaultQueueCallback { get; set; } public long ClientTicksDelta { get; set; } public HistoryItem InvokeAfter { get; set; } public TLRPCError LastError { get; set; } public int DCId { get; set; } //public volatile bool IsSending; public override string ToString() { return string.Format("{0:HH:mm:ss.fff} dc_id={1} {2} hash={3}", SendTime, DCId, Caption, GetHashCode()); } } } ================================================ FILE: Telegram.Api/Services/IMTProtoService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Contacts; using Telegram.Api.Transport; namespace Telegram.Api.Services { public interface IMTProtoService { TLEncryptedTransportMessage GetEncryptedTransportMessage(byte[] authKey, TLLong salt, TLObject obj); #if DEBUG void CheckPublicConfig(); #endif TLInputPeerBase PeerToInputPeer(TLPeerBase peer); void Stop(); void StartInitialize(); void RemoveFromQueue(TLLong id); event EventHandler TransportChecked; string Message { get; } void SetMessageOnTime(double seconds, string message); ITransport GetActiveTransport(); WindowsPhone.Tuple GetCurrentPacketInfo(); string GetTransportInfo(); string Country { get; } event EventHandler GotUserCountry; // To remove multiple UpdateStatusAsync calls, it's prefer to invoke this method instead void RaiseSendStatus(SendStatusEventArgs e); TLInt CurrentUserId { get; set; } IList History { get; } void ClearHistory(string caption, bool createNewSession, bool syncFaultCallbacks = false, Exception e = null); long ClientTicksDelta { get; } /// /// Indicates that service has authKey /// //bool IsInitialized { get; } event EventHandler Initialized; event EventHandler AuthorizationRequired; event EventHandler CheckDeviceLocked; event EventHandler ProxyDisabled; void SaveConfig(); TLConfig LoadConfig(); void GetStateAsync(Action callback, Action faultCallback = null); void GetDifferenceAsync(TLInt pts, TLInt date, TLInt qts, Action callback, Action faultCallback = null); void GetDifferenceWithoutUpdatesAsync(TLInt pts, TLInt date, TLInt qts, Action callback, Action faultCallback = null); void RegisterDeviceAsync(TLInt tokenType, TLString token, Action callback, Action faultCallback = null); void UnregisterDeviceAsync(TLInt tokenType, TLString token, Action callback, Action faultCallback = null); void MessageAcknowledgments(TLVector ids); // auth void BindTempAuthKeyAsync(TLLong permAuthKeyId, TLLong nonce, TLInt expiresAt, TLString encryptedMessage, Action callback, Action faultCallback = null); void SendCodeAsync(TLString phoneNumber, TLString currentNumber, Action callback, Action attemptFailed = null, Action faultCallback = null); void ResendCodeAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null); void CancelCodeAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null); void SignInAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null); void CancelSignInAsync(); void LogOutAsync(Action callback); void LogOutAsync(Action callback, Action faultCallback = null); void LogOutTransportsAsync(Action callback, Action> faultCallback = null); void SignUpAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, TLString firstName, TLString lastName, Action callback, Action faultCallback = null); void SendCallAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null); void SearchAsync(TLInputPeerBase peer, TLString query, TLInputUserBase fromId, TLInputMessagesFilterBase filter, TLInt minDate, TLInt maxDate, TLInt addOffset, TLInt offsetId, TLInt limit, TLInt hash, Action callback, Action faultCallback = null); void GetDialogsAsync(Stopwatch timer, TLInt offsetDate, TLInt offsetId, TLInputPeerBase offsetPeer, TLInt limit, TLInt hash, Action callback, Action faultCallback = null); void GetHistoryAsync(Stopwatch timer, TLInputPeerBase inputPeer, TLPeerBase peer, bool sync, TLInt offsetDate, TLInt offset, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null); void DeleteMessagesAsync(bool revoke, TLVector id, Action callback, Action faultCallback = null); void DeleteHistoryAsync(bool justClear, TLInputPeerBase peer, TLInt offset, Action callback, Action faultCallback = null); void ReadHistoryAsync(TLInputPeerBase peer, TLInt maxId, TLInt offset, Action callback, Action faultCallback = null); void ReadMentionsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void ReadMessageContentsAsync(TLVector id, Action callback, Action faultCallback = null); void GetFullChatAsync(TLInt chatId, Action callback, Action faultCallback = null); void SetTypingAsync(TLInputPeerBase peer, TLBool typing, Action callback, Action faultCallback = null); void SetTypingAsync(TLInputPeerBase peer, TLSendMessageActionBase action, Action callback, Action faultCallback = null); void GetContactsAsync(TLInt hash, Action callback, Action faultCallback = null); void ImportContactsAsync(TLVector contacts, Action callback, Action faultCallback = null); void BlockAsync(TLInputUserBase id, Action callback, Action faultCallback = null); void UnblockAsync(TLInputUserBase id, Action callback, Action faultCallback = null); void GetBlockedAsync(TLInt offset, TLInt limit, Action callback, Action faultCallback = null); void UpdateProfileAsync(TLString firstName, TLString lastName, TLString about, Action callback, Action faultCallback = null); void UpdateStatusAsync(TLBool offline, Action callback, Action faultCallback = null); void GetFileAsync(TLInt dcId, TLInputFileLocationBase location, TLInt offset, TLInt limit, Action callback, Action faultCallback = null); void GetFileAsync(TLInputFileLocationBase location, TLInt offset, TLInt limit, Action callback, Action faultCallback = null); void SaveFilePartAsync(TLLong fileId, TLInt filePart, TLString bytes, Action callback, Action faultCallback = null); void SaveBigFilePartAsync(TLLong fileId, TLInt filePart, TLInt fileTotalParts, TLString bytes, Action callback, Action faultCallback = null); void GetNotifySettingsAsync(TLInputNotifyPeerBase peer, Action settings, Action faultCallback = null); void UpdateNotifySettingsAsync(TLInputNotifyPeerBase peer, TLInputPeerNotifySettings settings, Action callback, Action faultCallback = null); void ResetNotifySettingsAsync(Action callback, Action faultCallback = null); void UploadProfilePhotoAsync(TLInputFile file, Action callback, Action faultCallback = null); void UpdateProfilePhotoAsync(TLInputPhotoBase id, Action callback, Action faultCallback = null); void GetDHConfigAsync(TLInt version, TLInt randomLength, Action result, Action faultCallback = null); void RequestEncryptionAsync(TLInputUserBase userId, TLInt randomId, TLString g_a, Action callback, Action faultCallback = null); void AcceptEncryptionAsync(TLInputEncryptedChat peer, TLString gb, TLLong keyFingerprint, Action callback, Action faultCallback = null); void SendEncryptedAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, Action callback, Action fastCallback, Action faultCallback = null); void SendEncryptedFileAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, TLInputEncryptedFileBase file, Action callback, Action fastCallback, Action faultCallback = null); void SendEncryptedMultiMediaAsync(TLInputEncryptedChat peer, TLVector randomId, TLVector data, TLVector file, Action> callback, Action fastCallback, Action faultCallback = null); void ReadEncryptedHistoryAsync(TLInputEncryptedChat peer, TLInt maxDate, Action callback, Action faultCallback = null); void SendEncryptedServiceAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, Action callback, Action faultCallback = null); void DiscardEncryptionAsync(TLInt chatId, Action callback, Action faultCallback = null); void SetEncryptedTypingAsync(TLInputEncryptedChat peer, TLBool typing, Action callback, Action faultCallback = null); void GetConfigInformationAsync(Action callback); void GetTransportInformationAsync(Action callback); void GetUserPhotosAsync(TLInputUserBase userId, TLInt offset, TLLong maxId, TLInt limit, Action callback, Action faultCallback = null); void GetNearestDCAsync(Action callback, Action faultCallback = null); void GetSupportAsync(Action callback, Action faultCallback = null); void ResetAuthorizationsAsync(Action callback, Action faultCallback = null); void SetInitState(); void PingAsync(TLLong pingId, Action callback, Action faultCallback = null); void PingDelayDisconnectAsync(TLLong pingId, TLInt disconnectDelay, Action callback, Action faultCallback = null); void SearchAsync(TLString q, TLInt limit, Action callback, Action faultCallback = null); void CheckUsernameAsync(TLString username, Action callback, Action faultCallback = null); void UpdateUsernameAsync(TLString username, Action callback, Action faultCallback = null); void GetAccountTTLAsync(Action callback, Action faultCallback = null); void SetAccountTTLAsync(TLAccountDaysTTL ttl, Action callback, Action faultCallback = null); void DeleteAccountTTLAsync(TLString reason, Action callback, Action faultCallback = null); void GetPrivacyAsync(TLInputPrivacyKeyBase key, Action callback, Action faultCallback = null); void SetPrivacyAsync(TLInputPrivacyKeyBase key, TLVector rules, Action callback, Action faultCallback = null); void GetStatusesAsync(Action> callback, Action faultCallback = null); void UpdateTransportInfoAsync(TLDCOption78 dcOption, TLString ipAddress, TLInt port, Action callback); void CheckAndUpdateTransportInfoAsync(TLInt dcId, TLString host, TLInt port, Action callback, Action faultCallback = null); void ResolveUsernameAsync(TLString username, Action callback, Action faultCallback = null); void SendChangePhoneCodeAsync(TLString phoneNumber, TLString currentNumber, Action callback, Action faultCallback = null); void ChangePhoneAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null); void GetWallpapersAsync(Action> callback, Action faultCallback = null); void GetAllStickersAsync(TLString hash, Action callback, Action faultCallback = null); void GetMaskStickersAsync(TLString hash, Action callback, Action faultCallback = null); void UpdateDeviceLockedAsync(TLInt period, Action callback, Action faultCallback = null); void GetSendingQueueInfoAsync(Action callback); void GetSyncErrorsAsync(Action> callback); void GetMessagesAsync(TLVector id, Action callback, Action faultCallback = null); // users void GetFullUserAsync(TLInputUserBase id, Action callback, Action faultCallback = null); void GetUsersAsync(TLVector id, Action> callback, Action faultCallback = null); void SetSecureValueErrorsAsync(TLInputUserBase id, TLVector errors, Action callback, Action faultCallback = null); // messages void GetRecentLocationsAsync(TLInputPeerBase peer, TLInt limit, TLInt hash, Action callback, Action faultCallback = null); void GetFeaturedStickersAsync(bool full, TLInt hash, Action callback, Action faultCallback = null); void GetArchivedStickersAsync(bool full, TLLong offsetId, TLInt limit, Action callback, Action faultCallback = null); void ReadFeaturedStickersAsync(TLVector id, Action callback, Action faultCallback = null); void GetAllDraftsAsync(Action callback, Action faultCallback = null); void SaveDraftAsync(TLInputPeerBase peer, TLDraftMessageBase draft, Action callback, Action faultCallback = null); void GetInlineBotResultsAsync(TLInputUserBase bot, TLInputPeerBase peer, TLInputGeoPointBase geoPoint, TLString query, TLString offset, Action callback, Action faultCallback = null); void SetInlineBotResultsAsync(TLBool gallery, TLBool pr, TLLong queryId, TLVector results, TLInt cacheTime, TLString nextOffset, TLInlineBotSwitchPM switchPM, Action callback, Action faultCallback = null); void SendInlineBotResultAsync(TLMessage45 message, Action callback, Action fastCallback, Action faultCallback = null); void GetDocumentByHashAsync(TLString sha256, TLInt size, TLString mimeType, Action callback, Action faultCallback = null); void SearchGifsAsync(TLString q, TLInt offset, Action callback, Action faultCallback = null); void GetSavedGifsAsync(TLInt hash, Action callback, Action faultCallback = null); void SaveGifAsync(TLInputDocumentBase id, TLBool unsave, Action callback, Action faultCallback = null); void ReorderStickerSetsAsync(bool masks, TLVector order, Action callback, Action faultCallback = null); void SearchGlobalAsync(TLString query, TLInt offsetDate, TLInputPeerBase offsetPeer, TLInt offsetId, TLInt limit, Action callback, Action faultCallback = null); void ReportSpamAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void SendMessageAsync(TLMessage36 message, Action callback, Action fastCallback, Action faultCallback = null); void SendMediaAsync(TLInputPeerBase inputPeer, TLInputMediaBase inputMedia, TLMessage34 message, Action callback, Action faultCallback = null); void StartBotAsync(TLInputUserBase bot, TLString startParam, TLMessage25 message, Action callback, Action faultCallback = null); void SendBroadcastAsync(TLVector contacts, TLInputMediaBase inputMedia, TLMessage25 message, Action callback, Action fastCallback, Action faultCallback = null); void ForwardMessageAsync(TLInputPeerBase peer, TLInt fwdMessageId, TLMessage25 message, Action callback, Action faultCallback = null); void ForwardMessagesAsync(TLInputPeerBase toPeer, TLVector id, IList messages, bool withMyScore, Action callback, Action faultCallback = null); void ForwardMessagesAsync(TLMessage25 commentMessage, TLInputPeerBase toPeer, TLVector id, IList messages, bool withMyScore, Action callback, Action faultCallback = null); void CreateChatAsync(TLVector users, TLString title, Action callback, Action faultCallback = null); void EditChatTitleAsync(TLInt chatId, TLString title, Action callback, Action faultCallback = null); void EditChatPhotoAsync(TLInt chatId, TLInputChatPhotoBase photo, Action callback, Action faultCallback = null); void AddChatUserAsync(TLInt chatId, TLInputUserBase userId, TLInt fwdLimit, Action callback, Action faultCallback = null); void DeleteChatUserAsync(TLInt chatId, TLInputUserBase userId, Action callback, Action faultCallback = null); void GetWebPagePreviewAsync(TLString message, Action callback, Action faultCallback = null); void ExportChatInviteAsync(TLInt chatId, Action callback, Action faultCallback = null); void CheckChatInviteAsync(TLString hash, Action callback, Action faultCallback = null); void ImportChatInviteAsync(TLString hash, Action callback, Action faultCallback = null); void GetStickerSetAsync(TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null); void InstallStickerSetAsync(TLInputStickerSetBase stickerset, TLBool archived, Action callback, Action faultCallback = null); void UninstallStickerSetAsync(TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null); void HideReportSpamAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void GetPeerSettingsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void GetBotCallbackAnswerAsync(TLInputPeerBase peer, TLInt messageId, TLString data, TLBool game, Action callback, Action faultCallback = null); void GetPromoDialogAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void GetRecentStickersAsync(bool attached, TLInt hash, Action callback, Action faultCallback = null); void ClearRecentStickersAsync(bool attached, Action callback, Action faultCallback = null); void GetUnusedStickersAsync(TLInt limit, Action> callback, Action faultCallback = null); void GetAttachedStickersAsync(bool full, TLInputStickeredMediaBase media, Action callback, Action faultCallback = null); void GetCommonChatsAsync(TLInputUserBase user, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null); void GetWebPageAsync(TLString url, TLInt hash, Action callback, Action faultCallback = null); void GetPinnedDialogsAsync(Action callback, Action faultCallback = null); void ReorderPinnedDialogsAsync(bool force, TLVector order, Action callback, Action faultCallback = null); void ToggleDialogPinAsync(bool pinned, TLPeerBase peer, Action callback, Action faultCallback = null); void GetFavedStickersAsync(TLInt hash, Action callback, Action faultCallback = null); void FaveStickerAsync(TLInputDocumentBase id, TLBool unfave, Action callback, Action faultCallback = null); void GetUnreadMentionsAsync(TLInputPeerBase peer, TLInt offsetId, TLInt addOffset, TLInt limit, TLInt maxId, TLInt minId, Action callback, Action faultCallback = null); void UploadMediaAsync(TLInputPeerBase inputPeer, TLInputMediaBase inputMedia, Action callback, Action faultCallback = null); void SendMultiMediaAsync(TLInputPeerBase inputPeer, TLVector inputMedia, TLMessage25 message, Action callback, Action faultCallback = null); void GetStickersAsync(TLString emoticon, TLInt hash, Action callback, Action faultCallback = null); void ReportAsync(TLInputPeerBase peer, TLVector id, TLInputReportReasonBase reason, Action callback, Action faultCallback = null); void SearchStickerSetsAsync(bool full, bool excludeFeatured, TLString q, TLInt hash, Action callback, Action faultCallback = null); void GetPeerDialogsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null); void MarkDialogUnreadAsync(bool unread, TLInputDialogPeer peer, Action callback, Action faultCallback = null); void GetDialogUnreadMarksAsync(Action> callback, Action faultCallback = null); void ToggleTopPeersAsync(TLBool enabled, Action callback, Action faultCallback = null); void ClearAllDraftsAsync(Action callback, Action faultCallback = null); // contacts void DeleteContactAsync(TLInputUserBase id, Action callback, Action faultCallback = null); void DeleteContactsAsync(TLVector id, Action callback, Action faultCallback = null); void GetTopPeersAsync(GetTopPeersFlags flags, TLInt offset, TLInt limit, TLInt hash, Action callback, Action faultCallback = null); void ResetTopPeerRatingAsync(TLTopPeerCategoryBase category, TLInputPeerBase peer, Action callback, Action faultCallback = null); void ResetSavedAsync(Action callback, Action faultCallback = null); void GetSavedAsync(Action> callback, Action faultCallback = null); // channels void GetChannelHistoryAsync(string debugInfo, TLInputPeerBase inputPeer, TLPeerBase peer, bool sync, TLInt offset, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null); void GetMessagesAsync(TLInputChannelBase inputChannel, TLVector id, Action callback, Action faultCallback = null); void UpdateChannelAsync(TLInt channelId, Action callback, Action faultCallback = null); void EditAdminAsync(TLChannel channel, TLInputUserBase userId, TLChannelAdminRights adminRights, Action callback, Action faultCallback = null); void KickFromChannelAsync(TLChannel channel, TLInputUserBase userId, TLBool kicked, Action callback, Action faultCallback = null); void GetParticipantAsync(TLInputChannelBase inputChannel, TLInputUserBase userId, Action callback, Action faultCallback = null); void GetParticipantsAsync(TLInputChannelBase inputChannel, TLChannelParticipantsFilterBase filter, TLInt offset, TLInt limit, TLInt hash, Action callback, Action faultCallback = null); void EditTitleAsync(TLChannel channel, TLString title, Action callback, Action faultCallback = null); void EditAboutAsync(TLChannel channel, TLString about, Action callback, Action faultCallback = null); void EditPhotoAsync(TLChannel channel, TLInputChatPhotoBase photo, Action callback, Action faultCallback = null); void JoinChannelAsync(TLChannel channel, Action callback, Action faultCallback = null); void LeaveChannelAsync(TLChannel channel, Action callback, Action faultCallback = null); void DeleteChannelAsync(TLChannel channel, Action callback, Action faultCallback = null); void InviteToChannelAsync(TLInputChannelBase channel, TLVector users, Action callback, Action faultCallback = null); void GetFullChannelAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null); void CreateChannelAsync(TLInt flags, TLString title, TLString about, Action callback, Action faultCallback = null); void ExportInviteAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null); void CheckUsernameAsync(TLInputChannelBase channel, TLString username, Action callback, Action faultCallback = null); void UpdateUsernameAsync(TLInputChannelBase channel, TLString username, Action callback, Action faultCallback = null); void GetChannelDialogsAsync(TLInt offset, TLInt limit, Action callback, Action faultCallback = null); void GetImportantHistoryAsync(TLInputChannelBase channel, TLPeerBase peer, bool sync, TLInt offsetId, TLInt addOffset, TLInt limit, TLInt maxId, TLInt minId, Action callback, Action faultCallback = null); void ReadHistoryAsync(TLChannel channel, TLInt maxId, Action callback, Action faultCallback = null); void DeleteMessagesAsync(TLInputChannelBase channel, TLVector id, Action callback, Action faultCallback = null); void ToggleInvitesAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null); void ExportMessageLinkAsync(TLInputChannelBase channel, TLInt id, Action callback, Action faultCallback = null); void ToggleSignaturesAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null); void GetMessageEditDataAsync(TLInputPeerBase peer, TLInt id, Action callback, Action faultCallback = null); void EditMessageAsync(TLInputPeerBase peer, TLInt id, TLString message, TLVector entities, TLInputMediaBase media, TLReplyKeyboardBase replyMarkup, bool noWebPage, bool stopGeoLive, TLInputGeoPointBase geoPoint, Action callback, Action faultCallback = null); void UpdatePinnedMessageAsync(bool silent, TLInputChannelBase channel, TLInt id, Action callback, Action faultCallback = null); void ReportSpamAsync(TLInputChannelBase channel, TLInt userId, TLVector id, Action callback, Action faultCallback = null); void DeleteUserHistoryAsync(TLChannel channel, TLInputUserBase userId, Action callback, Action faultCallback = null); void GetAdminedPublicChannelsAsync(Action callback, Action faultCallback = null); void ReadMessageContentsAsync(TLInputChannelBase channel, TLVector id, Action callback, Action faultCallback = null); void SetStickersAsync(TLInputChannelBase channel, TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null); void TogglePreHistoryHiddenAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null); void DeleteHistoryAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null); void SetFeedBroadcastsAsync(TLInt feedId, TLVector channels, TLBool alsoNewlyJoined, Action callback, Action faultCallback = null); void ChangeFeedBroadcastAsync(TLInputChannelBase channel, TLInt feedId, Action callback, Action faultCallback = null); void GetFeedAsync(bool offsetToMaxReed, TLInt feedId, TLFeedPosition offsetPosition, TLInt addOffset, TLInt limit, TLFeedPosition maxPosition, TLFeedPosition minPosition, TLInt hash, Action callback, Action faultCallback = null); void ReadFeedAsync(TLInt feedId, TLFeedPosition maxPosition, Action callback, Action faultCallback = null); // updates void GetChannelDifferenceAsync(bool force, TLInputChannelBase inputChannel, TLChannelMessagesFilerBase filter, TLInt pts, TLInt limit, Action callback, Action faultCallback = null); // admins void ToggleChatAdminsAsync(TLInt chatId, TLBool enabled, Action callback, Action faultCallback = null); void EditChatAdminAsync(TLInt chatId, TLInputUserBase userId, TLBool isAdmin, Action callback, Action faultCallback = null); void DeactivateChatAsync(TLInt chatId, TLBool enabled, Action callback, Action faultCallback = null); void MigrateChatAsync(TLInt chatId, Action callback, Action faultCallback = null); // account void ReportPeerAsync(TLInputPeerBase peer, TLInputReportReasonBase reason, Action callback, Action faultCallback = null); void DeleteAccountAsync(TLString reason, Action callback, Action faultCallback = null); void GetAuthorizationsAsync(Action callback, Action faultCallback = null); void ResetAuthorizationAsync(TLLong hash, Action callback, Action faultCallback = null); void GetPasswordAsync(Action callback, Action faultCallback = null); void GetPasswordSettingsAsync(TLInputCheckPasswordBase password, Action callback, Action faultCallback = null); void UpdatePasswordSettingsAsync(TLInputCheckPasswordBase password, TLPasswordInputSettings newSettings, Action callback, Action faultCallback = null); void CheckPasswordAsync(TLInputCheckPasswordBase password, Action callback, Action faultCallback = null); void RequestPasswordRecoveryAsync(Action callback, Action faultCallback = null); void RecoverPasswordAsync(TLString code, Action callback, Action faultCallback = null); void ConfirmPhoneAsync(TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null); void SendConfirmPhoneCodeAsync(TLString hash, TLBool currentNumber, Action callback, Action faultCallback = null); void GetTmpPasswordAsync(TLInputCheckPasswordBase password, TLInt period, Action callback, Action faultCallback = null); void GetWebAuthorizationsAsync(Action callback, Action faultCallback = null); void ResetWebAuthorizationAsync(TLLong hash, Action callback, Action faultCallback = null); void ResetWebAuthorizationsAsync(Action callback, Action faultCallback = null); void GetAllSecureValuesAsync(Action> callback, Action faultCallback = null); void GetSecureValueAsync(TLVector types, Action> callback, Action faultCallback = null); void SaveSecureValueAsync(TLInputSecureValue value, TLLong secureSecretId, Action callback, Action faultCallback = null); void DeleteSecureValueAsync(TLVector types, Action callback, Action faultCallback = null); void GetAuthorizationFormAsync(TLInt botId, TLString scope, TLString publicKey, Action callback, Action faultCallback = null); void GetAuthorizationFormAndPassportConfigAsync(TLInt botId, TLString scope, TLString publicKey, TLInt passportSettingsHash, Action callback, Action faultCallback = null); void AcceptAuthorizationAsync(TLInt botId, TLString scope, TLString publicKey, TLVector valueHashes, TLSecureCredentialsEncrypted credentials, Action callback, Action faultCallback = null); void SendVerifyPhoneCodeAsync(TLString phoneNumber, TLBool currentNumber, Action callback, Action faultCallback = null); void VerifyPhoneAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null); void SendVerifyEmailCodeAsync(TLString email, Action callback, Action faultCallback = null); void VerifyEmailAsync(TLString email, TLString code, Action callback, Action faultCallback = null); void InitTakeoutSessionAsync(bool contacts, bool messageUsers, bool messageChats, bool messageMegagroups, bool messageChannels, bool files, TLInt fileMaxSize, TLLong takeoutId, Action callback, Action faultCallback = null); void GetPassportDataAsync(Action> callback, Action faultCallback = null); // help void GetAppChangelogAsync(TLString deviceModel, TLString systemVersion, TLString appVersion, TLString langCode, Action callback, Action faultCallback = null); void GetTermsOfServiceAsync(TLString countryISO2, Action callback, Action faultCallback = null); void GetCdnConfigAsync(Action callback, Action faultCallback = null); void GetProxyDataAsync(Action callback, Action faultCallback = null); void GetDeepLinkInfoAsync(TLString path, Action callback, Action faultCallback = null); void GetPassportConfigAsync(TLInt hash, Action callback, Action faultCallback = null); // upload void GetCdnFileAsync(TLInt dcId, TLString fileToken, TLInt offset, TLInt limit, Action callback, Action faultCallback = null); void ReuploadCdnFileAsync(TLInt dcId, TLString fileToken, TLString requestToken, Action> callback, Action faultCallback = null); // encrypted chats void RekeyAsync(TLEncryptedChatBase chat, Action callback); // phone void GetCallConfigAsync(Action callback, Action faultCallback = null); void RequestCallAsync(TLInputUserBase userId, TLInt randomId, TLString gaHash, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null); void AcceptCallAsync(TLInputPhoneCall peer, TLString gb, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null); void ConfirmCallAsync(TLInputPhoneCall peer, TLString ga, TLLong keyFingerprint, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null); void ReceivedCallAsync(TLInputPhoneCall peer, Action callback, Action faultCallback = null); void DiscardCallAsync(TLInputPhoneCall peer, TLInt duration, TLPhoneCallDiscardReasonBase reason, TLLong connectionId, Action callback, Action faultCallback = null); void SetCallRatingAsync(TLInputPhoneCall peer, TLInt rating, TLString comment, Action callback, Action faultCallback = null); void SaveCallDebugAsync(TLInputPhoneCall peer, TLDataJSON debug, Action callback, Action faultCallback = null); // payments void GetPaymentReceiptAsync(TLInt msgId, Action callback, Action faultCallback = null); void GetPaymentFormAsync(TLInt msgId, Action callback, Action faultCallback = null); void SendPaymentFormAsync(TLInt msgId, TLString requestedInfoId, TLString shippingOptionId, TLInputPaymentCredentialsBase credentials, Action callback, Action faultCallback = null); void ValidateRequestedInfoAsync(bool save, TLInt msgId, TLPaymentRequestedInfo info, Action callback, Action faultCallback = null); void GetSavedInfoAsync(Action callback, Action faultCallback = null); void ClearSavedInfoAsync(bool credentials, bool info, Action callback, Action faultCallback = null); // langpack void GetLangPackAsync(TLString langCode, Action callback, Action faultCallback = null); void GetStringsAsync(TLString langCode, TLVector keys, Action> callback, Action faultCallback = null); void GetDifferenceAsync(TLInt fromVersion, Action callback, Action faultCallback = null); void GetLanguagesAsync(Action> callback, Action faultCallback = null); // proxy void PingProxyAsync(TLProxyBase proxy, Action callback, Action faultCallback = null); // background task void SendActionsAsync(List actions, Action callback, Action faultCallback = null); void ClearQueue(); } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Account.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Threading; #if WIN_RT using Windows.Data.Xml.Dom; #if WNS_PUSH_SERVICE using Windows.UI.Notifications; #endif #endif using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Account; using Telegram.Api.TL.Functions.Account; using Telegram.Api.TL.Functions.Help; using TLUpdateUserName = Telegram.Api.TL.Account.TLUpdateUserName; namespace Telegram.Api.Services { public partial class MTProtoService { public event EventHandler CheckDeviceLocked; protected virtual void RaiseCheckDeviceLocked() { var handler = CheckDeviceLocked; if (handler != null) handler(this, EventArgs.Empty); } private void CheckDeviceLockedInternal(object state) { RaiseCheckDeviceLocked(); } public void ReportPeerAsync(TLInputPeerBase peer, TLInputReportReasonBase reason, Action callback, Action faultCallback = null) { var obj = new TLReportPeer { Peer = peer, Reason = reason }; SendInformativeMessage("account.reportPeer", obj, callback, faultCallback); } public void DeleteAccountAsync(TLString reason, Action callback, Action faultCallback = null) { var obj = new TLDeleteAccount { Reason = reason }; SendInformativeMessage("account.deleteAccount", obj, callback, faultCallback); } public void UpdateDeviceLockedAsync(TLInt period, Action callback, Action faultCallback = null) { var obj = new TLUpdateDeviceLocked{ Period = period }; SendInformativeMessage("account.updateDeviceLocked", obj, callback, faultCallback); } public void GetWallpapersAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetWallPapers(); SendInformativeMessage("account.getWallpapers", obj, callback, faultCallback); } public void SendChangePhoneCodeAsync(TLString phoneNumber, TLString currentNumber, Action callback, Action faultCallback = null) { var obj = new TLSendChangePhoneCode { Flags = new TLInt(0), PhoneNumber = phoneNumber, CurrentNumber = currentNumber }; SendInformativeMessage("account.sendChangePhoneCode", obj, callback, faultCallback); } public void ChangePhoneAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null) { var obj = new TLChangePhone { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = phoneCode }; SendInformativeMessage("account.changePhone", obj, user => _cacheService.SyncUser(user, callback.SafeInvoke), faultCallback); } public void RegisterDeviceAsync(TLInt tokenType, TLString token, Action callback, Action faultCallback = null) { if (_activeTransport.AuthKey == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("Service is not initialized to register device") }); return; } var obj = new TLRegisterDevice { //TokenType = new TLInt(3), // MPNS //TokenType = new TLInt(8), // WNS //TokenType = new TLInt(11), // MPNS raw TokenType = tokenType, Token = token, AppSandbox = TLBool.False, Secret = TLString.Empty, OtherUids = new TLVector() }; const string methodName = "account.registerDevice"; Logs.Log.Write(string.Format("{0} {1}", methodName, obj)); SendInformativeMessage(methodName, obj, result => { Logs.Log.Write(string.Format("{0} result={1}", methodName, result)); callback.SafeInvoke(result); }, error => { Logs.Log.Write(string.Format("{0} error={1}", methodName, error)); faultCallback.SafeInvoke(error); }); } public void UnregisterDeviceAsync(TLInt tokenType, TLString token, Action callback, Action faultCallback = null) { var obj = new TLUnregisterDevice { //TokenType = new TLInt(3), // MPNS //TokenType = new TLInt(8), // WNS TokenType = tokenType, Token = token }; const string methodName = "account.unregisterDevice"; Logs.Log.Write(string.Format("{0} {1}", methodName, obj)); SendInformativeMessage("account.unregisterDevice", obj, result => { Logs.Log.Write(string.Format("{0} result={1}", methodName, result)); callback.SafeInvoke(result); }, error => { Logs.Log.Write(string.Format("{0} error={1}", methodName, error)); faultCallback.SafeInvoke(error); }); } public void GetNotifySettingsAsync(TLInputNotifyPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLGetNotifySettings{ Peer = peer }; SendInformativeMessage("account.getNotifySettings", obj, callback, faultCallback); } public void ResetNotifySettingsAsync(Action callback, Action faultCallback = null) { Execute.ShowDebugMessage(string.Format("account.resetNotifySettings")); var obj = new TLResetNotifySettings(); SendInformativeMessage("account.resetNotifySettings", obj, callback, faultCallback); } public void UpdateNotifySettingsAsync(TLInputNotifyPeerBase peer, TLInputPeerNotifySettings settings, Action callback, Action faultCallback = null) { //Execute.ShowDebugMessage(string.Format("account.updateNotifySettings peer=[{0}] settings=[{1}]", peer, settings)); var obj = new TL.Functions.Account.TLUpdateNotifySettings { Peer = peer, Settings = settings }; SendInformativeMessage("account.updateNotifySettings", obj, callback, faultCallback); } public void UpdateProfileAsync(TLString firstName, TLString lastName, TLString about, Action callback, Action faultCallback = null) { var obj = new TLUpdateProfile { FirstName = firstName, LastName = lastName, About = about }; SendInformativeMessage("account.updateProfile", obj, result => _cacheService.SyncUser(result, callback), faultCallback); } public void UpdateStatusAsync(TLBool offline, Action callback, Action faultCallback = null) { if (_activeTransport.AuthKey == null) return; #if WIN_RT if (_deviceInfo != null && _deviceInfo.IsBackground) { var message = string.Format("::{0} {1} account.updateStatus {2}", _deviceInfo.BackgroundTaskName, _deviceInfo.BackgroundTaskId, offline); Logs.Log.Write(message); #if DEBUG && WNS_PUSH_SERVICE AddToast("task", message); #endif } #endif TLObject obj = null; if (_deviceInfo != null && _deviceInfo.IsBackground) { obj = new TLInvokeWithoutUpdates {Object = new TLUpdateStatus {Offline = offline}}; } else { obj = new TLUpdateStatus { Offline = offline }; } System.Diagnostics.Debug.WriteLine("account.updateStatus offline=" + offline.Value); SendInformativeMessage("account.updateStatus", obj, callback, faultCallback); } #if WIN_RT && WNS_PUSH_SERVICE public static void AddToast(string caption, string message) { var toastNotifier = ToastNotificationManager.CreateToastNotifier(); var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); SetText(toastXml, caption, message); try { var toast = new ToastNotification(toastXml); //RemoveToastGroup(group); toastNotifier.Show(toast); } catch (Exception ex) { Logs.Log.Write(ex.ToString()); } } private static void SetText(XmlDocument document, string caption, string message) { var toastTextElements = document.GetElementsByTagName("text"); toastTextElements[0].InnerText = caption ?? string.Empty; toastTextElements[1].InnerText = message ?? string.Empty; } #endif public void CheckUsernameAsync(TLString username, Action callback, Action faultCallback = null) { var obj = new TLCheckUsername { Username = username }; SendInformativeMessage("account.checkUsername", obj, callback, faultCallback); } public void UpdateUsernameAsync(TLString username, Action callback, Action faultCallback = null) { var obj = new TLUpdateUserName { Username = username }; SendInformativeMessage("account.updateUsername", obj, callback, faultCallback); } public void GetAccountTTLAsync(Action callback, Action faultCallback = null) { var obj = new TLGetAccountTTL(); SendInformativeMessage("account.getAccountTTL", obj, callback, faultCallback); } public void SetAccountTTLAsync(TLAccountDaysTTL ttl, Action callback, Action faultCallback = null) { var obj = new TLSetAccountTTL{TTL = ttl}; SendInformativeMessage("account.setAccountTTL", obj, callback, faultCallback); } public void DeleteAccountTTLAsync(TLString reason, Action callback, Action faultCallback = null) { var obj = new TLDeleteAccount { Reason = reason }; SendInformativeMessage("account.deleteAccount", obj, callback, faultCallback); } public void GetPrivacyAsync(TLInputPrivacyKeyBase key, Action callback, Action faultCallback = null) { var obj = new TLGetPrivacy { Key = key }; SendInformativeMessage("account.getPrivacy", obj, callback, faultCallback); } public void SetPrivacyAsync(TLInputPrivacyKeyBase key, TLVector rules, Action callback, Action faultCallback = null) { var obj = new TLSetPrivacy { Key = key, Rules = rules }; SendInformativeMessage("account.setPrivacy", obj, callback, faultCallback); } public void GetAuthorizationsAsync(Action callback, Action faultCallback = null) { var obj = new TLGetAuthorizations(); SendInformativeMessage("account.getAuthorizations", obj, callback, faultCallback); } public void ResetAuthorizationAsync(TLLong hash, Action callback, Action faultCallback = null) { var obj = new TLResetAuthorization { Hash = hash }; SendInformativeMessage("account.resetAuthorization", obj, callback, faultCallback); } public void GetPasswordAsync(Action callback, Action faultCallback = null) { var obj = new TLGetPassword(); SendInformativeMessage("account.getPassword", obj, callback, faultCallback); } public void GetTmpPasswordAsync(TLInputCheckPasswordBase password, TLInt period, Action callback, Action faultCallback = null) { var obj = new TLGetTmpPassword{ Password = password, Period = period }; SendInformativeMessage("account.getTmpPassword", obj, callback, faultCallback); } public void GetPasswordSettingsAsync(TLInputCheckPasswordBase password, Action callback, Action faultCallback = null) { var obj = new TLGetPasswordSettings { Password = password }; SendInformativeMessage("account.getPasswordSettings", obj, callback, faultCallback); } public void UpdatePasswordSettingsAsync(TLInputCheckPasswordBase password, TLPasswordInputSettings newSettings, Action callback, Action faultCallback = null) { var obj = new TLUpdatePasswordSettings { Password = password, NewSettings = newSettings }; SendInformativeMessage("account.updatePasswordSettings", obj, callback, faultCallback); } public void CheckPasswordAsync(TLInputCheckPasswordBase password, Action callback, Action faultCallback = null) { var obj = new TLCheckPassword { Password = password }; SendInformativeMessage("account.checkPassword", obj, callback, faultCallback); } public void RequestPasswordRecoveryAsync(Action callback, Action faultCallback = null) { var obj = new TLRequestPasswordRecovery(); SendInformativeMessage("account.requestPasswordRecovery", obj, callback, faultCallback); } public void RecoverPasswordAsync(TLString code, Action callback, Action faultCallback = null) { var obj = new TLRecoverPassword {Code = code}; SendInformativeMessage("account.recoverPassword", obj, callback, faultCallback); } public void ConfirmPhoneAsync(TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null) { var obj = new TLConfirmPhone { PhoneCodeHash = phoneCodeHash, PhoneCode = phoneCode }; SendInformativeMessage("account.confirmPhone", obj, callback, faultCallback); } public void SendConfirmPhoneCodeAsync(TLString hash, TLBool currentNumber, Action callback, Action faultCallback = null) { var obj = new TLSendConfirmPhoneCode { Flags = new TLInt(0), Hash = hash, CurrentNumber = currentNumber }; SendInformativeMessage("account.sendConfirmPhoneCode", obj, callback, faultCallback); } public void GetWebAuthorizationsAsync(Action callback, Action faultCallback = null) { var obj = new TLGetWebAuthorizations(); SendInformativeMessage("account.getWebAuthorizations", obj, callback, faultCallback); } public void ResetWebAuthorizationAsync(TLLong hash, Action callback, Action faultCallback = null) { var obj = new TLResetWebAuthorization { Hash = hash }; SendInformativeMessage("account.resetWebAuthorization", obj, callback, faultCallback); } public void ResetWebAuthorizationsAsync(Action callback, Action faultCallback = null) { var obj = new TLResetWebAuthorizations(); SendInformativeMessage("account.resetWebAuthorizations", obj, callback, faultCallback); } public void GetAllSecureValuesAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetAllSecureValues(); SendInformativeMessage("account.getAllSecureValues", obj, result => { var vector = result as TLVector; if (vector != null) { callback.SafeInvoke(vector); } else { callback.SafeInvoke(new TLVector()); } }, faultCallback); } public void GetPassportDataAsync(Action> callback, Action faultCallback = null) { var requests = new TLObject[] { new TLGetPassword(), new TLGetAllSecureValues() }; var returnValue = new TLObject[2]; GetPassportRequestsInternal( requests, result => { bool completed; lock (returnValue) { if (result is TLPasswordBase) returnValue[0] = result; if (result is IList) returnValue[1] = result; else if (result is IList) returnValue[1] = new TLVector(); completed = returnValue[0] != null && returnValue[1] != null; } if (completed) { callback.SafeInvoke(returnValue[0] as TLPasswordBase, returnValue[1] as IList); } }, faultCallback.SafeInvoke); } private void GetPassportRequestsInternal(TLObject[] requests, Action getResultCallback, Action faultCallback = null) { var container = new TLContainer { Messages = new List() }; var historyItems = new List(); for (var i = 0; i < requests.Length; i++) { var obj = requests[i]; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } var data = i > 0 ? new TLInvokeAfterMsg { MsgId = container.Messages[i - 1].MessageId, Object = obj } : obj; var transportMessage = new TLContainerTransportMessage { MessageId = messageId, SeqNo = new TLInt(sequenceNumber), MessageData = data }; var historyItem = new HistoryItem { SendTime = DateTime.Now, Caption = "passport.item" + i, Object = obj, Message = transportMessage, Callback = getResultCallback, AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = ClientTicksDelta, Status = RequestStatus.Sent, }; historyItems.Add(historyItem); container.Messages.Add(transportMessage); } lock (_historyRoot) { foreach (var item in historyItems) { _history[item.Hash] = item; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif SendNonInformativeMessage("passport.container", container, result => { }, faultCallback); } public void GetSecureValueAsync(TLVector types, Action> callback, Action faultCallback = null) { var obj = new TLGetSecureValue { Types = types }; SendInformativeMessage("account.getSecureValue", obj, callback, faultCallback); } public void SaveSecureValueAsync(TLInputSecureValue value, TLLong secureSecretHash, Action callback, Action faultCallback = null) { var obj = new TLSaveSecureValue { Value = value, SecureSecretId = secureSecretHash }; SendInformativeMessage("account.saveSecureValue", obj, callback, faultCallback); } public void DeleteSecureValueAsync(TLVector types, Action callback, Action faultCallback = null) { var obj = new TLDeleteSecureValue { Types = types }; SendInformativeMessage("account.deleteSecureValue", obj, callback, faultCallback); } public void GetAuthorizationFormAsync(TLInt botId, TLString scope, TLString publicKey, Action callback, Action faultCallback = null) { var obj = new TLGetAuthorizationForm { BotId = botId, Scope = scope, PublicKey = publicKey }; SendInformativeMessage("account.getAuthorizationForm", obj, result => { _cacheService.SyncUsers(result.Users, users => { result.Users = users; callback.SafeInvoke(result); }); }, faultCallback); } public void GetAuthorizationFormAndPassportConfigAsync(TLInt botId, TLString scope, TLString publicKey, TLInt passportConfigHash, Action callback, Action faultCallback = null) { var requests = new TLObject[] { new TLGetAuthorizationForm { BotId = botId, Scope = scope, PublicKey = publicKey }, new TLGetPassportConfig { Hash = passportConfigHash } }; var returnValue = new TLObject[2]; GetPassportRequestsInternal( requests, result => { bool completed; lock (returnValue) { if (result is TLAuthorizationForm) returnValue[0] = result; if (result is TLPassportConfigBase) returnValue[1] = result; completed = returnValue[0] != null && returnValue[1] != null; } if (completed) { callback.SafeInvoke(returnValue[0] as TLAuthorizationForm, returnValue[1] as TLPassportConfigBase); } }, faultCallback.SafeInvoke); } public void AcceptAuthorizationAsync(TLInt botId, TLString scope, TLString publicKey, TLVector valueHashes, TLSecureCredentialsEncrypted credentials, Action callback, Action faultCallback = null) { var obj = new TLAcceptAuthorization { BotId = botId, Scope = scope, PublicKey = publicKey, ValueHashes = valueHashes, Credentials = credentials }; SendInformativeMessage("account.acceptAuthorization", obj, callback, faultCallback); } public void SendVerifyPhoneCodeAsync(TLString phoneNumber, TLBool currentNumber, Action callback, Action faultCallback = null) { var obj = new TLSendVerifyPhoneCode { Flags = new TLInt(0), PhoneNumber = phoneNumber, CurrentNumber = currentNumber }; SendInformativeMessage("account.sendVerifyPhoneCode", obj, callback, faultCallback); } public void VerifyPhoneAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null) { var obj = new TLVerifyPhone { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = phoneCode }; SendInformativeMessage("account.verifyPhone", obj, callback, faultCallback); } public void SendVerifyEmailCodeAsync(TLString email, Action callback, Action faultCallback = null) { var obj = new TLSendVerifyEmailCode { Email = email }; SendInformativeMessage("account.sendVerifyEmailCode", obj, callback, faultCallback); } public void VerifyEmailAsync(TLString email, TLString code, Action callback, Action faultCallback = null) { var obj = new TLVerifyEmail { Email = email, Code = code }; SendInformativeMessage("account.verifyEmail", obj, callback, faultCallback); } public void InitTakeoutSessionAsync(bool contacts, bool messageUsers, bool messageChats, bool messageMegagroups, bool messageChannels, bool files, TLInt fileMaxSize, TLLong takeoutId, Action callback, Action faultCallback = null) { var obj = new TLInitTakeoutSession { Flags = new TLInt(0), Contacts = contacts, MessageUsers = messageUsers, MessageChats = messageChats, MessageMegagroups = messageMegagroups, MessageChannels = messageChannels, Files = files, FileMaxSize = fileMaxSize, TakeoutId = takeoutId }; SendInformativeMessage("account.initTakeoutSession", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Auth.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Auth; using Telegram.Api.Transport; namespace Telegram.Api.Services { public partial class MTProtoService { public void BindTempAuthKeyAsync(TLLong permAuthKeyId, TLLong nonce, TLInt expiresAt, TLString encryptedMessage, Action callback, Action faultCallback = null) { var obj = new TLBindTempAuthKey { PermAuthKeyId = permAuthKeyId, Nonce = nonce, ExpiresAt = expiresAt, EncryptedMessage = encryptedMessage }; SendInformativeMessage("auth.bindTempAuthKey", obj, callback, faultCallback); } public void LogOutAsync(Action callback) { _cacheService.ClearAsync(callback); //try to close session LogOutAsync(null, null); } public void CheckPhoneAsync(TLString phoneNumber, Action callback, Action faultCallback = null) { var obj = new TLCheckPhone { PhoneNumber = phoneNumber }; SendInformativeMessage("auth.checkPhone", obj, callback, faultCallback); } public void SendCodeAsync(TLString phoneNumber, TLString currentNumber, Action callback, Action attemptFailed = null, Action faultCallback = null) { var obj = new TLSendCode { Flags = new TLInt(0), PhoneNumber = phoneNumber, CurrentNumber = currentNumber, ApiId = new TLInt(Constants.ApiId), ApiHash = new TLString(Constants.ApiHash) }; SendInformativeMessage("auth.sendCode", obj, callback, faultCallback, 3); } public void ResendCodeAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null) { var obj = new TLResendCode { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash }; SendInformativeMessage("auth.resendCode", obj, callback, faultCallback); } public void CancelCodeAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null) { var obj = new TLCancelCode { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash }; SendInformativeMessage("auth.cancelCode", obj, callback, faultCallback); } public void SendCallAsync(TLString phoneNumber, TLString phoneCodeHash, Action callback, Action faultCallback = null) { var obj = new TLSendCall { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash }; SendInformativeMessage("auth.sendCall", obj, callback, faultCallback); } public void SignUpAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, TLString firstName, TLString lastName, Action callback, Action faultCallback = null) { var obj = new TLSignUp { PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = phoneCode, FirstName = firstName, LastName = lastName }; SendInformativeMessage("auth.signUp", obj, auth => { _cacheService.SyncUser(auth.User, result => { }); callback(auth); }, faultCallback); } public void SignInAsync(TLString phoneNumber, TLString phoneCodeHash, TLString phoneCode, Action callback, Action faultCallback = null) { var obj = new TLSignIn{ PhoneNumber = phoneNumber, PhoneCodeHash = phoneCodeHash, PhoneCode = phoneCode}; SendInformativeMessage("auth.signIn", obj, auth => { _cacheService.SyncUser(auth.User, result => { }); callback(auth); }, faultCallback); } public void CancelSignInAsync() { CancelDelayedItemsAsync(true); } public void LogOutAsync(Action callback, Action faultCallback = null) { var obj = new TLLogOut(); const string methodName = "auth.logOut"; Logs.Log.Write(methodName); SendInformativeMessage(methodName, obj, result => { Logs.Log.Write(string.Format("{0} result={1}", methodName, result)); callback.SafeInvoke(result); }, error => { Logs.Log.Write(string.Format("{0} error={1}", methodName, error)); faultCallback.SafeInvoke(error); }); } public void SendInvitesAsync(TLVector phoneNumbers, TLString message, Action callback, Action faultCallback = null) { var obj = new TLSendInvites{ PhoneNumbers = phoneNumbers, Message = message }; SendInformativeMessage("auth.sendInvites", obj, callback, faultCallback); } public void ExportAuthorizationAsync(TLInt dcId, Action callback, Action faultCallback = null) { var obj = new TLExportAuthorization { DCId = dcId }; SendInformativeMessage("auth.exportAuthorization dc_id=" + dcId, obj, callback, faultCallback); } public void ImportAuthorizationAsync(TLInt id, TLString bytes, Action callback, Action faultCallback = null) { var obj = new TLImportAuthorization { Id = id, Bytes = bytes }; SendInformativeMessage("auth.importAuthorization id=" + id, obj, callback, faultCallback); } public void ImportAuthorizationByTransportAsync(ITransport transport, TLInt id, TLString bytes, Action callback, Action faultCallback = null) { var obj = new TLImportAuthorization { Id = id, Bytes = bytes }; SendInformativeMessageByTransport(transport, "auth.importAuthorization dc_id=" + transport.DCId, obj, callback, faultCallback); } public void ResetAuthorizationsAsync(Action callback, Action faultCallback = null) { var obj = new TLResetAuthorizations(); SendInformativeMessage("auth.resetAuthorizations", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.ByTransport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define MTPROTO using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using Org.BouncyCastle.Security; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Auth; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.DHKeyExchange; using Telegram.Api.TL.Functions.Help; using Telegram.Api.TL.Functions.Messages; using Telegram.Api.TL.Functions.Stuff; using Telegram.Api.TL.Functions.Upload; using Telegram.Api.Transport; namespace Telegram.Api.Services { public partial class MTProtoService { public void PingByTransportAsync(ITransport transport, TLLong pingId, Action callback, Action faultCallback = null) { var obj = new TLPing { PingId = pingId }; SendNonInformativeMessageByTransport(transport, "ping", obj, result => { callback.SafeInvoke(result); }, faultCallback.SafeInvoke); } public void GetConfigByTransportAsync(ITransport transport, Action callback, Action faultCallback = null) { var obj = new TLGetConfig(); Logs.Log.Write("help.getConfig"); SendInformativeMessageByTransport(transport, "help.getConfig", obj, result => { callback(result); }, faultCallback); } private void ReqPQByTransportAsync(ITransport transport, TLInt128 nonce, Action callback, Action faultCallback = null) { var obj = new TLReqPQ { Nonce = nonce }; SendNonEncryptedMessageByTransport(transport, "req_pq", obj, callback, faultCallback); } private void ReqDHParamsByTransportAsync(ITransport transport, TLInt128 nonce, TLInt128 serverNonce, TLString p, TLString q, TLLong publicKeyFingerprint, TLString encryptedData, Action callback, Action faultCallback = null) { var obj = new TLReqDHParams { Nonce = nonce, ServerNonce = serverNonce, P = p, Q = q, PublicKeyFingerprint = publicKeyFingerprint, EncryptedData = encryptedData }; SendNonEncryptedMessageByTransport(transport, "req_DH_params", obj, callback, faultCallback); } public void SetClientDHParamsByTransportAsync(ITransport transport, TLInt128 nonce, TLInt128 serverNonce, TLString encryptedData, Action callback, Action faultCallback = null) { var obj = new TLSetClientDHParams { Nonce = nonce, ServerNonce = serverNonce, EncryptedData = encryptedData }; SendNonEncryptedMessageByTransport(transport, "set_client_DH_params", obj, callback, faultCallback); } private static Dictionary _serverPublicKeys = new Dictionary(); public void GetServerPublicKeyAsync(int dcId, TLVector fingerprints, Action callback, Action faultCallback = null) { if (_serverPublicKeys.Count == 0) { _serverPublicKeys[unchecked((long)0xc3b42b026ce86b21L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6\n" + "lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS\n" + "an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw\n" + "Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+\n" + "8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n\n" + "Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0x9a996a1db11c729bL)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAxq7aeLAqJR20tkQQMfRn+ocfrtMlJsQ2Uksfs7Xcoo77jAid0bRt\n" + "ksiVmT2HEIJUlRxfABoPBV8wY9zRTUMaMA654pUX41mhyVN+XoerGxFvrs9dF1Ru\n" + "vCHbI02dM2ppPvyytvvMoefRoL5BTcpAihFgm5xCaakgsJ/tH5oVl74CdhQw8J5L\n" + "xI/K++KJBUyZ26Uba1632cOiq05JBUW0Z2vWIOk4BLysk7+U9z+SxynKiZR3/xdi\n" + "XvFKk01R3BHV+GUKM2RYazpS/P8v7eyKhAbKxOdRcFpHLlVwfjyM1VlDQrEZxsMp\n" + "NTLYXb6Sce1Uov0YtNx5wEowlREH1WOTlwIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0xb05b2a6f70cdea78L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAsQZnSWVZNfClk29RcDTJQ76n8zZaiTGuUsi8sUhW8AS4PSbPKDm+\n" + "DyJgdHDWdIF3HBzl7DHeFrILuqTs0vfS7Pa2NW8nUBwiaYQmPtwEa4n7bTmBVGsB\n" + "1700/tz8wQWOLUlL2nMv+BPlDhxq4kmJCyJfgrIrHlX8sGPcPA4Y6Rwo0MSqYn3s\n" + "g1Pu5gOKlaT9HKmE6wn5Sut6IiBjWozrRQ6n5h2RXNtO7O2qCDqjgB2vBxhV7B+z\n" + "hRbLbCmW0tYMDsvPpX5M8fsO05svN+lKtCAuz1leFns8piZpptpSCFn7bWxiA9/f\n" + "x5x17D7pfah3Sy2pA+NDXyzSlGcKdaUmwQIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0x71e025b6c76033e3L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAwqjFW0pi4reKGbkc9pK83Eunwj/k0G8ZTioMMPbZmW99GivMibwa\n" + "xDM9RDWabEMyUtGoQC2ZcDeLWRK3W8jMP6dnEKAlvLkDLfC4fXYHzFO5KHEqF06i\n" + "qAqBdmI1iBGdQv/OQCBcbXIWCGDY2AsiqLhlGQfPOI7/vvKc188rTriocgUtoTUc\n" + "/n/sIUzkgwTqRyvWYynWARWzQg0I9olLBBC2q5RQJJlnYXZwyTL3y9tdb7zOHkks\n" + "WV9IMQmZmyZh/N7sMbGWQpt4NMchGpPGeJ2e5gHBjDnlIf2p1yZOYeUYrdbwcS0t\n" + "UiggS4UeE8TzIuXFQxw7fzEIlmhIaq3FnwIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0xbc35f3509f7b7a5L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAruw2yP/BCcsJliRoW5eBVBVle9dtjJw+OYED160Wybum9SXtBBLX\n" + "riwt4rROd9csv0t0OHCaTmRqBcQ0J8fxhN6/cpR1GWgOZRUAiQxoMnlt0R93LCX/\n" + "j1dnVa/gVbCjdSxpbrfY2g2L4frzjJvdl84Kd9ORYjDEAyFnEA7dD556OptgLQQ2\n" + "e2iVNq8NZLYTzLp5YpOdO1doK+ttrltggTCy5SrKeLoCPPbOgGsdxJxyz5KKcZnS\n" + "Lj16yE5HvJQn0CNpRdENvRUXe6tBP78O39oJ8BTHp9oIjd6XWXAsp2CvK45Ol8wF\n" + "XGF710w9lwCGNbmNxNYhtIkdqfsEcwR5JwIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0x15ae5fa8b5529542L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAvfLHfYH2r9R70w8prHblWt/nDkh+XkgpflqQVcnAfSuTtO05lNPs\n" + "pQmL8Y2XjVT4t8cT6xAkdgfmmvnvRPOOKPi0OfJXoRVylFzAQG/j83u5K3kRLbae\n" + "7fLccVhKZhY46lvsueI1hQdLgNV9n1cQ3TDS2pQOCtovG4eDl9wacrXOJTG2990V\n" + "jgnIKNA0UMoP+KF03qzryqIt3oTvZq03DyWdGK+AZjgBLaDKSnC6qD2cFY81UryR\n" + "WOab8zKkWAnhw2kFpcqhI0jdV5QaSCExvnsjVaX0Y1N0870931/5Jb9ICe4nweZ9\n" + "kSDF/gip3kWLG0o8XQpChDfyvsqB9OLV/wIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0xaeae98e13cd7f94fL)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAs/ditzm+mPND6xkhzwFIz6J/968CtkcSE/7Z2qAJiXbmZ3UDJPGr\n" + "zqTDHkO30R8VeRM/Kz2f4nR05GIFiITl4bEjvpy7xqRDspJcCFIOcyXm8abVDhF+\n" + "th6knSU0yLtNKuQVP6voMrnt9MV1X92LGZQLgdHZbPQz0Z5qIpaKhdyA8DEvWWvS\n" + "Uwwc+yi1/gGaybwlzZwqXYoPOhwMebzKUk0xW14htcJrRrq+PXXQbRzTMynseCoP\n" + "Ioke0dtCodbA3qQxQovE16q9zz4Otv2k4j63cz53J+mhkVWAeWxVGI0lltJmWtEY\n" + "K6er8VqqWot3nqmWMXogrgRLggv/NbbooQIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; _serverPublicKeys[unchecked((long)0x5a181b2235057d98L)] = "-----BEGIN RSA PUBLIC KEY-----\n" + "MIIBCgKCAQEAvmpxVY7ld/8DAjz6F6q05shjg8/4p6047bn6/m8yPy1RBsvIyvuD\n" + "uGnP/RzPEhzXQ9UJ5Ynmh2XJZgHoE9xbnfxL5BXHplJhMtADXKM9bWB11PU1Eioc\n" + "3+AXBB8QiNFBn2XI5UkO5hPhbb9mJpjA9Uhw8EdfqJP8QetVsI/xrCEbwEXe0xvi\n" + "fRLJbY08/Gp66KpQvy7g8w7VB8wlgePexW3pT13Ap6vuC+mQuJPyiHvSxjEKHgqe\n" + "Pji9NP3tJUFQjcECqcm0yV7/2d0t/pbCm+ZH1sadZspQCEPPrtbkQBlvHb4OLiIW\n" + "PGHKSMeRFvp3IWcmdJqXahxLCUS1Eh6MAQIDAQAB\n" + "-----END RSA PUBLIC KEY-----"; } var dcOption = _config != null ? _config.DCOptions.FirstOrDefault(x => x.Id.Value == dcId) : null; if (dcOption == null || !dcOption.CDN.Value) { for (var i = 0; i < fingerprints.Count; i++) { string key; if (_serverPublicKeys.TryGetValue(fingerprints[i].Value, out key)) { callback.SafeInvoke(i, key); return; } } callback.SafeInvoke(-1, null); return; } var cdnConfig = _cacheService.GetCdnConfig(); if (cdnConfig != null) { var pairs = cdnConfig.PublicKeys.Where(x => x.DCId.Value == dcId).ToDictionary(x => x.PublicKeyFingerprint.Value); for (var i = 0; i < fingerprints.Count; i++) { if (pairs.ContainsKey(fingerprints[i].Value)) { callback.SafeInvoke(i, pairs[fingerprints[i].Value].PublicKey.ToString()); return; } } } GetCdnConfigAsync( result => { cdnConfig = result; _cacheService.SetCdnCofig(cdnConfig); GetServerPublicKeyAsync(dcId, fingerprints, callback, faultCallback); }, error => { faultCallback.SafeInvoke(error); }); } public void InitTransportAsync(ITransport transport, Action> callback, Action faultCallback = null) { var authTime = Stopwatch.StartNew(); var newNonce = TLInt256.Random(); #if LOG_REGISTRATION TLUtils.WriteLog("Start ReqPQ"); #endif var nonce = TLInt128.Random(); ReqPQByTransportAsync( transport, nonce, resPQ => { GetServerPublicKeyAsync(transport.DCId, resPQ.ServerPublicKeyFingerprints, (index, publicKey) => { if (index < 0 || string.IsNullOrEmpty(publicKey)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("unknown public key") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var serverNonce = resPQ.ServerNonce; if (!TLUtils.ByteArraysEqual(nonce.Value, resPQ.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ"); #endif TimeSpan calcTime; WindowsPhone.Tuple pqPair; var innerData = GetInnerData(new TLInt(TLUtils.GetProtocolDCId(transport.DCId, false, Constants.IsTestServer)), resPQ, newNonce, out calcTime, out pqPair); var encryptedInnerData = GetEncryptedInnerData(innerData, publicKey); #if LOG_REGISTRATION TLUtils.WriteLog("Start ReqDHParams"); #endif ReqDHParamsByTransportAsync( transport, resPQ.Nonce, resPQ.ServerNonce, innerData.P, innerData.Q, resPQ.ServerPublicKeyFingerprints[index], encryptedInnerData, serverDHParams => { if (!TLUtils.ByteArraysEqual(nonce.Value, serverDHParams.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.ByteArraysEqual(serverNonce.Value, serverDHParams.ServerNonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect server_nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams"); #endif var random = new SecureRandom(); var serverDHParamsOk = serverDHParams as TLServerDHParamsOk; if (serverDHParamsOk == null) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("Incorrect serverDHParams") }; if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("ServerDHParams " + serverDHParams); #endif return; } var aesParams = GetAesKeyIV(resPQ.ServerNonce.ToBytes(), newNonce.ToBytes()); var decryptedAnswerWithHash = Utils.AesIge(serverDHParamsOk.EncryptedAnswer.Data, aesParams.Item1, aesParams.Item2, false); //NOTE: Remove reverse here var position = 0; var serverDHInnerData = (TLServerDHInnerData)new TLServerDHInnerData().FromBytes(decryptedAnswerWithHash.Skip(20).ToArray(), ref position); var sha1 = Utils.ComputeSHA1(serverDHInnerData.ToBytes()); if (!TLUtils.ByteArraysEqual(sha1, decryptedAnswerWithHash.Take(20).ToArray())) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect sha1 TLServerDHInnerData") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.CheckPrime(serverDHInnerData.DHPrime.Data, serverDHInnerData.G.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect (p, q) pair") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.CheckGaAndGb(serverDHInnerData.GA.Data, serverDHInnerData.DHPrime.Data)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect g_a") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var bBytes = new byte[256]; //big endian B random.NextBytes(bBytes); var gbBytes = GetGB(bBytes, serverDHInnerData.G, serverDHInnerData.DHPrime); var clientDHInnerData = new TLClientDHInnerData { Nonce = resPQ.Nonce, ServerNonce = resPQ.ServerNonce, RetryId = new TLLong(0), GB = TLString.FromBigEndianData(gbBytes) }; var encryptedClientDHInnerData = GetEncryptedClientDHInnerData(clientDHInnerData, aesParams); #if LOG_REGISTRATION TLUtils.WriteLog("Start SetClientDHParams"); #endif SetClientDHParamsByTransportAsync( transport, resPQ.Nonce, resPQ.ServerNonce, encryptedClientDHInnerData, dhGen => { if (!TLUtils.ByteArraysEqual(nonce.Value, dhGen.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.ByteArraysEqual(serverNonce.Value, dhGen.ServerNonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect server_nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var dhGenOk = dhGen as TLDHGenOk; if (dhGenOk == null) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("Incorrect dhGen " + dhGen.GetType()) }; if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("DHGen result " + serverDHParams); #endif return; } #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams"); #endif var getKeyTimer = Stopwatch.StartNew(); var authKey = GetAuthKey(bBytes, serverDHInnerData.GA.ToBytes(), serverDHInnerData.DHPrime.ToBytes()); #if LOG_REGISTRATION var logCountersString = new StringBuilder(); logCountersString.AppendLine("Auth Counters"); logCountersString.AppendLine(); logCountersString.AppendLine("pq factorization time: " + calcTime); logCountersString.AppendLine("calc auth key time: " + getKeyTimer.Elapsed); logCountersString.AppendLine("auth time: " + authTime.Elapsed); TLUtils.WriteLog(logCountersString.ToString()); #endif //newNonce - little endian //authResponse.ServerNonce - little endian var salt = GetSalt(newNonce.ToBytes(), resPQ.ServerNonce.ToBytes()); var sessionId = new byte[8]; random.NextBytes(sessionId); // authKey, salt, sessionId callback(new WindowsPhone.Tuple(authKey, new TLLong(BitConverter.ToInt64(salt, 0)), new TLLong(BitConverter.ToInt64(sessionId, 0)))); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop ServerPublicKey with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); } public void LogOutTransportsAsync(Action callback, Action> faultCallback = null) { Execute.BeginOnThreadPool(() => { var dcOptions = _config.DCOptions; var activeDCOptionIndex = _config.ActiveDCOptionIndex; if (dcOptions.Count > 1) { var waitHandles = new List(); var errors = new List(); for (var i = 0; i < dcOptions.Count; i++) { if (activeDCOptionIndex == i) { continue; } var local = i; var handle = new ManualResetEvent(false); waitHandles.Add(handle); Execute.BeginOnThreadPool(() => { var dcOption = dcOptions[local]; LogOutAsync(dcOption.Id, result => { handle.Set(); }, error => { errors.Add(error); handle.Set(); }); }); } var waitingResult = WaitHandle.WaitAll(waitHandles.ToArray(), TimeSpan.FromSeconds(25.0)); if (waitingResult) { if (errors.Count > 0) { faultCallback.SafeInvoke(errors); } else { callback.SafeInvoke(); } } else { faultCallback.SafeInvoke(errors); } } else { callback.SafeInvoke(); } }); } public void LogOutAsync(TLInt dcId, Action callback, Action faultCallback = null) { lock (_activeTransportRoot) { if (_activeTransport.DCId == dcId.Value) { if (_activeTransport.DCId == 0) { TLUtils.WriteException(new Exception("_activeTransport.DCId==0")); } LogOutAsync(callback, faultCallback); return; } } var transport = GetMediaTransportByDCId(dcId); if (transport == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("LogOutAsync: Empty transport for dc id " + dcId) }); return; } if (transport.AuthKey == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("LogOutAsync: Empty authKey for dc id " + dcId) }); return; } var obj = new TLLogOut(); SendInformativeMessageByTransport(transport, "auth.logOut", obj, result => { lock (transport.SyncRoot) { transport.IsInitializing = false; transport.IsAuthorizing = false; transport.IsAuthorized = false; } }, faultCallback); } public void ReuploadCdnFileAsync(TLInt dcId, TLString fileToken, TLString requestToken, Action> callback, Action faultCallback = null) { var obj = new TLReuploadCdnFile { FileToken = fileToken, RequestToken = requestToken }; var transport = GetMediaTransportByDCId(dcId); if (transport == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("ReuploadCdnFileAsync: Empty transport for dc id " + dcId) }); } else { SendInformativeMessageByTransport(transport, string.Format("upload.reuploadCdnFile dc_id={0} file_token={1} request_token={2}", dcId, fileToken, requestToken), obj, callback, faultCallback); } } public void GetCdnFileAsync(TLInt dcId, TLString fileToken, TLInt offset, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetCdnFile { FileToken = fileToken, Offset = offset, Limit = limit }; var transport = GetMediaTransportByDCId(dcId); if (transport == null) { GetConfigAsync( result => { _config = TLConfig.Merge(_config, result); _cacheService.SetConfig(_config); GetCdnFileAsync(dcId, fileToken, offset, limit, callback, faultCallback); }, error => { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("GetCdnFileAsync: Empty transport for dc id " + dcId) }); }); return; } if (transport.AuthKey == null) { var cancelInitializing = false; lock (transport.SyncRoot) { if (transport.IsInitializing) { cancelInitializing = true; } else { transport.IsInitializing = true; } } if (cancelInitializing) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("DC " + dcId + " is already initializing") }); return; } InitTransportAsync( transport, tuple => { lock (transport.SyncRoot) { transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; transport.IsInitializing = false; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } foreach (var dcOption in _config.DCOptions) { if (dcOption.Id.Value == transport.DCId) { dcOption.AuthKey = tuple.Item1; dcOption.Salt = tuple.Item2; dcOption.SessionId = tuple.Item3; } } _cacheService.SetConfig(_config); SendInformativeMessageByTransport(transport, string.Format("upload.getCdnFile dc_id={0} file_token={3} o={1} l={2}", dcId, offset, limit, fileToken), obj, callback, faultCallback); }, error => { lock (transport.SyncRoot) { transport.IsInitializing = false; } faultCallback.SafeInvoke(error); }); } else { SendInformativeMessageByTransport(transport, string.Format("upload.getCdnFile dc_id={0} file_token={3} o={1} l={2}", dcId, offset, limit, fileToken), obj, callback, faultCallback); } } private void GetFileAsyncInternal(TLObject obj, TLInt dcId, TLInputFileLocationBase location, TLInt offset, TLInt limit, Action callback, Action faultCallback = null) where T : TLObject { var transport = GetMediaTransportByDCId(dcId); lock (_activeTransportRoot) { if (_activeTransport.DCId == dcId.Value) { if (_activeTransport.DCId == 0) { TLUtils.WriteException(new Exception("_activeTransport.DCId==0")); } SendInformativeMessageByTransport(transport, string.Format("upload.getFile main dc_id={0} loc=[{5}] o={1} l={2}\ntransport_id={3} session_id={4}", dcId, offset, limit, transport.Id, transport.SessionId, location.GetLocationString()), obj, callback, faultCallback); return; } } if (transport == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("GetFileAsync: Empty transport for dc id " + dcId) }); return; } if (transport.AuthKey == null) { var cancelInitializing = false; lock (transport.SyncRoot) { if (transport.IsInitializing) { cancelInitializing = true; } else { transport.IsInitializing = true; } } if (cancelInitializing) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("DC " + dcId + " is already initializing") }); return; } InitTransportAsync( transport, tuple => { lock (transport.SyncRoot) { transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; transport.IsInitializing = false; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } ExportImportAuthorizationAsync( transport, () => { foreach (var dcOption in _config.DCOptions) { if (dcOption.Id.Value == transport.DCId) { dcOption.AuthKey = tuple.Item1; dcOption.Salt = tuple.Item2; dcOption.SessionId = tuple.Item3; } } _cacheService.SetConfig(_config); SendInformativeMessageByTransport(transport, string.Format("upload.getFile dc_id={0} loc=[{3}] o={1} l={2}", dcId, offset, limit, location.GetLocationString()), obj, callback, faultCallback); }, error => { if (!error.CodeEquals(ErrorCode.NOT_FOUND) && !error.Message.ToString().Contains("is already authorizing")) { Execute.ShowDebugMessage("ExportImportAuthorization error " + error); } faultCallback.SafeInvoke(error); }); }, error => { lock (transport.SyncRoot) { transport.IsInitializing = false; } faultCallback.SafeInvoke(error); }); } else { ExportImportAuthorizationAsync( transport, () => { SendInformativeMessageByTransport(transport, string.Format("upload.getFile dc_id={0} loc=[{3}] o={1} l={2}", dcId, offset, limit, location.GetLocationString()), obj, callback, faultCallback); }, error => { if (!error.CodeEquals(ErrorCode.NOT_FOUND) && !error.Message.ToString().Contains("is already authorizing")) { Execute.ShowDebugMessage("ExportImportAuthorization error " + error); } faultCallback.SafeInvoke(error); }); } } public void GetFileAsync(TLInt dcId, TLInputFileLocationBase location, TLInt offset, TLInt limit, Action callback, Action faultCallback = null) { var obj = location is TLInputWebFileLocationBase ? (TLObject)new TLGetWebFile { Location = location, Offset = offset, Limit = limit } : new TLGetFile { Location = location, Offset = offset, Limit = limit }; GetFileAsyncInternal(obj, dcId, location, offset, limit, callback, faultCallback); } private void ExportImportAuthorizationAsync(ITransport toTransport, Action callback, Action faultCallback = null) { if (!toTransport.IsAuthorized) { bool authorizing = false; lock (toTransport.SyncRoot) { if (toTransport.IsAuthorizing) { authorizing = true; } toTransport.IsAuthorizing = true; } if (authorizing) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("DC " + toTransport.DCId + " is already authorizing") }); return; } ExportAuthorizationAsync( new TLInt(toTransport.DCId), exportedAuthorization => { ImportAuthorizationByTransportAsync( toTransport, exportedAuthorization.Id, exportedAuthorization.Bytes, authorization => { lock (toTransport.SyncRoot) { toTransport.IsAuthorized = true; toTransport.IsAuthorizing = false; } foreach (var dcOption in _config.DCOptions) { if (dcOption.Id.Value == toTransport.DCId) { dcOption.IsAuthorized = true; } } _cacheService.SetConfig(_config); callback.SafeInvoke(); }, error => { lock (toTransport.SyncRoot) { toTransport.IsAuthorizing = false; } faultCallback.SafeInvoke(error); }); ; }, error => { lock (toTransport.SyncRoot) { toTransport.IsAuthorizing = false; } faultCallback.SafeInvoke(error); }); } else { callback.SafeInvoke(); } } private ITransport GetMediaTransportByDCId(TLInt dcId) { ITransport transport; lock (_activeTransportRoot) { var dcOption = TLUtils.GetDCOption(_config, dcId);// && x.Media.Value); if (dcOption == null) return null; transport = GetFileTransport(dcOption.IpAddress.Value, dcOption.Port.Value, Type, new TransportSettings { DcId = dcOption.Id.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = dcOption.AuthKey, Salt = dcOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = dcOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } return transport; } private void SendNonInformativeMessageByTransport(ITransport transport, string caption, TLObject obj, Action callback, Action faultCallback = null) where T : TLObject { bool isInitialized; lock (transport.SyncRoot) { isInitialized = transport.AuthKey != null; } if (!isInitialized) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("transport " + transport.DCId + " " + caption + " delayed send is not supported") }); return; } int sequenceNumber; TLLong messageId; lock (transport.SyncRoot) { sequenceNumber = transport.SequenceNumber * 2; messageId = transport.GenerateMessageId(true); } var authKey = transport.AuthKey; var salt = transport.Salt; var sessionId = transport.SessionId; var clientsTicksDelta = transport.ClientTicksDelta; var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (transport.SyncRoot) { if (transport.Closed) { var transportSettings = new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = transport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }; transport = transport.MTProtoType == MTProtoTransportType.Special ? GetSpecialTransport(transport.Host, transport.Port, Type, transportSettings) : GetFileTransport(transport.Host, transport.Port, Type, transportSettings); } } PrintCaption(caption); HistoryItem historyItem = null; if (string.Equals(caption, "ping", StringComparison.OrdinalIgnoreCase) || string.Equals(caption, "ping_delay_disconnect", StringComparison.OrdinalIgnoreCase) || string.Equals(caption, "messages.container", StringComparison.OrdinalIgnoreCase)) { //save items to history historyItem = new HistoryItem { SendTime = DateTime.Now, //SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Message = transportMessage, Callback = t => callback((T)t), AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = clientsTicksDelta, Status = RequestStatus.Sent, }; lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } #if DEBUG NotifyOfPropertyChange(() => History); #endif } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2, -4} SessionId {3}", caption, transportMessage.MessageId.Value, transportMessage.SeqNo.Value, transportMessage.SessionId.Value); var captionString = string.Format("{0} {1}", caption, transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { if (!result) { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif } faultCallback.SafeInvoke(new TLRPCError(404) { Message = new TLString("FastCallback SocketError=" + result) }); } }, error => { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif } faultCallback.SafeInvoke(new TLRPCError(404) { #if WINDOWS_PHONE SocketError = error.Error, #endif Exception = error.Exception }); }); } private readonly object _initConnectionSyncRoot = new object(); private void SendInformativeMessageByTransport(ITransport transport, string caption, TLObject obj, Action callback, Action faultCallback = null, int? maxAttempt = null, // to send delayed items Action attemptFailed = null) // to send delayed items where T : TLObject { bool isInitialized; lock (transport.SyncRoot) { isInitialized = transport.AuthKey != null; } if (!isInitialized) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("transport " + transport.DCId + " " + caption + " delayed send is not supported") }); // var delayedItem = new DelayedItem // { // SendTime = DateTime.Now, // Caption = caption, // Object = obj, // Callback = t => callback((T)t), // AttemptFailed = attemptFailed, // FaultCallback = faultCallback, // MaxAttempt = maxAttempt // }; //#if LOG_REGISTRATION // TLUtils.WriteLog(DateTime.Now.ToLocalTime() + ": Enqueue delayed item\n " + delayedItem); //#endif // lock (_delayedItemsRoot) // { // _delayedItems.Add(delayedItem); // } return; } lock (transport.SyncRoot) { if (transport.Closed) { var transportSettings = new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = transport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }; transport = transport.MTProtoType == MTProtoTransportType.Special ? GetSpecialTransport(transport.Host, transport.Port, Type, transportSettings) : GetFileTransport(transport.Host, transport.Port, Type, transportSettings); } } PrintCaption(caption); TLObject data; int sequenceNumber; TLLong messageId; lock (transport.SyncRoot) { if (!transport.Initiated || caption == "auth.sendCode") { var initConnection = new TLInitConnection78 { Flags = new TLInt(0), AppId = new TLInt(Constants.ApiId), AppVersion = new TLString(_deviceInfo.AppVersion), Data = obj, DeviceModel = new TLString(_deviceInfo.Model), SystemLangCode = new TLString(Utils.CurrentUICulture()), LangPack = TLString.Empty, LangCode = new TLString(Utils.CurrentUICulture()), SystemVersion = new TLString(_deviceInfo.SystemVersion), Proxy = TLUtils.GetInputProxy(_transportService.GetProxyConfig()) }; var withLayerN = new TLInvokeWithLayerN { Data = initConnection }; data = withLayerN; transport.Initiated = true; } else { data = obj; } sequenceNumber = transport.SequenceNumber * 2 + 1; transport.SequenceNumber++; messageId = transport.GenerateMessageId(true); } var authKey = transport.AuthKey; var salt = transport.Salt; var sessionId = transport.SessionId; var clientsTicksDelta = transport.ClientTicksDelta; var dcId = transport.DCId; var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, data); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); var historyItem = new HistoryItem { SendTime = DateTime.Now, Caption = caption, Object = obj, Message = transportMessage, Callback = t => callback((T)t), FaultCallback = faultCallback, ClientTicksDelta = clientsTicksDelta, Status = RequestStatus.Sent, DCId = dcId }; lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } #if DEBUG NotifyOfPropertyChange(() => History); #endif //Debug.WriteLine(">> {4} {0, -30} MsgId {1} SeqNo {2, -4} SessionId {3}", caption, transportMessage.MessageId, transportMessage.SeqNo, transportMessage.SessionId, historyItem.DCId); var captionString = string.Format("{0} {1} {2}", caption, transportMessage.SessionId, transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { if (!result) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("FastCallback SocketError=" + result) }); } }, error => { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404) }); }); } private void SaveInitConnectionAsync(TLInitConnection initConnection) { Execute.BeginOnThreadPool(() => TLUtils.SaveObjectToMTProtoFile(_initConnectionSyncRoot, Constants.InitConnectionFileName, initConnection)); } private void SendNonEncryptedMessageByTransport(ITransport transport, string caption, TLObject obj, Action callback, Action faultCallback = null) where T : TLObject { PrintCaption(caption); TLLong messageId; lock (transport.SyncRoot) { messageId = transport.GenerateMessageId(); } var message = CreateTLNonEncryptedMessage(messageId, obj); var historyItem = new HistoryItem { Caption = caption, Message = message, Callback = t => callback((T)t), FaultCallback = faultCallback, SendTime = DateTime.Now, Status = RequestStatus.Sent }; var guid = message.MessageId; lock (transport.SyncRoot) { if (transport.Closed) { var transportSettings = new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = transport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }; transport = transport.MTProtoType == MTProtoTransportType.Special ? GetSpecialTransport(transport.Host, transport.Port, Type, transportSettings) : GetFileTransport(transport.Host, transport.Port, Type, transportSettings); } } transport.EnqueueNonEncryptedItem(historyItem); var captionString = string.Format("{0} {1}", caption, guid); SendPacketAsync(transport, captionString, message, socketError => { #if LOG_REGISTRATION TLUtils.WriteLog(caption + " SocketError=" + socketError); #endif if (!socketError) { transport.RemoveNonEncryptedItem(historyItem); // connection is unsuccessfully faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("FastCallback SocketError=" + socketError) }); } }, error => { transport.RemoveNonEncryptedItem(historyItem); faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404) }); }); } public void MessageAcknowledgmentsByTransport(ITransport transport, TLVector ids) { PrintCaption("msgs_ack"); TLUtils.WriteLine("ids"); foreach (var id in ids) { TLUtils.WriteLine(TLUtils.MessageIdString(id)); } var obj = new TLMessageAcknowledgments { MsgIds = ids }; var authKey = transport.AuthKey; var sesseionId = transport.SessionId; var salt = transport.Salt; int sequenceNumber; TLLong messageId; lock (transport.SyncRoot) { sequenceNumber = transport.SequenceNumber * 2; messageId = transport.GenerateMessageId(true); } var transportMessage = CreateTLTransportMessage(salt, sesseionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (transport.SyncRoot) { if (transport.Closed) { transport = GetTransport(transport.Host, transport.Port, Type, new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } } lock (_debugRoot) { //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2, -4} SessionId {3}\nids:", "msgs_ack", transportMessage.MessageId.Value, transportMessage.SeqNo.Value, transportMessage.SessionId.Value); foreach (var id in ids) { Debug.WriteLine(id.Value); } } var captionString = string.Format("msgs_ack {0}", transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { //Debug.WriteLine("@msgs_ack {0} result {1}", transportMessage.MessageId, result); //ReceiveBytesAsync(result, authKey); }, error => { //Debug.WriteLine("< History); #endif var saveConfig = false; lock (transport.SyncRoot) { var serverTime = message.MessageId.Value; var clientTime = transport.GenerateMessageId().Value; var serverDateTime = Utils.UnixTimestampToDateTime(serverTime >> 32); var clientDateTime = Utils.UnixTimestampToDateTime(clientTime >> 32); errorInfo.AppendLine("Server time: " + serverDateTime); errorInfo.AppendLine("Client time: " + clientDateTime); if (historyItem.ClientTicksDelta == transport.ClientTicksDelta) { transport.ClientTicksDelta += serverTime - clientTime; saveConfig = true; errorInfo.AppendLine("Set ticks delta: " + transport.ClientTicksDelta + "(" + (serverDateTime - clientDateTime).TotalSeconds + " seconds)"); } } if (saveConfig && _config != null) { var dcOption = _config.DCOptions.FirstOrDefault(x => string.Equals(x.IpAddress.ToString(), transport.Host, StringComparison.OrdinalIgnoreCase)); if (dcOption != null) { dcOption.ClientTicksDelta = transport.ClientTicksDelta; _cacheService.SetConfig(_config); } } TLUtils.WriteLine(errorInfo.ToString(), LogSeverity.Error); // TODO: replace with SendInformativeMessage var transportMessage = (TLContainerTransportMessage)historyItem.Message; int sequenceNumber; lock (transport.SyncRoot) { if (transportMessage.SeqNo.Value % 2 == 0) { sequenceNumber = 2 * transport.SequenceNumber; } else { sequenceNumber = 2 * transport.SequenceNumber + 1; transport.SequenceNumber++; } transportMessage.SeqNo = new TLInt(sequenceNumber); transportMessage.MessageId = transport.GenerateMessageId(true); } TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); var authKey = transport.AuthKey; var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } var faultCallback = historyItem.FaultCallback; lock (transport.SyncRoot) { if (transport.Closed) { var transportSettings = new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }; transport = transport.MTProtoType == MTProtoTransportType.Special ? GetSpecialTransport(transport.Host, transport.Port, Type, transportSettings) : GetFileTransport(transport.Host, transport.Port, Type, transportSettings); } } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2,-4} SessionId {3} BadMsgId {4}", string.Format("{0}: {1}", historyItem.Caption, "time"), transportMessage.MessageId.Value, transportMessage.SeqNo.Value, message.SessionId.Value, badMessage.BadMessageId.Value); var captionString = string.Format("{0} {1} {2}", historyItem.Caption, message.SessionId, transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", string.Format("{0}: {1}", historyItem.Caption, "time"), transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey), error => { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404) }); }); //_activeTransport.SendPacketAsync(historyItem.Caption + " " + transportMessage.MessageId, // encryptedMessage.ToBytes(), result => ReceiveBytesAsync(result, authKey), // () => { if (faultCallback != null) faultCallback(null); }); break; case 32: case 33: TLUtils.WriteLine(string.Format("ErrorCode={0} INCORRECT MSGSEQNO BY TRANSPORT TO DCID={2}, CREATE NEW SESSION {1}", badMessage.ErrorCode.Value, historyItem.Caption, transport.DCId), LogSeverity.Error); Execute.ShowDebugMessage(string.Format("ErrorCode={0} INCORRECT MSGSEQNO BY TRANSPORT TO DCID={2}, CREATE NEW SESSION {1}", badMessage.ErrorCode.Value, historyItem.Caption, transport.DCId)); var previousMessageId = historyItem.Hash; // fix seqNo with creating new Session lock (transport.SyncRoot) { transport.SessionId = TLLong.Random(); transport.SequenceNumber = 0; transportMessage = (TLTransportMessage)historyItem.Message; if (transportMessage.SeqNo.Value % 2 == 0) { sequenceNumber = 2 * transport.SequenceNumber; } else { sequenceNumber = 2 * transport.SequenceNumber + 1; transport.SequenceNumber++; } transportMessage.SeqNo = new TLInt(sequenceNumber); transportMessage.MessageId = transport.GenerateMessageId(true); } ((TLTransportMessage)transportMessage).SessionId = transport.SessionId; // TODO: replace with SendInformativeMessage TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); authKey = transport.AuthKey; encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history.Remove(previousMessageId); _history[historyItem.Hash] = historyItem; } faultCallback = historyItem.FaultCallback; lock (transport.SyncRoot) { if (transport.Closed) { var transportSettings = new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }; transport = transport.MTProtoType == MTProtoTransportType.Special ? GetSpecialTransport(transport.Host, transport.Port, Type, transportSettings) : GetFileTransport(transport.Host, transport.Port, Type, transportSettings); } } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2,-4} SessionId {3} BadMsgId {4}", string.Format("{0}: {1}", historyItem.Caption, "seqNo"), transportMessage.MessageId.Value, transportMessage.SeqNo.Value, message.SessionId.Value, badMessage.BadMessageId.Value); captionString = string.Format("{0} {1} {2}", historyItem.Caption, message.SessionId, transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", string.Format("{0}: {1}", historyItem.Caption, "seqNo"), transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey)}, error => { if (faultCallback != null) faultCallback(null); }); break; } } private void ProcessBadServerSaltByTransport(ITransport transport, TLTransportMessage message, TLBadServerSalt badServerSalt, HistoryItem historyItem) { if (historyItem == null) { return; } var transportMessage = (TLContainerTransportMessage)historyItem.Message; lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif TLUtils.WriteLine("CORRECT SERVER SALT:"); ((TLTransportMessage)transportMessage).Salt = badServerSalt.NewServerSalt; //Salt = badServerSalt.NewServerSalt; TLUtils.WriteLine("New salt: " + transport.Salt); switch (badServerSalt.ErrorCode.Value) { case 16: case 17: TLUtils.WriteLine("1. CORRECT TIME DELTA with salt by transport " + transport.DCId); var saveConfig = false; long serverTime; long clientTime; lock (transport.SyncRoot) { serverTime = message.MessageId.Value; clientTime = transport.GenerateMessageId().Value; TLUtils.WriteLine("Server time: " + TLUtils.MessageIdString(BitConverter.GetBytes(serverTime))); TLUtils.WriteLine("Client time: " + TLUtils.MessageIdString(BitConverter.GetBytes(clientTime))); if (historyItem.ClientTicksDelta == transport.ClientTicksDelta) { saveConfig = true; transport.ClientTicksDelta += serverTime - clientTime; } transportMessage.MessageId = transport.GenerateMessageId(true); TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); } if (saveConfig && _config != null) { var dcOption = _config.DCOptions.FirstOrDefault(x => string.Equals(x.IpAddress.ToString(), transport.Host, StringComparison.OrdinalIgnoreCase)); if (dcOption != null) { dcOption.ClientTicksDelta += serverTime - clientTime; _cacheService.SetConfig(_config); } } break; case 48: break; } if (transportMessage == null) return; var authKey = transport.AuthKey; var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } var faultCallback = historyItem.FaultCallback; lock (transport.SyncRoot) { if (transport.Closed) { transport = GetTransport(transport.Host, transport.Port, Type, new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } } var captionString = string.Format("{0} {1}", historyItem.Caption, transportMessage.MessageId); SendPacketAsync(transport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", historyItem.Caption, transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey)}, error => { if (faultCallback != null) faultCallback(new TLRPCError { Code = new TLInt(404), Message = new TLString("TCPTransport error") }); }); } private void ProcessRPCErrorByTransport(ITransport transport, TLRPCError error, HistoryItem historyItem, long keyId) { if (error.CodeEquals(ErrorCode.UNAUTHORIZED)) { Execute.ShowDebugMessage(string.Format("RPCError ByTransport {2} {0} {1}", historyItem.Caption, error, transport.DCId)); if (historyItem != null && historyItem.Caption != "account.updateStatus" && historyItem.Caption != "account.registerDevice" && historyItem.Caption != "auth.signIn") { if (error.TypeEquals(ErrorType.SESSION_REVOKED)) { } else { // Note! no reauthorization by transport to additional dc //RaiseAuthorizationRequired(new AuthorizationRequiredEventArgs{MethodName = "ByTransport " + transport.DCId + " " + historyItem.Caption, Error = error, AuthKeyId = keyId}); historyItem.FaultCallback.SafeInvoke(error); } } else if (historyItem != null && historyItem.FaultCallback != null) { historyItem.FaultCallback(error); } } else if (error.CodeEquals(ErrorCode.ERROR_SEE_OTHER) && (error.TypeStarsWith(ErrorType.NETWORK_MIGRATE) || error.TypeStarsWith(ErrorType.PHONE_MIGRATE) //|| error.TypeStarsWith(ErrorType.FILE_MIGRATE) )) { var serverNumber = Convert.ToInt32( error.GetErrorTypeString() .Replace(ErrorType.NETWORK_MIGRATE.ToString(), string.Empty) .Replace(ErrorType.PHONE_MIGRATE.ToString(), string.Empty) //.Replace(ErrorType.FILE_MIGRATE.ToString(), string.Empty) .Replace("_", string.Empty)); if (_config == null || TLUtils.GetDCOption(_config, new TLInt(serverNumber)) == null) { GetConfigAsync(config => { _config = TLConfig.Merge(_config, config); SaveConfig(); if (historyItem.Object.GetType() == typeof(TLSendCode)) { var dcOption = TLUtils.GetDCOption(_config, new TLInt(serverNumber)); lock (transport.SyncRoot) { transport = GetTransport(dcOption.IpAddress.ToString(), dcOption.Port.Value, Type, new TransportSettings { DcId = dcOption.Id.Value, AuthKey = dcOption.AuthKey, Secret = TLUtils.ParseSecret(dcOption), Salt = dcOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = dcOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } lock (transport.SyncRoot) { transport.Initialized = false; } InitTransportAsync(transport, tuple => { lock (transport.SyncRoot) { transport.DCId = serverNumber; transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } dcOption.AuthKey = tuple.Item1; dcOption.Salt = tuple.Item2; dcOption.SessionId = tuple.Item3; _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(dcOption); _cacheService.SetConfig(_config); lock (transport.SyncRoot) { transport.Initialized = true; } RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); }, er => { lock (transport.SyncRoot) { transport.Initialized = false; } historyItem.FaultCallback.SafeInvoke(er); }); } else { MigrateAsync(serverNumber, auth => SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback)); } }); } else { if (historyItem.Object.GetType() == typeof(TLSendCode) || historyItem.Object.GetType() == typeof(TLGetFile)) { var activeDCOption = TLUtils.GetDCOption(_config, new TLInt(serverNumber)); lock (transport.SyncRoot) { transport = GetTransport(activeDCOption.IpAddress.ToString(), activeDCOption.Port.Value, Type, new TransportSettings { DcId = activeDCOption.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption), AuthKey = activeDCOption.AuthKey, Salt = activeDCOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } if (activeDCOption.AuthKey == null) { lock (transport.SyncRoot) { transport.Initialized = false; } InitTransportAsync(transport, tuple => { lock (transport.SyncRoot) { transport.DCId = serverNumber; transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } activeDCOption.AuthKey = tuple.Item1; activeDCOption.Salt = tuple.Item2; activeDCOption.SessionId = tuple.Item3; _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(activeDCOption); _cacheService.SetConfig(_config); lock (transport.SyncRoot) { transport.Initialized = true; } RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); }, er => { lock (transport.SyncRoot) { transport.Initialized = false; } historyItem.FaultCallback.SafeInvoke(er); }); } else { lock (transport.SyncRoot) { transport.AuthKey = activeDCOption.AuthKey; transport.Salt = activeDCOption.Salt; transport.SessionId = TLLong.Random(); } var authKeyId = TLUtils.GenerateLongAuthKeyId(activeDCOption.AuthKey); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = activeDCOption.AuthKey, AutkKeyId = authKeyId }); } } _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(activeDCOption); _cacheService.SetConfig(_config); lock (transport.SyncRoot) { transport.Initialized = true; } RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); } } else { MigrateAsync(serverNumber, auth => SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback)); } } } else if (historyItem.FaultCallback != null) { historyItem.FaultCallback(error); } } private void OnPacketReceivedByTransport(object sender, DataEventArgs e) { var transport = (ITransport)sender; bool isInitialized; lock (transport.SyncRoot) { isInitialized = transport.AuthKey != null; } var position = 0; var handled = false; if (!isInitialized) { try { var message = TLObject.GetObject(e.Data, ref position); var item = transport.DequeueFirstNonEncryptedItem(); if (item != null) { #if LOG_REGISTRATION TLUtils.WriteLog("OnReceivedBytes !IsInitialized try historyItem " + item.Caption); #endif item.Callback.SafeInvoke(message.Data); } else { #if LOG_REGISTRATION TLUtils.WriteLog("OnReceivedBytes !IsInitialized cannot try historyItem "); #endif } handled = true; } catch (Exception ex) { #if LOG_REGISTRATION var sb = new StringBuilder(); sb.AppendLine("OnPacketReceived !IsInitialized catch Exception: \n" + ex); sb.AppendLine(transport.PrintNonEncryptedHistory()); TLUtils.WriteLog(sb.ToString()); #endif } if (!handled) { #if LOG_REGISTRATION TLUtils.WriteLog("OnPacketReceived !IsInitialized !handled invoke ReceiveBytesAsync"); #endif ReceiveBytesByTransportAsync(transport, e.Data); } } else { #if LOG_REGISTRATION TLUtils.WriteLog("OnPacketReceived IsInitialized invoke ReceiveBytesAsync"); #endif ReceiveBytesByTransportAsync(transport, e.Data); } } private void DisableMTProtoProxy() { var proxyConfig = _transportService.GetProxyConfig(); if (proxyConfig != null && !proxyConfig.IsEmpty && !proxyConfig.IsEnabled.Value) { var mtProtoProxy = proxyConfig.GetProxy() as TLMTProtoProxy; if (mtProtoProxy != null) { proxyConfig.IsEnabled = TLBool.False; _transportService.SetProxyConfig(proxyConfig); var instance = TelegramEventAggregator.Instance; if (instance != null) { instance.Publish(new MTProtoProxyDisabledEventArgs()); } } } } private void ReceiveBytesByTransportAsync(ITransport transport, byte[] bytes) { try { if (bytes.Length == 4) { var error = BitConverter.ToInt32(bytes, 0); if (error == -404 || error == -444) { if (error == -444) { DisableMTProtoProxy(); RaiseProxyDisabled(); } var message = string.Format("ByTransport dc_id={0} error={1}", transport.DCId, error); TLUtils.WriteException(new Exception(message)); ResetConnectionByTransport(transport, new Exception(message)); return; } } var position = 0; var encryptedMessage = (TLEncryptedTransportMessage)new TLEncryptedTransportMessage().FromBytes(bytes, ref position); encryptedMessage.Decrypt(transport.AuthKey); if (encryptedMessage.Data == null) { var message = string.Format("ByTransport msgKey mismatch transport_dc_id={0}", transport.DCId); TLUtils.WriteException(new Exception(message)); } if (encryptedMessage.Data.Length < 32) { var message = string.Format("ByTransport padding extension data={0} < 32 transport_dc_id={1}", encryptedMessage.Data.Length, transport.DCId); TLUtils.WriteException(new Exception(message)); } var messageDataLength = BitConverter.ToInt32(encryptedMessage.Data, 28); if (messageDataLength < 0 || messageDataLength % 4 != 0) { var message = string.Format("ByTransport incorrect length data={0} length={1} transport_dc_id={2}", encryptedMessage.Data.Length, messageDataLength, transport.DCId); TLUtils.WriteException(new Exception(message)); } if (32 + messageDataLength > encryptedMessage.Data.Length) { var message = string.Format("ByTransport padding extension data={0} length={1} transport_dc_id={2}", encryptedMessage.Data.Length, messageDataLength, transport.DCId); TLUtils.WriteException(new Exception(message)); } position = 0; var transportMessage = TLObject.GetObject(encryptedMessage.Data, ref position); #if MTPROTO if (encryptedMessage.Data.Length - position < 12 || encryptedMessage.Data.Length - position > 1024) { var message = string.Format("ByTransport padding extension data={0} position={1} object={2} transport_dc_id={3}", encryptedMessage.Data.Length, position, transportMessage.MessageData, transport.DCId); TLUtils.WriteException(new Exception(message)); } #else if ((encryptedMessage.Data.Length - position) > 15) { var message = string.Format("ByTransport padding extension data={0} position={1} object={2}", encryptedMessage.Data.Length, position, transportMessage.MessageData, transport.DCId); TLUtils.WriteException(new Exception(message)); } #endif if (transportMessage.SessionId.Value != transport.SessionId.Value) { var message = string.Format("ByTransport session_id={0} is not equal to transport.session_id={1} transport_dc_id={2}", transportMessage.SessionId, transport.SessionId, transport.DCId); TLUtils.WriteException(new Exception(message)); } if (transport.MinMessageId != 0) { if (transport.MinMessageId > transportMessage.MessageId.Value) { var message = string.Format("ByTransport message_id={0} seq_no={1} is higher than transport.min_message_id={2} transport_dc_id={3}", transportMessage.MessageId, transportMessage.SeqNo, transport.MinMessageId, transport.DCId); TLUtils.WriteException(new Exception(message)); } } if (transport.MessageIdDict.ContainsKey(transportMessage.MessageId.Value)) { var message = string.Format("ByTransport message_id={0} seq_no={1} already exists transport_dc_id={2}", transportMessage.MessageId, transportMessage.SeqNo, transport.MinMessageId); TLUtils.WriteException(new Exception(message)); } lock (transport.SyncRoot) { transport.MessageIdDict[transportMessage.MessageId.Value] = transportMessage.MessageId.Value; } if ((transportMessage.MessageId.Value % 2) == 0) { TLUtils.WriteException(new Exception(string.Format("ByTransport incorrect message_id transport_dc_id={0}", transport.MinMessageId))); } // get acknowledgments foreach (var acknowledgment in TLUtils.FindInnerObjects(transportMessage)) { var ids = acknowledgment.MessageIds.Items; lock (_historyRoot) { foreach (var id in ids) { if (_history.ContainsKey(id.Value)) { _history[id.Value].Status = RequestStatus.Confirmed; } } } } // send acknowledgments SendAcknowledgmentsByTransport(transport, transportMessage); // updates _updatesService.ProcessTransportMessage(transportMessage); // bad messages foreach (var badMessage in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem item = null; lock (_historyRoot) { if (_history.ContainsKey(badMessage.BadMessageId.Value)) { item = _history[badMessage.BadMessageId.Value]; } } Logs.Log.Write(string.Format("{0} {1} transport={2}", badMessage, item, transport.DCId)); ProcessBadMessageByTransport(transport, transportMessage, badMessage, item); } // bad server salts foreach (var badServerSalt in TLUtils.FindInnerObjects(transportMessage)) { lock (transport.SyncRoot) { transport.Salt = badServerSalt.NewServerSalt; } HistoryItem item = null; lock (_historyRoot) { if (_history.ContainsKey(badServerSalt.BadMessageId.Value)) { item = _history[badServerSalt.BadMessageId.Value]; } } Logs.Log.Write(string.Format("{0} {1} transport={2}", badServerSalt, item, transport.DCId)); ProcessBadServerSaltByTransport(transport, transportMessage, badServerSalt, item); } // new session created foreach (var newSessionCreated in TLUtils.FindInnerObjects(transportMessage)) { TLUtils.WritePerformance(string.Format("NEW SESSION CREATED: {0} (old {1})", transportMessage.SessionId, _activeTransport.SessionId)); lock (transport.SyncRoot) { transport.SessionId = transportMessage.SessionId; transport.Salt = newSessionCreated.ServerSalt; } } foreach (var pong in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem item; lock (_historyRoot) { if (_history.ContainsKey(pong.MessageId.Value)) { item = _history[pong.MessageId.Value]; _history.Remove(pong.MessageId.Value); } else { //Execute.ShowDebugMessage("TLPong lost item id=" + pong.MessageId); continue; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif if (item != null) { item.Callback.SafeInvoke(pong); } } // rpcresults foreach (var result in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem historyItem = null; lock (_historyRoot) { if (_history.ContainsKey(result.RequestMessageId.Value)) { historyItem = _history[result.RequestMessageId.Value]; _history.Remove(result.RequestMessageId.Value); } else { continue; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif //RemoveItemFromSendingQueue(result.RequestMessageId.Value); var error = result.Object as TLRPCError; if (error != null) { Debug.WriteLine("RPCError: " + error.Code + " " + error.Message + " MsgId " + result.RequestMessageId.Value); TLUtils.WriteLine("RPCError: " + error.Code + " " + error.Message); string errorString; var reqError = error as TLRPCReqError; if (reqError != null) { errorString = string.Format("RPCReqError {1} {2} (query_id={0}) transport=[dc_id={3}]", reqError.QueryId, reqError.Code, reqError.Message, transport.DCId); } else { errorString = string.Format("RPCError {0} {1} transport=[dc_id={2}]", error.Code, error.Message, transport.DCId); } Execute.ShowDebugMessage(historyItem + Environment.NewLine + errorString); ProcessRPCErrorByTransport(transport, error, historyItem, encryptedMessage.AuthKeyId.Value); Debug.WriteLine(errorString + " msg_id=" + result.RequestMessageId.Value); TLUtils.WriteLine(errorString); } else { var messageData = result.Object; if (messageData is TLGzipPacked) { messageData = ((TLGzipPacked)messageData).Data; } if (messageData is TLSentMessageBase || messageData is TLStatedMessageBase || messageData is TLUpdatesBase || messageData is TLSentEncryptedMessage || messageData is TLSentEncryptedFile || messageData is TLAffectedHistory || messageData is TLAffectedMessages || historyItem.Object is TLReadChannelHistory || historyItem.Object is TLReadEncryptedHistory) { RemoveFromQueue(historyItem); } try { historyItem.Callback(messageData); } catch (Exception e) { #if LOG_REGISTRATION TLUtils.WriteLog(e.ToString()); #endif TLUtils.WriteException(e); } } } } catch (Exception e) { TLUtils.WriteException("ReceiveBytesByTransportAsync", e); ResetConnectionByTransport(transport, e); } } public void ClearHistoryByTransport(ITransport transport) { _transportService.CloseTransport(transport); lock (_historyRoot) { var keysToRemove = new List(); foreach (var keyValue in _history) { if (keyValue.Value.Caption.StartsWith("msgs_ack")) { TLUtils.WriteLine("!!!!!!MSGS_ACK FAULT!!!!!!!", LogSeverity.Error); Debug.WriteLine("!!!!!!MSGS_ACK FAULT!!!!!!!"); } if (transport.DCId == keyValue.Value.DCId) { keyValue.Value.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("Clear History") }); keysToRemove.Add(keyValue.Key); } } foreach (var key in keysToRemove) { _history.Remove(key); } } transport.ClearNonEncryptedHistory(); } } public class MTProtoProxyDisabledEventArgs { } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Channel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.Updates; namespace Telegram.Api.Services { public partial class MTProtoService { public void ReadFeedAsync(TLInt feedId, TLFeedPosition maxPosition, Action callback, Action faultCallback = null) { var obj = new TLReadFeed { FeedId = feedId, MaxPosition = maxPosition }; const string caption = "channels.readFeed"; SendInformativeMessage(caption, obj, result => { callback(result); }, faultCallback); } public void GetFeedAsync(bool offsetToMaxReed, TLInt feedId, TLFeedPosition offsetPosition, TLInt addOffset, TLInt limit, TLFeedPosition maxPosition, TLFeedPosition minPosition, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetFeed { Flags = new TLInt(0), OffsetToMaxRead = offsetToMaxReed, FeedId = feedId, OffsetPosition = offsetPosition, AddOffset = addOffset, Limit = limit, MaxPosition = maxPosition, MinPosition = minPosition, Hash = hash }; const string caption = "channels.getFeed"; SendInformativeMessage(caption, obj, result => { callback(result); }, faultCallback); } public void SetFeedBroadcastsAsync(TLInt feedId, TLVector channels, TLBool alsoNewlyJoined, Action callback, Action faultCallback = null) { var obj = new TLSetFeedBroadcasts { FeedId = feedId, Channels = channels, AlsoNewlyJoined = alsoNewlyJoined }; const string caption = "channels.setFeedBroadcasts"; SendInformativeMessage(caption, obj, result => { callback(result); }, faultCallback); } public void ChangeFeedBroadcastAsync(TLInputChannelBase channel, TLInt feedId, Action callback, Action faultCallback = null) { var obj = new TLChangeFeedBroadcast { Flags = new TLInt(0), Channel = channel, FeedId = feedId }; const string caption = "channels.changeFeedBroadcast"; SendInformativeMessage(caption, obj, result => { callback(result); }, faultCallback); } public void DeleteHistoryAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null) { var obj = new TLDeleteHistory { Channel = channel, MaxId = new TLInt(int.MaxValue) }; const string caption = "channels.deleteHistory"; SendInformativeMessage(caption, obj, result => { callback(result); }, faultCallback); } public void TogglePreHistoryHiddenAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLTogglePreHistoryHidden { Channel = channel, Enabled = enabled }; const string caption = "channels.togglePreHistoryHidden"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void SetStickersAsync(TLInputChannelBase channel, TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null) { var obj = new TLSetStickers { Channel = channel, StickerSet = stickerset }; SendInformativeMessage("channels.setStickers", obj, callback.SafeInvoke, faultCallback); } public void ReadMessageContentsAsync(TLInputChannelBase channel, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLReadMessageContents { Channel = channel, Id = id }; const string caption = "channels.readMessageContents"; ReadMessageContentsAsyncInternal(obj, result => { callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void GetAdminedPublicChannelsAsync(Action callback, Action faultCallback = null) { var obj = new TLGetAdminedPublicChannels(); SendInformativeMessage("updates.getAdminedPublicChannels", obj, result => { var chats = result as TLChats24; if (chats != null) { _cacheService.SyncUsersAndChats(new TLVector(), chats.Chats, tuple => callback.SafeInvoke(result)); } }, faultCallback); } public void GetChannelDifferenceAsync(bool force, TLInputChannelBase inputChannel, TLChannelMessagesFilerBase filter, TLInt pts, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetChannelDifference { Flags = new TLInt(0), Channel = inputChannel, Filter = filter, Pts = pts, Limit = limit }; if (force) { obj.SetForce(); } SendInformativeMessage("updates.getChannelDifference", obj, callback, faultCallback); } public void GetMessagesAsync(TLInputChannelBase inputChannel, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLGetMessages { Channel = inputChannel, Id = id }; SendInformativeMessage("channels.getMessages", obj, callback, faultCallback); } public void EditAdminAsync(TLChannel channel, TLInputUserBase userId, TLChannelAdminRights adminRights, Action callback, Action faultCallback = null) { var obj = new TLEditAdmin { Channel = channel.ToInputChannel(), UserId = userId, AdminRights = adminRights }; const string caption = "channels.editAdmin"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } GetFullChannelAsync(channel.ToInputChannel(), messagesChatFull => callback.SafeInvoke(result), faultCallback.SafeInvoke); }, faultCallback); } public void GetParticipantAsync(TLInputChannelBase inputChannel, TLInputUserBase userId, Action callback, Action faultCallback = null) { var obj = new TLGetParticipant { Channel = inputChannel, UserId = userId }; const string caption = "channels.getParticipant"; SendInformativeMessage(caption, obj, result => { _cacheService.SyncUsers(result.Users, r => { }); callback.SafeInvoke(result); }, faultCallback); } public void GetParticipantsAsync(TLInputChannelBase inputChannel, TLChannelParticipantsFilterBase filter, TLInt offset, TLInt limit, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetParticipants { Channel = inputChannel, Filter = filter, Offset = offset, Limit = limit, Hash = hash }; const string caption = "channels.getParticipants"; SendInformativeMessage(caption, obj, result => { var channelParticipants = result as TLChannelParticipants; if (channelParticipants != null) { for (var i = 0; i < channelParticipants.Users.Count; i++) { var cachedUser = _cacheService.GetUser(channelParticipants.Users[i].Id); if (cachedUser != null) { cachedUser._status = channelParticipants.Users[i].Status; channelParticipants.Users[i] = cachedUser; } } } callback.SafeInvoke(result); }, faultCallback); } public void EditTitleAsync(TLChannel channel, TLString title, Action callback, Action faultCallback = null) { var obj = new TLEditTitle { Channel = channel.ToInputChannel(), Title = title }; const string caption = "channels.editTitle"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void EditAboutAsync(TLChannel channel, TLString about, Action callback, Action faultCallback = null) { var obj = new TLEditAbout { Channel = channel.ToInputChannel(), About = about }; const string caption = "channels.editAbout"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void JoinChannelAsync(TLChannel channel, Action callback, Action faultCallback = null) { var obj = new TLJoinChannel { Channel = channel.ToInputChannel() }; const string caption = "channels.joinChannel"; SendInformativeMessage(caption, obj, result => { channel.Left = TLBool.False; if (channel.ParticipantsCount != null) { channel.ParticipantsCount = new TLInt(channel.ParticipantsCount.Value + 1); } _cacheService.Commit(); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void LeaveChannelAsync(TLChannel channel, Action callback, Action faultCallback = null) { var obj = new TLLeaveChannel { Channel = channel.ToInputChannel() }; const string caption = "channels.leaveChannel"; SendInformativeMessage(caption, obj, result => { channel.Left = TLBool.True; if (channel.ParticipantsCount != null) { channel.ParticipantsCount = new TLInt(channel.ParticipantsCount.Value - 1); } _cacheService.Commit(); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void KickFromChannelAsync(TLChannel channel, TLInputUserBase userId, TLBool kicked, Action callback, Action faultCallback = null) { var obj = new TLKickFromChannel { Channel = channel.ToInputChannel(), UserId = userId, Kicked = kicked }; const string caption = "channels.kickFromChannel"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } GetFullChannelAsync(channel.ToInputChannel(), messagesChatFull => callback.SafeInvoke(result), faultCallback.SafeInvoke); }, faultCallback); } public void DeleteChannelAsync(TLChannel channel, Action callback, Action faultCallback = null) { var obj = new TLDeleteChannel { Channel = channel.ToInputChannel() }; const string caption = "channels.deleteChannel"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void InviteToChannelAsync(TLInputChannelBase channel, TLVector users, Action callback, Action faultCallback = null) { var obj = new TLInviteToChannel { Channel = channel, Users = users }; const string caption = "channels.inviteToChannel"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void DeleteMessagesAsync(TLInputChannelBase channel, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLDeleteChannelMessages { Channel = channel, Id = id }; const string caption = "channels.deleteMessages"; SendInformativeMessage(caption, obj, result => { //var multiPts = result as IMultiPts; //if (multiPts != null) //{ // _updatesService.SetState(multiPts, caption); //} //else //{ // _updatesService.SetState(null, result.Pts, null, null, null, caption); //} callback.SafeInvoke(result); }, faultCallback); } public void UpdateChannelAsync(TLInt channelId, Action callback, Action faultCallback = null) { var channel = _cacheService.GetChat(channelId) as TL.Interfaces.IInputChannel; if (channel != null) { GetFullChannelAsync(channel.ToInputChannel(), callback, faultCallback); return; } } public void GetFullChannelAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null) { var obj = new TLGetFullChannel { Channel = channel }; SendInformativeMessage( "cnannels.getFullChannel", obj, messagesChatFull => { _cacheService.SyncChat(messagesChatFull, result => callback.SafeInvoke(messagesChatFull)); }, faultCallback); } public void GetImportantHistoryAsync(TLInputChannelBase channel, TLPeerBase peer, bool sync, TLInt offsetId, TLInt addOffset, TLInt limit, TLInt maxId, TLInt minId, Action callback, Action faultCallback = null) { var obj = new TLGetImportantHistory { Channel = channel, OffsetId = offsetId, OffsetDate = new TLInt(0), AddOffset = addOffset, Limit = limit, MaxId = maxId, MinId = minId }; SendInformativeMessage("channels.getImportantHistory", obj, callback, faultCallback); } public void ReadHistoryAsync(TLChannel channel, TLInt maxId, Action callback, Action faultCallback = null) { var obj = new TLReadChannelHistory { Channel = channel.ToInputChannel(), MaxId = maxId }; ReadChannelHistoryAsyncInternal(obj, result => { channel.ReadInboxMaxId = maxId; _cacheService.Commit(); callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void CreateChannelAsync(TLInt flags, TLString title, TLString about, Action callback, Action faultCallback = null) { var obj = new TLCreateChannel { Flags = flags, Title = title, About = about }; var caption = "channels.createChannel"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void ExportInviteAsync(TLInputChannelBase channel, Action callback, Action faultCallback = null) { var obj = new TLExportInvite { Channel = channel }; SendInformativeMessage("channels.exportInvite", obj, callback, faultCallback); } public void CheckUsernameAsync(TLInputChannelBase channel, TLString username, Action callback, Action faultCallback = null) { var obj = new TLCheckUsername { Channel = channel, Username = username }; SendInformativeMessage("channels.checkUsername", obj, callback, faultCallback); } public void UpdateUsernameAsync(TLInputChannelBase channel, TLString username, Action callback, Action faultCallback = null) { var obj = new TLUpdateUsername { Channel = channel, Username = username }; SendInformativeMessage("channels.updateUsername", obj, callback, faultCallback); } public void EditPhotoAsync(TLChannel channel, TLInputChatPhotoBase photo, Action callback, Action faultCallback = null) { var obj = new TLEditPhoto { Channel = channel.ToInputChannel(), Photo = photo }; const string caption = "channels.editPhoto"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null, true); } callback.SafeInvoke(result); }, faultCallback); } public void DeleteChannelMessagesAsync(TLInputChannelBase channel, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLDeleteChannelMessages { Channel = channel, Id = id }; SendInformativeMessage("channels.deleteMessages", obj, callback, faultCallback); } public void ToggleInvitesAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLToggleInvites { Channel = channel, Enabled = enabled }; const string caption = "channels.toggleInvites"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void ExportMessageLinkAsync(TLInputChannelBase channel, TLInt id, Action callback, Action faultCallback = null) { var obj = new TLExportMessageLink { Channel = channel, Id = id }; SendInformativeMessage("channels.exportMessageLink", obj, callback, faultCallback); } public void UpdatePinnedMessageAsync(bool silent, TLInputChannelBase channel, TLInt id, Action callback, Action faultCallback = null) { var obj = new TLUpdatePinnedMessage { Flags = new TLInt(0), Channel = channel, Id = id }; if (silent) { obj.SetSilent(); } const string caption = "channels.updatePinnedMessage"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void ToggleSignaturesAsync(TLInputChannelBase channel, TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLToggleSignatures { Channel = channel, Enabled = enabled }; const string caption = "channels.toggleSignatures"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void GetMessageEditDataAsync(TLInputPeerBase peer, TLInt id, Action callback, Action faultCallback = null) { var obj = new TLGetMessageEditData { Peer = peer, Id = id }; SendInformativeMessage("messages.getMessageEditData", obj, callback, faultCallback); } public void EditMessageAsync(TLInputPeerBase peer, TLInt id, TLString message, TLVector entities, TLInputMediaBase media, TLReplyKeyboardBase replyMarkup, bool noWebPage, bool stopGeoLive, TLInputGeoPointBase geoPoint, Action callback, Action faultCallback = null) { var obj = new TLEditMessage { Flags = new TLInt(0), Peer = peer, Id = id, Message = message, NoWebPage = noWebPage, Entities = entities, Media = media, ReplyMarkup = replyMarkup, StopGeoLive = stopGeoLive, GeoPoint = geoPoint }; const string caption = "messages.editMessage"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null, true); } callback.SafeInvoke(result); }, faultCallback); } public void ReportSpamAsync(TLInputChannelBase channel, TLInt userId, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLReportSpam { Channel = channel, UserId = userId, Id = id }; const string caption = "channels.reportSpam"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void DeleteUserHistoryAsync(TLChannel channel, TLInputUserBase userId, Action callback, Action faultCallback = null) { var obj = new TLDeleteUserHistory { Channel = channel.ToInputChannel(), UserId = userId }; const string caption = "channels.deleteUserHistory"; SendInformativeMessage(caption, obj, result => { var multiChannelPts = result as IMultiChannelPts; if (multiChannelPts != null) { if (channel.Pts == null || channel.Pts.Value + multiChannelPts.ChannelPtsCount.Value != multiChannelPts.ChannelPts.Value) { Execute.ShowDebugMessage(string.Format("channel_id={0} channel_pts={1} affectedHistory24[channel_pts={2} channel_pts_count={3}]", channel.Id, channel.Pts, multiChannelPts.ChannelPts, multiChannelPts.ChannelPtsCount)); } channel.Pts = new TLInt(multiChannelPts.ChannelPts.Value); } callback.SafeInvoke(result); }, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Config.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Telegram.Api.Extensions; using Telegram.Api.Services.Connection; using Telegram.Api.TL; using Telegram.Api.Transport; namespace Telegram.Api.Services { public partial class MTProtoService { public void SaveConfig() { _cacheService.SetConfig(_config); } public TLConfig LoadConfig() { throw new NotImplementedException(); } #if DEBUG public void CheckPublicConfig() { OnCheckConfig(null, null); } #endif public void PingProxyAsync(TLProxyBase proxy, Action callback, Action faultCallback = null) { if (_activeTransport == null) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("ActiveTransport is null") }); return; } var transport = GetSpecialTransportWithProxy(_activeTransport.Host, _activeTransport.Port, _activeTransport.Type, proxy, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = TLLong.Random(), SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); if (transport.AuthKey == null) { InitTransportAsync(transport, tuple => { lock (transport.SyncRoot) { transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; transport.IsInitializing = false; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } PingSpecialTransportAsync(transport, callback, faultCallback); }, error => { faultCallback.SafeInvoke(error); }); } else { PingSpecialTransportAsync(transport, callback, faultCallback); } } private void PingSpecialTransportAsync(ITransport transport, Action callback, Action faultCallback = null) { // connect and ping var stopwatch = Stopwatch.StartNew(); PingByTransportAsync(transport, TLLong.Random(), pong => { // ping and measure var ping = transport.Ping > 0 ? transport.Ping : stopwatch.Elapsed.TotalMilliseconds; _transportService.CloseSpecialTransport(transport); callback.SafeInvoke(new TLInt((int)ping)); }, error => { _transportService.CloseSpecialTransport(transport); faultCallback.SafeInvoke(error); }); } private readonly IPublicConfigService _publicConfigService; private static void LogPublicConfig(string str) { Logs.Log.Write(string.Format(" MTProtoService.CheckConfig {0}", str)); Debug.WriteLine(" MTProtoService.CheckConfig {0}", str); } private void PingAndUpdateTransportInfoAsync(TLDCOption78 dcOption, ITransport transport, Action callback, Action faultCallback = null) { LogPublicConfig(string.Format("Ping id={0} dc_id={1} ip={2} port={3} secret={4} proxy=[{5}]", transport.Id, transport.DCId, transport.Host, transport.Port, transport.Secret != null, transport.ProxyConfig)); PingByTransportAsync(transport, TLLong.Random(), pong => { LogPublicConfig(string.Format("Ping completed id={0}", transport.Id)); LogPublicConfig("Close transport id=" + transport.Id); _transportService.CloseSpecialTransport(transport); LogPublicConfig(string.Format("Update info dc_id={0} ip={1} port={2} secret={3}", transport.DCId, transport.Host, transport.Port, transport.Secret != null)); UpdateTransportInfoAsync(dcOption, new TLString(transport.Host), new TLInt(transport.Port), result => { LogPublicConfig("Update info completed"); callback.SafeInvoke(); }); }, error => { LogPublicConfig(string.Format("Ping error id={0} error={1}", transport.Id, error)); _transportService.CloseSpecialTransport(transport); faultCallback.SafeInvoke(error); }); } private void CheckAndUpdateTransportInfoInternalAsync(TLDCOption78 dcOption, ITransport transport, Action callback, Action faultCallback = null) { if (transport.AuthKey == null) { InitTransportAsync(transport, tuple => { LogPublicConfig(string.Format("Init transport completed id={0}", transport.Id)); lock (transport.SyncRoot) { transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; transport.IsInitializing = false; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } PingAndUpdateTransportInfoAsync(dcOption, transport, callback, faultCallback); }, error => { LogPublicConfig(string.Format("Init transport error id={0} error={1}", transport.Id, error)); }); } else { PingAndUpdateTransportInfoAsync(dcOption, transport, callback, faultCallback); } } public void CheckAndUpdateTransportInfoAsync(TLInt dcId, TLString host, TLInt port, Action callback, Action faultCallback = null) { LogPublicConfig(string.Format("CheckTransport dc_id={0} host={1} port={2}", dcId, host, port)); if (dcId == null) return; if (TLString.IsNullOrEmpty(host)) return; if (port == null) return; var dcOption = TLUtils.GetDCOption(_config, dcId); var transport = GetSpecialTransport(host.ToString(), port.Value, Type, new TransportSettings { DcId = dcId.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = dcOption != null ? dcOption.AuthKey : null, Salt = dcOption != null ? dcOption.Salt : TLLong.Random(), SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = dcOption != null ? dcOption.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceivedByTransport }); CheckAndUpdateTransportInfoInternalAsync(dcOption as TLDCOption78, transport, callback, faultCallback); } private void OnCheckConfig(object sender, EventArgs e) { _publicConfigService.GetAsync( configSimple => { if (configSimple != null) { var now = TLUtils.DateToUniversalTimeTLInt(ClientTicksDelta, DateTime.Now); if (configSimple.Expires.Value < now.Value || now.Value < configSimple.Date.Value) { LogPublicConfig(string.Format("Config expired date={0} expires={1} now={2}", configSimple.Date, configSimple.Expires, now)); return; } var dcId = configSimple.DCId; var ipPort = configSimple.IpPortList.FirstOrDefault(); if (ipPort == null) { LogPublicConfig("ipPort is null"); return; } var dcOption = TLUtils.GetDCOption(_config, dcId); var transport = GetSpecialTransport(ipPort.GetIpString(), ipPort.Port.Value, Type, new TransportSettings { DcId = dcId.Value, Secret = null, //ipPort.Secret AuthKey = dcOption != null ? dcOption.AuthKey : null, Salt = dcOption != null ? dcOption.Salt : TLLong.Random(), SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = dcOption != null ? dcOption.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceivedByTransport }); if (transport.AuthKey == null) { LogPublicConfig(string.Format("Init transport id={0} dc_id={1} ip={2} port={3} proxy=[{4}]", transport.Id, transport.DCId, transport.Host, transport.Port, transport.ProxyConfig)); InitTransportAsync(transport, tuple => { LogPublicConfig(string.Format("Init transport completed id={0}", transport.Id)); lock (transport.SyncRoot) { transport.AuthKey = tuple.Item1; transport.Salt = tuple.Item2; transport.SessionId = tuple.Item3; transport.IsInitializing = false; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } CheckAndUpdateMainTransportAsync(transport); }, error => { LogPublicConfig(string.Format("Init transport error id={0} error={1}", transport.Id, error)); }); } else { CheckAndUpdateMainTransportAsync(transport); } } } , error => { LogPublicConfig(string.Format("PublicConfigService.GetAsync error {0}", error)); }); } private void CheckAndUpdateMainTransportAsync(ITransport transport) { LogPublicConfig(string.Format("Get config from id={0} dc_id={1} ip={2} port={3} proxy=[{4}]", transport.Id, transport.DCId, transport.Host, transport.Port, transport.ProxyConfig)); GetConfigByTransportAsync(transport, config => { LogPublicConfig(string.Format("Get config completed id={0}", transport.Id)); var dcId = new TLInt(_activeTransport.DCId); var dcOption = TLUtils.GetDCOption(config, dcId) as TLDCOption78; if (dcOption == null) { LogPublicConfig(string.Format("dcOption is null id={0}", transport.Id)); return; } if (string.Equals(_activeTransport.Host, dcOption.IpAddress.ToString(), StringComparison.OrdinalIgnoreCase)) { LogPublicConfig(string.Format("dcOption ip equals ip={0}", dcOption.IpAddress.ToString())); return; } LogPublicConfig("Close transport id=" + transport.Id); _transportService.CloseSpecialTransport(transport); // replace main dc ip and port transport = GetSpecialTransport(dcOption.IpAddress.ToString(), dcOption.Port.Value, Type, new TransportSettings { DcId = dcOption.Id.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); CheckAndUpdateTransportInfoInternalAsync(dcOption, transport, null); // reconnect }, error2 => { LogPublicConfig(string.Format("Get config error id={0} error={1}", transport.Id, error2)); LogPublicConfig("Close transport id=" + transport.Id); _transportService.CloseSpecialTransport(transport); }); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Contacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Contacts; namespace Telegram.Api.Services { public partial class MTProtoService { public void ResetSavedAsync(Action callback, Action faultCallback = null) { var obj = new TLResetSaved(); SendInformativeMessage("contacts.resetSaved", obj, callback.SafeInvoke, faultCallback); } public void ResetTopPeerRatingAsync(TLTopPeerCategoryBase category, TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLResetTopPeerRating { Category = category, Peer = peer }; SendInformativeMessage("contacts.resetTopPeerRating", obj, callback.SafeInvoke, faultCallback); } public void GetTopPeersAsync(GetTopPeersFlags flags, TLInt offset, TLInt limit, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetTopPeers { Flags = new TLInt((int) flags), Offset = offset, Limit = limit, Hash = hash }; SendInformativeMessage("contacts.getTopPeers", obj, result => { var topPeers = result as TLTopPeers; if (topPeers != null) { _cacheService.SyncUsersAndChats(topPeers.Users, topPeers.Chats, tuple => { topPeers.Users = tuple.Item1; topPeers.Chats = tuple.Item2; callback.SafeInvoke(result); }); } else { callback.SafeInvoke(result); } }, faultCallback); } public void ResolveUsernameAsync(TLString username, Action callback, Action faultCallback = null) { var obj = new TLResolveUsername{ Username = username }; SendInformativeMessage("contacts.resolveUsername", obj, result => { _cacheService.SyncUsersAndChats(result.Users, result.Chats, tuple => { result.Users = tuple.Item1; result.Chats = tuple.Item2; callback.SafeInvoke(result); }); }, faultCallback); } public void GetStatusesAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetStatuses(); SendInformativeMessage>("contacts.getStatuses", obj, contacts => { _cacheService.SyncStatuses(contacts, callback); }, faultCallback); } public void GetContactsAsync(TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetContacts { Hash = hash }; SendInformativeMessage("contacts.getContacts", obj, result => _cacheService.SyncContacts(result, callback), faultCallback); } public void ImportContactsAsync(TLVector contacts, Action callback, Action faultCallback = null) { var obj = new TLImportContacts { Contacts = contacts }; SendInformativeMessage("contacts.importContacts", obj, result => _cacheService.SyncContacts(result, callback), faultCallback); } public void DeleteContactAsync(TLInputUserBase id, Action callback, Action faultCallback = null) { var obj = new TLDeleteContact { Id = id }; SendInformativeMessage("contacts.deleteContact", obj, result => _cacheService.SyncUserLink(result, callback), faultCallback); } public void DeleteContactsAsync(TLVector id, Action callback, Action faultCallback = null) { var obj = new TLDeleteContacts { Id = id }; SendInformativeMessage("contacts.deleteContacts", obj, result => { foreach (var inputUser in id.OfType()) { var user = _cacheService.GetUser(inputUser.UserId); if (user != null && user.IsContact) { user.IsContact = false; user.IsContactMutual = false; } } _cacheService.Commit(); callback.SafeInvoke(result); }, faultCallback); } public void BlockAsync(TLInputUserBase id, Action callback, Action faultCallback = null) { var obj = new TLBlock { Id = id }; SendInformativeMessage("contacts.block", obj, callback, faultCallback); } public void UnblockAsync(TLInputUserBase id, Action callback, Action faultCallback = null) { var obj = new TLUnblock { Id = id }; SendInformativeMessage("contacts.unblock", obj, callback, faultCallback); } public void GetBlockedAsync(TLInt offset, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetBlocked { Offset = offset, Limit = limit }; SendInformativeMessage("contacts.getBlocked", obj, callback, faultCallback); } public void SearchAsync(TLString q, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLSearch { Q = q, Limit = limit }; SendInformativeMessage("contacts.search", obj, callback, faultCallback); } public void GetSavedAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetSaved(); SendInformativeMessage("contacts.getSaved", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.DHKeyExchange.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Numerics; using System.Text; using Org.BouncyCastle.Security; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Functions.DHKeyExchange; namespace Telegram.Api.Services { public class AuthKeyItem { public long AutkKeyId { get; set; } public byte[] AuthKey { get; set; } } public partial class MTProtoService { /// /// Список имеющихся ключей авторизации /// private static readonly Dictionary _authKeys = new Dictionary(); private static readonly object _authKeysRoot = new object(); private void ReqPQAsync(TLInt128 nonce, Action callback, Action faultCallback = null) { var obj = new TLReqPQ { Nonce = nonce }; SendNonEncryptedMessage("req_pq", obj, callback, faultCallback); } private void ReqDHParamsAsync(TLInt128 nonce, TLInt128 serverNonce, TLString p, TLString q, TLLong publicKeyFingerprint, TLString encryptedData, Action callback, Action faultCallback = null) { var obj = new TLReqDHParams { Nonce = nonce, ServerNonce = serverNonce, P = p, Q = q, PublicKeyFingerprint = publicKeyFingerprint, EncryptedData = encryptedData }; SendNonEncryptedMessage("req_DH_params", obj, callback, faultCallback); } public void SetClientDHParamsAsync(TLInt128 nonce, TLInt128 serverNonce, TLString encryptedData, Action callback, Action faultCallback = null) { var obj = new TLSetClientDHParams { Nonce = nonce, ServerNonce = serverNonce, EncryptedData = encryptedData }; SendNonEncryptedMessage("set_client_DH_params", obj, callback, faultCallback); } private TimeSpan _authTimeElapsed; public void InitAsync(Action> callback, Action faultCallback = null) { var authTime = Stopwatch.StartNew(); var newNonce = TLInt256.Random(); #if LOG_REGISTRATION TLUtils.WriteLog("Start ReqPQ"); #endif var nonce = TLInt128.Random(); ReqPQAsync(nonce, resPQ => { GetServerPublicKeyAsync(_activeTransport.DCId, resPQ.ServerPublicKeyFingerprints, (index, publicKey) => { if (index < 0 || string.IsNullOrEmpty(publicKey)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("unknown public key") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var serverNonce = resPQ.ServerNonce; if (!TLUtils.ByteArraysEqual(nonce.Value, resPQ.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ"); #endif TimeSpan calcTime; WindowsPhone.Tuple pqPair; var innerData = GetInnerData(new TLInt(TLUtils.GetProtocolDCId(_activeTransport.DCId, false, Constants.IsTestServer)), resPQ, newNonce, out calcTime, out pqPair); var encryptedInnerData = GetEncryptedInnerData(innerData, publicKey); #if LOG_REGISTRATION var pq = BitConverter.ToUInt64(resPQ.PQ.Data.Reverse().ToArray(), 0); var logPQString = new StringBuilder(); logPQString.AppendLine("PQ Counters"); logPQString.AppendLine(); logPQString.AppendLine("pq: " + pq); logPQString.AppendLine("p: " + pqPair.Item1); logPQString.AppendLine("q: " + pqPair.Item2); logPQString.AppendLine("encrypted_data length: " + encryptedInnerData.Data.Length); TLUtils.WriteLog(logPQString.ToString()); TLUtils.WriteLog("Start ReqDHParams"); #endif ReqDHParamsAsync( resPQ.Nonce, resPQ.ServerNonce, innerData.P, innerData.Q, resPQ.ServerPublicKeyFingerprints[0], encryptedInnerData, serverDHParams => { if (!TLUtils.ByteArraysEqual(nonce.Value, serverDHParams.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.ByteArraysEqual(serverNonce.Value, serverDHParams.ServerNonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect server_nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams"); #endif var random = new SecureRandom(); var serverDHParamsOk = serverDHParams as TLServerDHParamsOk; if (serverDHParamsOk == null) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("Incorrect serverDHParams " + serverDHParams.GetType()) }; if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("ServerDHParams " + serverDHParams); #endif return; } var aesParams = GetAesKeyIV(resPQ.ServerNonce.ToBytes(), newNonce.ToBytes()); var decryptedAnswerWithHash = Utils.AesIge(serverDHParamsOk.EncryptedAnswer.Data, aesParams.Item1, aesParams.Item2, false); var position = 0; var serverDHInnerData = (TLServerDHInnerData)new TLServerDHInnerData().FromBytes(decryptedAnswerWithHash.Skip(20).ToArray(), ref position); var sha1 = Utils.ComputeSHA1(serverDHInnerData.ToBytes()); if (!TLUtils.ByteArraysEqual(sha1, decryptedAnswerWithHash.Take(20).ToArray())) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect sha1 TLServerDHInnerData") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.CheckPrime(serverDHInnerData.DHPrime.Data, serverDHInnerData.G.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect (p, q) pair") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.CheckGaAndGb(serverDHInnerData.GA.Data, serverDHInnerData.DHPrime.Data)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect g_a") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var bBytes = new byte[256]; //big endian B random.NextBytes(bBytes); var gbBytes = GetGB(bBytes, serverDHInnerData.G, serverDHInnerData.DHPrime); var clientDHInnerData = new TLClientDHInnerData { Nonce = resPQ.Nonce, ServerNonce = resPQ.ServerNonce, RetryId = new TLLong(0), GB = TLString.FromBigEndianData(gbBytes) }; var encryptedClientDHInnerData = GetEncryptedClientDHInnerData(clientDHInnerData, aesParams); #if LOG_REGISTRATION TLUtils.WriteLog("Start SetClientDHParams"); #endif SetClientDHParamsAsync(resPQ.Nonce, resPQ.ServerNonce, encryptedClientDHInnerData, dhGen => { if (!TLUtils.ByteArraysEqual(nonce.Value, dhGen.Nonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } if (!TLUtils.ByteArraysEqual(serverNonce.Value, dhGen.ServerNonce.Value)) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("incorrect server_nonce") }; #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); } var dhGenOk = dhGen as TLDHGenOk; if (dhGenOk == null) { var error = new TLRPCError { Code = new TLInt(404), Message = new TLString("Incorrect dhGen " + dhGen.GetType()) }; if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("DHGen result " + serverDHParams); #endif return; } _authTimeElapsed = authTime.Elapsed; #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams"); #endif var getKeyTimer = Stopwatch.StartNew(); var authKey = GetAuthKey(bBytes, serverDHInnerData.GA.ToBytes(), serverDHInnerData.DHPrime.ToBytes()); var logCountersString = new StringBuilder(); logCountersString.AppendLine("Auth Counters"); logCountersString.AppendLine(); logCountersString.AppendLine("pq factorization time: " + calcTime); logCountersString.AppendLine("calc auth key time: " + getKeyTimer.Elapsed); logCountersString.AppendLine("auth time: " + _authTimeElapsed); #if LOG_REGISTRATION TLUtils.WriteLog(logCountersString.ToString()); #endif //newNonce - little endian //authResponse.ServerNonce - little endian var salt = GetSalt(newNonce.ToBytes(), resPQ.ServerNonce.ToBytes()); var sessionId = new byte[8]; random.NextBytes(sessionId); TLUtils.WriteLine("Salt " + BitConverter.ToInt64(salt, 0) + " (" + BitConverter.ToString(salt) + ")"); TLUtils.WriteLine("Session id " + BitConverter.ToInt64(sessionId, 0) + " (" + BitConverter.ToString(sessionId) + ")"); callback(new WindowsPhone.Tuple(authKey, new TLLong(BitConverter.ToInt64(salt, 0)), new TLLong(BitConverter.ToInt64(sessionId, 0)))); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop SetClientDHParams with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqDHParams with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); }); }, error => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop ReqPQ with error " + error.ToString()); #endif if (faultCallback != null) faultCallback(error); TLUtils.WriteLine(error.ToString()); }); } private static TLPQInnerData GetInnerData(TLInt dcId, TLResPQ resPQ, TLInt256 newNonce, out TimeSpan calcTime, out WindowsPhone.Tuple pqPair) { var pq = BitConverter.ToUInt64(resPQ.PQ.Data.Reverse().ToArray(), 0); TLUtils.WriteLine("pq: " + pq); var pqCalcTime = Stopwatch.StartNew(); try { pqPair = Utils.GetFastPQ(pq); pqCalcTime.Stop(); calcTime = pqCalcTime.Elapsed; TLUtils.WriteLineAtBegin("Pq Fast calculation time: " + pqCalcTime.Elapsed); TLUtils.WriteLine("p: " + pqPair.Item1); TLUtils.WriteLine("q: " + pqPair.Item2); } catch (Exception e) { pqCalcTime = Stopwatch.StartNew(); pqPair = Utils.GetPQPollard(pq); pqCalcTime.Stop(); calcTime = pqCalcTime.Elapsed; TLUtils.WriteLineAtBegin("Pq Pollard calculation time: " + pqCalcTime.Elapsed); TLUtils.WriteLine("p: " + pqPair.Item1); TLUtils.WriteLine("q: " + pqPair.Item2); } var p = TLString.FromUInt64(pqPair.Item1); var q = TLString.FromUInt64(pqPair.Item2); var innerData1 = new TLPQInnerDataDC { NewNonce = newNonce, Nonce = resPQ.Nonce, P = p, Q = q, PQ = resPQ.PQ, ServerNonce = resPQ.ServerNonce, DCId = dcId }; return innerData1; } private static TLString GetEncryptedClientDHInnerData(TLClientDHInnerData clientDHInnerData, WindowsPhone.Tuple aesParams) { var random = new Random(); var client_DH_inner_data = clientDHInnerData.ToBytes(); var client_DH_inner_dataWithHash = TLUtils.Combine(Utils.ComputeSHA1(client_DH_inner_data), client_DH_inner_data); var addedBytesLength = 16 - (client_DH_inner_dataWithHash.Length % 16); if (addedBytesLength > 0 && addedBytesLength < 16) { var addedBytes = new byte[addedBytesLength]; random.NextBytes(addedBytes); client_DH_inner_dataWithHash = TLUtils.Combine(client_DH_inner_dataWithHash, addedBytes); //TLUtils.WriteLine(string.Format("Added {0} bytes", addedBytesLength)); } var aesEncryptClientDHInnerDataWithHash = Utils.AesIge(client_DH_inner_dataWithHash, aesParams.Item1, aesParams.Item2, true); return TLString.FromBigEndianData(aesEncryptClientDHInnerDataWithHash); } public static TLString GetEncryptedInnerData(TLPQInnerData innerData, string publicKey) { var innerDataBytes = innerData.ToBytes(); #if LOG_REGISTRATION var sb = new StringBuilder(); sb.AppendLine(); sb.AppendLine("pq " + innerData.PQ.ToBytes().Length); sb.AppendLine("p " + innerData.P.ToBytes().Length); sb.AppendLine("q " + innerData.Q.ToBytes().Length); sb.AppendLine("nonce " + innerData.Nonce.ToBytes().Length); sb.AppendLine("serverNonce " + innerData.ServerNonce.ToBytes().Length); sb.AppendLine("newNonce " + innerData.NewNonce.ToBytes().Length); sb.AppendLine("innerData length " + innerDataBytes.Length); TLUtils.WriteLog(sb.ToString()); #endif var sha1 = Utils.ComputeSHA1(innerDataBytes); var dataWithHash = TLUtils.Combine(sha1, innerDataBytes); //116 #if LOG_REGISTRATION TLUtils.WriteLog("innerData+hash length " + dataWithHash.Length); #endif var data255 = new byte[255]; var random = new Random(); random.NextBytes(data255); Array.Copy(dataWithHash, data255, dataWithHash.Length); var reverseRSABytes = Utils.GetRSABytes(data255, publicKey); // NOTE: remove Reverse here var encryptedData = new TLString { Data = reverseRSABytes }; return encryptedData; } public static byte[] GetSalt(byte[] newNonce, byte[] serverNonce) { var newNonceBytes = newNonce.Take(8).ToArray(); var serverNonceBytes = serverNonce.Take(8).ToArray(); var returnBytes = new byte[8]; for (int i = 0; i < returnBytes.Length; i++) { returnBytes[i] = (byte)(newNonceBytes[i] ^ serverNonceBytes[i]); } return returnBytes; } // return big-endian authKey public static byte[] GetAuthKey(byte[] bBytes, byte[] g_aData, byte[] dhPrimeData) { int position = 0; var b = new BigInteger(bBytes.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var dhPrime = TLObject.GetObject(dhPrimeData, ref position).ToBigInteger(); position = 0; var g_a = TLObject.GetObject(g_aData, ref position).ToBigInteger(); var authKey = BigInteger.ModPow(g_a, b, dhPrime).ToByteArray(); // little endian + (may be) zero last byte //remove last zero byte if (authKey[authKey.Length - 1] == 0x00) { authKey = authKey.SubArray(0, authKey.Length - 1); } authKey = authKey.Reverse().ToArray(); if (authKey.Length > 256) { #if DEBUG var authKeyInfo = new StringBuilder(); authKeyInfo.AppendLine("auth_key length > 256: " + authKey.Length); authKeyInfo.AppendLine("g_a=" + g_a); authKeyInfo.AppendLine("b=" + b); authKeyInfo.AppendLine("dhPrime=" + dhPrime); Execute.ShowDebugMessage(authKeyInfo.ToString()); #endif var correctedAuth = new byte[256]; Array.Copy(authKey, authKey.Length - 256, correctedAuth, 0, 256); authKey = correctedAuth; } else if (authKey.Length < 256) { #if DEBUG var authKeyInfo = new StringBuilder(); authKeyInfo.AppendLine("auth_key length < 256: " + authKey.Length); authKeyInfo.AppendLine("g_a=" + g_a); authKeyInfo.AppendLine("b=" + b); authKeyInfo.AppendLine("dhPrime=" + dhPrime); Execute.ShowDebugMessage(authKeyInfo.ToString()); #endif var correctedAuth = new byte[256]; Array.Copy(authKey, 0, correctedAuth, 256 - authKey.Length, authKey.Length); for (var i = 0; i < 256 - authKey.Length; i++) { authKey[i] = 0; } authKey = correctedAuth; } return authKey; } // b - big endian bytes // g - serialized data // dhPrime - serialized data // returns big-endian G_B public static byte[] GetGB(byte[] bData, TLInt gData, TLString pString) { //var bBytes = new byte[256]; // big endian bytes //var random = new Random(); //random.NextBytes(bBytes); var g = new BigInteger(gData.Value); var p = pString.ToBigInteger(); var b = new BigInteger(bData.Reverse().Concat(new byte[] { 0x00 }).ToArray()); var gb = BigInteger.ModPow(g, b, p).ToByteArray(); // little endian + (may be) zero last byte //remove last zero byte if (gb[gb.Length - 1] == 0x00) { gb = gb.SubArray(0, gb.Length - 1); } var length = gb.Length; var result = new byte[length]; for (int i = 0; i < length; i++) { result[length - i - 1] = gb[i]; } return result; } //public BigInteger ToBigInteger() //{ // var data = new List(Data); // while (data[0] == 0x00) // { // data.RemoveAt(0); // } // return new BigInteger(Data.Reverse().Concat(new byte[] { 0x00 }).ToArray()); //NOTE: add reverse here //} public static WindowsPhone.Tuple GetAesKeyIV(byte[] serverNonce, byte[] newNonce) { var newNonceServerNonce = TLUtils.Combine(newNonce, serverNonce); var serverNonceNewNonce = TLUtils.Combine(serverNonce, newNonce); var key = TLUtils.Combine( Utils.ComputeSHA1(newNonceServerNonce), Utils.ComputeSHA1(serverNonceNewNonce).SubArray(0, 12)); var iv = TLUtils.Combine( Utils.ComputeSHA1(serverNonceNewNonce).SubArray(12, 8), Utils.ComputeSHA1(TLUtils.Combine(newNonce, newNonce)), newNonce.SubArray(0, 4)); return new WindowsPhone.Tuple(key, iv); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Help.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Threading; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Help; namespace Telegram.Api.Services { public partial class MTProtoService { private TLConfig __config = new TLConfig { DCOptions = new TLVector { new TLDCOption { Id = new TLInt(Constants.FirstServerDCId), IpAddress = new TLString(Constants.FirstServerIpAddress), Port = new TLInt(Constants.FirstServerPort) } } }; private TLConfig _config { get { return __config; } set { __config = value; } } public void GetConfigAsync(Action callback, Action faultCallback = null) { var obj = new TLGetConfig(); Logs.Log.Write("help.getConfig"); SendInformativeMessage("help.getConfig", obj, result => { callback(result); }, faultCallback); } private Timer _getConfigTimer; private volatile bool _isGettingConfig; private void CheckGetConfig(object state) { //TLUtils.WriteLine(DateTime.Now.ToLongTimeString() + ": Check Config on Thread " + Thread.CurrentThread.ManagedThreadId, LogSeverity.Error); if (_deviceInfo != null && _deviceInfo.IsBackground) { return; } if (_isGettingConfig) { return; } if (_activeTransport == null) { return; } if (_activeTransport.AuthKey == null) { return; } var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (!isAuthorized) { return; } var currentTime = TLUtils.DateToUniversalTimeTLInt(ClientTicksDelta, DateTime.Now); var config23 = _config as TLConfig23; if (config23 != null && config23.Expires != null && (config23.Expires.Value > currentTime.Value)) { return; } //if (_config != null && _config.Date != null && Math.Abs(_config.Date.Value - currentTime.Value) < Constants.GetConfigInterval) //{ // return; //} //Execute.ShowDebugMessage("MTProtoService.CheckGetConfig GetConfig"); _isGettingConfig = true; GetConfigAsync( result => { //TLUtils.WriteLine(DateTime.Now.ToLongTimeString() + ": help.getConfig", LogSeverity.Error); _config = TLConfig.Merge(_config, result); SaveConfig(); _isGettingConfig = false; }, error => { _isGettingConfig = false; //Execute.ShowDebugMessage("help.getConfig error: " + error); }); } public void GetPassportConfigAsync(TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetPassportConfig { Hash = hash }; SendInformativeMessage("help.getPassportConfig", obj, callback, faultCallback); } public void GetTermsOfServiceAsync(TLString countryISO2, Action callback, Action faultCallback = null) { var obj = new TLGetTermsOfService { CountryISO2 = countryISO2 }; SendInformativeMessage("help.getTermsOfService", obj, callback, faultCallback); } public void GetNearestDCAsync(Action callback, Action faultCallback = null) { var obj = new TLGetNearestDC(); SendInformativeMessage("help.getNearestDc", obj, callback, faultCallback); } public void GetInviteTextAsync(TLString langCode, Action callback, Action faultCallback = null) { var obj = new TLGetInviteText(); SendInformativeMessage("help.getInviteText", obj, callback, faultCallback); } public void GetSupportAsync(Action callback, Action faultCallback = null) { var obj = new TLGetSupport(); SendInformativeMessage("help.getSupport", obj, callback, faultCallback); } public void GetAppChangelogAsync(TLString deviceModel, TLString systemVersion, TLString appVersion, TLString langCode, Action callback, Action faultCallback = null) { var obj = new TLGetAppChangelog(); SendInformativeMessage("help.getAppChangelog", obj, callback, faultCallback); } public void GetCdnConfigAsync(Action callback, Action faultCallback = null) { var obj = new TLGetCdnConfig(); SendInformativeMessage("help.getCdnConfig", obj, result => { foreach (var publicKey in result.PublicKeys) { var fingerprint = Utils.GetRSAFingerprint(publicKey.PublicKey.ToString()); publicKey.PublicKeyFingerprint = new TLLong(fingerprint); } callback.SafeInvoke(result); }, faultCallback); } public void GetDeepLinkInfoAsync(TLString path, Action callback, Action faultCallback = null) { var obj = new TLGetDeepLinkInfo{ Path = path }; SendInformativeMessage("help.getDeepLinkInfo", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Helpers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using Telegram.Logs; #if WINDOWS_PHONE using System.Globalization; #endif using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Help; using Telegram.Api.Transport; namespace Telegram.Api.Services { public partial class MTProtoService { private void PrintCaption(string caption) { TLUtils.WriteLine(" "); //TLUtils.WriteLine("------------------------"); TLUtils.WriteLine(String.Format("-->>{0}", caption)); TLUtils.WriteLine("------------------------"); } public TLEncryptedTransportMessage GetEncryptedTransportMessage(byte[] authKey, TLLong salt, TLObject obj) { int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = 0; messageId = _activeTransport.GenerateMessageId(true); } var sessionId = TLLong.Random(); var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); return encryptedMessage; } private readonly object _delayedNonInformativeItemsRoot = new object(); private readonly List _delayedNonInformativeItems = new List(); private void SendNonInformativeMessage(string caption, TLObject obj, Action callback, Action faultCallback = null) where T : TLObject { PrintCaption(caption); if (_activeTransport.AuthKey == null) { var delayedItem = new DelayedItem { SendTime = DateTime.Now, //SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Callback = t => callback((T)t), AttemptFailed = null, FaultCallback = faultCallback, }; lock (_delayedNonInformativeItemsRoot) { _delayedNonInformativeItems.Add(delayedItem); } #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Add delayed item {0} sendTime={1}", delayedItem.Caption, delayedItem.SendTime.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); #endif return; } int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2; messageId = _activeTransport.GenerateMessageId(true); } var authKey = _activeTransport.AuthKey; var salt = _activeTransport.Salt; var sessionId = _activeTransport.SessionId; var clientsTicksDelta = _activeTransport.ClientTicksDelta; var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } HistoryItem historyItem = null; if (string.Equals(caption, "ping", StringComparison.OrdinalIgnoreCase) || string.Equals(caption, "ping_delay_disconnect", StringComparison.OrdinalIgnoreCase) || string.Equals(caption, "messages.container", StringComparison.OrdinalIgnoreCase)) { //save items to history historyItem = new HistoryItem { SendTime = DateTime.Now, //SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Message = transportMessage, Callback = t => callback((T)t), AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = clientsTicksDelta, Status = RequestStatus.Sent, }; lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } #if DEBUG NotifyOfPropertyChange(() => History); #endif } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2, -4} SessionId {3}", caption, transportMessage.MessageId.Value, transportMessage.SeqNo.Value, transportMessage.SessionId.Value); var captionString = string.Format("{0} {1}", caption, transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { if (!result) { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif } faultCallback.SafeInvoke(new TLRPCError(404) { Message = new TLString("FastCallback SocketError=" + result) }); } }, error => { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif } faultCallback.SafeInvoke(new TLRPCError(404) { #if WINDOWS_PHONE SocketError = error.Error, #endif Exception = error.Exception }); }); } private void SendPacketAsync(ITransport transport, string caption, TLObject data, Action callback, Action faultCallback = null) { if (_deviceInfo != null && _deviceInfo.IsBackground) { if (caption.Contains("account.updateStatus")) { } Log.SyncWrite("Background MTProto send " + caption); } transport.SendPacketAsync( caption, data.ToBytes(), callback, faultCallback); } private readonly object _historyRoot = new object(); public void SendInformativeMessageInternal(string caption, TLObject obj, Action callback, Action faultCallback = null, int? maxAttempt = null, // to send delayed items Action attemptFailed = null, Action fastCallback = null) // to send delayed items where T : TLObject { if (_activeTransport.AuthKey == null) { var delayedItem = new DelayedItem { SendTime = DateTime.Now, //SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Callback = t => callback((T)t), AttemptFailed = attemptFailed, FaultCallback = faultCallback, MaxAttempt = maxAttempt }; lock (_delayedItemsRoot) { _delayedItems.Add(delayedItem); } #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Add delayed item {0} sendTime={1}", delayedItem.Caption, delayedItem.SendTime.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); #endif return; } lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } PrintCaption(caption); TLObject data; lock (_activeTransportRoot) { if (!_activeTransport.Initiated || caption == "auth.sendCode") { var initConnection = new TLInitConnection78 { Flags = new TLInt(0), AppId = new TLInt(Constants.ApiId), AppVersion = new TLString(_deviceInfo.AppVersion), Data = obj, DeviceModel = new TLString(_deviceInfo.Model), LangCode = new TLString(Utils.CurrentUICulture()), SystemLangCode = new TLString(Utils.CurrentUICulture()), LangPack = TLString.Empty, SystemVersion = new TLString(_deviceInfo.SystemVersion), Proxy = TLUtils.GetInputProxy(_transportService.GetProxyConfig()) }; //Execute.ShowDebugMessage("initConnection dc_id=" + _activeTransport.DCId); SaveInitConnectionAsync(initConnection); var withLayerN = new TLInvokeWithLayerN { Data = initConnection }; data = withLayerN; _activeTransport.Initiated = true; } else { data = obj; } } int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } var authKey = _activeTransport.AuthKey; var salt = _activeTransport.Salt; var sessionId = _activeTransport.SessionId; var clientsTicksDelta = _activeTransport.ClientTicksDelta; var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, data); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); //save items to history var historyItem = new HistoryItem { SendTime = DateTime.Now, //SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Message = transportMessage, Callback = t => callback((T)t), AttemptFailed = attemptFailed, FaultCallback = faultCallback, ClientTicksDelta = clientsTicksDelta, Status = RequestStatus.Sent, }; lock (_historyRoot) { #if DEBUG HistoryItem existingItem; if (_history.TryGetValue(historyItem.Hash, out existingItem)) { Execute.ShowDebugMessage(string.Format("Duplicated history item hash={0} existing={1} new={2}", historyItem.Hash, existingItem.Caption, historyItem.Caption)); } _history[historyItem.Hash] = historyItem; #else _history[historyItem.Hash] = historyItem; #endif } #if DEBUG ITransport transport; lock (_activeTransportRoot) { transport = _activeTransport; } var transportId = transport.Id; var lastReceiveTime = transport.LastReceiveTime; int historyCount; string historyDescription; lock (_historyRoot) { historyCount = _history.Count; historyDescription = string.Join("\n", _history.Values.Select(x => x.Caption + " " + x.Hash)); } var currentPacketLength = transport.PacketLength; var lastPacketLength = transport.LastPacketLength; RaiseTransportChecked(new TransportCheckedEventArgs { TransportId = transportId, SessionId = sessionId, AuthKey = authKey, LastReceiveTime = lastReceiveTime, HistoryCount = historyCount, HistoryDescription = historyDescription, NextPacketLength = currentPacketLength, LastPacketLength = lastPacketLength }); #endif #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Add history item {0} sendTime={1}", historyItem.Caption, historyItem.SendTime.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); #endif #if DEBUG if (historyItem.Caption != "account.updateStatus") // to avoid deadlock on deactivation { NotifyOfPropertyChange(() => History); } #endif //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2, -4} SessionId {3} ClientTicksDelta {4}", caption, transportMessage.MessageId.Value, transportMessage.SeqNo.Value, transportMessage.SessionId.Value, clientsTicksDelta); var captionString = string.Format("{0} {1} {2}", caption, transportMessage.SessionId, transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { if (!result) { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG if (historyItem.Caption != "account.updateStatus") // to avoid deadlock on deactivation { NotifyOfPropertyChange(() => History); } #endif } faultCallback.SafeInvoke(new TLRPCError(404) { Message = new TLString("FastCallback SocketError=" + result) }); } }, error => { if (historyItem != null) { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG if (historyItem.Caption != "account.updateStatus") // to avoid deadlock on deactivation { NotifyOfPropertyChange(() => History); } #endif } faultCallback.SafeInvoke(new TLRPCError(404) { #if WINDOWS_PHONE SocketError = error.Error, #endif Exception = error.Exception }); }); } private void SendInformativeMessage(string caption, TLObject obj, Action callback, Action faultCallback = null, int? maxAttempt = null, // to send delayed items Action attemptFailed = null) // to send delayed items where T : TLObject { Execute.BeginOnThreadPool(() => { SendInformativeMessageInternal(caption, obj, callback, faultCallback, maxAttempt, attemptFailed); }); } private void SendNonEncryptedMessage(string caption, TLObject obj, Action callback, Action faultCallback = null) where T : TLObject { PrintCaption(caption); TLLong messageId; lock (_activeTransportRoot) { messageId = _activeTransport.GenerateMessageId(); } var message = CreateTLNonEncryptedMessage(messageId, obj); var historyItem = new HistoryItem { Caption = caption, Message = message, Callback = t => callback((T)t), FaultCallback = faultCallback, SendTime = DateTime.Now, Status = RequestStatus.Sent }; var guid = message.MessageId; lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } var activeTransport = _activeTransport; // до вызова callback _activeTransport может уже поменяться // Сначала создаем или получаем транспорт, а потом добавляем в его историю. // Если сначала добавить в историю транспорта, то потом можем получить новый и не найдем запрос _activeTransport.EnqueueNonEncryptedItem(historyItem); var bytes = message.ToBytes(); #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("SendPacketAsync {0} [{1}](data length={2})", _activeTransport.Id, caption, bytes.Length)); #endif var captionString = string.Format("{0} {1}", caption, guid); SendPacketAsync(_activeTransport, captionString, message, socketError => { #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("SendPacketAsync fastCallback {0} [{1}] socketError={2}", activeTransport.Id, caption, socketError)); #endif if (!socketError) { var result = activeTransport.RemoveNonEncryptedItem(historyItem); if (result) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("FastCallback SocketError=" + socketError) }); } } }, error => { #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("SendPacketAsync error {0} [{1}] error={2}", activeTransport.Id, caption, error)); #endif var result = activeTransport.RemoveNonEncryptedItem(historyItem); // чтобы callback не вызвался два раза из CheckTimeouts и отсюда if (result) { faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("FaltCallback") }); } }); } private static TLEncryptedTransportMessage CreateTLEncryptedMessage(byte[] authKey, TLContainerTransportMessage containerTransportMessage) { var message = new TLEncryptedTransportMessage { Data = containerTransportMessage.ToBytes() }; return message.Encrypt(authKey); } private TLTransportMessage CreateTLTransportMessage(TLLong salt, TLLong sessionId, TLInt seqNo, TLLong messageId, TLObject obj) { var message = new TLTransportMessage(); message.Salt = salt; message.SessionId = sessionId; message.MessageId = messageId; message.SeqNo = seqNo; message.MessageData = obj; return message; } public static TLNonEncryptedMessage CreateTLNonEncryptedMessage(TLLong messageId, TLObject obj) { var message = new TLNonEncryptedMessage(); message.AuthKeyId = new TLLong(0); message.MessageId = messageId; message.Data = obj; return message; } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.HttpLongPoll.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Threading; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services { public enum TransportType { Http, Tcp } public partial class MTProtoService { private volatile bool _isLongPollStopped; private const int ReattemptDelay = Constants.LongPollReattemptDelay; public void StartLongPollRequestAsync() { if (_isLongPollStopped || _type != TransportType.Http) return; TLUtils.WriteLongPoll("Send " + DateTime.Now); try { HttpWaitAsync(new TLInt(0), new TLInt(0), new TLInt(25000), () => { TLUtils.WriteLongPoll("Receive " + DateTime.Now); StartLongPollRequestAsync(); }, () => { TLUtils.WriteLongPoll("Receive failed " + DateTime.Now); StartLongPollRequestAsync(); }); } catch (Exception) { TLUtils.WriteLongPoll("Receive failed " + DateTime.Now); Execute.BeginOnThreadPool(TimeSpan.FromSeconds(5.0), StartLongPollRequestAsync); } } public void StartLongPoll() { TLUtils.WriteLongPoll("Start long poll " + DateTime.Now); _isLongPollStopped = false; StartLongPollRequestAsync(); } public void StopLongPoll() { TLUtils.WriteLongPoll("Stop long poll " + DateTime.Now); _isLongPollStopped = true; } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Langpack.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Langpack; namespace Telegram.Api.Services { public partial class MTProtoService { public void GetLangPackAsync(TLString langCode, Action callback, Action faultCallback = null) { var obj = new TLGetLangPack { LangCode = langCode }; SendInformativeMessage("langpack.getLangPack", obj, callback, faultCallback); } public void GetStringsAsync(TLString langCode, TLVector keys, Action> callback, Action faultCallback = null) { var obj = new TLGetStrings { LangCode = langCode, Keys = keys }; SendInformativeMessage("langpack.getStrings", obj, callback, faultCallback); } public void GetDifferenceAsync(TLInt fromVersion, Action callback, Action faultCallback = null) { var obj = new TLGetDifference { FromVersion = fromVersion }; SendInformativeMessage("langpack.getDifference", obj, callback, faultCallback); } public void GetLanguagesAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetLanguages(); SendInformativeMessage("langpack.getLanguages", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Messages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Help; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.Services { public partial class MTProtoService { public void ToggleTopPeersAsync(TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLToggleTopPeers{ Enabled = enabled }; const string caption = "messages.toggleTopPeers"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void ClearAllDraftsAsync(Action callback, Action faultCallback = null) { var obj = new TLClearAllDrafts(); const string caption = "messages.clearAllDrafts"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void MarkDialogUnreadAsync(bool unread, TLInputDialogPeer peer, Action callback, Action faultCallback = null) { var obj = new TLMarkDialogUnread{ Flags = new TLInt(0), Unread = unread, Peer = peer }; const string caption = "messages.markDialogUnread"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetDialogUnreadMarksAsync(Action> callback, Action faultCallback = null) { var obj = new TLGetDialogUnreadMarks(); const string caption = "messages.getDialogUnreadMarks"; SendInformativeMessage>(caption, obj, callback.SafeInvoke, faultCallback); } public void GetProxyDataAsync(Action callback, Action faultCallback = null) { var obj = new TLGetProxyData(); const string caption = "messages.getProxyData"; SendInformativeMessage(caption, obj, result => { _cacheService.SyncProxyData(result, callback.SafeInvoke); }, faultCallback); } public void SearchStickerSetsAsync(bool full, bool excludeFeatured, TLString q, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLSearchStickerSets { Flags = new TLInt(0), ExcludeFeatured = excludeFeatured, Q = q, Hash = hash }; var results = new List(); var resultsSyncRoot = new object(); const string caption = "messages.searchStickerSets"; SendInformativeMessage(caption, obj, result => { var foundStickerSets = result as TLFoundStickerSets; if (foundStickerSets != null && full) { GetStickerSetsAsync(foundStickerSets, r => callback(r as TLFoundStickerSetsBase), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == foundStickerSets.Sets.Count; } if (processStickerSets) { ProcessStickerSets(foundStickerSets, results); foundStickerSets.MessagesStickerSets = new TLVector(results); callback.SafeInvoke(foundStickerSets); } } }, faultCallback); } else { callback.SafeInvoke(result); } }, faultCallback.SafeInvoke); } public void ReportAsync(TLInputPeerBase peer, TLVector id, TLInputReportReasonBase reason, Action callback, Action faultCallback = null) { var obj = new TLReport { Peer = peer, Id = id, Reason = reason }; const string caption = "messages.report"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetStickersAsync(TLString emoticon, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetStickers { Emoticon = emoticon, Hash = hash }; const string caption = "messages.getStickers"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetRecentLocationsAsync(TLInputPeerBase peer, TLInt limit, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetRecentLocations { Peer = peer, Limit = limit, Hash = hash }; const string caption = "messages.getRecentLocations"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetFavedStickersAsync(TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetFavedStickers { Hash = hash }; const string caption = "messages.getFavedStickers"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void FaveStickerAsync(TLInputDocumentBase id, TLBool unfave, Action callback, Action faultCallback = null) { var obj = new TLFaveSticker { Id = id, Unfave = unfave }; const string caption = "messages.faveSticker"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetUnreadMentionsAsync(TLInputPeerBase peer, TLInt offsetId, TLInt addOffset, TLInt limit, TLInt maxId, TLInt minId, Action callback, Action faultCallback = null) { var obj = new TLGetUnreadMentions { Peer = peer, OffsetId = offsetId, AddOffset = addOffset, Limit = limit, MinId = minId, MaxId = maxId }; SendInformativeMessage("messages.getUnreadMentions", obj, callback.SafeInvoke, faultCallback); } public void ToggleDialogPinAsync(bool pinned, TLPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLToggleDialogPin { Flags = new TLInt(0), Peer = PeerToInputPeer(peer), Pinned = pinned }; const string caption = "messages.toggleDialogPin"; SendInformativeMessage(caption, obj, result => { _cacheService.UpdateDialogPinned(peer, pinned); callback.SafeInvoke(result); }, faultCallback); } public void ReorderPinnedDialogsAsync(bool force, TLVector order, Action callback, Action faultCallback = null) { var obj = new TLReorderPinnedDialogs { Flags = new TLInt(0), Order = order }; if (force) { obj.SetForce(); } const string caption = "messages.reorderPinnedDialogs"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetWebPageAsync(TLString url, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetWebPage { Url = url, Hash = hash }; const string caption = "messages.getWebPage"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetCommonChatsAsync(TLInputUserBase user, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetCommonChats { User = user, MaxId = maxId, Limit = limit }; const string caption = "messages.getCommonChats"; SendInformativeMessage(caption, obj, result => { var chats = result as TLChats24; if (chats != null) { _cacheService.SyncUsersAndChats(new TLVector(), chats.Chats, tuple => callback.SafeInvoke(result)); } }, faultCallback); } private readonly Dictionary _cachedArchivedStickers = new Dictionary(); public void GetAttachedStickersAsync(bool full, TLInputStickeredMediaBase media, Action callback, Action faultCallback = null) { TLArchivedStickers cachedArchivedStickers; var key = string.Format("{0} {1}", media, full); if (_cachedArchivedStickers.TryGetValue(key, out cachedArchivedStickers)) { callback.SafeInvoke(cachedArchivedStickers); return; } var obj = new TLGetAttachedStickers { Media = media }; const string caption = "messages.getAttachedStickers"; //SendInformativeMessage(caption, obj, callback, faultCallback); var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage>(caption, obj, result => { var archivedStickers = new TLArchivedStickers(); archivedStickers.Count = new TLInt(result.Count); archivedStickers.SetsCovered = result; archivedStickers.Packs = new TLVector(); archivedStickers.Documents = new TLVector(); archivedStickers.MessagesStickerSets = new TLVector(); if (full) { GetStickerSetsAsync(archivedStickers, r => callback(r as TLArchivedStickers), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == archivedStickers.Sets.Count; } if (processStickerSets) { ProcessStickerSets(archivedStickers, results); archivedStickers.MessagesStickerSets = new TLVector(results); _cachedArchivedStickers[key] = archivedStickers; callback.SafeInvoke(archivedStickers); } } }, faultCallback); } else { _cachedArchivedStickers[key] = archivedStickers; callback.SafeInvoke(archivedStickers); } }); } public void GetRecentStickersAsync(bool attached, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetRecentStickers { Flags = new TLInt(0), Hash = hash }; if (attached) { obj.SetAttached(); } const string caption = "messages.getRecentStickers"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void ClearRecentStickersAsync(bool attached, Action callback, Action faultCallback = null) { var obj = new TLClearRecentStickers { Flags = new TLInt(0) }; if (attached) { obj.SetAttached(); } const string caption = "messages.clearRecentStickers"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetUnusedStickersAsync(TLInt limit, Action> callback, Action faultCallback = null) { var obj = new TLGetUnusedStickers { Limit = limit }; const string caption = "messages.getUnusedStickers"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void ReadFeaturedStickersAsync(TLVector id, Action callback, Action faultCallback = null) { #if DEBUG callback.SafeInvoke(TLBool.True); return; #endif var obj = new TLReadFeaturedStickers { Id = id }; const string caption = "messages.readFeaturedStickers"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback.SafeInvoke); } public void GetAllDraftsAsync(Action callback, Action faultCallback = null) { var obj = new TLGetAllDrafts(); const string caption = "messages.getAllDrafts"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.ProcessUpdates(result, true); } callback.SafeInvoke(result); }, faultCallback.SafeInvoke); } public void SaveDraftAsync(TLInputPeerBase peer, TLDraftMessageBase draft, Action callback, Action faultCallback = null) { var obj = draft.ToSaveDraftObject(peer); const string caption = "messages.saveDraft"; SendInformativeMessage(caption, obj, result => { callback.SafeInvoke(result); }, faultCallback.SafeInvoke); } public void GetInlineBotResultsAsync(TLInputUserBase bot, TLInputPeerBase peer, TLInputGeoPointBase geoPoint, TLString query, TLString offset, Action callback, Action faultCallback = null) { var key = string.Format("{0}_{1}_{2}_{3}_{4}", bot, peer, geoPoint, query, offset); TLBotResults botResults; if (TryGetCachedValue(_cache, key, out botResults, IsCacheTimeValid)) { callback.SafeInvoke(botResults); return; } var obj = new TLGetInlineBotResults { Flags = new TLInt(0), Bot = bot, Peer = peer, GeoPoint = geoPoint, Query = query, Offset = offset }; const string caption = "messages.getInlineBotResults"; SendInformativeMessage(caption, obj, result => { SetCachedValue(ref _cache, key, result as ICachedObject, IsCacheTimeValid); callback.SafeInvoke(result); }, faultCallback); } public void SetInlineBotResultsAsync(TLBool gallery, TLBool pr, TLLong queryId, TLVector results, TLInt cacheTime, TLString nextOffset, TLInlineBotSwitchPM switchPM, Action callback, Action faultCallback = null) { var obj = new TLSetInlineBotResults { Flags = new TLInt(0), Gallery = gallery, Private = pr, QueryId = queryId, Results = results, CacheTime = cacheTime, NextOffset = nextOffset, SwitchPM = switchPM }; const string caption = "messages.setInlineBotResults"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void SendInlineBotResultAsync(TLMessage45 message, Action callback, Action fastCallback, Action faultCallback = null) { var inputPeer = PeerToInputPeer(message.ToId); var obj = new TLSendInlineBotResult { Flags = new TLInt(0), Peer = inputPeer, ReplyToMsgId = message.ReplyToMsgId, RandomId = message.RandomId, QueryId = message.InlineBotResultQueryId, Id = message.InlineBotResultId }; if (message.IsChannelMessage) { obj.SetChannelMessage(); } var message48 = message as TLMessage48; if (message48 != null && message48.Silent) { obj.SetSilent(); } const string caption = "messages.sendInlineBotResult"; SendInlineBotResultAsyncInternal(obj, result => { var multiPts = result as IMultiPts; var shortSentMessage = result as TLUpdatesShortSentMessage; if (shortSentMessage != null) { message.Flags = shortSentMessage.Flags; if (shortSentMessage.HasMedia) { message._media = shortSentMessage.Media; } if (shortSentMessage.HasEntities) { message.Entities = shortSentMessage.Entities; } Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); message.Date = shortSentMessage.Date; if (shortSentMessage.Media is TLMessageMediaWebPage) { message.NotifyOfPropertyChange(() => message.Media); } #if DEBUG message.Id = shortSentMessage.Id; message.NotifyOfPropertyChange(() => message.Id); message.NotifyOfPropertyChange(() => message.Date); #endif }); _updatesService.SetState(multiPts, caption); message.Id = shortSentMessage.Id; _cacheService.SyncSendingMessage(message, null, callback); return; } var updates = result as TLUpdates; if (updates != null) { foreach (var update in updates.Updates) { var updateNewMessage = update as TLUpdateNewMessage24; if (updateNewMessage != null) { Execute.BeginOnUIThread(() => { // faster update web page with inline bots @imdb, @vid, @wiki var newMessage = updateNewMessage.Message as TLMessage45; if (newMessage != null) { var mediaWebPage = newMessage.Media as TLMessageMediaWebPage; if (mediaWebPage != null) { message.Media = newMessage.Media; } if (mediaWebPage == null) { //Execute.ShowDebugMessage(newMessage.Media.GetType().ToString()); } } }); var messageCommon = updateNewMessage.Message as TLMessageCommon; if (messageCommon != null) { messageCommon.RandomId = message.RandomId; message.Id = messageCommon.Id; message.Date = messageCommon.Date; } } } Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); }); if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.ProcessUpdates(updates); } callback.SafeInvoke(message); } }, fastCallback, faultCallback.SafeInvoke); } public void GetDocumentByHashAsync(TLString sha256, TLInt size, TLString mimeType, Action callback, Action faultCallback = null) { var obj = new TLGetDocumentByHash { Sha256 = sha256, Size = size, MimeType = mimeType }; const string caption = "messages.getDocumentByHash"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void SearchGifsAsync(TLString q, TLInt offset, Action callback, Action faultCallback = null) { var obj = new TLSearchGifs { Q = q, Offset = offset }; const string caption = "messages.searchGifs"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetSavedGifsAsync(TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetSavedGifs { Hash = hash }; const string caption = "messages.getSavedGifs"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void SaveGifAsync(TLInputDocumentBase id, TLBool unsave, Action callback, Action faultCallback = null) { var obj = new TLSaveGif { Id = id, Unsave = unsave }; const string caption = "messages.saveGif"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void ReorderStickerSetsAsync(bool masks, TLVector order, Action callback, Action faultCallback = null) { var obj = new TLReorderStickerSets { Flags = new TLInt(0), Order = order }; if (masks) { obj.SetMasks(); } const string caption = "messages.reorderStickerSets"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void ReportSpamAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { #if DEBUG Execute.BeginOnThreadPool(() => callback.SafeInvoke(TLBool.True)); return; #endif var obj = new TLReportSpam { Peer = peer }; const string caption = "messages.reportSpam"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetWebPagePreviewAsync(TLString message, Action callback, Action faultCallback = null) { var obj = new TLGetWebPagePreview { Flags = new TLInt(0), Message = message, Entities = null }; const string caption = "messages.getWebPagePreview"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void GetFeaturedStickersAsync(bool full, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetFeaturedStickers { Hash = hash }; const string caption = "messages.getFeaturedStickers"; var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage(caption, obj, result => { var featuredStickers = result as TLFeaturedStickers; if (featuredStickers != null && full) { GetStickerSetsAsync(featuredStickers, r => callback(r as TLFeaturedStickersBase), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == featuredStickers.Sets.Count; } if (processStickerSets) { ProcessStickerSets(featuredStickers, results); featuredStickers.MessagesStickerSets = new TLVector(results); //Execute.ShowDebugMessage(caption + " elapsed=" + stopwatch.Elapsed); callback.SafeInvoke(featuredStickers); } } }, faultCallback); } else { callback.SafeInvoke(result); } }, faultCallback.SafeInvoke); } public void GetArchivedStickersAsync(bool full, TLLong offsetId, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetArchivedStickers { Flags = new TLInt(0), OffsetId = offsetId, Limit = limit }; //obj.SetMasks(); const string caption = "messages.getArchivedStickers"; var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage(caption, obj, result => { if (full) { GetStickerSetsAsync(result, r => callback(r as TLArchivedStickers), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == result.Sets.Count; } if (processStickerSets) { ProcessStickerSets(result, results); result.MessagesStickerSets = new TLVector(results); callback.SafeInvoke(result); } } }, faultCallback); } else { callback.SafeInvoke(result); } }); } public void GetMaskStickersAsync(TLString hash, Action callback, Action faultCallback = null) { var obj = new TLGetMaskStickers { Hash = TLUtils.ToTLInt(hash) ?? new TLInt(0) }; const string caption = "messages.getMaskStickers"; var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage(caption, obj, result => { var allStickers32 = result as TLAllStickers43; if (allStickers32 != null) { GetStickerSetsAsync(allStickers32, r => callback(r as TLAllStickersBase), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == allStickers32.Sets.Count; } if (processStickerSets) { ProcessStickerSets(allStickers32, results); callback.SafeInvoke(allStickers32); } } }, faultCallback); } else { callback.SafeInvoke(result); } }); } public void GetAllStickersAsync(TLString hash, Action callback, Action faultCallback = null) { var obj = new TLGetAllStickers { Hash = TLUtils.ToTLInt(hash) ?? new TLInt(0) }; const string caption = "messages.getAllStickers"; var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage(caption, obj, result => { var allStickers32 = result as TLAllStickers43; if (allStickers32 != null) { GetStickerSetsAsync(allStickers32, r => callback(r as TLAllStickersBase), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == allStickers32.Sets.Count; } if (processStickerSets) { ProcessStickerSets(allStickers32, results); callback.SafeInvoke(allStickers32); } } }, faultCallback); } else { callback.SafeInvoke(result); } }); } private static void ProcessStickerSets(IStickers stickers, List results) { var documentsDict = new Dictionary(); var packsDict = new Dictionary(); foreach (var result in results) { foreach (var pack in result.Packs) { var emoticon = pack.Emoticon.ToString(); TLStickerPack currentPack; if (packsDict.TryGetValue(emoticon, out currentPack)) { var docDict = new Dictionary(); foreach (var document in currentPack.Documents) { docDict[document.Value] = document.Value; } foreach (var document in pack.Documents) { if (!docDict.ContainsKey(document.Value)) { docDict[document.Value] = document.Value; currentPack.Documents.Add(document); } } } else { packsDict[emoticon] = pack; } } foreach (var document in result.Documents) { documentsDict[document.Id.Value] = document; } } stickers.Packs = new TLVector(); foreach (var pack in packsDict.Values) { stickers.Packs.Add(pack); } stickers.Documents = new TLVector(); foreach (var document in documentsDict.Values) { stickers.Documents.Add(document); } } private void GetStickerSetsAsync(IStickers stickers, Action callback, Action getStickerSetCallback, Action faultCallback) { var sets = stickers.Sets; if (sets.Count == 0) { callback.SafeInvoke(stickers); return; } var container = new TLContainer { Messages = new List() }; var historyItems = new List(); for (var i = 0; i < sets.Count; i++) { var set = sets[i]; var obj = new TLGetStickerSet { Stickerset = new TLInputStickerSetId { Id = set.Id, AccessHash = set.AccessHash } }; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } var data = i > 0 ? (TLObject)new TLInvokeAfterMsg { MsgId = container.Messages[i - 1].MessageId, Object = obj } : obj; var transportMessage = new TLContainerTransportMessage { MessageId = messageId, SeqNo = new TLInt(sequenceNumber), MessageData = data }; var historyItem = new HistoryItem { SendTime = DateTime.Now, Caption = "stickers.containerGetStickerSetPart" + i, Object = obj, Message = transportMessage, Callback = getStickerSetCallback, AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = ClientTicksDelta, Status = RequestStatus.Sent, }; historyItems.Add(historyItem); container.Messages.Add(transportMessage); } lock (_historyRoot) { foreach (var historyItem in historyItems) { _history[historyItem.Hash] = historyItem; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif SendNonInformativeMessage("stickers.container", container, result => callback(null), faultCallback); } private Dictionary _stickerSetCache; public void GetStickerSetAsync(TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null) { var obj = new TLGetStickerSet { Stickerset = stickerset }; var inputStickerSetShortName = stickerset as TLInputStickerSetShortName; TLMessagesStickerSet cachedValue; if (inputStickerSetShortName != null && _stickerSetCache != null && _stickerSetCache.TryGetValue(inputStickerSetShortName.ShortName.ToString(), out cachedValue)) { callback.SafeInvoke(cachedValue); return; } const string caption = "messages.getStickerSet"; SendInformativeMessage(caption, obj, result => { _stickerSetCache = _stickerSetCache ?? new Dictionary(); _stickerSetCache[result.Set.ShortName.ToString()] = result; callback.SafeInvoke(result); }, faultCallback); } public void InstallStickerSetAsync(TLInputStickerSetBase stickerset, TLBool archived, Action callback, Action faultCallback = null) { var obj = new TLInstallStickerSet { Stickerset = stickerset, Archived = archived }; const string caption = "messages.installStickerSet"; var results = new List(); var resultsSyncRoot = new object(); SendInformativeMessage(caption, obj, result => { var resultArchive = result as TLStickerSetInstallResultArchive; if (resultArchive != null) { GetStickerSetsAsync(resultArchive, r => callback(r as TLStickerSetInstallResultArchive), stickerSetResult => { var messagesStickerSet = stickerSetResult as TLMessagesStickerSet; if (messagesStickerSet != null) { var set32 = messagesStickerSet.Set as TLStickerSet32; if (set32 != null) { set32.Installed = true; set32.Archived = true; } var set76 = messagesStickerSet.Set as TLStickerSet76; if (set76 != null) { set76.InstalledDate = TLUtils.DateToUniversalTimeTLInt(ClientTicksDelta, DateTime.Now); } bool processStickerSets; lock (resultsSyncRoot) { results.Add(messagesStickerSet); processStickerSets = results.Count == resultArchive.Sets.Count; } if (processStickerSets) { ProcessStickerSets(resultArchive, results); resultArchive.MessagesStickerSets = new TLVector(results); callback.SafeInvoke(result); } } }, faultCallback); } else { callback.SafeInvoke(result); } }, faultCallback); } public void UninstallStickerSetAsync(TLInputStickerSetBase stickerset, Action callback, Action faultCallback = null) { var obj = new TLUninstallStickerSet { Stickerset = stickerset }; const string caption = "messages.uninstallStickerSet"; SendInformativeMessage(caption, obj, callback, faultCallback); } private static MessageStatus GetMessageStatus(ICacheService cacheService, TLPeerBase peer) { var status = MessageStatus.Confirmed; if (peer is TLPeerUser) { var user = cacheService.GetUser(peer.Id); if (user != null) { var botInfo = user.BotInfo as TLBotInfo; if (botInfo != null) { status = MessageStatus.Read; } else if (user.IsSelf) { status = MessageStatus.Read; } } } //if (peer is TLPeerChannel) //{ // status = MessageStatus.Read; //} return status; } public TLInputPeerBase PeerToInputPeer(TLPeerBase peer) { if (peer is TLPeerUser) { var cachedUser = _cacheService.GetUser(peer.Id); if (cachedUser != null) { var userForeign = cachedUser as TLUserForeign; var userRequest = cachedUser as TLUserRequest; var user = cachedUser as TLUser; if (userForeign != null) { return new TLInputPeerUser { UserId = userForeign.Id, AccessHash = userForeign.AccessHash }; } if (userRequest != null) { return new TLInputPeerUser { UserId = userRequest.Id, AccessHash = userRequest.AccessHash }; } if (user != null) { return user.ToInputPeer(); } return new TLInputPeerUser { UserId = peer.Id, AccessHash = new TLLong(0) }; } return new TLInputPeerUser { UserId = peer.Id, AccessHash = new TLLong(0) }; } if (peer is TLPeerChannel) { var channel = _cacheService.GetChat(peer.Id) as TLChannel; if (channel != null) { return new TLInputPeerChannel { ChatId = peer.Id, AccessHash = channel.AccessHash }; } } if (peer is TLPeerChat) { return new TLInputPeerChat { ChatId = peer.Id }; } return new TLInputPeerBroadcast { ChatId = peer.Id }; } public void SendMessageAsync(TLMessage36 message, Action callback, Action fastCallback, Action faultCallback = null) { var inputPeer = PeerToInputPeer(message.ToId); var obj = new TLSendMessage { Peer = inputPeer, ReplyToMsgId = message.ReplyToMsgId, Message = message.Message, RandomId = message.RandomId }; if (message.Entities != null) { obj.Entities = message.Entities; } if (message.NoWebpage) { obj.NoWebpage(); } if (message.IsChannelMessage) { obj.SetChannelMessage(); } var message48 = message as TLMessage48; if (message48 != null && message48.Silent) { obj.SetSilent(); } obj.ClearDraft(); const string caption = "messages.sendMessage"; SendMessageAsyncInternal(obj, result => { #if DEBUG var builder = new StringBuilder(); builder.Append(result.GetType()); var updates = result as TLUpdates; var updatesShort = result as TLUpdatesShort; if (updates != null) { foreach (var update in updates.Updates) { builder.Append(update); } } else if (updatesShort != null) { builder.Append(updatesShort.Update); } Logs.Log.Write(string.Format("{0} result={1}", caption, builder.ToString())); #endif var multiPts = result as IMultiPts; var shortSentMessage = result as TLUpdatesShortSentMessage; if (shortSentMessage != null) { message.Flags = shortSentMessage.Flags; if (shortSentMessage.HasMedia) { message._media = shortSentMessage.Media; } if (shortSentMessage.HasEntities) { message.Entities = shortSentMessage.Entities; } Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); message.Date = shortSentMessage.Date; if (shortSentMessage.Media is TLMessageMediaWebPage) { message.NotifyOfPropertyChange(() => message.Media); } #if DEBUG message.Id = shortSentMessage.Id; message.NotifyOfPropertyChange(() => message.Id); message.NotifyOfPropertyChange(() => message.Date); #endif }); _updatesService.SetState(multiPts, caption); message.Id = shortSentMessage.Id; _cacheService.SyncSendingMessage(message, null, callback); return; } Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); }); if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, new List { message }); } callback.SafeInvoke(message); }, fastCallback, faultCallback.SafeInvoke); } private void ProcessUpdates(TLUpdatesBase updatesBase, IList messages, bool notifyNewMessage = false) { var updates = updatesBase as TLUpdates; if (updates != null) { var messagesRandomIndex = new Dictionary(); if (messages != null) { for (var i = 0; i < messages.Count; i++) { if (messages[i].RandomIndex != 0) { messagesRandomIndex[messages[i].RandomIndex] = messages[i]; } } } var updateNewMessageIndex = new Dictionary(); var updateNewChannelMessageIndex = new Dictionary(); var updateMessageIdList = new List(); for (var i = 0; i < updates.Updates.Count; i++) { var updateNewMessage = updates.Updates[i] as TLUpdateNewMessage; if (updateNewMessage != null) { ProcessSelfMessage(updateNewMessage.Message); updateNewMessageIndex[updateNewMessage.Message.Index] = updateNewMessage; continue; } var updateNewChannelMessage = updates.Updates[i] as TLUpdateNewChannelMessage; if (updateNewChannelMessage != null) { //ProcessSelfMessage(updateNewChannelMessage.Message); // no need to channel messages updateNewChannelMessageIndex[updateNewChannelMessage.Message.Index] = updateNewChannelMessage; continue; } var updateMessageId = updates.Updates[i] as TLUpdateMessageId; if (updateMessageId != null) { updateMessageIdList.Add(updateMessageId); continue; } } foreach (var updateMessageId in updateMessageIdList) { TLUpdateNewMessage updateNewMessage; if (updateNewMessageIndex.TryGetValue(updateMessageId.Id.Value, out updateNewMessage)) { var cachedSendingMessage = _cacheService.GetMessage(updateMessageId.RandomId); if (cachedSendingMessage != null) { updateNewMessage.Message.RandomId = updateMessageId.RandomId; } } TLUpdateNewChannelMessage updateNewChannelMessage; if (updateNewChannelMessageIndex.TryGetValue(updateMessageId.Id.Value, out updateNewChannelMessage)) { var cachedSendingMessage = _cacheService.GetMessage(updateMessageId.RandomId); if (cachedSendingMessage != null) { updateNewChannelMessage.Message.RandomId = updateMessageId.RandomId; } } TLMessage25 message; if (messagesRandomIndex.TryGetValue(updateMessageId.RandomId.Value, out message)) { message.Id = updateMessageId.Id; if (updateNewMessage != null) { var messageCommon = updateNewMessage.Message as TLMessageCommon; if (messageCommon != null) { message.Date = messageCommon.Date; } } else if (updateNewChannelMessage != null) { var messageCommon = updateNewChannelMessage.Message as TLMessageCommon; if (messageCommon != null) { message.Date = messageCommon.Date; } } } } } _updatesService.ProcessUpdates(updates, notifyNewMessage); } public static void ProcessSelfMessage(TLMessageBase messageBase) { var messageCommon = messageBase as TLMessageCommon; if (messageCommon != null && messageCommon.ToId is TLPeerUser && messageCommon.FromId != null && messageCommon.FromId.Value == messageCommon.ToId.Id.Value) { messageCommon.Out = TLBool.True; messageCommon.SetUnreadSilent(TLBool.False); } } public void GetBotCallbackAnswerAsync(TLInputPeerBase peer, TLInt messageId, TLString data, TLBool game, Action callback, Action faultCallback = null) { var key = string.Format("{0}_{1}_{2}_{3}", peer, messageId, data, game); TLBotCallbackAnswer58 botCallbackAnswer; if (TryGetCachedValue(_cache, key, out botCallbackAnswer, IsCacheTimeValid)) { callback.SafeInvoke(botCallbackAnswer); return; } var obj = new TLGetBotCallbackAnswer { Peer = peer, MessageId = messageId, Data = data }; if (game != null && game.Value) { obj.SetGame(); } const string caption = "messages.getBotCallbackAnswer"; SendInformativeMessage(caption, obj, result => { SetCachedValue(ref _cache, key, result as ICachedObject, IsCacheTimeValid); callback.SafeInvoke(result); }, faultCallback); } private Dictionary>> _cache; private static bool IsCacheTimeValid(DateTime cachedDate, ICachedObject cachedObject) { if (cachedObject != null && cachedDate.AddSeconds(cachedObject.CacheTime.Value) > DateTime.Now) { return true; } return false; } private static void SetCachedValue(ref Dictionary>> dict, string key, T result, Func predicate) where T : class { var now = DateTime.Now; if (!predicate(now, result)) return; dict = dict ?? new Dictionary>>(); dict[key] = new Tuple>(now, new WeakReference(result)); } private static bool TryGetCachedValue(Dictionary>> dict, string key, out T1 cachedValue, Func predicate) where T : class where T1 : class { Tuple> tuple; cachedValue = null; T target; if (dict != null && dict.TryGetValue(key, out tuple) && tuple.Item2.TryGetTarget(out target) && predicate(tuple.Item1, target)) { if (target is T1) { cachedValue = target as T1; return true; } } return false; } public void StartBotAsync(TLInputUserBase bot, TLString startParam, TLMessage25 message, Action callback, Action faultCallback = null) { var obj = new TLStartBot { Bot = bot, Peer = PeerToInputPeer(message.ToId), RandomId = message.RandomId, StartParam = startParam }; const string caption = "messages.startBot"; StartBotAsyncInternal(obj, result => { Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); message.Media.LastProgress = 0.0; message.Media.DownloadingProgress = 0.0; }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, new List { message }); } callback.SafeInvoke(result); }, () => { //TLUtils.WriteLine(caption + " fast result " + message.RandomIndex, LogSeverity.Error); //fastCallback(); }, faultCallback.SafeInvoke); } public void UploadMediaAsync(TLInputPeerBase inputPeer, TLInputMediaBase inputMedia, Action callback, Action faultCallback = null) { var obj = new TLUploadMedia { Peer = inputPeer, Media = inputMedia }; const string caption = "messages.uploadMedia"; SendInformativeMessage(caption, obj, callback, faultCallback); } public void SendMultiMediaAsync(TLInputPeerBase inputPeer, TLVector inputMedia, TLMessage25 message, Action callback, Action faultCallback = null) { var obj = new TLSendMultiMedia { Flags = new TLInt(0), Peer = inputPeer, ReplyToMsgId = message.ReplyToMsgId, MultiMedia = inputMedia }; var message48 = message as TLMessage48; if (message48 != null && message48.Silent) { obj.SetSilent(); } const string caption = "messages.sendMultiMedia"; SendMultiMediaAsyncInternal(obj, result => { Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); message.Media.LastProgress = 0.0; message.Media.DownloadingProgress = 1.0; var mediaGroup = message.Media as TLMessageMediaGroup; if (mediaGroup != null) { foreach (var m in mediaGroup.Group.OfType()) { m.Status = GetMessageStatus(_cacheService, message.ToId); m.Media.LastProgress = 0.0; m.Media.DownloadingProgress = 1.0; } } }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { var handled = false; var message73 = message as TLMessage73; if (message73 != null) { var mediaGroup = message73.Media as TLMessageMediaGroup; if (mediaGroup != null) { var messages = new List(); foreach (var item in mediaGroup.Group) { messages.Add((TLMessage25)item); } if (messages.Count > 0) { handled = true; ProcessUpdates(result, messages); message.Id = messages[messages.Count - 1].Id; message.Date = messages[messages.Count - 1].Date; message.RandomId = new TLLong(0); } } } if (!handled) { ProcessUpdates(result, new List { message }); } } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void SendMediaAsync(TLInputPeerBase inputPeer, TLInputMediaBase inputMedia, TLMessage34 message, Action callback, Action faultCallback = null) { var obj = new TLSendMedia { Flags = new TLInt(0), Peer = inputPeer, ReplyToMsgId = message.ReplyToMsgId, Media = inputMedia, Message = message.Message, RandomId = message.RandomId, ReplyMarkup = null, Entities = message.Entities }; if (message.IsChannelMessage) { obj.SetChannelMessage(); } var message48 = message as TLMessage48; if (message48 != null && message48.Silent) { obj.SetSilent(); } const string caption = "messages.sendMedia"; SendMediaAsyncInternal(obj, result => { Execute.BeginOnUIThread(() => { message.Status = GetMessageStatus(_cacheService, message.ToId); message.Media.LastProgress = 0.0; message.Media.DownloadingProgress = 1.0; }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, new List { message }); } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void SendBroadcastAsync(TLVector contacts, TLInputMediaBase inputMedia, TLMessage25 message, Action callback, Action fastCallback, Action faultCallback = null) { var randomId = new TLVector(); for (var i = 0; i < contacts.Count; i++) { randomId.Add(TLLong.Random()); } var obj = new TLSendBroadcast { Contacts = contacts, RandomId = randomId, Message = message.Message, Media = inputMedia }; const string caption = "messages.sendBroadcast"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, new List { message }); } var updates = result as TLUpdates; if (updates != null) { var updateNewMessage = updates.Updates.FirstOrDefault(x => x is TLUpdateNewMessage) as TLUpdateNewMessage; if (updateNewMessage != null) { var messageCommon = updateNewMessage.Message as TLMessageCommon; if (messageCommon != null) { message.Date = new TLInt(messageCommon.DateIndex - 1); // Делаем бродкаст после всех чатов, в которые отправили, в списке диалогов } } } //message.Id = result.Id; message.Status = MessageStatus.Confirmed; callback.SafeInvoke(result); }, faultCallback); } public void SendEncryptedAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, Action callback, Action fastCallback, Action faultCallback = null) { var obj = new TLSendEncrypted { Peer = peer, RandomId = randomId, Data = data }; SendEncryptedAsyncInternal( obj, result => { callback(result); }, () => { }, faultCallback); } private object _sendEncryptedFileSyncRoot; public void SendEncryptedMultiMediaAsync(TLInputEncryptedChat peer, TLVector randomId, TLVector data, TLVector file, Action> callback, Action fastCallback, Action faultCallback = null) { var obj = new TLVector(); for (var i = 0; i < randomId.Count; i++) { obj.Add(new TLSendEncryptedFile { Peer = peer, RandomId = randomId[i], Data = data[i], File = file[i] }); } _sendEncryptedFileSyncRoot = _sendEncryptedFileSyncRoot ?? new object(); var results = new TLVector(); SendEncryptedFileAsyncInternal( obj, result => { lock (_sendEncryptedFileSyncRoot) { results.Add(result); } if (results.Count == randomId.Count) { callback.SafeInvoke(results); } }, () => { }, faultCallback); } public void SendEncryptedFileAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, TLInputEncryptedFileBase file, Action callback, Action fastCallback, Action faultCallback = null) { var obj = new TLSendEncryptedFile { Peer = peer, RandomId = randomId, Data = data, File = file }; SendEncryptedFileAsyncInternal( obj, callback, () => { }, faultCallback); } public void SendEncryptedServiceAsync(TLInputEncryptedChat peer, TLLong randomId, TLString data, Action callback, Action faultCallback = null) { var obj = new TLSendEncryptedService { Peer = peer, RandomId = randomId, Data = data }; SendEncryptedServiceAsyncInternal( obj, callback, () => { }, faultCallback); } public void ReadEncryptedHistoryAsync(TLInputEncryptedChat peer, TLInt maxDate, Action callback, Action faultCallback = null) { var obj = new TLReadEncryptedHistory { Peer = peer, MaxDate = maxDate }; ReadEncryptedHistoryAsyncInternal(obj, callback, () => { }, faultCallback); } public void SetEncryptedTypingAsync(TLInputEncryptedChat peer, TLBool typing, Action callback, Action faultCallback = null) { var obj = new TLSetEncryptedTyping { Peer = peer, Typing = typing }; SendInformativeMessage("messages.setEncryptedTyping", obj, callback, faultCallback); } public void SetTypingAsync(TLInputPeerBase peer, TLBool typing, Action callback, Action faultCallback = null) { var action = typing.Value ? (TLSendMessageActionBase)new TLSendMessageTypingAction() : new TLSendMessageCancelAction(); var obj = new TLSetTyping { Peer = peer, Action = action }; SendInformativeMessage("messages.setTyping", obj, callback, faultCallback); } public void SetTypingAsync(TLInputPeerBase peer, TLSendMessageActionBase action, Action callback, Action faultCallback = null) { var obj = new TLSetTyping { Peer = peer, Action = action ?? new TLSendMessageTypingAction() }; SendInformativeMessage("messages.setTyping", obj, callback, faultCallback); } public void GetMessagesAsync(TLVector id, Action callback, Action faultCallback = null) { var obj = new TLGetMessages { Id = id }; SendInformativeMessage("messages.getMessages", obj, callback, faultCallback); } private static void ProcessPinnedId(IList result) { var pinnedIndex = 0; foreach (var dialog in result) { var dialog53 = dialog as TLDialog53; if (dialog53 != null && dialog53.IsPinned) { dialog53.PinnedId = new TLInt(pinnedIndex++); } } } private static void ProcessUnread(TLDialogsBase result) { var dialogsCache = new Dictionary>(); foreach (var dialogBase in result.Dialogs) { List dialogs; if (dialogsCache.TryGetValue(dialogBase.TopMessageId.Value, out dialogs)) { dialogs.Add(dialogBase); } else { dialogsCache[dialogBase.TopMessageId.Value] = new List { dialogBase }; } } foreach (var messageBase in result.Messages) { ProcessSelfMessage(messageBase); var messageCommon = messageBase as TLMessageCommon; if (messageCommon != null) { List dialogs; if (dialogsCache.TryGetValue(messageBase.Index, out dialogs)) { TLDialog53 dialog53 = null; if (messageCommon.ToId is TLPeerChannel) { dialog53 = dialogs.FirstOrDefault( x => x.Peer is TLPeerChannel && x.Peer.Id.Value == messageCommon.ToId.Id.Value) as TLDialog53; } else if (messageCommon.ToId is TLPeerChat) { dialog53 = dialogs.FirstOrDefault( x => x.Peer is TLPeerChat && x.Peer.Id.Value == messageCommon.ToId.Id.Value) as TLDialog53; } else if (messageCommon.ToId is TLPeerUser) { var peer = messageCommon.Out.Value ? messageCommon.ToId : new TLPeerUser { Id = messageCommon.FromId }; dialog53 = dialogs.FirstOrDefault(x => x.Peer is TLPeerUser && x.Peer.Id.Value == peer.Id.Value) as TLDialog53; } if (dialog53 != null) { if (messageCommon.Out.Value) { if (messageCommon.Index > dialog53.ReadOutboxMaxId.Value) { messageCommon.SetUnreadSilent(TLBool.True); } } else { if (messageCommon.Index > dialog53.ReadInboxMaxId.Value) { messageCommon.SetUnreadSilent(TLBool.True); } } } } } } } public void GetPeerDialogsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLGetPeerDialogs { Peers = new TLVector { peer } }; SendInformativeMessage("messages.getPeerDialogs", obj, result => { ProcessUnread(result.ToDialogs()); _cacheService.SyncDialogs(Stopwatch.StartNew(), result.ToDialogs(), r => { callback.SafeInvoke(r.ToPeerDialogs(result.State)); }); }, faultCallback); } public void GetPromoDialogAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLGetPeerDialogs { Peers = new TLVector { peer } }; SendInformativeMessage("messages.getPeerDialogs", obj, result => { var oldDialogs = _cacheService.GetDialogs(); var oldPromoDialogs = new List(); foreach (var dialogBase in oldDialogs) { var dialog = dialogBase as TLDialog71; if (dialog != null && dialog.IsPromo) { oldPromoDialogs.Add(dialog); } } ProcessUnread(result.ToDialogs()); foreach (var dialogBase in oldPromoDialogs) { _cacheService.UpdateDialogPromo(dialogBase, false); } foreach (var dialogBase in result.Dialogs) { var channel = _cacheService.GetChat(dialogBase.Peer.Id) as TLChannel; if (channel != null && channel.Left.Value) { _cacheService.UpdateDialogPromo(dialogBase, true); } } _cacheService.SyncDialogs(Stopwatch.StartNew(), result.ToDialogs(), r => { callback.SafeInvoke(r.ToPeerDialogs(result.State)); }); }, faultCallback); } public void GetPinnedDialogsAsync(Action callback, Action faultCallback = null) { var obj = new TLGetPinnedDialogs(); const string caption = "messages.getPinnedDialogs"; SendInformativeMessage(caption, obj, result => { var oldDialogs = _cacheService.GetDialogs(); var oldPinnedDialogs = new List(); foreach (var dialogBase in oldDialogs) { var dialog = dialogBase as TLDialog53; if (dialog != null && dialog.IsPinned && result.Dialogs.FirstOrDefault(x => x.Index == dialog.Index) == null) { oldPinnedDialogs.Add(dialog); } } ProcessPinnedId(result.Dialogs); ProcessUnread(result.ToDialogs()); foreach (var dialogBase in oldPinnedDialogs) { _cacheService.UpdateDialogPinned(dialogBase.Peer, false); } _cacheService.SyncDialogs(Stopwatch.StartNew(), result.ToDialogs(), r => { callback.SafeInvoke(r.ToPeerDialogs(result.State)); }); }, faultCallback); } public void GetDialogsAsync(Stopwatch stopwatch, TLInt offsetDate, TLInt offsetId, TLInputPeerBase offsetPeer, TLInt limit, TLInt hash, Action callback, Action faultCallback = null) { var obj = new TLGetDialogs { Flags = new TLInt(0), /*FeedId = null,*/ OffsetDate = offsetDate, OffsetId = offsetId, OffsetPeer = offsetPeer, Limit = limit, Hash = hash }; if (offsetDate.Value != 0 || offsetId.Value != 0 || !(offsetPeer is TLInputPeerEmpty)) { obj.ExcludePinned = true; } SendInformativeMessage("messages.getDialogs", obj, result => { if (offsetDate.Value == 0 && !obj.ExcludePinned) { ProcessPinnedId(result.Dialogs); } ProcessUnread(result); _cacheService.SyncDialogs(stopwatch, result, callback); }, faultCallback); } public void GetChannelDialogsAsync(TLInt offset, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TL.Functions.Channels.TLGetDialogs { Offset = offset, Limit = limit }; SendInformativeMessage("channels.getDialogs", obj, result => { //return; var channelsCache = new Context(); foreach (var chatBase in result.Chats) { var channel = chatBase as TLChannel; if (channel != null) { channelsCache[channel.Index] = channel; } } var dialogsCache = new Context(); foreach (var dialogBase in result.Dialogs) { var dialogChannel = dialogBase as TLDialogChannel; if (dialogChannel != null) { var channelId = dialogChannel.Peer.Id.Value; dialogsCache[channelId] = dialogChannel; TLChannel channel; if (channelsCache.TryGetValue(channelId, out channel)) { channel.ReadInboxMaxId = dialogChannel.ReadInboxMaxId; //channel.UnreadCount = dialogChannel.UnreadCount; //channel.UnreadImportantCount = dialogChannel.UnreadImportantCount; channel.NotifySettings = dialogChannel.NotifySettings; //channel.Pts = dialogChannel.Pts; } } } //_cacheService.SyncChannelDialogs(result, callback); _cacheService.SyncUsersAndChats(result.Users, result.Chats, x => { _cacheService.MergeMessagesAndChannels(result); callback.SafeInvoke(result); }); }, faultCallback); } private void GetChannelHistoryAsyncInternal(bool sync, TLPeerBase peer, TLMessagesBase result, Action callback) { if (sync) { _cacheService.SyncPeerMessages(peer, result, false, false, callback); } else { _cacheService.AddChats(result.Chats, results => { }); _cacheService.AddUsers(result.Users, results => { }); callback(result); } } private void GetHistoryAsyncInternal(bool sync, TLPeerBase peer, TLMessagesBase result, Action callback) { if (sync) { _cacheService.SyncPeerMessages(peer, result, false, true, callback); } else { _cacheService.AddChats(result.Chats, results => { }); _cacheService.AddUsers(result.Users, results => { }); callback(result); } } public void GetHistoryAsync(Stopwatch timer, TLInputPeerBase inputPeer, TLPeerBase peer, bool sync, TLInt offsetDate, TLInt offset, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetHistory { Peer = inputPeer, AddOffset = offset, OffsetId = maxId, OffsetDate = offsetDate, Limit = limit, MaxId = new TLInt(int.MaxValue), MinId = new TLInt(0), Hash = new TLInt(0) }; //Telegram.Api.Helpers.Execute.ShowDebugMessage(string.Format("messages.getHistory offset_date=[{0} {1}], offset={2} max_id={3} limit={4}", offsetDate, TLUtils.ToDateTime(offsetDate).ToString("dd-MM-yyyy HH:mm:ss.f"), offset, maxId, limit)); //Debug.WriteLine("UpdateItems start request elapsed=" + (timer != null? timer.Elapsed.ToString() : null)); SendInformativeMessage("messages.getHistory", obj, result => { var peerChannel = inputPeer as TLInputPeerChannel; if (peerChannel != null) { var channel = result.Chats.FirstOrDefault(x => x.Index == peerChannel.ChatId.Value) as TLChannel; if (channel != null && channel.Left.Value) { sync = false; } } //Debug.WriteLine("UpdateItems stop request elapsed=" + (timer != null ? timer.Elapsed.ToString() : null)); foreach (var message in result.Messages) { ProcessSelfMessage(message); } var replyId = new TLVector(); var waitingList = new List(); //for (var i = 0; i < result.Messages.Count; i++) //{ // var message25 = result.Messages[i] as TLMessage25; // if (message25 != null // && message25.ReplyToMsgId != null // && message25.ReplyToMsgId.Value > 0) // { // var cachedReply = _cacheService.GetMessage(message25.ReplyToMsgId); // if (cachedReply != null) // { // message25.Reply = cachedReply; // } // else // { // replyId.Add(message25.ReplyToMsgId); // waitingList.Add(message25); // } // } //} if (replyId.Count > 0) { //Debug.WriteLine("UpdateItems start GetMessages elapsed=" + (timer != null ? timer.Elapsed.ToString() : null)); GetMessagesAsync( replyId, messagesResult => { //Debug.WriteLine("UpdateItems stop GetMessages elapsed=" + (timer != null ? timer.Elapsed.ToString() : null)); _cacheService.AddChats(result.Chats, results => { }); _cacheService.AddUsers(result.Users, results => { }); for (var i = 0; i < messagesResult.Messages.Count; i++) { for (var j = 0; j < waitingList.Count; j++) { var messageToReply = messagesResult.Messages[i] as TLMessageCommon; if (messageToReply != null && messageToReply.Index == waitingList[j].Index) { waitingList[j].Reply = messageToReply; } } } var inputChannelPeer = inputPeer as TLInputPeerChannel; if (inputChannelPeer != null) { var channel = _cacheService.GetChat(inputChannelPeer.ChatId) as TLChannel; if (channel != null) { var maxIndex = channel.ReadInboxMaxId != null ? channel.ReadInboxMaxId.Value : 0; foreach (var messageBase in messagesResult.Messages) { var messageCommon = messageBase as TLMessageCommon; if (messageCommon != null && !messageCommon.Out.Value && messageCommon.Index > maxIndex) { messageCommon.SetUnread(TLBool.True); } } } } //Debug.WriteLine("UpdateItems stop GetMessages GetHistoryAsyncInternal elapsed=" + (timer != null ? timer.Elapsed.ToString() : null)); GetHistoryAsyncInternal(sync, peer, result, callback); }, faultCallback); } else { //Debug.WriteLine("UpdateItems GetHistoryAsyncInternal elapsed=" + (timer != null ? timer.Elapsed.ToString() : null)); GetHistoryAsyncInternal(sync, peer, result, callback); } }, faultCallback); } public void GetChannelHistoryAsync(string debugInfo, TLInputPeerBase inputPeer, TLPeerBase peer, bool sync, TLInt offset, TLInt maxId, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetHistory { Peer = inputPeer, AddOffset = offset, OffsetId = maxId, OffsetDate = new TLInt(0), Limit = limit, MaxId = new TLInt(int.MaxValue), MinId = new TLInt(0), Hash = new TLInt(0) }; TLUtils.WriteLine(string.Format("{0} {1} messages.getHistory peer={2} offset={3} max_id={4} limit={5}", string.Empty, debugInfo, inputPeer, offset, maxId, limit), LogSeverity.Error); SendInformativeMessage("messages.getHistory", obj, result => { var peerChannel = inputPeer as TLInputPeerChannel; if (peerChannel != null) { var channel = result.Chats.FirstOrDefault(x => x.Index == peerChannel.ChatId.Value) as TLChannel; if (channel != null && channel.Left.Value) { sync = false; } } var replyId = new TLVector(); var waitingList = new List(); //for (var i = 0; i < result.Messages.Count; i++) //{ // var message25 = result.Messages[i] as TLMessage25; // if (message25 != null // && message25.ReplyToMsgId != null // && message25.ReplyToMsgId.Value > 0) // { // var cachedReply = _cacheService.GetMessage(message25.ReplyToMsgId); // if (cachedReply != null) // { // message25.Reply = cachedReply; // } // else // { // replyId.Add(message25.ReplyToMsgId); // waitingList.Add(message25); // } // } //} if (replyId.Count > 0) { GetMessagesAsync( replyId, messagesResult => { _cacheService.AddChats(result.Chats, results => { }); _cacheService.AddUsers(result.Users, results => { }); for (var i = 0; i < messagesResult.Messages.Count; i++) { for (var j = 0; j < waitingList.Count; j++) { var messageToReply = messagesResult.Messages[i] as TLMessageCommon; if (messageToReply != null && messageToReply.Index == waitingList[j].Index) { waitingList[j].Reply = messageToReply; } } } var inputChannelPeer = inputPeer as TLInputPeerChannel; if (inputChannelPeer != null) { var channel = _cacheService.GetChat(inputChannelPeer.ChatId) as TLChannel; if (channel != null) { var maxIndex = channel.ReadInboxMaxId != null ? channel.ReadInboxMaxId.Value : 0; foreach (var messageBase in messagesResult.Messages) { var messageCommon = messageBase as TLMessageCommon; if (messageCommon != null && !messageCommon.Out.Value && messageCommon.Index > maxIndex) { messageCommon.SetUnread(TLBool.True); } } } } GetChannelHistoryAsyncInternal(sync, peer, result, callback); }, faultCallback); } else { GetChannelHistoryAsyncInternal(sync, peer, result, callback); } }, faultCallback); } public void SearchAsync(TLInputPeerBase peer, TLString query, TLInputUserBase fromId, TLInputMessagesFilterBase filter, TLInt minDate, TLInt maxDate, TLInt addOffset, TLInt offsetId, TLInt limit, TLInt hash, Action callback, Action faultCallback = null) { Debug.WriteLine("messages.search query={0} from_id={7} filter={1} minDate={2} maxDate={3} offset={4} maxId={5} limit={6}", query, filter, maxDate, maxDate, addOffset, offsetId, limit, fromId); var obj = new TLSearch { Flags = new TLInt(0), Peer = peer, Query = query, FromId = fromId, Filter = filter, MinDate = minDate, MaxDate = maxDate, AddOffset = addOffset, OffsetId = offsetId, Limit = limit, MinId = new TLInt(0), MaxId = new TLInt(0), Hash = hash }; SendInformativeMessage("messages.search", obj, result => { callback.SafeInvoke(result); }, faultCallback); } public void SearchGlobalAsync(TLString query, TLInt offsetDate, TLInputPeerBase offsetPeer, TLInt offsetId, TLInt limit, Action callback, Action faultCallback = null) { TLUtils.WriteLine(string.Format("{0} messages.searchGlobal query={1} offset_date={2} offset_peer={3} offset_id={4} limit={5}", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), query, offsetDate, offsetPeer, offsetId, limit), LogSeverity.Error); var obj = new TLSearchGlobal { Query = query, OffsetDate = offsetDate, OffsetPeer = offsetPeer, OffsetId = offsetId, Limit = limit }; SendInformativeMessage("messages.searchGlobal", obj, result => { TLUtils.WriteLine(string.Format("{0} messages.searchGlobal result={1}", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), result.Messages.Count), LogSeverity.Error); callback.SafeInvoke(result); }, faultCallback); } public void ReadHistoryAsync(TLInputPeerBase peer, TLInt maxId, TLInt offset, Action callback, Action faultCallback = null) { var obj = new TLReadHistory { Peer = peer, MaxId = maxId }; const string caption = "messages.readHistory"; ReadHistoryAsyncInternal(obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.SetState(null, result.Pts, null, null, null, caption); } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void ReadMentionsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLReadMentions { Peer = peer }; const string caption = "messages.readMentions"; ReadMentionsAsyncInternal(obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.SetState(null, result.Pts, null, null, null, caption); } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void ReadMessageContentsAsync(TLVector id, Action callback, Action faultCallback = null) { var obj = new TLReadMessageContents { Id = id }; const string caption = "messages.readMessageContents"; ReadMessageContentsAsyncInternal(obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.SetState(null, result.Pts, null, null, null, caption); } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void DeleteHistoryAsync(bool justClear, TLInputPeerBase peer, TLInt offset, Action callback, Action faultCallback = null) { var obj = new TLDeleteHistory { Flags = new TLInt(0), Peer = peer, MaxId = new TLInt(int.MaxValue) }; if (justClear) { obj.SetJustClear(); } const string caption = "messages.deleteHistory"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.SetState(result.Seq, result.Pts, null, null, null, caption); } callback(result); }, faultCallback); } public void DeleteMessagesAsync(bool revoke, TLVector id, Action callback, Action faultCallback = null) { var obj = new TLDeleteMessages { Id = id, Revoke = revoke }; const string caption = "messages.deleteMessages"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { _updatesService.SetState(null, result.Pts, null, null, null, caption); } callback(result); }, faultCallback); } public void RestoreMessagesAsync(TLVector id, Action> callback, Action faultCallback = null) { var obj = new TLRestoreMessages { Id = id }; SendInformativeMessage("messages.restoreMessages", obj, callback, faultCallback); } public void ReceivedMessagesAsync(TLInt maxId, Action> callback, Action faultCallback = null) { var obj = new TLReceivedMessages { MaxId = maxId }; SendInformativeMessage("messages.receivedMessages", obj, callback, faultCallback); } public void ForwardMessageAsync(TLInputPeerBase peer, TLInt fwdMessageId, TLMessage25 message, Action callback, Action faultCallback = null) { var obj = new TLForwardMessage { Peer = peer, Id = fwdMessageId, RandomId = message.RandomId }; const string caption = "messages.forwardMessage"; ForwardMessageAsyncInternal(obj, result => { Execute.BeginOnUIThread(() => { message.Status = MessageStatus.Confirmed; message.Media.LastProgress = 0.0; message.Media.DownloadingProgress = 0.0; }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, new List { message }); } callback.SafeInvoke(result); }, () => { }, faultCallback); } private readonly object _forwardMessagesWithCommentSyncRoot = new object(); public void ForwardMessagesAsync(TLMessage25 commentMessage, TLInputPeerBase toPeer, TLVector id, IList messages, bool withMyScore, Action callback, Action faultCallback = null) { var randomId = new TLVector(); foreach (var message in messages) { randomId.Add(message.RandomId); } TLInputPeerBase fromPeer = null; var message48 = messages.FirstOrDefault() as TLMessage48; if (message48 != null) { fromPeer = message48.FwdFromChannelPeer; } if (fromPeer == null) { var message40 = messages.FirstOrDefault() as TLMessage40; if (message40 != null) { fromPeer = message40.FwdFromChannelPeer ?? PeerToInputPeer(message40.FwdFromPeer); } } var obj1 = commentMessage != null && !TLString.IsNullOrEmpty(commentMessage.Message) ? new TLSendMessage { Flags = new TLInt(0), Peer = toPeer, Message = commentMessage.Message, RandomId = commentMessage.RandomId } : null; var obj2 = new TLForwardMessages { ToPeer = toPeer, Id = id, RandomIds = randomId, FromPeer = fromPeer, Flags = new TLInt(0) }; if (message48 != null && message48.IsChannelMessage) { obj2.SetChannelMessage(); } if (message48 != null && message48.Silent) { obj2.SetSilent(); } if (withMyScore) { obj2.SetWithMyScore(); } var grouped = messages.OfType().FirstOrDefault(x => x.GroupedId != null) != null; if (grouped) { obj2.SetGrouped(); } const string caption1 = "messages.sendMessage"; const string caption2 = "messages.forwardMessages"; var results = new TLUpdatesBase[2]; ForwardMessagesWithCommentAsyncInternal(obj1, obj2, result => { bool invokeCallback; var multiPts = result as IMultiPts; var shortSentMessage = result as TLUpdatesShortSentMessage; if (shortSentMessage != null) { commentMessage.Flags = shortSentMessage.Flags; if (shortSentMessage.HasMedia) { commentMessage._media = shortSentMessage.Media; } if (shortSentMessage.HasEntities) { var commentMessage70 = commentMessage as TLMessage70; if (commentMessage70 != null) { commentMessage70.Entities = shortSentMessage.Entities; } } Execute.BeginOnUIThread(() => { commentMessage.Status = GetMessageStatus(_cacheService, commentMessage.ToId); commentMessage.Date = shortSentMessage.Date; if (shortSentMessage.Media is TLMessageMediaWebPage) { commentMessage.NotifyOfPropertyChange(() => commentMessage.Media); } #if DEBUG commentMessage.Id = shortSentMessage.Id; commentMessage.NotifyOfPropertyChange(() => commentMessage.Id); commentMessage.NotifyOfPropertyChange(() => commentMessage.Date); #endif }); _updatesService.SetState(multiPts, caption1); commentMessage.Id = shortSentMessage.Id; _cacheService.SyncSendingMessage(commentMessage, null, cachedMessage => { lock (_forwardMessagesWithCommentSyncRoot) { results[0] = result; invokeCallback = obj1 == null || (results[0] != null && results[1] != null); } if (invokeCallback) { callback.SafeInvoke(results); } }); return; } Execute.BeginOnUIThread(() => { commentMessage.Status = GetMessageStatus(_cacheService, commentMessage.ToId); }); if (multiPts != null) { _updatesService.SetState(multiPts, caption1); } else { ProcessUpdates(result, new List { commentMessage }); } lock (_forwardMessagesWithCommentSyncRoot) { results[0] = result; invokeCallback = obj1 == null || (results[0] != null && results[1] != null); } if (invokeCallback) { callback.SafeInvoke(results); } }, result => { Execute.BeginOnUIThread(() => { for (var i = 0; i < messages.Count; i++) { messages[i].Status = MessageStatus.Confirmed; messages[i].Media.LastProgress = 0.0; messages[i].Media.DownloadingProgress = 0.0; } }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption2); } else { ProcessUpdates(result, messages); } bool invokeCallback; lock (_forwardMessagesWithCommentSyncRoot) { results[1] = result; invokeCallback = obj1 == null || (results[0] != null && results[1] != null); } if (invokeCallback) { callback.SafeInvoke(results); } }, () => { }, faultCallback.SafeInvoke); } public void ForwardMessagesAsync(TLInputPeerBase toPeer, TLVector id, IList messages, bool withMyScore, Action callback, Action faultCallback = null) { var randomId = new TLVector(); foreach (var message in messages) { randomId.Add(message.RandomId); } TLInputPeerBase fromPeer = null; var message48 = messages.FirstOrDefault() as TLMessage48; if (message48 != null) { fromPeer = message48.FwdFromChannelPeer; } if (fromPeer == null) { var message40 = messages.FirstOrDefault() as TLMessage40; if (message40 != null) { fromPeer = message40.FwdFromChannelPeer ?? PeerToInputPeer(message40.FwdFromPeer); } } var obj = new TLForwardMessages { ToPeer = toPeer, Id = id, RandomIds = randomId, FromPeer = fromPeer, Flags = new TLInt(0) }; if (message48 != null && message48.IsChannelMessage) { obj.SetChannelMessage(); } if (message48 != null && message48.Silent) { obj.SetSilent(); } if (withMyScore) { obj.SetWithMyScore(); } const string caption = "messages.forwardMessages"; //Execute.ShowDebugMessage(string.Format(caption + " to_peer={0} from_peer={1} id={2} flags={3}", toPeer, fromPeer, string.Join(",", id), TLForwardMessages.ForwardMessagesFlagsString(obj.Flags))); //Execute.ShowDebugMessage(caption + string.Format("id={0} random_id={1} from_peer={2} to_peer={3}", obj.Id.FirstOrDefault(), obj.RandomIds.FirstOrDefault(), obj.FromPeer, obj.ToPeer)); ForwardMessagesAsyncInternal(obj, result => { Execute.BeginOnUIThread(() => { for (var i = 0; i < messages.Count; i++) { messages[i].Status = MessageStatus.Confirmed; messages[i].Media.LastProgress = 0.0; messages[i].Media.DownloadingProgress = 0.0; } }); var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, messages); } callback.SafeInvoke(result); }, () => { }, faultCallback.SafeInvoke); } public void GetChatsAsync(TLVector id, Action callback, Action faultCallback = null) { var obj = new TLGetChats { Id = id }; SendInformativeMessage("messages.getChats", obj, callback, faultCallback); } public void GetFullChatAsync(TLInt chatId, Action callback, Action faultCallback = null) { var obj = new TLGetFullChat { ChatId = chatId }; SendInformativeMessage( "messages.getFullChat", obj, messagesChatFull => { _cacheService.SyncChat(messagesChatFull, result => callback.SafeInvoke(messagesChatFull)); }, faultCallback); } public void EditChatTitleAsync(TLInt chatId, TLString title, Action callback, Action faultCallback = null) { var obj = new TLEditChatTitle { ChatId = chatId, Title = title }; const string caption = "messages.editChatTitle"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void EditChatPhotoAsync(TLInt chatId, TLInputChatPhotoBase photo, Action callback, Action faultCallback = null) { var obj = new TLEditChatPhoto { ChatId = chatId, Photo = photo }; const string caption = "messages.editChatPhoto"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null, true); } callback.SafeInvoke(result); }, faultCallback); } public void AddChatUserAsync(TLInt chatId, TLInputUserBase userId, TLInt fwdLimit, Action callback, Action faultCallback = null) { var obj = new TLAddChatUser { ChatId = chatId, UserId = userId, FwdLimit = fwdLimit }; const string caption = "messages.addChatUser"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void DeleteChatUserAsync(TLInt chatId, TLInputUserBase userId, Action callback, Action faultCallback = null) { var obj = new TLDeleteChatUser { ChatId = chatId, UserId = userId }; const string caption = "messages.deleteChatUser"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void CreateChatAsync(TLVector users, TLString title, Action callback, Action faultCallback = null) { var obj = new TLCreateChat { Users = users, Title = title }; const string caption = "messages.createChat"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void ExportChatInviteAsync(TLInt chatId, Action callback, Action faultCallback = null) { var obj = new TLExportChatInvite { ChatId = chatId }; SendInformativeMessage("messages.exportChatInvite", obj, callback, faultCallback); } public void CheckChatInviteAsync(TLString hash, Action callback, Action faultCallback = null) { var obj = new TLCheckChatInvite { Hash = hash }; SendInformativeMessage("messages.checkChatInvite", obj, result => { var chatInvite = result as TLChatInvite54; if (chatInvite != null) { _cacheService.SyncUsers(chatInvite.Participants, participants => { chatInvite.Participants = participants; callback.SafeInvoke(result); }); } else { callback.SafeInvoke(result); } } , faultCallback); } public void ImportChatInviteAsync(TLString hash, Action callback, Action faultCallback = null) { var obj = new TLImportChatInvite { Hash = hash }; const string caption = "messages.importChatInvite"; SendInformativeMessage(caption, obj, result => { var updates = result as TLUpdates; if (updates != null) { _cacheService.SyncUsersAndChats(updates.Users, updates.Chats, tuple => { }); } var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void SendActionsAsync(List actions, Action callback, Action faultCallback = null) { var container = new TLContainer { Messages = new List() }; var historyItems = new List(); for (var i = 0; i < actions.Count; i++) { var obj = actions[i]; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } var data = i > 0 ? new TLInvokeAfterMsg { MsgId = container.Messages[i - 1].MessageId, Object = obj } : obj; var invokeWithoutUpdates = new TLInvokeWithoutUpdates { Object = data }; var transportMessage = new TLContainerTransportMessage { MessageId = messageId, SeqNo = new TLInt(sequenceNumber), MessageData = invokeWithoutUpdates }; var historyItem = new HistoryItem { SendTime = DateTime.Now, Caption = "messages.containerPart" + i, Object = obj, Message = transportMessage, Callback = result => callback(obj, result), AttemptFailed = null, FaultCallback = faultCallback, ClientTicksDelta = ClientTicksDelta, Status = RequestStatus.Sent, }; historyItems.Add(historyItem); container.Messages.Add(transportMessage); } lock (_historyRoot) { foreach (var historyItem in historyItems) { _history[historyItem.Hash] = historyItem; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif SendNonInformativeMessage("messages.container", container, result => callback(null, result), faultCallback); } public void ToggleChatAdminsAsync(TLInt chatId, TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLToggleChatAdmins { ChatId = chatId, Enabled = enabled }; const string caption = "messages.toggleChatAdmins"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void EditChatAdminAsync(TLInt chatId, TLInputUserBase userId, TLBool isAdmin, Action callback, Action faultCallback = null) { var obj = new TLEditChatAdmin { ChatId = chatId, UserId = userId, IsAdmin = isAdmin }; SendInformativeMessage("messages.editChatAdmin", obj, callback, faultCallback); } public void DeactivateChatAsync(TLInt chatId, TLBool enabled, Action callback, Action faultCallback = null) { var obj = new TLDeactivateChat { ChatId = chatId, Enabled = enabled }; const string caption = "messages.deactivateChat"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public void HideReportSpamAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLHideReportSpam { Peer = peer }; const string caption = "messages.hideReportSpam"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetPeerSettingsAsync(TLInputPeerBase peer, Action callback, Action faultCallback = null) { var obj = new TLGetPeerSettings { Peer = peer }; const string caption = "messages.getPeerSettings"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void MigrateChatAsync(TLInt chatId, Action callback, Action faultCallback = null) { var obj = new TLMigrateChat { ChatId = chatId }; const string caption = "messages.migrateChat"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); } public int SendingMessages { get { var result = 0; lock (_historyRoot) { foreach (var historyItem in _history.Values) { if (historyItem.Caption.StartsWith("messages.containerPart")) { result++; break; } } } return result; } } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Payments.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Payments; namespace Telegram.Api.Services { public partial class MTProtoService { public void GetPaymentFormAsync(TLInt msgId, Action callback, Action faultCallback = null) { var obj = new TLGetPaymentForm { MsgId = msgId }; const string caption = "payments.getPaymentForm"; SendInformativeMessage(caption, obj, result => _cacheService.SyncUsers(result.Users, users => { result.Users = users; callback.SafeInvoke(result); }), faultCallback); } public void SendPaymentFormAsync(TLInt msgId, TLString requestedInfoId, TLString shippingOptionId, TLInputPaymentCredentialsBase credentials, Action callback, Action faultCallback = null) { var obj = new TLSendPaymentForm { Flags = new TLInt(0), MsgId = msgId, RequestedInfoId = requestedInfoId, ShippingOptionId = shippingOptionId, Credentials = credentials }; const string caption = "payments.savePaymentForm"; SendInformativeMessage(caption, obj, result => { var paymentResult = result as TLPaymentResult; if (paymentResult != null) { var multiPts = paymentResult.Updates as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(paymentResult.Updates, null, true); } } callback.SafeInvoke(result); }, faultCallback); } public void ValidateRequestedInfoAsync(bool save, TLInt msgId, TLPaymentRequestedInfo info, Action callback, Action faultCallback = null) { var obj = new TLValidateRequestedInfo { Flags = new TLInt(0), Save = save, MsgId = msgId, Info = info }; const string caption = "payments.validateRequestedInfo"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetSavedInfoAsync(Action callback, Action faultCallback = null) { var obj = new TLGetSavedInfo(); const string caption = "payments.getSavedInfo"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void ClearSavedInfoAsync(bool credentials, bool info, Action callback, Action faultCallback = null) { var obj = new TLClearSavedInfo{ Flags = new TLInt(0), Credentials = credentials, Info = info }; const string caption = "payments.clearSavedInfo"; SendInformativeMessage(caption, obj, callback.SafeInvoke, faultCallback); } public void GetPaymentReceiptAsync(TLInt msgId, Action callback, Action faultCallback = null) { var obj = new TLGetPaymentReceipt{ MsgId = msgId }; const string caption = "payments.getGetReceipt"; SendInformativeMessage(caption, obj, result => _cacheService.SyncUsers(result.Users, users => { result.Users = users; callback.SafeInvoke(result); }), faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Phone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Phone; namespace Telegram.Api.Services { public partial class MTProtoService { public void GetCallConfigAsync(Action callback, Action faultCallback = null) { var obj = new TLGetCallConfig(); SendInformativeMessage("phone.requestCall", obj, callback, faultCallback); } public void RequestCallAsync(TLInputUserBase userId, TLInt randomId, TLString gaHash, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null) { var obj = new TLRequestCall { UserId = userId, RandomId = randomId, GAHash = gaHash, Protocol = protocol }; SendInformativeMessage("phone.requestCall", obj, callback, faultCallback); } public void AcceptCallAsync(TLInputPhoneCall peer, TLString gb, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null) { var obj = new TLAcceptCall { Peer = peer, GB = gb, Protocol = protocol }; SendInformativeMessage("phone.acceptCall", obj, callback, faultCallback); } public void ConfirmCallAsync(TLInputPhoneCall peer, TLString ga, TLLong keyFingerprint, TLPhoneCallProtocol protocol, Action callback, Action faultCallback = null) { var obj = new TLConfirmCall { Peer = peer, GA = ga, KeyFingerprint = keyFingerprint, Protocol = protocol }; SendInformativeMessage("phone.confirmCall", obj, callback, faultCallback); } public void ReceivedCallAsync(TLInputPhoneCall peer, Action callback, Action faultCallback = null) { var obj = new TLReceivedCall { Peer = peer }; SendInformativeMessage("phone.receivedCall", obj, callback, faultCallback); } public void DiscardCallAsync(TLInputPhoneCall peer, TLInt duration, TLPhoneCallDiscardReasonBase reason, TLLong connectionId, Action callback, Action faultCallback = null) { var obj = new TLDiscardCall { Peer = peer, Duration = duration, Reason = reason, ConnectionId = connectionId }; const string caption = "phone.discardCall"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null, true); } callback.SafeInvoke(result); }, faultCallback); } public void SetCallRatingAsync(TLInputPhoneCall peer, TLInt rating, TLString comment, Action callback, Action faultCallback = null) { var obj = new TLSetCallRating { Peer = peer, Rating = rating, Comment = comment }; const string caption = "phone.setCallRating"; SendInformativeMessage(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null, true); } callback.SafeInvoke(result); }, faultCallback); } public void SaveCallDebugAsync(TLInputPhoneCall peer, TLDataJSON debug, Action callback, Action faultCallback = null) { var obj = new TLSaveCallDebug { Peer = peer, Debug = debug }; SendInformativeMessage("phone.saveCallDebug", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Photos.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Photos; namespace Telegram.Api.Services { public partial class MTProtoService { public void UploadProfilePhotoAsync(TLInputFile file, Action callback, Action faultCallback = null) { var obj = new TLUploadProfilePhoto { File = file }; SendInformativeMessage("photos.uploadProfilePhoto", obj, callback, faultCallback); } public void UpdateProfilePhotoAsync(TLInputPhotoBase id, Action callback, Action faultCallback = null) { var obj = new TLUpdateProfilePhoto{ Id = id }; SendInformativeMessage("photos.updateProfilePhoto", obj, callback, faultCallback); } public void GetUserPhotosAsync(TLInputUserBase userId, TLInt offset, TLLong maxId, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetUserPhotos { UserId = userId, Offset = offset, MaxId = maxId, Limit = limit }; SendInformativeMessage("photos.getUserPhotos", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.SecretChats.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.Services { public partial class MTProtoService { public void RekeyAsync(TLEncryptedChatBase chat, Action callback) { //GetGA() } public void GetDHConfigAsync(TLInt version, TLInt randomLength, Action callback, Action faultCallback = null) { var obj = new TLGetDHConfig { Version = version, RandomLength = randomLength }; SendInformativeMessage("messages.getDhConfig", obj, callback, faultCallback); } public void RequestEncryptionAsync(TLInputUserBase userId, TLInt randomId, TLString ga, Action callback, Action faultCallback = null) { var obj = new TLRequestEncryption { UserId = userId, RandomId = randomId, G_A = ga }; SendInformativeMessage("messages.requestEncryption", obj, encryptedChat => { _cacheService.SyncEncryptedChat(encryptedChat, callback.SafeInvoke); }, faultCallback); } public void AcceptEncryptionAsync(TLInputEncryptedChat peer, TLString gb, TLLong keyFingerprint, Action callback, Action faultCallback = null) { var obj = new TLAcceptEncryption { Peer = peer, GB = gb, KeyFingerprint = keyFingerprint }; SendInformativeMessage("messages.acceptEncryption", obj, encryptedChat => { _cacheService.SyncEncryptedChat(encryptedChat, callback.SafeInvoke); }, faultCallback); } public void DiscardEncryptionAsync(TLInt chatId, Action callback, Action faultCallback = null) { var obj = new TLDiscardEncryption { ChatId = chatId }; SendInformativeMessage("messages.discardEncryption", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.SendingQueue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using Telegram.Api.Extensions; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.Messages; using Action = System.Action; namespace Telegram.Api.Services { public partial class MTProtoService { private readonly object _sendingQueueSyncRoot = new object(); private readonly List _sendingQueue = new List(); private static Timer _sendingTimer; private static void StartSendingTimer() { //Helpers.Execute.ShowDebugMessage("MTProtoService.StartSendingTimer"); _sendingTimer.Change(TimeSpan.FromSeconds(Constants.ResendMessageInterval), TimeSpan.FromSeconds(Constants.ResendMessageInterval)); } private static void StopSendingTimer() { //Helpers.Execute.ShowDebugMessage("MTProtoService.StoptSendingTimer"); _sendingTimer.Change(Timeout.Infinite, Timeout.Infinite); } private static void CheckSendingMessages(object state) { #if DEBUG if (Debugger.IsAttached) return; #endif var service = (MTProtoService)state; service.ProcessQueue(); } private void ReadEncryptedHistoryAsyncInternal(TLReadEncryptedHistory message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.readEncryptedHistory", int.MaxValue, message, callback, fastCallback, faultCallback); } private void ReadChannelHistoryAsyncInternal(TLReadChannelHistory message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("channels.readHistory", int.MaxValue, message, callback, fastCallback, faultCallback); } private void ReadMessageContentsAsyncInternal(TL.Functions.Channels.TLReadMessageContents message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("channels.readMessageContents", int.MaxValue, message, callback, fastCallback, faultCallback); } private void ReadHistoryAsyncInternal(TLReadHistory message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.readHistory", int.MaxValue, message, callback, fastCallback, faultCallback); } private void ReadMentionsAsyncInternal(TLReadMentions message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.readMentions", int.MaxValue, message, callback, fastCallback, faultCallback); } private void ReadMessageContentsAsyncInternal(TL.Functions.Messages.TLReadMessageContents message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.readMessageContents", int.MaxValue, message, callback, fastCallback, faultCallback); } private void SendEncryptedAsyncInternal(TLSendEncrypted message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendEncrypted", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendEncryptedFileAsyncInternal(TLSendEncryptedFile message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendEncryptedFile", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendEncryptedFileAsyncInternal(TLVector messages, Action callback, Action fastCallback, Action faultCallback) { for (var i = 0; i < messages.Count - 1; i++) { AddAsyncInternal("messages.sendEncryptedFile", Constants.MessageSendingInterval, messages[i], callback, fastCallback, faultCallback, 10); } SendAsyncInternal("messages.sendEncryptedFile", Constants.MessageSendingInterval, messages[messages.Count - 1], callback, fastCallback, faultCallback, 10); } private void SendEncryptedServiceAsyncInternal(TLSendEncryptedService message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendEncryptedService", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendMessageAsyncInternal(TLSendMessage message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendMessage", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendInlineBotResultAsyncInternal(TLSendInlineBotResult message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendInlineBotResult", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendMediaAsyncInternal(TLSendMedia message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendMedia", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void SendMultiMediaAsyncInternal(TLSendMultiMedia message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.sendMultiMedia", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void StartBotAsyncInternal(TLStartBot message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.startBot", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void ForwardMessageAsyncInternal(TLForwardMessage message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.forwardMessage", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void ForwardMessagesAsyncInternal(TLForwardMessages message, Action callback, Action fastCallback, Action faultCallback) { SendAsyncInternal("messages.forwardMessages", Constants.MessageSendingInterval, message, callback, fastCallback, faultCallback); } private void ForwardMessagesWithCommentAsyncInternal(TLSendMessage message1, TLForwardMessages message2, Action callback1, Action callback2, Action fastCallback, Action faultCallback) { if (message1 != null) AddAsyncInternal("messages.sendMessages", Constants.MessageSendingInterval, message1, callback1, fastCallback, faultCallback, 10); SendAsyncInternal("messages.forwardMessages", Constants.MessageSendingInterval, message2, callback2, fastCallback, faultCallback, 10); } private HistoryItem AddAsyncInternal(string caption, double timeout, TLObject obj, Action callback, Action fastCallback, Action faultCallback, int timeoutToResend = 0) where T : TLObject { int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2 + 1; _activeTransport.SequenceNumber++; messageId = _activeTransport.GenerateMessageId(true); } Debug.WriteLine("AddAsyncInternal msg_id={0} caption={1}", messageId, caption); var transportMessage = new TLContainerTransportMessage { MessageId = messageId, SeqNo = new TLInt(sequenceNumber), MessageData = obj }; var now = DateTime.Now; var sendBeforeTime = now.AddSeconds(timeout); var sendingItem = new HistoryItem { SendTime = DateTime.MinValue, TimeToResend = timeoutToResend, SendBeforeTime = sendBeforeTime, Caption = caption, Object = obj, Message = transportMessage, Callback = result => callback((T)result), FastCallback = fastCallback, FaultCallback = null, // чтобы не вылететь по таймауту не сохраняем сюда faultCallback, а просто запоминаем последнюю ошибку, FaultQueueCallback = faultCallback, // для MTProto.CleanupQueue InvokeAfter = null, // устанвливаем в момент создания контейнера historyItems.LastOrDefault(), Status = RequestStatus.ReadyToSend, }; //обрабатываем ошибки sendingItem.FaultCallback = error => ProcessFault(sendingItem, error); AddActionInfoToFile(TLUtils.DateToUniversalTimeTLInt(ClientTicksDelta, sendBeforeTime), obj); lock (_sendingQueueSyncRoot) { _sendingQueue.Add(sendingItem); } return sendingItem; } private void SendAsyncInternal(string caption, double timeout, TLObject obj, Action callback, Action fastCallback, Action faultCallback, int timeoutToResend = 0) where T : TLObject { var sendingItem = AddAsyncInternal(caption, timeout, obj, callback, fastCallback, faultCallback, timeoutToResend); lock (_sendingQueueSyncRoot) { StartSendingTimer(); } ProcessQueue(); } private void ProcessFault(HistoryItem item, TLRPCError error) { item.LastError = error; if (error != null && (error.CodeEquals(ErrorCode.BAD_REQUEST) || error.CodeEquals(ErrorCode.FLOOD) || error.CodeEquals(ErrorCode.UNAUTHORIZED) || error.CodeEquals(ErrorCode.INTERNAL))) { RemoveFromQueue(item); item.FaultQueueCallback.SafeInvoke(error); } } private void ProcessQueue() { CleanupQueue(); SendQueue(); } private void SendQueue() { List itemsSnapshort; lock (_sendingQueueSyncRoot) { var now = DateTime.Now; itemsSnapshort = _sendingQueue.Where(x => x.SendTime.AddSeconds(x.TimeToResend) < now).ToList(); } if (itemsSnapshort.Count == 0) return; var historyItems = new List(); for (var i = 0; i < itemsSnapshort.Count; i++) { itemsSnapshort[i].SendTime = DateTime.Now; itemsSnapshort[i].InvokeAfter = historyItems.LastOrDefault(); historyItems.Add(itemsSnapshort[i]); } #if DEBUG NotifyOfPropertyChange(() => History); #endif lock (_historyRoot) { for (var i = 0; i < historyItems.Count; i++) { _history[historyItems[i].Hash] = historyItems[i]; } } var container = CreateContainer(historyItems); Debug.WriteLine("send container msg_count=" + container.Messages.Count); SendNonInformativeMessage( "container.sendMessages", container, result => { // переотправка сейчас по таймеру раз в 5 сек // этот метод никогда не вызывается, т.к. не используется в SendNonInformativeMessage для container.sendMessages //lock (_queueSyncRoot) //{ // // fast aknowledgments // _sendingQueue.Remove(item); //} //item.FastCallback.SafeInvoke(); }, error => { // переотправка сейчас по таймеру раз в 5 сек //FaultSending(error, item); }); } private void CleanupQueue() { var itemsToRemove = new List(); lock (_sendingQueueSyncRoot) { var now = DateTime.Now; for (var i = 0; i < _sendingQueue.Count; i++) { var historyItem = _sendingQueue[i]; if (historyItem.SendBeforeTime > now) continue; itemsToRemove.Add(historyItem); _sendingQueue.RemoveAt(i--); } if (_sendingQueue.Count == 0) { StopSendingTimer(); } } lock (_historyRoot) { for (var i = 0; i < itemsToRemove.Count; i++) { _history.Remove(itemsToRemove[i].Hash); } } var actions = new TLVector(); for (var i = 0; i < itemsToRemove.Count; i++) { actions.Add(itemsToRemove[i].Object); } RemoveActionInfoFromFile(actions); Helpers.Execute.BeginOnThreadPool(() => { foreach (var item in itemsToRemove) { item.FaultQueueCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.CleanupQueue") }); } }); } public void ClearQueue() { var itemsToRemove = new List(); lock (_sendingQueueSyncRoot) { var now = DateTime.Now; for (var i = 0; i < _sendingQueue.Count; i++) { var historyItem = _sendingQueue[i]; itemsToRemove.Add(historyItem); _sendingQueue.RemoveAt(i--); } if (_sendingQueue.Count == 0) { StopSendingTimer(); } } lock (_historyRoot) { for (var i = 0; i < itemsToRemove.Count; i++) { _history.Remove(itemsToRemove[i].Hash); } } var actions = new TLVector(); for (var i = 0; i < itemsToRemove.Count; i++) { actions.Add(itemsToRemove[i].Object); } ClearActionInfoFile(); Helpers.Execute.BeginOnThreadPool(() => { foreach (var item in itemsToRemove) { item.FaultQueueCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.CleanupQueue") }); } }); } private void RemoveFromQueue(HistoryItem item) { if (item == null) { Helpers.Execute.ShowDebugMessage("MTProtoService.RemoveFromQueue item=null"); return; } lock (_sendingQueueSyncRoot) { _sendingQueue.Remove(item); } RemoveActionInfoFromFile(item.Object); } public void RemoveFromQueue(TLLong id) { HistoryItem item = null; lock (_sendingQueueSyncRoot) { foreach (var historyItem in _sendingQueue) { var randomId = historyItem.Object as IRandomId; if (randomId != null && randomId.RandomId.Value == id.Value) { item = historyItem; break; } } if (item != null) { _sendingQueue.Remove(item); } } RemoveActionInfoFromFile(id); } private readonly object _actionsSyncRoot = new object(); private readonly object _actionInfoSyncRoot = new object(); private TLVector _actionInfo; public TLVector GetActionInfoFromFile() { if (_actionInfo != null) { return _actionInfo; } _actionInfo = TLUtils.OpenObjectFromMTProtoFile>(_actionsSyncRoot, Constants.ActionQueueFileName) ?? new TLVector(); return _actionInfo; } private void SaveActionInfoToFile(TLVector data) { TLUtils.SaveObjectToMTProtoFile(_actionsSyncRoot, Constants.ActionQueueFileName, data); } private void AddActionInfoToFile(TLInt sendBefore, TLObject obj) { if (!TLUtils.IsValidAction(obj)) { return; } lock (_actionInfoSyncRoot) { var actions = GetActionInfoFromFile(); var actionInfo = new TLActionInfo { Action = obj, SendBefore = sendBefore }; actions.Add(actionInfo); SaveActionInfoToFile(actions); } } private void RemoveActionInfoFromFile(TLVector objects) { lock (_actionInfoSyncRoot) { var actions = GetActionInfoFromFile(); foreach (var obj in objects) { RemoveActionInfoCommon(actions, obj); } SaveActionInfoToFile(actions); } } public static void RemoveActionInfoCommon(TLVector actions, TLObject obj) { for (var i = 0; i < actions.Count; i++) { if (actions[i].Action.GetType() == obj.GetType()) { if (actions[i].Action == obj) { actions.RemoveAt(i--); continue; } var randomId1 = actions[i].Action as IRandomId; var randomId2 = obj as IRandomId; if (randomId1 != null && randomId2 != null && randomId1.RandomId.Value == randomId2.RandomId.Value) { actions.RemoveAt(i--); continue; } } } } private void RemoveActionInfoFromFile(TLLong id) { lock (_actionInfoSyncRoot) { var actions = GetActionInfoFromFile(); for (var i = 0; i < actions.Count; i++) { var randomId = actions[i].Action as IRandomId; if (randomId != null && randomId.RandomId.Value == id.Value) { actions.RemoveAt(i--); } } SaveActionInfoToFile(actions); } } private void RemoveActionInfoFromFile(TLObject obj) { lock (_actionInfoSyncRoot) { var actions = GetActionInfoFromFile(); RemoveActionInfoCommon(actions, obj); SaveActionInfoToFile(actions); } } public void RemoveActionInfoFromFile(IEnumerable obj) { lock (_actionInfoSyncRoot) { var actions = GetActionInfoFromFile(); foreach (var o in obj) { RemoveActionInfoCommon(actions, o); } SaveActionInfoToFile(actions); } } public void ClearActionInfoFile() { lock (_actionInfoSyncRoot) { var actions = new TLVector(); SaveActionInfoToFile(actions); } } private static TLContainer CreateContainer(IList items) { var messages = new List(); for (var i = 0; i < items.Count; i++) { var item = items[i]; var transportMessage = (TLContainerTransportMessage)item.Message; if (item.InvokeAfter != null) { transportMessage.MessageData = new TLInvokeAfterMsg { MsgId = item.InvokeAfter.Message.MessageId, Object = item.Object }; } item.Status = RequestStatus.Sent; messages.Add(transportMessage); } var container = new TLContainer { Messages = new List(messages) }; return container; } public void GetSyncErrorsAsync(Action> callback) { Helpers.Execute.BeginOnThreadPool(() => callback.SafeInvoke(_cacheService.LastSyncMessageException, _updatesService.SyncDifferenceExceptions)); } public void GetSendingQueueInfoAsync(Action callback) { Helpers.Execute.BeginOnThreadPool(() => { var info = new StringBuilder(); lock (_sendingQueueSyncRoot) { var count = 0; foreach (var item in _sendingQueue) { var sendBeforeTimeString = item.SendBeforeTime.HasValue ? item.SendBeforeTime.Value.ToString("H:mm:ss.fff") : null; var message = string.Empty; try { var transportMessage = item.Message as TLContainerTransportMessage; if (transportMessage != null) { var sendMessage = transportMessage.MessageData as TLSendMessage; if (sendMessage != null) { message = string.Format("{0} {1}", sendMessage.Message, sendMessage.RandomId); } else { var invokeAfterMsg = transportMessage.MessageData as TLInvokeAfterMsg; if (invokeAfterMsg != null) { sendMessage = invokeAfterMsg.Object as TLSendMessage; if (sendMessage != null) { message = string.Format("{0} {1}", sendMessage.Message, sendMessage.RandomId); } } } } } catch (Exception ex) { } info.AppendLine(string.Format("{0} send={1} before={2} msg=[{3}] error=[{4}]", count++, item.SendTime.ToString("H:mm:ss.fff"), sendBeforeTimeString, message, item.LastError)); } } callback.SafeInvoke(info.ToString()); }); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Stuff.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Stuff; namespace Telegram.Api.Services { public partial class MTProtoService { private object _debugRoot = new object(); public void MessageAcknowledgments(TLVector ids) { PrintCaption("msgs_ack"); TLUtils.WriteLine("ids"); foreach (var id in ids) { TLUtils.WriteLine(TLUtils.MessageIdString(id)); } var obj = new TLMessageAcknowledgments { MsgIds = ids }; var authKey = _activeTransport.AuthKey; var sesseionId = _activeTransport.SessionId; var salt = _activeTransport.Salt; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2; messageId = _activeTransport.GenerateMessageId(true); } var transportMessage = CreateTLTransportMessage(salt, sesseionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } lock (_debugRoot) { //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2, -4} SessionId {3}\nids:", "msgs_ack", transportMessage.MessageId.Value, transportMessage.SeqNo.Value, transportMessage.SessionId.Value); foreach (var id in ids) { //Debug.WriteLine(id.Value); } } var captionString = string.Format("msgs_ack {0}", transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { //Debug.WriteLine("@msgs_ack {0} result {1}", transportMessage.MessageId, result); }, error => { //Debug.WriteLine("< callback, Action faultCallback = null) { var obj = new TLPing { PingId = pingId }; SendNonInformativeMessage("ping", obj, result => { callback.SafeInvoke(result); }, faultCallback.SafeInvoke); } public void PingDelayDisconnectAsync(TLLong pingId, TLInt disconnectDelay, Action callback, Action faultCallback = null) { var obj = new TLPingDelayDisconnect { PingId = pingId, DisconnectDelay = disconnectDelay }; SendNonInformativeMessage("ping_delay_disconnect", obj, result => { callback.SafeInvoke(result); }, faultCallback.SafeInvoke); } public void HttpWaitAsync(TLInt maxDelay, TLInt waitAfter, TLInt maxWait, Action callback, Action faultCallback) { PrintCaption("http_wait"); var obj = new TLHttpWait { MaxDelay = maxDelay, WaitAfter = waitAfter, MaxWait = maxWait }; var authKey = _activeTransport.AuthKey; var salt = _activeTransport.Salt; var sessionId = _activeTransport.SessionId; int sequenceNumber; TLLong messageId; lock (_activeTransportRoot) { sequenceNumber = _activeTransport.SequenceNumber * 2; messageId = _activeTransport.GenerateMessageId(true); } var transportMessage = CreateTLTransportMessage(salt, sessionId, new TLInt(sequenceNumber), messageId, obj); var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } SendPacketAsync(_activeTransport, "http_wait " + transportMessage.MessageId, encryptedMessage, result => { //try //{ // ReceiveBytesAsync(result, authKey); //} //catch (Exception e) //{ // TLUtils.WriteException(e); //} //finally //{ // callback(); //} }, error => faultCallback.SafeInvoke()); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Updates.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Help; using Telegram.Api.TL.Functions.Updates; namespace Telegram.Api.Services { public partial class MTProtoService { public void GetStateAsync(Action callback, Action faultCallback = null) { var obj = new TLGetState(); SendInformativeMessage("updates.getState", obj, callback, faultCallback); } public void GetStateWithoutUpdatesAsync(Action callback, Action faultCallback = null) { var obj = new TLInvokeWithoutUpdates {Object = new TLGetState()}; SendInformativeMessage("updates.getState", obj, callback, faultCallback); } public void GetDifferenceAsync(TLInt pts, TLInt date, TLInt qts, Action callback, Action faultCallback = null) { var obj = new TLGetDifference { Flags = new TLInt(0), Pts = pts, Date = date, Qts = qts }; SendInformativeMessage("updates.getDifference", obj, callback, faultCallback); } public void GetDifferenceWithoutUpdatesAsync(TLInt pts, TLInt date, TLInt qts, Action callback, Action faultCallback = null) { var obj = new TLGetDifference { Flags = new TLInt(0), Pts = pts, Date = date, Qts = qts }; SendInformativeMessage("updates.getDifference", new TLInvokeWithoutUpdates{Object = obj}, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Upload.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Upload; namespace Telegram.Api.Services { public partial class MTProtoService { public void SaveFilePartAsync(TLLong fileId, TLInt filePart, TLString bytes, Action callback, Action faultCallback = null) { var filePartValue = filePart.Value; var bytesLength = bytes.Data.Length; var obj = new TLSaveFilePart{ FileId = fileId, FilePart = filePart, Bytes = bytes }; SendInformativeMessage("upload.saveFilePart" + " " + filePart.Value, obj, callback, faultCallback); } public void SaveBigFilePartAsync(TLLong fileId, TLInt filePart, TLInt fileTotalParts, TLString bytes, Action callback, Action faultCallback = null) { var obj = new TLSaveBigFilePart { FileId = fileId, FilePart = filePart, FileTotalParts = fileTotalParts, Bytes = bytes }; Debug.WriteLine(string.Format("upload.saveBigFilePart file_id={0} file_part={1} file_total_parts={2} bytes={3}", fileId, filePart, fileTotalParts, bytes.Data.Length)); SendInformativeMessage("upload.saveBigFilePart " + filePart + " " + fileTotalParts, obj, callback, faultCallback); } public void GetFileAsync(TLInputFileLocationBase location, TLInt offset, TLInt limit, Action callback, Action faultCallback = null) { var obj = new TLGetFile { Location = location, Offset = offset, Limit = limit }; SendInformativeMessage("upload.getFile", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.Users.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Extensions; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Users; namespace Telegram.Api.Services { public partial class MTProtoService { public void GetUsersAsync(TLVector id, Action> callback, Action faultCallback = null) { var obj = new TLGetUsers { Id = id }; SendInformativeMessage>("users.getUsers", obj, result => { _cacheService.SyncUsers(result, callback); }, faultCallback); } public void GetFullUserAsync(TLInputUserBase id, Action callback, Action faultCallback = null) { var obj = new TLGetFullUser { Id = id }; SendInformativeMessage("users.getFullUser", obj, userFull => _cacheService.SyncUser(userFull, callback.SafeInvoke), faultCallback); } public void SetSecureValueErrorsAsync(TLInputUserBase id, TLVector errors, Action callback, Action faultCallback = null) { var obj = new TLSetSecureValueErrors { Id = id, Errors = errors }; SendInformativeMessage("users.setSecureValueErrors", obj, callback, faultCallback); } } } ================================================ FILE: Telegram.Api/Services/MTProtoService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define MTPROTO //#define DEBUG_UPDATEDCOPTIONS using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reactive.Linq; using System.Text; using System.Threading; using Org.BouncyCastle.Bcpg; using Telegram.Api.Services.DeviceInfo; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.Messages; #if WIN_RT using Windows.UI.Xaml; #elif WINDOWS_PHONE using System.Windows.Threading; using Microsoft.Devices; #endif using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Connection; using Telegram.Api.Services.Updates; using Telegram.Api.TL; using Telegram.Api.TL.Functions.Auth; using Telegram.Api.TL.Functions.Upload; using Telegram.Api.Transport; using Telegram.Logs; using Environment = System.Environment; namespace Telegram.Api.Services { public class CountryEventArgs : EventArgs { public string Country { get; set; } } public partial class MTProtoService : ServiceBase, IMTProtoService, IDisposable { public event EventHandler ProxyDisabled; protected void RaiseProxyDisabled() { var handler = ProxyDisabled; if (handler != null) { handler(this, EventArgs.Empty); } } public event EventHandler GotUserCountry; protected void RaiseGotUserCountry(string country) { var handler = GotUserCountry; if (handler != null) { handler(this, new CountryEventArgs { Country = country }); } } public void SetInitState() { _updatesService.SetInitState(); } public ITransport GetActiveTransport() { return _activeTransport; } public WindowsPhone.Tuple GetCurrentPacketInfo() { return _activeTransport != null ? _activeTransport.GetCurrentPacketInfo() : null; } public string GetTransportInfo() { return _activeTransport != null ? _activeTransport.GetTransportInfo() : null; } public string Country { get { return _config != null ? _config.Country : null; } } private TLInt _currentUserId; public TLInt CurrentUserId { get { return _currentUserId; } set { _currentUserId = value; } } public long ClientTicksDelta { get { return _activeTransport.ClientTicksDelta; } } //private bool _isInitialized; /// /// Получен ли ключ авторизации /// //public bool IsInitialized //{ // get { return _isInitialized; } // protected set // { // if (_isInitialized != value) // { // _isInitialized = value; // NotifyOfPropertyChange(() => IsInitialized); // } // } //} public event EventHandler Initialized; protected virtual void RaiseInitialized() { var handler = Initialized; if (handler != null) handler(this, EventArgs.Empty); } public event EventHandler InitializationFailed; protected virtual void RaiseInitializationFailed() { var handler = InitializationFailed; if (handler != null) handler(this, EventArgs.Empty); } private readonly object _fileTransportRoot = new object(); private readonly object _activeTransportRoot = new object(); private ITransport _activeTransport; private readonly ITransportService _transportService; private readonly ICacheService _cacheService; private readonly IUpdatesService _updatesService; private readonly IConnectionService _connectionService; private readonly IDeviceInfoService _deviceInfo; private readonly Dictionary _history = new Dictionary(); #if DEBUG private readonly Dictionary _removedHistory = new Dictionary(); #endif public IList History { get { return _history.Values.ToList(); } } private TransportType _type = TransportType.Tcp; public TransportType Type { get { return _type; } set { _type = value; } } private readonly object _delayedItemsRoot = new object(); private readonly List _delayedItems = new List(); private Timer _timeoutsTimer; private Timer _deviceLockedTimer; private Timer _checkTransportTimer; public MTProtoService(IDeviceInfoService deviceInfo, IUpdatesService updatesService, ICacheService cacheService, ITransportService transportService, IConnectionService connectionService, IPublicConfigService publicConfigService) { var isBackground = deviceInfo != null && deviceInfo.IsBackground; _deviceInfo = deviceInfo; _sendingTimer = new Timer(CheckSendingMessages, this, Timeout.Infinite, Timeout.Infinite); _getConfigTimer = new Timer(CheckGetConfig, this, TimeSpan.FromSeconds(10.0), TimeSpan.FromSeconds(Constants.CheckGetConfigInterval)); _timeoutsTimer = new Timer(CheckTimeouts, this, TimeSpan.FromSeconds(10.0), TimeSpan.FromSeconds(10.0)); _deviceLockedTimer = new Timer(CheckDeviceLockedInternal, this, TimeSpan.FromSeconds(60.0), TimeSpan.FromSeconds(60.0)); _publicConfigService = publicConfigService; _connectionService = connectionService; _connectionService.Initialize(this); _connectionService.ConnectionLost += OnConnectionLost; var sendStatusEvents = Observable.FromEventPattern, SendStatusEventArgs>( keh => { SendStatus += keh; }, keh => { SendStatus -= keh; }); _statusSubscription = sendStatusEvents .Throttle(TimeSpan.FromSeconds(Constants.UpdateStatusInterval)) .Subscribe(e => UpdateStatusAsync(e.EventArgs.Offline, result => { })); _updatesService = updatesService; _updatesService.DCOptionsUpdated += OnDCOptionsUpdated; _cacheService = cacheService; if (_updatesService != null) { _updatesService.GetDifferenceAsync = GetDifferenceAsync; _updatesService.GetStateAsync = GetStateAsync; _updatesService.GetCurrentUserId = GetCurrentUserId; _updatesService.GetDHConfigAsync = GetDHConfigAsync; _updatesService.AcceptEncryptionAsync = AcceptEncryptionAsync; _updatesService.SendEncryptedServiceAsync = SendEncryptedServiceAsync; _updatesService.SetMessageOnTimeAsync = SetMessageOnTime; _updatesService.RemoveFromQueue = RemoveFromQueue; _updatesService.UpdateChannelAsync = UpdateChannelAsync; _updatesService.GetFullChatAsync = GetFullChatAsync; _updatesService.GetFullUserAsync = GetFullUserAsync; _updatesService.GetChannelMessagesAsync = GetMessagesAsync; _updatesService.GetPinnedDialogsAsync = GetPinnedDialogsAsync; _updatesService.GetMessagesAsync = GetMessagesAsync; _updatesService.GetPeerDialogsAsync = GetPeerDialogsAsync; _updatesService.GetPromoDialogAsync = GetPromoDialogAsync; } _transportService = transportService; _transportService.ConnectionLost += OnConnectionLost; _transportService.FileConnectionLost += OnFileConnectionLost; _transportService.SpecialConnectionLost += OnSpecialConnectionLost; _transportService.CheckConfig += OnCheckConfig; _activeTransport = GetTransport(Constants.FirstServerIpAddress, Constants.FirstServerPort, Type, new TransportSettings { DcId = _activeTransport != null ? _activeTransport.DCId : Constants.FirstServerDCId, Secret = _activeTransport != null ? _activeTransport.Secret : null, AuthKey = _activeTransport != null ? _activeTransport.AuthKey : null, Salt = _activeTransport != null ? _activeTransport.Salt : null, SessionId = _activeTransport != null ? _activeTransport.SessionId : null, MessageIdDict = _activeTransport != null ? _activeTransport.MessageIdDict : new Dictionary(), SequenceNumber = _activeTransport != null ? _activeTransport.SequenceNumber : 0, ClientTicksDelta = _activeTransport != null ? _activeTransport.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceived }); #if DEBUG _checkTransportTimer = new Timer(CheckTransport, this, TimeSpan.FromSeconds(1.0), Timeout.InfiniteTimeSpan); #endif Initialized += OnServiceInitialized; InitializationFailed += OnServiceInitializationFailed; //IsInitialized = true; if (!isBackground) { //Initialize(); } Instance = this; } public event EventHandler TransportChecked; protected virtual void RaiseTransportChecked(TransportCheckedEventArgs e) { var handler = TransportChecked; if (handler != null) handler(this, e); } private void CheckTransport(object state) { //return; ITransport transport = null; lock (_activeTransportRoot) { transport = _activeTransport; } var transportId = transport.Id; var sessionId = transport.SessionId; var authKey = transport.AuthKey; var lastReceiveTime = transport.LastReceiveTime; int historyCount; string historyDescription; lock (_historyRoot) { historyCount = _history.Count; historyDescription = string.Join("\n", _history.Values.Select(x => x.Caption + " " + x.Hash)); } var currentPacketLength = transport.PacketLength; var lastPacketLength = transport.LastPacketLength; RaiseTransportChecked(new TransportCheckedEventArgs { TransportId = transportId, SessionId = sessionId, AuthKey = authKey, LastReceiveTime = lastReceiveTime, HistoryCount = historyCount, HistoryDescription = historyDescription, NextPacketLength = currentPacketLength, LastPacketLength = lastPacketLength }); _checkTransportTimer.Change(TimeSpan.FromSeconds(1.0), Timeout.InfiniteTimeSpan); } public static IMTProtoService Instance { get; protected set; } private void CheckTimeouts(object state) { #if DEBUG if (Debugger.IsAttached) { return; } #endif const double timeout = Constants.TimeoutInterval; const double delayedTimeout = Constants.DelayedTimeoutInterval; const double nonEncryptedTimeout = Constants.NonEncryptedTimeoutInterval; var timedOutKeys = new List(); var timedOutValues = new List(); var now = DateTime.Now; // history lock (_historyRoot) { foreach (var historyKeyValue in _history) { var historyValue = historyKeyValue.Value; if (historyValue.SendTime != default(DateTime) && historyValue.SendTime.AddSeconds(timeout) < now) { timedOutKeys.Add(historyKeyValue.Key); timedOutValues.Add(historyKeyValue.Value); } } foreach (var key in timedOutKeys) { _history.Remove(key); } } if (timedOutValues.Count > 0) { Execute.BeginOnThreadPool(() => { foreach (var item in timedOutValues) { try { item.FaultCallback.SafeInvoke( new TLRPCError { Code = new TLInt((int)ErrorCode.TIMEOUT), Message = new TLString("MTProtoService: operation timed out (" + timeout + "s)") }); #if DEBUG TLUtils.WriteLine(item.Caption + " time out", LogSeverity.Error); #endif } catch (Exception ex) { TLUtils.WriteException("Timeout exception", ex); } } }); } // delayed history var timedOutItems = new List(); lock (_delayedItemsRoot) { foreach (var item in _delayedItems) { if (item.SendTime != default(DateTime) && item.SendTime.AddSeconds(delayedTimeout) < now) { timedOutItems.Add(item); } } foreach (var item in timedOutItems) { _delayedItems.Remove(item); } } if (timedOutItems.Count > 0) { Execute.BeginOnThreadPool(() => { foreach (var item in timedOutItems) { try { item.FaultCallback.SafeInvoke( new TLRPCError { Code = new TLInt((int)ErrorCode.TIMEOUT), Message = new TLString("MTProtoService: operation timed out (" + delayedTimeout + "s)") }); #if DEBUG TLUtils.WriteLine(item.Caption + " time out", LogSeverity.Error); #endif } catch (Exception ex) { TLUtils.WriteException("Timeout exception", ex); } } }); } // generating key if (_activeTransport != null) { var requests = _activeTransport.RemoveTimeOutRequests(nonEncryptedTimeout); if (requests.Count > 0) { #if LOG_REGISTRATION TLUtils.WriteLog("MTProtoService.CheckTimeouts clear history and replace transport"); #endif ClearHistory("CheckTimeouts", false); Execute.BeginOnThreadPool(() => { foreach (var item in requests) { try { item.FaultCallback.SafeInvoke( new TLRPCError { Code = new TLInt((int)ErrorCode.TIMEOUT), Message = new TLString("MTProtoService: operation timed out (" + timeout + "s)") }); #if DEBUG TLUtils.WriteLine(item.Caption + " time out", LogSeverity.Error); #endif } catch (Exception ex) { TLUtils.WriteException("Timeout exception", ex); } } }); } } } private void OnConnectionLost(object sender, EventArgs e) { ResetConnection(null); } private void OnFileConnectionLost(object sender, EventArgs e) { ResetConnection(null); } private void OnSpecialConnectionLost(object sender, TransportEventArgs e) { var transport = e.Transport; if (transport != null) { var str = string.Format("Connection lost id={0} dc_id={1} ip={2} port={3}", transport.Id, transport.DCId, transport.Host, transport.Port); LogPublicConfig(str); Execute.ShowDebugMessage(str); } } public void GetConfigInformationAsync(Action callback) { Execute.BeginOnThreadPool(() => { var now = DateTime.Now; var currentTime = TLUtils.DateToUniversalTimeTLInt(ClientTicksDelta, now); var activeTransportString = _activeTransport != null ? _activeTransport.ToString() : null; var sb = new StringBuilder(); sb.AppendLine("current_time utc0:"); sb.AppendLine(string.Format("{0} {1}", currentTime, TLUtils.ToDateTime(currentTime).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine("config:"); sb.AppendLine(_config.ToString()); sb.AppendLine("active transport:"); sb.AppendLine(activeTransportString); sb.AppendLine("dc_options:"); foreach (var option in _config.DCOptions) { sb.AppendLine(option.ToString()); } callback(sb.ToString()); }); } public void GetTransportInformationAsync(Action callback) { Execute.BeginOnThreadPool(() => { var activeTransportString = _activeTransport != null ? _activeTransport.ToString() : null; var sb = new StringBuilder(); sb.AppendLine("active transport:"); sb.AppendLine(activeTransportString); sb.AppendLine("Date: " + TLUtils.ToDateTime(_config.Date)); callback(sb.ToString()); }); } public void UpdateTransportInfoAsync(TLDCOption78 dcOption, TLString ipAddress, TLInt port, Action callback) { var args = new DCOptionsUpdatedEventArgs { Update = new TLUpdateDCOptions { DCOptions = new TLVector { dcOption } } }; OnDCOptionsUpdated(this, args); ClearHistory("UpdateTransportInfoAsync", false); // continue listening on fault _activeTransport = GetTransport(ipAddress.ToString(), port.Value, Type, new TransportSettings { DcId = dcOption.Id.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = _activeTransport != null ? _activeTransport.AuthKey : null, Salt = _activeTransport != null ? _activeTransport.Salt : null, SessionId = _activeTransport != null ? _activeTransport.SessionId : null, MessageIdDict = _activeTransport != null ? _activeTransport.MessageIdDict : new Dictionary(), SequenceNumber = _activeTransport != null ? _activeTransport.SequenceNumber : 0, ClientTicksDelta = _activeTransport != null ? _activeTransport.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceived }); callback.SafeInvoke(true); } private void OnDCOptionsUpdated(object sender, DCOptionsUpdatedEventArgs e) { var newOptions = e.Update.DCOptions; var dcOptionsInfo = new StringBuilder(); dcOptionsInfo.AppendLine("TLUpdateDCOptions"); foreach (var option in newOptions) { dcOptionsInfo.AppendLine(string.Format("DCId={0} {1}:{2}", option.Id, option.IpAddress, option.Port)); } Execute.ShowDebugMessage(dcOptionsInfo.ToString()); if (_config != null && _config.DCOptions != null) { var activeDCId = _config.DCOptions[_config.ActiveDCOptionIndex].Id.Value; foreach (var newOption in newOptions) { var updated = false; // 1) update ip address, port, hostname foreach (var oldOption in _config.DCOptions) { if (newOption.Id.Value == oldOption.Id.Value && newOption.IPv6.Value == oldOption.IPv6.Value && newOption.Media.Value == oldOption.Media.Value && newOption.TCPO.Value == oldOption.TCPO.Value && newOption.Static.Value == oldOption.Static.Value) { // keep AuthKey, SessionId and Salt var oldOption78 = oldOption as TLDCOption78; var newOption78 = newOption as TLDCOption78; if (oldOption78 != null && newOption78 != null) { if (oldOption78.Secret != null && newOption78.Secret != null || oldOption78.Secret == null && newOption78.Secret == null) { oldOption.Hostname = newOption.Hostname; oldOption.IpAddress = newOption.IpAddress; oldOption.Port = newOption.Port; oldOption78.Secret = newOption78.Secret; updated = true; if (!newOption.Media.Value && activeDCId == newOption78.Id.Value) { _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(oldOption); } break; } } else { oldOption.Hostname = newOption.Hostname; oldOption.IpAddress = newOption.IpAddress; oldOption.Port = newOption.Port; updated = true; if (!newOption.Media.Value && activeDCId == newOption.Id.Value) { _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(oldOption); } break; } } } // 2) append new DCOption if (!updated) { // fix readonly array of dcOption var list = _config.DCOptions.ToList(); list.Add(newOption); _config.DCOptions.Items = list; if (!newOption.Media.Value && activeDCId == newOption.Id.Value) { _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(newOption); } } } SaveConfig(); } } private TLInt GetCurrentUserId() { return CurrentUserId; } private void OnPacketReceived(object sender, DataEventArgs e) { var transport = (ITransport)sender; #if DEBUG bool byActiveTransport; lock (_activeTransportRoot) { byActiveTransport = transport == _activeTransport; } if (byActiveTransport) { var transportId = transport.Id; var sessionId = transport.SessionId; var authKey = transport.AuthKey; int historyCount; string historyDescription; lock (_historyRoot) { historyCount = _history.Count; historyDescription = string.Join("\n", _history.Values.Select(x => x.Caption + " " + x.Hash)); } RaiseTransportChecked(new TransportCheckedEventArgs { HistoryCount = historyCount, HistoryDescription = historyDescription, TransportId = transportId, SessionId = sessionId, AuthKey = authKey, LastReceiveTime = e.LastReceiveTime, NextPacketLength = e.NextPacketLength, LastPacketLength = e.Data.Length }); } #endif var position = 0; var handled = false; if (transport.AuthKey == null) { try { var message = TLObject.GetObject(e.Data, ref position); var historyItem = transport.DequeueFirstNonEncryptedItem(); if (historyItem != null) { #if LOG_REGISTRATION TLUtils.WriteLog( string.Format("OnReceivedBytes by {0} AuthKey==null: invoke historyItem {1} with result {2} (data length={3})", transport.Id, historyItem.Caption, message.Data.GetType(), e.Data.Length)); #endif historyItem.Callback.SafeInvoke(message.Data); } else { #if LOG_REGISTRATION TLUtils.WriteLog( string.Format("OnReceivedBytes by {0} AuthKey==null: cannot find historyItem {1} with result {2} (data length={3})", transport.Id, string.Empty, message.Data.GetType(), e.Data.Length)); #endif } handled = true; } catch (Exception ex) { #if LOG_REGISTRATION TLUtils.WriteLog( string.Format("OnReceivedBytes by {0} AuthKey==null exception: cannot parse TLNonEncryptedMessage with History\n {1} \nand exception\n{2} (data length={3})", transport.Id, transport.PrintNonEncryptedHistory(), ex, e.Data.Length)); #endif } if (!handled) { #if LOG_REGISTRATION TLUtils.WriteLog( string.Format("OnReceivedBytes by {0} AuthKey==null !handled: invoke ReceiveBytesAsync with data length {1}", transport.Id, e.Data.Length)); #endif ReceiveBytesAsync(transport, e.Data); } } else { #if LOG_REGISTRATION TLUtils.WriteLog( string.Format("OnReceivedBytes by {0} AuthKey!=null: invoke ReceiveBytesAsync with data length {1}", transport.Id, e.Data.Length)); #endif ReceiveBytesAsync(transport, e.Data); } } private void OnServiceInitializationFailed(object sender, EventArgs e) { Execute.BeginOnThreadPool(TimeSpan.FromSeconds(1.0), () => { #if LOG_REGISTRATION TLUtils.WriteLog("Service initialization failed"); #endif CancelDelayedItemsAsync(); // если генерация ключа прошла успешно, но предыдущая попытка завершилась неудачно на методах help.getNearestDc, help.getConfig // обнуляем ключ, т.к. в противном случае resPQ будем пытаться расшифровать ключем lock (_activeTransportRoot) { _activeTransport.AuthKey = null; } Initialize(); }); } private void CancelDelayedItemsAsync(bool force = false) { Execute.BeginOnThreadPool(() => { #if LOG_REGISTRATION TLUtils.WriteLog("Cancel delayed items"); #endif lock (_delayedItemsRoot) { var canceledItems = new List(); foreach (var item in _delayedItems) { if (force || (item.MaxAttempt.HasValue && item.MaxAttempt <= item.CurrentAttempt)) { item.AttemptFailed.SafeInvoke(item.CurrentAttempt); canceledItems.Add(item); } item.CurrentAttempt++; } foreach (var canceledItem in canceledItems) { #if LOG_REGISTRATION TLUtils.WriteLog("Cancel delayed item\n " + canceledItem); #endif _delayedItems.Remove(canceledItem); if (canceledItem.FaultCallback != null) { canceledItem.FaultCallback(new TLRPCError { Code = new TLInt(404) }); } } } }); } private void OnServiceInitialized(object sender, EventArgs e) { #if LOG_REGISTRATION TLUtils.WriteLog("Service initialized"); #endif if (Constants.IsLongPollEnabled) { StartLongPoll(); } SendDelayedItemsAsync(); } private void SendDelayedItemsAsync() { Execute.BeginOnThreadPool(() => { #if LOG_REGISTRATION TLUtils.WriteLog("Send delayed items (count=" + _delayedItems.Count + ")"); #endif lock (_delayedItemsRoot) { if (_delayedItems.Count > 0) { foreach (var item in _delayedItems) { #if LOG_REGISTRATION TLUtils.WriteLog("Dequeue and send delayed item \n" + item); #endif SendInformativeMessage(item.Caption, item.Object, item.Callback, item.FaultCallback, item.MaxAttempt, item.AttemptFailed); } _delayedItems.Clear(); } } lock (_delayedNonInformativeItemsRoot) { if (_delayedNonInformativeItems.Count > 0) { foreach (var item in _delayedNonInformativeItems) { #if LOG_REGISTRATION TLUtils.WriteLog("Dequeue and send delayed item \n" + item); #endif SendNonInformativeMessage(item.Caption, item.Object, item.Callback, item.FaultCallback); } _delayedNonInformativeItems.Clear(); } } }); } private bool _initializeInvoked; public void StartInitialize() { if (_initializeInvoked) return; _initializeInvoked = true; Initialize(); } public void Initialize() { Execute.BeginOnThreadPool(() => { try { TryReadConfig( result => { #if LOG_REGISTRATION TLUtils.WriteLog("Read config with result: " + result); #endif if (!result) { #if LOG_REGISTRATION TLUtils.WriteLog("TLUtils.LogRegistration=true"); TLUtils.IsLogEnabled = true; #endif var host = _activeTransport != null ? _activeTransport.Host : Constants.FirstServerIpAddress; // !IMPORTANT host can be obtained through publig config var port = _activeTransport != null ? _activeTransport.Port : Constants.FirstServerPort; // !IMPORTANT port can be obtained through publig config var dcId = _activeTransport != null ? _activeTransport.DCId : Constants.FirstServerDCId; // !IMPORTANT dcId can be obtained through publig config _activeTransport = GetTransport(host, port, Type, new TransportSettings { DcId = dcId, Secret = _activeTransport != null ? _activeTransport.Secret : null, AuthKey = _activeTransport != null ? _activeTransport.AuthKey : null, Salt = _activeTransport != null ? _activeTransport.Salt : null, SessionId = _activeTransport != null ? _activeTransport.SessionId : null, MessageIdDict = _activeTransport != null ? _activeTransport.MessageIdDict : new Dictionary(), SequenceNumber = _activeTransport != null ? _activeTransport.SequenceNumber : 0, ClientTicksDelta = _activeTransport != null ? _activeTransport.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceived }); #if LOG_REGISTRATION TLUtils.WriteLog("Start generating auth key"); #endif InitAsync(tuple => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop generating auth key"); TLUtils.WriteLog("Start help.getNearestDc"); #endif lock (_activeTransportRoot) { _activeTransport.DCId = Constants.FirstServerDCId; _activeTransport.AuthKey = tuple.Item1; _activeTransport.Salt = tuple.Item2; _activeTransport.SessionId = tuple.Item3; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } //IsInitialized = true; // Важно, используется тут, чтобы OnPacketReceived не пытался рассматривать ответ как NonEncryptedMessage var timer = Stopwatch.StartNew(); GetNearestDCAsync(nearestDC => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop help.getNearestDc"); TLUtils.WriteLog("Start help.getConfig"); #endif lock (_activeTransportRoot) { _activeTransport.DCId = nearestDC.ThisDC.Value; } var elapsed = timer.Elapsed; var timer2 = Stopwatch.StartNew(); GetConfigAsync( config => { var elapsed2 = timer2.Elapsed; var sb = new StringBuilder(); sb.AppendLine("help.getNearestDc " + elapsed.ToString("g")); sb.AppendLine("help.getConfig " + elapsed2.ToString("g")); sb.AppendLine("auth time " + _authTimeElapsed.ToString("g")); Execute.ShowDebugMessage(sb.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("Stop help.getConfig"); #endif config.Country = nearestDC.Country.ToString(); Execute.BeginOnThreadPool(() => RaiseGotUserCountry(config.Country)); _config = TLConfig.Merge(_config, config); var dcOption = TLUtils.GetDCOption(config, new TLInt(_activeTransport.DCId)); dcOption.AuthKey = _activeTransport.AuthKey; dcOption.Salt = _activeTransport.Salt; dcOption.SessionId = _activeTransport.SessionId; config.ActiveDCOptionIndex = config.DCOptions.IndexOf(dcOption); _cacheService.SetConfig(config); RaiseInitialized(); }, error => RaiseInitializationFailed()); }, error => RaiseInitializationFailed()); }, error => RaiseInitializationFailed()); } else { var configQ = _config; var activeDCOPtionIndex = _config.ActiveDCOptionIndex; var activeDCOption = configQ.DCOptions[activeDCOPtionIndex]; var getConfigRequired = activeDCOption.Id == null; // fix to update from 0.1.2.1 to 0.1.2.4 // previously Id is not saved for first DC _activeTransport = GetTransport(activeDCOption.IpAddress.ToString(), activeDCOption.Port.Value, Type, new TransportSettings { DcId = getConfigRequired ? 0 : activeDCOption.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption), AuthKey = activeDCOption.AuthKey, Salt = activeDCOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); lock (_activeTransportRoot) { _activeTransport.DCId = getConfigRequired ? 0 : activeDCOption.Id.Value; _activeTransport.AuthKey = activeDCOption.AuthKey; _activeTransport.Salt = activeDCOption.Salt; _activeTransport.SessionId = TLLong.Random(); _activeTransport.ClientTicksDelta = activeDCOption.ClientTicksDelta; } //fix for version 0.1.3.12 if (activeDCOption.AuthKey == null) { //clear config and try again RaiseAuthorizationRequired(new AuthorizationRequiredEventArgs { MethodName = "Initialize activeDCOption.AuthKey==null", Error = null, AuthKeyId = 0 }); _config = null; _cacheService.SetConfig(_config); RaiseInitializationFailed(); return; } var authKeyId = TLUtils.GenerateLongAuthKeyId(activeDCOption.AuthKey); //Log.Write("Use authKey=" + authKeyId); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = activeDCOption.AuthKey, AutkKeyId = authKeyId }); } } if (getConfigRequired) { var timer = Stopwatch.StartNew(); GetNearestDCAsync(nearestDC => { #if LOG_REGISTRATION TLUtils.WriteLog("Stop help.getNearestDc"); TLUtils.WriteLog("Start help.getConfig"); #endif lock (_activeTransportRoot) { _activeTransport.DCId = nearestDC.ThisDC.Value; } var elapsed = timer.Elapsed; var timer2 = Stopwatch.StartNew(); GetConfigAsync( config => { var elapsed2 = timer2.Elapsed; var sb = new StringBuilder(); sb.AppendLine("help.getNearestDc: " + elapsed); sb.AppendLine("help.getConfig: " + elapsed2); Execute.ShowDebugMessage(sb.ToString()); #if LOG_REGISTRATION TLUtils.WriteLog("Stop help.getConfig"); #endif config.Country = nearestDC.Country.ToString(); _config = TLConfig.Merge(_config, config); var dcOption = TLUtils.GetDCOption(config, new TLInt(_activeTransport.DCId)); dcOption.AuthKey = _activeTransport.AuthKey; dcOption.Salt = _activeTransport.Salt; dcOption.SessionId = _activeTransport.SessionId; config.ActiveDCOptionIndex = config.DCOptions.IndexOf(dcOption); _cacheService.SetConfig(config); RaiseInitialized(); }, error => RaiseInitializationFailed()); }, error => RaiseInitializationFailed()); } else { RaiseInitialized(); } } }); } catch (Exception e) { TLUtils.WriteException(e); RaiseInitializationFailed(); } }); } private void TryReadConfig(Action callback) { _cacheService.GetConfigAsync( config => { _config = config; if (_config == null) { callback(false); return; } callback(true); }); } private void SendAcknowledgments(TLTransportMessage response) { var ids = new TLVector(); if (response.SeqNo.Value % 2 == 1) { ids.Items.Add(response.MessageId); } if (response.MessageData is TLContainer) { var container = (TLContainer)response.MessageData; foreach (var message in container.Messages) { if (message.SeqNo.Value % 2 == 1) { ids.Items.Add(message.MessageId); } } } if (ids.Items.Count > 0) { MessageAcknowledgments(ids); } } private void SendAcknowledgmentsByTransport(ITransport transport, TLTransportMessage response) { var ids = new TLVector(); if (response.SeqNo.Value % 2 == 1) { ids.Items.Add(response.MessageId); } if (response.MessageData is TLContainer) { var container = (TLContainer)response.MessageData; foreach (var message in container.Messages) { if (message.SeqNo.Value % 2 == 1) { ids.Items.Add(message.MessageId); } } } if (ids.Items.Count > 0) { MessageAcknowledgmentsByTransport(transport, ids); } } public event EventHandler AuthorizationRequired; public void RaiseAuthorizationRequired(AuthorizationRequiredEventArgs args) { var handler = AuthorizationRequired; if (handler != null) { handler(this, args); } } private void ReceiveBytesAsync(ITransport transport, byte[] bytes) { try { if (bytes.Length == 4) { var error = BitConverter.ToInt32(bytes, 0); if (error == -404 || error == -444) { if (error == -444) { DisableMTProtoProxy(); RaiseProxyDisabled(); } var message = string.Format("dc_id={0} error={1}", transport.DCId, error); TLUtils.WriteException(new Exception(message)); ResetConnection(new Exception(message)); return; } } var position = 0; var encryptedMessage = (TLEncryptedTransportMessage)new TLEncryptedTransportMessage().FromBytes(bytes, ref position); byte[] authKey2 = null; lock (_authKeysRoot) { try { authKey2 = _authKeys[encryptedMessage.AuthKeyId.Value].AuthKey; } catch (Exception e) { var error = new StringBuilder(); error.AppendLine("bytes_length=" + bytes.Length); error.AppendLine("authKey=" + encryptedMessage.AuthKeyId); error.AppendLine("authKeys"); foreach (var authKey in _authKeys) { error.AppendLine(string.Format("{0} {1}", authKey.Key, authKey.Value.AutkKeyId)); } TLUtils.WriteException(error.ToString(), e); } } encryptedMessage.Decrypt(authKey2); #region Security checks if (encryptedMessage.Data == null) { var message = "msgKey mismatch"; TLUtils.WriteException(new Exception(message)); } if (encryptedMessage.Data.Length < 32) { var message = string.Format("padding extension data={0} < 32", encryptedMessage.Data.Length); TLUtils.WriteException(new Exception(message)); } var messageDataLength = BitConverter.ToInt32(encryptedMessage.Data, 28); if (messageDataLength < 0 || messageDataLength % 4 != 0) { var message = string.Format("incorrect length data={0} length={1}", encryptedMessage.Data.Length, messageDataLength); TLUtils.WriteException(new Exception(message)); } if (32 + messageDataLength > encryptedMessage.Data.Length) { var message = string.Format("padding extension data={0} length={1}", encryptedMessage.Data.Length, messageDataLength); TLUtils.WriteException(new Exception(message)); } position = 0; var transportMessage = TLObject.GetObject(encryptedMessage.Data, ref position); #if MTPROTO if (encryptedMessage.Data.Length - position < 12 || encryptedMessage.Data.Length - position > 1024) { var message = string.Format("padding extension data={0} position={1} object={2}", encryptedMessage.Data.Length, position, transportMessage.MessageData); TLUtils.WriteException(new Exception(message)); } #else if ((encryptedMessage.Data.Length - position) > 15) { var message = string.Format("padding extension data={0} position={1} object={2}", encryptedMessage.Data.Length, position, transportMessage.MessageData); TLUtils.WriteException(new Exception(message)); } #endif if (transportMessage.SessionId.Value != transport.SessionId.Value) { var message = string.Format("Transport Session_id={0} is not equal to transport.session_id={1} transport_dc_id={2}", transportMessage.SessionId, transport.SessionId, transport.DCId); TLUtils.WriteException(new Exception(message)); } if (transport.MinMessageId != 0) { if (transport.MinMessageId > transportMessage.MessageId.Value) { var message = string.Format("Message_id={0} seq_no={1} is higher than transport.min_message_id={2}", transportMessage.MessageId, transportMessage.SeqNo, transport.MinMessageId); TLUtils.WriteException(new Exception(message)); } } if (transport.MessageIdDict.ContainsKey(transportMessage.MessageId.Value)) { var message = string.Format("Message_id={0} already exists", transportMessage.MessageId.Value); TLUtils.WriteException(new Exception(message)); } lock (transport.SyncRoot) { transport.MessageIdDict[transportMessage.MessageId.Value] = transportMessage.MessageId.Value; } if ((transportMessage.MessageId.Value % 2) == 0) { TLUtils.WriteException(new Exception("Incorrect message_id")); } #endregion // get acknowledgments foreach (var acknowledgment in TLUtils.FindInnerObjects(transportMessage)) { var ids = acknowledgment.MessageIds.Items; lock (_historyRoot) { foreach (var id in ids) { if (_history.ContainsKey(id.Value)) { _history[id.Value].Status = RequestStatus.Confirmed; } } } } // send acknowledgments SendAcknowledgments(transportMessage); // set client ticks delta bool updated = false; lock (_activeTransportRoot) { if (transport.ClientTicksDelta == 0) { var serverTime = transportMessage.MessageId.Value; var clientTime = transport.GenerateMessageId().Value; var serverDateTime = Utils.UnixTimestampToDateTime(serverTime >> 32); var clientDateTime = Utils.UnixTimestampToDateTime(clientTime >> 32); var errorInfo = new StringBuilder(); errorInfo.AppendLine("Server time: " + serverDateTime); errorInfo.AppendLine("Client time: " + clientDateTime); transport.ClientTicksDelta = serverTime - clientTime; if (transport.ClientTicksDelta == 0) transport.ClientTicksDelta = 1; updated = true; } } if (updated && _config != null) { var dcOption = _config.DCOptions.FirstOrDefault(x => string.Equals(x.IpAddress.ToString(), transport.Host, StringComparison.OrdinalIgnoreCase)); if (dcOption != null) { dcOption.ClientTicksDelta = transport.ClientTicksDelta; _cacheService.SetConfig(_config); } } // updates _updatesService.ProcessTransportMessage(transportMessage); // bad messages foreach (var badMessage in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem item = null; lock (_historyRoot) { if (_history.ContainsKey(badMessage.BadMessageId.Value)) { item = _history[badMessage.BadMessageId.Value]; } else { Execute.ShowDebugMessage("TLBadMessageNotificaiton lost item id=" + badMessage.BadMessageId); } } Logs.Log.Write(string.Format("{0} {1}", badMessage, item)); ProcessBadMessage(transportMessage, badMessage, item); } // bad server salts foreach (var badServerSalt in TLUtils.FindInnerObjects(transportMessage)) { lock (_activeTransportRoot) { _activeTransport.Salt = badServerSalt.NewServerSalt; } // save config if (_config != null && _config.DCOptions != null) { var activeDCOption = _config.DCOptions[_config.ActiveDCOptionIndex]; activeDCOption.Salt = badServerSalt.NewServerSalt; SaveConfig(); } HistoryItem item = null; lock (_historyRoot) { if (_history.ContainsKey(badServerSalt.BadMessageId.Value)) { item = _history[badServerSalt.BadMessageId.Value]; } else { Execute.ShowDebugMessage("TLBadServerSalt lost item id=" + badServerSalt.BadMessageId); } } Logs.Log.Write(string.Format("{0} {1}", badServerSalt, item)); ProcessBadServerSalt(transportMessage, badServerSalt, item); } // new session created foreach (var newSessionCreated in TLUtils.FindInnerObjects(transportMessage)) { TLUtils.WritePerformance(string.Format("NEW SESSION CREATED: {0} (old {1})", transportMessage.SessionId, _activeTransport.SessionId)); lock (_activeTransportRoot) { _activeTransport.SessionId = transportMessage.SessionId; _activeTransport.Salt = newSessionCreated.ServerSalt; } } foreach (var pong in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem item; lock (_historyRoot) { if (_history.ContainsKey(pong.MessageId.Value)) { item = _history[pong.MessageId.Value]; _history.Remove(pong.MessageId.Value); } else { //Execute.ShowDebugMessage("TLPong lost item id=" + pong.MessageId); continue; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif if (item != null) { item.Callback.SafeInvoke(pong); } } // rpcresults foreach (var result in TLUtils.FindInnerObjects(transportMessage)) { HistoryItem historyItem = null; lock (_historyRoot) { if (_history.ContainsKey(result.RequestMessageId.Value)) { historyItem = _history[result.RequestMessageId.Value]; //#if !DEBUG _history.Remove(result.RequestMessageId.Value); //Debug.WriteLine("History remove msg_id={0} obj={1}", result.RequestMessageId, result.Object); #if DEBUG _removedHistory[result.RequestMessageId.Value] = new HistoryItem { Caption = historyItem.Caption }; #endif //#endif } else { #if DEBUG //Debug.WriteLine("History missing msg_id={0} obj={1}", result.RequestMessageId, result.Object); if (_removedHistory.ContainsKey(result.RequestMessageId.Value)) { var removedHistoryItem = _removedHistory[result.RequestMessageId.Value]; Execute.ShowDebugMessage(string.Format("TLRPCResult LostItem msg_id={0} caption={1} result={2}", result.RequestMessageId, removedHistoryItem != null ? removedHistoryItem.Caption : "null", result.Object)); } else { HistoryItem removedHistoryItem = null; Execute.ShowDebugMessage(string.Format("TLRPCResult LostItem msg_id={0} caption={1} result={2}", result.RequestMessageId, removedHistoryItem != null ? removedHistoryItem.Caption : "null", result.Object)); } #endif continue; } } #if DEBUG NotifyOfPropertyChange(() => History); #endif var error = result.Object as TLRPCError; if (error != null) { string errorString; var reqError = error as TLRPCReqError; if (reqError != null) { errorString = string.Format("RPCReqError {1} {2} (query_id={0})", reqError.QueryId, reqError.Code, reqError.Message); } else { errorString = string.Format("RPCError {0} {1}", error.Code, error.Message); } Execute.ShowDebugMessage(historyItem + Environment.NewLine + errorString); ProcessRPCError(error, historyItem, encryptedMessage.AuthKeyId.Value); Debug.WriteLine(errorString + " msg_id=" + result.RequestMessageId.Value); TLUtils.WriteLine(errorString); } else { var messageData = result.Object; if (messageData is TLGzipPacked) { messageData = ((TLGzipPacked)messageData).Data; } if (messageData is TLSentMessageBase || messageData is TLStatedMessageBase || messageData is TLUpdatesBase || messageData is TLSentEncryptedMessage || messageData is TLSentEncryptedFile || messageData is TLAffectedHistory || messageData is TLAffectedMessages || historyItem.Object is TLReadChannelHistory || historyItem.Object is TLReadEncryptedHistory) { RemoveFromQueue(historyItem); } if (historyItem.Caption == "messages.getDialogs") { #if DEBUG_UPDATEDCOPTIONS var dcOption = new TLDCOption { Hostname = new TLString(""), Id = new TLInt(2), IpAddress = new TLString("109.239.131.193"), Port = new TLInt(80) }; var dcOptions = new TLVector {dcOption}; var update = new TLUpdateDCOptions {DCOptions = dcOptions}; var updateShort = new TLUpdatesShort {Date = new TLInt(0), Update = update}; _updatesService.ProcessTransportMessage(new TLTransportMessage{MessageData = updateShort}); #endif } try { historyItem.Callback(messageData); } catch (Exception e) { #if LOG_REGISTRATION TLUtils.WriteLog(e.ToString()); #endif TLUtils.WriteException(e); } } } } catch (Exception e) { TLUtils.WriteException("ReceiveBytesAsync", e); ResetConnection(e); } } private void ResetConnectionByTransport(ITransport transport, Exception ex) { ClearHistoryByTransport(transport); lock (transport.SyncRoot) { // continue listening on fault transport = GetTransport(transport.Host, transport.Port, Type, new TransportSettings { DcId = transport.DCId, Secret = transport.Secret, AuthKey = transport.AuthKey, Salt = transport.Salt, SessionId = transport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = transport.SequenceNumber, ClientTicksDelta = transport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceivedByTransport }); } // to bind authKey to current TCPTransport PingByTransportAsync(transport, TLLong.Random(), result => { }); } private void ResetConnection(Exception ex) { ClearHistory("ResetConnection", false, false, ex); // continue listening on fault _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport != null ? _activeTransport.DCId : 0, Secret = _activeTransport != null ? _activeTransport.Secret : null, AuthKey = _activeTransport != null ? _activeTransport.AuthKey : null, Salt = _activeTransport != null ? _activeTransport.Salt : null, SessionId = _activeTransport != null ? _activeTransport.SessionId : null, MessageIdDict = _activeTransport != null ? _activeTransport.MessageIdDict : new Dictionary(), SequenceNumber = _activeTransport != null ? _activeTransport.SequenceNumber : 0, ClientTicksDelta = _activeTransport != null ? _activeTransport.ClientTicksDelta : 0, PacketReceivedHandler = OnPacketReceived }); // to bind authKey to current TCPTransport, get changes, etc... PingAsync(TLLong.Random(), pong => { }); } public void Stop() { _transportService.CheckConfig -= OnCheckConfig; _transportService.ConnectionLost -= OnConnectionLost; _transportService.FileConnectionLost -= OnFileConnectionLost; _transportService.SpecialConnectionLost -= OnSpecialConnectionLost; _transportService.Close(); var history = new List(); lock (_historyRoot) { foreach (var keyValue in _history) { history.Add(keyValue.Value); } _history.Clear(); } foreach (var keyValue in history) { keyValue.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.Stop") }); } } public void ClearHistory(string caption, bool createNewSession, bool syncFaultCallbacks = false, Exception e = null) { var errorDebugString = string.Format("{0} clear history start {1}", DateTime.Now.ToString("HH:mm:ss.fff"), _history.Count); TLUtils.WriteLine(errorDebugString, LogSeverity.Error); _transportService.Close(); if (createNewSession) { _activeTransport.SessionId = TLLong.Random(); _activeTransport.MessageIdDict = new Dictionary(); } // сначала очищаем reqPQ, reqDHParams и setClientDHParams _activeTransport.ClearNonEncryptedHistory(); //затем очищаем help.getNearestDc, help.getConfig и любые другие методы //иначе при вызове faultCallback для help.getNearestDc, help.getConfig и reqPQ снова бы завершился с ошибкой // при вызове ClearNonEncryptedHistory var history = new List(); lock (_historyRoot) { foreach (var keyValue in _history) { history.Add(keyValue.Value); } _history.Clear(); } if (syncFaultCallbacks) { foreach (var keyValue in history) { keyValue.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.ClearHistory " + caption), Exception = e }); } } else { Execute.BeginOnThreadPool(() => { foreach (var keyValue in history) { keyValue.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.ClearHistory " + caption), Exception = e }); } }); } } private void ResetConnection(ITransport transport, Exception ex) { Execute.ShowDebugMessage("ResetConnection dc_id=" + transport.DCId); ClearHistory("ResetConnection dc_id=" + transport.DCId, false, false, ex); } public void ClearHistory(string caption, ITransport transport, Exception e = null) { var errorDebugString = string.Format("{0} clear history start {1}", DateTime.Now.ToString("HH:mm:ss.fff"), _history.Count); TLUtils.WriteLine(errorDebugString, LogSeverity.Error); _transportService.CloseTransport(transport); // сначала очищаем reqPQ, reqDHParams и setClientDHParams transport.ClearNonEncryptedHistory(); //затем очищаем help.getNearestDc, help.getConfig и любые другие методы //иначе при вызове faultCallback для help.getNearestDc, help.getConfig и reqPQ снова бы завершился с ошибкой // при вызове ClearNonEncryptedHistory var history = new List(); lock (_historyRoot) { foreach (var keyValue in _history) { if (keyValue.Value.DCId == transport.DCId) { history.Add(keyValue.Value); } } foreach (var historyItem in history) { _history.Remove(historyItem.Hash); } } Execute.BeginOnThreadPool(() => { foreach (var keyValue in history) { keyValue.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString("MTProtoService.ClearHistory " + caption), Exception = e }); } }); } private void ProcessRPCError(TLRPCError error, HistoryItem historyItem, long keyId) { Log.Write(string.Format("RPCError {0} {1}", historyItem.Caption, error)); #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("RPCError {0} {1}", historyItem.Caption, error)); #endif if (error.CodeEquals(ErrorCode.UNAUTHORIZED)) { Execute.ShowDebugMessage(string.Format("RPCError {0} {1}", historyItem.Caption, error)); if (historyItem != null && historyItem.Caption != "account.updateStatus" && historyItem.Caption != "account.registerDevice" && historyItem.Caption != "auth.signIn") { //Execute.ShowDebugMessage(string.Format("RPCError {0} {1} (auth required)", historyItem.Caption, error)); RaiseAuthorizationRequired(new AuthorizationRequiredEventArgs { Error = error, MethodName = historyItem.Caption, AuthKeyId = keyId }); } else if (historyItem != null && historyItem.FaultCallback != null) { historyItem.FaultCallback(error); } } else if (error.CodeEquals(ErrorCode.ERROR_SEE_OTHER) && (error.TypeStarsWith(ErrorType.NETWORK_MIGRATE) || error.TypeStarsWith(ErrorType.PHONE_MIGRATE) //|| error.TypeStarsWith(ErrorType.FILE_MIGRATE) )) { var serverNumber = Convert.ToInt32( error.GetErrorTypeString() .Replace(ErrorType.NETWORK_MIGRATE.ToString(), string.Empty) .Replace(ErrorType.PHONE_MIGRATE.ToString(), string.Empty) //.Replace(ErrorType.FILE_MIGRATE.ToString(), string.Empty) .Replace("_", string.Empty)); if (_config == null || TLUtils.GetDCOption(_config, new TLInt(serverNumber)) == null) { GetConfigAsync(config => { // параметры предыдущего подключения не сохраняются, поэтому когда ответ приходит после // подключения к следующему серверу, то не удается расшифровать старые сообщения, пришедшие с // задержкой с новой солью и authKey _config = TLConfig.Merge(_config, config); SaveConfig(); if (historyItem.Object.GetType() == typeof(TLSendCode)) { var dcOption = TLUtils.GetDCOption(_config, new TLInt(serverNumber)); _activeTransport = GetTransport(dcOption.IpAddress.ToString(), dcOption.Port.Value, Type, new TransportSettings { DcId = dcOption.Id.Value, Secret = TLUtils.ParseSecret(dcOption), AuthKey = dcOption.AuthKey, Salt = dcOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = dcOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); //IsInitialized = false; InitAsync(tuple => { lock (_activeTransportRoot) { _activeTransport.DCId = serverNumber; _activeTransport.AuthKey = tuple.Item1; _activeTransport.Salt = tuple.Item2; _activeTransport.SessionId = tuple.Item3; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } dcOption.AuthKey = tuple.Item1; dcOption.Salt = tuple.Item2; dcOption.SessionId = tuple.Item3; _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(dcOption); _cacheService.SetConfig(_config); //IsInitialized = true; RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); }, er => { //restore previous transport var activeDCOption = _config.DCOptions[_config.ActiveDCOptionIndex]; _activeTransport = GetTransport(activeDCOption.IpAddress.ToString(), activeDCOption.Port.Value, Type, new TransportSettings { DcId = activeDCOption.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption), AuthKey = activeDCOption.AuthKey, Salt = activeDCOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("RPCError restore transport {0} {1}:{2} item {3}", _activeTransport.Id, _activeTransport.Host, _activeTransport.Port, historyItem.Caption)); #endif historyItem.FaultCallback.SafeInvoke(er); }); } else { MigrateAsync(serverNumber, auth => SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback)); } }); } else { if (historyItem.Object.GetType() == typeof(TLSendCode) || historyItem.Object.GetType() == typeof(TLGetFile)) { var activeDCOption = TLUtils.GetDCOption(_config, new TLInt(serverNumber)); _activeTransport = GetTransport(activeDCOption.IpAddress.ToString(), activeDCOption.Port.Value, Type, new TransportSettings { DcId = activeDCOption.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption), AuthKey = activeDCOption.AuthKey, Salt = activeDCOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); if (activeDCOption.AuthKey == null) { //IsInitialized = false; InitAsync(tuple => { lock (_activeTransportRoot) { _activeTransport.DCId = serverNumber; _activeTransport.AuthKey = tuple.Item1; _activeTransport.Salt = tuple.Item2; _activeTransport.SessionId = tuple.Item3; } var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = tuple.Item1, AutkKeyId = authKeyId }); } } activeDCOption.AuthKey = tuple.Item1; activeDCOption.Salt = tuple.Item2; activeDCOption.SessionId = tuple.Item3; _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(activeDCOption); _cacheService.SetConfig(_config); //IsInitialized = true; RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); }, er => { //restore previous transport var activeDCOption2 = _config.DCOptions[_config.ActiveDCOptionIndex]; _activeTransport = GetTransport(activeDCOption2.IpAddress.ToString(), activeDCOption2.Port.Value, Type, new TransportSettings { DcId = activeDCOption2.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption2), AuthKey = activeDCOption2.AuthKey, Salt = activeDCOption2.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption2.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("RPCError restore transport {0} {1}:{2} item {3}", _activeTransport.Id, _activeTransport.Host, _activeTransport.Port, historyItem.Caption)); #endif historyItem.FaultCallback.SafeInvoke(er); }); } else { lock (_activeTransportRoot) { _activeTransport.AuthKey = activeDCOption.AuthKey; _activeTransport.Salt = activeDCOption.Salt; _activeTransport.SessionId = TLLong.Random(); } var authKeyId = TLUtils.GenerateLongAuthKeyId(activeDCOption.AuthKey); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = activeDCOption.AuthKey, AutkKeyId = authKeyId }); } } _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(activeDCOption); _cacheService.SetConfig(_config); //IsInitialized = true; RaiseInitialized(); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); } } else { MigrateAsync(serverNumber, auth => SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback)); } } } else if (error.CodeEquals(ErrorCode.ERROR_SEE_OTHER) && error.TypeStarsWith(ErrorType.USER_MIGRATE)) { //return; var serverNumber = Convert.ToInt32( error.GetErrorTypeString() .Replace(ErrorType.USER_MIGRATE.ToString(), string.Empty) .Replace("_", string.Empty)); // фикс версии 0.1.3.13 когда первый конфиг для dc2 отличался от стартового dc2 // можно убрать после if (_config.ActiveDCOptionIndex == 0 && serverNumber == 2) { var activeDCOption = TLUtils.GetDCOption(_config, new TLInt(serverNumber)); _activeTransport = GetTransport(activeDCOption.IpAddress.ToString(), activeDCOption.Port.Value, Type, new TransportSettings { DcId = activeDCOption.Id.Value, Secret = TLUtils.ParseSecret(activeDCOption), AuthKey = activeDCOption.AuthKey, Salt = activeDCOption.Salt, SessionId = TLLong.Random(), MessageIdDict = new Dictionary(), SequenceNumber = 0, ClientTicksDelta = activeDCOption.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); var authKeyId = TLUtils.GenerateLongAuthKeyId(activeDCOption.AuthKey); lock (_authKeysRoot) { if (!_authKeys.ContainsKey(authKeyId)) { _authKeys.Add(authKeyId, new AuthKeyItem { AuthKey = activeDCOption.AuthKey, AutkKeyId = authKeyId }); } } _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(activeDCOption); _cacheService.SetConfig(_config); SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); } // конец фикса //ITransport newTransport; //TLDCOption newActiveDCOption; //lock (_activeTransportRoot) //{ // newActiveDCOption = _config.DCOptions.First(x => x.IsValidIPv4Option(new TLInt(serverNumber))); // var transportClientsTicksDelta = newActiveDCOption.ClientTicksDelta; // bool isCreated; // newTransport = _transportService.GetTransport(newActiveDCOption.IpAddress.ToString(), newActiveDCOption.Port.Value, Type, out isCreated); // newTransport.ClientTicksDelta = transportClientsTicksDelta; // newTransport.PacketReceived += OnPacketReceived; //} //if (newTransport.AuthKey == null) //{ // InitTransportAsync(newTransport, // tuple => // { // lock (newTransport.SyncRoot) // { // newTransport.AuthKey = tuple.Item1; // newTransport.Salt = tuple.Item2; // newTransport.SessionId = tuple.Item3; // newTransport.IsInitializing = false; // } // var authKeyId = TLUtils.GenerateLongAuthKeyId(tuple.Item1); // lock (_authKeysRoot) // { // if (!_authKeys.ContainsKey(authKeyId)) // { // _authKeys.Add(authKeyId, new AuthKeyItem {AuthKey = tuple.Item1, AutkKeyId = authKeyId}); // } // } // foreach (var dcOption in _config.DCOptions) // { // if (dcOption.Id.Value == newTransport.Id) // { // dcOption.AuthKey = tuple.Item1; // dcOption.Salt = tuple.Item2; // dcOption.SessionId = tuple.Item3; // } // } // _cacheService.SetConfig(_config); // ExportImportAuthorizationAsync( // newTransport, // () => // { // lock (_activeTransportRoot) // { // _activeTransport = newTransport; // } // _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(newActiveDCOption); // SaveConfig(); // SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); // }, // err => // { // }); // }, // er => // { // }); //} //else //{ // ExportImportAuthorizationAsync( // newTransport, // () => // { // lock (_activeTransportRoot) // { // _activeTransport = newTransport; // } // _config.ActiveDCOptionIndex = _config.DCOptions.IndexOf(newActiveDCOption); // SaveConfig(); // SendInformativeMessage(historyItem.Caption, historyItem.Object, historyItem.Callback, historyItem.FaultCallback); // }, // err => // { // }); //} } else if (historyItem.FaultCallback != null) { historyItem.FaultCallback(error); } } private void MigrateAsync(int serverNumber, Action callback) { throw new NotImplementedException(); //ExportAuthorizationAsync(new TLInt(serverNumber), // exportedAuthorization => // { // var dcOption = _config.DCOptions.First(x => x.IsValidIPv4Option(new TLInt(serverNumber))); // _activeTransport.SetAddress(dcOption.IpAddress.ToString(), dcOption.Port.Value); // _isInitialized = false; // NotifyOfPropertyChange(() => IsInitialized); // _authHelper.InitAsync(tuple => // { // ImportAuthorizationAsync(exportedAuthorization.Id, exportedAuthorization.Bytes, callback); // _isInitialized = true; // NotifyOfPropertyChange(() => IsInitialized); // RaiseInitialized(); // }); // }); } private void ProcessBadMessage(TLTransportMessage message, TLBadMessageNotification badMessage, HistoryItem historyItem) { if (historyItem == null) return; switch (badMessage.ErrorCode.Value) { case 16: // слишком маленький msg_id case 17: // слишком большой msg_id var errorInfo = new StringBuilder(); errorInfo.AppendLine("2. CORRECT TIME DELTA for active transport " + _activeTransport.DCId); errorInfo.AppendLine(historyItem.Caption); lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif var saveConfig = false; lock (_activeTransportRoot) { var serverTime = message.MessageId.Value; var clientTime = _activeTransport.GenerateMessageId().Value; var serverDateTime = Utils.UnixTimestampToDateTime(serverTime >> 32); var clientDateTime = Utils.UnixTimestampToDateTime(clientTime >> 32); errorInfo.AppendLine("Server time: " + serverDateTime); errorInfo.AppendLine("Client time: " + clientDateTime); if (historyItem.ClientTicksDelta == _activeTransport.ClientTicksDelta) { saveConfig = true; _activeTransport.ClientTicksDelta += serverTime - clientTime; errorInfo.AppendLine("Set ticks delta: " + _activeTransport.ClientTicksDelta + "(" + (serverDateTime - clientDateTime).TotalSeconds + " seconds)"); } } TLUtils.WriteLine(errorInfo.ToString(), LogSeverity.Error); if (saveConfig && _config != null) { var dcOption = _config.DCOptions.FirstOrDefault(x => string.Equals(x.IpAddress.ToString(), _activeTransport.Host, StringComparison.OrdinalIgnoreCase)); if (dcOption != null) { dcOption.ClientTicksDelta = _activeTransport.ClientTicksDelta; _cacheService.SetConfig(_config); } } // TODO: replace with SendInformativeMessage var transportMessage = (TLContainerTransportMessage)historyItem.Message; int sequenceNumber; lock (_activeTransportRoot) { if (transportMessage.SeqNo.Value % 2 == 0) { sequenceNumber = 2 * _activeTransport.SequenceNumber; } else { sequenceNumber = 2 * _activeTransport.SequenceNumber + 1; _activeTransport.SequenceNumber++; } transportMessage.SeqNo = new TLInt(sequenceNumber); transportMessage.MessageId = _activeTransport.GenerateMessageId(false); } TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); var authKey = _activeTransport.AuthKey; var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } var faultCallback = historyItem.FaultCallback; lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2,-4} SessionId {3} BadMsgId {4}", string.Format("{0}: {1}", historyItem.Caption, "time"), transportMessage.MessageId.Value, transportMessage.SeqNo.Value, message.SessionId.Value, badMessage.BadMessageId.Value); var captionString = string.Format("{0} {1} {2}", historyItem.Caption, message.SessionId, transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", string.Format("{0}: {1}", historyItem.Caption, "time"), transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey), error => { lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif faultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404) }); }); break; case 32: case 33: TLUtils.WriteLine(string.Format("ErrorCode={0} INCORRECT MSGSEQNO, CREATE NEW SESSION {1}", badMessage.ErrorCode.Value, historyItem.Caption), LogSeverity.Error); Execute.ShowDebugMessage(string.Format("ErrorCode={0} INCORRECT MSGSEQNO, CREATE NEW SESSION {1}", badMessage.ErrorCode.Value, historyItem.Caption)); var previousMessageId = historyItem.Hash; // fix seqNo with creating new Session lock (_activeTransportRoot) { _activeTransport.SessionId = TLLong.Random(); _activeTransport.SequenceNumber = 0; transportMessage = (TLTransportMessage)historyItem.Message; if (transportMessage.SeqNo.Value % 2 == 0) { sequenceNumber = 2 * _activeTransport.SequenceNumber; } else { sequenceNumber = 2 * _activeTransport.SequenceNumber + 1; _activeTransport.SequenceNumber++; } transportMessage.SeqNo = new TLInt(sequenceNumber); transportMessage.MessageId = _activeTransport.GenerateMessageId(true); } ((TLTransportMessage)transportMessage).SessionId = _activeTransport.SessionId; // TODO: replace with SendInformativeMessage TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); authKey = _activeTransport.AuthKey; encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history.Remove(previousMessageId); _history[historyItem.Hash] = historyItem; } faultCallback = historyItem.FaultCallback; lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } //Debug.WriteLine(">>{0, -30} MsgId {1} SeqNo {2,-4} SessionId {3} BadMsgId {4}", string.Format("{0}: {1}", historyItem.Caption, "seqNo"), transportMessage.MessageId.Value, transportMessage.SeqNo.Value, message.SessionId.Value, badMessage.BadMessageId.Value); captionString = string.Format("{0} {1} {2}", historyItem.Caption, message.SessionId, transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", string.Format("{0}: {1}", historyItem.Caption, "seqNo"), transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey)}, error => { if (faultCallback != null) faultCallback(null); }); break; } } private void ProcessBadServerSalt(TLTransportMessage message, TLBadServerSalt badServerSalt, HistoryItem historyItem) { if (historyItem == null) { return; } var transportMessage = (TLContainerTransportMessage)historyItem.Message; lock (_historyRoot) { _history.Remove(historyItem.Hash); } #if DEBUG NotifyOfPropertyChange(() => History); #endif TLUtils.WriteLine("CORRECT SERVER SALT:"); ((TLTransportMessage)transportMessage).Salt = badServerSalt.NewServerSalt; //Salt = badServerSalt.NewServerSalt; TLUtils.WriteLine("New salt: " + _activeTransport.Salt); switch (badServerSalt.ErrorCode.Value) { case 16: case 17: TLUtils.WriteLine("3. CORRECT TIME DELTA with Salt by activeTransport " + _activeTransport.DCId); var saveConfig = false; lock (_activeTransportRoot) { var serverTime = message.MessageId.Value; TLUtils.WriteLine("Server time: " + TLUtils.MessageIdString(BitConverter.GetBytes(serverTime))); var clientTime = _activeTransport.GenerateMessageId().Value; TLUtils.WriteLine("Client time: " + TLUtils.MessageIdString(BitConverter.GetBytes(clientTime))); if (historyItem.ClientTicksDelta == _activeTransport.ClientTicksDelta) { saveConfig = true; _activeTransport.ClientTicksDelta += serverTime - clientTime; } transportMessage.MessageId = _activeTransport.GenerateMessageId(true); TLUtils.WriteLine("Corrected client time: " + TLUtils.MessageIdString(transportMessage.MessageId)); } if (saveConfig && _config != null) { var dcOption = _config.DCOptions.FirstOrDefault(x => string.Equals(x.IpAddress.ToString(), _activeTransport.Host, StringComparison.OrdinalIgnoreCase)); if (dcOption != null) { dcOption.ClientTicksDelta = _activeTransport.ClientTicksDelta; _cacheService.SetConfig(_config); } } break; case 48: break; } if (transportMessage == null) return; var authKey = _activeTransport.AuthKey; var encryptedMessage = CreateTLEncryptedMessage(authKey, transportMessage); lock (_historyRoot) { _history[historyItem.Hash] = historyItem; } var faultCallback = historyItem.FaultCallback; lock (_activeTransportRoot) { if (_activeTransport.Closed) { _activeTransport = GetTransport(_activeTransport.Host, _activeTransport.Port, Type, new TransportSettings { DcId = _activeTransport.DCId, Secret = _activeTransport.Secret, AuthKey = _activeTransport.AuthKey, Salt = _activeTransport.Salt, SessionId = _activeTransport.SessionId, MessageIdDict = _activeTransport.MessageIdDict, SequenceNumber = _activeTransport.SequenceNumber, ClientTicksDelta = _activeTransport.ClientTicksDelta, PacketReceivedHandler = OnPacketReceived }); } } var captionString = string.Format("{0} {1} {2}", historyItem.Caption, message.SessionId, transportMessage.MessageId); SendPacketAsync(_activeTransport, captionString, encryptedMessage, result => { Debug.WriteLine("@{0} {1} result {2}", historyItem.Caption, transportMessage.MessageId.Value, result); },//ReceiveBytesAsync(result, authKey)}, error => { if (faultCallback != null) faultCallback(new TLRPCError { Code = new TLInt(404), Message = new TLString("TCPTransport error") }); }); } private readonly IDisposable _statusSubscription; public event EventHandler SendStatus; public void RaiseSendStatus(SendStatusEventArgs e) { var handler = SendStatus; if (handler != null) handler(this, e); } public void Dispose() { _statusSubscription.Dispose(); } private string _message; public string Message { get { return _message; } set { if (_message != value) { _message = value; NotifyOfPropertyChange(() => Message); } } } private DispatcherTimer _messageScheduler; public void SetMessageOnTime(double seconds, string message) { //Logs.Log.Write(string.Format("MTProtoService.SetMessageOnTime sec={0}, message={1}", seconds, message)); Execute.BeginOnUIThread(() => { if (_messageScheduler == null) { _messageScheduler = new DispatcherTimer(); _messageScheduler.Tick += MessageScheduler_Tick; } _messageScheduler.Stop(); Message = message; _messageScheduler.Interval = TimeSpan.FromSeconds(seconds); _messageScheduler.Start(); }); } #if WINDOWS_PHONE private void MessageScheduler_Tick(object sender, EventArgs e) #elif WIN_RT private void MessageScheduler_Tick(object sender, object args) #endif { Message = string.Empty; _messageScheduler.Stop(); } private ITransport GetTransportWithProxyInternal(GetTransportWithProxyFunc getTransportAction, string host, int port, TransportType type, bool checkStatic, TransportSettings settings, TLProxyBase proxy) { bool isCreated; var staticHost = host; var staticPort = port; // looking for static dcOption with none empty config if (checkStatic) { var staticOption = GetStaticDCOption(settings.DcId); if (staticOption != null) { staticHost = staticOption.IpAddress.ToString(); staticPort = staticOption.Port.Value; } } ITransport transport; lock (_activeTransportRoot) { transport = getTransportAction(host, port, staticHost, staticPort, type, TLUtils.GetProtocolDCId(settings.DcId, false, Constants.IsTestServer), settings.Secret, proxy, out isCreated); } if (isCreated) { transport.DCId = settings.DcId; transport.Secret = settings.Secret; transport.AuthKey = settings.AuthKey; transport.Salt = settings.Salt; transport.SessionId = settings.SessionId; transport.MessageIdDict = settings.MessageIdDict; transport.SequenceNumber = settings.SequenceNumber; transport.ClientTicksDelta = settings.ClientTicksDelta; transport.PacketReceived += settings.PacketReceivedHandler; } return transport; } private TLDCOption GetStaticDCOption(int dcId) { if (_config == null) return null; foreach (var item in _config.DCOptions.Items.Where(x => x.Static.Value)) { if (item.Id.Value == dcId) { return item; } } return null; } private ITransport GetTransportInternal(GetTransportFunc getTransportAction, string host, int port, TransportType type, bool checkStatic, TransportSettings settings) { bool isCreated; var staticHost = host; var staticPort = port; // looking for static dcOption with none empty config if (checkStatic) { var staticOption = GetStaticDCOption(settings.DcId); if (staticOption != null) { staticHost = staticOption.IpAddress.ToString(); staticPort = staticOption.Port.Value; } } ITransport transport; lock (_activeTransportRoot) { transport = getTransportAction(host, port, staticHost, staticPort, type, TLUtils.GetProtocolDCId(settings.DcId, false, Constants.IsTestServer), settings.Secret, out isCreated); } if (isCreated) { transport.DCId = settings.DcId; transport.Secret = settings.Secret; transport.AuthKey = settings.AuthKey; transport.Salt = settings.Salt; transport.SessionId = settings.SessionId; transport.MessageIdDict = settings.MessageIdDict; transport.SequenceNumber = settings.SequenceNumber; transport.ClientTicksDelta = settings.ClientTicksDelta; transport.PacketReceived += settings.PacketReceivedHandler; } return transport; } private ITransport GetTransport(string host, int port, TransportType type, TransportSettings settings) { return GetTransportInternal(_transportService.GetTransport, host, port, type, true, settings); } private ITransport GetFileTransport(string host, int port, TransportType type, TransportSettings settings) { return GetTransportInternal(_transportService.GetFileTransport, host, port, type, true, settings); } private ITransport GetFileTransport2(string host, int port, int dcId, TransportType type, TransportSettings settings) { return GetTransportInternal(_transportService.GetFileTransport2, host, port, type, true, settings); } private ITransport GetSpecialTransport(string host, int port, TransportType type, TransportSettings settings) { return GetTransportInternal(_transportService.GetSpecialTransport, host, port, type, false, settings); } private ITransport GetSpecialTransportWithProxy(string host, int port, TransportType type, TLProxyBase proxy, TransportSettings settings) { return GetTransportWithProxyInternal(_transportService.GetSpecialTransport, host, port, type, true, settings, proxy); } } public class TransportSettings { public int DcId { get; set; } public byte[] Secret { get; set; } public byte[] AuthKey { get; set; } public TLLong Salt { get; set; } public TLLong SessionId { get; set; } public Dictionary MessageIdDict { get; set; } public int SequenceNumber { get; set; } public long ClientTicksDelta { get; set; } public EventHandler PacketReceivedHandler { get; set; } } public class AuthorizationRequiredEventArgs : EventArgs { public string MethodName { get; set; } public long AuthKeyId { get; set; } public TLRPCError Error { get; set; } } public class SendStatusEventArgs : EventArgs { public TLBool Offline { get; set; } public SendStatusEventArgs(TLBool offline) { Offline = offline; } } public class TransportCheckedEventArgs : EventArgs { public int TransportId { get; set; } public TLLong SessionId { get; set; } public byte[] AuthKey { get; set; } public DateTime? LastReceiveTime { get; set; } public int HistoryCount { get; set; } public int NextPacketLength { get; set; } public int LastPacketLength { get; set; } public string HistoryDescription { get; set; } } } ================================================ FILE: Telegram.Api/Services/Messages/ISenderService.cs ================================================ using Telegram.Api.TL; namespace Telegram.Api.Services.Messages { public interface ISenderService { void Send(TLMessageBase message); void ResendAll(); void Open(); void Close(); } } ================================================ FILE: Telegram.Api/Services/Messages/SenderService.cs ================================================ using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.Messages { public class SenderService : ISenderService { private Queue _sendingQueue = new Queue(); private IMTProtoService _mtProtoService; public SenderService(IMTProtoService mtProtoService) { _mtProtoService = mtProtoService; } public void Send(TLMessageBase message) { _sendingQueue.Enqueue(message); } public void ResendAll() { } public void Open() { } public void Close() { } } } ================================================ FILE: Telegram.Api/Services/ServiceBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.ComponentModel; using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; using System.Runtime.Serialization; using Telegram.Api.Helpers; namespace Telegram.Api.Services { [DataContract] public abstract class TelegramPropertyChangedBase : INotifyPropertyChanged { /// /// Enables/Disables property change notification. /// /// public bool IsNotifying { get; set; } private static bool _isNotifyingGlobal = true; public static bool IsNotifyingGlobal { get { return _isNotifyingGlobal; } set { _isNotifyingGlobal = false; } } private static bool _logNotify = false; public static bool LogNotify { get { return _logNotify; } set { _logNotify = value; } } /// /// Occurs when a property value changes. /// /// public event PropertyChangedEventHandler PropertyChanged = (param0, param1) => { }; public TelegramPropertyChangedBase() { IsNotifying = true; } /// /// Raises a change notification indicating that all bindings should be refreshed. /// /// public void Refresh() { NotifyOfPropertyChange(String.Empty); } /// /// Notifies subscribers of the property change. /// /// /// Name of the property. public virtual void NotifyOfPropertyChange(string propertyName) { if (!IsNotifyingGlobal) return; if (!IsNotifying) return; #if DEBUG if (LogNotify) { Debug.WriteLine("Notify " + propertyName + " " + GetType()); } #endif if (Execute.CheckAccess()) { OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); } else { Execute.BeginOnUIThread(() => OnPropertyChanged(new PropertyChangedEventArgs(propertyName))); } //Execute.OnUIThread(() => OnPropertyChanged(new PropertyChangedEventArgs(propertyName))); } /// /// Notifies subscribers of the property change. /// /// /// The type of the property.The property expression. public void NotifyOfPropertyChange(Expression> property) { this.NotifyOfPropertyChange(GetMemberInfo(property).Name); } public static MemberInfo GetMemberInfo(Expression expression) { var lambdaExpression = (LambdaExpression)expression; return (!(lambdaExpression.Body is UnaryExpression) ? (MemberExpression)lambdaExpression.Body : (MemberExpression)((UnaryExpression)lambdaExpression.Body).Operand).Member; } /// /// Raises the event directly. /// /// /// The instance containing the event data. [EditorBrowsable(EditorBrowsableState.Never)] protected void OnPropertyChanged(PropertyChangedEventArgs e) { PropertyChangedEventHandler changedEventHandler = PropertyChanged; if (changedEventHandler == null) return; changedEventHandler(this, e); } /// /// Called when the object is deserialized. /// /// /// The streaming context. [OnDeserialized] public void OnDeserialized(StreamingContext c) { IsNotifying = true; } /// /// Used to indicate whether or not the IsNotifying property is serialized to Xml. /// /// /// /// /// Whether or not to serialize the IsNotifying property. The default is false. /// public virtual bool ShouldSerializeIsNotifying() { return false; } } public abstract class ServiceBase : TelegramPropertyChangedBase { } } ================================================ FILE: Telegram.Api/Services/Updates/IUpdatesService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using Telegram.Api.Services.Cache; using Telegram.Api.TL; namespace Telegram.Api.Services.Updates { public delegate void GetDifferenceAction(TLInt pts, TLInt date, TLInt qts, Action callback, Action faultCallback); public delegate void GetDHConfigAction(TLInt version, TLInt randomLength, Action callback, Action faultCallback); public delegate void AcceptEncryptionAction(TLInputEncryptedChat peer, TLString gb, TLLong keyFingerprint, Action callback, Action faultCallback); public delegate void SendEncryptedServiceAction(TLInputEncryptedChat peer, TLLong randomkId, TLString data, Action callback, Action faultCallback); public delegate void UpdateChannelAction(TLInt channelId, Action callback, Action faultCallback); public delegate void GetFullChatAction(TLInt chatId, Action callback, Action faultCallback); public delegate void GetFullUserAction(TLInputUserBase userId, Action callback, Action faultCallback); public delegate void GetPinnedDialogsAction(Action callback, Action faultCallback = null); public delegate void GetChannelMessagesAction(TLInputChannelBase channelId, TLVector id, Action callback, Action faultCallback); public delegate void GetMessagesAction(TLVector id, Action callback, Action faultCallback = null); public delegate void GetPeerDialogsAction(TLInputPeerBase peer, Action callback, Action faultCallback = null); public delegate void GetPromoDialogAction(TLInputPeerBase peer, Action callback, Action faultCallback = null); public delegate void SetMessageOnTimeAtion(double seconds, string message); public interface IUpdatesService { bool ProcessUpdateInternal(TLUpdateBase update, bool notifyNewMessage = true); void CancelUpdating(); IList SyncDifferenceExceptions { get; } //void IncrementClientSeq(); Func GetCurrentUserId { get; set; } Action, Action> GetStateAsync { get; set; } GetDHConfigAction GetDHConfigAsync { get; set; } GetDifferenceAction GetDifferenceAsync { get; set; } AcceptEncryptionAction AcceptEncryptionAsync { get; set; } SendEncryptedServiceAction SendEncryptedServiceAsync { get; set; } SetMessageOnTimeAtion SetMessageOnTimeAsync { get; set; } Action RemoveFromQueue { get; set; } UpdateChannelAction UpdateChannelAsync { get; set; } GetFullChatAction GetFullChatAsync { get; set; } GetFullUserAction GetFullUserAsync { get; set; } GetChannelMessagesAction GetChannelMessagesAsync { get; set; } GetPinnedDialogsAction GetPinnedDialogsAsync { get; set; } GetMessagesAction GetMessagesAsync { get; set; } GetPeerDialogsAction GetPeerDialogsAsync { get; set; } GetPromoDialogAction GetPromoDialogAsync { get; set; } void SetInitState(); TLInt ClientSeq { get; } void SetState(TLInt seq, TLInt pts, TLInt qts, TLInt date, TLInt unreadCount, string caption, bool cleanupMissingCounts = false); void SetState(IMultiPts multiPts, string caption); void ProcessTransportMessage(TLTransportMessage transportMessage); void ProcessUpdates(TLUpdatesBase updates, bool notifyNewMessages = false); void LoadStateAndUpdate(long acceptedCallId, Action callback); void SaveState(); TLState GetState(); void ClearState(); void SaveStateSnapshot(string toDirectoryName); void LoadStateSnapshot(string fromDirectoryName); event EventHandler DCOptionsUpdated; } } ================================================ FILE: Telegram.Api/Services/Updates/ReceiveUpdatesEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.TL; namespace Telegram.Api.Services.Updates { public class ReceiveUpdatesEventArgs : EventArgs { public TLUpdates Updates { get; protected set; } public ReceiveUpdatesEventArgs(TLUpdates updates) { Updates = updates; } } } ================================================ FILE: Telegram.Api/Services/Updates/UpdatesBySeqComparer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.Updates { //public class UpdatesBySeqComparer : IComparer //{ // private const int XIsLessThanY = -1; // private const int XEqualsY = 0; // private const int XIsGreaterThanY = 1; // public int Compare(TLUpdatesBase x, TLUpdatesBase y) // { // var xSeq = x.GetSeq(); // var ySeq = y.GetSeq(); // if (xSeq == null && ySeq == null) // { // return x is TLUpdatesShort ? XIsLessThanY : XIsGreaterThanY; // } // if (xSeq == null) // { // return XIsGreaterThanY; // } // if (ySeq == null) // { // return XIsLessThanY; // } // return xSeq.Value < ySeq.Value ? XIsLessThanY : (xSeq == ySeq ? XEqualsY : XIsGreaterThanY); // } //} } ================================================ FILE: Telegram.Api/Services/Updates/UpdatesService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define LOG_CLIENTSEQ using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Threading; using Org.BouncyCastle.Bcpg; using Org.BouncyCastle.Security; using Telegram.Api.Helpers; using Telegram.Logs; #if DEBUG using System.Windows; #endif using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Cache.EventArgs; using Telegram.Api.TL; namespace Telegram.Api.Services.Updates { public class MockupUpdatesService : IUpdatesService { public void CancelUpdating() { } public IList SyncDifferenceExceptions { get; private set; } public Func GetCurrentUserId { get; set; } public Action, Action> GetStateAsync { get; set; } public GetDHConfigAction GetDHConfigAsync { get; set; } public GetDifferenceAction GetDifferenceAsync { get; set; } public AcceptEncryptionAction AcceptEncryptionAsync { get; set; } public SendEncryptedServiceAction SendEncryptedServiceAsync { get; set; } public SetMessageOnTimeAtion SetMessageOnTimeAsync { get; set; } public Action RemoveFromQueue { get; set; } public UpdateChannelAction UpdateChannelAsync { get; set; } public GetFullChatAction GetFullChatAsync { get; set; } public GetFullUserAction GetFullUserAsync { get; set; } public GetChannelMessagesAction GetChannelMessagesAsync { get; set; } public GetPinnedDialogsAction GetPinnedDialogsAsync { get; set; } public GetMessagesAction GetMessagesAsync { get; set; } public GetPeerDialogsAction GetPeerDialogsAsync { get; set; } public GetPromoDialogAction GetPromoDialogAsync { get; set; } public void SetInitState() { } public TLInt ClientSeq { get; private set; } public void SetState(TLInt seq, TLInt pts, TLInt qts, TLInt date, TLInt unreadCount, string caption, bool cleanupMissingCounts = false) { } public void SetState(IMultiPts multiPts, string caption) { } public void ProcessTransportMessage(TLTransportMessage transportMessage) { } public void ProcessUpdates(TLUpdatesBase updates, bool notifyNewMessages = false) { } public void LoadStateAndUpdate(long acceptedCallId, Action callback) { } public void SaveState() { } public TLState GetState() { throw new NotImplementedException(); } public void ClearState() { } public void SaveStateSnapshot(string toDirectoryName) { } public void LoadStateSnapshot(string fromDirectoryName) { } public event EventHandler DCOptionsUpdated; public bool ProcessUpdateInternal(TLUpdateBase update, bool notifyNewMessage = true) { throw new NotImplementedException(); } } public class UpdatesService : IUpdatesService { public TLUserBase CurrentUser { get; set; } private readonly ICacheService _cacheService; private readonly ITelegramEventAggregator _eventAggregator; public Func GetCurrentUserId { get; set; } public Action, Action> GetStateAsync { get; set; } public GetDHConfigAction GetDHConfigAsync { get; set; } public GetDifferenceAction GetDifferenceAsync { get; set; } public AcceptEncryptionAction AcceptEncryptionAsync { get; set; } public SendEncryptedServiceAction SendEncryptedServiceAsync { get; set; } public SetMessageOnTimeAtion SetMessageOnTimeAsync { get; set; } public Action RemoveFromQueue { get; set; } public UpdateChannelAction UpdateChannelAsync { get; set; } public GetFullChatAction GetFullChatAsync { get; set; } public GetFullUserAction GetFullUserAsync { get; set; } public GetChannelMessagesAction GetChannelMessagesAsync { get; set; } public GetPinnedDialogsAction GetPinnedDialogsAsync { get; set; } public GetMessagesAction GetMessagesAsync { get; set; } public GetPeerDialogsAction GetPeerDialogsAsync { get; set; } public GetPromoDialogAction GetPromoDialogAsync { get; set; } private readonly Timer _lostSeqTimer; private readonly Timer _lostPtsTimer; public UpdatesService(ICacheService cacheService, ITelegramEventAggregator eventAggregator) { _lostSeqTimer = new Timer(OnCheckLostSeq, this, Timeout.Infinite, Timeout.Infinite); _lostPtsTimer = new Timer(OnCheckLostPts, this, Timeout.Infinite, Timeout.Infinite); _cacheService = cacheService; _eventAggregator = eventAggregator; } private void StartLostSeqTimer() { _lostSeqTimer.Change(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)); TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Start lostSeqTimer", LogSeverity.Error); } private void StopLostSeqTimer() { _lostSeqTimer.Change(Timeout.Infinite, Timeout.Infinite); TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Stop lostSeqTimer", LogSeverity.Error); } private void StartLostPtsTimer() { _lostPtsTimer.Change(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0)); TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Start lostPtsTimer", LogSeverity.Error); } private void StopLostPtsTimer() { _lostPtsTimer.Change(Timeout.Infinite, Timeout.Infinite); TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Stop lostPtsTimer", LogSeverity.Error); } private void OnCheckLostSeq(object state) { TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " OnCheck lostSeqTimer", LogSeverity.Error); var getDifference = false; var isLostSeqEmpty = true; var keyValuePair = default(KeyValuePair>); lock (_clientSeqLock) { foreach (var keyValue in _lostSeq.OrderBy(x => x.Key)) { isLostSeqEmpty = false; if (DateTime.Now > keyValue.Value.Item1.AddSeconds(3.0)) { getDifference = true; keyValuePair = keyValue; break; } } } if (isLostSeqEmpty) { StopLostSeqTimer(); } if (getDifference) { var seq = keyValuePair.Key; var pts = keyValuePair.Value.Item2.Pts; var date = keyValuePair.Value.Item2.Date; var qts = keyValuePair.Value.Item2.Qts; Helpers.Execute.ShowDebugMessage(string.Format("stub lostSeqTimer.getDifference(seq={0}, pts={1}, date={2}, qts={3}) localState=[seq={4}, pts={5}, date={6}, qts={7}]", seq, pts, date, qts, ClientSeq, _pts, _date, _qts)); StopLostSeqTimer(); lock (_clientSeqLock) { _lostSeq.Clear(); } //GetDifference(() => //{ //}); } } private void OnCheckLostPts(object state) { TLUtils.WriteLine(DateTime.Now.ToString(" HH:mm:ss.fff", CultureInfo.InvariantCulture) + " OnCheck lostPtsTimer", LogSeverity.Error); var getDifference = false; var isLostPtsEmpty = true; var keyValuePair = default(KeyValuePair>); lock (_clientPtsLock) { foreach (var keyValue in _lostPts.OrderBy(x => x.Key)) { isLostPtsEmpty = false; if (DateTime.Now > keyValue.Value.Item1.AddSeconds(3.0)) { getDifference = true; keyValuePair = keyValue; break; } } } if (isLostPtsEmpty) { StopLostPtsTimer(); } if (getDifference) { var seq = keyValuePair.Value.Item2.Seq; var pts = keyValuePair.Key; var date = keyValuePair.Value.Item2.Date; var qts = keyValuePair.Value.Item2.Qts; Helpers.Execute.ShowDebugMessage(string.Format("stub lostSeqTimer.getDifference(seq={0}, pts={1}, date={2}, qts={3}) localState=[seq={4}, pts={5}, date={6}, qts={7}]", seq, pts, date, qts, ClientSeq, _pts, _date, _qts)); StopLostPtsTimer(); lock (_clientPtsLock) { _lostPts.Clear(); } //GetDifference(() => //{ //}); } } public void SetState(IMultiPts multiPts, string caption) { var ptsList = TLUtils.GetPtsRange(multiPts); if (ptsList.Count == 0) { ptsList.Add(multiPts.Pts); } #if LOG_CLIENTSEQ TLUtils.WriteLine(string.Format("{0} {1}\nclientSeq={2} newSeq={3}\npts={4} ptsList={5}\n", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), caption, ClientSeq != null ? ClientSeq.ToString() : "null", "null", _pts != null ? _pts.ToString() : "null", ptsList.Count > 0 ? string.Join(", ", ptsList) : "null"), LogSeverity.Error); #endif UpdateLostPts(ptsList); } public TLInt ClientSeq { get; protected set; } private TLInt _dateInternal; private TLInt _date { get { return _dateInternal; } set { _dateInternal = value; } } private TLInt _pts; private TLInt _qts = new TLInt(1); private TLInt _unreadCount; public void SetState(TLInt seq, TLInt pts, TLInt qts, TLInt date, TLInt unreadCount, string caption, bool cleanupMissingCounts = false) { #if LOG_CLIENTSEQ TLUtils.WriteLine(string.Format("{0} {1}\nclientSeq={2} newSeq={3}\npts={4} newPts={5}\n", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), caption, ClientSeq != null ? ClientSeq.ToString() : "null", seq, _pts != null ? _pts.ToString() : "null", pts), LogSeverity.Error); //TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " " + caption + " clientSeq=" + ClientSeq + " newSeq=" + seq + " pts=" + pts, LogSeverity.Error); #endif if (seq != null) { UpdateLostSeq(new List { seq }, cleanupMissingCounts); } _date = date ?? _date; if (pts != null) { UpdateLostPts(new List { pts }, cleanupMissingCounts); } _qts = qts ?? _qts; _unreadCount = unreadCount ?? _unreadCount; } public void SetState(TLState state, string caption) { if (state == null) return; Debug.WriteLine("SetState state={0}", state); SetState(state.Seq, state.Pts, state.Qts, state.Date, state.UnreadCount, caption, true); } public void SetInitState() { GetStateAsync.SafeInvoke( result => SetState(result, "setInitState"), error => Execute.BeginOnThreadPool(TimeSpan.FromSeconds(5.0), SetInitState)); } private readonly object _getDifferenceRequestRoot = new object(); private readonly IList _getDifferenceRequests = new List(); private bool RequestExists(int id) { var result = false; lock (_getDifferenceRequestRoot) { foreach (var differenceRequest in _getDifferenceRequests) { if (differenceRequest == id) { result = true; break; } } } return result; } private void AddRequest(int id) { lock (_getDifferenceRequestRoot) { _getDifferenceRequests.Add(id); } } private void RemoveRequest(int id) { lock (_getDifferenceRequestRoot) { _getDifferenceRequests.Remove(id); } } public void CancelUpdating() { lock (_getDifferenceRequestRoot) { _getDifferenceRequests.Clear(); } } private void GetDifference(int id, Action callback) { if (_pts != null && _date != null && _qts != null) { GetDifference(id, _pts, _date, _qts, callback); } else { SetInitState(); callback(); } } private void GetDifference(int id, TLInt pts, TLInt date, TLInt qts, Action callback) { Logs.Log.Write(string.Format("UpdatesService.GetDifference {0} state=[p={1} d={2} q={3}]", id, _pts, _date, _qts)); TLUtils.WritePerformance(string.Format("UpdatesService.GetDifference pts={0} date={1} qts={2}", _pts, _date, _qts)); GetDifferenceAsync(pts, date, qts, diff => { //#if DEBUG // Execute.BeginOnThreadPool(TimeSpan.FromSeconds(5.0), () => // { //#endif var processDiffStopwatch = Stopwatch.StartNew(); var differenceEmpty = diff as TLDifferenceEmpty; if (differenceEmpty != null) { #if LOG_CLIENTSEQ TLUtils.WriteLine( string.Format("{0} {1} clientSeq={2} newSeq={3} pts={4}", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), "processDiff empty", ClientSeq, differenceEmpty.Seq, _pts), LogSeverity.Error); #endif _date = differenceEmpty.Date; lock (_clientSeqLock) { ClientSeq = differenceEmpty.Seq; } Logs.Log.Write(string.Format("UpdatesService.GetDifference {0} result {1} elapsed={2}", id, diff, processDiffStopwatch.Elapsed)); TLUtils.WritePerformance("UpdateService.GetDifference empty result=" + differenceEmpty.Seq); Execute.BeginOnThreadPool(() => { var updateChannelTooLongList = new List(); lock (_updateChannelTooLongSyncRoot) { foreach (var keyValue in _updateChannelTooLongList) { updateChannelTooLongList.Add(keyValue.Value); } _updateChannelTooLongList.Clear(); } _eventAggregator.Publish(new UpdateChannelsEventArgs { UpdateChannelTooLongList = updateChannelTooLongList }); }); callback(); return; } var difference = diff as TLDifference; if (difference != null) { //Logs.Log.Write("UpdatesService.Publish UpdatingEventArgs"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new UpdatingEventArgs())); var resetEvent = new ManualResetEvent(false); TLUtils.WritePerformance( string.Format("UpdateService.GetDifference result=[Pts={0} Date={1} Qts={2}]", difference.State.Pts, difference.State.Date, difference.State.Qts)); lock (_clientSeqLock) { SetState(difference.State, "processDiff"); } ProcessDifference(difference, () => resetEvent.Set()); #if DEBUG resetEvent.WaitOne(); #else resetEvent.WaitOne(10000); #endif } var otherInfo = new StringBuilder(); if (difference != null && difference.OtherUpdates.Count > 0) { otherInfo.AppendLine(); for (var i = 0; i < difference.OtherUpdates.Count; i++) { otherInfo.AppendLine(difference.OtherUpdates[i].ToString()); } } Logs.Log.Write(string.Format("UpdatesService.GetDifference {0} result {1} elapsed={2}{3}", id, diff, processDiffStopwatch.Elapsed, otherInfo)); var differenceSlice = diff as TLDifferenceSlice; if (differenceSlice != null) { GetDifference(id, callback); //GetDifference(differenceSlice.State.Pts, differenceSlice.State.Date, differenceSlice.State.Qts, callback); } else { Logs.Log.Write( string.Format("UpdatesService.GetDifference {0} publish UpdateCompletedEventArgs", id)); Execute.BeginOnThreadPool(() => { var updateChannelTooLongList = new List(); lock (_updateChannelTooLongSyncRoot) { foreach (var keyValue in _updateChannelTooLongList) { updateChannelTooLongList.Add(keyValue.Value); } _updateChannelTooLongList.Clear(); } _eventAggregator.Publish(new UpdateCompletedEventArgs { UpdateChannelTooLongList = updateChannelTooLongList }); }); callback(); } //#if DEBUG // }); //#endif }, error => { Execute.BeginOnThreadPool(TimeSpan.FromSeconds(5.0), () => { if (!RequestExists(id)) { Logs.Log.Write(string.Format("UpdatesService.LoadStateAndUpdate {0} CancelGetDifference", id)); return; } GetDifference(id, callback); }); }); } public bool IsCanceled { get; set; } private readonly List _syncDifferenceExceptions = new List(); public IList SyncDifferenceExceptions { get { return _syncDifferenceExceptions; } } private void ProcessDifference(TLDifference difference, System.Action callback) { // в первую очередь синхронизируем пользователей и чаты (секретный чат может создать пользователь, которого у нас нет на клиенте) _cacheService.SyncUsersAndChats(difference.Users, difference.Chats, result => { // сначала получаем апдейты, а только потом синхронизируем новые сообщения // т.к. апдейт о создании секретного чата нада обрабатывать раньше, чем новые сообщения в нем foreach (var update in difference.OtherUpdates) { try { ProcessUpdateInternal(update, false); } catch (Exception ex) { _syncDifferenceExceptions.Add(new ExceptionInfo { Caption = "UpdatesService.ProcessDifference OtherUpdates", Exception = ex, Timestamp = DateTime.Now }); TLUtils.WriteException("UpdatesService.ProcessDifference OtherUpdates ex ", ex); } } _cacheService.SyncDifferenceWithoutUsersAndChats(difference, result2 => { callback.SafeInvoke(); }, _syncDifferenceExceptions); }); } private bool ProcessUpdatesInternal(TLUpdatesBase updatesBase, bool notifyNewMessage = true) { //ClientSeq = updates.GetSeq() ?? ClientSeq; var updatesShortSentMessage = updatesBase as TLUpdatesShortSentMessage; if (updatesShortSentMessage != null) { //if (updatesShortSentMessage.Date.Value > 0) //{ // _date = updatesShortSentMessage.Date; //} Execute.ShowDebugMessage(string.Format("ProcessUpdatesInternal.UpdatesShortSentMessage: id={0}", updatesShortSentMessage.Id)); return true; } // chat message var updatesShortChatMessage = updatesBase as TLUpdatesShortChatMessage; if (updatesShortChatMessage != null) { var user = _cacheService.GetUser(updatesShortChatMessage.UserId); if (user == null) { var logString = string.Format("ProcessUpdatesInternal.UpdatesShortChatMessage: user is missing (userId={0}, msgId={1})", updatesShortChatMessage.UserId, updatesShortChatMessage.Id); Logs.Log.Write(logString); Helpers.Execute.ShowDebugMessage(logString); return false; } var chat = _cacheService.GetChat(updatesShortChatMessage.ChatId); if (chat == null) { var logString = string.Format("ProcessUpdatesInternal.UpdatesShortChatMessage: chat is missing (chatId={0}, msgId={1})", updatesShortChatMessage.ChatId, updatesShortChatMessage.Id); Logs.Log.Write(logString); Helpers.Execute.ShowDebugMessage(logString); return false; } if (updatesShortChatMessage.Date.Value > 0 && (_date == null || _date.Value < updatesShortChatMessage.Date.Value)) { _date = updatesShortChatMessage.Date; } ContinueShortChatMessage(updatesShortChatMessage, notifyNewMessage); return true; } // user message var updatesShortMessage = updatesBase as TLUpdatesShortMessage; if (updatesShortMessage != null) { if (_cacheService.GetUser(updatesShortMessage.UserId) == null) { var logString = string.Format("ProcessUpdatesInternal.UpdatesShortMessage: user is missing (userId={0}, msgId={1})", updatesShortMessage.UserId, updatesShortMessage.Id); Logs.Log.Write(logString); Helpers.Execute.ShowDebugMessage(logString); return false; } if (updatesShortMessage.Date.Value > 0 && (_date == null || _date.Value < updatesShortMessage.Date.Value)) { _date = updatesShortMessage.Date; } ContinueShortMessage(updatesShortMessage, notifyNewMessage); return true; } var updatesShort = updatesBase as TLUpdatesShort; if (updatesShort != null) { if (updatesShort.Date.Value > 0 && (_date == null || _date.Value < updatesShort.Date.Value)) { _date = updatesShort.Date; } return ProcessUpdateInternal(updatesShort.Update, notifyNewMessage); } var updatesCombined = updatesBase as TLUpdatesCombined; if (updatesCombined != null) { var resetEvent = new ManualResetEvent(false); var returnValue = true; _cacheService.SyncUsersAndChats(updatesCombined.Users, updatesCombined.Chats, result => { if (updatesCombined.Date.Value > 0 && (_date == null || _date.Value < updatesCombined.Date.Value)) { _date = updatesCombined.Date; } //ClientSeq = combined.Seq; foreach (var update in updatesCombined.Updates) { if (!ProcessUpdateInternal(update, notifyNewMessage)) { returnValue = false; } } resetEvent.Set(); }); resetEvent.WaitOne(10000); return returnValue; } var updates = updatesBase as TLUpdates; if (updates != null) { var resetEvent = new ManualResetEvent(false); var returnValue = true; _cacheService.SyncUsersAndChats(updates.Users, updates.Chats, result => { if (updates.Date.Value > 0 && (_date == null || _date.Value < updates.Date.Value)) { _date = updates.Date; } //ClientSeq = updatesFull.Seq; foreach (var update in updates.Updates) { if (!ProcessUpdateInternal(update, notifyNewMessage)) { returnValue = false; } } resetEvent.Set(); }); resetEvent.WaitOne(10000); return returnValue; } return false; } private void ContinueShortMessage(TLUpdatesShortMessage updatesShortMessage, bool notifyNewMessage) { var message = TLUtils.GetShortMessage( updatesShortMessage.Id, updatesShortMessage.UserId, new TLPeerUser { Id = GetCurrentUserId() }, updatesShortMessage.Date, updatesShortMessage.Message); var shortMessage40 = updatesShortMessage as TLUpdatesShortMessage40; if (shortMessage40 != null) { message.Flags = shortMessage40.Flags; message.FwdFromPeer = shortMessage40.FwdFrom; //message.FwdFromId = shortMessage25.FwdFromId; message.FwdDate = shortMessage40.FwdDate; message.ReplyToMsgId = shortMessage40.ReplyToMsgId; } var shortMessage48 = updatesShortMessage as TLUpdatesShortMessage48; if (shortMessage48 != null) { message.FwdHeader = shortMessage48.FwdHeader; } var shortMessage45 = updatesShortMessage as TLUpdatesShortMessage45; if (shortMessage45 != null) { message.ViaBotId = shortMessage45.ViaBotId; } var shortMessage34 = updatesShortMessage as TLUpdatesShortMessage34; if (shortMessage34 != null) { message.Entities = shortMessage34.Entities; } if (message.Out.Value) { message.ToId = new TLPeerUser { Id = updatesShortMessage.UserId }; message.FromId = GetCurrentUserId(); } // set as read var readMaxId = _cacheService.GetUser(message.Out.Value ? message.ToId.Id : message.FromId) as IReadMaxId; if (readMaxId != null) { var maxId = message.Out.Value ? readMaxId.ReadOutboxMaxId : readMaxId.ReadInboxMaxId; if (maxId != null) { if (maxId.Value >= message.Index) { message.SetUnreadSilent(TLBool.False); } } } MTProtoService.ProcessSelfMessage(message); _cacheService.SyncMessage(message, cachedMessage => { if (notifyNewMessage) { _eventAggregator.Publish(cachedMessage); } }); } private void ContinueShortChatMessage(TLUpdatesShortChatMessage updatesShortChatMessage, bool notifyNewMessage) { var message = TLUtils.GetShortMessage( updatesShortChatMessage.Id, updatesShortChatMessage.UserId, new TLPeerChat { Id = updatesShortChatMessage.ChatId }, updatesShortChatMessage.Date, updatesShortChatMessage.Message); var shortChatMessage40 = updatesShortChatMessage as TLUpdatesShortChatMessage40; if (shortChatMessage40 != null) { message.Flags = shortChatMessage40.Flags; message.FwdFromPeer = shortChatMessage40.FwdFrom; //message.FwdFromId = shortChatMessage25.FwdFromId; message.FwdDate = shortChatMessage40.FwdDate; message.ReplyToMsgId = shortChatMessage40.ReplyToMsgId; } var shortMessage48 = updatesShortChatMessage as TLUpdatesShortChatMessage48; if (shortMessage48 != null) { message.FwdHeader = shortMessage48.FwdHeader; } var shortChatMessage45 = updatesShortChatMessage as TLUpdatesShortChatMessage45; if (shortChatMessage45 != null) { message.ViaBotId = shortChatMessage45.ViaBotId; } var shortChatMessage34 = updatesShortChatMessage as TLUpdatesShortChatMessage34; if (shortChatMessage34 != null) { message.Entities = shortChatMessage34.Entities; } // set as read var readMaxId = _cacheService.GetChat(message.ToId.Id) as IReadMaxId; if (readMaxId != null) { var maxId = message.Out.Value ? readMaxId.ReadOutboxMaxId : readMaxId.ReadInboxMaxId; if (maxId != null) { if (maxId.Value >= message.Index) { message.SetUnreadSilent(TLBool.False); } } } _cacheService.SyncMessage(message, cachedMessage => { if (notifyNewMessage) { _eventAggregator.Publish(cachedMessage); } }); } public event EventHandler DCOptionsUpdated; protected virtual void RaiseDCOptionsUpdated(DCOptionsUpdatedEventArgs e) { var handler = DCOptionsUpdated; if (handler != null) handler(this, e); } public static TLDecryptedMessageBase GetDecryptedMessage(TLInt currentUserId, TLEncryptedChat cachedChat, TLEncryptedMessageBase encryptedMessageBase, TLInt qts, out bool commitChat) { commitChat = false; if (cachedChat == null) return null; if (cachedChat.Key == null) return null; TLDecryptedMessageBase decryptedMessage = null; try { decryptedMessage = TLUtils.DecryptMessage(encryptedMessageBase.Bytes, currentUserId, cachedChat, out commitChat); } catch (Exception e) { #if DEBUG TLUtils.WriteException(e); #endif } if (decryptedMessage == null) return null; var participantId = currentUserId.Value == cachedChat.ParticipantId.Value ? cachedChat.AdminId : cachedChat.ParticipantId; var cachedUser = InMemoryCacheService.Instance.GetUser(participantId); if (cachedUser == null) return null; decryptedMessage.FromId = cachedUser.Id; decryptedMessage.Out = new TLBool(false); decryptedMessage.Unread = new TLBool(true); decryptedMessage.RandomId = encryptedMessageBase.RandomId; decryptedMessage.ChatId = encryptedMessageBase.ChatId; decryptedMessage.Date = encryptedMessageBase.Date; decryptedMessage.Qts = qts; var message = decryptedMessage as TLDecryptedMessage; if (message != null) { var encryptedMessage = encryptedMessageBase as TLEncryptedMessage; if (encryptedMessage != null) { message.Media.File = encryptedMessage.File; var document = message.Media as TLDecryptedMessageMediaDocument; if (document != null) { var file = document.File as TLEncryptedFile; if (file != null) { file.FileName = document.FileName; } } var video = message.Media as TLDecryptedMessageMediaVideo; if (video != null) { var file = video.File as TLEncryptedFile; if (file != null) { file.Duration = video.Duration; } } var audio = message.Media as TLDecryptedMessageMediaAudio; if (audio != null) { audio.UserId = decryptedMessage.FromId; } } } return decryptedMessage; } private Dictionary _contactRegisteredList = new Dictionary(); private static readonly object _updateChannelTooLongSyncRoot = new object(); private Dictionary _updateChannelTooLongList = new Dictionary(); public bool ProcessUpdateInternal(TLUpdateBase update, bool notifyNewMessage = true) { var userStatus = update as TLUpdateUserStatus; if (userStatus != null) { var user = _cacheService.GetUser(userStatus.UserId); if (user == null) { return false; } user._status = userStatus.Status; // not UI Thread if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(userStatus)); } //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(user)); return true; } var userTyping = update as TLUpdateUserTyping; if (userTyping != null) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(userTyping)); return true; } var chatUserTyping = update as TLUpdateChatUserTyping; if (chatUserTyping != null) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(chatUserTyping)); return true; } System.Diagnostics.Debug.WriteLine(update); var updateServiceNotification = update as TLUpdateServiceNotification; if (updateServiceNotification != null) { Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateServiceNotification)); return true; } var updatePrivacy = update as TLUpdatePrivacy; if (updatePrivacy != null) { Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updatePrivacy)); return true; } var updateUserBlocked = update as TLUpdateUserBlocked; if (updateUserBlocked != null) { var user = _cacheService.GetUser(updateUserBlocked.UserId); if (user != null) { user.Blocked = updateUserBlocked.Blocked; _cacheService.Commit(); } Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateUserBlocked)); return true; } var processed = ProcessEncryptedChatUpdate(update); if (processed != null) { return processed.Value; } var updateDCOptions = update as TLUpdateDCOptions; if (updateDCOptions != null) { RaiseDCOptionsUpdated(new DCOptionsUpdatedEventArgs { Update = updateDCOptions }); return true; } var updateChannelTooLong = update as TLUpdateChannelTooLong; if (updateChannelTooLong != null) { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelTooLong)); } else { lock (_updateChannelTooLongSyncRoot) { _updateChannelTooLongList[updateChannelTooLong.ChannelId.Value] = updateChannelTooLong; } } //var updateChannelTooLong49 = update as TLUpdateChannelTooLong49; //if (updateChannelTooLong49 != null) //{ // Execute.ShowDebugMessage(string.Format("updateChannelTooLong channel_id={0} channel_pts={1}", updateChannelTooLong49.ChannelId, updateChannelTooLong49.ChannelPts)); //} //else //{ // Execute.ShowDebugMessage(string.Format("updateChannelTooLong channel_id={0}", updateChannelTooLong.ChannelId)); //} //#if DEBUG // Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelTooLong)); // Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelTooLong)); // Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelTooLong)); //#endif //UpdateChannelAsync(updateChannelTooLong.ChannelId, // result => // { // var channel = result.Chats.FirstOrDefault(); // if (channel != null) // { // // replace with channels.getDifference and handling channelDifferenceTooLong // GetHistoryAsync(channel.ToInputPeer(), new TLInt(0), new TLInt(0), // new TLInt(Constants.CachedMessagesCount), new TLInt(0), new TLInt(0), // result2 => // { // }, // error2 => // { // }); // } // else // { // } // }, // error => // { // Execute.ShowDebugMessage("updateChannel getFullChannel error " + error); // }); return true; } var updateChannel = update as TLUpdateChannel; if (updateChannel != null) { UpdateChannelAsync(updateChannel.ChannelId, result => { var channel = result.Chats.FirstOrDefault() as TLChannel; if (channel != null) { var dialogBase = _cacheService.GetDialog(new TLPeerChannel { Id = channel.Id }); if (channel.Left.Value) { var promo = _cacheService.GetProxyData() as TLProxyDataPromo; if (promo != null && promo.Peer.Id.Value == updateChannel.ChannelId.Value) { if (dialogBase == null) { GetPromoDialogAsync(channel.ToInputPeer(), result3 => { }); } else { var oldDialogs = _cacheService.GetDialogs().OfType().Where(x => x.IsPromo).ToList(); foreach (var oldDialogBase in oldDialogs) { _cacheService.UpdateDialogPromo(oldDialogBase, false); } _cacheService.UpdateDialogPromo(dialogBase, true); } } else { if (dialogBase != null) { _cacheService.DeleteDialog(dialogBase); if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new DialogRemovedEventArgs(dialogBase))); } } } } else { var promo = _cacheService.GetProxyData() as TLProxyDataPromo; if (promo != null && promo.Peer.Id.Value == updateChannel.ChannelId.Value) { if (dialogBase != null) { _cacheService.UpdateDialogPromo(dialogBase, false); } } else { if (dialogBase == null) { GetPeerDialogsAsync(channel.ToInputPeer(), result3 => { dialogBase = result3.Dialogs.FirstOrDefault() as TLDialog; if (dialogBase != null) { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new DialogAddedEventArgs(dialogBase))); } } }); } } } if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannel)); } } else { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannel)); } Execute.ShowDebugMessage("updateChannel empty"); } }, error => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannel)); } Execute.ShowDebugMessage("updateChannel getFullChannel error " + error); }); return true; } var updateChannelGroup = update as TLUpdateChannelGroup; if (updateChannelGroup != null) { Execute.ShowDebugMessage(string.Format("updateChannelGroup channel_id={0} min_id={1} max_id={2} count={3} date={4}", updateChannelGroup.ChannelId, updateChannelGroup.Group.MinId, updateChannelGroup.Group.MaxId, updateChannelGroup.Group.Count, updateChannelGroup.Group.Date)); return true; } var updateChannelPinnedMessage = update as TLUpdateChannelPinnedMessage; if (updateChannelPinnedMessage != null) { var channel = _cacheService.GetChat(updateChannelPinnedMessage.ChannelId) as TLChannel49; if (channel != null) { channel.PinnedMsgId = updateChannelPinnedMessage.Id; channel.HiddenPinnedMsgId = null; _cacheService.Commit(); var message = _cacheService.GetMessage(updateChannelPinnedMessage.Id, updateChannelPinnedMessage.ChannelId); if (message == null) { GetChannelMessagesAsync(channel.ToInputChannel(), new TLVector { new TLInputMessageId { Id = updateChannelPinnedMessage.Id } }, messagesBase => { _cacheService.AddMessagesToContext(messagesBase, result => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelPinnedMessage)); } }); }, error => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelPinnedMessage)); } }); } else { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelPinnedMessage)); } } } return true; } var updateEditMessage = update as TLUpdateEditMessage; if (updateEditMessage != null) { //uExecute.ShowDebugMessage(string.Format("updateEditMessage pts={0} pts_count={1} message={2}", updateEditMessage.Pts, updateEditMessage.PtsCount, updateEditMessage.Message)); _cacheService.SyncEditedMessage(updateEditMessage.Message, notifyNewMessage, notifyNewMessage, cachedMessage => { var geoLive = false; var message = cachedMessage as TLMessage; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { geoLive = true; } } if (notifyNewMessage || geoLive) // to avoid handle live locations on UpdateCompletedEventArgs { updateEditMessage.Message = cachedMessage; Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateEditMessage)); } }); return true; } var updateEditChannelMessage = update as TLUpdateEditChannelMessage; if (updateEditChannelMessage != null) { //Execute.ShowDebugMessage(string.Format("updateEditChannelMessage channel_pts={0} channel_ptscount={1} message={2}", updateEditChannelMessage.ChannelPts, updateEditChannelMessage.ChannelPtsCount, updateEditChannelMessage.Message)); var commonMessage = updateEditChannelMessage.Message as TLMessageCommon; if (commonMessage != null) { var peer = commonMessage.ToId; var channel = _cacheService.GetChat(commonMessage.ToId.Id) as TLChannel; if (channel != null) { if (channel.Pts == null || (channel.Pts.Value < updateEditChannelMessage.ChannelPts.Value && channel.Pts.Value + updateEditChannelMessage.ChannelPtsCount.Value != updateEditChannelMessage.ChannelPts.Value)) { Execute.ShowDebugMessage(string.Format("channel_id={0} channel_pts={1} updateEditChannelMessage[channel_pts={2} channel_pts_count={3}]", peer.Id, channel.Pts, updateEditChannelMessage.ChannelPts, updateEditChannelMessage.ChannelPtsCount)); } channel.Pts = new TLInt(updateEditChannelMessage.ChannelPts.Value); } _cacheService.SyncEditedMessage(updateEditChannelMessage.Message, notifyNewMessage, notifyNewMessage, cachedMessage => { var geoLive = false; var message = cachedMessage as TLMessage; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { geoLive = true; } } if (notifyNewMessage || geoLive) // to avoid handle live locations on UpdateCompletedEventArgs { updateEditChannelMessage.Message = cachedMessage; Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateEditChannelMessage)); } }); } return true; } var updateNewChannelMessage = update as TLUpdateNewChannelMessage; if (updateNewChannelMessage != null) { var commonMessage = updateNewChannelMessage.Message as TLMessageCommon; if (commonMessage != null) { var peer = commonMessage.ToId; var channel = _cacheService.GetChat(commonMessage.ToId.Id) as TLChannel; if (channel != null) { if (channel.Pts == null || (channel.Pts.Value < updateNewChannelMessage.ChannelPts.Value && channel.Pts.Value + updateNewChannelMessage.ChannelPtsCount.Value != updateNewChannelMessage.ChannelPts.Value)) { //Execute.ShowDebugMessage(string.Format("channel_id={0} channel_pts={1} updateNewChannelMessage[channel_pts={2} channel_pts_count={3}]", peer.Id, channel.Pts, updateNewChannelMessage.ChannelPts, updateNewChannelMessage.ChannelPtsCount)); } channel.Pts = new TLInt(updateNewChannelMessage.ChannelPts.Value); if (!commonMessage.Out.Value) { var readInboxMaxId = channel.ReadInboxMaxId != null ? channel.ReadInboxMaxId.Value : 0; if (commonMessage.Index <= readInboxMaxId) { commonMessage.SetUnreadSilent(TLBool.False); } } else { var channel49 = channel as TLChannel49; if (channel49 != null) { var readOutboxMaxId = channel49.ReadOutboxMaxId != null ? channel49.ReadOutboxMaxId.Value : 0; if (commonMessage.Index <= readOutboxMaxId) { commonMessage.SetUnreadSilent(TLBool.False); } } } } if (commonMessage.RandomIndex != 0) { _cacheService.SyncSendingMessage(commonMessage, null, cachedMessage => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(cachedMessage)); } }); } else { _cacheService.SyncMessage(updateNewChannelMessage.Message, notifyNewMessage, notifyNewMessage, cachedMessage => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(cachedMessage)); } }); } } return true; } var updateNewMessage = update as TLUpdateNewMessage; if (updateNewMessage != null) { var commonMessage = updateNewMessage.Message as TLMessageCommon; if (commonMessage != null) { MTProtoService.ProcessSelfMessage(commonMessage); TLPeerBase peer; if (commonMessage.ToId is TLPeerChat) { peer = commonMessage.ToId; } else { peer = commonMessage.Out.Value ? commonMessage.ToId : new TLPeerUser { Id = commonMessage.FromId }; } if (commonMessage.RandomIndex != 0) { #if DEBUG Log.Write("TLUpdateNewMessage " + updateNewMessage.Message); #endif _cacheService.SyncSendingMessage(commonMessage, null, cachedMessage => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(cachedMessage)); } }); } else { #if DEBUG Log.Write("TLUpdateNewMessage " + updateNewMessage.Message); #endif _cacheService.SyncMessage(updateNewMessage.Message, cachedMessage => { if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(cachedMessage)); } }); } } return true; } var updateMessageId = update as TLUpdateMessageId; if (updateMessageId != null) { _cacheService.SyncSendingMessageId(updateMessageId.RandomId, updateMessageId.Id, m => { }); RemoveFromQueue(updateMessageId.RandomId); return true; } var updateChannelReadMessagesContents = update as TLUpdateChannelReadMessagesContents; if (updateChannelReadMessagesContents != null) { var localMessages = new List(); var remoteMessages = new TLVector(); foreach (var readMessageId in updateChannelReadMessagesContents.Messages) { var message = _cacheService.GetMessage(readMessageId, updateChannelReadMessagesContents.ChannelId) as TLMessage25; if (message != null) { localMessages.Add(message); } else { remoteMessages.Add(new TLInputMessageId { Id = readMessageId }); } } TLDialog71 dialog = null; var localMentionsCount = localMessages.OfType().Count(x => x.IsMention); if (localMentionsCount > 0 || remoteMessages.Count > 0) { dialog = _cacheService.GetDialog(new TLPeerChannel { Id = updateChannelReadMessagesContents.ChannelId }) as TLDialog71; if (dialog != null) { if (remoteMessages.Count > 0) { var channel = _cacheService.GetChat(updateChannelReadMessagesContents.ChannelId) as TLChannel; if (channel != null) { GetChannelMessagesAsync(channel.ToInputChannel(), remoteMessages, messagesBase => { var remoteMentionsCount = messagesBase.Messages.OfType().Count(x => x.IsMention); if (remoteMentionsCount > 0) { Execute.BeginOnUIThread(() => { dialog.UnreadMentionsCount = new TLInt(Math.Max(0, dialog.UnreadMentionsCount.Value - remoteMentionsCount)); dialog.NotifyOfPropertyChange(() => dialog.UnreadMentionsCount); }); } }, error => { }); } } } } Execute.BeginOnUIThread(() => { foreach (var message in localMessages) { message.SetListened(); if (message.Media != null) { message.Media.NotListened = false; message.Media.NotifyOfPropertyChange(() => message.Media.NotListened); } var message70 = message as TLMessage70; if (message70 != null && message70.HasTTL()) { var mediaPhoto70 = message.Media as TLMessageMediaPhoto70; if (mediaPhoto70 != null && mediaPhoto70.Photo != null) { mediaPhoto70.Photo = null; message70.NotifyOfPropertyChange(() => message70.TTLMediaExpired); } var mediaDocument70 = message.Media as TLMessageMediaDocument70; if (mediaDocument70 != null && mediaDocument70.Document != null) { mediaDocument70.Document = null; message70.NotifyOfPropertyChange(() => message70.TTLMediaExpired); } } } if (dialog != null && localMentionsCount > 0) { dialog.UnreadMentionsCount = new TLInt(Math.Max(0, dialog.UnreadMentionsCount.Value - localMentionsCount)); dialog.NotifyOfPropertyChange(() => dialog.UnreadMentionsCount); } if (notifyNewMessage) { _eventAggregator.Publish(updateChannelReadMessagesContents); } }); return true; } var updateReadMessagesContents = update as TLUpdateReadMessagesContents; if (updateReadMessagesContents != null) { var localMessages = new List(); var remoteMessages = new TLVector(); foreach (var readMessageId in updateReadMessagesContents.Messages) { var message = _cacheService.GetMessage(readMessageId) as TLMessage25; if (message != null) { localMessages.Add(message); } else { remoteMessages.Add(new TLInputMessageId { Id = readMessageId }); } } var dialogs = new List(); if (localMessages.Count > 0) { foreach (var localMessage in localMessages) { if (localMessage.IsMention) { var dialog = _cacheService.GetDialog(localMessage) as TLDialog71; if (dialog != null && dialog.UnreadMentionsCount.Value > 0) { dialog.UnreadMentionsCount = new TLInt(Math.Max(0, dialog.UnreadMentionsCount.Value - 1)); dialogs.Add(dialog); } } } } if (remoteMessages.Count > 0) { GetMessagesAsync(remoteMessages, messagesBase => { var dialogs2 = new List(); foreach (var messageBase in messagesBase.Messages) { var message = messageBase as TLMessage17; if (message != null && message.IsMention) { var dialog = _cacheService.GetDialog(message) as TLDialog71; if (dialog != null && dialog.UnreadMentionsCount.Value > 0) { dialog.UnreadMentionsCount = new TLInt(Math.Max(0, dialog.UnreadMentionsCount.Value - 1)); dialogs2.Add(dialog); } } } Execute.BeginOnUIThread(() => { foreach (var dialog in dialogs2) { dialog.NotifyOfPropertyChange(() => dialog.UnreadMentionsCount); } }); }, error => { }); } Execute.BeginOnUIThread(() => { foreach (var message in localMessages) { message.SetListened(); if (message.Media != null) { message.Media.NotListened = false; message.Media.NotifyOfPropertyChange(() => message.Media.NotListened); } var message70 = message as TLMessage70; if (message70 != null && message70.HasTTL()) { var mediaPhoto70 = message.Media as TLMessageMediaPhoto70; if (mediaPhoto70 != null && mediaPhoto70.Photo != null) { mediaPhoto70.Photo = null; message70.NotifyOfPropertyChange(() => message70.TTLMediaExpired); } var mediaDocument70 = message.Media as TLMessageMediaDocument70; if (mediaDocument70 != null && mediaDocument70.Document != null) { mediaDocument70.Document = null; message70.NotifyOfPropertyChange(() => message70.TTLMediaExpired); } } } foreach (var dialog in dialogs) { dialog.NotifyOfPropertyChange(() => dialog.UnreadMentionsCount); } if (notifyNewMessage) { _eventAggregator.Publish(updateReadMessagesContents); } }); return true; } var updateChannelMessageViews = update as TLUpdateChannelMessageViews; if (updateChannelMessageViews != null) { //Execute.ShowDebugMessage(string.Format("updateChannelMessageViews channel_id={0} id={1} views={2}", updateChannelMessageViews.ChannelId, updateChannelMessageViews.Id, updateChannelMessageViews.Views)); var message = _cacheService.GetMessage(updateChannelMessageViews.Id, updateChannelMessageViews.ChannelId) as TLMessage36; if (message != null) { if (message.Views == null || message.Views.Value < updateChannelMessageViews.Views.Value) { message.Views = updateChannelMessageViews.Views; Execute.BeginOnUIThread(() => { message.NotifyOfPropertyChange(() => message.Views); }); } } return true; } var updateReadHistory = update as TLUpdateReadHistory; if (updateReadHistory != null) { var outbox = update is TLUpdateReadHistoryOutbox; IReadMaxId readMaxId = null; if (updateReadHistory.Peer is TLPeerUser) { readMaxId = _cacheService.GetUser(updateReadHistory.Peer.Id) as IReadMaxId; } else if (updateReadHistory.Peer is TLPeerChat) { readMaxId = _cacheService.GetChat(updateReadHistory.Peer.Id) as IReadMaxId; } SetReadMaxId(readMaxId, updateReadHistory.MaxId, outbox); var dialog = _cacheService.GetDialog(updateReadHistory.Peer); if (dialog != null) { var dialog53 = dialog as TLDialog53; if (dialog53 != null) { SetReadMaxId(dialog53, updateReadHistory.MaxId, outbox); SetReadMaxId(dialog53.With as IReadMaxId, updateReadHistory.MaxId, outbox); } var notifyMessages = new List(); var maxId = updateReadHistory.MaxId; for (int i = 0; i < dialog.Messages.Count; i++) { var message = dialog.Messages[i] as TLMessageCommon; if (message != null) { if (message.Index != 0 && message.Index <= maxId.Value && message.Out.Value == outbox) { if (message.Unread.Value) { message.SetUnread(TLBool.False); notifyMessages.Add(message); //message.NotifyOfPropertyChange(() => message.Unread); } else { break; } } } } var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage != null) { if (topMessage.Index <= maxId.Value) { if (topMessage.Index != 0 && topMessage.Unread.Value && topMessage.Out.Value == outbox) { topMessage.SetUnread(TLBool.False); notifyMessages.Add(topMessage); //topMessage.NotifyOfPropertyChange(() => topMessage.Unread); } } } var unreadCount = 0; if (dialog.TopMessageId != null && dialog.TopMessageId.Value > updateReadHistory.MaxId.Value) { unreadCount = dialog.UnreadCount.Value; } if (outbox) { unreadCount = dialog.UnreadCount.Value; } dialog.UnreadCount = new TLInt(unreadCount); if (notifyNewMessage) { Execute.BeginOnUIThread(() => { foreach (var message in notifyMessages) { message.NotifyOfPropertyChange(() => message.Unread); } dialog.NotifyOfPropertyChange(() => dialog.TopMessage); dialog.NotifyOfPropertyChange(() => dialog.Self); dialog.NotifyOfPropertyChange(() => dialog.UnreadCount); }); } } return true; } var updateReadChannelOutbox = update as TLUpdateReadChannelOutbox; if (updateReadChannelOutbox != null) { //Execute.ShowDebugMessage(string.Format("TLUpdateReadChannelOutbox channel_id={0} max_id={1}", updateReadChannelOutbox.ChannelId, updateReadChannelOutbox.MaxId)); var readMaxId = _cacheService.GetChat(updateReadChannelOutbox.ChannelId) as IReadMaxId; if (readMaxId != null) { SetReadMaxId(readMaxId, updateReadChannelOutbox.MaxId, true); } var dialog = _cacheService.GetDialog(new TLPeerChannel { Id = updateReadChannelOutbox.ChannelId }); if (dialog != null) { var dialog53 = dialog as TLDialog53; if (dialog53 != null) { SetReadMaxId(dialog53, updateReadChannelOutbox.MaxId, true); SetReadMaxId(dialog53.With as IReadMaxId, updateReadChannelOutbox.MaxId, true); } var messages = new List(); var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage != null && topMessage.Out.Value && topMessage.Index <= updateReadChannelOutbox.MaxId.Value) { //dialog.UnreadCount = new TLInt(0); topMessage.SetUnread(TLBool.False); messages.Add(topMessage); } foreach (var messageBase in dialog.Messages) { var message = messageBase as TLMessageCommon; if (message != null && message.Unread.Value && message.Out.Value) { if (message.Index != 0 && message.Index < updateReadChannelOutbox.MaxId.Value) { message.SetUnread(TLBool.False); messages.Add(message); } } } if (notifyNewMessage) { Execute.BeginOnUIThread(() => { foreach (var message in messages) { message.NotifyOfPropertyChange(() => message.Unread); } dialog.NotifyOfPropertyChange(() => dialog.TopMessage); dialog.NotifyOfPropertyChange(() => dialog.Self); dialog.NotifyOfPropertyChange(() => dialog.UnreadCount); }); } } _cacheService.Commit(); return true; } var updateReadChannelInbox = update as TLUpdateReadChannelInbox; if (updateReadChannelInbox != null) { //Execute.ShowDebugMessage(string.Format("TLUpdateReadChannelInbox channel_id={0} max_id={1}", updateReadChannelInbox.ChannelId, updateReadChannelInbox.MaxId)); var messages = new List(); var readMaxId = _cacheService.GetChat(updateReadChannelInbox.ChannelId) as IReadMaxId; if (readMaxId != null) { SetReadMaxId(readMaxId, updateReadChannelInbox.MaxId, false); } var dialog = _cacheService.GetDialog(new TLPeerChannel { Id = updateReadChannelInbox.ChannelId }); if (dialog != null) { var dialog53 = dialog as TLDialog53; if (dialog53 != null) { SetReadMaxId(dialog53, updateReadChannelInbox.MaxId, false); SetReadMaxId(dialog53.With as IReadMaxId, updateReadChannelInbox.MaxId, false); } var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage != null && !topMessage.Out.Value && topMessage.Index <= updateReadChannelInbox.MaxId.Value) { dialog.UnreadCount = new TLInt(0); topMessage.SetUnread(TLBool.False); messages.Add(topMessage); } foreach (var messageBase in dialog.Messages) { var message = messageBase as TLMessageCommon; if (message != null && message.Unread.Value && !message.Out.Value) { if (message.Index != 0 && message.Index < updateReadChannelInbox.MaxId.Value) { message.SetUnread(TLBool.False); messages.Add(message); } } } if (notifyNewMessage) { Execute.BeginOnUIThread(() => { foreach (var message in messages) { message.NotifyOfPropertyChange(() => message.Unread); } dialog.NotifyOfPropertyChange(() => dialog.TopMessage); dialog.NotifyOfPropertyChange(() => dialog.Self); dialog.NotifyOfPropertyChange(() => dialog.UnreadCount); }); } } _cacheService.Commit(); return true; } var updateReadMessages = update as TLUpdateReadMessages; if (updateReadMessages != null) { var dialogs = new Dictionary(); var messages = new List(updateReadMessages.Messages.Count); foreach (var readMessageId in updateReadMessages.Messages) { var message = _cacheService.GetMessage(readMessageId) as TLMessageCommon; if (message != null) { messages.Add(message); var dialog = _cacheService.GetDialog(message); if (dialog != null && dialog.UnreadCount.Value > 0) { dialog.UnreadCount = new TLInt(Math.Max(0, dialog.UnreadCount.Value - 1)); var topMessage = dialog.TopMessage; if (topMessage != null && topMessage.Index == readMessageId.Value) { dialogs[dialog.Index] = dialog; } } } } Execute.BeginOnUIThread(() => { foreach (var message in messages) { message.SetUnread(new TLBool(false)); message.NotifyOfPropertyChange(() => message.Unread); } foreach (var dialogBase in dialogs.Values) { var dialog = dialogBase as TLDialog; if (dialog == null) continue; dialog.NotifyOfPropertyChange(() => dialog.TopMessage); dialog.NotifyOfPropertyChange(() => dialog.Self); dialog.NotifyOfPropertyChange(() => dialog.UnreadCount); } }); return true; } var deleteMessages = update as TLUpdateDeleteMessages; if (deleteMessages != null) { _cacheService.DeleteMessages(deleteMessages.Messages); return true; } var updateDeleteChannelMessages = update as TLUpdateDeleteChannelMessages; if (updateDeleteChannelMessages != null) { Execute.ShowDebugMessage(string.Format("updateDeleteChannelMessages channel_id={0} msgs=[{1}] channel_pts={2} channel_pts_count={3}", updateDeleteChannelMessages.ChannelId, string.Join(", ", updateDeleteChannelMessages.Messages), updateDeleteChannelMessages.ChannelPts, updateDeleteChannelMessages.ChannelPtsCount)); var channel = _cacheService.GetChat(updateDeleteChannelMessages.ChannelId) as TLChannel; if (channel != null) { if (channel.Pts == null || channel.Pts.Value + updateDeleteChannelMessages.ChannelPtsCount.Value != updateDeleteChannelMessages.ChannelPts.Value) { Execute.ShowDebugMessage(string.Format("channel_id={0} channel_pts={1} updateDeleteChannelMessages[channel_pts={2} channel_pts_count={3}]", channel.Id, channel.Pts, updateDeleteChannelMessages.ChannelPts, updateDeleteChannelMessages.ChannelPtsCount)); } channel.Pts = new TLInt(updateDeleteChannelMessages.ChannelPts.Value); } _cacheService.DeleteChannelMessages(updateDeleteChannelMessages.ChannelId, updateDeleteChannelMessages.Messages); return true; } var restoreMessages = update as TLUpdateRestoreMessages; if (restoreMessages != null) { return true; } var updateChatAdmins = update as TLUpdateChatAdmins; if (updateChatAdmins != null) { var chat = _cacheService.GetChat(updateChatAdmins.ChatId) as TLChat40; if (chat != null) { chat.AdminsEnabled = updateChatAdmins.Enabled; chat.Version = updateChatAdmins.Version; _cacheService.Commit(); } Execute.ShowDebugMessage(string.Format("TLUpdateChatAdmins chat_id={0} enabled={1} version={2}", updateChatAdmins.ChatId, updateChatAdmins.Enabled, updateChatAdmins.Version)); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChatAdmins)); return true; } var updateChatParticipantAdmin = update as TLUpdateChatParticipantAdmin; if (updateChatParticipantAdmin != null) { var chat = _cacheService.GetChat(updateChatParticipantAdmin.ChatId) as TLChat40; if (chat != null) { var userId = GetCurrentUserId(); if (updateChatParticipantAdmin.UserId.Value == userId.Value) { chat.Admin = updateChatParticipantAdmin.IsAdmin; chat.Version = updateChatParticipantAdmin.Version; _cacheService.Commit(); } } Execute.ShowDebugMessage(string.Format("TLUpdateChatParticipantAdmin chat_id={0} user_id={1} is_admin={2} version={3}", updateChatParticipantAdmin.ChatId, updateChatParticipantAdmin.UserId, updateChatParticipantAdmin.IsAdmin, updateChatParticipantAdmin.Version)); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChatParticipantAdmin)); return true; } var updateChatParticipants = update as TLUpdateChatParticipants; if (updateChatParticipants != null) { var chat = _cacheService.GetChat(updateChatParticipants.Participants.ChatId) as TLChat40; if (chat != null) { chat.Participants = updateChatParticipants.Participants; var participants = chat.Participants as IChatParticipants; if (participants != null) { chat.Version = participants.Version; } _cacheService.Commit(); } Execute.ShowDebugMessage(string.Format("TLUpdateChatParticipants participants={0}", updateChatParticipants.Participants.GetType().Name)); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChatParticipants)); return true; } var userName = update as TLUpdateUserName; if (userName != null) { var user = _cacheService.GetUser(userName.UserId); if (user == null) { return false; } user.FirstName = userName.FirstName; user.LastName = userName.LastName; var userWithUserName = user as IUserName; if (userWithUserName != null) { userWithUserName.UserName = userName.UserName; } Execute.BeginOnThreadPool(() => _eventAggregator.Publish(userName)); return true; } var userPhoto = update as TLUpdateUserPhoto; if (userPhoto != null) { if (userPhoto.Date.Value > 0 && (_date == null || _date.Value < userPhoto.Date.Value)) { _date = userPhoto.Date; } var user = _cacheService.GetUser(userPhoto.UserId); if (user == null) { return false; } user.Photo = userPhoto.Photo; Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(userPhoto)); //_cacheService.SyncUser(user, result => _eventAggregator.Publish(result)); return true; } var userPhone = update as TLUpdateUserPhone; if (userPhone != null) { var user = _cacheService.GetUser(userPhone.UserId); if (user == null) { return false; } user.Phone = userPhone.Phone; Helpers.Execute.BeginOnThreadPool(() => user.NotifyOfPropertyChange(() => user.Phone)); return true; } var contactRegistered = update as TLUpdateContactRegistered; if (contactRegistered != null) { if (contactRegistered.Date.Value > 0 && (_date == null || _date.Value < contactRegistered.Date.Value)) { _date = contactRegistered.Date; } if (_contactRegisteredList.ContainsKey(contactRegistered.UserId.Value)) { return true; } _contactRegisteredList[contactRegistered.UserId.Value] = contactRegistered.UserId.Value; if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(contactRegistered)); } return true; } var updateNewAuthorization = update as TLUpdateNewAuthorization; if (updateNewAuthorization != null) { if (updateNewAuthorization.Date.Value > 0 && (_date == null || _date.Value < updateNewAuthorization.Date.Value)) { _date = updateNewAuthorization.Date; } Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateNewAuthorization)); return true; } var updateContactLink = update as TLUpdateContactLinkBase; if (updateContactLink != null) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateContactLink)); return true; } var updateChatParticipantAdd = update as TLUpdateChatParticipantAdd; if (updateChatParticipantAdd != null) { return true; } var updateChatParticipantDelete = update as TLUpdateChatParticipantDelete; if (updateChatParticipantDelete != null) { return true; } var updateNotifySettings = update as TLUpdateNotifySettings; if (updateNotifySettings != null) { var notifyPeer = updateNotifySettings.Peer as TLNotifyPeer; if (notifyPeer != null) { var dialog = _cacheService.GetDialog(notifyPeer.Peer); if (dialog != null) { dialog.NotifySettings = updateNotifySettings.NotifySettings; var peerUser = dialog.Peer as TLPeerUser; if (peerUser != null) { var user = _cacheService.GetUser(peerUser.Id); if (user != null) { user.NotifySettings = updateNotifySettings.NotifySettings; if (dialog.With != null) { var dialogUser = dialog.With as TLUserBase; if (dialogUser != null) { dialogUser.NotifySettings = updateNotifySettings.NotifySettings; } } } } var peerChat = dialog.Peer as TLPeerChat; if (peerChat != null) { var chat = _cacheService.GetChat(peerChat.Id); if (chat != null) { chat.NotifySettings = updateNotifySettings.NotifySettings; if (dialog.With != null) { var dialogChat = dialog.With as TLChatBase; if (dialogChat != null) { dialogChat.NotifySettings = updateNotifySettings.NotifySettings; } } } } if (peerChat != null || peerUser != null) { _cacheService.Commit(); } Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateNotifySettings)); } } return true; } var updateWebPage = update as TLUpdateWebPage; if (updateWebPage != null) { var message = _cacheService.GetMessage(updateWebPage.WebPage) as TLMessage; if (message != null) { message._media = new TLMessageMediaWebPage { WebPage = updateWebPage.WebPage }; _cacheService.SyncMessage(message, m => { Helpers.Execute.BeginOnUIThread(() => message.NotifyOfPropertyChange(() => message.Media)); }); } Helpers.Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateWebPage)); return true; } var updateNewStickerSet = update as TLUpdateNewStickerSet; if (updateNewStickerSet != null) { Execute.ShowDebugMessage("TLUpdateNewStickeSet"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateNewStickerSet)); return true; } var updateStickerSetsOrder = update as TLUpdateStickerSetsOrder; if (updateStickerSetsOrder != null) { Execute.ShowDebugMessage("TLUpdateStickerSetsOrder56"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateStickerSetsOrder)); return true; } var updateStickerSets = update as TLUpdateStickerSets; if (updateStickerSets != null) { Execute.ShowDebugMessage("TLUpdateStickerSets"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateStickerSets)); return true; } var updateReadFeaturedStickers = update as TLUpdateReadFeaturedStickers; if (updateReadFeaturedStickers != null) { Execute.ShowDebugMessage("TLUpdateReadFeaturedStickers"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateReadFeaturedStickers)); return true; } var updateRecentStickers = update as TLUpdateRecentStickers; if (updateRecentStickers != null) { Execute.ShowDebugMessage("TLUpdateRecentStickers"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateRecentStickers)); return true; } var updateFavedStickers = update as TLUpdateFavedStickers; if (updateFavedStickers != null) { //Execute.ShowDebugMessage("TLUpdateFavedStickers"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateFavedStickers)); return true; } var updateSavedGifs = update as TLUpdateSavedGifs; if (updateSavedGifs != null) { Execute.ShowDebugMessage("TLUpdateSavedGifs"); //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateSavedGifs)); return true; } var updateBotInlineQuery = update as TLUpdateBotInlineQuery; if (updateBotInlineQuery != null) { Execute.ShowDebugMessage("TLUpdateBotInlineQuery"); //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateSavedGifs)); return true; } var updateBotCallbackQuery = update as TLUpdateBotCallbackQuery; if (updateBotCallbackQuery != null) { Execute.ShowDebugMessage("TLUpdateBotCallbackQuery"); //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateSavedGifs)); return true; } var updateBotInlineSend = update as TLUpdateBotInlineSend; if (updateBotInlineSend != null) { Execute.ShowDebugMessage("TLUpdateBotInlineSend"); //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateSavedGifs)); return true; } var updateInlineBotCallbackQuery = update as TLUpdateInlineBotCallbackQuery; if (updateInlineBotCallbackQuery != null) { Execute.ShowDebugMessage("TLUpdateInlineBotCallbackQuery"); //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateSavedGifs)); return true; } var updateDraftMessage = update as TLUpdateDraftMessage; if (updateDraftMessage != null) { //Execute.ShowDebugMessage("TLUpdateDraftMessage draft=" + updateDraftMessage.Draft); var dialog = _cacheService.GetDialog(updateDraftMessage.Peer) as TLDialog53; if (dialog != null) { dialog.Draft = updateDraftMessage.Draft; _cacheService.Commit(); } if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateDraftMessage)); } return true; } var updatePinnedDialogs = update as TLUpdatePinnedDialogs; if (updatePinnedDialogs != null) { #if DEBUG var order = new List(); if (updatePinnedDialogs.Order != null) { foreach (var peer in updatePinnedDialogs.Order) { order.Add(peer.ToString()); } } Execute.ShowDebugMessage(string.Format("TLUpdatePinnedDialogs order=[{0}]", string.Join(", ", order))); #endif //if (updatePinnedDialogs.Order == null) //{ GetPinnedDialogsAsync(result => { // important: must be true in all cases. UpdateCompletedEventArgs will be invoke before getting new pinned chats //if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updatePinnedDialogs)); } }); //} //else //{ // _cacheService.UpdatePinnedDialogs(updatePinnedDialogs.Order); // if (notifyNewMessage) // { // Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updatePinnedDialogs)); // } //} return true; } var updateDialogPinned = update as TLUpdateDialogPinned76; if (updateDialogPinned != null) { var dialogPeer = updateDialogPinned.Peer as TLDialogPeer; if (dialogPeer != null) { _cacheService.UpdateDialogPinned(dialogPeer.Peer, updateDialogPinned.Pinned); } if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateDialogPinned)); } return true; } var updateChannelAvailableMessages = update as TLUpdateChannelAvailableMessages; if (updateChannelAvailableMessages != null) { _cacheService.UpdateChannelAvailableMessages(updateChannelAvailableMessages.ChannelId, updateChannelAvailableMessages.AvailableMinId); if (notifyNewMessage) { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(updateChannelAvailableMessages)); } return true; } var updateDialogUnreadMark = update as TLUpdateDialogUnreadMark; if (updateDialogUnreadMark != null) { var dialogPeer = updateDialogUnreadMark.Peer as TLDialogPeer; if (dialogPeer != null) { var dialog = _cacheService.GetDialog(dialogPeer.Peer); if (dialog != null) { var dialog71 = dialog as TLDialog71; if (dialog71 != null) { dialog71.UnreadMark = updateDialogUnreadMark.Unread; } if (notifyNewMessage) { Execute.BeginOnUIThread(() => { if (dialog71 != null) { dialog71.NotifyOfPropertyChange(() => dialog71.UnreadMark); } }); } } return true; } } return false; } private static void SetReadMaxId(IReadMaxId readMaxId, TLInt maxId, bool outbox) { if (readMaxId == null) return; if (outbox) { if (readMaxId.ReadOutboxMaxId == null || readMaxId.ReadOutboxMaxId.Value < maxId.Value) { readMaxId.ReadOutboxMaxId = maxId; } } else { if (readMaxId.ReadInboxMaxId == null || readMaxId.ReadInboxMaxId.Value < maxId.Value) { readMaxId.ReadInboxMaxId = maxId; } } } private object _waitingEncryptedMessagesSyncRoot = new object(); private List _waitingEncryptedMessages = new List(); private bool? ProcessEncryptedChatUpdate(TLUpdateBase update) { // typing var updateEncryptedChatTyping = update as TLUpdateEncryptedChatTyping; if (updateEncryptedChatTyping != null) { _eventAggregator.Publish(updateEncryptedChatTyping); return true; } // reading var updateEncryptedMessagesRead = update as TLUpdateEncryptedMessagesRead; if (updateEncryptedMessagesRead != null) { //Helpers.Execute.ShowDebugMessage(updateEncryptedMessagesRead.ToString()); var encryptedChat = _cacheService.GetEncryptedChat(updateEncryptedMessagesRead.ChatId) as TLEncryptedChat; if (encryptedChat != null) { var items = _cacheService.GetDecryptedHistory(encryptedChat.Id.Value, 100); Execute.BeginOnUIThread(() => { for (var i = 0; i < items.Count; i++) { if (items[i].Out.Value) { if (items[i].Status == MessageStatus.Confirmed) //&& Items[i].Date.Value <= update.MaxDate.Value) // здесь надо учитывать смещение по времени { items[i].Status = MessageStatus.Read; items[i].NotifyOfPropertyChange(() => items[i].Status); if (items[i].TTL != null && items[i].TTL.Value > 0) { var decryptedMessage = items[i] as TLDecryptedMessage17; if (decryptedMessage != null) { var decryptedPhoto = decryptedMessage.Media as TLDecryptedMessageMediaPhoto; if (decryptedPhoto != null && items[i].TTL.Value <= 60.0) { continue; } var decryptedVideo17 = decryptedMessage.Media as TLDecryptedMessageMediaVideo17; if (decryptedVideo17 != null && items[i].TTL.Value <= 60.0) { continue; } var decryptedAudio17 = decryptedMessage.Media as TLDecryptedMessageMediaAudio17; if (decryptedAudio17 != null && items[i].TTL.Value <= 60.0) { continue; } var decryptedDocument45 = decryptedMessage.Media as TLDecryptedMessageMediaDocument45; if (decryptedDocument45 != null && (items[i].IsVoice() || items[i].IsVideo()) && items[i].TTL.Value <= 60.0) { continue; } } items[i].DeleteDate = new TLLong(DateTime.Now.Ticks + encryptedChat.MessageTTL.Value * TimeSpan.TicksPerSecond); } } else if (items[i].Status == MessageStatus.Read) { var message = items[i] as TLDecryptedMessage; if (message != null) { break; } } } } var dialog = _cacheService.GetEncryptedDialog(encryptedChat.Id) as TLEncryptedDialog; if (dialog != null) { //dialog.UnreadCount = new TLInt(dialog.UnreadCount.Value - 1); var topMessage = dialog.TopMessage; if (topMessage != null) { dialog.NotifyOfPropertyChange(() => dialog.TopMessage); } } }); } //_eventAggregator.Publish(updateEncryptedMessagesRead); return true; } // message var updateNewEncryptedMessage = update as TLUpdateNewEncryptedMessage; if (updateNewEncryptedMessage != null) { var encryptedMessageBase = updateNewEncryptedMessage.Message; if (encryptedMessageBase != null) { var encryptedChat = _cacheService.GetEncryptedChat(encryptedMessageBase.ChatId) as TLEncryptedChat; if (encryptedChat == null) { var chat = _cacheService.GetEncryptedChat(encryptedMessageBase.ChatId); if (chat is TLEncryptedChatWaiting) { Debug.WriteLine(" >>ProcessEncryptedChatUpdate await TLUpdateNewEncryptedMessage chat_id=" + chat.Id); lock (_waitingEncryptedMessagesSyncRoot) { _waitingEncryptedMessages.Add(updateNewEncryptedMessage); } } else { Execute.ShowDebugMessage(string.Format("ProcessEncryptedChatUpdate chat_id={0} is not TLEncryptedChat ({1})", encryptedMessageBase.ChatId, chat != null ? chat.GetType() : null)); } return true; } TLDecryptedMessageBase decryptedMessage = null; try { bool commitChat; decryptedMessage = GetDecryptedMessage(MTProtoService.Instance.CurrentUserId, encryptedChat, encryptedMessageBase, updateNewEncryptedMessage.Qts, out commitChat); if (commitChat) { _cacheService.Commit(); } } catch (Exception ex) { Execute.ShowDebugMessage("ProcessEncryptedChatUpdate ex " + ex); } if (decryptedMessage == null) { return true; } var seqNoDecryptedMessage = decryptedMessage as ISeqNo; var encryptedChat17 = encryptedChat as TLEncryptedChat17; if (seqNoDecryptedMessage != null && encryptedChat17 != null) { var chatRawInSeqNo = encryptedChat17.RawInSeqNo.Value; var messageRawInSeqNo = GetRawInFromReceivedMessage(MTProtoService.Instance.CurrentUserId, encryptedChat17, seqNoDecryptedMessage); if (chatRawInSeqNo <= messageRawInSeqNo) { if (messageRawInSeqNo > chatRawInSeqNo) { Execute.ShowDebugMessage(string.Format("ProcessEncryptedChatUpdate decrypted message gap chatId={0} chatRawInSeqNo={1} messageRawInSeqNo={2}", encryptedChat17.Id, chatRawInSeqNo, messageRawInSeqNo)); } encryptedChat17.RawInSeqNo = new TLInt(chatRawInSeqNo + 1); _cacheService.SyncEncryptedChat(encryptedChat17, r => { }); } else { Execute.ShowDebugMessage(string.Format("ProcessEncryptedChatUpdate skip old decrypted message chatId={0} chatRawInSeqNo={1} messageRawInSeqNo={2}", encryptedChat17.Id, chatRawInSeqNo, messageRawInSeqNo)); return true; } } var decryptedMessageService = decryptedMessage as TLDecryptedMessageService; if (decryptedMessageService != null) { var readMessagesAction = decryptedMessageService.Action as TLDecryptedMessageActionReadMessages; if (readMessagesAction != null) { var items = _cacheService.GetDecryptedHistory(encryptedChat.Id.Value, 100); Execute.BeginOnUIThread(() => { foreach (var randomId in readMessagesAction.RandomIds) { foreach (var item in items) { if (item.RandomId.Value == randomId.Value) { item.Status = MessageStatus.Read; if (item.TTL != null && item.TTL.Value > 0) { item.DeleteDate = new TLLong(DateTime.Now.Ticks + encryptedChat.MessageTTL.Value * TimeSpan.TicksPerSecond); } var message = item as TLDecryptedMessage17; if (message != null) { var decryptedMediaPhoto = message.Media as TLDecryptedMessageMediaPhoto; if (decryptedMediaPhoto != null) { if (decryptedMediaPhoto.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = message.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = message.Out.Value; decryptedMediaPhoto.TTLParams = ttlParams; } } var decryptedMediaVideo17 = message.Media as TLDecryptedMessageMediaVideo17; if (decryptedMediaVideo17 != null) { if (decryptedMediaVideo17.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = message.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = message.Out.Value; decryptedMediaVideo17.TTLParams = ttlParams; } } var decryptedMediaAudio17 = message.Media as TLDecryptedMessageMediaAudio17; if (decryptedMediaAudio17 != null) { if (decryptedMediaAudio17.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = message.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = message.Out.Value; decryptedMediaAudio17.TTLParams = ttlParams; } } var decryptedMediaDocument45 = message.Media as TLDecryptedMessageMediaDocument45; if (decryptedMediaDocument45 != null && (message.IsVoice() || message.IsVideo())) { if (decryptedMediaDocument45.TTLParams == null) { var ttlParams = new TTLParams(); ttlParams.IsStarted = true; ttlParams.Total = message.TTL.Value; ttlParams.StartTime = DateTime.Now; ttlParams.Out = message.Out.Value; decryptedMediaDocument45.TTLParams = ttlParams; } var message45 = message as TLDecryptedMessage45; if (message45 != null) { message45.SetListened(); } decryptedMediaDocument45.NotListened = false; decryptedMediaDocument45.NotifyOfPropertyChange(() => decryptedMediaDocument45.NotListened); } } break; } } } }); } } var isDisplayedMessage = TLUtils.IsDisplayedDecryptedMessageInternal(decryptedMessage); if (!isDisplayedMessage) { decryptedMessage.Unread = TLBool.False; } ProcessPFS(SendEncryptedServiceAsync, _cacheService, _eventAggregator, encryptedChat, decryptedMessageService); ProcessNewLayer(SendEncryptedServiceAsync, _cacheService, _eventAggregator, encryptedChat, decryptedMessage); _eventAggregator.Publish(decryptedMessage); _cacheService.SyncDecryptedMessage(decryptedMessage, encryptedChat, cachedMessage => { SetState(null, null, updateNewEncryptedMessage.Qts, null, null, "ProcessEncryptedChatUpdate"); }); if (decryptedMessageService != null) { var resendAction = decryptedMessageService.Action as TLDecryptedMessageActionResend; if (resendAction != null) { Execute.ShowDebugMessage(string.Format("ProcessEncryptedChatUpdate TLDecryptedMessageActionResend start_seq_no={0} end_seq_no={1}", resendAction.StartSeqNo, resendAction.EndSeqNo)); } } return true; } } var updatePhoneCall = update as TLUpdatePhoneCall; if (updatePhoneCall != null) { try { _eventAggregator.Publish(updatePhoneCall); } catch (Exception ex) { TLUtils.WriteException("ProcessUpdateInternal", ex); } } // creating, new layer var updateEncryption = update as TLUpdateEncryption; if (updateEncryption != null) { var chatRequested = updateEncryption.Chat as TLEncryptedChatRequested; if (chatRequested != null) { _cacheService.SyncEncryptedChat(updateEncryption.Chat, result => _eventAggregator.Publish(result)); var message = new TLDecryptedMessageService17 { RandomId = TLLong.Random(), //RandomBytes = TLString.Random(Constants.MinRandomBytesLength), ChatId = chatRequested.Id, Action = new TLDecryptedMessageActionEmpty(), FromId = MTProtoService.Instance.CurrentUserId, Date = chatRequested.Date, Out = new TLBool(false), Unread = new TLBool(false), Status = MessageStatus.Read }; _cacheService.SyncDecryptedMessage(message, chatRequested, result => { }); GetDHConfigAsync(new TLInt(0), new TLInt(0), result => { var dhConfig = (TLDHConfig)result; if (!TLUtils.CheckPrime(dhConfig.P.Data, dhConfig.G.Value)) { return; } if (!TLUtils.CheckGaAndGb(chatRequested.GA.Data, dhConfig.P.Data)) { return; } //TODO: precalculate gb to improve speed var bBytes = new byte[256]; var random = new SecureRandom(); random.NextBytes(bBytes); //var b = TLString.FromBigEndianData(bBytes); var p = dhConfig.P; var g = dhConfig.G; updateEncryption.Chat.P = p; updateEncryption.Chat.G = g; var gbBytes = MTProtoService.GetGB(bBytes, dhConfig.G, dhConfig.P); var gb = TLString.FromBigEndianData(gbBytes); var key = MTProtoService.GetAuthKey(bBytes, chatRequested.GA.ToBytes(), dhConfig.P.ToBytes()); var keyHash = Utils.ComputeSHA1(key); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); AcceptEncryptionAsync( new TLInputEncryptedChat { AccessHash = chatRequested.AccessHash, ChatId = chatRequested.Id }, gb, keyFingerprint, chat => { chat.P = p; chat.G = g; chat.Key = TLString.FromBigEndianData(key); chat.KeyFingerprint = keyFingerprint; _cacheService.SyncEncryptedChat(chat, r2 => _eventAggregator.Publish(r2)); }, er => { Helpers.Execute.ShowDebugMessage("messages.acceptEncryption " + er); }); }, error => { Helpers.Execute.ShowDebugMessage("messages.getDhConfig error " + error); }); } var encryptedChat = updateEncryption.Chat as TLEncryptedChat; if (encryptedChat != null) { var waitingChat = _cacheService.GetEncryptedChat(encryptedChat.Id) as TLEncryptedChatWaiting; if (waitingChat != null) { _cacheService.SyncEncryptedChat(encryptedChat, syncedChat => { // to avoid raise conditions for TLUpdateEncryption and TLUpdateNewEncryptedMessage with layer notificaiton var updates = new List(); lock (_waitingEncryptedMessagesSyncRoot) { for (var i = 0; i < _waitingEncryptedMessages.Count; i++) { if (_waitingEncryptedMessages[i].Message.ChatId.Value == syncedChat.Index) { updates.Add(_waitingEncryptedMessages[i]); _waitingEncryptedMessages.RemoveAt(i--); } } } foreach (var u in updates) { Debug.WriteLine(" >>ProcessEncryptedChatUpdate process awaited TLUpdateNewEncryptedMessage chat_id=" + syncedChat.Id); ProcessEncryptedChatUpdate(u); } var syncedChat17 = _cacheService.GetEncryptedChat(encryptedChat.Id) as TLEncryptedChat17; if (syncedChat17 == null || syncedChat17.Layer.Value <= Constants.MinSecretSupportedLayer) { var layer = new TLInt(Constants.MinSecretSupportedLayer); var rawInSeqNo = new TLInt(0); var rawOutSeqNo = new TLInt(0); UpgradeSecretChatLayerAndSendNotification(SendEncryptedServiceAsync, _cacheService, _eventAggregator, encryptedChat, layer, rawInSeqNo, rawOutSeqNo); } }); } var encryptedChat17 = _cacheService.GetEncryptedChat(encryptedChat.Id) as TLEncryptedChat17; if (encryptedChat17 != null) { updateEncryption.Chat = encryptedChat17; } _cacheService.SyncEncryptedChat(updateEncryption.Chat, r => { _eventAggregator.Publish(r); }); } else { _cacheService.SyncEncryptedChat(updateEncryption.Chat, r => { _eventAggregator.Publish(r); }); } return true; } return null; } public static void ProcessNewLayer(SendEncryptedServiceAction sendEncryptedServiceActionAsync, ICacheService cacheService, ITelegramEventAggregator eventAggregator, TLEncryptedChatBase encryptedChatBase, TLDecryptedMessageBase decryptedMessageBase) { var seqNoMessage = decryptedMessageBase as ISeqNo; var encryptedChat8 = encryptedChatBase as TLEncryptedChat; var encryptedChat17 = encryptedChatBase as TLEncryptedChat17; var decryptedMessageService = decryptedMessageBase as TLDecryptedMessageService; if (seqNoMessage != null) { if (encryptedChat17 != null) { if (decryptedMessageService != null) { var notifyLayerAction = decryptedMessageService.Action as TLDecryptedMessageActionNotifyLayer; if (notifyLayerAction != null) { if (encryptedChat17.Layer.Value < notifyLayerAction.Layer.Value && notifyLayerAction.Layer.Value <= Constants.SecretSupportedLayer) { var layer = notifyLayerAction.Layer; var rawInSeqNo = encryptedChat17.RawInSeqNo; var rawOutSeqNo = encryptedChat17.RawOutSeqNo; UpgradeSecretChatLayerAndSendNotification(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat17, layer, rawInSeqNo, rawOutSeqNo); } } } } else if (encryptedChat8 != null) { var newLayer = Constants.SecretSupportedLayer; if (decryptedMessageService != null) { var actionNotifyLayer = decryptedMessageService.Action as TLDecryptedMessageActionNotifyLayer; if (actionNotifyLayer != null) { if (actionNotifyLayer.Layer.Value <= Constants.SecretSupportedLayer) { newLayer = actionNotifyLayer.Layer.Value; } } } var layer = new TLInt(newLayer); var rawInSeqNo = new TLInt(1); // one message was received var rawOutSeqNo = new TLInt(0); UpgradeSecretChatLayerAndSendNotification(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat8, layer, rawInSeqNo, rawOutSeqNo); } } else if (decryptedMessageService != null) { var notifyLayerAction = decryptedMessageService.Action as TLDecryptedMessageActionNotifyLayer; if (notifyLayerAction != null) { if (encryptedChat17 != null) { var newLayer = Constants.SecretSupportedLayer; if (notifyLayerAction.Layer.Value <= Constants.SecretSupportedLayer) { newLayer = notifyLayerAction.Layer.Value; } var layer = new TLInt(newLayer); var rawInSeqNo = new TLInt(0); var rawOutSeqNo = new TLInt(0); UpgradeSecretChatLayerAndSendNotification(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat17, layer, rawInSeqNo, rawOutSeqNo); } else if (encryptedChat8 != null) { var newLayer = Constants.SecretSupportedLayer; if (notifyLayerAction.Layer.Value <= Constants.SecretSupportedLayer) { newLayer = notifyLayerAction.Layer.Value; } var layer = new TLInt(newLayer); var rawInSeqNo = new TLInt(1); // one message was received var rawOutSeqNo = new TLInt(0); UpgradeSecretChatLayerAndSendNotification(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat8, layer, rawInSeqNo, rawOutSeqNo); } } } } public static void ProcessPFS(SendEncryptedServiceAction sendEncryptedServiceActionAsync, ICacheService cacheService, ITelegramEventAggregator eventAggregator, TLEncryptedChatBase encryptedChatBase, TLDecryptedMessageService decryptedMessageService) { var encryptedChat = encryptedChatBase as TLEncryptedChat20; if (encryptedChat == null) return; if (decryptedMessageService == null) return; var abortKey = decryptedMessageService.Action as TLDecryptedMessageActionAbortKey; if (abortKey != null) { encryptedChat.PFS_A = null; encryptedChat.PFS_ExchangeId = null; cacheService.SyncEncryptedChat(encryptedChat, cachedChat => { }); return; } var noop = decryptedMessageService.Action as TLDecryptedMessageActionNoop; if (noop != null) { return; } var commitKey = decryptedMessageService.Action as TLDecryptedMessageActionCommitKey; if (commitKey != null) { encryptedChat.PFS_A = null; encryptedChat.PFS_ExchangeId = null; encryptedChat.Key = encryptedChat.PFS_Key; encryptedChat.PFS_Key = null; cacheService.SyncEncryptedChat(encryptedChat, cachedChat => { eventAggregator.Publish(encryptedChat); var actionNoop = new TLDecryptedMessageActionNoop(); SendEncryptedServiceActionAsync(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat, actionNoop, (message, result) => { }); }); return; } var requestKey = decryptedMessageService.Action as TLDecryptedMessageActionRequestKey; if (requestKey != null) { var bBytes = new byte[256]; var random = new Random(); random.NextBytes(bBytes); var p = encryptedChat.P; var g = encryptedChat.G; var gbBytes = MTProtoService.GetGB(bBytes, g, p); var gb = TLString.FromBigEndianData(gbBytes); encryptedChat.PFS_A = TLString.FromBigEndianData(bBytes); encryptedChat.PFS_ExchangeId = requestKey.ExchangeId; if (!TLUtils.CheckGaAndGb(requestKey.GA.Data, encryptedChat.P.Data)) { return; } var key = MTProtoService.GetAuthKey(encryptedChat.PFS_A.Data, requestKey.GA.ToBytes(), encryptedChat.P.ToBytes()); var keyHash = Utils.ComputeSHA1(key); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); encryptedChat.PFS_Key = TLString.FromBigEndianData(key); encryptedChat.PFS_KeyFingerprint = keyFingerprint; cacheService.SyncEncryptedChat(encryptedChat, cachedChat => { var actionAcceptKey = new TLDecryptedMessageActionAcceptKey { ExchangeId = encryptedChat.PFS_ExchangeId, KeyFingerprint = keyFingerprint, GB = gb }; SendEncryptedServiceActionAsync(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat, actionAcceptKey, (message, result) => { }); }); return; } var acceptKey = decryptedMessageService.Action as TLDecryptedMessageActionAcceptKey; if (acceptKey != null) { if (!TLUtils.CheckGaAndGb(acceptKey.GB.Data, encryptedChat.P.Data)) { return; } var key = MTProtoService.GetAuthKey(encryptedChat.PFS_A.Data, acceptKey.GB.ToBytes(), encryptedChat.P.ToBytes()); var keyHash = Utils.ComputeSHA1(key); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); // abort for keyfingerprint != acceptKey.keyFingerprint if (keyFingerprint.Value != acceptKey.KeyFingerprint.Value) { var actionAbortKey = new TLDecryptedMessageActionAbortKey { ExchangeId = encryptedChat.PFS_ExchangeId }; SendEncryptedServiceActionAsync(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat, actionAbortKey, (message, result) => { encryptedChat.PFS_A = null; encryptedChat.PFS_ExchangeId = null; eventAggregator.Publish(encryptedChat); cacheService.Commit(); }); return; } encryptedChat.PFS_Key = TLString.FromBigEndianData(key); encryptedChat.PFS_KeyFingerprint = keyFingerprint; cacheService.SyncEncryptedChat(encryptedChat, cachedChat => { var actionCommitKey = new TLDecryptedMessageActionCommitKey { ExchangeId = encryptedChat.PFS_ExchangeId, KeyFingerprint = keyFingerprint }; SendEncryptedServiceActionAsync(sendEncryptedServiceActionAsync, cacheService, eventAggregator, encryptedChat, actionCommitKey, (message, result) => { encryptedChat.PFS_ExchangeId = null; if (encryptedChat.PFS_Key != null) { encryptedChat.Key = encryptedChat.PFS_Key; } encryptedChat.PFS_A = null; encryptedChat.PFS_KeyFingerprint = null; cacheService.SyncEncryptedChat(encryptedChat, cachedChat2 => { eventAggregator.Publish(encryptedChat); }); }); }); return; } } private static void SendEncryptedServiceActionAsync(SendEncryptedServiceAction sendEncryptedServiceAsync, ICacheService cacheService, ITelegramEventAggregator eventAggregator, TLEncryptedChat20 encryptedChat, TLDecryptedMessageActionBase action, Action callback) { if (encryptedChat == null) return; var randomId = TLLong.Random(); var currentUserId = MTProtoService.Instance.CurrentUserId; var clientTicksDelta = MTProtoService.Instance.ClientTicksDelta; var inSeqNo = TLUtils.GetInSeqNo(currentUserId, encryptedChat); var outSeqNo = TLUtils.GetOutSeqNo(currentUserId, encryptedChat); encryptedChat.RawOutSeqNo = new TLInt(encryptedChat.RawOutSeqNo.Value + 1); var message = new TLDecryptedMessageService17 { Action = action, RandomId = randomId, //RandomBytes = TLString.Random(Constants.MinRandomBytesLength), ChatId = encryptedChat.Id, FromId = currentUserId, Out = TLBool.True, Unread = TLBool.False, Date = TLUtils.DateToUniversalTimeTLInt(clientTicksDelta, DateTime.Now), Status = MessageStatus.Sending, TTL = new TLInt(0), InSeqNo = inSeqNo, OutSeqNo = outSeqNo }; var decryptedMessageLayer17 = TLUtils.GetDecryptedMessageLayer(encryptedChat.Layer, inSeqNo, outSeqNo, message); cacheService.SyncDecryptedMessage( message, encryptedChat, messageResult => { sendEncryptedServiceAsync( new TLInputEncryptedChat { AccessHash = encryptedChat.AccessHash, ChatId = encryptedChat.Id }, randomId, TLUtils.EncryptMessage(decryptedMessageLayer17, MTProtoService.Instance.CurrentUserId, encryptedChat), result => { message.Status = MessageStatus.Confirmed; cacheService.SyncSendingDecryptedMessage(encryptedChat.Id, result.Date, message.RandomId, m => { #if DEBUG eventAggregator.Publish(message); #endif callback.SafeInvoke(message, result); }); }, error => { Helpers.Execute.ShowDebugMessage("messages.sendEncryptedService error " + error); }); }); } public static void UpgradeSecretChatLayerAndSendNotification(SendEncryptedServiceAction sendEncryptedServiceAsync, ICacheService cacheService, ITelegramEventAggregator eventAggregator, TLEncryptedChat encryptedChat, TLInt layer, TLInt rawInSeqNo, TLInt rawOutSeqNo) { var newEncryptedChat = new TLEncryptedChat20(); newEncryptedChat.Layer = layer; newEncryptedChat.RawInSeqNo = rawInSeqNo; newEncryptedChat.RawOutSeqNo = rawOutSeqNo; //SetInitRawSeqNo(newEncryptedChat, MTProtoService.Instance.CurrentUserId); newEncryptedChat.Id = encryptedChat.Id; newEncryptedChat.AccessHash = encryptedChat.AccessHash; newEncryptedChat.Date = encryptedChat.Date; newEncryptedChat.AdminId = encryptedChat.AdminId; newEncryptedChat.ParticipantId = encryptedChat.ParticipantId; newEncryptedChat.GAorB = encryptedChat.GAorB; newEncryptedChat.CustomFlags = encryptedChat.CustomFlags; if (encryptedChat.OriginalKey != null) newEncryptedChat.OriginalKey = encryptedChat.OriginalKey; if (encryptedChat.ExtendedKey != null) newEncryptedChat.ExtendedKey = encryptedChat.ExtendedKey; newEncryptedChat.Key = encryptedChat.Key; newEncryptedChat.KeyFingerprint = encryptedChat.KeyFingerprint; newEncryptedChat.P = encryptedChat.P; newEncryptedChat.G = encryptedChat.G; newEncryptedChat.A = encryptedChat.A; newEncryptedChat.MessageTTL = encryptedChat.MessageTTL; cacheService.SyncEncryptedChat(newEncryptedChat, result => { eventAggregator.Publish(newEncryptedChat); var currentUserId = MTProtoService.Instance.CurrentUserId; var clientTicksDelta = MTProtoService.Instance.ClientTicksDelta; var randomId = TLLong.Random(); var notifyLayerAction = new TLDecryptedMessageActionNotifyLayer(); notifyLayerAction.Layer = new TLInt(Constants.SecretSupportedLayer); var inSeqNo = TLUtils.GetInSeqNo(currentUserId, newEncryptedChat); var outSeqNo = TLUtils.GetOutSeqNo(currentUserId, newEncryptedChat); var encryptedChat17 = result as TLEncryptedChat17; if (encryptedChat17 != null) { encryptedChat17.RawOutSeqNo = new TLInt(encryptedChat17.RawOutSeqNo.Value + 1); } var decryptedMessageService17 = new TLDecryptedMessageService17 { Action = notifyLayerAction, RandomId = randomId, //RandomBytes = TLString.Random(Constants.MinRandomBytesLength), ChatId = encryptedChat.Id, FromId = currentUserId, Out = TLBool.True, Unread = TLBool.False, Date = TLUtils.DateToUniversalTimeTLInt(clientTicksDelta, DateTime.Now), Status = MessageStatus.Sending, TTL = new TLInt(0), InSeqNo = inSeqNo, OutSeqNo = outSeqNo }; var decryptedMessageLayer17 = TLUtils.GetDecryptedMessageLayer(newEncryptedChat.Layer, inSeqNo, outSeqNo, decryptedMessageService17); cacheService.SyncDecryptedMessage( decryptedMessageService17, encryptedChat, messageResult => { sendEncryptedServiceAsync( new TLInputEncryptedChat { AccessHash = encryptedChat.AccessHash, ChatId = encryptedChat.Id }, randomId, TLUtils.EncryptMessage(decryptedMessageLayer17, MTProtoService.Instance.CurrentUserId, newEncryptedChat), sentEncryptedMessage => { decryptedMessageService17.Status = MessageStatus.Confirmed; cacheService.SyncSendingDecryptedMessage(encryptedChat.Id, sentEncryptedMessage.Date, decryptedMessageService17.RandomId, m => { #if DEBUG eventAggregator.Publish(decryptedMessageService17); #endif }); }, error => { Helpers.Execute.ShowDebugMessage("messages.sendEncryptedService error " + error); }); }); }); } public static int GetRawInFromReceivedMessage(TLInt currentUserId, TLEncryptedChat17 chat, ISeqNo message) { var isAdmin = chat.AdminId.Value == currentUserId.Value; var x = isAdmin ? 0 : 1; return (message.OutSeqNo.Value - x) / 2; } private readonly object _clientSeqLock = new object(); private readonly Dictionary> _lostSeq = new Dictionary>(); private void UpdateLostSeq(IList seqList, bool cleanupMissingSeq = false) { lock (_clientSeqLock) { if (ClientSeq != null) { if (seqList.Count > 0) { // add missing items if (seqList[0].Value > ClientSeq.Value + 1) { for (var i = ClientSeq.Value + 1; i < seqList[0].Value; i++) { _lostSeq[i] = new WindowsPhone.Tuple(DateTime.Now, new TLState { Seq = ClientSeq, Pts = _pts, Date = _date, Qts = _qts }); } } // remove received items for (var i = 0; i < seqList.Count; i++) { if (_lostSeq.ContainsKey(seqList[i].Value)) { TLUtils.WriteLine( DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " remove from Missing Seq List seq=" + seqList[i].Value + " time=" + (DateTime.Now - _lostSeq[seqList[i].Value].Item1), LogSeverity.Error); _lostSeq.Remove(seqList[i].Value); } } } } // cleanup (updates.getDifference, set initState, etc) if (cleanupMissingSeq) { _lostSeq.Clear(); } if (seqList.Count > 0) { var lastSeqValue = seqList.Last().Value; var maxSeqValue = Math.Max(lastSeqValue, ClientSeq != null ? ClientSeq.Value : -1); ClientSeq = new TLInt(maxSeqValue); } if (_lostSeq.Count > 0) { var missingSeqInfo = new StringBuilder(); foreach (var keyValue in _lostSeq) { missingSeqInfo.AppendLine(string.Format("seq={0}, date={1}", keyValue.Key, keyValue.Value.Item1.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture))); } StartLostSeqTimer(); TLUtils.WriteLine( DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Missing Seq List\n" + missingSeqInfo, LogSeverity.Error); } } } private readonly object _clientPtsLock = new object(); private readonly Dictionary> _lostPts = new Dictionary>(); private void UpdateLostPts(IList ptsList, bool cleanupMissingPts = false) { lock (_clientPtsLock) { if (_pts != null) { if (ptsList.Count > 0) { // add missing items if (ptsList[0].Value > _pts.Value + 1) { for (var i = _pts.Value + 1; i < ptsList[0].Value; i++) { _lostPts[i] = new WindowsPhone.Tuple(DateTime.Now, new TLState { Seq = ClientSeq, Pts = _pts, Date = _date, Qts = _qts }); } } // remove received items for (var i = 0; i < ptsList.Count; i++) { if (_lostPts.ContainsKey(ptsList[i].Value)) { TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " remove from Missing Pts List pts=" + ptsList[i].Value + " time=" + (DateTime.Now - _lostPts[ptsList[i].Value].Item1), LogSeverity.Error); _lostPts.Remove(ptsList[i].Value); } } } } // cleanup (updates.getDifference, set initState, etc) if (cleanupMissingPts) { _lostPts.Clear(); } if (ptsList.Count > 0) { var lastPtsValue = ptsList.Last().Value; var maxPtsValue = Math.Max(lastPtsValue, _pts != null ? _pts.Value : -1); _pts = new TLInt(maxPtsValue); } if (_lostPts.Count > 0) { var missingPtsInfo = new StringBuilder(); foreach (var keyValue in _lostPts) { missingPtsInfo.AppendLine(string.Format("pts={0}, date={1}", keyValue.Key, keyValue.Value.Item1.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture))); } StartLostPtsTimer(); TLUtils.WriteLine( DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " Missing Pts List\n" + missingPtsInfo, LogSeverity.Error); } } } private void ProcessUpdates(IList updatesList, IList updatesTooLong = null, bool notifyNewMessage = true) { try { #if DEBUG if (updatesTooLong != null && updatesTooLong.Count > 0) { //NOTE to get AUTH_KEY_UNREGISTERED GetStateAsync.SafeInvoke( result => { }, error => { Helpers.Execute.ShowDebugMessage("account.updateStatus error " + error); }); #if LOG_CLIENTSEQ Helpers.Execute.ShowDebugMessage(string.Format("{0} updatesTooLong clientSeq={1} pts={2}", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), ClientSeq, _pts)); TLUtils.WriteLine(string.Format("{0} updatesTooLong seq={1} pts={2}", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture), ClientSeq, _pts), LogSeverity.Error); //TLUtils.WriteLine(DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + " updatesTooLong clientSeq=" + ClientSeq, LogSeverity.Error); #endif } #endif var seqList = updatesList.SelectMany(updates => updates.GetSeq()).OrderBy(x => x.Value).ToList(); var ptsList = updatesList.SelectMany(updates => updates.GetPts()).OrderBy(x => x.Value).ToList(); /*#if DEBUG if (seqList.Count > 0) { var showDebugInfo = false; for (var i = 0; i < seqList.Count; i++) { if (seqList[i].Value == 0) { showDebugInfo = true; break; } } // only TLUpdateUserStatus here if (showDebugInfo) { var updateListInfo = new StringBuilder(); foreach (var updatesBase in updateList) { updateListInfo.AppendLine(updatesBase.ToString()); } Helpers.Execute.ShowDebugMessage("ProcessTransportMessage seqs=0 " + updateListInfo); } } #endif*/ #if LOG_CLIENTSEQ if (ptsList.Count > 0 || seqList.Count > 0) { var builder = new StringBuilder(); builder.AppendLine(string.Format("{0} ProcessTransportMessage", DateTime.Now.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture))); builder.AppendLine(string.Format("clientSeq={0} seqList={1}", ClientSeq, seqList.Count == 0 ? "null" : string.Join(", ", seqList))); builder.AppendLine(string.Format("pts={0} ptsList={1}", _pts, ptsList.Count == 0 ? "null" : string.Join(", ", ptsList))); TLUtils.WriteLine(builder.ToString(), LogSeverity.Error); } #endif if (GetDifferenceRequired(updatesList)) { var stopwatch = Stopwatch.StartNew(); Logs.Log.Write("UpdatesService.ProcessUpdates StartGetDifference"); GetDifference(1000, () => { var elapsed = stopwatch.Elapsed; Logs.Log.Write("UpdatesService.ProcessUpdates StopGetDifference time=" + elapsed); }); return; } var processUpdates = false; if (updatesList.Count > 0) { if (seqList.Count > 0) { UpdateLostSeq(seqList); } if (ptsList.Count > 0) { UpdateLostPts(ptsList); } processUpdates = true; } if (processUpdates) { ProcessReading(updatesList); foreach (var updatesItem in updatesList) { ProcessUpdatesInternal(updatesItem, notifyNewMessage); } } return; } catch (Exception e) { TLUtils.WriteLine("Error during processing update: ", LogSeverity.Error); TLUtils.WriteException(e); } } private bool GetDifferenceRequired(IList updatesList) { var getDifferenceRequired = false; for (int i = 0; i < updatesList.Count; i++) { var updatesShortChatMessage = updatesList[i] as TLUpdatesShortChatMessage; if (updatesShortChatMessage != null) { var user = _cacheService.GetUser(updatesShortChatMessage.UserId); if (user == null) { var logString = string.Format("ProcessUpdates.UpdatesShortChatMessage: user is missing (userId={0}, msgId={1})", updatesShortChatMessage.UserId, updatesShortChatMessage.Id); Logs.Log.Write(logString); getDifferenceRequired = true; break; } var chat = _cacheService.GetChat(updatesShortChatMessage.ChatId); if (chat == null) { var logString = string.Format("ProcessUpdates.UpdatesShortChatMessage: chat is missing (chatId={0}, msgId={1})", updatesShortChatMessage.ChatId, updatesShortChatMessage.Id); Logs.Log.Write(logString); getDifferenceRequired = true; break; } } var updatesShortMessage = updatesList[i] as TLUpdatesShortMessage; if (updatesShortMessage != null) { var user = _cacheService.GetUser(updatesShortMessage.UserId); if (user == null) { var logString = string.Format("ProcessUpdates.UpdatesShortMessage: user is missing (userId={0}, msgId={1})", updatesShortMessage.UserId, updatesShortMessage.Id); Logs.Log.Write(logString); getDifferenceRequired = true; break; } } } return getDifferenceRequired; } private void ProcessReading(IList updatesList) { var readHistoryInboxList = new List(); var readHistoryOutboxList = new List(); var newChatMessageList = new List(); var newMessageList = new List(); var shortChatMessageList = new List(); var shortMessageList = new List(); foreach (var updatesBase in updatesList) { var updatesShort = updatesBase as TLUpdatesShort; if (updatesShort != null) { GetReadingUpdates(updatesShort.Update, readHistoryInboxList, readHistoryOutboxList, newChatMessageList, newMessageList); continue; } var updates = updatesBase as TLUpdates; if (updates != null) { foreach (var updateBase in updates.Updates) { GetReadingUpdates(updateBase, readHistoryInboxList, readHistoryOutboxList, newChatMessageList, newMessageList); } continue; } var shortChatMessage = updatesBase as TLUpdatesShortChatMessage34; if (shortChatMessage != null && shortChatMessage.Unread.Value) { shortChatMessageList.Add(shortChatMessage); continue; } var shortMessage = updatesBase as TLUpdatesShortMessage34; if (shortMessage != null && shortMessage.Unread.Value) { shortMessageList.Add(shortMessage); continue; } } ProcessReadingUpdates(false, readHistoryInboxList, shortChatMessageList, newChatMessageList, shortMessageList, newMessageList); ProcessReadingUpdates(true, readHistoryOutboxList, shortChatMessageList, newChatMessageList, shortMessageList, newMessageList); } private static void ProcessReadingUpdates( bool outbox, IList readHistoryList, IList shortChatMessageList, IList newChatMessageList, IList shortMessageList, IList newMessageList) { if (readHistoryList.Count == 0) return; foreach (var readHistory in readHistoryList) { var peerChat = readHistory.Peer as TLPeerChat; if (peerChat != null) { for (var i = 0; i < shortChatMessageList.Count; i++) { if (shortChatMessageList[i].Out.Value == outbox && peerChat.Id.Value == shortChatMessageList[i].ChatId.Value && readHistory.MaxId.Value >= shortChatMessageList[i].Id.Value) { shortChatMessageList[i].Unread = TLBool.False; shortChatMessageList.RemoveAt(i--); } } for (var i = 0; i < newChatMessageList.Count; i++) { var message = newChatMessageList[i].Message as TLMessageCommon; if (message != null && message.Out.Value == outbox) { if (message.Out.Value == outbox && peerChat.Id.Value == message.ToId.Id.Value && readHistory.MaxId.Value >= message.Id.Value) { message.SetUnreadSilent(TLBool.False); newChatMessageList.RemoveAt(i--); } } } continue; } var peerUser = readHistory.Peer as TLPeerUser; if (peerUser != null) { for (var i = 0; i < shortMessageList.Count; i++) { if (shortMessageList[i].Out.Value == outbox && peerUser.Id.Value == shortMessageList[i].UserId.Value && readHistory.MaxId.Value >= shortMessageList[i].Id.Value) { shortMessageList[i].Unread = TLBool.False; shortMessageList.RemoveAt(i--); } } for (var i = 0; i < newMessageList.Count; i++) { var message = newMessageList[i].Message as TLMessageCommon; if (message != null) { if (message.Out.Value == outbox && peerUser.Id.Value == message.FromId.Value && readHistory.MaxId.Value >= message.Id.Value) { message.SetUnreadSilent(TLBool.False); newMessageList.RemoveAt(i--); } } } continue; } } } private static void GetReadingUpdates(TLUpdateBase updateBase, IList readHistoryInboxList, IList readHistoryOutboxList, IList newChatMessageList, IList newMessageList) { var readHistoryInbox = updateBase as TLUpdateReadHistoryInbox; if (readHistoryInbox != null) { readHistoryInboxList.Add(readHistoryInbox); return; } var readHistoryOutbox = updateBase as TLUpdateReadHistoryOutbox; if (readHistoryOutbox != null) { readHistoryOutboxList.Add(readHistoryOutbox); return; } var newMessage = updateBase as TLUpdateNewMessage; if (newMessage != null) { var message = newMessage.Message as TLMessageCommon; if (message != null && message.Unread.Value) { var peerChat = message.ToId as TLPeerChat; if (peerChat != null) { newChatMessageList.Add(newMessage); return; } var peerUser = message.ToId as TLPeerUser; if (peerUser != null) { newMessageList.Add(newMessage); return; } } } } public void ProcessUpdates(TLUpdatesBase updates, bool notifyNewMessages = false) { var updatesList = new List { updates }; var updatesTooLongList = new List(); var updatesTooLong = updates as TLUpdatesTooLong; if (updatesTooLong != null) { updatesTooLongList.Add(updatesTooLong); } ProcessUpdates(updatesList, updatesTooLongList, notifyNewMessages); } public void ProcessTransportMessage(TLTransportMessage transportMessage) { try { var isUpdating = false; lock (_getDifferenceRequestRoot) { if (_getDifferenceRequests.Count > 0) { isUpdating = true; } } if (isUpdating) { //Execute.ShowDebugMessage("UpdatesService.ProcessTransportMessage Skip"); return; } var updatesList = TLUtils.FindInnerObjects(transportMessage).ToList(); var updatesTooLong = TLUtils.FindInnerObjects(transportMessage).ToList(); ProcessUpdates(updatesList, updatesTooLong); } catch (Exception e) { TLUtils.WriteLine("Error during processing update: ", LogSeverity.Error); TLUtils.WriteException(e); } } private readonly object _stateRoot = new object(); public void LoadStateAndUpdate(long acceptedCallId, Action callback) { var id = new Random().Next(999); TLUtils.WritePerformance(">>Loading current state and updating"); if (_pts == null || _date == null || _qts == null) { var state = TLUtils.OpenObjectFromMTProtoFile(_stateRoot, Constants.StateFileName); #if DEBUG_UPDATES state.Pts = new TLInt(140000); #endif SetState(state, "setFileState"); TLUtils.WritePerformance("Current state: " + state); FileUtils.Copy(_stateRoot, Constants.StateFileName, Constants.TempStateFileName); } Logs.Log.Write(string.Format("UpdatesService.LoadStateAndUpdate {0} client_state=[p={1} d={2} q={3}]", id, _pts, _date, _qts)); LoadFileState(); var stopwatch = Stopwatch.StartNew(); Logs.Log.Write(string.Format("UpdatesService.LoadStateAndUpdate {0} start GetDifference", id)); AddRequest(id); //TLObject.LogNotify = true; //TelegramEventAggregator.LogPublish = true; GetDifference(id, () => { var elapsed = stopwatch.Elapsed; Logs.Log.Write(string.Format("UpdatesService.LoadStateAndUpdate {0} stop GetDifference elapsed={1}", id, elapsed)); //TLObject.LogNotify = false; //TelegramEventAggregator.LogPublish = false; RemoveRequest(id); callback.SafeInvoke(); }); } private readonly object _differenceSyncRoot = new object(); private readonly object _differenceTimeSyncRoot = new object(); private void LoadFileState() { var stopwatch = Stopwatch.StartNew(); var difference = TLUtils.OpenObjectFromMTProtoFile>(_differenceSyncRoot, Constants.DifferenceFileName); Logs.Log.Write("UpdatesService.LoadStateAndUpdate start LoadFileState"); if (difference != null && difference.Count > 0) { CleanupDifference(difference); var ptsList = string.Join(", ", difference.OfType().Select(x => x.State.Pts)); Logs.Log.Write(string.Format("UpdatesService.LoadStateAndUpdate ptsList=[{0}]", ptsList)); foreach (var differenceBase in difference) { var stopwatchProcessDiff = Stopwatch.StartNew(); var diff = differenceBase as TLDifference; if (diff != null) { var resetEvent = new ManualResetEvent(false); lock (_clientSeqLock) { SetState(diff.State, "loadFileState"); } ProcessDifference(diff, () => resetEvent.Set()); #if DEBUG resetEvent.WaitOne(); #else resetEvent.WaitOne(10000); #endif var otherInfo = new StringBuilder(); if (diff.OtherUpdates.Count > 0) { otherInfo.AppendLine(); for (var i = 0; i < diff.OtherUpdates.Count; i++) { otherInfo.AppendLine(diff.OtherUpdates[i].ToString()); } } Logs.Log.Write(string.Format("UpdatesService.LoadFileState processDiff state=[{0}] messages={1} other={2} elapsed={3}{4}", diff.State, diff.NewMessages.Count, diff.OtherUpdates.Count, stopwatchProcessDiff.Elapsed, otherInfo)); } } Logs.Log.Write("UpdatesService.LoadStateAndUpdate LoadFileState publish UpdateCompletedEventArgs"); Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new UpdateCompletedEventArgs())); } Logs.Log.Write("UpdatesService.LoadStateAndUpdate stop LoadFileState elapsed=" + stopwatch.Elapsed); FileUtils.Copy(_differenceSyncRoot, Constants.DifferenceFileName, Constants.TempDifferenceFileName); FileUtils.Delete(_differenceSyncRoot, Constants.DifferenceFileName); FileUtils.Delete(_differenceTimeSyncRoot, Constants.DifferenceTimeFileName); } private void CleanupDifference(TLVector list) { var updateChannelTooLongCache = new Dictionary(); var updateChannelCache = new Dictionary(); var hasUpdateDialogPinned = false; var updatePhoneCallDiscardedCache = new Dictionary(); foreach (var differenceBase in list) { var differenceSlice = differenceBase as TLDifference; if (differenceSlice != null) { var updates = differenceSlice.OtherUpdates; for (var i = 0; i < updates.Count; i++) { var updateChannelTooLong = updates[i] as TLUpdateChannelTooLong; if (updateChannelTooLong != null) { if (updateChannelTooLongCache.ContainsKey(updateChannelTooLong.ChannelId.Value)) { updates.RemoveAt(i--); } else { updateChannelTooLongCache[updateChannelTooLong.ChannelId.Value] = updateChannelTooLong.ChannelId.Value; } } var updatePhoneCall = updates[i] as TLUpdatePhoneCall; if (updatePhoneCall != null) { var phoneCallDiscarded = updatePhoneCall.PhoneCall as TLPhoneCallDiscarded61; if (phoneCallDiscarded != null) { updatePhoneCallDiscardedCache[phoneCallDiscarded.Id.Value] = phoneCallDiscarded.Id.Value; } } } } } foreach (var differenceBase in list) { var differenceSlice = differenceBase as TLDifference; if (differenceSlice != null) { var updates = differenceSlice.OtherUpdates; for (var i = 0; i < updates.Count; i++) { var updateChannel = updates[i] as TLUpdateChannel; if (updateChannel != null) { if (updateChannelTooLongCache.ContainsKey(updateChannel.ChannelId.Value)) { updates.RemoveAt(i--); } else if (updateChannelCache.ContainsKey(updateChannel.ChannelId.Value)) { updates.RemoveAt(i--); } else { updateChannelCache[updateChannel.ChannelId.Value] = updateChannel.ChannelId.Value; } } var updatePinnedDialogs = updates[i] as TLUpdatePinnedDialogs; if (updatePinnedDialogs != null) { if (hasUpdateDialogPinned) { updates.RemoveAt(i--); } else { hasUpdateDialogPinned = true; updatePinnedDialogs.Order = null; } } var updatePhoneCall = updates[i] as TLUpdatePhoneCall; if (updatePhoneCall != null) { var phoneCallDiscarded = updatePhoneCall.PhoneCall as TLPhoneCallDiscarded61; if (phoneCallDiscarded == null) { if (updatePhoneCallDiscardedCache.ContainsKey(updatePhoneCall.PhoneCall.Id.Value)) { updates.RemoveAt(i--); } } } } } } } public void SaveState() { var state = new TLState { Date = _date, Pts = _pts, Qts = _qts, Seq = ClientSeq, UnreadCount = _unreadCount }; TLUtils.WritePerformance("<(_stateRoot, Path.Combine(fromDirectoryName, Constants.StateFileName)); if (state != null) { lock (_clientSeqLock) { ClientSeq = state.Seq; } _date = state.Date ?? _date; _pts = state.Pts ?? _pts; _qts = state.Qts ?? _qts; _unreadCount = state.UnreadCount ?? _unreadCount; SaveState(); } FileUtils.Copy(_differenceSyncRoot, Path.Combine(fromDirectoryName, Constants.DifferenceFileName), Constants.DifferenceFileName); } public void ClearState() { _date = null; _pts = null; _qts = null; ClientSeq = null; _unreadCount = null; FileUtils.Delete(_stateRoot, Constants.StateFileName); } } public class DCOptionsUpdatedEventArgs : EventArgs { public TLUpdateDCOptions Update { get; set; } } public class UpdatingEventArgs : EventArgs { } public class UpdateCompletedEventArgs : EventArgs { public IList UpdateChannelTooLongList { get; set; } } public class UpdateChannelsEventArgs : EventArgs { public IList UpdateChannelTooLongList { get; set; } } public class ChannelUpdateCompletedEventArgs { public TLInt ChannelId { get; set; } } } ================================================ FILE: Telegram.Api/Services/VoIP/IVoIPService.cs ================================================ using Telegram.Api.TL; namespace Telegram.Api.Services.VoIP { public interface IVoIPService { void StartOutgoingCall(TLInputUserBase userId); } } ================================================ FILE: Telegram.Api/Services/VoIP/VoIPService.cs ================================================ using System; using System.Text; using Windows.Storage; #if WINDOWS_PHONE using libtgvoip; #endif using Org.BouncyCastle.Security; using Telegram.Api.Aggregator; using Telegram.Api.Helpers; using Telegram.Api.Services.Cache; using Telegram.Api.TL; namespace Telegram.Api.Services.VoIP { public class VoIPService : IVoIPService, IHandle #if WINDOWS_PHONE , IStateCallback #endif { private const int CALL_MIN_LAYER = 65; private const int CALL_MAX_LAYER = 65; private readonly IMTProtoService _mtProtoService; private readonly ITelegramEventAggregator _eventAggregator; private readonly ICacheService _cacheService; public VoIPService(IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator, ICacheService cacheService) { _mtProtoService = mtProtoService; _eventAggregator = eventAggregator; _cacheService = cacheService; _eventAggregator.Subscribe(this); #if WINDOWS_PHONE MicrosoftCryptoImpl.Init(); var input = Encoding.UTF8.GetBytes("test"); var result1 = MicrosoftCryptoImpl.SHA1_test(input, (uint) input.Length); var result2 = Utils.ComputeSHA1(input); for (int i = 0; i < result1.Length; i++) { if (result1[i] != result2[i]) { throw new Exception("sha1 i=" + i); } } var result3 = MicrosoftCryptoImpl.SHA256_test(input, (uint)input.Length); var result4 = Utils.ComputeSHA256(input); for (int i = 0; i < result1.Length; i++) { if (result3[i] != result4[i]) { throw new Exception("sha1 i=" + i); } } var keyString = "01234567890123456789012345678901"; var ivString = "01234567890123456789012345678901"; var key = Encoding.UTF8.GetBytes(keyString); var iv = Encoding.UTF8.GetBytes(ivString); var result5 = MicrosoftCryptoImpl.AesIgeEncrypt_test(input, (uint)input.Length, key, iv); key = Encoding.UTF8.GetBytes(keyString); iv = Encoding.UTF8.GetBytes(ivString); var result6 = MicrosoftCryptoImpl.AesIgeDecrypt_test(result5, (uint)input.Length, key, iv); key = Encoding.UTF8.GetBytes(keyString); iv = Encoding.UTF8.GetBytes(ivString); var result7 = Utils.AesIge(input, key, iv, true); var result8 = Utils.AesIge(result7, key, iv, false); #endif } private TLString _secretP; private TLString _secretRandom; private TLInt _secretG; private TLInt _lastVersion; private byte[] _ga; private TLPhonePhoneCall _call; private byte[] _aOrB; private byte[] _authKey; private bool _outgoing = true; #if WINDOWS_PHONE private VoIPControllerWrapper _controller; #endif public void StartOutgoingCall(TLInputUserBase userId) { var salt = new Byte[256]; var random = new SecureRandom(); random.NextBytes(salt); var version = _lastVersion ?? new TLInt(0); var randomLength = new TLInt(256); _mtProtoService.GetDHConfigAsync(version, randomLength, result => { ConfigureDeviceForCall(); ShowNotifications(); StartConnectionSound(); DispatchStateChanged(PhoneCallState.STATE_REQUESTING); _eventAggregator.Publish(new PhoneCallEventArgs("NotificationCenter.didStartedCall")); var dhConfig = result as TLDHConfig; if (dhConfig != null) { if (!TLUtils.CheckPrime(dhConfig.P.Data, dhConfig.G.Value)) { CallFailed(); return; } _secretP = dhConfig.P; _secretG = dhConfig.G; _secretRandom = dhConfig.Random; } for (var i = 0; i < 256; i++) { salt[i] = (byte) (salt[i] ^ _secretRandom.Data[i]); } var gaBytes = MTProtoService.GetGB(salt, _secretG, _secretP); var protocol = new TLPhoneCallProtocol { Flags = new TLInt(0), UdpP2P = true, UdpReflector = true, MinLayer = new TLInt(CALL_MIN_LAYER), MaxLayer = new TLInt(CALL_MAX_LAYER) }; _ga = gaBytes; var gaHash = Utils.ComputeSHA256(_ga); _mtProtoService.RequestCallAsync(userId, TLInt.Random(), TLString.FromBigEndianData(gaHash), protocol, result2 => { _call = result2; _aOrB = salt; DispatchStateChanged(PhoneCallState.STATE_WAITING); //if (_endCallAfterRequest) //{ // Hangup(); // return; //} }, error2 => { }); }, error => { Helpers.Execute.ShowDebugMessage("messages.getDHConfig error " + error); CallFailed(); }); } private void DispatchStateChanged(PhoneCallState phoneCallState) { } private void StartConnectionSound() { } private void ShowNotifications() { } private void ConfigureDeviceForCall() { } private void CallFailed() { } public void Handle(TLUpdatePhoneCall updatePhoneCall) { var phoneCall = updatePhoneCall.PhoneCall; var phoneCallAccepted = phoneCall as TLPhoneCallAccepted; if (phoneCallAccepted != null) { if (_authKey == null) { ProcessAcceptedCall(phoneCallAccepted); } return; } } private void ProcessAcceptedCall(TLPhoneCallAccepted phoneCallAccepted) { DispatchStateChanged(PhoneCallState.STATE_EXCHANGING_KEYS); if (!TLUtils.CheckGaAndGb(phoneCallAccepted.GB.Data, _secretP.Data)) { CallFailed(); return; } _authKey = MTProtoService.GetAuthKey(_aOrB, phoneCallAccepted.GB.ToBytes(), _secretP.ToBytes()); var keyHash = Utils.ComputeSHA1(_authKey); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); var peer = new TLInputPhoneCall { Id = phoneCallAccepted.Id, AccessHash = phoneCallAccepted.AccessHash }; var protocol = new TLPhoneCallProtocol { Flags = new TLInt(0), UdpP2P = true, UdpReflector = true, MinLayer = new TLInt(CALL_MIN_LAYER), MaxLayer = new TLInt(CALL_MAX_LAYER) }; _mtProtoService.ConfirmCallAsync(peer, TLString.FromBigEndianData(_ga), keyFingerprint, protocol, result => { _call = result; InitiateActualEncryptedCall(); }, error => { CallFailed(); }); } private void InitiateActualEncryptedCall() { #if WINDOWS_PHONE _mtProtoService.GetCallConfigAsync(result => { VoIPControllerWrapper.UpdateServerConfig(result.Data.ToString()); var logFile = ApplicationData.Current.LocalFolder.Path + "\\tgvoip.logFile.txt"; var statsDumpFile = ApplicationData.Current.LocalFolder.Path + "\\tgvoip.statsDump.txt"; if (_controller != null) { //_controller.Dispose(); _controller = null; } _cacheService.GetConfigAsync(config => { var config60 = config as TLConfig60; if (config60 != null) { _controller = new VoIPControllerWrapper(); _controller.SetConfig(config60.CallPacketTimeoutMs.Value / 1000.0, config60.CallConnectTimeoutMs.Value / 1000.0, DataSavingMode.Never, false, false, true, logFile, statsDumpFile); _controller.SetStateCallback(this); _controller.SetEncryptionKey(_authKey, _outgoing); var phoneCall = _call.PhoneCall as TLPhoneCall; if (phoneCall != null) { var connection = phoneCall.Connection; var endpoints = new Endpoint[phoneCall.AlternativeConnections.Count + 1]; endpoints[0] = connection.ToEndpoint(); for (int i = 0; i < phoneCall.AlternativeConnections.Count; i++) { connection = phoneCall.AlternativeConnections[i]; endpoints[i + 1] = connection.ToEndpoint(); } _controller.SetPublicEndpoints(endpoints, phoneCall.Protocol.UdpP2P); _controller.Start(); _controller.Connect(); } } }); }, error => { }); #endif } #if WINDOWS_PHONE public void OnCallStateChanged(CallState newState) { Execute.ShowDebugMessage("OnCallStateChanged state=" + newState); } #endif } public class PhoneCallEventArgs { public string Param { get; set; } public PhoneCallEventArgs(string param) { Param = param; } } public enum PhoneCallState { STATE_WAIT_INIT = 1, STATE_WAIT_INIT_ACK = 2, STATE_ESTABLISHED = 3, STATE_FAILED = 4, STATE_HANGING_UP = 5, STATE_ENDED = 6, STATE_EXCHANGING_KEYS = 7, STATE_WAITING = 8, STATE_REQUESTING = 9, STATE_WAITING_INCOMING = 10, STATE_RINGING = 11, STATE_BUSY = 12, } } ================================================ FILE: Telegram.Api/TL/Account/TLChangePhone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLChangePhone : TLObject { public const string Signature = "#70c32edb"; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public TLString PhoneCode { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes(), PhoneCode.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLCheckPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLCheckPassword : TLObject { public const uint Signature = 0xd18b4d16; public TLInputCheckPasswordBase Password { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Password.ToBytes()); } } class TLCheckPasswordOld : TLObject { public const string Signature = "#a63011e"; public TLString PasswordHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PasswordHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLConfirmPhone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLConfirmPhone : TLObject { public const uint Signature = 0x5f2178c3; public TLString PhoneCodeHash { get; set; } public TLString PhoneCode { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneCodeHash.ToBytes(), PhoneCode.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLGetAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLGetAuthorizations : TLObject { public const uint Signature = 0xe320c158; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLGetPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLGetPassword : TLObject { public const string Signature = "#548a30f5"; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLGetPasswordSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLGetPasswordSettings : TLObject { public const uint Signature = 0x9cd4eaf9; public TLInputCheckPasswordBase Password { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Password.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLGetTmpPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLGetTmpPassword : TLObject { public const uint Signature = 0x449e0b51; public TLInputCheckPasswordBase Password { get; set; } public TLInt Period { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Password.ToBytes(), Period.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLGetWallPapers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLGetWallPapers : TLObject { public const string Signature = "#c04cfac2"; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLRecoverPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLRecoverPassword : TLObject { public const string Signature = "#4ea56e92"; public TLString Code { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Code.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLReportPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLReportPeer : TLObject { public const uint Signature = 0xae189d5f; public TLInputPeerBase Peer { get; set; } public TLInputReportReasonBase Reason { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Reason.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLRequestPasswordRecovery.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLRequestPasswordRecovery : TLObject { public const string Signature = "#d897bc66"; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLResetAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLResetAuthorization : TLObject { public const uint Signature = 0xdf77f3bc; public TLLong Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLResetPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Telegram.Api.TL.Account { class TLResetPassword { } } ================================================ FILE: Telegram.Api/TL/Account/TLSendChangePhoneCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Account { [Flags] public enum SendChangePhoneCode { AllowFlashcall = 0x1, // 0 } class TLSendChangePhoneCode : TLObject { public const uint Signature = 0x8e57deb; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString PhoneNumber { get; set; } private TLString _currentNumber; public TLString CurrentNumber { get { return _currentNumber; } set { SetField(out _currentNumber, value, ref _flags, (int)SendChangePhoneCode.AllowFlashcall); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), ToBytes(CurrentNumber, Flags, (int)SendChangePhoneCode.AllowFlashcall)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLSendConfirmPhoneCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Account { [Flags] public enum SendConfirmPhoneCodeFlags { AllowFlashcall = 0x1, // 0 } class TLSendConfirmPhoneCode : TLObject { public const uint Signature = 0x1516d7bd; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Hash { get; set; } private TLBool _currentNumber; public TLBool CurrentNumber { get { return _currentNumber; } set { SetField(out _currentNumber, value, ref _flags, (int)SendConfirmPhoneCodeFlags.AllowFlashcall); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Hash.ToBytes(), ToBytes(CurrentNumber, Flags, (int)SendConfirmPhoneCodeFlags.AllowFlashcall)); } } } ================================================ FILE: Telegram.Api/TL/Account/TLSetPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLSetPassword : TLObject { public const string Signature = "#dd2a4d8f"; public TLString CurrentPasswordHash { get; set; } public TLString NewSalt { get; set; } public TLString NewPasswordHash { get; set; } public TLString Hint { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), CurrentPasswordHash.ToBytes(), NewSalt.ToBytes(), NewPasswordHash.ToBytes(), Hint.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLUpdateDeviceLocked.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLUpdateDeviceLocked : TLObject { public const string Signature = "#38df3532"; public TLInt Period { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Period.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Account/TLUpdatePasswordSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { class TLUpdatePasswordSettings : TLObject { public const uint Signature = 0xa59b102f; public TLInputCheckPasswordBase Password { get; set; } public TLPasswordInputSettings NewSettings { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Password.ToBytes(), NewSettings.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Enums.cs ================================================ namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLCheckUsername.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { public class TLCheckUsername : TLObject { public const string Signature = "#2714d86c"; public TLString Username { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Username.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLDeleteAccount.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLDeleteAccount : TLObject { public const string Signature = "#418d4e0b"; public TLString Reason { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Reason.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLGetAccountTTL.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLGetAccountTTL : TLObject { public const string Signature = "#8fc711d"; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLSetAccountTTL : TLObject { public const string Signature = "#2442485e"; public TLAccountDaysTTL TTL { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), TTL.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLGetNotifySettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLGetNotifySettings : TLObject { public const string Signature = "#12b3ad31"; public TLInputNotifyPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLGetPrivacy.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLGetPrivacy : TLObject { public const string Signature = "#dadbc950"; public TLInputPrivacyKeyBase Key { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Key.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLRegisterDevice.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { public class TLRegisterDevice : TLObject { public const uint Signature = 0x5cbea590; public TLInt TokenType { get; set; } public TLString Token { get; set; } public TLBool AppSandbox { get; set; } public TLString Secret { get; set; } public TLVector OtherUids { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), TokenType.ToBytes(), Token.ToBytes(), AppSandbox.ToBytes(), Secret.ToBytes(), OtherUids.ToBytes()); } public override string ToString() { return string.Format("token_type={0}\ntoken={1}", TokenType, Token); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLResetNotifySettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLResetNotifySettings : TLObject { public const string Signature = "#db7e1747"; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLSetPrivacy.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLSetPrivacy : TLObject { public const string Signature = "#c9f81ce8"; public TLInputPrivacyKeyBase Key { get; set; } public TLVector Rules { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Key.ToBytes(), Rules.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLUnregisterDevice.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { public class TLUnregisterDevice : TLObject { public const string Signature = "#65c55b40"; public TLInt TokenType { get; set; } public TLString Token { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), TokenType.ToBytes(), Token.ToBytes()); } public override string ToString() { return string.Format("token_type={0}\ntoken={1}", TokenType, Token); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLUpdateNotifySettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLUpdateNotifySettings : TLObject { public const string Signature = "#84be5b93"; public TLInputNotifyPeerBase Peer { get; set; } public TLInputPeerNotifySettings Settings { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Settings.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLUpdateProfile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Account { [Flags] public enum UpdateProfileFlags { FirstName = 0x1, // 0 LastName = 0x2, // 1 About = 0x4, // 2 } public class TLUpdateProfile : TLObject { public const uint Signature = 0x78515775; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLString _firstName; public TLString FirstName { get { return _firstName; } set { SetField(out _firstName, value, ref _flags, (int)UpdateProfileFlags.FirstName); } } private TLString _lastName; public TLString LastName { get { return _lastName; } set { SetField(out _lastName, value, ref _flags, (int)UpdateProfileFlags.LastName); } } private TLString _about; public TLString About { get { return _about; } set { SetField(out _about, value, ref _flags, (int)UpdateProfileFlags.About); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(FirstName, Flags, (int)UpdateProfileFlags.FirstName), ToBytes(LastName, Flags, (int)UpdateProfileFlags.LastName), ToBytes(About, Flags, (int)UpdateProfileFlags.About)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLUpdateStatus.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLUpdateStatus : TLObject { public const string Signature = "#6628562c"; public TLBool Offline { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offline.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Account/TLUpdateUserName.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Account { public class TLUpdateUserName : TLObject { public const string Signature = "#3e0bdd7c"; public TLString Username { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Username.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLCancelCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLCancelCode : TLObject { public const uint Signature = 0x1f040578; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLCheckPhone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLCheckPhone : TLObject { public const string Signature = "#6fe51dfb"; public TLString PhoneNumber { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLExportAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLExportAuthorization : TLObject { public const string Signature = "#e5bfffcd"; public TLInt DCId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), DCId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLImportAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLImportAuthorization : TLObject { public const string Signature = "#e3ef9613"; public TLInt Id { get; set; } public TLString Bytes { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Bytes.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLLogOut.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLLogOut : TLObject { public const string Signature = "#5717da40"; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLResendCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLResendCode : TLObject { public const uint Signature = 0x3ef1a9bf; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLResetAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLResetAuthorizations : TLObject { public const string Signature = "#9fab0d1a"; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSendCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLSendCall : TLObject { public const string Signature = "#3c51564"; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSendCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Auth { [Flags] public enum SendCode { AllowFlashcall = 0x1, // 0 } class TLSendCode : TLObject { public const uint Signature = 0x86aef0ec; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString PhoneNumber { get; set; } private TLString _currentNumber; public TLString CurrentNumber { get { return _currentNumber; } set { SetField(out _currentNumber, value, ref _flags, (int)SendCode.AllowFlashcall); } } public TLInt ApiId { get; set; } public TLString ApiHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), ToBytes(CurrentNumber, Flags, (int)SendCode.AllowFlashcall), ApiId.ToBytes(), ApiHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSendInvites.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLSendInvites : TLObject { public const string Signature = "#771c1d97"; public TLVector PhoneNumbers { get; set; } public TLString Message { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumbers.ToBytes(), Message.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSendSms.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLSendSms : TLObject { public const string Signature = "#da9f3e8"; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSignIn.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { class TLSignIn : TLObject { public const string Signature = "#bcd51581"; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public TLString PhoneCode { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes(), PhoneCode.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Auth/TLSignUp.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { public class TLSignUp : TLObject { public const string Signature = "#1b067634"; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public TLString PhoneCode { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes(), PhoneCode.ToBytes(), FirstName.ToBytes(), LastName.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLCheckUsername.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLCheckUsername : TLObject { public const uint Signature = 0x10e6bd2c; public TLInputChannelBase Channel { get; set; } public TLString Username { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Username.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLCreateChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLCreateChannel : TLObject { public const uint Signature = 0xf4893d7f; public TLInt Flags { get; set; } public TLString Title { get; set; } public TLString About { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Title.ToBytes(), About.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLDeleteChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLDeleteChannel : TLObject { public const uint Signature = 0xc0111fe3; public TLInputChannelBase Channel { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLDeleteChannelMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLDeleteChannelMessages : TLObject { public const uint Signature = 0x84c1fd4e; public TLInputChannelBase Channel { get; set; } public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLDeleteHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLDeleteHistory : TLObject { public const uint Signature = 0xaf369d42; public TLInputChannelBase Channel { get; set; } public TLInt MaxId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), MaxId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLDeleteUserHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLDeleteUserHistory : TLObject { public const uint Signature = 0xd10dd71b; public TLInputChannelBase Channel { get; set; } public TLInputUserBase UserId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), UserId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLEditAbout.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLEditAbout : TLObject { public const uint Signature = 0x13e27f1e; public TLInputChannelBase Channel { get; set; } public TLString About { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), About.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLEditAdmin.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLEditAdmin : TLObject { public const uint Signature = 0x20b88214; public TLInputChannelBase Channel { get; set; } public TLInputUserBase UserId { get; set; } public TLChannelAdminRights AdminRights { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), UserId.ToBytes(), AdminRights.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLEditMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Channels { [Flags] public enum EditMessageFlags { // 0 NoWebPage = 0x2, // 1 ReplyMarkup = 0x4, // 2 Entities = 0x8, // 3 Message = 0x800, // 11 StopGeoLive = 0x1000, // 12 GeoPoint = 0x2000, // 13 Media = 0x4000, // 14 } class TLEditMessage : TLObject { public const uint Signature = 0xc000e4c8; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } public TLInt Id { get; set; } private TLString _message; public TLString Message { get { return _message; } set { SetField(out _message, value, ref _flags, (int)EditMessageFlags.Message); } } private TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)EditMessageFlags.Entities); } } private TLInputMediaBase _media; public TLInputMediaBase Media { get { return _media; } set { SetField(out _media, value, ref _flags, (int)EditMessageFlags.Media); } } private TLReplyKeyboardBase _replyMarkup; public TLReplyKeyboardBase ReplyMarkup { get { return _replyMarkup; } set { SetField(out _replyMarkup, value, ref _flags, (int)EditMessageFlags.ReplyMarkup); } } public bool NoWebPage { get { return IsSet(Flags, (int)EditMessageFlags.NoWebPage); } set { SetUnset(ref _flags, value, (int)EditMessageFlags.NoWebPage); } } private TLInputGeoPointBase _geoPoint; public TLInputGeoPointBase GeoPoint { get { return _geoPoint; } set { SetField(out _geoPoint, value, ref _flags, (int)EditMessageFlags.GeoPoint); } } public bool StopGeoLive { get { return IsSet(Flags, (int)EditMessageFlags.StopGeoLive); } set { SetUnset(ref _flags, value, (int)EditMessageFlags.StopGeoLive); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), Id.ToBytes(), ToBytes(Message, Flags, (int)EditMessageFlags.Message), ToBytes(Media, Flags, (int)EditMessageFlags.Media), ToBytes(ReplyMarkup, Flags, (int)EditMessageFlags.ReplyMarkup), ToBytes(Entities, Flags, (int)EditMessageFlags.Entities), ToBytes(GeoPoint, Flags, (int)EditMessageFlags.GeoPoint)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLEditPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { public class TLEditPhoto : TLObject { public const uint Signature = 0xf12e57c9; public TLInputChannelBase Channel { get; set; } public TLInputChatPhotoBase Photo { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Photo.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLEditTitle.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLEditTitle : TLObject { public const uint Signature = 0x566decd0; public TLInputChannelBase Channel { get; set; } public TLString Title { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Title.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLExportInvite.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLExportInvite : TLObject { public const uint Signature = 0xc7560885; public TLInputChannelBase Channel { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLExportMessageLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLExportMessageLink : TLObject { public const uint Signature = 0xc846d22d; public TLInputChannelBase Channel { get; set; } public TLInt Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetAdminedPublicChannels.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetAdminedPublicChannels : TLObject { public const uint Signature = 0x8d8d82d7; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetChannels.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetChannels : TLObject { public const uint Signature = 0xa7f6bbb; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetDialogs : TLObject { public const uint Signature = 0xa9d3d249; public TLInt Offset { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetFullChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetFullChannel : TLObject { public const uint Signature = 0x08736a09; public TLInputChannelBase Channel { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetImportantHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetImportantHistory : TLObject { public const uint Signature = 0x8f494bb2; public TLInputChannelBase Channel { get; set; } public TLInt OffsetId { get; set; } public TLInt OffsetDate { get; set; } public TLInt AddOffset { get; set; } public TLInt Limit { get; set; } public TLInt MaxId { get; set; } public TLInt MinId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), OffsetId.ToBytes(), OffsetDate.ToBytes(), AddOffset.ToBytes(), Limit.ToBytes(), MaxId.ToBytes(), MinId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetMessageEditData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetMessageEditData : TLObject { public const uint Signature = 0xfda68d36; public TLInputPeerBase Peer { get; set; } public TLInt Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetMessages : TLObject { public const uint Signature = 0xad8c9a23; public TLInputChannelBase Channel { get; set; } public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetParticipant.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetParticipant : TLObject { public const uint Signature = 0x546dd7a6; public TLInputChannelBase Channel { get; set; } public TLInputUserBase UserId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), UserId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLGetParticipants.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLGetParticipants : TLObject { public const uint Signature = 0x123e05e9; public TLInputChannelBase Channel { get; set; } public TLChannelParticipantsFilterBase Filter { get; set; } public TLInt Offset { get; set; } public TLInt Limit { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Filter.ToBytes(), Offset.ToBytes(), Limit.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLInviteToChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLInviteToChannel : TLObject { public const uint Signature = 0x199f3a6c; public TLInputChannelBase Channel { get; set; } public TLVector Users { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Users.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLJoinChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLJoinChannel : TLObject { public const uint Signature = 0x24b524c5; public TLInputChannelBase Channel { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLKickFromChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLKickFromChannel : TLObject { public const uint Signature = 0xa672de14; public TLInputChannelBase Channel { get; set; } public TLInputUserBase UserId { get; set; } public TLBool Kicked { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), UserId.ToBytes(), Kicked.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLLeaveChannel.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLLeaveChannel : TLObject { public const uint Signature = 0xf836aa95; public TLInputChannelBase Channel { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLReadHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.TL.Functions.Channels { public class TLReadChannelHistory : TLObject, IRandomId { public const uint Signature = 0xcc104937; public TLInputChannelBase Channel { get; set; } public TLInt MaxId { get; set; } public TLLong RandomId { get; set; } public TLReadChannelHistory() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), MaxId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Channel.ToStream(output); MaxId.ToStream(output); } public override TLObject FromStream(Stream input) { Channel = GetObject(input); MaxId = GetObject(input); return this; } public override string ToString() { return string.Format("TLReadChannelHistory max_id={0} peer=[{1}]", MaxId, Channel); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLReadMessageContents.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.TL.Functions.Channels { class TLReadMessageContents : TLObject, IRandomId { public const uint Signature = 0xeab5dc38; public TLInputChannelBase Channel { get; set; } public TLVector Id { get; set; } public TLLong RandomId { get; set; } public TLReadMessageContents() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Channel.ToStream(output); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Channel = GetObject(input); Id = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLReportSpam.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLReportSpam : TLObject { public const uint Signature = 0xfe087810; public TLInputChannelBase Channel { get; set; } public TLInt UserId { get; set; } public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), UserId.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLSetStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLSetStickers : TLObject { public const uint Signature = 0xea8ca4f9; public TLInputChannelBase Channel { get; set; } public TLInputStickerSetBase StickerSet { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), StickerSet.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLToggleComments.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLToggleComments : TLObject { public const uint Signature = 0xaaa29e88; public TLInputChannelBase Channel { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLToggleInvites.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLToggleInvites : TLObject { public const uint Signature = 0x49609307; public TLInputChannelBase Channel { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLTogglePreHistoryHidden.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLTogglePreHistoryHidden : TLObject { public const uint Signature = 0xeabbb94c; public TLInputChannelBase Channel { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLToggleSignatures.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLToggleSignatures : TLObject { public const uint Signature = 0x1f69b606; public TLInputChannelBase Channel { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLUpdateChannelUsername.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLUpdateUsername : TLObject { public const uint Signature = 0x3514b3de; public TLInputChannelBase Channel { get; set; } public TLString Username { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Username.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Channels/TLUpdatePinnedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.TL.Functions.Channels { [Flags] public enum UpdatePinnedMessageFlags { Silent = 0x1, } class TLUpdatePinnedMessage : TLObject { public const uint Signature = 0xa72ded52; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputChannelBase Channel { get; set; } public TLInt Id { get; set; } public void SetSilent() { Set(ref _flags, (int)UpdatePinnedMessageFlags.Silent); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Channel.ToBytes(), Id.ToBytes() ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Channel.ToStream(output); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Channel = GetObject(input); Id = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLBlock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLBlock : TLObject { public const string Signature = "#332b49fc"; public TLInputUserBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLDeleteContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLDeleteContact : TLObject { public const string Signature = "#8e953744"; public TLInputUserBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLDeleteContacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLDeleteContacts : TLObject { public const uint Signature = 0x59ab389e; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLGetBlocked.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLGetBlocked : TLObject { public const string Signature = "#f57c350f"; public TLInt Offset { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLGetContacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLGetContacts : TLObject { public const uint Signature = 0xc023849f; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLGetStatuses.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLGetStatuses : TLObject { public const uint Signature = 0xc4a353ee; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLGetTopPeers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Contacts { [Flags] public enum GetTopPeersFlags { Correspondents = 0x1, BotsPM = 0x2, BotsInline = 0x4, Groups = 0x400, Channels = 0x8000, } class TLGetTopPeers : TLObject { public const uint Signature = 0xd4982db5; public TLInt Flags { get; set; } public TLInt Offset { get; set; } public TLInt Limit { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Offset.ToBytes(), Limit.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLImportContacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLImportContacts : TLObject { public const uint Signature = 0x2c800be5; public TLVector Contacts { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Contacts.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLResetSaved.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { class TLResetSaved : TLObject { public const uint Signature = 0x879537f1; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLResetTopPeerRating.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { class TLResetTopPeerRating : TLObject { public const uint Signature = 0x1ae373ac; public TLTopPeerCategoryBase Category { get; set; } public TLInputPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Category.ToBytes(), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLResolveUsername.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { class TLResolveUsername : TLObject { public const uint Signature = 0xf93ccba3; public TLString Username { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Username.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLSearch.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLSearch : TLObject { public const string Signature = "#11f812d8"; public TLString Q { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Q.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Contacts/TLUnblock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { public class TLUnblock : TLObject { public const string Signature = "#e54100bd"; public TLInputUserBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/DHKeyExchange/TLReqDHParams.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.DHKeyExchange { public class TLReqDHParams : TLObject { public const string Signature = "#d712e4be"; public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLString P { get; set; } public TLString Q { get; set; } public TLLong PublicKeyFingerprint { get; set; } public TLString EncryptedData { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.ToBytes(), ServerNonce.ToBytes(), P.ToBytes(), Q.ToBytes(), PublicKeyFingerprint.ToBytes(), EncryptedData.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/DHKeyExchange/TLReqPQ.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.DHKeyExchange { public class TLReqPQ : TLObject { public const string Signature = "#60469778"; public TLInt128 Nonce { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.Value); } } } ================================================ FILE: Telegram.Api/TL/Functions/DHKeyExchange/TLSetClientDHParams.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.DHKeyExchange { public class TLSetClientDHParams : TLObject { public const string Signature = "#f5045f1f"; public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLString EncryptedData { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.ToBytes(), ServerNonce.ToBytes(), EncryptedData.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetAppChangelog.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetAppChangelog : TLObject { public const uint Signature = 0xb921197a; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetCdnConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetCdnConfig : TLObject { public const uint Signature = 0x52029342; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetConfig : TLObject { public const uint Signature = 0xc4f9186b; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetInviteText.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetInviteText : TLObject { public const uint Signature = 0x4d392343; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetNearestDC.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetNearestDC : TLObject { public const string Signature = "#1fb33026"; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetRecentMeUrls.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Telegram.Api.TL.Functions.Help { class TLGetRecentMeUrls { } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetSupport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetSupport : TLObject { public const string Signature = "#9cdf08cd"; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLGetTermsOfService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetTermsOfService : TLObject { public const uint Signature = 0x8e59b7e7; public TLString CountryISO2 { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), CountryISO2.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLInvokeWithLayerN.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLInvokeWithLayer : TLObject { public const string Signature = "#da9b0d0d"; public TLInt Layer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Layer.ToBytes()); } } public class TLInvokeWithLayerN : TLObject { public const string Signature2 = "#289dd1f6"; public const string Signature3 = "#b7475268"; public const string Signature4 = "#dea0d430"; public const string Signature5 = "#417a57ae"; public const string Signature6 = "#3a64d54d"; public const string Signature7 = "#a5be56d3"; public const string Signature8 = "#e9abd9fd"; public const string Signature9 = "#76715a63"; public const string Signature10 = "#39620c41"; public const string Signature11 = "#a6b88fdf"; public const string Signature12 = "#dda60d3c"; public const string Signature13 = "#427c8ea2"; public const string Signature14 = "#2b9b08fa"; public const string Signature15 = "#b4418b64"; public const string Signature16 = "#cf5f0987"; public const string Signature17 = "#50858a19"; public const string Signature18 = "#1c900537"; //public const string Signature19 = "#da9b0d0d"; public TLObject Data { get; set; } public override byte[] ToBytes() { byte[] signature; if (Constants.SupportedLayer == 85) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 84) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 83) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 82) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 81) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 80) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 79) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 78) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 76) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 75) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 74) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 73) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 72) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 71) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 70) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 69) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 68) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 67) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 66) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 65) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 64) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 63) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 62) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 61) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 60) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 59) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 58) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 57) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 56) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 55) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 54) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 53) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 52) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 51) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 50) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 49) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 48) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 47) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 46) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 45) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 44) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 43) { signature = new TLInvokeWithLayer { Layer = new TLInt(Constants.SupportedLayer) }.ToBytes(); } if (Constants.SupportedLayer == 42) { signature = new TLInvokeWithLayer { Layer = new TLInt(42) }.ToBytes(); } if (Constants.SupportedLayer == 41) { signature = new TLInvokeWithLayer { Layer = new TLInt(41) }.ToBytes(); } if (Constants.SupportedLayer == 40) { signature = new TLInvokeWithLayer { Layer = new TLInt(40) }.ToBytes(); } if (Constants.SupportedLayer == 39) { signature = new TLInvokeWithLayer { Layer = new TLInt(39) }.ToBytes(); } if (Constants.SupportedLayer == 38) { signature = new TLInvokeWithLayer { Layer = new TLInt(38) }.ToBytes(); } if (Constants.SupportedLayer == 37) { signature = new TLInvokeWithLayer { Layer = new TLInt(37) }.ToBytes(); } if (Constants.SupportedLayer == 36) { signature = new TLInvokeWithLayer { Layer = new TLInt(36) }.ToBytes(); } if (Constants.SupportedLayer == 35) { signature = new TLInvokeWithLayer { Layer = new TLInt(35) }.ToBytes(); } if (Constants.SupportedLayer == 34) { signature = new TLInvokeWithLayer { Layer = new TLInt(34) }.ToBytes(); } if (Constants.SupportedLayer == 33) { signature = new TLInvokeWithLayer { Layer = new TLInt(33) }.ToBytes(); } if (Constants.SupportedLayer == 32) { signature = new TLInvokeWithLayer { Layer = new TLInt(32) }.ToBytes(); } if (Constants.SupportedLayer == 31) { signature = new TLInvokeWithLayer { Layer = new TLInt(31) }.ToBytes(); } if (Constants.SupportedLayer == 30) { signature = new TLInvokeWithLayer { Layer = new TLInt(30) }.ToBytes(); } if (Constants.SupportedLayer == 29) { signature = new TLInvokeWithLayer { Layer = new TLInt(29) }.ToBytes(); } if (Constants.SupportedLayer == 28) { signature = new TLInvokeWithLayer { Layer = new TLInt(28) }.ToBytes(); } if (Constants.SupportedLayer == 27) { signature = new TLInvokeWithLayer { Layer = new TLInt(27) }.ToBytes(); } if (Constants.SupportedLayer == 26) { signature = new TLInvokeWithLayer { Layer = new TLInt(26) }.ToBytes(); } if (Constants.SupportedLayer == 25) { signature = new TLInvokeWithLayer { Layer = new TLInt(25) }.ToBytes(); } if (Constants.SupportedLayer == 24) { signature = new TLInvokeWithLayer { Layer = new TLInt(24) }.ToBytes(); } if (Constants.SupportedLayer == 23) { signature = new TLInvokeWithLayer { Layer = new TLInt(23) }.ToBytes(); } if (Constants.SupportedLayer == 22) { signature = new TLInvokeWithLayer { Layer = new TLInt(22) }.ToBytes(); } if (Constants.SupportedLayer == 21) { signature = new TLInvokeWithLayer { Layer = new TLInt(21) }.ToBytes(); } if (Constants.SupportedLayer == 20) { signature = new TLInvokeWithLayer { Layer = new TLInt(20) }.ToBytes(); } if (Constants.SupportedLayer == 19) { signature = new TLInvokeWithLayer { Layer = new TLInt(19) }.ToBytes(); } if (Constants.SupportedLayer == 18) { signature = TLUtils.SignatureToBytes(Signature18); } if (Constants.SupportedLayer == 17) { signature = TLUtils.SignatureToBytes(Signature17); } if (Constants.SupportedLayer == 16) { signature = TLUtils.SignatureToBytes(Signature16); } if (Constants.SupportedLayer == 15) { signature = TLUtils.SignatureToBytes(Signature15); } if (Constants.SupportedLayer == 14) { signature = TLUtils.SignatureToBytes(Signature14); } if (Constants.SupportedLayer == 13) { signature = TLUtils.SignatureToBytes(Signature13); } if (Constants.SupportedLayer == 12) { signature = TLUtils.SignatureToBytes(Signature12); } if (Constants.SupportedLayer == 11) { signature = TLUtils.SignatureToBytes(Signature11); } if (Constants.SupportedLayer == 1) { signature = new byte[] { }; } if (Constants.SupportedLayer == 2) { signature = TLUtils.SignatureToBytes(Signature2); } if (Constants.SupportedLayer == 3) { signature = TLUtils.SignatureToBytes(Signature3); } if (Constants.SupportedLayer == 4) { signature = TLUtils.SignatureToBytes(Signature4); } if (Constants.SupportedLayer == 5) { signature = TLUtils.SignatureToBytes(Signature5); } if (Constants.SupportedLayer == 6) { signature = TLUtils.SignatureToBytes(Signature6); } if (Constants.SupportedLayer == 7) { signature = TLUtils.SignatureToBytes(Signature7); } if (Constants.SupportedLayer == 8) { signature = TLUtils.SignatureToBytes(Signature8); } if (Constants.SupportedLayer == 9) { signature = TLUtils.SignatureToBytes(Signature9); } if (Constants.SupportedLayer == 10) { signature = TLUtils.SignatureToBytes(Signature10); } return TLUtils.Combine(signature, Data.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Help/TLInvokeWithoutUpdates.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLInvokeWithoutUpdates : TLObject { public const uint Signature = 0xbf9459b7; public TLObject Object { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Object.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Langpack/TLGetDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Langpack { class TLGetDifference : TLObject { public const uint Signature = 0xb2e4d7d; public TLInt FromVersion { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FromVersion.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Langpack/TLGetLangPack.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Langpack { class TLGetLangPack : TLObject { public const uint Signature = 0x9ab5c58e; public TLString LangCode { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), LangCode.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Langpack/TLGetLanguages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Langpack { class TLGetLanguages : TLObject { public const uint Signature = 0x800fd57d; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Langpack/TLGetStrings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Langpack { class TLGetStrings : TLObject { public const uint Signature = 0x2e1ee318; public TLString LangCode { get; set; } public TLVector Keys { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), LangCode.ToBytes(), Keys.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLAcceptEncryption.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLAcceptEncryption : TLObject { public const string Signature = "#3dbc0415"; public TLInputEncryptedChat Peer { get; set; } public TLString GB { get; set; } public TLLong KeyFingerprint { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), GB.ToBytes(), KeyFingerprint.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLAddChatUser.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLAddChatUser : TLObject { public const string Signature = "#f9a0aa09"; public TLInt ChatId { get; set; } public TLInputUserBase UserId { get; set; } public TLInt FwdLimit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), UserId.ToBytes(), FwdLimit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLBotGetCallbackAnswer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum GetBotCallbackAnswerFlags { Data = 0x1, Game = 0x2, } class TLGetBotCallbackAnswer : TLObject { public const uint Signature = 0x810a9fec; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } public TLInt MessageId { get; set; } private TLString _data; public TLString Data { get { return _data; } set { SetField(out _data, value, ref _flags, (int) GetBotCallbackAnswerFlags.Data); } } public void SetGame() { Set(ref _flags, (int) GetBotCallbackAnswerFlags.Game); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), MessageId.ToBytes(), ToBytes(Data, Flags, (int) GetBotCallbackAnswerFlags.Data)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLCheckChatInvite.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLCheckChatInvite : TLObject { public const uint Signature = 0x3eadb1bb; public TLString Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLClearRecentStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum ClearRecentStickersFlags { Attached = 0x1 } class TLClearRecentStickers : TLObject { public const uint Signature = 0x8999602d; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public void SetAttached() { Set(ref _flags, (int) ClearRecentStickersFlags.Attached); } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLCreateChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLCreateChat : TLObject { public const string Signature = "#419d9aee"; public TLVector Users { get; set; } public TLString Title { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Users.ToBytes(), Title.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLDeactivateChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLDeactivateChat : TLObject { public const uint Signature = 0x626f0b41; public TLInt ChatId { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLDeleteChatUser.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLDeleteChatUser : TLObject { public const string Signature = "#e0611f16"; public TLInt ChatId { get; set; } public TLInputUserBase UserId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), UserId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLDeleteHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum DeleteHistoryFlags { JustClear = 0x1, } class TLDeleteHistory : TLObject { public const uint Signature = 0x1c015b09; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } public TLInt MaxId { get; set; } public void SetJustClear() { Set(ref _flags, (int) DeleteHistoryFlags.JustClear); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), MaxId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLDeleteMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum DeleteMessagesFlags { Revoke = 0x1, // 0 } class TLDeleteMessages : TLObject { public const uint Signature = 0xe58e95d2; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLVector Id { get; set; } public bool Revoke { get { return IsSet(Flags, (int) DeleteMessagesFlags.Revoke); } set { SetUnset(ref _flags, value, (int) DeleteMessagesFlags.Revoke); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLDiscardEncryption.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLDiscardEncryption : TLObject { public const string Signature = "#edd923c5"; public TLInt ChatId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLEditChatAdmin.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLEditChatAdmin : TLObject { public const uint Signature = 0xa9e69f2e; public TLInt ChatId { get; set; } public TLInputUserBase UserId { get; set; } public TLBool IsAdmin { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), UserId.ToBytes(), IsAdmin.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLEditChatPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLEditChatPhoto : TLObject { public const string Signature = "#ca4c79d8"; public TLInt ChatId { get; set; } public TLInputChatPhotoBase Photo { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), Photo.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLEditChatTitle.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLEditChatTitle : TLObject { public const string Signature = "#dc452855"; public TLInt ChatId { get; set; } public TLString Title { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), Title.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLEditGeoLive.cs ================================================ using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum EditGeoLiveFlags { Stop = 0x1, GeoPoint = 0x2 } public class TLEditGeoLive : TLObject { public const uint Signature = 0x9a92304e; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Stop { get { return IsSet(_flags, (int) EditGeoLiveFlags.Stop); } set { SetUnset(ref _flags, value, (int) EditGeoLiveFlags.Stop); } } public TLInputPeerBase Peer { get; set; } public TLInt Id { get; set; } private TLInputGeoPointBase _geoPoint; public TLInputGeoPointBase GeoPoint { get { return _geoPoint; } set { SetField(out _geoPoint, value, ref _flags, (int) EditGeoLiveFlags.GeoPoint); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), Id.ToBytes(), ToBytes(GeoPoint, _flags, (int) EditGeoLiveFlags.GeoPoint)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLExportChatInvite.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLExportChatInvite : TLObject { public const string Signature = "#7d885289"; public TLInt ChatId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLFaveSticker.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLFaveSticker : TLObject { public const uint Signature = 0xb9ffc55b; public TLInputDocumentBase Id { get; set; } public TLBool Unfave { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Unfave.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLForwardMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLForwardMessage : TLObject, IRandomId { public const uint Signature = 0x3f3f4f2; public TLInputPeerBase Peer { get; set; } public TLInt Id { get; set; } public TLLong RandomId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Id.ToBytes(), RandomId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); Id.ToStream(output); RandomId.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); Id = GetObject(input); RandomId = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLForwardMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLForwardMessages : TLObject, IRandomId { public const uint Signature = 0x708e0195; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase FromPeer { get; set; } public TLInputPeerBase ToPeer { get; set; } public TLVector Id { get; set; } public TLVector RandomIds { get; set; } public TLLong RandomId { get { if (RandomIds != null && RandomIds.Count > 0) { return RandomIds[0]; } return new TLLong(0); } } public void SetChannelMessage() { Set(ref _flags, (int) SendFlags.Channel); } public void SetSilent() { Set(ref _flags, (int) SendFlags.Silent); } public void SetWithMyScore() { Set(ref _flags, (int) SendFlags.WithMyScore); } public void SetGrouped() { Set(ref _flags, (int)SendFlags.Grouped); } public static string ForwardMessagesFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (SendFlags) flags.Value; return string.Format("{0} [{1}]", flags, list); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), FromPeer.ToBytes(), Id.ToBytes(), RandomIds.ToBytes(), ToPeer.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); FromPeer.ToStream(output); Id.ToStream(output); RandomIds.ToStream(output); ToPeer.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); FromPeer = GetObject(input); Id = GetObject>(input); RandomIds = GetObject>(input); ToPeer = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetAllDrafts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLGetAllDrafts : TLObject { public const uint Signature = 0x6a3f8d65; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetAllStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetAllStickers : TLObject { public const uint Signature = 0x1c9618b1; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetArchivedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum GetArchivedStickersFlags { Masks = 0x1, } class TLGetArchivedStickers : TLObject { public const uint Signature = 0x57f17692; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLLong OffsetId { get; set; } public TLInt Limit { get; set; } public void SetMasks() { Set(ref _flags, (int) GetArchivedStickersFlags.Masks); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), OffsetId.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetAttachedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetAttachedStickers : TLObject { public const uint Signature = 0xcc5b67cc; public TLInputStickeredMediaBase Media { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Media.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetChats.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetChats : TLObject { public const string Signature = "#3c6aa187"; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetCommonChats.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetCommonChats : TLObject { public const uint Signature = 0xd0a48c4; public TLInputUserBase User { get; set; } public TLInt MaxId { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), User.ToBytes(), MaxId.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetDHConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetDHConfig : TLObject { public const string Signature = "#26cf8950"; public TLInt Version { get; set; } public TLInt RandomLength { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Version.ToBytes(), RandomLength.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum GetDialogsFlags { ExcludePinned = 0x1, FeedId = 0x2, } class TLGetDialogs : TLObject { public const uint Signature = 0xb098aee6; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool ExcludePinned { get { return IsSet(Flags, (int) GetDialogsFlags.ExcludePinned); } set { SetUnset(ref _flags, value, (int) GetDialogsFlags.ExcludePinned); } } //private TLInt _feedId; //public TLInt FeedId //{ // get { return _feedId; } // set { SetField(out _feedId, value, ref _flags, (int)GetDialogsFlags.FeedId); } //} public TLInt OffsetDate { get; set; } public TLInt OffsetId { get; set; } public TLInputPeerBase OffsetPeer { get; set; } public TLInt Limit { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), //ToBytes(FeedId, Flags, (int)GetDialogsFlags.FeedId), OffsetDate.ToBytes(), OffsetId.ToBytes(), OffsetPeer.ToBytes(), Limit.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetDocumentByHash.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetDocumentByHash : TLObject { public const uint Signature = 0x338e2464; public TLString Sha256 { get; set; } public TLInt Size { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Sha256.ToBytes(), Size.ToBytes(), MimeType.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetFavedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetFavedStickers : TLObject { public const uint Signature = 0x21ce0b0e; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetFeaturedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetFeaturedStickers : TLObject { public const uint Signature = 0x2dacca4f; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetFullChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetFullChat : TLObject { public const string Signature = "#3b831c66"; public TLInt ChatId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetHistory : TLObject { public const uint Signature = 0xdcbb8260; public TLInputPeerBase Peer { get; set; } public TLInt OffsetId { get; set; } public TLInt OffsetDate { get; set; } public TLInt AddOffset { get; set; } public TLInt Limit { get; set; } public TLInt MaxId { get; set; } public TLInt MinId { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), OffsetId.ToBytes(), OffsetDate.ToBytes(), AddOffset.ToBytes(), Limit.ToBytes(), MaxId.ToBytes(), MinId.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetInlineBotResults.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum GetInlineBotResultsFlags { GeoPoint = 0x1 } class TLGetInlineBotResults : TLObject { public const uint Signature = 0x514e999d; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputUserBase Bot { get; set; } public TLInputPeerBase Peer { get; set; } private TLInputGeoPointBase _geoPoint; public TLInputGeoPointBase GeoPoint { get { return _geoPoint; } set { SetField(out _geoPoint, value, ref _flags, (int) GetInlineBotResultsFlags.GeoPoint); } } public TLString Query { get; set; } public TLString Offset { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Bot.ToBytes(), Peer.ToBytes(), ToBytes(GeoPoint, Flags, (int) GetInlineBotResultsFlags.GeoPoint), Query.ToBytes(), Offset.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetMaskStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetMaskStickers : TLObject { public const uint Signature = 0x65b8c79f; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetMessages : TLObject { public const uint Signature = 0x63c66506; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetPeerDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetPeerDialogs : TLObject { public const uint Signature = 0x2d9776b9; public TLVector Peers { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peers.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetPeerSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetPeerSettings : TLObject { public const uint Signature = 0x3672e09c; public TLInputPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetPinnedDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetPinnedDialogs : TLObject { public const uint Signature = 0xe254d64e; public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetRecentLocations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetRecentLocations : TLObject { public const uint Signature = 0xbbc45b09; public TLInputPeerBase Peer { get; set; } public TLInt Limit { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Limit.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetRecentStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum GetRecentStickersFlags { Attached = 0x1 } class TLGetRecentStickers : TLObject { public const uint Signature = 0x5ea192c9; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Hash { get; set; } public void SetAttached() { Set(ref _flags, (int) GetRecentStickersFlags.Attached); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetSavedGifs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetSavedGifs : TLObject { public const uint Signature = 0x83bf3d52; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetStickerSet : TLObject { public const string Signature = "#2619a90e"; public TLInputStickerSetBase Stickerset { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Stickerset.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetStickers : TLObject { public const uint Signature = 0x43d4f2c; public TLString Emoticon { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Emoticon.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetUnreadMentions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetUnreadMentions : TLObject { public const uint Signature = 0x46578472; public TLInputPeerBase Peer { get; set; } public TLInt OffsetId { get; set; } public TLInt AddOffset { get; set; } public TLInt Limit { get; set; } public TLInt MaxId { get; set; } public TLInt MinId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), OffsetId.ToBytes(), AddOffset.ToBytes(), Limit.ToBytes(), MaxId.ToBytes(), MinId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetUnusedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetUnusedStickers : TLObject { public const uint Signature = 0xa978d356; public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetWebPage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetWebPage : TLObject { public const uint Signature = 0x32ca8f91; public TLString Url { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLGetWebPagePreview.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLGetWebPagePreview : TLObject { public const uint Signature = 0x8b68b0cc; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Message { get; set; } private TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)SendFlags.Entities); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int)SendFlags.Entities)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLHideReportSpam.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLHideReportSpam : TLObject { public const uint Signature = 0xa8f1709b; public TLInputPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLImportChatInvite.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLImportChatInvite : TLObject { public const string Signature = "#6c50051c"; public TLString Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLInstallStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLInstallStickerSet : TLObject { public const uint Signature = 0xc78fe460; public TLInputStickerSetBase Stickerset { get; set; } public TLBool Archived { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Stickerset.ToBytes(), Archived.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLMigrateChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLMigrateChat : TLObject { public const uint Signature = 0x15a3b8e3; public TLInt ChatId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReadEncryptedHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLReadEncryptedHistory : TLObject, IRandomId { public const uint Signature = 0x7f4b690a; public TLInputEncryptedChat Peer { get; set; } public TLInt MaxDate { get; set; } public TLLong RandomId { get; set; } public TLReadEncryptedHistory() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), MaxDate.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); MaxDate.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); MaxDate = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReadFeaturedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLReadFeaturedStickers : TLObject { public const uint Signature = 0x5b118126; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReadHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLReadHistory : TLObject, IRandomId { public const uint Signature = 0xe306d3a; public TLInputPeerBase Peer { get; set; } public TLInt MaxId { get; set; } public TLLong RandomId { get; set; } public TLReadHistory() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), MaxId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); MaxId.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); MaxId = GetObject(input); return this; } public override string ToString() { return string.Format("TLReadHistory max_id={0} peer=[{1}]", MaxId, Peer); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReadMentions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLReadMentions : TLObject, IRandomId { public const uint Signature = 0xf0189d3; public TLInputPeerBase Peer { get; set; } public TLLong RandomId { get; set; } public TLReadMentions() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); return this; } public override string ToString() { return string.Format("TLReadMentions peer=[{0}]", Peer); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReadMessageContents.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLReadMessageContents : TLObject, IRandomId { public const uint Signature = 0x36a73f77; public TLVector Id { get; set; } public TLLong RandomId { get; set; } public TLReadMessageContents() { RandomId = TLLong.Random(); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReceivedMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLReceivedMessages : TLObject { public const string Signature = "#5a954c0"; public TLInt MaxId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MaxId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReceivedQueue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLReceivedQueue : TLObject { public const string Signature = "#55a5bb66"; public TLLong MaxQts { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MaxQts.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReorderPinnedDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum ReorderPinnedDialogsFlags { Force = 0x1, } class TLReorderPinnedDialogs : TLObject { public const uint Signature = 0x5b51d63f; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLVector Order { get; set; } public void SetForce() { Set(ref _flags, (int) ReorderPinnedDialogsFlags.Force); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Order.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReorderStickerSets.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum ReorderStickerSetsFlags { Masks = 0x1, } class TLReorderStickerSets : TLObject { public const uint Signature = 0x78337739; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLVector Order { get; set; } public void SetMasks() { Set(ref _flags, (int) ReorderStickerSetsFlags.Masks); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Order.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLReportSpam.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLReportSpam : TLObject { public const uint Signature = 0xcf1592db; public TLInputPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLRequestEncryption.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Helpers; using Telegram.Logs; namespace Telegram.Api.TL.Functions.Messages { public class TLRequestEncryption : TLObject { public const string Signature = "#f64daf43"; public TLInputUserBase UserId { get; set; } public TLInt RandomId { get; set; } public TLString G_A { get; set; } public override byte[] ToBytes() { byte[] bytes = null; try { bytes = TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), RandomId.ToBytes(), G_A.ToBytes()); } catch (Exception ex) { var str = "TLRequestEncryption.ToBytes error user_id=" + UserId + " random_id=" + RandomId + " g_a=" + G_A; Log.Write(str); Execute.ShowDebugMessage(ex.ToString()); } return bytes; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLRestoreMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLRestoreMessages : TLObject { public const string Signature = "#395f9d7e"; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSaveDraft.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSaveDraft : TLObject { public const uint Signature = 0xbc39e14b; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { SetField(out _replyToMsgId, value, ref _flags, (int) SendFlags.ReplyToMsgId); } } public TLInputPeerBase Peer { get; set; } public TLString Message { get; set; } private TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int) SendFlags.Entities); } } public void DisableWebPagePreview() { Set(ref _flags, (int)SendFlags.NoWebpage); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId), Peer.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int) SendFlags.Entities)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int) SendFlags.ReplyToMsgId); Peer.ToStream(output); Message.ToStream(output); ToStream(output, Entities, Flags, (int) SendFlags.Entities); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ReplyToMsgId = GetObject(Flags, (int) SendFlags.ReplyToMsgId, null, input); Peer = GetObject(input); Message = GetObject(input); Entities = GetObject>(Flags, (int) SendFlags.Entities, null, input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSaveGif.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLSaveGif : TLObject { public const uint Signature = 0x327a30cb; public TLInputDocumentBase Id { get; set; } public TLBool Unsave { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Unsave.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSearch.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum SearchFlags { FromId = 0x1, } public class TLSearch : TLObject { public const uint Signature = 0x8614ef68; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } public TLString Query { get; set; } private TLInputUserBase _fromId; public TLInputUserBase FromId { get { return _fromId; } set { SetField(out _fromId, value, ref _flags, (int) SearchFlags.FromId); } } public TLInputMessagesFilterBase Filter { get; set; } public TLInt MinDate { get; set; } public TLInt MaxDate { get; set; } public TLInt OffsetId { get; set; } public TLInt AddOffset { get; set; } public TLInt Limit { get; set; } public TLInt MaxId { get; set; } public TLInt MinId { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), Query.ToBytes(), ToBytes(FromId, Flags, (int)SearchFlags.FromId), Filter.ToBytes(), MinDate.ToBytes(), MaxDate.ToBytes(), OffsetId.ToBytes(), AddOffset.ToBytes(), Limit.ToBytes(), MaxId.ToBytes(), MinId.ToBytes(), Hash.ToBytes()); } } public class TLSearchGlobal : TLObject { public const uint Signature = 0x9e3cacb0; public TLString Query { get; set; } public TLInt OffsetDate { get; set; } public TLInputPeerBase OffsetPeer { get; set; } public TLInt OffsetId { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Query.ToBytes(), OffsetDate.ToBytes(), OffsetPeer.ToBytes(), OffsetId.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSearchGifs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLSearchGifs : TLObject { public const uint Signature = 0xbf9a776b; public TLString Q { get; set; } public TLInt Offset { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Q.ToBytes(), Offset.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendBroadcast.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLSendBroadcast : TLObject { public const string Signature = "#bf73f4da"; public TLVector Contacts { get; set; } public TLVector RandomId { get; set; } public TLString Message { get; set; } public TLInputMediaBase Media { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Contacts.ToBytes(), RandomId.ToBytes(), Message.ToBytes(), Media.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendEncrypted.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSendEncrypted : TLObject, IRandomId { public const uint Signature = 0xa9776773; public TLInputEncryptedChat Peer { get; set; } public TLLong RandomId { get; set; } public TLString Data { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), RandomId.ToBytes(), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); RandomId.ToStream(output); Data.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); RandomId = GetObject(input); Data = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendEncryptedFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSendEncryptedFile : TLObject, IRandomId { public const uint Signature = 0x9a901b66; public TLInputEncryptedChat Peer { get; set; } public TLLong RandomId { get; set; } public TLString Data { get; set; } public TLInputEncryptedFileBase File { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), RandomId.ToBytes(), Data.ToBytes(), File.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); RandomId.ToStream(output); Data.ToStream(output); File.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); RandomId = GetObject(input); Data = GetObject(input); File = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendEncryptedService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSendEncryptedService : TLObject, IRandomId { public const uint Signature = 0x32d439a4; public TLInputEncryptedChat Peer { get; set; } public TLLong RandomId { get; set; } public TLString Data { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), RandomId.ToBytes(), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); RandomId.ToStream(output); Data.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); RandomId = GetObject(input); Data = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendInlineBotResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLSendInlineBotResult : TLObject, IRandomId { public const uint Signature = 0xb16e06fe; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { if (value != null && value.Value > 0) { Set(ref _flags, (int)SendFlags.ReplyToMsgId); _replyToMsgId = value; } else { Unset(ref _flags, (int)SendFlags.ReplyToMsgId); } } } public TLLong RandomId { get; set; } public TLLong QueryId { get; set; } public TLString Id { get; set; } public void SetChannelMessage() { Set(ref _flags, (int)SendFlags.Channel); } public void SetSilent() { Set(ref _flags, (int)SendFlags.Silent); } public void SetClearDraft() { Set(ref _flags, (int)SendFlags.ClearDraft); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), ToBytes(ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId), RandomId.ToBytes(), QueryId.ToBytes(), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId); RandomId.ToStream(output); QueryId.ToStream(output); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); if (IsSet(Flags, (int)SendFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } RandomId = GetObject(input); QueryId = GetObject(input); Id = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSendMedia : TLObject, IRandomId { public const uint Signature = 0xb8d1262b; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { var replyToMsgId = value != null && value.Value > 0 ? value : null; SetField(out _replyToMsgId, replyToMsgId, ref _flags, (int)SendFlags.ReplyToMsgId); } } public TLInputMediaBase Media { get; set; } public TLString Message { get; set; } public TLLong RandomId { get; set; } private TLReplyKeyboardBase _replyMarkup; public TLReplyKeyboardBase ReplyMarkup { get { return _replyMarkup; } set { SetField(out _replyMarkup, value, ref _flags, (int)SendFlags.ReplyMarkup); } } protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)SendFlags.Entities); } } public void SetChannelMessage() { Set(ref _flags, (int)SendFlags.Channel); } public void SetSilent() { Set(ref _flags, (int)SendFlags.Silent); } public void SetClearDraft() { Set(ref _flags, (int)SendFlags.ClearDraft); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), ToBytes(ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId), Media.ToBytes(), Message.ToBytes(), RandomId.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)SendFlags.ReplyMarkup), ToBytes(Entities, Flags, (int)SendFlags.Entities) ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId); Media.ToStream(output); Message.ToStream(output); RandomId.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)SendFlags.ReplyMarkup); ToStream(output, Entities, Flags, (int)SendFlags.Entities); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); ReplyToMsgId = GetObject(Flags, (int)SendFlags.ReplyToMsgId, null, input); Media = GetObject(input); Message = GetObject(input); RandomId = GetObject(input); ReplyMarkup = GetObject(Flags, (int)SendFlags.ReplyMarkup, null, input); Entities = GetObject>(Flags, (int)SendFlags.Entities, null, input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum SendFlags { ReplyToMsgId = 0x1, NoWebpage = 0x2, ReplyMarkup = 0x4, Entities = 0x8, Channel = 0x10, Silent = 0x20, Background = 0x40, ClearDraft = 0x80, WithMyScore = 0x100, Grouped = 0x200 } public interface IRandomId { TLLong RandomId { get; } } public class TLSendMessage : TLObject, IRandomId { public const uint Signature = 0xfa88427a; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { SetField(out _replyToMsgId, value, ref _flags, (int) SendFlags.ReplyToMsgId); } } public TLString Message { get; set; } public TLLong RandomId { get; set; } private TLReplyKeyboardBase _replyMarkup; public TLReplyKeyboardBase ReplyMarkup { get { return _replyMarkup; } set { SetField(out _replyMarkup, value, ref _flags, (int) SendFlags.ReplyMarkup); } } private TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int) SendFlags.Entities); } } public void NoWebpage() { Set(ref _flags, (int) SendFlags.NoWebpage); } public void SetChannelMessage() { Set(ref _flags, (int) SendFlags.Channel); } public void SetSilent() { Set(ref _flags, (int) SendFlags.Silent); } public void ClearDraft() { Set(ref _flags, (int) SendFlags.ClearDraft); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), ToBytes(ReplyToMsgId, Flags, (int) SendFlags.ReplyToMsgId), Message.ToBytes(), RandomId.ToBytes(), ToBytes(ReplyMarkup, Flags, (int) SendFlags.ReplyMarkup), ToBytes(Entities, Flags, (int) SendFlags.Entities) ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int) SendFlags.ReplyToMsgId); Message.ToStream(output); RandomId.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int) SendFlags.ReplyMarkup); ToStream(output, Entities, Flags, (int) SendFlags.Entities); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); ReplyToMsgId = GetObject(Flags, (int) SendFlags.ReplyToMsgId, null, input); Message = GetObject(input); RandomId = GetObject(input); ReplyMarkup = GetObject(Flags, (int) SendFlags.ReplyMarkup, null, input); Entities = GetObject>(Flags, (int) SendFlags.Entities, null, input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSendMultiMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLSendMultiMedia : TLObject, IRandomId { public const uint Signature = 0x2095512f; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputPeerBase Peer { get; set; } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { if (value != null && value.Value > 0) { SetField(out _replyToMsgId, value, ref _flags, (int) SendFlags.ReplyToMsgId); } } } public TLVector MultiMedia { get; set; } public TLLong RandomId { get { long hash = 19; unchecked { if (MultiMedia != null) { for (var i = 0; i < MultiMedia.Count; i++) { hash = hash * 31 + MultiMedia[i].RandomId.Value; } } } return new TLLong(hash); } set { } } public void SetSilent() { Set(ref _flags, (int)SendFlags.Silent); } public void SetBackground() { Set(ref _flags, (int)SendFlags.Background); } public void SetClearDraft() { Set(ref _flags, (int)SendFlags.ClearDraft); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes(), ToBytes(ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId), MultiMedia.ToBytes() ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int)SendFlags.ReplyToMsgId); MultiMedia.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); ReplyToMsgId = GetObject(Flags, (int) SendFlags.ReplyToMsgId, null, input); MultiMedia = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSetBotCallbackAnswer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum SetBotCallbackAnswerFlags { Message = 0x1, // 0 Alert = 0x2, // 1 } class TLSetBotCallbackAnswer : TLObject { public const uint Signature = 0xa6e94f04; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt QueryId { get; set; } private TLString _message; public TLString Message { get { return _message; } set { SetField(out _message, value, ref _flags, (int) SetBotCallbackAnswerFlags.Message); } } public void SetAlert() { Set(ref _flags, (int) SetBotCallbackAnswerFlags.Alert); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), Message.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSetEncryptedTyping.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLSetEncryptedTyping : TLObject { public const string Signature = "#791451ed"; public TLInputEncryptedChat Peer { get; set; } public TLBool Typing { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Typing.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSetInlineBotResults.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum SetInlineBotResultsFlags { Gallery = 0x1, // 0 Private = 0x2, // 1 NextOffset = 0x4, // 2 SwitchPM = 0x8, // 3 } class TLSetInlineBotResults : TLObject { public const uint Signature = 0xeb5ea206; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLBool _gallery; public TLBool Gallery { get { return _gallery; } set { SetField(out _gallery, value, ref _flags, (int) SetInlineBotResultsFlags.Gallery); } } private TLBool _private; public TLBool Private { get { return _private; } set { SetField(out _private, value, ref _flags, (int) SetInlineBotResultsFlags.Private); } } public TLLong QueryId { get; set; } public TLVector Results { get; set; } public TLInt CacheTime { get; set; } private TLString _nextOffset; public TLString NextOffset { get { return _nextOffset; } set { SetField(out _nextOffset, value, ref _flags, (int)SetInlineBotResultsFlags.NextOffset); } } private TLInlineBotSwitchPM _switchPM; public TLInlineBotSwitchPM SwitchPM { get { return _switchPM; } set { SetField(out _switchPM, value, ref _flags, (int)SetInlineBotResultsFlags.NextOffset); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), Results.ToBytes(), CacheTime.ToBytes(), ToBytes(NextOffset, Flags, (int) SetInlineBotResultsFlags.NextOffset), ToBytes(SwitchPM, Flags, (int) SetInlineBotResultsFlags.SwitchPM)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLSetTyping.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLSetTyping : TLObject { public const string Signature = "#a3825e50"; public TLInputPeerBase Peer { get; set; } public TLSendMessageActionBase Action { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Action.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLStartBot.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { public class TLStartBot : TLObject, IRandomId { public const uint Signature = 0xe6df7378; public TLInputUserBase Bot { get; set; } public TLInputPeerBase Peer { get; set; } public TLLong RandomId { get; set; } public TLString StartParam { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Bot.ToBytes(), Peer.ToBytes(), RandomId.ToBytes(), StartParam.ToBytes() ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Bot.ToStream(output); Peer.ToStream(output); RandomId.ToStream(output); StartParam.ToStream(output); } public override TLObject FromStream(Stream input) { Bot = GetObject(input); Peer = GetObject(input); RandomId = GetObject(input); StartParam = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLToggleChatAdmins.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLToggleChatAdmins : TLObject { public const uint Signature = 0xec8bd9e1; public TLInt ChatId { get; set; } public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLToggleDialogPin.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum ToggleDialogPinFlags { Pinned = 0x1, } class TLToggleDialogPin : TLObject { public const uint Signature = 0x3289be6a; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Pinned { get { return IsSet(Flags, (int)ToggleDialogPinFlags.Pinned); } set { SetUnset(ref _flags, value, (int)ToggleDialogPinFlags.Pinned); } } public TLInputPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLUninstallStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLUninstallStickerSet : TLObject { public const uint Signature = 0xf96e55de; public TLInputStickerSetBase Stickerset { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Stickerset.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Messages/TLUploadMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL.Functions.Messages { class TLUploadMedia : TLObject { public const uint Signature = 0x519bc2b1; public TLInputPeerBase Peer { get; set; } public TLInputMediaBase Media { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Media.ToBytes() ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); Media.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); Media = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLClearSavedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Payments { [Flags] public enum ClearSavedInfoFlags { Credentials = 0x1, Info = 0x2 } class TLClearSavedInfo : TLObject { public const uint Signature = 0xd83d70c1; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Credentials { get { return IsSet(Flags, (int) ClearSavedInfoFlags.Credentials); } set { SetUnset(ref _flags, value, (int) ClearSavedInfoFlags.Credentials); } } public bool Info { get { return IsSet(Flags, (int) ClearSavedInfoFlags.Info); } set { SetUnset(ref _flags, value, (int) ClearSavedInfoFlags.Info); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLGetPaymentForm.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Payments { class TLGetPaymentForm : TLObject { public const uint Signature = 0x99f09745; public TLInt MsgId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MsgId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLGetPaymentReceipt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Payments { class TLGetPaymentReceipt : TLObject { public const uint Signature = 0xa092a980; public TLInt MsgId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MsgId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLGetSavedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Payments { class TLGetSavedInfo : TLObject { public const uint Signature = 0x227d824b; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLSendPaymentForm.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Payments { [Flags] public enum SendPaymentFormFlags { RequestedInfoId = 0x1, ShippingOptionId = 0x2 } class TLSendPaymentForm : TLObject { public const uint Signature = 0x2b8879b3; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt MsgId { get; set; } private TLString _requestedInfoId; public TLString RequestedInfoId { get { return _requestedInfoId; } set { SetField(out _requestedInfoId, value, ref _flags, (int) SendPaymentFormFlags.RequestedInfoId); } } private TLString _shippingOptionId; public TLString ShippingOptionId { get { return _shippingOptionId; } set { SetField(out _shippingOptionId, value, ref _flags, (int)SendPaymentFormFlags.ShippingOptionId); } } public TLInputPaymentCredentialsBase Credentials { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), MsgId.ToBytes(), ToBytes(RequestedInfoId, Flags, (int) SendPaymentFormFlags.RequestedInfoId), ToBytes(ShippingOptionId, Flags, (int) SendPaymentFormFlags.ShippingOptionId), Credentials.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Payments/TLValidateRequestedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Payments { [Flags] public enum ValidateRequestedInfoFlags { Save = 0x1 } class TLValidateRequestedInfo : TLObject { public const uint Signature = 0x770a8e74; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Save { get { return IsSet(Flags, (int) ValidateRequestedInfoFlags.Save); } set { SetUnset(ref _flags, value, (int) ValidateRequestedInfoFlags.Save); } } public TLInt MsgId { get; set; } public TLPaymentRequestedInfo Info { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); MsgId = GetObject(bytes, ref position); Info = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), MsgId.ToBytes(), Info.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLAcceptCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLAcceptCall : TLObject { public const uint Signature = 0x3bd2b4a0; public TLInputPhoneCall Peer { get; set; } public TLString GB { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), GB.ToBytes(), Protocol.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLConfirmCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLConfirmCall : TLObject { public const uint Signature = 0x2efe1722; public TLInputPhoneCall Peer { get; set; } public TLString GA { get; set; } public TLLong KeyFingerprint { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), GA.ToBytes(), KeyFingerprint.ToBytes(), Protocol.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLDiscardCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { public class TLDiscardCall : TLObject { public const uint Signature = 0x78d413a6; public TLInputPhoneCall Peer { get; set; } public TLInt Duration { get; set; } public TLPhoneCallDiscardReasonBase Reason { get; set; } public TLLong ConnectionId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Duration.ToBytes(), Reason.ToBytes(), ConnectionId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLGetCallConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLGetCallConfig : TLObject { public const uint Signature = 0x55451fa9; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLReceivedCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { public class TLReceivedCall : TLObject { public const uint Signature = 0x17d54f61; public TLInputPhoneCall Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLRequestCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLRequestCall : TLObject { public const uint Signature = 0x5b95b3d4; public TLInputUserBase UserId { get; set; } public TLInt RandomId { get; set; } public TLString GAHash { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), RandomId.ToBytes(), GAHash.ToBytes(), Protocol.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLSaveCallDebug.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLSaveCallDebug : TLObject { public const uint Signature = 0x277add7e; public TLInputPhoneCall Peer { get; set; } public TLDataJSON Debug { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Debug.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Phone/TLSetCallRating.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Phone { class TLSetCallRating : TLObject { public const uint Signature = 0x1c536a34; public TLInputPhoneCall Peer { get; set; } public TLInt Rating { get; set; } public TLString Comment { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Rating.ToBytes(), Comment.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Photos/TLGetUserPhotos.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Photos { class TLGetUserPhotos : TLObject { public const string Signature = "#91cd32a8"; public TLInputUserBase UserId { get; set; } public TLInt Offset { get; set; } public TLLong MaxId { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), Offset.ToBytes(), MaxId.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Photos/TLUpdateProfilePhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Photos { public class TLUpdateProfilePhoto : TLObject { public const uint Signature = 0xf0bb5152; public TLInputPhotoBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Photos/TLUploadProfilePhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Photos { public class TLUploadProfilePhoto : TLObject { public const uint Signature = 0x4f32c098; public TLInputFile File { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Stuff/TLGetFutureSalts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Stuff { public class TLGetFutureSalts : TLObject { public const string Signature = "#b921bd04"; public TLInt Num { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Num.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Stuff/TLHttpWait.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Stuff { public class TLHttpWait : TLObject { public const string Signature = "#9299359f"; /// /// Сервер ждет max_delay миллисекунд, после чего отправляет все сообщения, что у него накопились для клиента. /// По умолчанию 0. Второй по приоритету. /// public TLInt MaxDelay { get; set; } /// /// После получения последнего сообщения для данной сессии сервер ждет еще wait_after миллисекунд, на тот случай, если появятся еще сообщения. /// Если ни одного дополнительного сообщения не появляется, отправляется результат (контейнер со всеми сообщениями); /// если же появляются еще сообщения, отсчет wait_after начинается заново. /// По умолчанию 0. Последний по приоритету. /// public TLInt WaitAfter { get; set; } /// /// Сервер ждет не более max_wait миллисекунд, пока такое сообщение не появится. /// Если сообщений так и не появилось, отправляется пустой контейнер. /// По умолчанию 25000. Главный по приоритету. /// public TLInt MaxWait { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MaxDelay.ToBytes(), WaitAfter.ToBytes(), MaxWait.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Stuff/TLMessageAcknowledgments.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Stuff { class TLMessageAcknowledgments : TLObject { public const string Signature = "#62d6b459"; public TLVector MsgIds { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MsgIds.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Stuff/TLRPCDropAnswer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Stuff { public class TLRPCDropAnswer : TLObject { public const string Signature = "#5e2ad36e"; public TLLong ReqMsgId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ReqMsgId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Updates/TLGetChannelDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Updates { enum GetChannelDifferenceFlags { Force = 0x1 } class TLGetChannelDifference : TLObject { public const uint Signature = 0xbb32d7c0; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputChannelBase Channel { get; set; } public TLChannelMessagesFilerBase Filter { get; set; } public TLInt Pts { get; set; } public TLInt Limit { get; set; } public void SetForce() { Set(ref _flags, (int) GetChannelDifferenceFlags.Force); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes(), Filter.ToBytes(), Pts.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Updates/TLGetDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Updates { enum GetDifferenceFlags { PtsTotalLimit = 0x1 } class TLGetDifference : TLObject { public const uint Signature = 0x25939651; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Pts { get; set; } private TLInt _ptsTotalLimit; public TLInt PtsTotalLimit { get { return _ptsTotalLimit; } set { SetField(out _ptsTotalLimit, value, ref _flags, (int) GetDifferenceFlags.PtsTotalLimit); } } public TLInt Date { get; set; } public TLInt Qts { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Pts.ToBytes(), ToBytes(PtsTotalLimit, Flags, (int)GetDifferenceFlags.PtsTotalLimit), Date.ToBytes(), Qts.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Updates/TLGetState.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Updates { public class TLGetState : TLObject { public const string Signature = "#edd4882a"; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/Functions/Upload/TLGetCdnFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Upload { public class TLGetCdnFile : TLObject { public const uint Signature = 0x2000bcc3; public TLString FileToken { get; set; } public TLInt Offset { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FileToken.ToBytes(), Offset.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Upload/TLGetFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Upload { class TLGetFile : TLObject { public const uint Signature = 0xe3a6cfb5; public TLInputFileLocationBase Location { get; set; } public TLInt Offset { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Location.ToBytes(), Offset.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Upload/TLReuploadCdnFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Upload { public class TLReuploadCdnFile : TLObject { public const uint Signature = 0x9b2754a8; public TLString FileToken { get; set; } public TLString RequestToken { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FileToken.ToBytes(), RequestToken.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Upload/TLSaveFilePart.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Upload { public class TLSaveFilePart : TLObject { public const string Signature = "#b304a621"; public TLLong FileId { get; set; } public TLInt FilePart { get; set; } public TLString Bytes { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FileId.ToBytes(), FilePart.ToBytes(), Bytes.ToBytes()); } } public class TLSaveBigFilePart : TLObject { public const string Signature = "#de7b673d"; public TLLong FileId { get; set; } public TLInt FilePart { get; set; } public TLInt FileTotalParts { get; set; } public TLString Bytes { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FileId.ToBytes(), FilePart.ToBytes(), FileTotalParts.ToBytes(), Bytes.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Users/TLGetFullUser.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Users { public class TLGetFullUser : TLObject { public const string Signature = "#ca30a5b1"; public TLInputUserBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Functions/Users/TLGetUsers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Users { public class TLGetUsers : TLObject { public const string Signature = "#d91a548"; public TLVector Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/Interfaces/IBytes.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Interfaces { public interface IFileData { byte[] Buffer { get; set; } } } ================================================ FILE: Telegram.Api/TL/Interfaces/IFullName.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Interfaces { public interface IFullName { string FullName { get; } } } ================================================ FILE: Telegram.Api/TL/Interfaces/IInputPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Interfaces { public interface IInputPeer { TLInputPeerBase ToInputPeer(); string GetUnsendedTextFileName(); } public interface IInputChannel { TLInputChannelBase ToInputChannel(); } } ================================================ FILE: Telegram.Api/TL/Interfaces/ISelectable.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Interfaces { public interface ISelectable { bool IsSelected { get; set; } } } ================================================ FILE: Telegram.Api/TL/Interfaces/IVIsibility.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Interfaces { public interface IVIsibility { bool IsVisible { get; set; } } } ================================================ FILE: Telegram.Api/TL/SignatureAttribute.cs ================================================ using System; namespace Telegram.Api.TL { class SignatureAttribute : Attribute { public string Value { get; set; } public SignatureAttribute(string signature) { Value = signature; } } } ================================================ FILE: Telegram.Api/TL/TLAccountAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Text; namespace Telegram.Api.TL { public class TLAccountAuthorization : TLObject { public const uint Signature = TLConstructors.TLAccountAuthorization; public TLLong Hash { get; set; } public TLInt Flags { get; set; } public TLString DeviceModel { get; set; } public TLString Platform { get; set; } public TLString SystemVersion { get; set; } public TLInt ApiId { get; set; } public TLString AppName { get; set; } public TLString AppVersion { get; set; } public TLInt DateCreated { get; set; } public TLInt DateActive { get; set; } public TLString Ip { get; set; } public TLString Country { get; set; } public TLString Region { get; set; } public string Location { get { return string.Format("{0} – {1}", Ip, Country); } } public string AppFullName { get { return string.Format("{0} {1}", AppName, AppVersion); } } public string DeviceFullName { get { var name = new StringBuilder(); name.Append(DeviceModel); if (!TLString.IsNullOrEmpty(Platform)) { name.Append(string.Format(", {0}", Platform)); } if (!TLString.IsNullOrEmpty(SystemVersion)) { name.Append(string.Format(" {0}", SystemVersion)); } return name.ToString(); } } public bool IsCurrent { get { return IsSet(Flags, 1); } } public bool IsOfficialApp { get { return IsSet(Flags, 2); } } public string Description { get; set; } public override string ToString() { return string.Format("TLAccountAuthorization hash={0} date_active={1}", Hash, TLUtils.ToDateTime(DateActive)); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Flags = GetObject(bytes, ref position); DeviceModel = GetObject(bytes, ref position); Platform = GetObject(bytes, ref position); SystemVersion = GetObject(bytes, ref position); ApiId = GetObject(bytes, ref position); AppName = GetObject(bytes, ref position); AppVersion = GetObject(bytes, ref position); DateCreated = GetObject(bytes, ref position); DateActive = GetObject(bytes, ref position); Ip = GetObject(bytes, ref position); Country = GetObject(bytes, ref position); Region = GetObject(bytes, ref position); return this; } public void Update(TLAccountAuthorization authorization) { Hash = authorization.Hash; Flags = authorization.Flags; DeviceModel = authorization.DeviceModel; Platform = authorization.Platform; SystemVersion = authorization.SystemVersion; ApiId = authorization.ApiId; AppName = authorization.AppName; AppVersion = authorization.AppVersion; DateCreated = authorization.DateCreated; DateActive = authorization.DateActive; Ip = authorization.Ip; Country = authorization.Country; Region = authorization.Region; } } } ================================================ FILE: Telegram.Api/TL/TLAccountAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLAccountAuthorizations : TLObject { public const uint Signature = TLConstructors.TLAccountAuthorizations; public TLVector Authorizations { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Authorizations = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLAccountDaysTTL.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLAccountDaysTTL : TLObject { public const uint Signature = TLConstructors.TLAccountDaysTTL; public TLInt Days { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Days = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Days.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLActionInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLActionInfo : TLObject { public const uint Signature = TLConstructors.TLActionInfo; public TLInt SendBefore { get; set; } public TLObject Action { get; set; } public override string ToString() { return string.Format("send_before={0} action={1}", SendBefore, Action); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { SendBefore = GetObject(input); Action = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); SendBefore.ToStream(output); Action.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLAdminLogResults.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLAdminLogResults : TLObject { public const uint Signature = TLConstructors.TLAdminLogResults; public TLVector Events { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Events = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Events = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Events.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLAffectedHistory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLAffectedHistory : TLObject { public const uint Signature = TLConstructors.TLAffectedHistory; public TLInt Pts { get; set; } public TLInt Seq { get; set; } public TLInt Offset { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); Offset = GetObject(bytes, ref position); return this; } } public class TLAffectedHistory24 : TLAffectedHistory, IMultiPts, IMultiChannelPts { public new const uint Signature = TLConstructors.TLAffectedHistory24; public TLInt PtsCount { get; set; } public TLInt ChannelPts { get { return Pts; } set { Pts = value; } } public TLInt ChannelPtsCount { get { return PtsCount; } set { PtsCount = value; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Offset = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLAffectedMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLAffectedMessages : TLObject, IMultiPts { public const uint Signature = TLConstructors.TLAffectedMessages; public TLInt Pts { get; set; } public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLAllStrickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum AllStickersCustomFlags { RecentStickers = 0x1, FavedStickers = 0x2, ShowStickersByEmoji = 0x4, } public interface IStickers { TLString Hash { get; set; } TLVector Sets { get; set; } TLVector Packs { get; set; } TLVector Documents { get; set; } } public abstract class TLAllStickersBase : TLObject { } public class TLAllStickersNotModified : TLAllStickersBase { public const uint Signature = TLConstructors.TLAllStickersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLAllStickers : TLAllStickersBase { public const uint Signature = TLConstructors.TLAllStickers; public virtual TLString Hash { get; set; } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Packs = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Packs.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Packs = GetObject>(input); Documents = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); } } public class TLAllStickers29 : TLAllStickers { public new const uint Signature = TLConstructors.TLAllStickers29; public TLVector Sets { get; set; } #region Additional public TLInt Date { get; set; } public TLBool ShowStickersTab { get; set; } public TLVector RecentlyUsed { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Packs = GetObject>(bytes, ref position); Sets = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); ShowStickersTab = new TLBool(true); RecentlyUsed = new TLVector(); Date = TLUtils.DateToUniversalTimeTLInt(0, DateTime.Now); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Packs.ToBytes(), Sets.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Packs = GetObject>(input); Sets = GetObject>(input); Documents = GetObject>(input); ShowStickersTab = GetNullableObject(input); RecentlyUsed = GetNullableObject>(input); Date = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Packs.ToStream(output); Sets.ToStream(output); Documents.ToStream(output); ShowStickersTab.NullableToStream(output); RecentlyUsed.NullableToStream(output); Date.NullableToStream(output); } } public class TLAllStickers32 : TLAllStickers29 { public new const uint Signature = TLConstructors.TLAllStickers32; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Sets = GetObject>(bytes, ref position); Packs = new TLVector(); Documents = new TLVector(); ShowStickersTab = TLBool.True; RecentlyUsed = new TLVector(); Date = TLUtils.DateToUniversalTimeTLInt(0, DateTime.Now); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Sets.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Packs = GetObject>(input); Sets = GetObject>(input); Documents = GetObject>(input); ShowStickersTab = GetNullableObject(input); RecentlyUsed = GetNullableObject>(input); Date = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Packs.ToStream(output); Sets.ToStream(output); Documents.ToStream(output); ShowStickersTab.NullableToStream(output); RecentlyUsed.NullableToStream(output); Date.NullableToStream(output); } } public class TLAllStickers43 : TLAllStickers32, IStickers { public new const uint Signature = TLConstructors.TLAllStickers43; public TLInt HashValue { get; set; } public override TLString Hash { get { return TLUtils.ToTLString(HashValue) ?? TLString.Empty; } set { HashValue = TLUtils.ToTLInt(value) ?? new TLInt(0); } } private TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } private TLRecentStickers _recentStickers; public TLRecentStickers RecentStickers { get { return _recentStickers; } set { SetField(out _recentStickers, value, ref _customFlags, (int) AllStickersCustomFlags.RecentStickers); } } private TLFavedStickers _favedStickers; public TLFavedStickers FavedStickers { get { return _favedStickers; } set { SetField(out _favedStickers, value, ref _customFlags, (int)AllStickersCustomFlags.FavedStickers); } } protected TLInt _showStickersByEmoji; // null - all sets // 1 - my sets // 0 - none public ShowStickersByEmoji ShowStickersByEmoji { get { if (_showStickersByEmoji == null) { return ShowStickersByEmoji.AllSets; } if (_showStickersByEmoji.Value == 1) { return ShowStickersByEmoji.MySets; } return ShowStickersByEmoji.None; } set { switch (value) { case ShowStickersByEmoji.AllSets: SetField(out _showStickersByEmoji, null, ref _customFlags, (int)AllStickersCustomFlags.ShowStickersByEmoji); break; case ShowStickersByEmoji.MySets: SetField(out _showStickersByEmoji, new TLInt(1), ref _customFlags, (int)AllStickersCustomFlags.ShowStickersByEmoji); break; default: SetField(out _showStickersByEmoji, new TLInt(0), ref _customFlags, (int)AllStickersCustomFlags.ShowStickersByEmoji); break; } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); HashValue = GetObject(bytes, ref position); Sets = GetObject>(bytes, ref position); Packs = new TLVector(); Documents = new TLVector(); ShowStickersTab = TLBool.True; RecentlyUsed = new TLVector(); Date = TLUtils.DateToUniversalTimeTLInt(0, DateTime.Now); CustomFlags = new TLLong(0); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), HashValue.ToBytes(), Sets.ToBytes()); } public override TLObject FromStream(Stream input) { HashValue = GetObject(input); Packs = GetObject>(input); Sets = GetObject>(input); Documents = GetObject>(input); ShowStickersTab = GetNullableObject(input); RecentlyUsed = GetNullableObject>(input); Date = GetNullableObject(input); CustomFlags = GetNullableObject(input); RecentStickers = GetObject(CustomFlags, (int)AllStickersCustomFlags.RecentStickers, null, input); FavedStickers = GetObject(CustomFlags, (int)AllStickersCustomFlags.FavedStickers, null, input); _showStickersByEmoji = GetObject(CustomFlags, (int)AllStickersCustomFlags.ShowStickersByEmoji, null, input); // move showStickersTab flag to ShowStickersByEmoji flag if (ShowStickersTab != null && !ShowStickersTab.Value) { ShowStickersByEmoji = ShowStickersByEmoji.MySets; ShowStickersTab = TLBool.True; } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); HashValue.ToStream(output); Packs.ToStream(output); Sets.ToStream(output); Documents.ToStream(output); ShowStickersTab.NullableToStream(output); RecentlyUsed.NullableToStream(output); Date.NullableToStream(output); CustomFlags.ToStream(output); ToStream(output, RecentStickers, CustomFlags, (int)AllStickersCustomFlags.RecentStickers); ToStream(output, FavedStickers, CustomFlags, (int)AllStickersCustomFlags.FavedStickers); ToStream(output, _showStickersByEmoji, CustomFlags, (int)AllStickersCustomFlags.ShowStickersByEmoji); } } public enum ShowStickersByEmoji { AllSets, MySets, None } } ================================================ FILE: Telegram.Api/TL/TLAppChangelogBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLAppChangelogBase : TLObject { } public class TLAppChangelogEmpty : TLAppChangelogBase { public const uint Signature = TLConstructors.TLAppChangelogEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLAppChangelog : TLAppChangelogBase { public const uint Signature = TLConstructors.TLAppChangelog; public TLString Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } } public class TLAppChangelog59 : TLAppChangelogBase { public const uint Signature = TLConstructors.TLAppChangelog59; public TLString Message { get; set; } public TLMessageMediaBase Media { get; set; } public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Entities = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLArchivedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLArchivedStickers : TLObject, IStickers { public const uint Signature = TLConstructors.TLArchivedStickers; public TLInt Count { get; set; } public TLVector SetsCovered { get; set; } public TLVector Sets { get { var sets = new TLVector(); foreach (var setCovered in SetsCovered) { sets.Add(setCovered.StickerSet); } return sets; } set { Execute.ShowDebugMessage("TLArchivedStickers.Sets set"); } } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public TLString Hash { get; set; } public TLVector MessagesStickerSets { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); SetsCovered = GetObject>(bytes, ref position); Packs = new TLVector(); Documents = new TLVector(); MessagesStickerSets = new TLVector(); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Count.ToBytes(), SetsCovered.ToBytes()); } public override TLObject FromStream(Stream input) { Count = GetObject(input); SetsCovered = GetObject>(input); Packs = GetObject>(input); Documents = GetObject>(input); MessagesStickerSets = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Count.ToStream(output); SetsCovered.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); MessagesStickerSets.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLAudio.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Services.Cache; namespace Telegram.Api.TL { public abstract class TLAudioBase : TLObject { public TLLong Id { get; set; } public virtual int AudioSize{get { return 0; }} } public class TLAudioEmpty : TLAudioBase { public const uint Signature = TLConstructors.TLAudioEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public class TLAudio33 : TLAudio { public new const uint Signature = TLConstructors.TLAudio33; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); //UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), //UserId.ToBytes(), Date.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), DCId.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); //UserId = GetObject(input); Date = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); DCId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); //UserId.ToStream(output); Date.ToStream(output); Duration.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); DCId.ToStream(output); } } public class TLAudio : TLAudioBase { public const uint Signature = TLConstructors.TLAudio; public TLLong AccessHash { get; set; } public TLInt UserId { get; set; } public TLInt Date { get; set; } public TLInt Duration { get; set; } public TLString MimeType { get; set; } public TLInt Size { get; set; } public TLInt DCId { get; set; } public string GetFileName() { return string.Format("audio{0}_{1}.mp3", Id, AccessHash); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), UserId.ToBytes(), Date.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), DCId.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); DCId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); UserId.ToStream(output); Date.ToStream(output); Duration.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); DCId.ToStream(output); } #region Additional public override int AudioSize { get { return Size != null ? Size.Value : 0; } } public string DurationString { get { var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public TLUserBase User { get { var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(UserId); } } #endregion public TLInputAudioFileLocation ToInputFileLocation() { return new TLInputAudioFileLocation { AccessHash = AccessHash, Id = Id }; } } } ================================================ FILE: Telegram.Api/TL/TLAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum AuthorizationFlags { TmpSessions = 0x1, // 0 } public class TLAuthorization : TLObject { public const uint Signature = TLConstructors.TLAuthorization; public TLInt Expires { get; set; } public TLUserBase User { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); User = GetObject(bytes, ref position); return this; } } public class TLAuthorization31 : TLAuthorization { public new const uint Signature = TLConstructors.TLAuthorization31; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); User = GetObject(bytes, ref position); return this; } } public class TLAuthorization55 : TLAuthorization { public new const uint Signature = TLConstructors.TLAuthorization55; public TLInt Flags { get; set; } public TLInt TempSessions { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); User = GetObject(bytes, ref position); TempSessions = GetObject(Flags, (int) AuthorizationFlags.TmpSessions, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLBadMessageNotification.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; namespace Telegram.Api.TL { public class TLBadMessageNotification : TLObject { public const uint Signature = TLConstructors.TLBadMessageNotification; public TLLong BadMessageId { get; set; } public TLInt BadMessageSequenceNumber { get; set; } public TLInt ErrorCode { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); BadMessageId = GetObject(bytes, ref position); BadMessageSequenceNumber = GetObject(bytes, ref position); ErrorCode = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLBadMessageNotification msg_id={0} msg_seq_no={1} error_code={2}", BadMessageId, BadMessageSequenceNumber, ErrorCode); } } } ================================================ FILE: Telegram.Api/TL/TLBadServerSalt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLBadServerSalt : TLObject { public const uint Signature = TLConstructors.TLBadServerSalt; public TLLong BadMessageId { get; set; } public TLInt BadMessageSeqNo { get; set; } public TLInt ErrorCode { get; set; } public TLLong NewServerSalt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); BadMessageId = GetObject(bytes, ref position); BadMessageSeqNo = GetObject(bytes, ref position); ErrorCode = GetObject(bytes, ref position); NewServerSalt = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLBadServerSalt msg_id={0} msg_seq_no={1} error_code={2} new_salt={3}", BadMessageId, BadMessageSeqNo, ErrorCode, NewServerSalt); } } } ================================================ FILE: Telegram.Api/TL/TLBool.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Runtime.Serialization; namespace Telegram.Api.TL { [DataContract] public class TLBool : TLObject { public const uint BoolTrue = 0x997275b5; public const uint BoolFalse = 0xbc799737; [DataMember] public bool Value { get; set; } public TLBool() { } public TLBool(bool value) { Value = value; } public static TLBool True { get { return new TLBool(true); } } public static TLBool False { get { return new TLBool(false); } } public static TLBool Parse(byte[] bytes, out int bytesRead) { bytesRead = 4; if (bytes.StartsWith(BoolTrue)) { return new TLBool{ Value = true }; } if (bytes.StartsWith(BoolFalse)) { return new TLBool { Value = false }; } bytesRead = 0; bytes.ThrowNotSupportedException("TLBool"); return null; } public override byte[] ToBytes() { return Value ? TLUtils.SignatureToBytes(BoolTrue) : TLUtils.SignatureToBytes(BoolFalse); } public override TLObject FromBytes(byte[] bytes, ref int position) { if (bytes.StartsWith(position, BoolTrue)) { Value = true; } else if (bytes.StartsWith(position, BoolFalse)) { Value = false; } else { bytes.ThrowNotSupportedException("TLBool"); } position += 4; return this; } public override TLObject FromStream(Stream input) { var buffer = new byte[4]; input.Read(buffer, 0, 4); if (buffer.StartsWith(0, BoolTrue)) { Value = true; } else if (buffer.StartsWith(0, BoolFalse)) { Value = false; } else { buffer.ThrowNotSupportedException("TLBool"); } return this; } public override void ToStream(Stream output) { output.Write(Value ? BitConverter.GetBytes(BoolTrue) : BitConverter.GetBytes(BoolFalse), 0, 4); } public override string ToString() { #if WIN_RT return Value.ToString(); #else return Value.ToString(CultureInfo.InvariantCulture); #endif } } } ================================================ FILE: Telegram.Api/TL/TLBotCallbackAnswer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum BotCallbackAnswer { Message = 0x1, // 0 Alert = 0x2, // 1 Url = 0x4, // 2 HasUrl = 0x8, // 3 } public class TLBotCallbackAnswer : TLObject { public const uint Signature = TLConstructors.TLBotCallbackAnswer; public TLInt Flags { get; set; } public TLString Message { get; set; } public bool Alert { get { return IsSet(Flags, (int) BotCallbackAnswer.Alert); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Message = GetObject(Flags, (int)BotCallbackAnswer.Message, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Message.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Message = GetObject(Flags, (int)BotCallbackAnswer.Message, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); ToBytes(Message, Flags, (int) BotCallbackAnswer.Message); } } public class TLBotCallbackAnswer54 : TLBotCallbackAnswer { public new const uint Signature = TLConstructors.TLBotCallbackAnswer54; public TLString Url { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Message = GetObject(Flags, (int) BotCallbackAnswer.Message, null, bytes, ref position); Url = GetObject(Flags, (int) BotCallbackAnswer.Url, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Message.ToBytes(), Url.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Message = GetObject(Flags, (int) BotCallbackAnswer.Message, null, input); Url = GetObject(Flags, (int) BotCallbackAnswer.Url, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); ToBytes(Message, Flags, (int) BotCallbackAnswer.Message); ToBytes(Url, Flags, (int) BotCallbackAnswer.Url); } } public class TLBotCallbackAnswer58 : TLBotCallbackAnswer54, ICachedObject { public new const uint Signature = TLConstructors.TLBotCallbackAnswer58; public TLInt CacheTime { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Message = GetObject(Flags, (int)BotCallbackAnswer.Message, null, bytes, ref position); Url = GetObject(Flags, (int)BotCallbackAnswer.Url, null, bytes, ref position); CacheTime = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(Message, Flags, (int)BotCallbackAnswer.Message), ToBytes(Url, Flags, (int)BotCallbackAnswer.Url), CacheTime.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Message = GetObject(Flags, (int)BotCallbackAnswer.Message, null, input); Url = GetObject(Flags, (int)BotCallbackAnswer.Url, null, input); CacheTime = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); ToStream(output, Message, Flags, (int) BotCallbackAnswer.Message); ToStream(output, Url, Flags, (int) BotCallbackAnswer.Url); output.Write(CacheTime.ToBytes()); } } public interface ICachedObject { TLInt CacheTime { get; set; } } } ================================================ FILE: Telegram.Api/TL/TLBotCommand.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLBotCommand : TLObject { public const uint Signature = TLConstructors.TLBotCommand; public TLString Command { get; set; } public TLString Description { get; set; } public TLUserBase Bot { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Command = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Command.ToBytes(), Description.ToBytes()); } public override TLObject FromStream(Stream input) { Command = GetObject(input); Description = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Command.ToBytes()); output.Write(Description.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLBotInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLBotInfoBase : TLObject { } public class TLBotInfoEmpty : TLBotInfoBase { public const uint Signature = TLConstructors.TLBotInfoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLBotInfo49 : TLBotInfo { public new const uint Signature = TLConstructors.TLBotInfo49; public override TLInt Version { get { return new TLInt(0); } set { } } public override TLString ShareText { get { return TLString.Empty; } set { } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); Commands = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), Description.ToBytes(), Commands.ToBytes()); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Description = GetObject(input); Commands = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(Description.ToBytes()); output.Write(Commands.ToBytes()); } } public class TLBotInfo : TLBotInfoBase { public const uint Signature = TLConstructors.TLBotInfo; public TLInt UserId { get; set; } public virtual TLInt Version { get; set; } public virtual TLString ShareText { get; set; } public TLString Description { get; set; } public TLVector Commands { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); ShareText = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); Commands = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), Version.ToBytes(), ShareText.ToBytes(), Description.ToBytes(), Commands.ToBytes()); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Version = GetObject(input); ShareText = GetObject(input); Description = GetObject(input); Commands = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(Version.ToBytes()); output.Write(ShareText.ToBytes()); output.Write(Description.ToBytes()); output.Write(Commands.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLBotInlineMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum BotInlineMessageFlags { NoWebpage = 0x1, // 0 Entities = 0x2, // 1 ReplyMarkup = 0x4, // 2 } public abstract class TLBotInlineMessageBase : TLObject { public TLReplyKeyboardBase ReplyMarkup { get; set; } public static string BotInlineMessageFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (BotInlineMessageFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } } public class TLBotInlineMessageMediaAuto75 : TLBotInlineMessageMediaAuto51 { public new const uint Signature = TLConstructors.TLBotInlineMessageMediaAuto75; protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)InputBotInlineMessageFlags.Entities); } } public override string ToString() { return string.Format("TLBotInlineMessageMediaAuto75 flags={0} caption={1} reply_markup={2}", BotInlineMessageFlagsString(Flags), Caption, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); Entities = GetObject>(Flags, (int)BotInlineMessageFlags.Entities, null, bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Caption.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Caption = GetObject(input); Entities = GetObject>(Flags, (int)BotInlineMessageFlags.Entities, null, input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Caption.ToStream(output); ToStream(output, Entities, Flags, (int)BotInlineMessageFlags.Entities); ToStream(output, ReplyMarkup, Flags, (int)BotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaAuto51 : TLBotInlineMessageMediaAuto { public new const uint Signature = TLConstructors.TLBotInlineMessageMediaAuto51; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override string ToString() { return string.Format("TLBotInlineMessageMediaAuto51 flags={0} caption={1} reply_markup={2}", BotInlineMessageFlagsString(Flags), Caption, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Caption.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Caption = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Caption.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)BotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaAuto : TLBotInlineMessageBase { public const uint Signature = TLConstructors.TLBotInlineMessageMediaAuto; public TLString Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Caption.ToStream(output); } } public class TLBotInlineMessageText51 : TLBotInlineMessageText { public new const uint Signature = TLConstructors.TLBotInlineMessageText51; public override string ToString() { return string.Format("TLBotInlineMessageText51 flags={0} message={1} entities={2} reply_markup={3}", BotInlineMessageFlagsString(Flags), Message, Entities, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Entities = GetObject>(Flags, (int)BotInlineMessageFlags.Entities, null, bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Message = GetObject(input); Entities = GetObject>(Flags, (int)BotInlineMessageFlags.Entities, null, input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Message.ToStream(output); ToStream(output, Entities, Flags, (int)InputBotInlineMessageFlags.Entities); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageText : TLBotInlineMessageBase { public const uint Signature = TLConstructors.TLBotInlineMessageText; public TLInt Flags { get; set; } public bool NoWebpage { get { return IsSet(Flags, (int)BotInlineMessageFlags.NoWebpage); } } public TLString Message { get; set; } public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); if (IsSet(Flags, (int)BotInlineMessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Message = GetObject(input); if (IsSet(Flags, (int)InputBotInlineMessageFlags.Entities)) { Entities = GetObject>(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Message.ToStream(output); ToStream(output, Entities, Flags, (int)InputBotInlineMessageFlags.Entities); } } public class TLBotInlineMessageMediaGeo : TLBotInlineMessageBase { public const uint Signature = TLConstructors.TLBotInlineMessageMediaGeo; public TLInt Flags { get; set; } public TLGeoPointBase Geo { get; set; } public override string ToString() { return string.Format("TLBotInlineMessageMediaGeo flags={0} geo={1} reply_markup={2}", BotInlineMessageFlagsString(Flags), Geo, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Geo = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Geo.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Geo = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Geo.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaVenue78 : TLBotInlineMessageMediaVenue { public new const uint Signature = TLConstructors.TLBotInlineMessageMediaVenue78; public TLString VenueType { get; set; } public override string ToString() { return string.Format("TLBotInlineMessageMediaVenue flags={0} geo={1} title={2} address={3} provider={4} venue_id={5} venue_type={6} reply_markup={7}", BotInlineMessageFlagsString(Flags), Geo, Title, Address, Provider, VenueId, VenueType, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Geo = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Address = GetObject(bytes, ref position); Provider = GetObject(bytes, ref position); VenueId = GetObject(bytes, ref position); VenueType = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Geo.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes(), VenueType.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Geo = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); VenueType = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Geo.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); VenueType.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaVenue : TLBotInlineMessageMediaGeo { public new const uint Signature = TLConstructors.TLBotInlineMessageMediaVenue; public TLString Title { get; set; } public TLString Address { get; set; } public TLString Provider { get; set; } public TLString VenueId { get; set; } public override string ToString() { return string.Format("TLBotInlineMessageMediaVenue flags={0} geo={1} title={2} address={3} provider={4} venue_id={5} reply_markup={6}", BotInlineMessageFlagsString(Flags), Geo, Title, Address, Provider, VenueId, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Geo = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Address = GetObject(bytes, ref position); Provider = GetObject(bytes, ref position); VenueId = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Geo.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Geo = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Geo.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaContact82 : TLBotInlineMessageMediaContact { public new const uint Signature = TLConstructors.TLBotInlineMessageMediaContact82; public TLString VCard { get; set; } public override string ToString() { return string.Format("TLBotInlineMessageMediaContact82 flags={0} phone_number={1} first_name={2} last_name={3} vcard={4} reply_markup={5}", BotInlineMessageFlagsString(Flags), PhoneNumber, FirstName, LastName, VCard, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); PhoneNumber = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); VCard = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), VCard.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); VCard = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); VCard.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLBotInlineMessageMediaContact : TLBotInlineMessageBase { public const uint Signature = TLConstructors.TLBotInlineMessageMediaContact; public TLInt Flags { get; set; } public TLString PhoneNumber { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public TLUserBase User { get { return new TLUser { Id = new TLInt(0), Photo = new TLPhotoEmpty { Id = new TLLong(0) }, FirstName = FirstName, LastName = LastName, Phone = PhoneNumber }; } } public override string ToString() { return string.Format("TLBotInlineMessageMediaContact flags={0} phone_number={1} first_name={2} last_name={3} reply_markup={4}", BotInlineMessageFlagsString(Flags), PhoneNumber, FirstName, LastName, ReplyMarkup); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); PhoneNumber = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); ReplyMarkup = GetObject(Flags, (int)BotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } } ================================================ FILE: Telegram.Api/TL/TLBotInlineResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum BotInlineResultFlags { //Unread = 0x1, // 0 Title = 0x2, // 1 Description = 0x4, // 2 Url = 0x8, // 3 Thumb = 0x10, // 4 Content = 0x20, // 5 Size = 0x40, // 6 Duration = 0x80, // 7 } [Flags] public enum BotInlineMediaResultFlags { Photo = 0x1, // 0 Document = 0x2, // 1 Title = 0x4, // 2 Description = 0x8, // 3 } public abstract class TLBotInlineResultBase : TLObject { public TLBotInlineResultBase Self { get { return this; } } public TLString Id { get; set; } public TLString Type { get; set; } public TLBotInlineMessageBase SendMessage { get; set; } public TLLong QueryId { get; set; } } public class TLBotInlineMediaResult : TLBotInlineResultBase, IMediaGif { public const uint Signature = TLConstructors.TLBotInlineMediaResult; public TLInt Flags { get; set; } public TLPhotoBase Photo { get; set; } public TLDocumentBase Document { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLBotInlineMediaResult ThumbSelf { get { return this; } } private double _downloadingProgress; public double DownloadingProgress { get { return _downloadingProgress; } set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } } public double LastProgress { get; set; } public bool IsCanceled { get; set; } public string IsoFileName { get; set; } public bool? AutoPlayGif { get; set; } public bool Forbidden { get; set; } public static string BotInlineMediaResultFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (BotInlineMediaResultFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { return string.Format("TLBotInlineMediaResult flags={0} type={2} id={1} photo={3} document={4} title={5} description={6} send_message=[{7}]", BotInlineMediaResultFlagsString(Flags), Id, Type, Photo != null, Document != null, Title, Description, SendMessage); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); Photo = GetObject(Flags, (int)BotInlineMediaResultFlags.Photo, null, bytes, ref position); Document = GetObject(Flags, (int)BotInlineMediaResultFlags.Document, null, bytes, ref position); Title = GetObject(Flags, (int)BotInlineMediaResultFlags.Title, null, bytes, ref position); Description = GetObject(Flags, (int)BotInlineMediaResultFlags.Description, null, bytes, ref position); SendMessage = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Photo, Flags, (int)BotInlineMediaResultFlags.Photo), ToBytes(Document, Flags, (int)BotInlineMediaResultFlags.Document), ToBytes(Title, Flags, (int)BotInlineMediaResultFlags.Title), ToBytes(Description, Flags, (int)BotInlineMediaResultFlags.Description), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); Photo = GetObject(Flags, (int)BotInlineMediaResultFlags.Photo, null, input); Document = GetObject(Flags, (int)BotInlineMediaResultFlags.Document, null, input); Title = GetObject(Flags, (int)BotInlineMediaResultFlags.Title, null, input); Description = GetObject(Flags, (int)BotInlineMediaResultFlags.Description, null, input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Photo, Flags, (int)BotInlineMediaResultFlags.Photo); ToStream(output, Document, Flags, (int)BotInlineMediaResultFlags.Document); ToStream(output, Title, Flags, (int)BotInlineMediaResultFlags.Title); ToStream(output, Description, Flags, (int)BotInlineMediaResultFlags.Description); SendMessage.ToStream(output); } } //public class TLBotInlineMediaResultDocument : TLBotInlineResultBase, IMediaGif //{ // public const uint Signature = TLConstructors.TLBotInlineMediaResultDocument; // public TLDocumentBase Document { get; set; } // public TLBotInlineMediaResultDocument ThumbSelf { get { return this; } } // private double _downloadingProgress; // public double DownloadingProgress // { // get { return _downloadingProgress; } // set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } // } // public double LastProgress { get; set; } // public bool IsCanceled { get; set; } // public string IsoFileName { get; set; } // public bool? AutoPlayGif { get; set; } // public bool Forbidden { get; set; } // public override string ToString() // { // return string.Format("TLBotInlineMediaResultDocument id={0} type={1} document={2} send_message={3}", Id, Type, Document, SendMessage); // } // public override TLObject FromBytes(byte[] bytes, ref int position) // { // bytes.ThrowExceptionIfIncorrect(ref position, Signature); // Id = GetObject(bytes, ref position); // Type = GetObject(bytes, ref position); // Document = GetObject(bytes, ref position); // SendMessage = GetObject(bytes, ref position); // return this; // } // public override byte[] ToBytes() // { // return TLUtils.Combine( // TLUtils.SignatureToBytes(Signature), // Id.ToBytes(), // Type.ToBytes(), // Document.ToBytes(), // SendMessage.ToBytes()); // } // public override TLObject FromStream(Stream input) // { // Id = GetObject(input); // Type = GetObject(input); // Document = GetObject(input); // SendMessage = GetObject(input); // return this; // } // public override void ToStream(Stream output) // { // output.Write(TLUtils.SignatureToBytes(Signature)); // Id.ToStream(output); // Type.ToStream(output); // Document.ToStream(output); // SendMessage.ToStream(output); // } //} public class TLBotInlineMediaResultPhoto : TLBotInlineResultBase { public const uint Signature = TLConstructors.TLBotInlineMediaResultPhoto; public TLPhotoBase Photo { get; set; } public override string ToString() { return string.Format("TLBotInlineMediaResultPhoto id={0} type={1} photo={2} send_message={3}", Id, Type, Photo, SendMessage); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); Photo = GetObject(bytes, ref position); SendMessage = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Type.ToBytes(), Photo.ToBytes(), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Type = GetObject(input); Photo = GetObject(input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Type.ToStream(output); Photo.ToStream(output); SendMessage.ToStream(output); } } public class TLBotInlineResult : TLBotInlineResultBase, IMediaGif { public const uint Signature = TLConstructors.TLBotInlineResult; public TLInt Flags { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLString Url { get; set; } public virtual TLString ThumbUrl { get; protected set; } public string ThumbUrlString { get { return ThumbUrl != null ? ThumbUrl.ToString() : string.Empty; } } public virtual TLString ContentUrl { get; protected set; } public string ContentUrlString { get { return ContentUrl != null ? ContentUrl.ToString() : string.Empty; } } public virtual TLString ContentType { get; protected set; } public virtual TLInt W { get; protected set; } public virtual TLInt H { get; protected set; } public virtual TLInt Duration { get; protected set; } public static string BotInlineResultFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (BotInlineResultFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { return string.Format("TLBotInlineResult flags={0} type={2} id={1} title={3} description={4} url={5} thumb_url={6} content_url={7} content_type={8} w={9} h={10} duration={11} send_message=[{12}]", BotInlineResultFlagsString(Flags), Id, Type, Title, Description, Url, ThumbUrl, ContentUrl, ContentType, W, H, Duration, SendMessage); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); if (IsSet(Flags, (int)BotInlineResultFlags.Title)) { Title = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Description)) { Description = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Url)) { Url = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Thumb)) { ThumbUrl = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Content)) { ContentUrl = GetObject(bytes, ref position); ContentType = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Size)) { W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); } if (IsSet(Flags, (int)BotInlineResultFlags.Duration)) { Duration = GetObject(bytes, ref position); } SendMessage = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Title, Flags, (int)InputBotInlineResultFlags.Title), ToBytes(Description, Flags, (int)InputBotInlineResultFlags.Description), ToBytes(Url, Flags, (int)InputBotInlineResultFlags.Url), ToBytes(ThumbUrl, Flags, (int)InputBotInlineResultFlags.Thumb), ToBytes(ContentUrl, Flags, (int)InputBotInlineResultFlags.Content), ToBytes(ContentType, Flags, (int)InputBotInlineResultFlags.Content), ToBytes(W, Flags, (int)InputBotInlineResultFlags.Size), ToBytes(H, Flags, (int)InputBotInlineResultFlags.Size), ToBytes(Duration, Flags, (int)InputBotInlineResultFlags.Duration), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); if (IsSet(Flags, (int)InputBotInlineResultFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Description)) { Description = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Url)) { Url = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Thumb)) { ThumbUrl = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Content)) { ContentUrl = GetObject(input); ContentType = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Size)) { W = GetObject(input); H = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Duration)) { Duration = GetObject(input); } SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Title, Flags, (int)InputBotInlineResultFlags.Title); ToStream(output, Description, Flags, (int)InputBotInlineResultFlags.Description); ToStream(output, Url, Flags, (int)InputBotInlineResultFlags.Url); ToStream(output, ThumbUrl, Flags, (int)InputBotInlineResultFlags.Thumb); ToStream(output, ContentUrl, Flags, (int)InputBotInlineResultFlags.Content); ToStream(output, ContentType, Flags, (int)InputBotInlineResultFlags.Content); ToStream(output, W, Flags, (int)InputBotInlineResultFlags.Size); ToStream(output, H, Flags, (int)InputBotInlineResultFlags.Size); ToStream(output, Duration, Flags, (int)InputBotInlineResultFlags.Duration); SendMessage.ToStream(output); } public TLBotInlineResult ThumbSelf { get { return this; } } #region IGifMedia private TLDocumentBase _document; public TLDocumentBase Document { get { if (_document != null) return _document; if (TLString.Equals(Type, new TLString("gif"), StringComparison.OrdinalIgnoreCase)) { var document = new TLDocumentExternal(); document.Id = TLLong.Random(); document.ResultId = Id; document.Type = Type; document.Url = Url ?? TLString.Empty; document.ThumbUrl = ThumbUrl ?? TLString.Empty; document.ContentUrl = ContentUrl ?? TLString.Empty; document.ContentType = ContentType ?? TLString.Empty; document.Attributes = new TLVector{ new TLDocumentAttributeAnimated() }; if (W != null && H != null && W.Value > 0 && H.Value > 0) { var duration = Duration ?? new TLInt(0); var videoAttribute = new TLDocumentAttributeVideo66 { Flags = new TLInt(0), W = W, H = H, Duration = duration }; document.Attributes.Add(videoAttribute); } _document = document; } else if (TLString.Equals(Type, new TLString("photo"), StringComparison.OrdinalIgnoreCase)) { } return _document; } } private double _downloadingProgress; public double DownloadingProgress { get { return _downloadingProgress; } set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } } public double LastProgress { get; set; } public bool IsCanceled { get; set; } public string IsoFileName { get; set; } public bool? AutoPlayGif { get; set; } public bool Forbidden { get; set; } #endregion } public class TLBotInlineResult76 : TLBotInlineResult { public new const uint Signature = TLConstructors.TLBotInlineResult76; public TLWebDocumentBase Thumb { get; set; } public override TLString ThumbUrl { get { return Thumb != null ? Thumb.Url : null; } } public TLWebDocumentBase Content { get; set; } public override TLString ContentUrl { get { return Content != null ? Content.Url : null; } } public override TLString ContentType { get { return Content != null ? Content.MimeType : null; } } public override TLInt W { get { return Content != null ? Content.W : null; } } public override TLInt H { get { return Content != null ? Content.H : null; } } public override TLInt Duration { get { return Content != null ? Content.Duration : null; } } public override string ToString() { return string.Format("TLBotInlineResult76 flags={0} type={2} id={1} title={3} description={4} url={5} thumb_url={6} content_url={7} content_type={8} w={9} h={10} duration={11} send_message=[{12}]", BotInlineResultFlagsString(Flags), Id, Type, Title, Description, Url, ThumbUrl, ContentUrl, ContentType, W, H, Duration, SendMessage); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); Title = GetObject(Flags, (int)BotInlineResultFlags.Title, null, bytes, ref position); Description = GetObject(Flags, (int)BotInlineResultFlags.Description, null, bytes, ref position); Url = GetObject(Flags, (int)BotInlineResultFlags.Url, null, bytes, ref position); Thumb = GetObject(Flags, (int)BotInlineResultFlags.Thumb, null, bytes, ref position); Content = GetObject(Flags, (int)BotInlineResultFlags.Content, null, bytes, ref position); SendMessage = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Title, Flags, (int)BotInlineResultFlags.Title), ToBytes(Description, Flags, (int)BotInlineResultFlags.Description), ToBytes(Url, Flags, (int)BotInlineResultFlags.Url), ToBytes(Thumb, Flags, (int)BotInlineResultFlags.Thumb), ToBytes(Content, Flags, (int)BotInlineResultFlags.Content), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); Title = GetObject(Flags, (int)BotInlineResultFlags.Title, null, input); Description = GetObject(Flags, (int)BotInlineResultFlags.Description, null, input); Url = GetObject(Flags, (int)BotInlineResultFlags.Url, null, input); Thumb = GetObject(Flags, (int)BotInlineResultFlags.Thumb, null, input); Content = GetObject(Flags, (int)BotInlineResultFlags.Content, null, input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Title, Flags, (int)BotInlineResultFlags.Title); ToStream(output, Description, Flags, (int)BotInlineResultFlags.Description); ToStream(output, Url, Flags, (int)BotInlineResultFlags.Url); ToStream(output, Thumb, Flags, (int)BotInlineResultFlags.Thumb); ToStream(output, Content, Flags, (int)BotInlineResultFlags.Content); SendMessage.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLBotResults.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum BotResultsFlags { Gallery = 0x1, // 0 NextOffset = 0x2, // 1 SwitchPM = 0x4, // 2 } public class TLBotResults72 : TLBotResults58 { public new const uint Signature = TLConstructors.TLBotResults72; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, bytes, ref position); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, bytes, ref position); Results = GetObject>(bytes, ref position); CacheTime = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), ToBytes(NextOffset, Flags, (int)BotResultsFlags.NextOffset), ToBytes(SwitchPM, Flags, (int)BotResultsFlags.SwitchPM), Results.ToBytes(), CacheTime.ToBytes(), Users.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, input); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, input); Results = GetObject>(input); CacheTime = GetObject(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); ToStream(output, NextOffset, Flags, (int)BotResultsFlags.NextOffset); ToStream(output, SwitchPM, Flags, (int)BotResultsFlags.SwitchPM); Results.ToStream(output); CacheTime.ToStream(output); Users.ToStream(output); } } public class TLBotResults58 : TLBotResults51, ICachedObject { public new const uint Signature = TLConstructors.TLBotResults58; public TLInt CacheTime { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, bytes, ref position); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, bytes, ref position); Results = GetObject>(bytes, ref position); CacheTime = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), ToBytes(NextOffset, Flags, (int)BotResultsFlags.NextOffset), ToBytes(SwitchPM, Flags, (int)BotResultsFlags.SwitchPM), Results.ToBytes(), CacheTime.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, input); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, input); Results = GetObject>(input); CacheTime = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); ToStream(output, NextOffset, Flags, (int)BotResultsFlags.NextOffset); ToStream(output, SwitchPM, Flags, (int)BotResultsFlags.SwitchPM); Results.ToStream(output); CacheTime.ToStream(output); } } public class TLBotResults51 : TLBotResults { public new const uint Signature = TLConstructors.TLBotResults51; public TLInlineBotSwitchPM SwitchPM { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, bytes, ref position); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, bytes, ref position); Results = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), ToBytes(NextOffset, Flags, (int)BotResultsFlags.NextOffset), ToBytes(SwitchPM, Flags, (int)BotResultsFlags.SwitchPM), Results.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, input); SwitchPM = GetObject(Flags, (int)BotResultsFlags.SwitchPM, null, input); Results = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); ToStream(output, NextOffset, Flags, (int)BotResultsFlags.NextOffset); ToStream(output, SwitchPM, Flags, (int)BotResultsFlags.SwitchPM); Results.ToStream(output); } } public class TLBotResults : TLBotInlineResultBase { public const uint Signature = TLConstructors.TLBotResults; public TLInt Flags { get; set; } public bool Gallery { get { return IsSet(Flags, (int)BotResultsFlags.Gallery); } } public TLString NextOffset { get; set; } public TLVector Results { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); NextOffset = GetObject(Flags, (int) BotResultsFlags.NextOffset, null, bytes, ref position); Results = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), QueryId.ToBytes(), ToBytes(NextOffset, Flags, (int)BotResultsFlags.NextOffset), Results.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); NextOffset = GetObject(Flags, (int)BotResultsFlags.NextOffset, null, input); Results = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); ToStream(output, NextOffset, Flags, (int)BotResultsFlags.NextOffset); Results.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLCallsSecurity.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum CallsSecurityFlags { PeerToPeer = 0x1, PeerToPeerEverybody = 0x4, PeerToPeerContacts = 0x8, PeetToPeerNobody = 0x10 } public class TLCallsSecurity : TLObject { public const uint Signature = TLConstructors.TLCallsSecurity; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool PeerToPeer { get { return IsSet(Flags, (int) CallsSecurityFlags.PeerToPeer); } set { SetUnset(ref _flags, value, (int) CallsSecurityFlags.PeerToPeer); } } public bool PeerToPeerEverybody { get { return IsSet(Flags, (int)CallsSecurityFlags.PeerToPeerEverybody); } set { SetUnset(ref _flags, value, (int)CallsSecurityFlags.PeerToPeerEverybody); } } public bool PeerToPeerContacts { get { return IsSet(Flags, (int)CallsSecurityFlags.PeerToPeerContacts); } set { SetUnset(ref _flags, value, (int)CallsSecurityFlags.PeerToPeerContacts); } } public bool PeerToPeerNobody { get { return IsSet(Flags, (int)CallsSecurityFlags.PeetToPeerNobody); } set { SetUnset(ref _flags, value, (int)CallsSecurityFlags.PeetToPeerNobody); } } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } public void Update(bool defaultP2PContacts) { var updated = PeerToPeerEverybody || PeerToPeerContacts || PeerToPeerNobody; if (!updated) { if (PeerToPeer) { PeerToPeerEverybody = false; PeerToPeerContacts = defaultP2PContacts; PeerToPeerNobody = !defaultP2PContacts; } else { PeerToPeerEverybody = false; PeerToPeerContacts = false; PeerToPeerNobody = true; } } } } } ================================================ FILE: Telegram.Api/TL/TLCameraSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum CameraSettingsFlags { External = 0x1, // 0 } public class TLCameraSettings : TLObject { public const uint Signature = TLConstructors.TLCameraSettings; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool External { get { return IsSet(Flags, (int) CameraSettingsFlags.External); } set { SetUnset(ref _flags, value, (int) CameraSettingsFlags.External); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLCdnConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLCdnConfig : TLObject { public const uint Signature = TLConstructors.TLCdnConfig; public TLVector PublicKeys { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PublicKeys = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PublicKeys = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PublicKeys.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLCdnFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLCdnFileBase : TLObject { } public class TLCdnFile : TLCdnFileBase { public const uint Signature = TLConstructors.TLCdnFile; public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Bytes = GetObject(bytes, ref position); return this; } } public class TLCdnFileReuploadNeeded : TLCdnFileBase { public const uint Signature = TLConstructors.TLCdnFileReuploadNeeded; public TLString RequestToken { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RequestToken = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLCdnPublicKey.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public enum CdnPublicKeyCustomFlags { PublicKeyFingerprint = 0x1 } public class TLCdnPublicKey : TLObject { public const uint Signature = TLConstructors.TLCdnPublicKey; public TLInt DCId { get; set; } public TLString PublicKey { get; set; } #region Additional private TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } private TLLong _publicKeyFingerprint; public TLLong PublicKeyFingerprint { get { return _publicKeyFingerprint; } set { SetField(out _publicKeyFingerprint, value, ref _customFlags, (int) CdnPublicKeyCustomFlags.PublicKeyFingerprint); } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); PublicKey = GetObject(bytes, ref position); CustomFlags = new TLLong(0); return this; } public override TLObject FromStream(Stream input) { DCId = GetObject(input); PublicKey = GetObject(input); CustomFlags = GetObject(input); _publicKeyFingerprint = GetObject(CustomFlags, (int) CdnPublicKeyCustomFlags.PublicKeyFingerprint, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); DCId.ToStream(output); PublicKey.ToStream(output); CustomFlags.ToStream(output); ToStream(output, _publicKeyFingerprint, CustomFlags, (int)CdnPublicKeyCustomFlags.PublicKeyFingerprint); } } } ================================================ FILE: Telegram.Api/TL/TLChannelAdminLogEvent.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLChannelAdminLogEvent : TLObject { public const uint Signature = TLConstructors.TLChannelAdminLogEvent; public TLLong Id { get; set; } public TLInt Date { get; set; } public TLInt UserId { get; set; } public TLChannelAdminLogEventActionBase Action { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Date = GetObject(input); UserId = GetObject(input); Action = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Date.ToStream(output); UserId.ToStream(output); Action.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChannelAdminLogEventAction.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLChannelAdminLogEventActionBase : TLObject { } public class TLChannelAdminLogEventActionChangeTitle : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionChangeTitle; public TLString PrevValue { get; set; } public TLString NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevValue = GetObject(bytes, ref position); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevValue = GetObject(input); NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevValue.ToStream(output); NewValue.ToStream(output); } } public class TLChannelAdminLogEventActionChangeAbout : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionChangeAbout; public TLString PrevValue { get; set; } public TLString NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevValue = GetObject(bytes, ref position); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevValue = GetObject(input); NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevValue.ToStream(output); NewValue.ToStream(output); } } public class TLChannelAdminLogEventActionChangeUsername : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionChangeUsername; public TLString PrevValue { get; set; } public TLString NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevValue = GetObject(bytes, ref position); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevValue = GetObject(input); NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevValue.ToStream(output); NewValue.ToStream(output); } } public class TLChannelAdminLogEventActionChangePhoto : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionChangePhoto; public TLPhotoBase PrevPhoto { get; set; } public TLPhotoBase NewPhoto { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevPhoto = GetObject(bytes, ref position); NewPhoto = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevPhoto = GetObject(input); NewPhoto = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevPhoto.ToStream(output); NewPhoto.ToStream(output); } } public class TLChannelAdminLogEventActionToggleInvites : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionToggleInvites; public TLBool NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NewValue.ToStream(output); } } public class TLChannelAdminLogEventActionToggleSignatures : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionToggleSignatures; public TLBool NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NewValue.ToStream(output); } } public class TLChannelAdminLogEventActionUpdatePinned : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionUpdatePinned; public TLMessageBase Message { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Message = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); } } public class TLChannelAdminLogEventActionEditMessage : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionEditMessage; public TLMessageBase PrevMessage { get; set; } public TLMessageBase NewMessage { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevMessage = GetObject(bytes, ref position); NewMessage = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevMessage = GetObject(input); NewMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevMessage.ToStream(output); NewMessage.ToStream(output); } } public class TLChannelAdminLogEventActionDeleteMessage : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionDeleteMessage; public TLMessageBase Message { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Message = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); } } public class TLChannelAdminLogEventActionParticipantJoin : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionParticipantJoin; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLChannelAdminLogEventActionParticipantLeave : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionParticipantLeave; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLChannelAdminLogEventActionParticipantInvite : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionParticipantInvite; public TLChannelParticipantBase Participant { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Participant = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Participant = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Participant.ToStream(output); } } public class TLChannelAdminLogEventActionParticipantToggleBan : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionParticipantToggleBan; public TLChannelParticipantBase PrevParticipant { get; set; } public TLChannelParticipantBase NewParticipant { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevParticipant = GetObject(bytes, ref position); NewParticipant = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevParticipant = GetObject(input); NewParticipant = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevParticipant.ToStream(output); NewParticipant.ToStream(output); } } public class TLChannelAdminLogEventActionParticipantToggleAdmin : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionParticipantToggleAdmin; public TLChannelParticipantBase PrevParticipant { get; set; } public TLChannelParticipantBase NewParticipant { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevParticipant = GetObject(bytes, ref position); NewParticipant = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevParticipant = GetObject(input); NewParticipant = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevParticipant.ToStream(output); NewParticipant.ToStream(output); } } public class TLChannelAdminLogEventActionChangeStickerSet : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionChangeStickerSet; public TLInputStickerSetBase PrevStickerSet { get; set; } public TLInputStickerSetBase NewStickerSet { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PrevStickerSet = GetObject(bytes, ref position); NewStickerSet = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PrevStickerSet = GetObject(input); NewStickerSet = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PrevStickerSet.ToStream(output); NewStickerSet.ToStream(output); } } public class TLChannelAdminLogEventActionTogglePreHistoryHidden : TLChannelAdminLogEventActionBase { public const uint Signature = TLConstructors.TLChannelAdminLogEventActionTogglePreHistoryHidden; public TLBool NewValue { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewValue = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { NewValue = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NewValue.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChannelAdminLogEventsFilter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChannelAdminLogEventsFilterFlags { Join = 0x1, Leave = 0x2, Invite = 0x4, Ban = 0x8, Unban = 0x10, Kick = 0x20, Unkick = 0x40, Promote = 0x80, Demote = 0x100, Info = 0x200, Settings = 0x400, Pinned = 0x800, Edit = 0x1000, Delete = 0x2000, } public class TLChannelAdminLogEventsFilter : TLObject { public const uint Signature = TLConstructors.TLChannelAdminLogEventsFilter; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Join { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Join); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Join); } } public bool Leave { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Leave); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Leave); } } public bool Invite { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Invite); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Invite); } } public bool Ban { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Ban); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Ban); } } public bool Unban { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Unban); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Unban); } } public bool Kick { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Kick); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Kick); } } public bool Unkick { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Unkick); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Unkick); } } public bool Promote { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Promote); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Promote); } } public bool Demote { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Demote); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Demote); } } public bool Info { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Info); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Info); } } public bool Settings { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Settings); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Settings); } } public bool Pinned { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Pinned); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Pinned); } } public bool Edit { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Edit); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Edit); } } public bool Delete { get { return IsSet(_flags, (int)ChannelAdminLogEventsFilterFlags.Delete); } set { SetUnset(ref _flags, value, (int)ChannelAdminLogEventsFilterFlags.Delete); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChannelAdminRights.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChannelAdminRightsFlags { ChannelInfo = 0x1, PostMessages = 0x2, EditMessages = 0x4, DeleteMessages = 0x8, BanUsers = 0x10, InviteUsers = 0x20, InviteLinks = 0x40, PinMessages = 0x80, AddAdmins = 0x200, } public class TLChannelAdminRights : TLObject { public const uint Signature = TLConstructors.TLChannelAdminRights; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool ChannelInfo { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.ChannelInfo); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.ChannelInfo); } } public bool PostMessages { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.PostMessages); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.PostMessages); } } public bool EditMessages { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.EditMessages); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.EditMessages); } } public bool DeleteMessages { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.DeleteMessages); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.DeleteMessages); } } public bool BanUsers { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.BanUsers); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.BanUsers); } } public bool InviteUsers { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.InviteUsers); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.InviteUsers); } } public bool InviteLinks { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.InviteLinks); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.InviteLinks); } } public bool PinMessages { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.PinMessages); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.PinMessages); } } public bool AddAdmins { get { return IsSet(_flags, (int)ChannelAdminRightsFlags.AddAdmins); } set { SetUnset(ref _flags, value, (int)ChannelAdminRightsFlags.AddAdmins); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLChannelBannedRights.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChannelBannedRightsFlags { ViewMessages = 0x1, SendMessages = 0x2, SendMedia = 0x4, SendStickers = 0x8, SendGifs = 0x10, SendGames = 0x20, SendInline = 0x40, EmbedLinks = 0x80, } public class TLChannelBannedRights : TLObject { public const uint Signature = TLConstructors.TLChannelBannedRights; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt UntilDate { get; set; } public bool ViewMessages { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.ViewMessages); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.ViewMessages); } } public bool SendMessages { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendMessages); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendMessages); } } public bool SendMedia { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendMedia); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendMedia); } } public bool SendStickers { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendStickers); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendStickers); } } public bool SendGifs { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendGifs); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendGifs); } } public bool SendGames { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendGames); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendGames); } } public bool SendInline { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.SendInline); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.SendInline); } } public bool EmbedLinks { get { return IsSet(_flags, (int)ChannelBannedRightsFlags.EmbedLinks); } set { SetUnset(ref _flags, value, (int)ChannelBannedRightsFlags.EmbedLinks); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); UntilDate = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); UntilDate = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); UntilDate.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChannelDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChannelDifferenceFlags { Final = 0x1, Timeout = 0x2 } public abstract class TLChannelDifferenceBase : TLObject { protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Pts { get; set; } protected TLInt _timeout; public TLInt Timeout { get { return _timeout; } set { SetField(out _timeout, value, ref _flags, (int) ChannelDifferenceFlags.Timeout); } } } public class TLChannelDifferenceEmpty : TLChannelDifferenceBase { public const uint Signature = TLConstructors.TLChannelDifferenceEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); _timeout = GetObject(Flags, (int) ChannelDifferenceFlags.Timeout, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Pts.ToStream(output); ToStream(output, Timeout, Flags, (int) ChannelDifferenceFlags.Timeout); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Pts = GetObject(input); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, input); return this; } public override string ToString() { return string.Format("TLChannelDifferenceEmpty flags={0} pts={1} timeout={2}", Flags, Pts, Timeout); } } public class TLChannelDifferenceTooLong : TLChannelDifferenceBase { public const uint Signature = TLConstructors.TLChannelDifferenceTooLong; public TLInt TopMessage { get; set; } public TLInt TopImportantMessage { get; set; } public TLInt ReadInboxMaxId { get; set; } public TLInt UnreadCount { get; set; } public TLInt UnreadMentionsCount { get; set; } public TLVector Messages { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, bytes, ref position); TopMessage = GetObject(bytes, ref position); TopImportantMessage = GetObject(bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadMentionsCount = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Pts.ToStream(output); ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout); TopMessage.ToStream(output); TopImportantMessage.ToStream(output); ReadInboxMaxId.ToStream(output); UnreadCount.ToStream(output); UnreadMentionsCount.ToStream(output); Messages.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Pts = GetObject(input); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, input); TopMessage = GetObject(input); TopImportantMessage = GetObject(input); ReadInboxMaxId = GetObject(input); UnreadCount = GetObject(input); UnreadMentionsCount = GetObject(input); Messages = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override string ToString() { return string.Format("TLChannelDifferenceTooLong flags={0} pts={1} timeout={2} new_messages={3}", Flags, Pts, Timeout, Messages.Count); } } public class TLChannelDifferenceTooLong53 : TLChannelDifferenceTooLong { public new const uint Signature = TLConstructors.TLChannelDifferenceTooLong53; public TLInt ReadOutboxMaxId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, bytes, ref position); TopMessage = GetObject(bytes, ref position); TopImportantMessage = new TLInt(0); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadMentionsCount = new TLInt(0); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Pts.ToStream(output); ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout); TopMessage.ToStream(output); ReadInboxMaxId.ToStream(output); ReadOutboxMaxId.ToStream(output); UnreadCount.ToStream(output); Messages.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Pts = GetObject(input); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, input); TopMessage = GetObject(input); TopImportantMessage = new TLInt(0); ReadInboxMaxId = GetObject(input); ReadOutboxMaxId = GetObject(input); UnreadCount = GetObject(input); UnreadMentionsCount = new TLInt(0); Messages = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override string ToString() { return string.Format("TLChannelDifferenceTooLong53 flags={0} pts={1} timeout={2} new_messages={3}", Flags, Pts, Timeout, Messages.Count); } } public class TLChannelDifferenceTooLong71 : TLChannelDifferenceTooLong53 { public new const uint Signature = TLConstructors.TLChannelDifferenceTooLong71; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, bytes, ref position); TopMessage = GetObject(bytes, ref position); TopImportantMessage = new TLInt(0); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadMentionsCount = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Pts.ToStream(output); ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout); TopMessage.ToStream(output); ReadInboxMaxId.ToStream(output); ReadOutboxMaxId.ToStream(output); UnreadCount.ToStream(output); UnreadMentionsCount.ToStream(output); Messages.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Pts = GetObject(input); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, input); TopMessage = GetObject(input); TopImportantMessage = new TLInt(0); ReadInboxMaxId = GetObject(input); ReadOutboxMaxId = GetObject(input); UnreadCount = GetObject(input); UnreadMentionsCount = GetObject(input); Messages = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override string ToString() { return string.Format("TLChannelDifferenceTooLong71 flags={0} pts={1} timeout={2} new_messages={3}", Flags, Pts, Timeout, Messages.Count); } } public class TLChannelDifference : TLChannelDifferenceBase { public const uint Signature = TLConstructors.TLChannelDifference; public TLVector NewMessages { get; set; } public TLVector OtherUpdates { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, bytes, ref position); NewMessages = GetObject>(bytes, ref position); OtherUpdates = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Pts.ToStream(output); ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout); NewMessages.ToStream(output); OtherUpdates.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Pts = GetObject(input); _timeout = GetObject(Flags, (int)ChannelDifferenceFlags.Timeout, null, input); NewMessages = GetObject>(input); OtherUpdates = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override string ToString() { return string.Format("TLChannelDifference flags={0} pts={1} timeout={2} new_messages={3} other_updates={4}", Flags, Pts, Timeout, NewMessages.Count, OtherUpdates.Count); } } } ================================================ FILE: Telegram.Api/TL/TLChannelMessagesFiler.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLChannelMessagesFilerBase : TLObject { } public class TLChannelMessagesFilterEmpty : TLChannelMessagesFilerBase { public const uint Signature = TLConstructors.TLChannelMessagesFilterEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLChannelMessagesFilter : TLChannelMessagesFilerBase { public const uint Signature = TLConstructors.TLChannelMessagesFilter; public TLInt Flags { get; set; } public TLVector Ranges { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Ranges.ToBytes() ); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Ranges.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Ranges = GetObject>(input); return this; } } public class TLChannelMessagesFilterCollapsed : TLChannelMessagesFilerBase { public const uint Signature = TLConstructors.TLChannelMessagesFilterCollapsed; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLChannelParticipant.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public enum ChannelParticipantBannedFlags { Left = 0x1 } public enum ChannelParticipantAdminFlags { CanEdit = 0x1 } public interface IChannelInviter { TLInt InviterId { get; set; } TLInt Date { get; set; } } public abstract class TLChannelParticipantBase : TLObject { public TLInt UserId { get; set; } } public class TLChannelParticipant : TLChannelParticipantBase { public const uint Signature = TLConstructors.TLChannelParticipant; public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(Date.ToBytes()); } } public class TLChannelParticipantSelf : TLChannelParticipantBase, IChannelInviter { public const uint Signature = TLConstructors.TLChannelParticipantSelf; public TLInt InviterId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(InviterId.ToBytes()); output.Write(Date.ToBytes()); } } [Obsolete] public class TLChannelParticipantModerator : TLChannelParticipantBase, IChannelInviter { public const uint Signature = TLConstructors.TLChannelParticipantModerator; public TLInt InviterId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(InviterId.ToBytes()); output.Write(Date.ToBytes()); } } [Obsolete] public class TLChannelParticipantEditor : TLChannelParticipantBase, IChannelInviter { public const uint Signature = TLConstructors.TLChannelParticipantEditor; public TLInt InviterId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(InviterId.ToBytes()); output.Write(Date.ToBytes()); } } [Obsolete] public class TLChannelParticipantKicked : TLChannelParticipantBase { public const uint Signature = TLConstructors.TLChannelParticipantKicked; public TLInt KickedBy { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); KickedBy = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); KickedBy = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(KickedBy.ToBytes()); output.Write(Date.ToBytes()); } } public class TLChannelParticipantCreator : TLChannelParticipantBase { public const uint Signature = TLConstructors.TLChannelParticipantCreator; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); } } public class TLChannelParticipantAdmin : TLChannelParticipantBase { public const uint Signature = TLConstructors.TLChannelParticipantAdmin; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool CanEdit { get { return IsSet(Flags, (int)ChannelParticipantAdminFlags.CanEdit); } set { SetUnset(ref _flags, value, (int)ChannelParticipantAdminFlags.CanEdit); } } public TLInt InviterId { get; set; } public TLInt PromotedById { get; set; } public TLInt Date { get; set; } public TLChannelAdminRights AdminRights { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); PromotedById = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminRights = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); UserId = GetObject(input); InviterId = GetObject(input); PromotedById = GetObject(input); Date = GetObject(input); AdminRights = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); UserId.ToStream(output); InviterId.ToStream(output); PromotedById.ToStream(output); Date.ToStream(output); AdminRights.ToStream(output); } } public class TLChannelParticipantBanned : TLChannelParticipantKicked { public new const uint Signature = TLConstructors.TLChannelParticipantBanned; public TLInt Flags { get; set; } public bool Left { get { return IsSet(Flags, (int) ChannelParticipantBannedFlags.Left); } } public TLChannelBannedRights BannedRights { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); KickedBy = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); BannedRights = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); UserId = GetObject(input); KickedBy = GetObject(input); Date = GetObject(input); BannedRights = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); UserId.ToStream(output); KickedBy.ToStream(output); Date.ToStream(output); BannedRights.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChannelParticipantRole.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLChannelParticipantRoleBase : TLObject { } [Obsolete] public class TLChannelRoleEmpty : TLChannelParticipantRoleBase { public const uint Signature = TLConstructors.TLChannelRoleEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } [Obsolete] public class TLChannelRoleModerator : TLChannelParticipantRoleBase { public const uint Signature = TLConstructors.TLChannelRoleModerator; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } [Obsolete] public class TLChannelRoleEditor : TLChannelParticipantRoleBase { public const uint Signature = TLConstructors.TLChannelRoleEditor; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLChannelParticipantsFilter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLChannelParticipantsFilterBase : TLObject { } public class TLChannelParticipantsRecent : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsRecent; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLChannelParticipantsAdmins : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsAdmins; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLChannelParticipantsKicked68 : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsKicked68; public TLString Q { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Q.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Q.ToStream(output); } public override TLObject FromStream(Stream input) { Q = GetObject(input); return this; } } public class TLChannelParticipantsKicked : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsKicked; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLChannelParticipantsBots : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsBots; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLChannelParticipantsBanned : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsBanned; public TLString Q { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Q.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Q.ToStream(output); } public override TLObject FromStream(Stream input) { Q = GetObject(input); return this; } } public class TLChannelParticipantsSearch : TLChannelParticipantsFilterBase { public const uint Signature = TLConstructors.TLChannelParticipantsSearch; public TLString Q { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Q.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Q.ToStream(output); } public override TLObject FromStream(Stream input) { Q = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL.Interfaces; namespace Telegram.Api.TL { [Flags] public enum ChatFlags { Creator = 0x1, Kicked = 0x2, Left = 0x4, AdminsEnabled = 0x8, Admin = 0x10, Deactivated = 0x20, MigratedTo = 0x40 } [Flags] public enum ChatCustomFlags { ReadInboxMaxId = 0x1, ReadOutboxMaxId = 0x2, } [Flags] public enum ChannelFlags { Creator = 0x1, Kicked = 0x2, Left = 0x4, Editor = 0x8, Moderator = 0x10, Broadcast = 0x20, Public = 0x40, Verified = 0x80, MegaGroup = 0x100, Restricted = 0x200, Democracy = 0x400, Signatures = 0x800, Min = 0x1000, AccessHash = 0x2000, AdminRights = 0x4000, BannedRights = 0x8000, UntilDate = 0x10000, ParticipantsCount = 0x20000, FeedId = 0x40000, } [Flags] public enum ChannelCustomFlags { MigratedFromChatId = 0x1, MigratedFromMaxId = 0x2, Silent = 0x4, PinnedMsgId = 0x8, HiddenPinnedMsgId = 0x10, ReadOutboxMaxId = 0x20, ReadInboxMaxId = 0x40, CanSetStickers = 0x80, StickerSet = 0x100, AvailableMinId = 0x200, HiddenPrehistory = 0x400 } public abstract class TLChatBase : TLObject, IInputPeer, IFullName, INotifySettings { public static string ChatFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (ChatFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public static string ChannelFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (ChannelFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public static string ChannelCustomFlagsString(TLLong flags) { if (flags == null) return string.Empty; var list = (ChannelCustomFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public int Index { get { return Id.Value; } set { Id = new TLInt(value); } } public TLInt Id { get; set; } public virtual void Update(TLChatBase chat) { Id = chat.Id; if (chat.Participants != null) { Participants = chat.Participants; } if (chat.ChatPhoto != null) { ChatPhoto = chat.ChatPhoto; } if (chat.NotifySettings != null) { NotifySettings = chat.NotifySettings; } } public abstract TLInputPeerBase ToInputPeer(); public abstract string GetUnsendedTextFileName(); #region Full chat information public TLChatParticipantsBase Participants { get; set; } public TLPhotoBase ChatPhoto { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public int UsersOnline { get; set; } public TLExportedChatInvite ExportedInvite { get; set; } #endregion public TLInputNotifyPeerBase ToInputNotifyPeer() { return new TLInputNotifyPeer { Peer = ToInputPeer() }; } public abstract string FullName { get; } public virtual string FullName2 { get { return FullName; } } public virtual string ShortName { get { return FullName; } } public abstract bool IsForbidden { get; } #region Additional public IList FullNameWords { get; set; } public TLVector BotInfo { get; set; } #endregion } public class TLChatEmpty : TLChatBase { public const uint Signature = TLConstructors.TLChatEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string FullName { get { return string.Empty; } } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerChat { ChatId = Id }; } public override string GetUnsendedTextFileName() { return "c" + Id + ".dat"; } public override bool IsForbidden { get { return true; } } } public class TLChat : TLChatBase { public const uint Signature = TLConstructors.TLChat; protected TLString _title; public TLString Title { get { return _title; } set { SetField(ref _title, value, () => Title); NotifyOfPropertyChange(() => FullName); } } protected TLPhotoBase _photo; public TLPhotoBase Photo { get { return _photo; } set { SetField(ref _photo, value, () => Photo); } } public TLInt ParticipantsCount { get; set; } public TLInt Date { get; set; } public virtual TLBool Left { get; set; } public TLInt Version { get; set; } public override string ToString() { return Title.ToString(); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _title = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); ParticipantsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Left = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); _title = GetObject(input); _photo = GetObject(input); ParticipantsCount = GetObject(input); Date = GetObject(input); Left = GetObject(input); Version = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); Photo.ToStream(output); output.Write(ParticipantsCount.ToBytes()); output.Write(Date.ToBytes()); output.Write(Left.ToBytes()); output.Write(Version.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); } public override string FullName { get { return Title != null ? Title.ToString() : string.Empty; } } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChat; if (c != null) { _title = c.Title; if (Photo.GetType() != c.Photo.GetType()) { _photo = c.Photo; // при удалении фото чата не обновляется UI при _photo = c.Photo } else { Photo.Update(c.Photo); } ParticipantsCount = c.ParticipantsCount; Date = c.Date; Left = c.Left; Version = c.Version; } } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerChat { ChatId = Id }; } public override string GetUnsendedTextFileName() { return "c" + Id + ".dat"; } public override bool IsForbidden { get { return Left.Value; } } } public class TLChat40 : TLChat { public new const uint Signature = TLConstructors.TLChat40; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Left { get { return new TLBool(IsSet(_flags, (int)ChatFlags.Left)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)ChatFlags.Left); } } } public bool Creator { get { return IsSet(_flags, (int)ChatFlags.Creator); } } public TLBool Admin { get { return new TLBool(IsSet(_flags, (int)ChatFlags.Admin)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)ChatFlags.Admin); } } } public TLBool AdminsEnabled { get { return new TLBool(IsSet(_flags, (int)ChatFlags.AdminsEnabled)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)ChatFlags.AdminsEnabled); } } } public bool Deactivated { get { return IsSet(_flags, (int)ChatFlags.Deactivated); } } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); _title = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); ParticipantsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); //Left = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); _title = GetObject(input); _photo = GetObject(input); ParticipantsCount = GetObject(input); Date = GetObject(input); //Left = GetObject(input); Version = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); Photo.ToStream(output); output.Write(ParticipantsCount.ToBytes()); output.Write(Date.ToBytes()); //output.Write(Left.ToBytes()); output.Write(Version.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); CustomFlags.NullableToStream(output); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChat40; if (c != null) { Flags = c.Flags; if (c.CustomFlags != null) { CustomFlags = c.CustomFlags; } } } public override string ToString() { return base.ToString() + " flags=" + ChatFlagsString(Flags); } } public class TLChat41 : TLChat40, IReadMaxId { public new const uint Signature = TLConstructors.TLChat41; public bool IsMigrated { get { return IsSet(Flags, (int)ChatFlags.MigratedTo); } } private TLInputChannelBase _migratedTo; public TLInputChannelBase MigratedTo { get { return _migratedTo; } set { SetField(out _migratedTo, value, ref _flags, (int)ChatFlags.MigratedTo); } } private TLInt _readInboxMaxId; public TLInt ReadInboxMaxId { get { return _readInboxMaxId; } set { SetField(out _readInboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadInboxMaxId); } } private TLInt _readOutboxMaxId; public TLInt ReadOutboxMaxId { get { return _readOutboxMaxId; } set { SetField(out _readOutboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadOutboxMaxId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); _title = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); ParticipantsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); //Left = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); _migratedTo = GetObject(Flags, (int)ChatFlags.MigratedTo, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); _title = GetObject(input); _photo = GetObject(input); ParticipantsCount = GetObject(input); Date = GetObject(input); //Left = GetObject(input); Version = GetObject(input); _migratedTo = GetObject(Flags, (int)ChatFlags.MigratedTo, null, input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; CustomFlags = GetNullableObject(input); _readInboxMaxId = GetObject(CustomFlags, (int)ChatCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChatCustomFlags.ReadOutboxMaxId, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); Photo.ToStream(output); output.Write(ParticipantsCount.ToBytes()); output.Write(Date.ToBytes()); //output.Write(Left.ToBytes()); output.Write(Version.ToBytes()); ToStream(output, MigratedTo, Flags, (int)ChatFlags.MigratedTo); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, ReadInboxMaxId, CustomFlags, (int)ChatCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChatCustomFlags.ReadOutboxMaxId); } public override void Update(TLChatBase chat) { base.Update(chat); var chat41 = chat as TLChat41; if (chat41 != null) { if (chat41.MigratedTo != null) { MigratedTo = chat41.MigratedTo; } if (chat41.ReadInboxMaxId != null && (ReadInboxMaxId == null || ReadInboxMaxId.Value < chat41.ReadInboxMaxId.Value)) { ReadInboxMaxId = chat41.ReadInboxMaxId; } if (chat41.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < chat41.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = chat41.ReadOutboxMaxId; } } } } public class TLChatForbidden : TLChatBase { public const uint Signature = TLConstructors.TLChatForbidden; public TLString Title { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Title = GetObject(input); Date = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); output.Write(Date.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); } public override void Update(TLChatBase chat) { base.Update(chat); var c = (TLChatForbidden)chat; Title = c.Title; Date = c.Date; } public override string FullName { get { return Title != null ? Title.ToString() : string.Empty; } } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerChat { ChatId = Id }; } public override string GetUnsendedTextFileName() { return "c" + Id + ".dat"; } public override bool IsForbidden { get { return true; } } } public class TLChatForbidden40 : TLChatForbidden, IReadMaxId { public new const uint Signature = TLConstructors.TLChatForbidden40; protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } private TLInt _readInboxMaxId; public TLInt ReadInboxMaxId { get { return _readInboxMaxId; } set { SetField(out _readInboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadInboxMaxId); } } private TLInt _readOutboxMaxId; public TLInt ReadOutboxMaxId { get { return _readOutboxMaxId; } set { SetField(out _readOutboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadOutboxMaxId); } } #region Additional public TLPhotoBase Photo { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); //Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Title = GetObject(input); //Date = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; CustomFlags = GetNullableObject(input); _readInboxMaxId = GetObject(CustomFlags, (int)ChatCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChatCustomFlags.ReadOutboxMaxId, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); //output.Write(Date.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, ReadInboxMaxId, CustomFlags, (int)ChatCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChatCustomFlags.ReadOutboxMaxId); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChatForbidden40; if (c != null) { if (c.ReadInboxMaxId != null && (ReadInboxMaxId == null || ReadInboxMaxId.Value < c.ReadInboxMaxId.Value)) { ReadInboxMaxId = c.ReadInboxMaxId; } if (c.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < c.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = c.ReadOutboxMaxId; } } } } public class TLBroadcastChat : TLChatBase { public const uint Signature = TLConstructors.TLBroadcastChat; public TLVector ParticipantIds { get; set; } protected TLString _title; public TLString Title { get { return _title; } set { SetField(ref _title, value, () => Title); NotifyOfPropertyChange(() => FullName); } } public TLPhotoBase _photo; public TLPhotoBase Photo { get { return _photo; } set { SetField(ref _photo, value, () => Photo); } } public override string FullName { get { return Title != null ? Title.ToString() : string.Empty; } } public override TLObject FromStream(Stream input) { Id = GetObject(input); _title = GetObject(input); _photo = GetObject(input); ParticipantIds = GetObject>(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); Photo.ToStream(output); ParticipantIds.ToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLBroadcastChat; if (c != null) { _title = c.Title; if (Photo.GetType() != c.Photo.GetType()) { _photo = c.Photo; } else { Photo.Update(c.Photo); } ParticipantIds = c.ParticipantIds; } } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerBroadcast { ChatId = Id }; } public override string GetUnsendedTextFileName() { return "b" + Id + ".dat"; } public override bool IsForbidden { get { return false; } } } public class TLChannel76 : TLChannel73 { public new const uint Signature = TLConstructors.TLChannel76; protected TLInt _feedId; public TLInt FeedId { get { return _feedId; } set { SetField(out _feedId, value, ref _flags, (int)ChannelFlags.FeedId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), bytes, ref position); _title = GetObject(bytes, ref position); UserName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, bytes, ref position); _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, bytes, ref position); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, bytes, ref position); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, bytes, ref position); _participantsCount = GetObject(Flags, (int)ChannelFlags.ParticipantsCount, null, bytes, ref position); _feedId = GetObject(Flags, (int)ChannelFlags.FeedId, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), input); _title = GetObject(input); _userName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, input); _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, input); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, input); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, input); _participantsCount = GetObject(Flags, (int)ChannelFlags.ParticipantsCount, null, input); _feedId = GetObject(Flags, (int)ChannelFlags.FeedId, null, input); CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); _migratedFromChatId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId, null, input); _migratedFromMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId, null, input); _pinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.PinnedMsgId, null, input); _hiddenPinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); _stickerSet = GetObject(CustomFlags, (int)ChannelCustomFlags.StickerSet, null, input); _availableMinId = GetObject(CustomFlags, (int)ChannelCustomFlags.AvailableMinId, null, input); return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); ToStream(output, AccessHash, Flags, (int)ChannelFlags.AccessHash); output.Write(Title.ToBytes()); ToStream(output, UserName, Flags, (int)ChannelFlags.Public); Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); ToStream(output, RestrictionReason, Flags, (int)ChannelFlags.Restricted); ToStream(output, AdminRights, Flags, (int)ChannelFlags.AdminRights); ToStream(output, BannedRights, Flags, (int)ChannelFlags.BannedRights); ToStream(output, ParticipantsCount, Flags, (int)ChannelFlags.ParticipantsCount); ToStream(output, FeedId, Flags, (int)ChannelFlags.FeedId); CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); ToStream(output, _migratedFromChatId, CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId); ToStream(output, _migratedFromMaxId, CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId); ToStream(output, PinnedMsgId, CustomFlags, (int)ChannelCustomFlags.PinnedMsgId); ToStream(output, HiddenPinnedMsgId, CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); ToStream(output, _stickerSet, CustomFlags, (int)ChannelCustomFlags.StickerSet); ToStream(output, _availableMinId, CustomFlags, (int)ChannelCustomFlags.AvailableMinId); } catch (Exception ex) { Execute.ShowDebugMessage( string.Format( "TLChannel76.ToStream access_hash={0} user_name={1} restriction_reason={2} migrated_from_chat_id={3} migrated_from_max_id={4} pinned_msg_id={5} hidden_pinned_msg_id={9} flags={6} custom_flags={7} ex {8}", AccessHash, UserName, RestrictionReason, MigratedFromChatId, MigratedFromMaxId, PinnedMsgId, ChannelFlagsString(Flags), ChannelCustomFlagsString(CustomFlags), HiddenPinnedMsgId, ex)); } } public override void Update(TLChatBase chat) { var c = chat as TLChannel76; if (c != null) { FeedId = c.FeedId; } base.Update(chat); } } public class TLChannel73 : TLChannel68 { public new const uint Signature = TLConstructors.TLChannel73; protected TLInt _participantsCount; public override TLInt ParticipantsCount { get { return _participantsCount; } set { SetField(out _participantsCount, value, ref _flags, (int)ChannelFlags.ParticipantsCount); } } public override bool CanPinMessages { get { if (IsMegaGroup) { return Creator || (AdminRights != null && AdminRights.PinMessages); } return Creator || (AdminRights != null && AdminRights.EditMessages); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), bytes, ref position); _title = GetObject(bytes, ref position); UserName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, bytes, ref position); _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, bytes, ref position); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, bytes, ref position); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, bytes, ref position); _participantsCount = GetObject(Flags, (int)ChannelFlags.ParticipantsCount, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), input); _title = GetObject(input); _userName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, input); _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, input); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, input); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, input); _participantsCount = GetObject(Flags, (int)ChannelFlags.ParticipantsCount, null, input); CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); _migratedFromChatId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId, null, input); _migratedFromMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId, null, input); _pinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.PinnedMsgId, null, input); _hiddenPinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); _stickerSet = GetObject(CustomFlags, (int)ChannelCustomFlags.StickerSet, null, input); _availableMinId = GetObject(CustomFlags, (int)ChannelCustomFlags.AvailableMinId, null, input); return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); ToStream(output, AccessHash, Flags, (int)ChannelFlags.AccessHash); output.Write(Title.ToBytes()); ToStream(output, UserName, Flags, (int)ChannelFlags.Public); Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); ToStream(output, RestrictionReason, Flags, (int)ChannelFlags.Restricted); ToStream(output, AdminRights, Flags, (int)ChannelFlags.AdminRights); ToStream(output, BannedRights, Flags, (int)ChannelFlags.BannedRights); ToStream(output, ParticipantsCount, Flags, (int)ChannelFlags.ParticipantsCount); CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); ToStream(output, _migratedFromChatId, CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId); ToStream(output, _migratedFromMaxId, CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId); ToStream(output, PinnedMsgId, CustomFlags, (int)ChannelCustomFlags.PinnedMsgId); ToStream(output, HiddenPinnedMsgId, CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); ToStream(output, _stickerSet, CustomFlags, (int)ChannelCustomFlags.StickerSet); ToStream(output, _availableMinId, CustomFlags, (int)ChannelCustomFlags.AvailableMinId); } catch (Exception ex) { Execute.ShowDebugMessage( string.Format( "TLChannel68.ToStream access_hash={0} user_name={1} restriction_reason={2} migrated_from_chat_id={3} migrated_from_max_id={4} pinned_msg_id={5} hidden_pinned_msg_id={9} flags={6} custom_flags={7} ex {8}", AccessHash, UserName, RestrictionReason, MigratedFromChatId, MigratedFromMaxId, PinnedMsgId, ChannelFlagsString(Flags), ChannelCustomFlagsString(CustomFlags), HiddenPinnedMsgId, ex)); } } public override void Update(TLChatBase chat) { var c = chat as TLChannel73; if (c != null) { if (c.ParticipantsCount != null) { ParticipantsCount = c.ParticipantsCount; } } base.Update(chat); } } public class TLChannel68 : TLChannel49 { public new const uint Signature = TLConstructors.TLChannel68; protected TLChannelAdminRights _adminRights; public TLChannelAdminRights AdminRights { get { return _adminRights; } set { SetField(out _adminRights, value, ref _flags, (int)ChannelFlags.AdminRights); } } protected TLChannelBannedRights _bannedRights; public TLChannelBannedRights BannedRights { get { return _bannedRights; } set { SetField(out _bannedRights, value, ref _flags, (int)ChannelFlags.BannedRights); } } public bool CanSetStickers { get { return IsSet(CustomFlags, (int)ChannelCustomFlags.CanSetStickers); } set { SetUnset(ref _customFlags, value, (int)ChannelCustomFlags.CanSetStickers); } } protected TLStickerSetBase _stickerSet; public TLStickerSetBase StickerSet { get { return _stickerSet; } set { SetField(out _stickerSet, value, ref _customFlags, (int)ChannelCustomFlags.StickerSet); } } public bool HiddenPrehistory { get { return IsSet(CustomFlags, (int)ChannelCustomFlags.HiddenPrehistory); } set { SetUnset(ref _customFlags, value, (int)ChannelCustomFlags.HiddenPrehistory); } } protected TLInt _availableMinId; public TLInt AvailableMinId { get { return _availableMinId; } set { SetField(out _availableMinId, value, ref _customFlags, (int)ChannelCustomFlags.AvailableMinId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), bytes, ref position); _title = GetObject(bytes, ref position); UserName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, bytes, ref position); _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, bytes, ref position); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, bytes, ref position); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), input); _title = GetObject(input); _userName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, input); _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, input); _adminRights = GetObject(Flags, (int)ChannelFlags.AdminRights, null, input); _bannedRights = GetObject(Flags, (int)ChannelFlags.BannedRights, null, input); CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); ParticipantsCount = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); _migratedFromChatId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId, null, input); _migratedFromMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId, null, input); _pinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.PinnedMsgId, null, input); _hiddenPinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); _stickerSet = GetObject(CustomFlags, (int)ChannelCustomFlags.StickerSet, null, input); _availableMinId = GetObject(CustomFlags, (int)ChannelCustomFlags.AvailableMinId, null, input); return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); ToStream(output, AccessHash, Flags, (int)ChannelFlags.AccessHash); output.Write(Title.ToBytes()); ToStream(output, UserName, Flags, (int)ChannelFlags.Public); Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); ToStream(output, RestrictionReason, Flags, (int)ChannelFlags.Restricted); ToStream(output, AdminRights, Flags, (int)ChannelFlags.AdminRights); ToStream(output, BannedRights, Flags, (int)ChannelFlags.BannedRights); CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); ParticipantsCount.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); ToStream(output, _migratedFromChatId, CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId); ToStream(output, _migratedFromMaxId, CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId); ToStream(output, PinnedMsgId, CustomFlags, (int)ChannelCustomFlags.PinnedMsgId); ToStream(output, HiddenPinnedMsgId, CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); ToStream(output, _stickerSet, CustomFlags, (int)ChannelCustomFlags.StickerSet); ToStream(output, _availableMinId, CustomFlags, (int)ChannelCustomFlags.AvailableMinId); } catch (Exception ex) { Execute.ShowDebugMessage( string.Format( "TLChannel68.ToStream access_hash={0} user_name={1} restriction_reason={2} migrated_from_chat_id={3} migrated_from_max_id={4} pinned_msg_id={5} hidden_pinned_msg_id={9} flags={6} custom_flags={7} ex {8}", AccessHash, UserName, RestrictionReason, MigratedFromChatId, MigratedFromMaxId, PinnedMsgId, ChannelFlagsString(Flags), ChannelCustomFlagsString(CustomFlags), HiddenPinnedMsgId, ex)); } } public override void Update(TLChatBase chat) { var c = chat as TLChannel68; if (c != null) { AdminRights = c.AdminRights; BannedRights = c.BannedRights; if (c.Full) { CanSetStickers = c.CanSetStickers; if (c.StickerSet != null) { if (c.StickerSet is TLStickerSetEmpty) { StickerSet = null; } else { StickerSet = c.StickerSet; } } HiddenPrehistory = c.HiddenPrehistory; AvailableMinId = c.AvailableMinId; } } base.Update(chat); } } public class TLChannel49 : TLChannel44, IReadMaxId { public new const uint Signature = TLConstructors.TLChannel49; public bool Min { get { return IsSet(Flags, (int)ChannelFlags.Min); } } protected TLInt _pinnedMsgId; public TLInt PinnedMsgId { get { return _pinnedMsgId; } set { SetField(out _pinnedMsgId, value, ref _customFlags, (int)ChannelCustomFlags.PinnedMsgId); } } protected TLInt _hiddenPinnedMsgId; public TLInt HiddenPinnedMsgId { get { return _hiddenPinnedMsgId; } set { SetField(out _hiddenPinnedMsgId, value, ref _customFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId); } } protected TLInt _readOutboxMaxId; public TLInt ReadOutboxMaxId { get { return _readOutboxMaxId; } set { SetField(out _readOutboxMaxId, value, ref _customFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), bytes, ref position); _title = GetObject(bytes, ref position); UserName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, bytes, ref position); _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { //try ////{ Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)ChannelFlags.AccessHash, new TLLong(0), input); _title = GetObject(input); _userName = GetObject(Flags, (int)ChannelFlags.Public, TLString.Empty, input); _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); RestrictionReason = GetObject(Flags, (int)ChannelFlags.Restricted, TLString.Empty, input); CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); ParticipantsCount = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); _migratedFromChatId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId, null, input); _migratedFromMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId, null, input); _pinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.PinnedMsgId, null, input); _hiddenPinnedMsgId = GetObject(CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); //} //catch (Exception ex) //{ // Execute.ShowDebugMessage("TLChannel44.FromStream ex " + ex); //} return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); ToStream(output, AccessHash, Flags, (int)ChannelFlags.AccessHash); output.Write(Title.ToBytes()); ToStream(output, UserName, Flags, (int)ChannelFlags.Public); Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); ToStream(output, RestrictionReason, Flags, (int)ChannelFlags.Restricted); CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); ParticipantsCount.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); ToStream(output, _migratedFromChatId, CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId); ToStream(output, _migratedFromMaxId, CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId); ToStream(output, PinnedMsgId, CustomFlags, (int)ChannelCustomFlags.PinnedMsgId); ToStream(output, HiddenPinnedMsgId, CustomFlags, (int)ChannelCustomFlags.HiddenPinnedMsgId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); } catch (Exception ex) { Execute.ShowDebugMessage( string.Format( "TLChannel49.ToStream access_hash={0} user_name={1} restriction_reason={2} migrated_from_chat_id={3} migrated_from_max_id={4} pinned_msg_id={5} hidden_pinned_msg_id={9} flags={6} custom_flags={7} ex {8}", AccessHash, UserName, RestrictionReason, MigratedFromChatId, MigratedFromMaxId, PinnedMsgId, ChannelFlagsString(Flags), ChannelCustomFlagsString(CustomFlags), HiddenPinnedMsgId, ex)); } } public override void Update(TLChatBase chat) { var c = chat as TLChannel49; if (c != null) { if (c.Min) { // copy flags: broadcast, verified, megagroup, democracy IsBroadcast = c.IsBroadcast; IsVerified = c.IsVerified; if (IsMegaGroup && !c.IsMegaGroup) { } IsMegaGroup = c.IsMegaGroup; IsDemocracy = c.IsDemocracy; Id = c.Id; _title = c.Title; UserName = c.UserName; _photo = c.Photo; return; } if (c.PinnedMsgId != null) { PinnedMsgId = c.PinnedMsgId; } if (c.HiddenPinnedMsgId != null) { HiddenPinnedMsgId = c.HiddenPinnedMsgId; } if (c.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < c.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = c.ReadOutboxMaxId; } } base.Update(chat); } } public class TLChannel44 : TLChannel { public new const uint Signature = TLConstructors.TLChannel44; protected TLString _restrictionReason; public TLString RestrictionReason { get { return _restrictionReason; } set { SetField(out _restrictionReason, value, ref _flags, (int)ChannelFlags.Restricted); } } public bool IsRestricted { get { return IsSet(Flags, (int)ChannelFlags.Restricted); } } public bool Silent { get { return IsSet(CustomFlags, (int)ChannelCustomFlags.Silent); } set { SetUnset(ref _customFlags, value, (int)ChannelCustomFlags.Silent); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); _title = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName = GetObject(bytes, ref position); } _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChannelFlags.Restricted)) { RestrictionReason = GetObject(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { //try ////{ Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); _title = GetObject(input); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName = GetObject(input); } _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); if (IsSet(Flags, (int)ChannelFlags.Restricted)) { RestrictionReason = GetObject(input); } CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); ParticipantsCount = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId)) { _migratedFromChatId = GetObject(input); } if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId)) { _migratedFromMaxId = GetObject(input); } //} //catch (Exception ex) //{ // Execute.ShowDebugMessage("TLChannel44.FromStream ex " + ex); //} return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Title.ToBytes()); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName.ToStream(output); } Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); if (IsSet(Flags, (int)ChannelFlags.Restricted)) { RestrictionReason.ToStream(output); } CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); ParticipantsCount.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId)) { _migratedFromChatId.ToStream(output); } if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId)) { _migratedFromMaxId.ToStream(output); } } catch (Exception ex) { Execute.ShowDebugMessage("TLChannel44.ToStream ex " + ex); } } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChannel44; if (c != null) { RestrictionReason = c.RestrictionReason ?? TLString.Empty; } } } public class TLChannel : TLBroadcastChat, IUserName, IInputChannel { public new const uint Signature = TLConstructors.TLChannel; public bool Full { get; set; } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public virtual TLBool Left { get { return new TLBool(IsSet(_flags, (int)ChatFlags.Left)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)ChatFlags.Left); } } } public TLLong AccessHash { get; set; } protected TLString _userName; public TLString UserName { get { return _userName; } set { SetField(out _userName, value, ref _flags, (int)ChannelFlags.Public); } } public TLInt Date { get; set; } public TLInt Version { get; set; } public TLString About { get; set; } public virtual TLInt ParticipantsCount { get; set; } public TLInt AdminsCount { get; set; } public TLInt KickedCount { get; set; } public TLInt ReadInboxMaxId { get; set; } private TLInt _pts; public TLInt Pts { get { return _pts; } set { _pts = value; } } public override string FullName { get { return Title != null ? Title.ToString() : string.Empty; } } public bool Creator { get { return IsSet(Flags, (int)ChannelFlags.Creator); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Creator); } } public bool IsEditor { get { return IsSet(Flags, (int)ChannelFlags.Editor); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Editor); } } public bool IsModerator { get { return IsSet(Flags, (int)ChannelFlags.Moderator); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Moderator); } } public bool IsBroadcast { get { return IsSet(Flags, (int)ChannelFlags.Broadcast); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Broadcast); } } public bool IsPublic { get { return IsSet(Flags, (int)ChannelFlags.Public); } } public bool IsKicked { get { return IsSet(Flags, (int)ChannelFlags.Kicked); } } public bool IsVerified { get { return IsSet(Flags, (int)ChannelFlags.Verified); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Verified); } } public bool IsMegaGroup { get { return IsSet(Flags, (int)ChannelFlags.MegaGroup); } set { SetUnset(ref _flags, value, (int)ChannelFlags.MegaGroup); } } public bool IsDemocracy { get { return IsSet(Flags, (int)ChannelFlags.Democracy); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Democracy); } } public bool Signatures { get { return IsSet(Flags, (int)ChannelFlags.Signatures); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Signatures); } } #region Additional public virtual bool CanPinMessages { get { return Creator; } } public string ChannelParticipantsFileName { get { return string.Format("{0}_participants.dat", Id); } } public TLChannelParticipants ChannelParticipants { get; set; } protected TLInt _migratedFromChatId; public TLInt MigratedFromChatId { get { return _migratedFromChatId; } set { SetField(out _migratedFromChatId, value, ref _customFlags, (int)ChannelCustomFlags.MigratedFromChatId); } } protected TLInt _migratedFromMaxId; public TLInt MigratedFromMaxId { get { return _migratedFromMaxId; } set { SetField(out _migratedFromMaxId, value, ref _customFlags, (int)ChannelCustomFlags.MigratedFromMaxId); } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); _title = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName = GetObject(bytes, ref position); } _photo = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); _title = GetObject(input); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName = GetObject(input); } _photo = GetObject(input); Date = GetObject(input); Version = GetObject(input); CustomFlags = GetNullableObject(input); ParticipantIds = GetNullableObject>(input); About = GetNullableObject(input); ParticipantsCount = GetNullableObject(input); AdminsCount = GetNullableObject(input); KickedCount = GetNullableObject(input); ReadInboxMaxId = GetNullableObject(input); Pts = GetNullableObject(input); Participants = GetNullableObject(input); NotifySettings = GetNullableObject(input); _migratedFromChatId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId, null, input); _migratedFromMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId, null, input); return this; } public override void ToStream(Stream output) { try { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Title.ToBytes()); if (IsSet(Flags, (int)ChannelFlags.Public)) { UserName.ToStream(output); } Photo.ToStream(output); Date.ToStream(output); Version.ToStream(output); CustomFlags.NullableToStream(output); ParticipantIds.NullableToStream(output); About.NullableToStream(output); ParticipantsCount.NullableToStream(output); AdminsCount.NullableToStream(output); KickedCount.NullableToStream(output); ReadInboxMaxId.NullableToStream(output); Pts.NullableToStream(output); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); ToStream(output, _migratedFromChatId, CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId); ToStream(output, _migratedFromMaxId, CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId); } catch (Exception ex) { } } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChannel; if (c != null) { //if (c.Flags != null) Flags = c.Flags; Creator = c.Creator; Left = c.Left; IsEditor = c.IsEditor; IsBroadcast = c.IsBroadcast; IsVerified = c.IsVerified; IsMegaGroup = c.IsMegaGroup; IsDemocracy = c.IsDemocracy; Signatures = c.Signatures; AccessHash = c.AccessHash ?? new TLLong(0); UserName = c.UserName ?? TLString.Empty; //if (c.CustomFlags != null) CustomFlags = c.CustomFlags; if (c.MigratedFromChatId != null) MigratedFromChatId = c.MigratedFromChatId; if (c.MigratedFromMaxId != null) MigratedFromMaxId = c.MigratedFromMaxId; if (c.ParticipantIds != null) ParticipantIds = c.ParticipantIds; if (c.About != null) About = c.About; if (c.ParticipantsCount != null) ParticipantsCount = c.ParticipantsCount; if (c.AdminsCount != null) AdminsCount = c.AdminsCount; if (c.KickedCount != null) KickedCount = c.KickedCount; if (c.ReadInboxMaxId != null) ReadInboxMaxId = c.ReadInboxMaxId; if (c.Participants != null) Participants = c.Participants; if (c.NotifySettings != null) NotifySettings = c.NotifySettings; } } public override string ToString() { return Title + " flags=" + ChannelFlagsString(Flags) + " custom_flags=" + ChannelCustomFlagsString(CustomFlags); ; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerChannel { ChatId = Id, AccessHash = AccessHash }; } public TLInputChannelBase ToInputChannel() { return new TLInputChannel { ChannelId = Id, AccessHash = AccessHash }; } public override string GetUnsendedTextFileName() { return "ch" + Id + ".dat"; } public override bool IsForbidden { get { return Left.Value; } } } public class TLChannelForbidden : TLChatBase, IInputChannel { public const uint Signature = TLConstructors.TLChannelForbidden; public TLLong AccessHash { get; set; } public TLString Title { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Title.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChannelForbidden; if (c != null) { Id = c.Id; AccessHash = c.AccessHash; Title = c.Title; } } public override string FullName { get { return Title != null ? Title.ToString() : string.Empty; } } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerChannel { ChatId = Id, AccessHash = AccessHash }; } public TLInputChannelBase ToInputChannel() { return new TLInputChannel { ChannelId = Id, AccessHash = AccessHash }; } public override string GetUnsendedTextFileName() { return "ch" + Id + ".dat"; } public override bool IsForbidden { get { return true; } } } public class TLChannelForbidden53 : TLChannelForbidden, IReadMaxId { public new const uint Signature = TLConstructors.TLChannelForbidden53; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public bool IsBroadcast { get { return IsSet(Flags, (int)ChannelFlags.Broadcast); } set { SetUnset(ref _flags, value, (int)ChannelFlags.Broadcast); } } public bool IsMegaGroup { get { return IsSet(Flags, (int)ChannelFlags.MegaGroup); } set { SetUnset(ref _flags, value, (int)ChannelFlags.MegaGroup); } } protected TLInt _readInboxMaxId; public TLInt ReadInboxMaxId { get { return _readInboxMaxId; } set { SetField(out _readInboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadInboxMaxId); } } protected TLInt _readOutboxMaxId; public TLInt ReadOutboxMaxId { get { return _readOutboxMaxId; } set { SetField(out _readOutboxMaxId, value, ref _customFlags, (int)ChatCustomFlags.ReadOutboxMaxId); } } #region Additional public TLPhotoBase Photo { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; CustomFlags = GetNullableObject(input); _readInboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Title.ToBytes()); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, ReadInboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChannelForbidden53; if (c != null) { IsBroadcast = c.IsBroadcast; IsMegaGroup = c.IsMegaGroup; if (c.ReadInboxMaxId != null && (ReadInboxMaxId == null || ReadInboxMaxId.Value < c.ReadInboxMaxId.Value)) { ReadInboxMaxId = c.ReadInboxMaxId; } if (c.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < c.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = c.ReadOutboxMaxId; } } } } public class TLChannelForbidden68 : TLChannelForbidden53 { public new const uint Signature = TLConstructors.TLChannelForbidden68; protected TLInt _untilDate; public TLInt UntilDate { get { return _untilDate; } set { SetField(out _untilDate, value, ref _flags, (int)ChannelFlags.UntilDate); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); _untilDate = GetObject(Flags, (int)ChannelFlags.UntilDate, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); _untilDate = GetObject(Flags, (int)ChannelFlags.UntilDate, null, input); Participants = GetObject(input) as TLChatParticipantsBase; NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; CustomFlags = GetNullableObject(input); _readInboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Title.ToBytes()); ToStream(output, UntilDate, Flags, (int)ChannelFlags.UntilDate); Participants.NullableToStream(output); NotifySettings.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, ReadInboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)ChannelCustomFlags.ReadOutboxMaxId); } public override void Update(TLChatBase chat) { base.Update(chat); var c = chat as TLChannelForbidden68; if (c != null) { UntilDate = c.UntilDate; } } } } ================================================ FILE: Telegram.Api/TL/TLChatFull.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum ChannelFullFlags { ParticipantsCount = 0x1, AdminsCount = 0x2, KickedCount = 0x4, CanViewParticipants = 0x8, Migrated = 0x10, PinnedMsgId = 0x20, CanSetUsername = 0x40, CanSetStickers = 0x80, StickerSet = 0x100, AvailableMinId = 0x200, HiddenPrehistory = 0x400 } public class TLChatFull : TLObject { public const uint Signature = TLConstructors.TLChatFull; public TLInt Id { get; set; } public TLChatParticipantsBase Participants { get; set; } public TLPhotoBase ChatPhoto { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Participants = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); return this; } public virtual TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; return chat; } } public class TLChatFull28 : TLChatFull { public new const uint Signature = TLConstructors.TLChatFull28; public TLExportedChatInvite ExportedInvite { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Participants = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); return this; } } public class TLChatFull31 : TLChatFull28 { public new const uint Signature = TLConstructors.TLChatFull31; public TLVector BotInfo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Participants = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); return this; } } public class TLChannelFull : TLChatFull { public new const uint Signature = TLConstructors.TLChannelFull; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString About { get; set; } protected TLInt _participantsCount; public TLInt ParticipantsCount { get { return _participantsCount; } set { SetField(out _participantsCount, value, ref _flags, (int)ChannelFullFlags.ParticipantsCount); } } protected TLInt _adminsCount; public TLInt AdminsCount { get { return _adminsCount; } set { SetField(out _adminsCount, value, ref _flags, (int)ChannelFullFlags.AdminsCount); } } protected TLInt _kickedCount; public TLInt KickedCount { get { return _kickedCount; } set { SetField(out _kickedCount, value, ref _flags, (int)ChannelFullFlags.KickedCount); } } public TLInt ReadInboxMaxId { get; set; } public TLInt UnreadCount { get; set; } public TLInt UnreadImportantCount { get; set; } public TLExportedChatInvite ExportedInvite { get; set; } public bool CanViewParticipants { get { return IsSet(Flags, (int) ChannelFullFlags.CanViewParticipants); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); //Participants = GetObject(bytes, ref position); About = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChannelFullFlags.ParticipantsCount)) { ParticipantsCount = GetObject(bytes, ref position); } if (IsSet(Flags, (int) ChannelFullFlags.AdminsCount)) { AdminsCount = GetObject(bytes, ref position); } if (IsSet(Flags, (int)ChannelFullFlags.KickedCount)) { KickedCount = GetObject(bytes, ref position); } ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.ExportedInvite = ExportedInvite; channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; } return chat; } } public class TLChannelFull41 : TLChannelFull { public new const uint Signature = TLConstructors.TLChannelFull41; public TLVector BotInfo { get; set; } protected TLInt _migratedFromChatId; public TLInt MigratedFromChatId { get { return _migratedFromChatId; } set { SetField(out _migratedFromChatId, value, ref _flags, (int)ChannelFullFlags.Migrated); } } protected TLInt _migratedFromMaxId; public TLInt MigratedFromMaxId { get { return _migratedFromMaxId; } set { SetField(out _migratedFromMaxId, value, ref _flags, (int)ChannelFullFlags.Migrated); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); //Participants = GetObject(bytes, ref position); About = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChannelFullFlags.ParticipantsCount)) { ParticipantsCount = GetObject(bytes, ref position); } if (IsSet(Flags, (int)ChannelFullFlags.AdminsCount)) { AdminsCount = GetObject(bytes, ref position); } if (IsSet(Flags, (int)ChannelFullFlags.KickedCount)) { KickedCount = GetObject(bytes, ref position); } ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); if (IsSet(Flags, (int)ChannelFullFlags.Migrated)) { MigratedFromChatId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)ChannelFullFlags.Migrated)) { MigratedFromMaxId = GetObject(bytes, ref position); } return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.ExportedInvite = ExportedInvite; channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; } return chat; } } public class TLChannelFull49 : TLChannelFull41 { public new const uint Signature = TLConstructors.TLChannelFull49; protected TLInt _pinnedMsgId; public TLInt PinnedMsgId { get { return _pinnedMsgId; } set { SetField(out _pinnedMsgId, value, ref _flags, (int)ChannelFullFlags.PinnedMsgId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); //Participants = GetObject(bytes, ref position); About = GetObject(bytes, ref position); ParticipantsCount = GetObject(Flags, (int)ChannelFullFlags.ParticipantsCount, null, bytes, ref position); AdminsCount = GetObject(Flags, (int)ChannelFullFlags.AdminsCount, null, bytes, ref position); KickedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = GetObject(bytes, ref position); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); MigratedFromChatId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); MigratedFromMaxId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); PinnedMsgId = GetObject(Flags, (int)ChannelFullFlags.PinnedMsgId, null, bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; channel.ExportedInvite = ExportedInvite; channel.BotInfo = BotInfo; channel.MigratedFromChatId = MigratedFromChatId; channel.MigratedFromMaxId = MigratedFromMaxId; } var channel49 = chat as TLChannel49; if (channel49 != null) { channel49.PinnedMsgId = PinnedMsgId; } return chat; } } public class TLChannelFull53 : TLChannelFull49 { public new const uint Signature = TLConstructors.TLChannelFull53; public TLInt ReadOutboxMaxId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); //Participants = GetObject(bytes, ref position); About = GetObject(bytes, ref position); ParticipantsCount = GetObject(Flags, (int)ChannelFullFlags.ParticipantsCount, null, bytes, ref position); AdminsCount = GetObject(Flags, (int)ChannelFullFlags.AdminsCount, null, bytes, ref position); KickedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = new TLInt(0); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); MigratedFromChatId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); MigratedFromMaxId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); PinnedMsgId = GetObject(Flags, (int)ChannelFullFlags.PinnedMsgId, null, bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; channel.ExportedInvite = ExportedInvite; channel.BotInfo = BotInfo; channel.MigratedFromChatId = MigratedFromChatId; channel.MigratedFromMaxId = MigratedFromMaxId; } var channel49 = chat as TLChannel49; if (channel49 != null) { channel49.ReadOutboxMaxId = ReadOutboxMaxId; channel49.PinnedMsgId = PinnedMsgId; } return chat; } } public class TLChannelFull68 : TLChannelFull53 { public new const uint Signature = TLConstructors.TLChannelFull68; protected TLInt _bannedCount; public TLInt BannedCount { get { return _bannedCount; } set { SetField(out _bannedCount, value, ref _flags, (int)ChannelFullFlags.KickedCount); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); About = GetObject(bytes, ref position); ParticipantsCount = GetObject(Flags, (int)ChannelFullFlags.ParticipantsCount, null, bytes, ref position); _adminsCount = GetObject(Flags, (int)ChannelFullFlags.AdminsCount, null, bytes, ref position); _kickedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); _bannedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = new TLInt(0); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); _migratedFromChatId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _migratedFromMaxId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _pinnedMsgId = GetObject(Flags, (int)ChannelFullFlags.PinnedMsgId, null, bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; channel.ExportedInvite = ExportedInvite; channel.BotInfo = BotInfo; channel.MigratedFromChatId = MigratedFromChatId; channel.MigratedFromMaxId = MigratedFromMaxId; } var channel49 = chat as TLChannel49; if (channel49 != null) { channel49.ReadOutboxMaxId = ReadOutboxMaxId; channel49.PinnedMsgId = PinnedMsgId; } var channel68 = chat as TLChannel68; if (channel68 != null) { } return chat; } } public class TLChannelFull71 : TLChannelFull68 { public new const uint Signature = TLConstructors.TLChannelFull71; public bool CanSetStickers { get { return IsSet(Flags, (int) ChannelFullFlags.CanSetStickers); } } protected TLStickerSetBase _stickerSet; public TLStickerSetBase StickerSet { get { return _stickerSet; } set { SetField(out _stickerSet, value, ref _flags, (int)ChannelFullFlags.StickerSet); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); About = GetObject(bytes, ref position); ParticipantsCount = GetObject(Flags, (int)ChannelFullFlags.ParticipantsCount, null, bytes, ref position); _adminsCount = GetObject(Flags, (int)ChannelFullFlags.AdminsCount, null, bytes, ref position); _kickedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); _bannedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = new TLInt(0); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); _migratedFromChatId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _migratedFromMaxId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _pinnedMsgId = GetObject(Flags, (int)ChannelFullFlags.PinnedMsgId, null, bytes, ref position); _stickerSet = GetObject(Flags, (int)ChannelFullFlags.StickerSet, null, bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.Full = true; channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; channel.ExportedInvite = ExportedInvite; channel.BotInfo = BotInfo; channel.MigratedFromChatId = MigratedFromChatId; channel.MigratedFromMaxId = MigratedFromMaxId; } var channel49 = chat as TLChannel49; if (channel49 != null) { channel49.ReadOutboxMaxId = ReadOutboxMaxId; channel49.PinnedMsgId = PinnedMsgId; } var channel68 = chat as TLChannel68; if (channel68 != null) { channel68.CanSetStickers = CanSetStickers; channel68.StickerSet = StickerSet ?? new TLStickerSetEmpty(); } return chat; } } public class TLChannelFull72 : TLChannelFull71 { public new const uint Signature = TLConstructors.TLChannelFull72; public bool HiddenPrehistory { get { return IsSet(Flags, (int)ChannelFullFlags.HiddenPrehistory); } } protected TLInt _availableMinId; public TLInt AvailableMinId { get { return _availableMinId; } set { SetField(out _availableMinId, value, ref _flags, (int)ChannelFullFlags.AvailableMinId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); About = GetObject(bytes, ref position); ParticipantsCount = GetObject(Flags, (int)ChannelFullFlags.ParticipantsCount, null, bytes, ref position); _adminsCount = GetObject(Flags, (int)ChannelFullFlags.AdminsCount, null, bytes, ref position); _kickedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); _bannedCount = GetObject(Flags, (int)ChannelFullFlags.KickedCount, null, bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = new TLInt(0); ChatPhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); ExportedInvite = GetObject(bytes, ref position); BotInfo = GetObject>(bytes, ref position); _migratedFromChatId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _migratedFromMaxId = GetObject(Flags, (int)ChannelFullFlags.Migrated, null, bytes, ref position); _pinnedMsgId = GetObject(Flags, (int)ChannelFullFlags.PinnedMsgId, null, bytes, ref position); _stickerSet = GetObject(Flags, (int)ChannelFullFlags.StickerSet, null, bytes, ref position); _availableMinId = GetObject(Flags, (int)ChannelFullFlags.AvailableMinId, null, bytes, ref position); return this; } public override TLChatBase ToChat(TLChatBase chat) { chat.NotifySettings = NotifySettings; chat.Participants = Participants; chat.ChatPhoto = ChatPhoto; var channel = chat as TLChannel; if (channel != null) { channel.Full = true; channel.About = About; channel.ParticipantsCount = ParticipantsCount; channel.AdminsCount = AdminsCount; channel.KickedCount = KickedCount; channel.ReadInboxMaxId = ReadInboxMaxId; channel.ExportedInvite = ExportedInvite; channel.BotInfo = BotInfo; channel.MigratedFromChatId = MigratedFromChatId; channel.MigratedFromMaxId = MigratedFromMaxId; } var channel49 = chat as TLChannel49; if (channel49 != null) { channel49.ReadOutboxMaxId = ReadOutboxMaxId; channel49.PinnedMsgId = PinnedMsgId; } var channel68 = chat as TLChannel68; if (channel68 != null) { channel68.CanSetStickers = CanSetStickers; channel68.StickerSet = StickerSet ?? new TLStickerSetEmpty(); channel68.HiddenPrehistory = HiddenPrehistory; channel68.AvailableMinId = AvailableMinId; } return chat; } } } ================================================ FILE: Telegram.Api/TL/TLChatInvite.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChatInviteFlags { Channel = 0x1, Broadcast = 0x2, Public = 0x4, MegaGroup = 0x8, Participants = 0x10, } public abstract class TLChatInviteBase : TLObject { } public abstract class TLExportedChatInvite : TLChatInviteBase { } public class TLChatInviteEmpty : TLExportedChatInvite { public const uint Signature = TLConstructors.TLChatInviteEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLChatInviteExported : TLExportedChatInvite { public const uint Signature = TLConstructors.TLChatInviteExported; public TLString Link { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Link = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Link.ToBytes()); } public override TLObject FromStream(Stream input) { Link = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Link.ToBytes()); } } public class TLChatInviteAlready : TLChatInviteBase { public const uint Signature = TLConstructors.TLChatInviteAlready; public TLChatBase Chat { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Chat = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Chat.ToBytes()); } public override TLObject FromStream(Stream input) { Chat = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Chat.ToBytes()); } } public class TLChatInvite : TLChatInviteBase { public const uint Signature = TLConstructors.TLChatInvite; public TLString Title { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Title = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Title.ToBytes()); } public override TLObject FromStream(Stream input) { Title = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Title.ToBytes()); } } public class TLChatInvite40 : TLChatInvite { public new const uint Signature = TLConstructors.TLChatInvite40; public TLInt Flags { get; set; } public bool IsChannel { get { return IsSet(Flags, (int) ChatInviteFlags.Channel); } } public bool IsBroadcast { get { return IsSet(Flags, (int)ChatInviteFlags.Broadcast); } } public bool IsPublic { get { return IsSet(Flags, (int)ChatInviteFlags.Public); } } public bool IsMegaGroup { get { return IsSet(Flags, (int)ChatInviteFlags.MegaGroup); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Title.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Title = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Title.ToBytes()); } } public class TLChatInvite54 : TLChatInvite40 { public new const uint Signature = TLConstructors.TLChatInvite54; public TLPhotoBase Photo { get; set; } public TLInt ParticipantsCount { get; set; } public TLVector Participants { get; set; } public static string ChatInviteFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (ChatInviteFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { return "TLChatInvite54 flags=" + ChatInviteFlagsString(Flags); } #region Additional public TLChatBase Chat { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Photo = GetObject(bytes, ref position); ParticipantsCount = GetObject(bytes, ref position); Participants = GetObject>(Flags, (int) ChatInviteFlags.Participants, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Title.ToBytes(), Photo.ToBytes(), ParticipantsCount.ToBytes(), ToBytes(Participants, Flags, (int) ChatInviteFlags.Participants)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Title = GetObject(input); Photo = GetObject(input); ParticipantsCount = GetObject(input); Participants = GetObject>(Flags, (int) ChatInviteFlags.Participants, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Title.ToBytes()); output.Write(Photo.ToBytes()); output.Write(ParticipantsCount.ToBytes()); ToStream(output, Participants, Flags, (int) ChatInviteFlags.Participants); } } } ================================================ FILE: Telegram.Api/TL/TLChatParticipant.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public interface IInviter { TLInt InviterId { get; set; } TLInt Date { get; set; } } public abstract class TLChatParticipantBase : TLObject { public TLInt UserId { get; set; } } public class TLChatParticipant : TLChatParticipantBase, IInviter { public const uint Signature = TLConstructors.TLChatParticipant; public TLInt InviterId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(InviterId.ToBytes()); output.Write(Date.ToBytes()); } } public class TLChatParticipantCreator : TLChatParticipantBase { public const uint Signature = TLConstructors.TLChatParticipantCreator; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); } } public class TLChatParticipantAdmin : TLChatParticipantBase, IInviter { public const uint Signature = TLConstructors.TLChatParticipantAdmin; public TLInt InviterId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(InviterId.ToBytes()); output.Write(Date.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLChatParticipants.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public enum ChatParticipantsFlags { Self = 0x1, } public abstract class TLChatParticipantsBase : TLObject { public TLInt ChatId { get; set; } } public class TLChatParticipantsForbidden37 : TLChatParticipantsForbidden { public new const uint Signature = TLConstructors.TLChatParticipantsForbidden37; public TLInt Flags { get; set; } public TLChatParticipantBase SelfParticipant { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); if (IsSet(Flags, (int) ChatParticipantsFlags.Self)) { SelfParticipant = GetObject(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ChatId = GetObject(input); if (IsSet(Flags, (int)ChatParticipantsFlags.Self)) { SelfParticipant = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(ChatId.ToBytes()); if (IsSet(Flags, (int)ChatParticipantsFlags.Self)) { SelfParticipant.ToStream(output); } } } public class TLChatParticipantsForbidden : TLChatParticipantsBase { public const uint Signature = TLConstructors.TLChatParticipantsForbidden; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ChatId.ToBytes()); } } public interface IChatParticipants { TLInt ChatId { get; set; } TLVector Participants { get; set; } TLInt Version { get; set; } } public class TLChatParticipants : TLChatParticipantsBase, IChatParticipants { public const uint Signature = TLConstructors.TLChatParticipants; public TLInt AdminId { get; set; } public TLVector Participants { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); Participants = GetObject>(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); AdminId = GetObject(input); Participants = GetObject>(input); Version = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ChatId.ToBytes()); output.Write(AdminId.ToBytes()); Participants.ToStream(output); output.Write(Version.ToBytes()); } } public class TLChatParticipants40 : TLChatParticipantsBase, IChatParticipants { public const uint Signature = TLConstructors.TLChatParticipants40; public TLVector Participants { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); Participants = GetObject>(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); Participants = GetObject>(input); Version = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ChatId.ToBytes()); Participants.ToStream(output); output.Write(Version.ToBytes()); } } public class TLChannelParticipants40 : TLChatParticipantsBase { public const uint Signature = TLConstructors.TLChannelParticipants40; public TLInt Flags { get; set; } public TLChatParticipantBase SelfParticipant { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); if (IsSet(Flags, (int)ChatParticipantsFlags.Self)) { SelfParticipant = GetObject(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ChatId = GetObject(input); if (IsSet(Flags, (int)ChatParticipantsFlags.Self)) { SelfParticipant = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ChatId.ToBytes()); if (IsSet(Flags, (int)ChatParticipantsFlags.Self)) { SelfParticipant.ToStream(output); } } } } ================================================ FILE: Telegram.Api/TL/TLChatSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ChatSettingsFlags { AutoDownloadPhotoPrivateChats = 0x1, // 0 AutoDownloadPhotoGroups = 0x2, // 1 AutoDownloadAudioPrivateChats = 0x4, // 2 AutoDownloadAudioGroups = 0x8, // 3 AutoDownloadGifPrivateChats = 0x10, AutoDownloadGifGroups = 0x20, AutoPlayGif = 0x40 } public class TLChatSettings : TLObject { public const uint Signature = TLConstructors.TLChatSettings; private TLLong _flags; public TLLong Flags { get { return _flags; } set { _flags = value; } } public bool AutoDownloadPhotoPrivateChats { get { return IsSet(Flags, (int) ChatSettingsFlags.AutoDownloadPhotoPrivateChats); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadPhotoPrivateChats); } } public bool AutoDownloadPhotoGroups { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoDownloadPhotoGroups); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadPhotoGroups); } } public bool AutoDownloadAudioPrivateChats { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoDownloadAudioPrivateChats); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadAudioPrivateChats); } } public bool AutoDownloadAudioGroups { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoDownloadAudioGroups); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadAudioGroups); } } public bool AutoDownloadGifPrivateChats { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoDownloadGifPrivateChats); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadGifPrivateChats); } } public bool AutoDownloadGifGroups { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoDownloadGifGroups); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoDownloadGifGroups); } } public bool AutoPlayGif { get { return IsSet(Flags, (int)ChatSettingsFlags.AutoPlayGif); } set { SetUnset(ref _flags, value, (int)ChatSettingsFlags.AutoPlayGif); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLChats.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLChatsBase : TLObject { public TLVector Chats { get; set; } } public class TLChats : TLChatsBase { public const uint Signature = TLConstructors.TLChats; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLChats24 : TLChatsBase { public const uint Signature = TLConstructors.TLChats24; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Chats = GetObject>(bytes, ref position); return this; } } public class TLChatsSlice : TLChatsBase { public const uint Signature = TLConstructors.TLChatsSlice; public TLInt Count { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLChatsSlice59 : TLChatsBase { public const uint Signature = TLConstructors.TLChatsSlice59; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLChatsSlice.cs ================================================ namespace Telegram.Api.TL { public class TLChatsSlice : TLObject { public const uint Signature = TLConstructors.TLChatsSlice; public TLInt Count { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLCheckedPhone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLCheckedPhoneBase : TLObject { public TLBool PhoneRegistered { get; set; } } public class TLCheckedPhone : TLCheckedPhoneBase { public const uint Signature = TLConstructors.TLCheckedPhone; public TLBool PhoneInvited { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneRegistered = GetObject(bytes, ref position); PhoneInvited = GetObject(bytes, ref position); return this; } } public class TLCheckedPhone24 : TLCheckedPhoneBase { public const uint Signature = TLConstructors.TLCheckedPhone24; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneRegistered = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLClientDHInnerData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLClientDHInnerData : TLObject { public const string Signature = "#6643b654"; public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLLong RetryId { get; set; } public TLString GB { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.ToBytes(), ServerNonce.ToBytes(), RetryId.ToBytes(), GB.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLCodeType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLCodeTypeBase : TLObject { } public class TLCodeTypeSms : TLCodeTypeBase { public const uint Signature = TLConstructors.TLCodeTypeSms; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } public class TLCodeTypeCall : TLCodeTypeBase { public const uint Signature = TLConstructors.TLCodeTypeCall; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } public class TLCodeTypeFlashCall : TLCodeTypeBase { public const uint Signature = TLConstructors.TLCodeTypeFlashCall; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using System.Runtime.Serialization; using System.Text; namespace Telegram.Api.TL { [Flags] public enum ConfigFlags { TmpSessions = 0x1, // 0 PhoneCallsEnabled = 0x2, // 1 Lang = 0x4, // 2 DefaultP2PContacts = 0x8, // 3 PreloadFeaturedStickers = 0x10, // 4 IgnorePhoneEntities = 0x20, // 5 RevokePmInbox = 0x40, // 6 AutoupdateUrlPrefix = 0x80, // 7 BlockedMode = 0x100, // 8 GifSearchUsername = 0x200, // 9 VenueSearchUsername = 0x400, // 10 ImgSearchUsername = 0x800, // 11 StaticMapsProvider = 0x1000, // 12 } [DataContract] public class TLConfig : TLObject { public const uint Signature = TLConstructors.TLConfig; [DataMember] public TLInt Date { get; set; } [DataMember] public TLBool TestMode { get; set; } /// /// Номер датацентра, ему может соответствовать несколько записей в DCOptions /// [DataMember] public TLInt ThisDC { get; set; } [DataMember] public TLVector DCOptions { get; set; } [DataMember] public TLInt ChatSizeMax { get; set; } [DataMember] public TLInt BroadcastSizeMax { get; set; } #region Additional /// /// Время последней загрузки config /// [DataMember] public DateTime LastUpdate { get; set; } /// /// Номер конкретного датацентра внутри списка DCOptions, однозначно определяет текущий датацентр /// [DataMember] public int ActiveDCOptionIndex { get; set; } [DataMember] public string Country { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); return this; } public static TLConfig Merge(TLConfig oldConfig, TLConfig newConfig) { if (oldConfig == null) return newConfig; if (newConfig == null) return oldConfig; foreach (var dcOption in oldConfig.DCOptions) { if (dcOption.AuthKey != null) { var option = dcOption; foreach (var newDCOption in newConfig.DCOptions.Where(x => x.AreEquals(option))) { newDCOption.AuthKey = dcOption.AuthKey; newDCOption.Salt = dcOption.Salt; newDCOption.SessionId = dcOption.SessionId; newDCOption.ClientTicksDelta = dcOption.ClientTicksDelta; } } } if (!string.IsNullOrEmpty(oldConfig.Country)) { newConfig.Country = oldConfig.Country; } if (oldConfig.ActiveDCOptionIndex != default(int)) { var oldActiveDCOption = oldConfig.DCOptions[oldConfig.ActiveDCOptionIndex]; var dcId = oldConfig.DCOptions[oldConfig.ActiveDCOptionIndex].Id.Value; var ipv6 = oldActiveDCOption.IPv6.Value; var media = oldActiveDCOption.Media.Value; TLDCOption newActiveDCOption = null; int newActiveDCOptionIndex = 0; for (var i = 0; i < newConfig.DCOptions.Count; i++) { if (newConfig.DCOptions[i].Id.Value == dcId && newConfig.DCOptions[i].IPv6.Value == ipv6 && newConfig.DCOptions[i].Media.Value == media) { newActiveDCOption = newConfig.DCOptions[i]; newActiveDCOptionIndex = i; break; } } if (newActiveDCOption == null) { for (var i = 0; i < newConfig.DCOptions.Count; i++) { if (newConfig.DCOptions[i].Id.Value == dcId) { newActiveDCOption = newConfig.DCOptions[i]; newActiveDCOptionIndex = i; break; } } } newConfig.ActiveDCOptionIndex = newActiveDCOptionIndex; } if (oldConfig.LastUpdate != default(DateTime)) { newConfig.LastUpdate = oldConfig.LastUpdate; } return newConfig; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("BroadcastSizeMax {0}", BroadcastSizeMax)); return sb.ToString(); } } [DataContract] public class TLConfig23 : TLConfig { public new const uint Signature = TLConstructors.TLConfig23; [DataMember] public TLInt Expires { get; set; } [DataMember] public TLInt ChatBigSize { get; set; } [DataMember] public TLVector DisabledFeatures { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("BroadcastSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig24 : TLConfig23 { public new const uint Signature = TLConstructors.TLConfig24; [DataMember] public TLInt OnlineUpdatePeriodMs { get; set; } [DataMember] public TLInt OfflineBlurTimeoutMs { get; set; } [DataMember] public TLInt OfflineIdleTimeoutMs { get; set; } [DataMember] public TLInt OnlineCloudTimeoutMs { get; set; } [DataMember] public TLInt NotifyCloudDelayMs { get; set; } [DataMember] public TLInt NotifyDefaultDelayMs { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("BroadcastSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig26 : TLConfig24 { public new const uint Signature = TLConstructors.TLConfig26; [DataMember] public TLInt ForwardedCountMax { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("BroadcastSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig28 : TLConfig26 { public new const uint Signature = TLConstructors.TLConfig28; [DataMember] public TLInt PushChatPeriodMs { get; set; } [DataMember] public TLInt PushChatLimit { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("BroadcastSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig41 : TLConfig28 { public new const uint Signature = TLConstructors.TLConfig41; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig44 : TLConfig41 { public new const uint Signature = TLConstructors.TLConfig44; [DataMember] public TLInt SavedGifsLimit { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig48 : TLConfig44 { public new const uint Signature = TLConstructors.TLConfig48; [DataMember] public TLInt EditTimeLimit { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig52 : TLConfig48 { public new const uint Signature = TLConstructors.TLConfig52; [DataMember] public TLInt RatingEDecay { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig54 : TLConfig52 { public new const uint Signature = TLConstructors.TLConfig54; [DataMember] public TLInt StickersRecentLimit { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig55 : TLConfig54 { public new const uint Signature = TLConstructors.TLConfig55; protected TLInt _flags; [DataMember] public TLInt Flags { get { return _flags; } set { _flags = value; } } [DataMember] public TLInt TmpSessions { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public static string ConfigFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (ConfigFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig60 : TLConfig55 { public new const uint Signature = TLConstructors.TLConfig60; public bool PhoneCallsEnabled { get { return IsSet(Flags, (int)ConfigFlags.PhoneCallsEnabled); } } [DataMember] public TLInt CallReceiveTimeoutMs { get; set; } [DataMember] public TLInt CallRingTimeoutMs { get; set; } [DataMember] public TLInt CallConnectTimeoutMs { get; set; } [DataMember] public TLInt CallPacketTimeoutMs { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig61 : TLConfig60 { public new const uint Signature = TLConstructors.TLConfig61; [DataMember] public TLInt PinnedDialogsCountMax { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig63 : TLConfig61 { public new const uint Signature = TLConstructors.TLConfig63; [DataMember] public TLString MeUrlPrefix { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig67 : TLConfig63 { public new const uint Signature = TLConstructors.TLConfig67; protected TLString _suggestedLangCode; [DataMember] public TLString SuggestedLangCode { get { return _suggestedLangCode; } set { SetField(out _suggestedLangCode, value, ref _flags, (int)ConfigFlags.Lang); } } protected TLInt _langPackVersion; [DataMember] public TLInt LangPackVersion { get { return _langPackVersion; } set { SetField(out _langPackVersion, value, ref _flags, (int)ConfigFlags.Lang); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig71 : TLConfig67 { public new const uint Signature = TLConstructors.TLConfig71; [DataMember] public TLInt StickersFavedLimit { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); StickersFavedLimit = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("StickersFavedLimit {0}", StickersFavedLimit)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig72 : TLConfig71 { public new const uint Signature = TLConstructors.TLConfig72; [DataMember] public TLInt ChannelsReadMediaPeriod { get; set; } public bool PreloadFeaturedStickers { get { return IsSet(Flags, (int)ConfigFlags.PreloadFeaturedStickers); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = GetObject(bytes, ref position); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); StickersFavedLimit = GetObject(bytes, ref position); ChannelsReadMediaPeriod = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); DisabledFeatures = GetObject>(bytes, ref position); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("ChatBigSize {0}", ChatBigSize)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("StickersFavedLimit {0}", StickersFavedLimit)); sb.AppendLine(string.Format("ChannelsReadMediaPeriod {0}", ChannelsReadMediaPeriod)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); sb.AppendLine(string.Format("DisabledFeatures {0}", DisabledFeatures.Count)); return sb.ToString(); } } [DataContract] public class TLConfig76 : TLConfig72 { public new const uint Signature = TLConstructors.TLConfig76; [DataMember] public TLInt RevokeTimeLimit { get; set; } [DataMember] public TLInt RevokePmTimeLimit { get; set; } public bool IgnorePhoneEntities { get { return IsSet(Flags, (int)ConfigFlags.IgnorePhoneEntities); } } public bool RevokePmInbox { get { return IsSet(Flags, (int)ConfigFlags.RevokePmInbox); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = new TLInt(int.MaxValue); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RevokeTimeLimit = GetObject(bytes, ref position); RevokePmTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); StickersFavedLimit = GetObject(bytes, ref position); ChannelsReadMediaPeriod = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); DisabledFeatures = new TLVector(); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RevokeTimeLimit {0}", RevokeTimeLimit)); sb.AppendLine(string.Format("RevokePmTimeLimit {0}", RevokePmTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("StickersFavedLimit {0}", StickersFavedLimit)); sb.AppendLine(string.Format("ChannelsReadMediaPeriod {0}", ChannelsReadMediaPeriod)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); return sb.ToString(); } } [DataContract] public class TLConfig78 : TLConfig76 { public new const uint Signature = TLConstructors.TLConfig78; protected TLString _autoupdateUrlPrefix; [DataMember] public TLString AutoupdateUrlPrefix { get { return _autoupdateUrlPrefix; } set { SetField(out _autoupdateUrlPrefix, value, ref _flags, (int)ConfigFlags.AutoupdateUrlPrefix); } } public bool BlockedMode { get { return IsSet(Flags, (int)ConfigFlags.BlockedMode); } } public bool DefaultP2PContacts { get { return IsSet(Flags, (int)ConfigFlags.DefaultP2PContacts); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = new TLInt(int.MaxValue); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RevokeTimeLimit = GetObject(bytes, ref position); RevokePmTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); StickersFavedLimit = GetObject(bytes, ref position); ChannelsReadMediaPeriod = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); _autoupdateUrlPrefix = GetObject(_flags, (int)ConfigFlags.AutoupdateUrlPrefix, null, bytes, ref position); DisabledFeatures = new TLVector(); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("PhoneCallsEnabled {0}", PhoneCallsEnabled)); sb.AppendLine(string.Format("DefaultP2PContacts {0}", DefaultP2PContacts)); sb.AppendLine(string.Format("PreloadFeaturedStickers {0}", PreloadFeaturedStickers)); sb.AppendLine(string.Format("IgnorePhoneEntities {0}", IgnorePhoneEntities)); sb.AppendLine(string.Format("RevokePmInbox {0}", RevokePmInbox)); sb.AppendLine(string.Format("BlockedMode {0}", BlockedMode)); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ThisDC {0}", ThisDC)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RevokeTimeLimit {0}", RevokeTimeLimit)); sb.AppendLine(string.Format("RevokePmTimeLimit {0}", RevokePmTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("StickersFavedLimit {0}", StickersFavedLimit)); sb.AppendLine(string.Format("ChannelsReadMediaPeriod {0}", ChannelsReadMediaPeriod)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("AutoupdateUrlPrefix {0}", AutoupdateUrlPrefix)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); return sb.ToString(); } } [DataContract] public class TLConfig82 : TLConfig78 { public new const uint Signature = TLConstructors.TLConfig82; [DataMember] public TLString DCTxtDomainName { get; set; } protected TLString _gifSearchUsername; [DataMember] public TLString GifSearchUsername { get { return _gifSearchUsername; } set { SetField(out _gifSearchUsername, value, ref _flags, (int)ConfigFlags.GifSearchUsername); } } protected TLString _venueSearchUsername; [DataMember] public TLString VenueSearchUsername { get { return _venueSearchUsername; } set { SetField(out _venueSearchUsername, value, ref _flags, (int)ConfigFlags.VenueSearchUsername); } } protected TLString _imgSearchUsername; [DataMember] public TLString ImgSearchUsername { get { return _imgSearchUsername; } set { SetField(out _imgSearchUsername, value, ref _flags, (int)ConfigFlags.ImgSearchUsername); } } protected TLString _staticMapsProvider; [DataMember] public TLString StaticMapsProvider { get { return _staticMapsProvider; } set { SetField(out _staticMapsProvider, value, ref _flags, (int)ConfigFlags.StaticMapsProvider); } } [DataMember] public TLInt CaptionLengthMax { get; set; } [DataMember] public TLInt MessageLengthMax { get; set; } [DataMember] public TLInt WebfileDCId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); TestMode = GetObject(bytes, ref position); ThisDC = GetObject(bytes, ref position); DCOptions = GetObject>(bytes, ref position); DCTxtDomainName = GetObject(bytes, ref position); ChatSizeMax = GetObject(bytes, ref position); BroadcastSizeMax = GetObject(bytes, ref position); // MegagroupSizeMax ForwardedCountMax = GetObject(bytes, ref position); OnlineUpdatePeriodMs = GetObject(bytes, ref position); OfflineBlurTimeoutMs = GetObject(bytes, ref position); OfflineIdleTimeoutMs = GetObject(bytes, ref position); OnlineCloudTimeoutMs = GetObject(bytes, ref position); NotifyCloudDelayMs = GetObject(bytes, ref position); NotifyDefaultDelayMs = GetObject(bytes, ref position); ChatBigSize = new TLInt(int.MaxValue); PushChatPeriodMs = GetObject(bytes, ref position); PushChatLimit = GetObject(bytes, ref position); SavedGifsLimit = GetObject(bytes, ref position); EditTimeLimit = GetObject(bytes, ref position); RevokeTimeLimit = GetObject(bytes, ref position); RevokePmTimeLimit = GetObject(bytes, ref position); RatingEDecay = GetObject(bytes, ref position); StickersRecentLimit = GetObject(bytes, ref position); StickersFavedLimit = GetObject(bytes, ref position); ChannelsReadMediaPeriod = GetObject(bytes, ref position); TmpSessions = GetObject(Flags, (int)ConfigFlags.TmpSessions, null, bytes, ref position); PinnedDialogsCountMax = GetObject(bytes, ref position); CallReceiveTimeoutMs = GetObject(bytes, ref position); CallRingTimeoutMs = GetObject(bytes, ref position); CallConnectTimeoutMs = GetObject(bytes, ref position); CallPacketTimeoutMs = GetObject(bytes, ref position); MeUrlPrefix = GetObject(bytes, ref position); _autoupdateUrlPrefix = GetObject(_flags, (int)ConfigFlags.AutoupdateUrlPrefix, null, bytes, ref position); _gifSearchUsername = GetObject(_flags, (int)ConfigFlags.GifSearchUsername, null, bytes, ref position); _venueSearchUsername = GetObject(_flags, (int)ConfigFlags.VenueSearchUsername, null, bytes, ref position); _imgSearchUsername = GetObject(_flags, (int)ConfigFlags.ImgSearchUsername, null, bytes, ref position); _staticMapsProvider = GetObject(_flags, (int)ConfigFlags.StaticMapsProvider, null, bytes, ref position); CaptionLengthMax = GetObject(bytes, ref position); MessageLengthMax = GetObject(bytes, ref position); WebfileDCId = GetObject(bytes, ref position); DisabledFeatures = new TLVector(); _suggestedLangCode = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); _langPackVersion = GetObject(Flags, (int)ConfigFlags.Lang, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine(string.Format("Flags {0}", ConfigFlagsString(Flags))); sb.AppendLine(string.Format("PhoneCallsEnabled {0}", PhoneCallsEnabled)); sb.AppendLine(string.Format("DefaultP2PContacts {0}", DefaultP2PContacts)); sb.AppendLine(string.Format("PreloadFeaturedStickers {0}", PreloadFeaturedStickers)); sb.AppendLine(string.Format("IgnorePhoneEntities {0}", IgnorePhoneEntities)); sb.AppendLine(string.Format("RevokePmInbox {0}", RevokePmInbox)); sb.AppendLine(string.Format("BlockedMode {0}", BlockedMode)); sb.AppendLine(string.Format("Date utc0 {0} {1}", Date.Value, TLUtils.ToDateTime(Date).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("Expires utc0 {0} {1}", Expires.Value, TLUtils.ToDateTime(Expires).ToUniversalTime().ToString("HH:mm:ss.fff dd-MM-yyyy"))); sb.AppendLine(string.Format("TestMode {0}", TestMode)); sb.AppendLine(string.Format("ThisDC {0}", ThisDC)); sb.AppendLine(string.Format("DCTxtDomainName {0}", DCTxtDomainName)); sb.AppendLine(string.Format("ChatSizeMax {0}", ChatSizeMax)); sb.AppendLine(string.Format("MegagroupSizeMax {0}", BroadcastSizeMax)); sb.AppendLine(string.Format("ForwardedCountMax {0}", ForwardedCountMax)); sb.AppendLine(string.Format("OnlineUpdatePeriodMs {0}", OnlineUpdatePeriodMs)); sb.AppendLine(string.Format("OfflineBlurTimeoutMs {0}", OfflineBlurTimeoutMs)); sb.AppendLine(string.Format("OfflineIdleTimeoutMs {0}", OfflineIdleTimeoutMs)); sb.AppendLine(string.Format("OnlineCloudTimeoutMs {0}", OnlineCloudTimeoutMs)); sb.AppendLine(string.Format("NotifyCloudDelayMs {0}", NotifyCloudDelayMs)); sb.AppendLine(string.Format("NotifyDefaultDelayMs {0}", NotifyDefaultDelayMs)); sb.AppendLine(string.Format("PushChatPeriodMs {0}", PushChatPeriodMs)); sb.AppendLine(string.Format("PushChatLimit {0}", PushChatLimit)); sb.AppendLine(string.Format("SavedGifsLimit {0}", SavedGifsLimit)); sb.AppendLine(string.Format("EditTimeLimit {0}", EditTimeLimit)); sb.AppendLine(string.Format("RevokeTimeLimit {0}", RevokeTimeLimit)); sb.AppendLine(string.Format("RevokePmTimeLimit {0}", RevokePmTimeLimit)); sb.AppendLine(string.Format("RatingEDecay {0}", RatingEDecay)); sb.AppendLine(string.Format("StickersRecentLimit {0}", StickersRecentLimit)); sb.AppendLine(string.Format("StickersFavedLimit {0}", StickersFavedLimit)); sb.AppendLine(string.Format("ChannelsReadMediaPeriod {0}", ChannelsReadMediaPeriod)); sb.AppendLine(string.Format("TmpSessions {0}", TmpSessions)); sb.AppendLine(string.Format("PinnedDialogsCountMax {0}", PinnedDialogsCountMax)); sb.AppendLine(string.Format("CallReceiveTimeoutMs {0}", CallReceiveTimeoutMs)); sb.AppendLine(string.Format("CallRingTimeoutMs {0}", CallRingTimeoutMs)); sb.AppendLine(string.Format("CallConnectTimeoutMs {0}", CallConnectTimeoutMs)); sb.AppendLine(string.Format("CallPacketTimeoutMs {0}", CallPacketTimeoutMs)); sb.AppendLine(string.Format("MeUrlPrefix {0}", MeUrlPrefix)); sb.AppendLine(string.Format("AutoupdateUrlPrefix {0}", AutoupdateUrlPrefix)); sb.AppendLine(string.Format("GifSearchUsername {0}", GifSearchUsername)); sb.AppendLine(string.Format("VenueSearchUsername {0}", VenueSearchUsername)); sb.AppendLine(string.Format("ImgSearchUsername {0}", ImgSearchUsername)); sb.AppendLine(string.Format("StaticMapsProvider {0}", StaticMapsProvider)); sb.AppendLine(string.Format("CaptionLengthMax {0}", CaptionLengthMax)); sb.AppendLine(string.Format("MessageLengthMax {0}", MessageLengthMax)); sb.AppendLine(string.Format("WebfileDCId {0}", WebfileDCId)); sb.AppendLine(string.Format("SuggestedLangCode {0}", SuggestedLangCode)); sb.AppendLine(string.Format("LangPackVersion {0}", LangPackVersion)); return sb.ToString(); } } } ================================================ FILE: Telegram.Api/TL/TLConfigSimple.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLConfigSimple : TLObject { public const uint Signature = TLConstructors.TLConfigSimple; public TLInt Date { get; set; } public TLInt Expires { get; set; } public TLInt DCId { get; set; } public TLVector IpPortList { get; set; } public override string ToString() { return string.Format("TLConfigSimple date={0} expires={1} dc_id={2} ip_port_list=[{3}]", Date, Expires, DCId, string.Join(", ", IpPortList)); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); IpPortList = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Date = GetObject(input); Expires = GetObject(input); DCId = GetObject(input); IpPortList = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Date.ToStream(output); Expires.ToStream(output); DCId.ToStream(output); IpPortList.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [DataContract] public class TLContact : TLObject { public const uint Signature = TLConstructors.TLContact; [DataMember] public TLInt UserId { get; set; } [DataMember] public TLBool Mutual { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Mutual = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Mutual = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(UserId.ToBytes()); output.Write(Mutual.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLContactBlocked.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLContactBlocked : TLObject { public const uint Signature = TLConstructors.TLContactBlocked; public TLInt UserId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLContactBlocked--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); TLUtils.WriteLine("UserId: " + UserId); TLUtils.WriteLine("Date: " + TLUtils.MessageIdString(Date)); return this; } } } ================================================ FILE: Telegram.Api/TL/TLContactFound.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLContactFound : TLObject { public const uint Signature = TLConstructors.TLContactFound; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLContactLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLContactLinkBase : TLObject { } public class TLContactLinkUnknown : TLContactLinkBase { public const uint Signature = TLConstructors.TLContactLinkUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLContactLinkNone : TLContactLinkBase { public const uint Signature = TLConstructors.TLContactLinkNone; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLContactLinkHasPhone : TLContactLinkBase { public const uint Signature = TLConstructors.TLContactLinkHasPhone; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLContactLink : TLContactLinkBase { public const uint Signature = TLConstructors.TLContactLink; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLContactStatus.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLContactStatusBase : TLObject { public TLInt UserId { get; set; } } public class TLContactStatus : TLContactStatusBase { public const uint Signature = TLConstructors.TLContactStatus; public TLInt Expires { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Expires = GetObject(bytes, ref position); return this; } } public class TLContactStatus19 : TLContactStatusBase { public const uint Signature = TLConstructors.TLContactStatus19; public TLUserStatus Status { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Status = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLContacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLContactsBase : TLObject { public abstract TLContactsBase GetEmptyObject(); } public class TLContacts71 : TLContacts { public new const uint Signature = TLConstructors.TLContacts71; public TLInt SavedCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Contacts = GetObject>(bytes, ref position); SavedCount = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLContactsBase GetEmptyObject() { return new TLContacts71 { Contacts = new TLVector(Contacts.Count), SavedCount = SavedCount, Users = new TLVector(Users.Count) }; } public override string ToString() { return string.Format("TLContacts contacts={0} saved_count={1} users={2}", Contacts.Count, SavedCount, Users.Count); } } public class TLContacts : TLContactsBase { public const uint Signature = TLConstructors.TLContacts; public TLVector Users { get; set; } public TLVector Contacts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Contacts = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLContactsBase GetEmptyObject() { return new TLContacts { Contacts = new TLVector(Contacts.Count), Users = new TLVector(Users.Count) }; } } public class TLContactsNotModified : TLContactsBase { public const uint Signature = TLConstructors.TLContactsNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLContactsBase GetEmptyObject() { return new TLContactsNotModified(); } } } ================================================ FILE: Telegram.Api/TL/TLContactsBlocked.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLContactsBlockedBase : TLObject { } public class TLContactsBlocked : TLContactsBlockedBase { public const uint Signature = TLConstructors.TLContactsBlocked; public TLVector Blocked { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLContactsBlocked--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); Blocked = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLContactsBlockedSlice : TLContactsBlocked { public new const uint Signature = TLConstructors.TLContactsBlockedSlice; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLContactsBlocked--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Blocked = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLContactsFound.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLContactsFoundBase : TLObject { public TLVector Users { get; set; } } public class TLContactsFound : TLContactsFoundBase { public const uint Signature = TLConstructors.TLContactsFound; public TLVector Results { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Results = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLContactsFound40 : TLContactsFoundBase { public const uint Signature = TLConstructors.TLContactsFound40; public TLVector Results { get; set; } public TLVector Chats { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Results = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLContactsFound74 : TLContactsFound40 { public new const uint Signature = TLConstructors.TLContactsFound74; public TLVector MyResults { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MyResults = GetObject>(bytes, ref position); Results = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLContainerTransportMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { public class TLTransportMessageWithIdBase : TLObject { public TLLong MessageId { get; set; } } public class TLContainerTransportMessage : TLTransportMessageWithIdBase { public TLInt SeqNo { get; set; } public TLInt MessageDataLength { get; set; } public TLObject MessageData { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { MessageId = GetObject(bytes, ref position); SeqNo = GetObject(bytes, ref position); MessageDataLength = GetObject(bytes, ref position); MessageData = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { var objectBytes = MessageData.ToBytes(); return TLUtils.Combine( MessageId.ToBytes(), SeqNo.ToBytes(), BitConverter.GetBytes(objectBytes.Length), objectBytes); } } public class TLTransportMessage : TLContainerTransportMessage { public TLLong Salt { get; set; } public TLLong SessionId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { Salt = GetObject(bytes, ref position); SessionId = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); SeqNo = GetObject(bytes, ref position); MessageDataLength = GetObject(bytes, ref position); MessageData = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { var objectBytes = MessageData.ToBytes(); return TLUtils.Combine( Salt.ToBytes(), SessionId.ToBytes(), MessageId.ToBytes(), SeqNo.ToBytes(), BitConverter.GetBytes(objectBytes.Length), objectBytes); } } } ================================================ FILE: Telegram.Api/TL/TLDCOption.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum DCOptionFlags { IPv6 = 0x1, Media = 0x2, TCPO = 0x4, CDN = 0x8, Static = 0x10, Secret = 0x400 } [KnownType(typeof(TLDCOption78))] [KnownType(typeof(TLDCOption30))] [DataContract] public class TLDCOption : TLObject { public const uint Signature = TLConstructors.TLDCOption; [DataMember] public TLInt Id { get; set; } [DataMember] public TLString Hostname { get; set; } private TLString _ipAddress; [DataMember] public TLString IpAddress { get { return _ipAddress; } set { _ipAddress = value; } } [DataMember] public TLInt Port { get; set; } #region Additional public TLLong CustomFlags { get; set; } [DataMember] public byte[] AuthKey { get; set; } [DataMember] public bool IsAuthorized { get; set; } [DataMember] public TLLong Salt { get; set; } [DataMember] public long ClientTicksDelta { get; set; } //[DataMember] //Important this field initialize with random value on each app startup to avoid TLBadMessage result with 32, 33 code (incorrect MsgSeqNo) public TLLong SessionId { get; set; } public virtual TLBool IPv6 { get { return TLBool.False; } set { } } public virtual TLBool Media { get { return TLBool.False; } set { } } public virtual TLBool TCPO { get { return TLBool.False; } set { } } public virtual TLBool CDN { get { return TLBool.False; } set { } } public virtual TLBool Static { get { return TLBool.False; } set { } } public bool IsValidIPv4Option(TLInt dcId) { return !IPv6.Value && Id != null && Id.Value == dcId.Value; } public virtual bool IsValidIPv4WithTCPO25Option(TLInt dcId) { return false; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Hostname = GetObject(bytes, ref position); IpAddress = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Hostname.ToStream(output); IpAddress.ToStream(output); Port.ToStream(output); CustomFlags.NullableToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Hostname = GetObject(input); IpAddress = GetObject(input); Port = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public bool AreEquals(TLDCOption dcOption) { if (dcOption == null) return false; return Id.Value == dcOption.Id.Value; } public override string ToString() { return string.Format("{0}) {1}:{2} (AuthKey {3})\n Salt {4} TicksDelta {5}", Id, IpAddress, Port, AuthKey != null, Salt, ClientTicksDelta); } protected string AuthKeySignature(byte[] authKey) { if (authKey == null || authKey.Length == 0) return "null"; return string.Join(" ", AuthKey.Take(7).ToArray()); } } [DataContract] public class TLDCOption30 : TLDCOption { public new const uint Signature = TLConstructors.TLDCOption30; protected TLInt _flags; [DataMember] public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool IPv6 { get { return new TLBool(IsSet(_flags, (int)DCOptionFlags.IPv6)); } set { SetUnset(ref _flags, value.Value, (int)DCOptionFlags.IPv6); } } public override TLBool Media { get { return new TLBool(IsSet(_flags, (int)DCOptionFlags.Media)); } set { SetUnset(ref _flags, value.Value, (int)DCOptionFlags.Media); } } public override TLBool TCPO { get { return new TLBool(IsSet(_flags, (int)DCOptionFlags.TCPO)); } set { SetUnset(ref _flags, value.Value, (int)DCOptionFlags.TCPO); } } public override TLBool CDN { get { return new TLBool(IsSet(_flags, (int)DCOptionFlags.CDN)); } set { SetUnset(ref _flags, value.Value, (int)DCOptionFlags.CDN); } } public override TLBool Static { get { return new TLBool(IsSet(_flags, (int)DCOptionFlags.Static)); } set { SetUnset(ref _flags, value.Value, (int)DCOptionFlags.Static); } } public static string DCOptionFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (DCOptionFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); //Hostname = GetObject(bytes, ref position); IpAddress = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); //Hostname.ToStream(output); IpAddress.ToStream(output); Port.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); //Hostname = GetObject(input); IpAddress = GetObject(input); Port = GetObject(input); return this; } public override string ToString() { return string.Format("{0}) {1}:{2} (AuthKey {3} IsAuthorized={7})\n Flags {6} Salt {4} TicksDelta {5}", Id, IpAddress, Port, AuthKeySignature(AuthKey), Salt, ClientTicksDelta, DCOptionFlagsString(Flags), IsAuthorized); } } [DataContract] public class TLDCOption78 : TLDCOption30 { public new const uint Signature = TLConstructors.TLDCOption78; protected TLString _secret; [DataMember] public TLString Secret { get { return _secret; } set { SetField(out _secret, value, ref _flags, (int)DCOptionFlags.Secret); } } public override bool IsValidIPv4WithTCPO25Option(TLInt dcId) { return IsValidIPv4Option(dcId) && !TLString.IsNullOrEmpty(Secret) && Secret.Data.Length == 16; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); IpAddress = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); _secret = GetObject(Flags, (int)DCOptionFlags.Secret, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); IpAddress.ToStream(output); Port.ToStream(output); ToStream(output, _secret, _flags, (int)DCOptionFlags.Secret); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); IpAddress = GetObject(input); Port = GetObject(input); _secret = GetObject(Flags, (int)DCOptionFlags.Secret, null, input); return this; } public override string ToString() { return string.Format("{0}) {1}:{2} (AuthKey {3} IsAuthorized={7})\n Flags {6} Salt {4} TicksDelta {5}", Id, IpAddress, Port, AuthKeySignature(AuthKey), Salt, ClientTicksDelta, DCOptionFlagsString(Flags), IsAuthorized); } } } ================================================ FILE: Telegram.Api/TL/TLDHConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLDHConfigBase : TLObject { } public class TLDHConfig : TLDHConfigBase { public const uint Signature = TLConstructors.TLDHConfig; public TLInt G { get; set; } public TLString P { get; set; } public TLInt Version { get; set; } public TLString Random { get; set; } #region Additional public TLString A { get; set; } public TLString GA { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); G = GetObject(bytes, ref position); P = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); Random = GetObject(bytes, ref position); return this; } } public class TLDHConfigNotModified : TLDHConfigBase { public const uint Signature = TLConstructors.TLDHConfigNotModified; public TLString Random { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Random = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLDHGen.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLDHGenBase : TLObject { public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLInt128 NewNonce { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { Nonce = GetObject(bytes, ref position); ServerNonce = GetObject(bytes, ref position); NewNonce = GetObject(bytes, ref position); return this; } } public class TLDHGenOk : TLDHGenBase { public const uint Signature = TLConstructors.TLDHGenOk; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLDHGenOk--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return base.FromBytes(bytes, ref position); } } public class TLDHGenRetry : TLDHGenBase { public const uint Signature = TLConstructors.TLDHGenRetry; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLDHGenRetry--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return base.FromBytes(bytes, ref position); } } public class TLDHGenFail : TLDHGenBase { public const uint Signature = TLConstructors.TLDHGenFail; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLDHGenFail--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return base.FromBytes(bytes, ref position); } } } ================================================ FILE: Telegram.Api/TL/TLDataJSON.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLDataJSON : TLUpdateBase { public const uint Signature = TLConstructors.TLDataJSON; public TLString Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Data = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Data.ToStream(output); } public override TLObject FromStream(Stream input) { Data = GetObject(input); return this; } public override IList GetPts() { return new List(); } } } ================================================ FILE: Telegram.Api/TL/TLDecryptedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using Telegram.Api.Services.Cache; #if WIN_RT using Windows.UI.Xaml; #else using System.Windows; #endif using Telegram.Api.Extensions; using Telegram.Api.Services; namespace Telegram.Api.TL { public interface IMessage { TLString Message { get; set; } TLObject From { get; } } public interface ISeqNo { TLInt InSeqNo { get; set; } TLInt OutSeqNo { get; set; } } public abstract class TLDecryptedMessageBase : TLObject { public TLDecryptedMessageBase Self { get { return this; } } public TLDecryptedMessageBase MediaSelf { get { return this; } } public TLLong RandomId { get; set; } public long RandomIndex { get { return RandomId != null ? RandomId.Value : 0; } set { RandomId = new TLLong(value); } } public TLString RandomBytes { get; set; } private bool _isHighlighted; public bool IsHighlighted { get { return _isHighlighted; } set { SetField(ref _isHighlighted, value, () => IsHighlighted); } } private TLObject _from; public TLObject From { get { if (_from != null) return _from; var cacheService = InMemoryCacheService.Instance; _from = cacheService.GetUser(FromId); return _from; } } #region Additional public TLInt ChatId { get; set; } public TLInputEncryptedFileBase InputFile { get; set; } // to send media public TLInt FromId { get; set; } public TLBool Out { get; set; } public TLBool Unread { get; set; } public TLInt Date { get; set; } public int DateIndex { get { return Date != null ? Date.Value : 0; } set { Date = new TLInt(value); } } public TLInt Qts { get; set; } public int QtsIndex { get { return Qts != null ? Qts.Value : 0; } set { Qts = new TLInt(value); } } public TLLong DeleteDate { get; set; } public long DeleteIndex { get { return DeleteDate != null ? DeleteDate.Value : 0; } set { DeleteDate = new TLLong(value); } } public MessageStatus Status { get; set; } public virtual bool ShowFrom { get { return false; } } private bool _isSelected; public bool IsSelected { get { return _isSelected; } set { SetField(ref _isSelected, value, () => IsSelected); } } public abstract Visibility SelectionVisibility { get; } public TLInt TTL { get; set; } private bool _isTTLStarted; public bool IsTTLStarted { get { return _isTTLStarted; } set { SetField(ref _isTTLStarted, value, () => IsTTLStarted); } } public abstract Visibility SecretPhotoMenuVisibility { get; } public abstract Visibility MessageVisibility { get; } public TLDecryptedMessageBase Reply { get; set; } public virtual ReplyInfo ReplyInfo { get { return null; } } public virtual Visibility ReplyVisibility { get { return Visibility.Collapsed; } } public virtual double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { RandomId = GetObject(bytes, ref position); RandomBytes = GetObject(bytes, ref position); return this; } public virtual void Update(TLDecryptedMessageBase message) { ChatId = message.ChatId ?? ChatId; InputFile = message.InputFile ?? InputFile; FromId = message.FromId ?? FromId; Out = message.Out ?? Out; Unread = message.Unread ?? Unread; Date = message.Date ?? Date; Qts = message.Qts ?? Qts; DeleteDate = message.DeleteDate ?? DeleteDate; Status = message.Status; TTL = message.TTL ?? TTL; } public virtual bool IsSticker() { return false; } public static bool IsSticker(TLDecryptedMessageMediaExternalDocument document) { #if WP8 if (document != null && document.Size.Value > 0 && document.Size.Value < Constants.StickerMaxSize) { //var documentStickerAttribute = document22.Attributes.FirstOrDefault(x => x is TLDocumentAttributeSticker); if (//documentStickerAttribute != null //&& string.Equals(document.MimeType.ToString(), "image/webp", StringComparison.OrdinalIgnoreCase) || string.Equals(document.FileExt, "webp", StringComparison.OrdinalIgnoreCase)) { return true; } } #endif return false; } public virtual bool IsGif() { return false; } public virtual bool IsVoice() { return false; } public static bool IsVoice(IAttributes attributes, TLInt size) { #if WP8 if (size == null || size.Value > 0) { var audioAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (audioAttribute != null && audioAttribute.Voice) { return true; } } #endif return false; } public static bool IsVoice(TLDecryptedMessageMediaDocument45 document) { #if WP8 var document22 = document; if (document22 != null) { return IsVoice(document22, document22.Size); } #endif return false; } public virtual bool IsVideo() { return false; } public static bool IsVideo(IAttributes attributes, TLInt size) { #if WP8 if (size == null || size.Value > 0) { var videoAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeVideo) as TLDocumentAttributeVideo; var animatedAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAnimated) as TLDocumentAttributeAnimated; if (videoAttribute != null && animatedAttribute == null) { return true; } } #endif return false; } public static bool IsVideo(TLDecryptedMessageMediaDocument45 document) { #if WP8 var document22 = document; if (document22 != null) { return IsVideo(document22, document22.Size); } #endif return false; } } public class TLDecryptedMessagesContainter : TLDecryptedMessageBase { public const uint Signature = TLConstructors.TLDecryptedMessagesContainter; public TLMessageMediaBase WebPageMedia { get; set; } public TLVector FwdMessages { get; set; } public override Visibility SelectionVisibility { get { return Visibility.Collapsed; } } public override Visibility SecretPhotoMenuVisibility { get { return Visibility.Collapsed; } } public override Visibility MessageVisibility { get { return Visibility.Collapsed; } } public TLObject From { get { //if (FwdMessages != null && FwdMessages.Count > 0) //{ // var fwdMessage = FwdMessages[0] as TLDecryptedMessage; // if (fwdMessage != null) // { // var fwdPeer = fwdMessage.FwdFromPeer; // if (fwdPeer != null) // { // var cacheService = InMemoryCacheService.Instance; // if (fwdPeer is TLPeerChannel) // { // return cacheService.GetChat(fwdPeer.Id); // } // return cacheService.GetUser(fwdPeer.Id); // } // } // return FwdMessages[0].FwdFrom; //} return null; } } public TLString Message { get { if (FwdMessages != null && FwdMessages.Count > 0) { return FwdMessages[0].Message; } return null; } } public TLDecryptedMessageMediaBase Media { get { if (FwdMessages != null && FwdMessages.Count > 0) { return FwdMessages[0].Media; } return null; } } } public class TLDecryptedMessage73 : TLDecryptedMessage45 { public new const uint Signature = TLConstructors.TLDecryptedMessage73; private TLLong _groupedId; public TLLong GroupedId { get { return _groupedId; } set { SetField(out _groupedId, value, ref _flags, (int) MessageFlags.GroupedId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); RandomId = GetObject(bytes, ref position); TTL = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLDecryptedMessageMediaEmpty(); Entities = GetObject>(Flags, (int) MessageFlags.Entities, null, bytes, ref position); ViaBotName = GetObject(Flags, (int) MessageFlags.ViaBotId, null, bytes, ref position); ReplyToRandomMsgId = GetObject(Flags, (int) MessageFlags.ReplyToMsgId, null, bytes, ref position); GroupedId = GetObject(Flags, (int) MessageFlags.GroupedId, null, bytes, ref position); if (IsVoice()) { NotListened = true; } System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessage73.FromBytes random_id={0} ttl={1} message={2} media=[{3}]", RandomId, TTL, Message, Media); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); RandomId = GetObject(input); TTL = GetObject(input); Message = GetObject(input); Media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(input) : new TLDecryptedMessageMediaEmpty(); Entities = GetObject>(Flags, (int)MessageFlags.Entities, null, input); ViaBotName = GetObject(Flags, (int)MessageFlags.ViaBotId, null, input); ReplyToRandomMsgId = GetObject(Flags, (int)MessageFlags.ReplyToMsgId, null, input); GroupedId = GetObject(Flags, (int)MessageFlags.GroupedId, null, input); ChatId = GetNullableObject(input); InputFile = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; InSeqNo = GetNullableObject(input); OutSeqNo = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResult = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(RandomId.ToBytes()); output.Write(TTL.ToBytes()); output.Write(Message.ToBytes()); ToStream(output, Media, Flags, (int)MessageFlags.Media); ToStream(output, Entities, Flags, (int)MessageFlags.Entities); ToStream(output, ViaBotName, Flags, (int)MessageFlags.ViaBotId); ToStream(output, ReplyToRandomMsgId, Flags, (int)MessageFlags.ReplyToMsgId); ToStream(output, GroupedId, Flags, (int)MessageFlags.GroupedId); ChatId.NullableToStream(output); InputFile.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); InSeqNo.NullableToStream(output); OutSeqNo.NullableToStream(output); CustomFlags.NullableToStream(output); if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResult.ToStream(output); } } public override string ToString() { if (Media is TLDecryptedMessageMediaEmpty) { return string.Format("TLDecryptedMessage73 random_id={7} qts={0} in_seq_no={1} out_seq_no={2} flags=[{3}] date={4} delete_date={5} message={6}", Qts, InSeqNo, OutSeqNo, TLMessageBase.MessageFlagsString(Flags), Date, DeleteDate, Message, RandomId); } return string.Format("TLDecryptedMessage73 random_id={7} qts={0} in_seq_no={1} out_seq_no={2} flags=[{3}] date={4} delete_date={5} media={6}", Qts, InSeqNo, OutSeqNo, TLMessageBase.MessageFlagsString(Flags), Date, DeleteDate, Media, RandomId); } } public class TLDecryptedMessage45 : TLDecryptedMessage17 { public new const uint Signature = TLConstructors.TLDecryptedMessage45; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLVector _entities; public TLVector Entities { get { return _entities; } set { if (value != null) { _entities = value; Set(ref _flags, (int)MessageFlags.Entities); } else { Unset(ref _flags, (int)MessageFlags.Entities); } } } private TLString _viaBotBane; public TLString ViaBotName { get { return _viaBotBane; } set { if (value != null) { _viaBotBane = value; Set(ref _flags, (int)MessageFlags.ViaBotId); } else { Unset(ref _flags, (int)MessageFlags.ViaBotId); } } } private TLLong _replyToRandomMsgId; public TLLong ReplyToRandomMsgId { get { return _replyToRandomMsgId; } set { if (value != null && value.Value != 0) { _replyToRandomMsgId = value; Set(ref _flags, (int)MessageFlags.ReplyToMsgId); } else { Unset(ref _flags, (int)MessageFlags.ReplyToMsgId); } } } protected TLBotInlineResultBase _inlineBotResult; public TLBotInlineResultBase InlineBotResult { get { return _inlineBotResult; } set { if (value != null) { Set(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResult = value; } else { Unset(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResult = null; } } } public void SetMedia() { Set(ref _flags, (int)MessageFlags.Media); } public void SetListened() { Unset(ref _flags, (int)MessageFlags.MediaUnread); } public bool NotListened { get { return IsSet(_flags, (int)MessageFlags.MediaUnread); } set { SetUnset(ref _flags, value, (int)MessageFlags.MediaUnread); } } public override ReplyInfo ReplyInfo { get { return ReplyToRandomMsgId != null ? new ReplyInfo { ReplyToRandomMsgId = ReplyToRandomMsgId, Reply = Reply } : null; } } public override Visibility ReplyVisibility { get { return ReplyToRandomMsgId != null && ReplyToRandomMsgId.Value != 0 ? Visibility.Visible : Visibility.Collapsed; } } public override bool IsVoice() { var mediaAudio = Media as TLDecryptedMessageMediaAudio; if (mediaAudio != null) { return true; } var mediaDocument = Media as TLDecryptedMessageMediaDocument45; if (mediaDocument != null) { return IsVoice(mediaDocument); } return false; } public override bool IsVideo() { var mediaVideo = Media as TLDecryptedMessageMediaVideo; if (mediaVideo != null) { return true; } var mediaDocument = Media as TLDecryptedMessageMediaDocument45; if (mediaDocument != null) { return IsVideo(mediaDocument); } return false; } public override bool IsGif() { var mediaDocument = Media as TLDecryptedMessageMediaDocument45; if (mediaDocument != null && TLString.Equals(mediaDocument.MimeType, new TLString("video/mp4"), StringComparison.OrdinalIgnoreCase)) { return TLMessageBase.IsGif(mediaDocument, mediaDocument.Size); } return false; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); RandomId = GetObject(bytes, ref position); TTL = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLDecryptedMessageMediaEmpty(); if (IsSet(Flags, (int) MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotName = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToRandomMsgId = GetObject(bytes, ref position); } if (IsVoice()) { NotListened = true; } System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessage45.FromBytes random_id={0} ttl={1} message={2} media=[{3}]", RandomId, TTL, Message, Media); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); RandomId = GetObject(input); TTL = GetObject(input); Message = GetObject(input); Media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(input) : new TLDecryptedMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotName = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToRandomMsgId = GetObject(input); } ChatId = GetNullableObject(input); InputFile = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; InSeqNo = GetNullableObject(input); OutSeqNo = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResult = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(RandomId.ToBytes()); output.Write(TTL.ToBytes()); output.Write(Message.ToBytes()); ToStream(output, Media, Flags, (int)MessageFlags.Media); ToStream(output, Entities, Flags, (int)MessageFlags.Entities); ToStream(output, ViaBotName, Flags, (int)MessageFlags.ViaBotId); ToStream(output, ReplyToRandomMsgId, Flags, (int)MessageFlags.ReplyToMsgId); ChatId.NullableToStream(output); InputFile.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); InSeqNo.NullableToStream(output); OutSeqNo.NullableToStream(output); CustomFlags.NullableToStream(output); if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResult.ToStream(output); } } public override string ToString() { if (Media is TLDecryptedMessageMediaEmpty) { return string.Format("TLDecryptedMessage45 qts={0} in_seq_no={1} out_seq_no={2} flags=[{3}] date={4} delete_date={5} message={6}", Qts, InSeqNo, OutSeqNo, TLMessageBase.MessageFlagsString(Flags), Date, DeleteDate, Message); } return string.Format("TLDecryptedMessage45 qts={0} in_seq_no={1} out_seq_no={2} flags=[{3}] date={4} delete_date={5} media={6}", Qts, InSeqNo, OutSeqNo, TLMessageBase.MessageFlagsString(Flags), Date, DeleteDate, Media); } } public class TLDecryptedMessage17 : TLDecryptedMessage, ISeqNo { public new const uint Signature = TLConstructors.TLDecryptedMessage17; public TLInt InSeqNo { get; set; } public TLInt OutSeqNo { get; set; } protected TLInt _customFlags; public TLInt CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public override Visibility SecretPhotoMenuVisibility { get { var isSecretPhoto = Media is TLDecryptedMessageMediaPhoto; return isSecretPhoto && TTL.Value > 0.0 && TTL.Value <= 60.0 ? Visibility.Collapsed : Visibility.Visible; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RandomId = GetObject(bytes, ref position); TTL = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessage17.FromBytes random_id={0} ttl={1} message={2} media=[{3}]", RandomId, TTL, Message, Media); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); TTL = GetObject(input); //RandomBytes = GetObject(input); Message = GetObject(input); Media = GetObject(input); ChatId = GetNullableObject(input); InputFile = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; InSeqNo = GetNullableObject(input); OutSeqNo = GetNullableObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomId.ToBytes()); output.Write(TTL.ToBytes()); //output.Write(RandomBytes.ToBytes()); output.Write(Message.ToBytes()); Media.ToStream(output); ChatId.NullableToStream(output); InputFile.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); InSeqNo.NullableToStream(output); OutSeqNo.NullableToStream(output); CustomFlags.NullableToStream(output); } public override string ToString() { if (Media is TLDecryptedMessageMediaEmpty) { return string.Format("TLDecryptedMessage17 qts={0} in_seq_no={1} out_seq_no={2} date={3} delete_date={4} message={5}", Qts, InSeqNo, OutSeqNo, Date, DeleteDate, Message); } return string.Format("TLDecryptedMessage17 qts={0} in_seq_no={1} out_seq_no={2} date={3} delete_date={4} media={5}", Qts, InSeqNo, OutSeqNo, Date, DeleteDate, Media); } } public class TLDecryptedMessage : TLDecryptedMessageBase, IMessage { public const uint Signature = TLConstructors.TLDecryptedMessage; public TLString Message { get; set; } public TLDecryptedMessageMediaBase Media { get; set; } public override double MediaWidth { get { if (Media != null) { return Media.MediaWidth; } return base.MediaWidth; } } public override bool IsSticker() { var mediaDocument = Media as TLDecryptedMessageMediaExternalDocument; if (mediaDocument != null) { return IsSticker(mediaDocument); } return false; } public override Visibility MessageVisibility { get { return Message == null || string.IsNullOrEmpty(Message.ToString()) ? Visibility.Collapsed : Visibility.Visible; } } public override Visibility SelectionVisibility { get { return Visibility.Visible; } } public override Visibility SecretPhotoMenuVisibility { get { return Visibility.Visible; } } public override string ToString() { if (Media is TLDecryptedMessageMediaEmpty) { return string.Format("TLDecryptedMessage qts={0} date={1} delete_date={2} message={3}", Qts, Date, DeleteDate, Message); } return string.Format("TLDecryptedMessage qts={0} date={1} delete_date={2} media={3}", Qts, Date, DeleteDate, Media); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); Message = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessage.FromBytes message={0} media=[{1}]", Message, Media); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); RandomBytes = GetObject(input); Message = GetObject(input); Media = GetObject(input); ChatId = GetNullableObject(input); InputFile = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomId.ToBytes()); output.Write(RandomBytes.ToBytes()); output.Write(Message.ToBytes()); Media.ToStream(output); ChatId.NullableToStream(output); InputFile.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } } public class TLDecryptedMessageService17 : TLDecryptedMessageService, ISeqNo { public new const uint Signature = TLConstructors.TLDecryptedMessageService17; public TLInt InSeqNo { get; set; } public TLInt OutSeqNo { get; set; } public TLInt Flags { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RandomId = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessageService17.FromBytes random_id={0} action=[{1}]", RandomId, Action); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); //RandomBytes = GetObject(input); Action = GetObject(input); ChatId = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; InSeqNo = GetNullableObject(input); OutSeqNo = GetNullableObject(input); Flags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomId.ToBytes()); //output.Write(RandomBytes.ToBytes()); Action.ToStream(output); ChatId.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); InSeqNo.NullableToStream(output); OutSeqNo.NullableToStream(output); Flags.NullableToStream(output); } public override string ToString() { return string.Format("TLDecryptedMessageService17 qts={0} in_seq_no={1} out_seq_no={2} random_id={3} date={4} delete_date={5} action=[{6}]", Qts, InSeqNo, OutSeqNo, RandomId, Date, DeleteDate, Action); } } public class TLDecryptedMessageService : TLDecryptedMessageBase { public const uint Signature = TLConstructors.TLDecryptedMessageService; public TLDecryptedMessageActionBase Action { get; set; } public override Visibility SelectionVisibility { get { return Visibility.Collapsed; } } public override Visibility SecretPhotoMenuVisibility { get { return Visibility.Visible; } } public override Visibility MessageVisibility { get { return Visibility.Collapsed; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); Action = GetObject(bytes, ref position); System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessageService.FromBytes random_id={0} action=[{1}]", RandomId, Action); return this; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(input); RandomBytes = GetObject(input); Action = GetObject(input); ChatId = GetNullableObject(input); FromId = GetNullableObject(input); Out = GetNullableObject(input); Unread = GetNullableObject(input); Date = GetNullableObject(input); DeleteDate = GetNullableObject(input); Qts = GetNullableObject(input); var status = GetObject(input); Status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomId.ToBytes()); output.Write(RandomBytes.ToBytes()); output.Write(Action.ToBytes()); ChatId.NullableToStream(output); FromId.NullableToStream(output); Out.NullableToStream(output); Unread.NullableToStream(output); Date.NullableToStream(output); DeleteDate.NullableToStream(output); Qts.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override string ToString() { var dateTimeString = "null"; try { if (Date != null) { var clientDelta = MTProtoService.Instance.ClientTicksDelta; //var utc0SecsLong = Date.Value * 4294967296 - clientDelta; var utc0SecsInt = Date.Value - clientDelta / 4294967296.0; DateTime? dateTime = Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); dateTimeString = dateTime.Value.ToString("H:mm:ss"); } } catch (Exception ex) { } return string.Format("TLDecryptedMessageService qts={0} random_id={1} date={2} delete_date={3} action=[{4}]", Qts, RandomId, Date, DeleteDate, Action); } } } ================================================ FILE: Telegram.Api/TL/TLDecryptedMessageAction.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLDecryptedMessageActionBase : TLObject { } #region Additional public class TLDecryptedMessageActionEmpty : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } #endregion public class TLDecryptedMessageActionSetMessageTTL : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionSetMessageTTL; public TLInt TTLSeconds { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); TTLSeconds = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), TTLSeconds.ToBytes()); } public override TLObject FromStream(Stream input) { TTLSeconds = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(TTLSeconds.ToBytes()); } } public class TLDecryptedMessageActionReadMessages : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionReadMessages; public TLVector RandomIds { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RandomIds = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), RandomIds.ToBytes()); } public override TLObject FromStream(Stream input) { RandomIds = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomIds.ToBytes()); } } public class TLDecryptedMessageActionDeleteMessages : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionDeleteMessages; public TLVector RandomIds { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RandomIds = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), RandomIds.ToBytes()); } public override TLObject FromStream(Stream input) { RandomIds = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomIds.ToBytes()); } } public class TLDecryptedMessageActionScreenshotMessages : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionScreenshotMessages; public TLVector RandomIds { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RandomIds = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), RandomIds.ToBytes()); } public override TLObject FromStream(Stream input) { RandomIds = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(RandomIds.ToBytes()); } } public class TLDecryptedMessageActionFlushHistory : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionFlushHistory; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLDecryptedMessageActionNotifyLayer : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionNotifyLayer; public TLInt Layer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Layer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Layer.ToBytes()); } public override TLObject FromStream(Stream input) { Layer = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Layer.ToBytes()); } public override string ToString() { return string.Format("TLDecryptedMessageActionNotifyLayer layer={0}", Layer); } } public class TLDecryptedMessageActionResend : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionResend; public TLInt StartSeqNo { get; set; } public TLInt EndSeqNo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); StartSeqNo = GetObject(bytes, ref position); EndSeqNo = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), StartSeqNo.ToBytes(), EndSeqNo.ToBytes()); } public override TLObject FromStream(Stream input) { StartSeqNo = GetObject(input); EndSeqNo = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(StartSeqNo.ToBytes()); output.Write(EndSeqNo.ToBytes()); } } public class TLDecryptedMessageActionTyping : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionTyping; public TLSendMessageActionBase Action { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Action = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Action.ToBytes()); } public override TLObject FromStream(Stream input) { Action = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Action.ToBytes()); } } public class TLDecryptedMessageActionRequestKey : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionRequestKey; public TLLong ExchangeId { get; set; } public TLString GA { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ExchangeId = GetObject(bytes, ref position); GA = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ExchangeId.ToBytes(), GA.ToBytes()); } public override TLObject FromStream(Stream input) { ExchangeId = GetObject(input); GA = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ExchangeId.ToBytes()); output.Write(GA.ToBytes()); } } public class TLDecryptedMessageActionAcceptKey : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionAcceptKey; public TLLong ExchangeId { get; set; } public TLString GB { get; set; } public TLLong KeyFingerprint { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ExchangeId = GetObject(bytes, ref position); GB = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ExchangeId.ToBytes(), GB.ToBytes(), KeyFingerprint.ToBytes()); } public override TLObject FromStream(Stream input) { ExchangeId = GetObject(input); GB = GetObject(input); KeyFingerprint = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ExchangeId.ToBytes()); output.Write(GB.ToBytes()); output.Write(KeyFingerprint.ToBytes()); } } public class TLDecryptedMessageActionAbortKey : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionAbortKey; public TLLong ExchangeId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ExchangeId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ExchangeId.ToBytes()); } public override TLObject FromStream(Stream input) { ExchangeId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ExchangeId.ToBytes()); } } public class TLDecryptedMessageActionCommitKey : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionCommitKey; public TLLong ExchangeId { get; set; } public TLLong KeyFingerprint { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ExchangeId = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ExchangeId.ToBytes(), KeyFingerprint.ToBytes()); } public override TLObject FromStream(Stream input) { ExchangeId = GetObject(input); KeyFingerprint = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(ExchangeId.ToBytes()); output.Write(KeyFingerprint.ToBytes()); } } public class TLDecryptedMessageActionNoop : TLDecryptedMessageActionBase { public const uint Signature = TLConstructors.TLDecryptedMessageActionNoop; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLDecryptedMessageLayer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLDecryptedMessageLayer : TLObject { public const uint Signature = TLConstructors.TLDecryptedMessageLayer; public TLInt Layer { get; set; } public TLDecryptedMessageBase Message { get; set; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <>TLDecryptedMessageLayer.FromBytes layer={0} message=[{1}]", Layer, Message); Layer = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); return this; } } public class TLDecryptedMessageLayer17 : TLDecryptedMessageLayer { public const uint Signature = TLConstructors.TLDecryptedMessageLayer17; public TLString RandomBytes { get; set; } public TLInt InSeqNo { get; set; } public TLInt OutSeqNo { get; set; } public override byte[] ToBytes() { System.Diagnostics.Debug.WriteLine(" <(bytes, ref position); Layer = GetObject(bytes, ref position); InSeqNo = GetObject(bytes, ref position); OutSeqNo = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); System.Diagnostics.Debug.WriteLine(" >>TLDecryptedMessageLayer17.FromBytes layer={0} in_seq_no={1} out_seq_no={2} message=[{3}]", Layer, InSeqNo, OutSeqNo, Message); return this; } } } ================================================ FILE: Telegram.Api/TL/TLDecryptedMessageMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; #if WP8 using Windows.Storage; #endif using Telegram.Api.Extensions; using Telegram.Api.Services.Cache; namespace Telegram.Api.TL { public class TTLParams { public bool IsStarted { get; set; } public int Total { get; set; } public DateTime StartTime { get; set; } public bool Out { get; set; } } public abstract class TLDecryptedMessageMediaBase : TLObject { public double LastProgress { get; set; } public string IsoFileName { get; set; } public bool? AutoPlayGif { get; set; } public bool Forbidden { get; set; } public TLInt TTLSeconds { get; set; } private double _uploadingProgress; public double UploadingProgress { get { return _uploadingProgress; } set { SetField(ref _uploadingProgress, value, () => UploadingProgress); } } private double _downloadingProgress; public double DownloadingProgress { get { return _downloadingProgress; } set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } } #region Additional #if WP8 public StorageFile StorageFile { get; set; } #endif private TLEncryptedFileBase _file; public TLEncryptedFileBase File { get { return _file; } set { _file = value; } } public TLDecryptedMessageMediaBase Self { get { return this; } } public TLDecryptedMessageMediaBase ThumbSelf { get { return this; } } public bool IsCanceled { get; set; } public TTLParams _ttlParams; public TTLParams TTLParams { get { return _ttlParams; } set { SetField(ref _ttlParams, value, () => TTLParams); } } public bool NotListened { get; set; } private bool _out = true; public bool Out { get { return _out; } set { _out = value; } } public virtual double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } #endregion } public class TLDecryptedMessageMediaEmpty : TLDecryptedMessageMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLDecryptedMessageThumbMediaBase : TLDecryptedMessageMediaBase { public TLString Thumb { get; set; } public TLInt ThumbW { get; set; } public TLInt ThumbH { get; set; } public TLInt Size { get; set; } public TLString Key { get; set; } public TLString IV { get; set; } } public class TLDecryptedMessageMediaPhoto45 : TLDecryptedMessageMediaPhoto, IMediaCaption { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaPhoto45; public TLString Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); Caption = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); output.Write(Caption.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaPhoto : TLDecryptedMessageThumbMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaPhoto; public TLInt W { get; set; } public TLInt H { get; set; } #region Additional public TLEncryptedFileBase Photo { get { return File; } } #endregion public override double MediaWidth { get { var ttl = TTLSeconds; if (ttl != null && ttl.Value > 0 && ttl.Value <= 60.0) { return 2.0 + 256.0 + 2.0; } var minVerticalRatioToScale = 1.2; var scale = 1.2; // must be less than minVerticalRatioToScale to avoid large square photos var maxDimension = 323.0; if (H.Value > W.Value) { if (TLMessageMediaPhoto.IsScaledVerticalPhoto(minVerticalRatioToScale, H, W)) { return 2.0 + scale * maxDimension / H.Value * W.Value + 2.0; } return 2.0 + maxDimension / H.Value * W.Value + 2.0; } return 2.0 + maxDimension + 2.0; } } //public override double MediaWidth //{ // get // { // if (TLMessageBase.HasTTL(this) && Photo != null) // { // return 2.0 + 256.0 + 2.0; // } // return base.MediaWidth; // } //} public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaVideo45 : TLDecryptedMessageMediaVideo17, IMediaCaption { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaVideo45; public TLString Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); Caption = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(Duration.ToBytes()); output.Write(MimeType.ToBytes()); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); output.Write(Caption.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaVideo17 : TLDecryptedMessageMediaVideo { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaVideo17; public TLString MimeType { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(Duration.ToBytes()); output.Write(MimeType.ToBytes()); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaVideo : TLDecryptedMessageThumbMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaVideo; public TLInt Duration { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } #region Additional public TLDecryptedMessageMediaVideo Video { get { return this; } } public string DurationString { get { if (Duration == null) return string.Empty; var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } #endregion public override double MediaWidth { get { return 2.0 + 230.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(Duration.ToBytes()); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaVenue : TLDecryptedMessageMediaGeoPoint { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaVenue; public TLString Title { get; set; } public TLString Address { get; set; } public TLString Provider { get; set; } public TLString VenueId { get; set; } public override double MediaWidth { get { return 2.0 + 320.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Lat = GetObject(bytes, ref position); Long = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Address = GetObject(bytes, ref position); Provider = GetObject(bytes, ref position); VenueId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Lat.ToBytes(), Long.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes()); } public override TLObject FromStream(Stream input) { Lat = GetObject(input); Long = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Lat.ToStream(output); Long.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); } } public class TLDecryptedMessageMediaGeoPoint : TLDecryptedMessageMediaBase, IMessageMediaGeoPoint { public const uint Signature = TLConstructors.TLDecryptedMessageMediaGeoPoint; public TLDouble Lat { get; set; } public TLDouble Long { get; set; } #region Additional public TLGeoPointBase Geo { get { return Lat != null && Long != null ? (TLGeoPointBase) new TLGeoPoint{ Lat = Lat, Long = Long } : new TLGeoPointEmpty(); } } #endregion public override double MediaWidth { get { return 2.0 + 320.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Lat = GetObject(bytes, ref position); Long = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Lat.ToBytes(), Long.ToBytes()); } public override TLObject FromStream(Stream input) { Lat = GetObject(input); Long = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Lat.ToBytes()); output.Write(Long.ToBytes()); } } public class TLDecryptedMessageMediaContact : TLDecryptedMessageMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaContact; public TLString PhoneNumber { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public TLInt UserId { get; set; } public override string ToString() { return FullName; } #region Additional public virtual string FullName { get { return string.Format("{0} {1}", FirstName, LastName); } } public TLUserBase User { get { var cacheService = InMemoryCacheService.Instance; var user = cacheService.GetUser(UserId); if (user == null) { return new TLUser{Phone = PhoneNumber, FirstName = FirstName, LastName = LastName, Id = new TLInt(0)}; } return null; } } #endregion public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneNumber = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserId.ToBytes()); } public override TLObject FromStream(Stream input) { PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(PhoneNumber.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserId.ToBytes()); } } public class TLDecryptedMessageMediaAudio : TLDecryptedMessageMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaAudio; public TLInt Duration { get; set; } public TLInt Size { get; set; } public TLString Key { get; set; } public TLString IV { get; set; } public override double MediaWidth { get { return 12.0 + 284.0 + 12.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Duration = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Duration.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Duration = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); UserId = GetNullableObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Duration.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); UserId.NullableToStream(output); File.NullableToStream(output); } #region Additional private TLInt _userId; public TLInt UserId { get { return _userId; } set { _userId = value; } } public TLDecryptedMessageMediaAudio Audio { get { return this; } } public string DurationString { get { var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public TLUserBase User { get { if (UserId == null) return null; var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(UserId); } } #endregion } public class TLDecryptedMessageMediaAudio17 : TLDecryptedMessageMediaAudio { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaAudio17; public TLString MimeType { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Duration.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Duration = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); UserId = GetNullableObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Duration.ToBytes()); output.Write(MimeType.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); UserId.NullableToStream(output); File.NullableToStream(output); } } public class TLDecryptedMessageMediaDocument45 : TLDecryptedMessageMediaDocument, IMediaCaption, IAttributes { public new const uint Signature = TLConstructors.TLDecryptedMessageMediaDocument45; public override TLString FileName { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var fileNameAttribute = Attributes[i] as TLDocumentAttributeFileName; if (fileNameAttribute != null) { return fileNameAttribute.FileName; } } } return TLString.Empty; } set { Attributes = Attributes ?? new TLVector(); for (var i = 0; i < Attributes.Count; i++) { if (Attributes[i] is TLDocumentAttributeFileName) { Attributes.RemoveAt(i--); } } Attributes.Add(new TLDocumentAttributeFileName { FileName = value }); } } public bool Music { get { var documentAttributeAudio = Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio32) as TLDocumentAttributeAudio32; if (documentAttributeAudio != null) { return true; } return false; } } public override string DocumentName { get { var documentAttributeAudio = Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (documentAttributeAudio != null) { if (documentAttributeAudio.Title != null && documentAttributeAudio.Performer != null) { return string.Format("{0} — {1}", documentAttributeAudio.Title, documentAttributeAudio.Performer); } if (documentAttributeAudio.Title != null) { return string.Format("{0}", documentAttributeAudio.Title); } if (documentAttributeAudio.Performer != null) { return string.Format("{0}", documentAttributeAudio.Performer); } } return FileName.ToString(); } } public TLVector Attributes { get; set; } public TLString Caption { get; set; } public TLInt Duration { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var audioAttribute = Attributes[i] as TLDocumentAttributeAudio; if (audioAttribute != null) { return audioAttribute.Duration; } } } return new TLInt(0); } } public TLString Waveform { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var audioAttribute = Attributes[i] as TLDocumentAttributeAudio46; if (audioAttribute != null) { return audioAttribute.Waveform; } } } return null; } } public string DurationString { get { var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public override double MediaWidth { get { var document = Document as TLDecryptedMessageMediaDocument45; if (document != null) { if (TLMessageBase.IsSticker(document, document.Size)) { var maxStickerDimension = 196.0; return 6.0 + TLMessageMediaDocument.GetStickerDimension(document, true, maxStickerDimension) + 6.0; } if (TLMessageBase.IsVoice(document, document.Size)) { return 12.0 + 284.0 + 12.0; } //if (TLMessageBase.IsRoundVideo(document)) //{ // return 2.0 + 240.0 + 2.0; //} if (TLMessageBase.IsVideo(document, document.Size)) { return 2.0 + 230.0 + 2.0; } if (TLMessageBase.IsGif(document, document.Size)) { var maxGifDimension = 323.0; return 2.0 + TLMessageMediaDocument.GetGifDimension(new TLPhotoCachedSize { W = ThumbW, H = ThumbH }, document, true, maxGifDimension) + 2.0; } } return base.MediaWidth; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes(), Attributes.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(MimeType.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); output.Write(Attributes.ToBytes()); output.Write(Caption.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaDocument : TLDecryptedMessageMediaBase, IDecryptedMediaGif { public const uint Signature = TLConstructors.TLDecryptedMessageMediaDocument; public TLString Thumb { get; set; } public TLInt ThumbW { get; set; } public TLInt ThumbH { get; set; } public virtual TLString FileName { get; set; } public TLString MimeType { get; set; } public TLInt Size { get; set; } public TLString Key { get; set; } public TLString IV { get; set; } #region Additional public TLDecryptedMessageMediaDocument Document { get { return this; } } public virtual string DocumentName { get { return FileName != null ? FileName.ToString() : string.Empty; } } public string FileExt { get { return FileName != null ? Path.GetExtension(FileName.ToString()).Replace(".", string.Empty) : null; } } public int DocumentSize { get { return Size != null ? Size.Value : 0; } } public string GetFileName() { var fileLocation = File as TLEncryptedFile; if (fileLocation == null) return null;; var fileName = String.Format("{0}_{1}_{2}.{3}", fileLocation.Id, fileLocation.DCId, fileLocation.AccessHash, FileExt); return fileName; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Thumb = GetObject(bytes, ref position); ThumbW = GetObject(bytes, ref position); ThumbH = GetObject(bytes, ref position); FileName = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); IV = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Thumb.ToBytes(), ThumbW.ToBytes(), ThumbH.ToBytes(), FileName.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Key.ToBytes(), IV.ToBytes()); } public override TLObject FromStream(Stream input) { Thumb = GetObject(input); ThumbW = GetObject(input); ThumbH = GetObject(input); FileName = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Key = GetObject(input); IV = GetObject(input); File = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Thumb.ToBytes()); output.Write(ThumbW.ToBytes()); output.Write(ThumbH.ToBytes()); output.Write(FileName.ToBytes()); output.Write(MimeType.ToBytes()); output.Write(Size.ToBytes()); output.Write(Key.ToBytes()); output.Write(IV.ToBytes()); File.NullableToStream(output); } } public class TLDecryptedMessageMediaExternalDocument : TLDecryptedMessageMediaBase, IAttributes { public const uint Signature = TLConstructors.TLDecryptedMessageMediaExternalDocument; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLString MimeType { get; set; } public TLInt Size { get; set; } public TLPhotoSizeBase Thumb { get; set; } public TLInt DCId { get; set; } public TLVector Attributes { get; set; } public TLInt ImageSizeH { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var imageSizeAttribute = Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { return imageSizeAttribute.H; } } } return new TLInt(0); } } public TLInt ImageSizeW { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var imageSizeAttribute = Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { return imageSizeAttribute.W; } } } return new TLInt(0); } } public string FileExt { get { return Path.GetExtension(FileName.ToString()).Replace(".", string.Empty); } } public TLString FileName { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var fileNameAttribute = Attributes[i] as TLDocumentAttributeFileName; if (fileNameAttribute != null) { return fileNameAttribute.FileName; } } } return TLString.Empty; } set { Attributes = Attributes ?? new TLVector(); for (var i = 0; i < Attributes.Count; i++) { if (Attributes[i] is TLDocumentAttributeFileName) { Attributes.RemoveAt(i--); } } Attributes.Add(new TLDocumentAttributeFileName { FileName = value }); } } public string GetFileName() { return string.Format("document{0}_{1}.{2}", Id, AccessHash, FileExt); } public TLInputStickerSetBase StickerSet { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var stickerAttribute = Attributes[i] as TLDocumentAttributeSticker29; if (stickerAttribute != null) { return stickerAttribute.Stickerset; } } } return null; } } #region Additional public string Emoticon { get; set; } public TLDecryptedMessageMediaExternalDocument Document { get { return this; } } #endregion public override string ToString() { return string.Format("{0} Id={1}", GetType().Name, Id) + (StickerSet != null ? StickerSet.ToString() : string.Empty); } public TLInputDocumentFileLocation ToInputFileLocation() { return new TLInputDocumentFileLocation54 { Id = Id, AccessHash = AccessHash, Version = new TLInt(0) }; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); Attributes.ToStream(output); } } public class TLDecryptedMessageMediaWebPage : TLDecryptedMessageMediaBase { public const uint Signature = TLConstructors.TLDecryptedMessageMediaWebPage; public TLString Url { get; set; } public TLWebPageBase WebPage { get; set; } public TLPhotoBase Photo { get { var webPage = WebPage as TLWebPage; if (webPage != null) { return webPage.Photo; } return null; } } public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes()); } public override TLObject FromStream(Stream input) { Url = GetObject(input); WebPage = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Url.ToBytes()); WebPage.NullableToStream(output); } } public class TLDecryptedMessageMediaGroup : TLDecryptedMessageMediaBase, IMessageMediaGroup { public const uint Signature = TLConstructors.TLDecryptedMessageMediaGroup; public TLVector Group { get; set; } public TLVector GroupCommon { get { if (Group == null) { return new TLVector(); } var group = new TLVector(); foreach (var item in Group) { group.Add(item); } return group; } } public override double MediaWidth { get { return 1.0 + 311.0 + 1.0; } } public event EventHandler Calculate; public virtual void RaiseCalculate() { var handler = Calculate; if (handler != null) handler(this, EventArgs.Empty); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Group = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Group = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Group.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLDialog.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using Telegram.Api.Helpers; #if WIN_RT using Windows.UI; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; #elif WINDOWS_PHONE using System.Windows; using System.Windows.Media; #endif using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum DialogCustomFlags { PinnedId = 0x1, // 0 Promo = 0x2, // 1 PromoExpires = 0x4, // 2 PromoNotification = 0x8, // 3 UnreadMark = 0x10, // 4 } [Flags] public enum DialogFlags { Pts = 0x1, // 0 Draft = 0x2, // 1 Pinned = 0x4, // 2 UnreadMark = 0x8, // 3 ReadMaxPosition = 0x10, // 4 } public interface IDialogPts { TLInt Pts { get; set; } } public enum TypingType { Text, Record, Upload } public class Typing { public TypingType Type { get; protected set; } public string Description { get; protected set; } public override string ToString() { return Description; } public Typing(TypingType type, string description) { Description = description; Type = type; } public static bool Equals(Typing typing1, Typing typing2) { if (typing1 == null && typing2 == null) return true; if (typing1 == null) return false; if (typing2 == null) return false; return typing1.Type == typing2.Type; } } public abstract class TLDialogBase : TLObject { public static string DialogFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (DialogFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public object MessagesSyncRoot = new object(); public int Index { get { return Peer != null && Peer.Id != null ? Peer.Id.Value : default(int); } set { //NOTE: No need to set Index during deserialization. Possible null reference } } public TLPeerBase Peer { get; set; } public TLInt TopMessageId { get; set; } private TLInt _unreadCount; public TLInt UnreadCount { get { return _unreadCount; } set { _unreadCount = value; } } public virtual bool IsPinned { get; set; } public virtual TLInt PinnedId { get; set; } #region Additional public Typing Typing { get; set; } public TLDialogBase Self { get { return this; } } /// /// If top message is sending message, than it has RandomId instead of Id /// public TLLong TopMessageRandomId { get; set; } public TLLong TopDecryptedMessageRandomId { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public TLObject _with; public TLObject With { get { return _with; } set { SetField(ref _with, value, () => With); } } public int WithId { get { if (With is TLChatBase) { return ((TLChatBase)With).Index; } if (With is TLUserBase) { return ((TLUserBase)With).Index; } return -1; } } public Visibility ChatIconVisibility { get { return Peer is TLPeerChat ? Visibility.Visible : Visibility.Collapsed; } } public Visibility ChatVisibility { get { return Peer is TLPeerChat || Peer is TLPeerEncryptedChat || Peer is TLPeerBroadcast ? Visibility.Visible : Visibility.Collapsed; } } public Visibility UserVisibility { get { return Peer is TLPeerUser || _with is TLChatForbidden || _with is TLChatEmpty ? Visibility.Visible : Visibility.Collapsed; } } public Visibility BotVisibility { get { var user = _with as TLUser; return user != null && user.IsBot ? Visibility.Visible : Visibility.Collapsed; } } public Visibility EncryptedChatVisibility { get { return Peer is TLPeerEncryptedChat ? Visibility.Visible : Visibility.Collapsed; } } public Visibility VerifiedVisibility { get { var user = With as TLUserBase; if (user != null) { return user.IsVerified ? Visibility.Visible : Visibility.Collapsed; } var channel = With as TLChannel; if (channel != null) { return channel.IsVerified ? Visibility.Visible : Visibility.Collapsed; } return Visibility.Collapsed; } } public Uri EncryptedImageSource { get { var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; return !isLightTheme ? new Uri("/Images/Dialogs/secretchat-white-WXGA.png", UriKind.Relative) : new Uri("/Images/Dialogs/secretchat-black-WXGA.png", UriKind.Relative); } } public virtual Brush ForegroundBrush { get { return (Brush)Application.Current.Resources["PhoneForegroundBrush"]; } } public Brush MuteIconBackground { get { return new SolidColorBrush(Color.FromArgb(255, 39, 164, 236)); } } public bool IsChat { get { return Peer is TLPeerChat; } } public bool IsEncryptedChat { get { return Peer is TLPeerEncryptedChat; } } public DateTime? LastNotificationTime { get; set; } public int UnmutedCount { get; set; } #endregion public abstract int GetDateIndex(); public abstract int GetDateIndexWithDraft(); public abstract int CountMessages(); } public class TLEncryptedDialog : TLDialogBase { public const uint Signature = TLConstructors.TLDialogSecret; #region Additional public TLInt UnreadMentionsCount { get; set; } public TLDecryptedMessageBase _topMessage; public TLDecryptedMessageBase TopMessage { get { if (TLUtils.IsDisplayedDecryptedMessage(_topMessage, true)) { return _topMessage; } if (Messages != null) { for (var i = 0; i < Messages.Count; i++) { if (TLUtils.IsDisplayedDecryptedMessage(Messages[i], true)) { return Messages[i]; } } } return null; } set { SetField(ref _topMessage, value, () => TopMessage); } } public ObservableCollection Messages { get; set; } #endregion public override Brush ForegroundBrush { get { return new SolidColorBrush(Color.FromArgb(255, 0, 170, 8)); } } public override int GetDateIndex() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int GetDateIndexWithDraft() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int CountMessages() { return Messages.Count; } public override TLObject FromStream(Stream input) { Peer = GetObject(input); var topDecryptedMessageRandomId = GetObject(input); if (topDecryptedMessageRandomId.Value != 0) { TopDecryptedMessageRandomId = topDecryptedMessageRandomId; } UnreadCount = GetObject(input); _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); TopDecryptedMessageRandomId = TopDecryptedMessageRandomId ?? new TLLong(0); TopDecryptedMessageRandomId.ToStream(output); output.Write(UnreadCount.ToBytes()); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = Messages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } } public override string ToString() { return string.Format("peer=[{0}] unread_count={1} top_message_id={2} top_message={3}", Peer, UnreadCount, TopMessageId, TopMessage); } public static int InsertMessageInOrder(IList messages, TLDecryptedMessageBase message) { var position = -1; if (messages.Count == 0) { position = 0; } for (var i = 0; i < messages.Count; i++) { if (messages[i].DateIndex < message.DateIndex) { position = i; break; } } if (position != -1) { messages.Insert(position, message); } return position; } } public class TLBroadcastDialog : TLDialogBase { public const uint Signature = TLConstructors.TLBroadcastDialog; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } UnreadCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); output.Write(UnreadCount.ToBytes()); NotifySettings.NullableToStream(output); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = Messages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } } #region Additional public TLMessageBase _topMessage; public TLMessageBase TopMessage { get { return _topMessage; } set { SetField(ref _topMessage, value, () => TopMessage); } } public ObservableCollection Messages { get; set; } public bool ShowFrom { get { return Peer is TLPeerChat && !(TopMessage is TLMessageService); } } #endregion public override int GetDateIndex() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int GetDateIndexWithDraft() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int CountMessages() { return Messages.Count; } public override string ToString() { return string.Format("peer=[{0}] unread_count={1} top_message_id={2} top_message={3}", Peer, UnreadCount, TopMessageId, TopMessage); } public static int InsertMessageInOrder(IList messages, TLMessageBase message) { var position = -1; if (messages.Count == 0) { position = 0; } for (var i = 0; i < messages.Count; i++) { if (messages[i].Index == 0) { if (messages[i].DateIndex < message.DateIndex) { position = i; break; } continue; } if (messages[i].Index == message.Index) { position = -1; break; } if (messages[i].Index < message.Index) { position = i; break; } } if (position != -1) { //message.IsAnimated = position == 0; Execute.BeginOnUIThread(() => messages.Insert(position, message)); } return position; } public virtual void Update(TLDialog dialog) { Peer = dialog.Peer; UnreadCount = dialog.UnreadCount; //если последнее сообщение отправляется и имеет дату больше, то не меняем if (TopMessageId == null && TopMessage.DateIndex > dialog.TopMessage.DateIndex) { //добавляем сообщение в список в нужное место InsertMessageInOrder(Messages, dialog.TopMessage); return; } TopMessageId = dialog.TopMessageId; TopMessageRandomId = dialog.TopMessageRandomId; TopMessage = dialog.TopMessage; if (Messages.Count > 0) { for (int i = 0; i < Messages.Count; i++) { if (Messages[i].DateIndex < TopMessage.DateIndex) { Messages.Insert(i, TopMessage); break; } if (Messages[i].DateIndex == TopMessage.DateIndex) { break; } } } else { Messages.Add(TopMessage); } } } public class TLDialog : TLDialogBase { public const uint Signature = TLConstructors.TLDialog; #region Additional public TLMessageBase _topMessage; public TLMessageBase TopMessage { get { return _topMessage; } set { SetField(ref _topMessage, value, () => TopMessage); } } public ObservableCollection Messages { get; set; } public List CommitMessages { get; set; } public bool ShowFrom { get { return Peer is TLPeerChat && !(TopMessage is TLMessageService); } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } UnreadCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); var dialog71 = new TLDialog71(); dialog71.Flags = new TLInt(0); dialog71.Peer = Peer; dialog71.TopMessageId = TopMessageId; dialog71.ReadInboxMaxId = new TLInt(0); dialog71.ReadOutboxMaxId = new TLInt(0); dialog71.UnreadCount = UnreadCount; dialog71.UnreadMentionsCount = new TLInt(0); dialog71.NotifySettings = NotifySettings; //dialog53.Pts = Pts; dialog71.Draft = null; dialog71.TopMessageRandomId = topMessageRandomId; dialog71._with = _with; dialog71.Messages = Messages; return dialog71; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); output.Write(UnreadCount.ToBytes()); NotifySettings.NullableToStream(output); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = CommitMessages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } } public virtual void Update(TLDialog dialog) { Peer = dialog.Peer; UnreadCount = dialog.UnreadCount; //если последнее сообщение отправляется и имеет дату больше, то не меняем if (TopMessageId == null && (TopMessage == null || TopMessage.DateIndex > dialog.TopMessage.DateIndex)) { //добавляем сообщение в список в нужное место, если его еще нет var insertRequired = false; if (Messages != null && dialog.TopMessage != null) { var oldMessage = Messages.FirstOrDefault(x => x.Index == dialog.TopMessage.Index); if (oldMessage == null) { insertRequired = true; } } if (insertRequired) { InsertMessageInOrder(Messages, dialog.TopMessage); } return; } if (TopMessageId != null && dialog.TopMessageId != null && TopMessageId.Value == dialog.TopMessageId.Value) { } else if (TopMessage != null && TopMessage.RandomIndex != 0) { } else { TopMessageId = dialog.TopMessageId; _topMessage = dialog.TopMessage; TopMessageRandomId = dialog.TopMessageRandomId; lock (MessagesSyncRoot) { InsertMessageInOrder(Messages, TopMessage); } } } #region Methods public override int GetDateIndex() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int GetDateIndexWithDraft() { return _topMessage != null ? _topMessage.DateIndex : 0; } public override int CountMessages() { return Messages.Count; } public override string ToString() { return string.Format("peer=[{0}] pinned_id={1} unread_count={2} top_message_id={3} top_message={4}", Peer, PinnedId, UnreadCount, TopMessageId, TopMessage); } public static int InsertMessageInOrder(IList messages, TLMessageBase message) { var position = -1; if (messages.Count == 0) { position = 0; } for (var i = 0; i < messages.Count; i++) { if (messages[i].Index == 0) { if (messages[i].DateIndex < message.DateIndex) { position = i; break; } continue; } if (messages[i].Index == message.Index) { position = -1; break; } if (messages[i].Index < message.Index) { position = i; break; } } if (position != -1) { //message._isAnimated = position == 0; messages.Insert(position, message); } return position; } #endregion } public class TLDialog24 : TLDialog { public new const uint Signature = TLConstructors.TLDialog24; public TLInt ReadInboxMaxId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } ReadInboxMaxId = GetObject(input); UnreadCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); var dialog71 = new TLDialog71(); dialog71.Flags = new TLInt(0); dialog71.Peer = Peer; dialog71.TopMessageId = TopMessageId; dialog71.ReadInboxMaxId = ReadInboxMaxId; dialog71.ReadOutboxMaxId = new TLInt(0); dialog71.UnreadCount = UnreadCount; dialog71.UnreadMentionsCount = new TLInt(0); dialog71.NotifySettings = NotifySettings; //dialog53.Pts = Pts; dialog71.Draft = null; dialog71.TopMessageRandomId = topMessageRandomId; dialog71._with = _with; dialog71.Messages = Messages; return dialog71; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); ReadInboxMaxId = ReadInboxMaxId ?? new TLInt(0); ReadInboxMaxId.ToStream(output); output.Write(UnreadCount.ToBytes()); NotifySettings.NullableToStream(output); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = Messages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } } public override void Update(TLDialog dialog) { try { base.Update(dialog); } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } var dialog24 = dialog as TLDialog24; if (dialog24 != null) { ReadInboxMaxId = dialog24.ReadInboxMaxId; } } } public class TLDialog53 : TLDialog24, IReadMaxId, IDialogPts { public new const uint Signature = TLConstructors.TLDialog53; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt ReadOutboxMaxId { get; set; } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } protected TLInt _pts; public TLInt Pts { get { return _pts; } set { SetField(out _pts, value, ref _flags, (int)DialogFlags.Pts); } } protected TLDraftMessageBase _draft; public TLDraftMessageBase Draft { get { return _draft; } set { SetField(out _draft, value, ref _flags, (int)DialogFlags.Draft); } } protected TLInt _pinnedId; public override TLInt PinnedId { get { return _pinnedId; } set { SetField(out _pinnedId, value, ref _customFlags, (int)DialogCustomFlags.PinnedId); } } public bool UnreadMark { get { return IsSet(_customFlags, (int)DialogFlags.UnreadMark); } set { SetUnset(ref _customFlags, value, (int)DialogFlags.UnreadMark); } } public override int GetDateIndex() { if (IsPinned) { if (PinnedId != null) { return int.MaxValue - PinnedId.Value; } Execute.ShowDebugMessage("GetDateIndex IsPinned=true PinnedId=null with=" + With); } return base.GetDateIndex(); } public override int GetDateIndexWithDraft() { var dateIndex = GetDateIndex(); if (IsPinned) { if (PinnedId != null) { return int.MaxValue - PinnedId.Value; } } var draft = Draft as TLDraftMessage; if (draft != null) { return Math.Max(draft.Date.Value, dateIndex); } return dateIndex; } public override bool IsPinned { get { return IsSet(Flags, (int)DialogFlags.Pinned); } set { SetUnset(ref _flags, value, (int)DialogFlags.Pinned); } } public override string ToString() { return string.Format("flags={0} ", DialogFlagsString(Flags)) + "count=" + (Messages != null ? Messages.Count : 0) + " commit_count=" + (CommitMessages != null ? CommitMessages.Count : 0) + " " + base.ToString(); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); _pts = GetObject(Flags, (int)DialogFlags.Pts, null, bytes, ref position); _draft = GetObject(Flags, (int)DialogFlags.Draft, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } ReadInboxMaxId = GetObject(input); ReadOutboxMaxId = GetObject(input); UnreadCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; _pts = GetObject(Flags, (int)DialogFlags.Pts, null, input); _draft = GetObject(Flags, (int)DialogFlags.Draft, null, input); var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); CustomFlags = GetNullableObject(input); PinnedId = GetObject(CustomFlags, (int)DialogCustomFlags.PinnedId, null, input); var dialog71 = new TLDialog71(); dialog71.Flags = new TLInt(0); dialog71.Peer = Peer; dialog71.TopMessageId = TopMessageId; dialog71.ReadInboxMaxId = ReadInboxMaxId; dialog71.ReadOutboxMaxId = ReadOutboxMaxId; dialog71.UnreadCount = UnreadCount; dialog71.UnreadMentionsCount = new TLInt(0); dialog71.NotifySettings = NotifySettings; dialog71.Pts = Pts; dialog71.Draft = Draft; dialog71.TopMessageRandomId = TopMessageRandomId; dialog71._with = _with; dialog71.Messages = Messages; dialog71.PinnedId = PinnedId; return dialog71; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); ReadInboxMaxId = ReadInboxMaxId ?? new TLInt(0); ReadInboxMaxId.ToStream(output); ReadOutboxMaxId = ReadOutboxMaxId ?? new TLInt(0); ReadOutboxMaxId.ToStream(output); UnreadCount.ToStream(output); NotifySettings.NullableToStream(output); ToStream(output, Pts, Flags, (int)DialogFlags.Pts); ToStream(output, Draft, Flags, (int)DialogFlags.Draft); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = CommitMessages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } CustomFlags.NullableToStream(output); ToStream(output, PinnedId, CustomFlags, (int)DialogCustomFlags.PinnedId); } public override void Update(TLDialog dialog) { try { base.Update(dialog); } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } var dialog53 = dialog as TLDialog53; if (dialog53 != null) { ReadOutboxMaxId = dialog53.ReadOutboxMaxId; Pts = dialog53.Pts; Draft = dialog53.Draft; if (dialog53.IsPinned) { IsPinned = true; if (dialog53.PinnedId != null) PinnedId = dialog53.PinnedId; } else { IsPinned = false; dialog53.PinnedId = null; } } } } public class TLDialog71 : TLDialog53 { public new const uint Signature = TLConstructors.TLDialog71; public TLInt UnreadMentionsCount { get; set; } public TLVector UnreadMentions { get; set; } public IList MigratedHistory { get; set; } public bool IsPromo { get { return IsSet(_customFlags, (int)DialogCustomFlags.Promo); } set { SetUnset(ref _customFlags, value, (int)DialogCustomFlags.Promo); } } protected TLInt _promoExpires; public TLInt PromoExpires { get { return _promoExpires; } set { SetField(out _promoExpires, value, ref _customFlags, (int)DialogCustomFlags.PromoExpires); } } public bool PromoNotification { get { return IsSet(_customFlags, (int)DialogCustomFlags.PromoNotification); } set { SetUnset(ref _customFlags, value, (int)DialogCustomFlags.PromoNotification); } } public override int GetDateIndex() { if (IsPromo) { return int.MaxValue; } if (IsPinned) { if (PinnedId != null) { return int.MaxValue - PinnedId.Value - 1; } Execute.ShowDebugMessage("GetDateIndex IsPinned=true PinnedId=null with=" + With); } return base.GetDateIndex(); } public override int GetDateIndexWithDraft() { var dateIndex = GetDateIndex(); if (IsPromo) { return int.MaxValue; } if (IsPinned) { if (PinnedId != null) { return int.MaxValue - PinnedId.Value - 1; } } var draft = Draft as TLDraftMessage; if (draft != null) { return Math.Max(draft.Date.Value, dateIndex); } return dateIndex; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); ReadOutboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadMentionsCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); _pts = GetObject(Flags, (int)DialogFlags.Pts, null, bytes, ref position); _draft = GetObject(Flags, (int)DialogFlags.Draft, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } ReadInboxMaxId = GetObject(input); ReadOutboxMaxId = GetObject(input); UnreadCount = GetObject(input); UnreadMentionsCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; _pts = GetObject(Flags, (int)DialogFlags.Pts, null, input); _draft = GetObject(Flags, (int)DialogFlags.Draft, null, input); var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); CustomFlags = GetNullableObject(input); _pinnedId = GetObject(CustomFlags, (int)DialogCustomFlags.PinnedId, null, input); _promoExpires = GetObject(CustomFlags, (int)DialogCustomFlags.PromoExpires, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); ReadInboxMaxId = ReadInboxMaxId ?? new TLInt(0); ReadInboxMaxId.ToStream(output); ReadOutboxMaxId = ReadOutboxMaxId ?? new TLInt(0); ReadOutboxMaxId.ToStream(output); UnreadCount.ToStream(output); UnreadMentionsCount.ToStream(output); NotifySettings.NullableToStream(output); ToStream(output, Pts, Flags, (int)DialogFlags.Pts); ToStream(output, Draft, Flags, (int)DialogFlags.Draft); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = CommitMessages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } CustomFlags.NullableToStream(output); ToStream(output, PinnedId, CustomFlags, (int)DialogCustomFlags.PinnedId); ToStream(output, PromoExpires, CustomFlags, (int)DialogCustomFlags.PromoExpires); } public override void Update(TLDialog dialog) { try { base.Update(dialog); } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } var dialog71 = dialog as TLDialog71; if (dialog71 != null) { UnreadMentionsCount = dialog71.UnreadMentionsCount; IsPromo = dialog71.IsPromo; PromoExpires = dialog71.PromoExpires; } } } public class TLDialogChannel : TLDialog24, IDialogPts { public new const uint Signature = TLConstructors.TLDialogChannel; public TLInt TopImportantMessageId { get; set; } public TLInt UnreadImportantCount { get; set; } public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); TopImportantMessageId = GetObject(bytes, ref position); ReadInboxMaxId = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadImportantCount = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { try { Peer = GetObject(input); var topMessageId = GetObject(input); if (topMessageId.Value != 0) { TopMessageId = topMessageId; } var topImportantMessageId = GetObject(input); if (topImportantMessageId.Value != 0) { TopImportantMessageId = topImportantMessageId; } ReadInboxMaxId = GetObject(input); UnreadCount = GetObject(input); UnreadImportantCount = GetObject(input); var notifySettingsObject = GetObject(input); NotifySettings = notifySettingsObject as TLPeerNotifySettingsBase; Pts = GetObject(input); var topMessageRandomId = GetObject(input); if (topMessageRandomId.Value != 0) { TopMessageRandomId = topMessageRandomId; } _with = GetObject(input); if (_with is TLNull) { _with = null; } var messages = GetObject>(input); Messages = messages != null ? new ObservableCollection(messages.Items) : new ObservableCollection(); var dialog71 = new TLDialog71(); dialog71.Flags = new TLInt(0); dialog71.Peer = Peer; dialog71.TopMessageId = TopMessageId; dialog71.ReadInboxMaxId = ReadInboxMaxId; dialog71.ReadOutboxMaxId = new TLInt(0); dialog71.UnreadCount = UnreadCount; dialog71.UnreadMentionsCount = new TLInt(0); dialog71.NotifySettings = NotifySettings; dialog71.Pts = Pts; dialog71.Draft = null; dialog71.TopMessageRandomId = topMessageRandomId; dialog71._with = _with; dialog71.Messages = Messages; return dialog71; } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); TopImportantMessageId = TopImportantMessageId ?? new TLInt(0); TopImportantMessageId.ToStream(output); ReadInboxMaxId = ReadInboxMaxId ?? new TLInt(0); ReadInboxMaxId.ToStream(output); output.Write(UnreadCount.ToBytes()); output.Write(UnreadImportantCount.ToBytes()); NotifySettings.NullableToStream(output); output.Write(Pts.ToBytes()); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = Messages.Where(x => x != null).ToList() }; #if DEBUG var indexes = new List(); for (var i = 0; i < Messages.Count; i++) { if (Messages[i] == null) { indexes.Add(i); } } if (indexes.Count > 0) { Execute.ShowDebugMessage("TLDialogChannel.ToStream Items has null values total=" + Messages.Count + " null indexes=" + string.Join(",", indexes)); } #endif messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } } public override void Update(TLDialog dialog) { try { base.Update(dialog); } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } var d = dialog as TLDialogChannel; if (d != null) { TopImportantMessageId = d.TopImportantMessageId; UnreadImportantCount = d.UnreadImportantCount; Pts = d.Pts; } } } public class TLDialogFeed : TLDialog { public new const uint Signature = TLConstructors.TLDialogFeed; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLLong CustomFlags { get; set; } public TLInt FeedId { get; set; } public TLVector FeedOtherChannels { get; set; } protected TLFeedPosition _readMaxPosition; public TLFeedPosition ReadMaxPosition { get { return _readMaxPosition; } set { SetField(out _readMaxPosition, value, ref _flags, (int)DialogFlags.ReadMaxPosition); } } public TLInt UnreadMutedCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); TopMessageId = GetObject(bytes, ref position); FeedId = GetObject(bytes, ref position); FeedOtherChannels = GetObject>(bytes, ref position); _readMaxPosition = GetObject(Flags, (int)DialogFlags.ReadMaxPosition, null, bytes, ref position); UnreadCount = GetObject(bytes, ref position); UnreadMutedCount = GetObject(bytes, ref position); NotifySettings = new TLPeerNotifySettingsEmpty(); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); TopMessageId = GetObject(input); FeedId = GetObject(input); FeedOtherChannels = GetObject>(input); _readMaxPosition = GetObject(Flags, (int)DialogFlags.ReadMaxPosition, null, input); UnreadCount = GetObject(input); UnreadMutedCount = GetObject(input); NotifySettings = GetNullableObject(input); TopMessageRandomId = GetObject(input); //_with = GetNullableObject(input); var messages = GetObject>(input) ?? new TLVector(); Messages = new ObservableCollection(messages.Items); CustomFlags = GetNullableObject(input); PinnedId = GetObject(CustomFlags, (int)DialogCustomFlags.PinnedId, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); TopMessageId = TopMessageId ?? new TLInt(0); TopMessageId.ToStream(output); FeedId.ToStream(output); FeedOtherChannels.ToStream(output); ToStream(output, ReadMaxPosition, Flags, (int)DialogFlags.ReadMaxPosition); UnreadCount.ToStream(output); UnreadMutedCount.ToStream(output); NotifySettings.NullableToStream(output); TopMessageRandomId = TopMessageRandomId ?? new TLLong(0); TopMessageRandomId.ToStream(output); //With.NullableToStream(output); if (Messages != null) { var messages = new TLVector { Items = CommitMessages }; messages.ToStream(output); } else { var messages = new TLVector(); messages.ToStream(output); } CustomFlags.NullableToStream(output); ToStream(output, PinnedId, CustomFlags, (int)DialogCustomFlags.PinnedId); } public override void Update(TLDialog dialog) { base.Update(dialog); var dialogFeed = dialog as TLDialogFeed; if (dialogFeed != null) { FeedId = dialogFeed.FeedId; FeedOtherChannels = dialogFeed.FeedOtherChannels; ReadMaxPosition = dialogFeed.ReadMaxPosition; UnreadMutedCount = dialogFeed.UnreadMutedCount; if (dialogFeed.IsPinned) { IsPinned = true; if (dialogFeed.PinnedId != null) PinnedId = dialogFeed.PinnedId; } else { IsPinned = false; dialogFeed.PinnedId = null; } } } } } ================================================ FILE: Telegram.Api/TL/TLDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLDialogsBase : TLObject { public TLVector Dialogs { get; set; } public TLVector Messages { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public abstract TLDialogsBase GetEmptyObject(); public TLPeerDialogs ToPeerDialogs(TLState state) { return new TLPeerDialogs { Dialogs = Dialogs, Messages = Messages, Chats = Chats, Users = Users, State = state }; } } public class TLDialogsNotModified : TLDialogsBase { public const uint Signature = TLConstructors.TLDialogsNotModified; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Dialogs = new TLVector(); Messages = new TLVector(); Chats = new TLVector(); Users = new TLVector(); return this; } public override TLDialogsBase GetEmptyObject() { return new TLDialogs { Dialogs = new TLVector(Dialogs.Count), Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLDialogs : TLDialogsBase { public const uint Signature = TLConstructors.TLDialogs; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Dialogs = GetObject>(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLDialogsBase GetEmptyObject() { return new TLDialogs { Dialogs = new TLVector(Dialogs.Count), Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLDialogsSlice : TLDialogsBase { public const uint Signature = TLConstructors.TLDialogsSlice; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Dialogs = GetObject>(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLDialogsBase GetEmptyObject() { return new TLDialogsSlice { Count = Count, Dialogs = new TLVector(Dialogs.Count), Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } } ================================================ FILE: Telegram.Api/TL/TLDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLDifferenceBase : TLObject { public abstract TLDifferenceBase GetEmptyObject(); } public class TLDifferenceEmpty : TLDifferenceBase { public const uint Signature = TLConstructors.TLDifferenceEmpty; public TLInt Date { get; set; } public TLInt Seq { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Date.ToStream(output); Seq.ToStream(output); } public override TLObject FromStream(Stream input) { Date = GetObject(input); Seq = GetObject(input); return this; } public override TLDifferenceBase GetEmptyObject() { return new TLDifferenceEmpty { Date = Date, Seq = Seq }; } public override string ToString() { return string.Format("TLDifferenceEmpty date={0} seq={1}", Date, Seq); } } public class TLDifference : TLDifferenceBase { public const uint Signature = TLConstructors.TLDifference; public TLVector NewMessages { get; set; } public TLVector NewEncryptedMessages { get; set; } public TLVector OtherUpdates { get; set; } public TLVector Users { get; set; } public TLVector Chats { get; set; } public TLState State { get; set; } public override TLDifferenceBase GetEmptyObject() { return new TLDifference { NewMessages = new TLVector(NewMessages.Count), NewEncryptedMessages = new TLVector(NewEncryptedMessages.Count), OtherUpdates = new TLVector(OtherUpdates.Count), Users = new TLVector(Users.Count), Chats = new TLVector(Chats.Count), State = State }; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewMessages = GetObject>(bytes, ref position); NewEncryptedMessages = GetObject>(bytes, ref position); OtherUpdates = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); State = GetObject(bytes, ref position); ProcessReading(); return this; } protected void ProcessReading() { var readUserInbox = new Dictionary(); var readUserOutbox = new Dictionary(); var readChatInbox = new Dictionary(); var readChatOutbox = new Dictionary(); var readChannelInbox = new Dictionary(); var readChannelOutbox = new Dictionary(); var newMessages = new List(); var newChannelMessages = new List(); foreach (var otherUpdate in OtherUpdates) { var updateNewChannelMessage = otherUpdate as TLUpdateNewChannelMessage; if (updateNewChannelMessage != null) { newChannelMessages.Add(updateNewChannelMessage); continue; } var updateNewMessage = otherUpdate as TLUpdateNewMessage; if (updateNewMessage != null) { newMessages.Add(updateNewMessage); continue; } var updateReadChannelInbox = otherUpdate as TLUpdateReadChannelInbox; if (updateReadChannelInbox != null) { readChannelInbox[updateReadChannelInbox.ChannelId.Value] = updateReadChannelInbox; continue; } var updateReadChannelOutbox = otherUpdate as TLUpdateReadChannelOutbox; if (updateReadChannelOutbox != null) { readChannelOutbox[updateReadChannelOutbox.ChannelId.Value] = updateReadChannelOutbox; continue; } var updateReadHistoryInbox = otherUpdate as TLUpdateReadHistoryInbox; if (updateReadHistoryInbox != null) { if (updateReadHistoryInbox.Peer is TLPeerChat) { readChatInbox[updateReadHistoryInbox.Peer.Id.Value] = updateReadHistoryInbox; } else if (updateReadHistoryInbox.Peer is TLPeerUser) { readUserInbox[updateReadHistoryInbox.Peer.Id.Value] = updateReadHistoryInbox; } continue; } var updateReadHistoryOutbox = otherUpdate as TLUpdateReadHistoryOutbox; if (updateReadHistoryOutbox != null) { if (updateReadHistoryOutbox.Peer is TLPeerChat) { readChatOutbox[updateReadHistoryOutbox.Peer.Id.Value] = updateReadHistoryOutbox; } else if (updateReadHistoryOutbox.Peer is TLPeerUser) { readUserOutbox[updateReadHistoryOutbox.Peer.Id.Value] = updateReadHistoryOutbox; } continue; } } for (var i = 0; i < newChannelMessages.Count; i++) { var messageCommon = newChannelMessages[i].Message as TLMessageCommon; if (messageCommon != null) { if (IsReadMessage(messageCommon, readChatOutbox, readChatInbox, readUserOutbox, readUserInbox, readChannelOutbox, readChannelInbox)) { continue; } messageCommon.SetUnreadSilent(TLBool.True); } } for (var i = 0; i < newMessages.Count; i++) { var messageCommon = newMessages[i].Message as TLMessageCommon; if (messageCommon != null) { if (IsReadMessage(messageCommon, readChatOutbox, readChatInbox, readUserOutbox, readUserInbox, readChannelOutbox, readChannelInbox)) { continue; } messageCommon.SetUnreadSilent(TLBool.True); } } for (var i = 0; i < NewMessages.Count; i++) { var messageCommon = NewMessages[i] as TLMessageCommon; if (messageCommon != null) { if (IsReadMessage(messageCommon, readChatOutbox, readChatInbox, readUserOutbox, readUserInbox, readChannelOutbox, readChannelInbox)) { continue; } messageCommon.SetUnreadSilent(TLBool.True); } } } private static bool IsReadMessage(TLMessageCommon messageCommon, Dictionary readChatOutbox, Dictionary readChatInbox, Dictionary readUserOutbox, Dictionary readUserInbox, Dictionary readChannelOutbox, Dictionary readChannelInbox) { if (messageCommon.ToId is TLPeerChat) { if (messageCommon.Out.Value) { TLUpdateReadHistory updateReadHistory; if (readChatOutbox.TryGetValue(messageCommon.ToId.Id.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } else { TLUpdateReadHistory updateReadHistory; if (readChatInbox.TryGetValue(messageCommon.ToId.Id.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } } else if (messageCommon.ToId is TLPeerUser) { if (messageCommon.Out.Value) { TLUpdateReadHistory updateReadHistory; if (readUserOutbox.TryGetValue(messageCommon.ToId.Id.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } else { TLUpdateReadHistory updateReadHistory; if (readUserInbox.TryGetValue(messageCommon.FromId.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } } else if (messageCommon.ToId is TLPeerChannel) { if (messageCommon.Out.Value) { TLUpdateReadChannelOutbox updateReadHistory; if (readChannelOutbox.TryGetValue(messageCommon.ToId.Id.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } else { TLUpdateReadChannelInbox updateReadHistory; if (readChannelInbox.TryGetValue(messageCommon.ToId.Id.Value, out updateReadHistory) && updateReadHistory.MaxId.Value >= messageCommon.Index) { return true; } } } return false; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NewMessages.ToStream(output); NewEncryptedMessages.ToStream(output); OtherUpdates.ToStream(output); Chats.ToStream(output); Users.ToStream(output); State.ToStream(output); } public override TLObject FromStream(Stream input) { NewMessages = GetObject>(input); NewEncryptedMessages = GetObject>(input); OtherUpdates = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); State = GetObject(input); return this; } public override string ToString() { return string.Format("TLDifference state=[{0}] messages={1} other={2} users={3} chats={4} encrypted={5}", State, NewMessages.Count, OtherUpdates.Count, Users.Count, Chats.Count, NewEncryptedMessages.Count); } } public class TLDifferenceSlice : TLDifference { public new const uint Signature = TLConstructors.TLDifferenceSlice; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewMessages = GetObject>(bytes, ref position); NewEncryptedMessages = GetObject>(bytes, ref position); OtherUpdates = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); State = GetObject(bytes, ref position); ProcessReading(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NewMessages.ToStream(output); NewEncryptedMessages.ToStream(output); OtherUpdates.ToStream(output); Chats.ToStream(output); Users.ToStream(output); State.ToStream(output); } public override TLObject FromStream(Stream input) { NewMessages = GetObject>(input); NewEncryptedMessages = GetObject>(input); OtherUpdates = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); State = GetObject(input); return this; } public override string ToString() { return string.Format("TLDifferenceSlice state=[{0}] messages={1} other={2} users={3} chats={4} encrypted={5}", State, NewMessages.Count, OtherUpdates.Count, Users.Count, Chats.Count, NewEncryptedMessages.Count); } } public class TLDifferenceTooLong : TLDifferenceBase { public const uint Signature = TLConstructors.TLDifferenceTooLong; public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Pts.ToStream(output); } public override TLObject FromStream(Stream input) { Pts = GetObject(input); return this; } public override TLDifferenceBase GetEmptyObject() { return new TLDifferenceTooLong { Pts = Pts }; } public override string ToString() { return string.Format("TLDifferenceTooLong pts={0}", Pts); } } } ================================================ FILE: Telegram.Api/TL/TLDisabledFeature.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Runtime.Serialization; namespace Telegram.Api.TL { [DataContract] public class TLDisabledFeature : TLObject { public const uint Signature = TLConstructors.TLDisabledFeature; [DataMember] public TLString Feature { get; set; } [DataMember] public TLString Description { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Feature = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("{0} {1}", Feature, Description); } } } ================================================ FILE: Telegram.Api/TL/TLDocument.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public interface IAttributes { TLVector Attributes { get; set; } } public abstract class TLDocumentBase : TLObject { public long Index { get { return Id != null ? Id.Value : 0; } } public TLLong Id { get; set; } public string ShortId { get { return Id != null ? (Id.Value % 1000).ToString() : "unknown"; } } public virtual int DocumentSize { get { return 0; } } public static bool DocumentEquals(TLDocumentBase document1, TLDocumentBase document2) { var doc1 = document1 as TLDocument; var doc2 = document2 as TLDocument; if (doc1 == null || doc2 == null) return false; return doc1.Id.Value == doc2.Id.Value && doc1.DCId.Value == doc2.DCId.Value && doc1.AccessHash.Value == doc2.AccessHash.Value; } } public class TLDocumentExternal : TLDocumentBase, IAttributes { public const uint Signature = TLConstructors.TLDocumentExternal; public TLString ResultId { get; set; } public TLString Type { get; set; } public TLString Url { get; set; } public TLString ThumbUrl { get; set; } public TLString ContentUrl { get; set; } public TLString ContentType { get; set; } public TLVector Attributes { get; set; } public override TLObject FromStream(Stream input) { Id = GetObject(input); ResultId = GetObject(input); Type = GetObject(input); ThumbUrl = GetObject(input); ContentType = GetObject(input); ContentUrl = GetObject(input); Url = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); ResultId.ToStream(output); Type.ToStream(output); ThumbUrl.ToStream(output); ContentType.ToStream(output); ContentUrl.ToStream(output); Url.ToStream(output); Attributes.ToStream(output); } public string GetFileName() { string extension; if (!TLString.IsNullOrEmpty(Url)) { extension = Path.GetExtension(Url.ToString()); if (!string.IsNullOrEmpty(extension)) { return ResultId + extension; } } if (!TLString.IsNullOrEmpty(ContentUrl)) { extension = Path.GetExtension(ContentUrl.ToString()); if (!string.IsNullOrEmpty(extension)) { return ResultId + extension; } } return ResultId + TLUtils.ContentTypeToFileExt(ContentType); } } public class TLDocumentEmpty : TLDocumentBase { public const uint Signature = TLConstructors.TLDocumentEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public abstract class TLDocument : TLDocumentBase { public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLString MimeType { get; set; } public TLInt Size { get; set; } public override int DocumentSize { get { return Size != null ? Size.Value : 0; } } public TLPhotoSizeBase Thumb { get; set; } public TLInt DCId { get; set; } public byte[] Buffer { get; set; } public TLInputFileBase ThumbInputFile { get; set; } public virtual TLInputDocumentFileLocation ToInputFileLocation() { return new TLInputDocumentFileLocation { AccessHash = AccessHash, Id = Id }; } public abstract TLString FileName { get; set; } public abstract string DocumentName { get; } public string FileExt { get { return Path.GetExtension(FileName.ToString()).Replace(".", string.Empty); } } public virtual string GetFileName() { return string.Format("document{0}_{1}.{2}", Id, AccessHash, FileExt); } } public class TLDocument10 : TLDocument { public const uint Signature = TLConstructors.TLDocument; public TLInt UserId { get; set; } public override TLString FileName { get; set; } public override string DocumentName { get { return FileName != null ? FileName.ToString() : string.Empty; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); FileName = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), UserId.ToBytes(), Date.ToBytes(), FileName.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); FileName = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); UserId.ToStream(output); Date.ToStream(output); FileName.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); } } public class TLDocument22 : TLDocument, IAttributes { public const uint Signature = TLConstructors.TLDocument22; public TLVector Attributes { get; set; } public bool Music { get { var documentAttributeAudio = Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (documentAttributeAudio != null) { return !documentAttributeAudio.Voice; } return false; } } public override string DocumentName { get { var documentAttributeAudio = Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (documentAttributeAudio != null) { if (documentAttributeAudio.Title != null && documentAttributeAudio.Performer != null) { return string.Format("{0} — {1}", documentAttributeAudio.Title, documentAttributeAudio.Performer); } if (documentAttributeAudio.Title != null) { return string.Format("{0}", documentAttributeAudio.Title); } if (documentAttributeAudio.Performer != null) { return string.Format("{0}", documentAttributeAudio.Performer); } } return FileName.ToString(); } } public override string GetFileName() { if (TLMessageBase.IsVideo(this)) { return string.Format("video{0}_{1}.{2}", Id, AccessHash, "mp4"); } if (TLMessageBase.IsVoice(this)) { return string.Format("audio{0}_{1}.{2}", Id, AccessHash, "mp3"); } return string.Format("document{0}_{1}.{2}", Id, AccessHash, FileExt); } public override TLInputDocumentFileLocation ToInputFileLocation() { return new TLInputDocumentFileLocation { Id = Id, AccessHash = AccessHash }; } public TLInt Duration { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var durationAttribute = Attributes[i] as IAttributeDuration; if (durationAttribute != null) { return durationAttribute.Duration; } } } return new TLInt(0); } } public string DurationString { get { var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public TLInt ImageSizeH { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var imageSizeAttribute = Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { return imageSizeAttribute.H; } } } return new TLInt(0); } } public TLInt ImageSizeW { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var imageSizeAttribute = Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { return imageSizeAttribute.W; } } } return new TLInt(0); } } public override TLString FileName { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var fileNameAttribute = Attributes[i] as TLDocumentAttributeFileName; if (fileNameAttribute != null) { return fileNameAttribute.FileName; } } } return TLString.Empty; } set { Attributes = Attributes ?? new TLVector(); for (var i = 0; i < Attributes.Count; i++) { if (Attributes[i] is TLDocumentAttributeFileName) { Attributes.RemoveAt(i--); } } Attributes.Add(new TLDocumentAttributeFileName{FileName = value}); } } public TLInputStickerSetBase StickerSet { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var stickerAttribute = Attributes[i] as TLDocumentAttributeSticker29; if (stickerAttribute != null) { return stickerAttribute.Stickerset; } } } return null; } } #region Additional private string _emoticon; public string Emoticon { get { if (_emoticon != null) return _emoticon; if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var stickerAttribute = Attributes[i] as TLDocumentAttributeSticker29; if (stickerAttribute != null) { _emoticon = stickerAttribute.Alt.ToString(); } } } _emoticon = _emoticon ?? string.Empty; return _emoticon; } } #endregion public override string ToString() { return string.Format("{0} Id={1}", GetType().Name, Id) + (StickerSet != null ? StickerSet.ToString() : string.Empty); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); Attributes.ToStream(output); } } public class TLDocument54 : TLDocument22 { public new const uint Signature = TLConstructors.TLDocument54; public bool Mask { get { if (Attributes != null) { for (var i = 0; i < Attributes.Count; i++) { var stickerAttribute = Attributes[i] as TLDocumentAttributeSticker56; if (stickerAttribute != null) { return stickerAttribute.Mask; } } } return false; } } public TLInt Version { get; set; } public override string ToString() { return string.Format("{0} id={1} version={2}", GetType().Name, Id, Version) + (StickerSet != null ? " stickerset=[" + StickerSet + "]" : string.Empty); } public override string GetFileName() { if (TLMessageBase.IsVideo(this)) { return string.Format("video{0}_{1}.{2}", Id, AccessHash, "mp4"); } if (TLMessageBase.IsVoice(this)) { return string.Format("audio{0}_{1}.{2}", Id, AccessHash, "mp3"); } var documentVersion = Version; if (documentVersion != null && documentVersion.Value > 0) { return string.Format("document{0}_{1}.{2}", Id, documentVersion, FileExt); } return string.Format("document{0}_{1}.{2}", Id, AccessHash, FileExt); } public override TLInputDocumentFileLocation ToInputFileLocation() { return new TLInputDocumentFileLocation54 { Id = Id, AccessHash = AccessHash, Version = Version }; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), Version.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); Version = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); Version.ToStream(output); Attributes.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLDocumentAttribute.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum DocumentAttributeVideoFlags { RoundMessage = 0x1, // 0 } [Flags] public enum DocumentAttributeStickerFlags { MaskCoords = 0x1, // 0 Mask = 0x2, // 1 } [Flags] public enum DocumentAttributeAudioFlags { Title = 0x1, // 0 Performer = 0x2, // 1 Waveform = 0x4, // 2 Voice = 0x400, // 10 } public interface IAttributeDuration { TLInt Duration { get; set; } } public interface IAttributeSize { TLInt W { get; set; } TLInt H { get; set; } } public abstract class TLDocumentAttributeBase : TLObject { } public class TLDocumentAttributeImageSize : TLDocumentAttributeBase, IAttributeSize { public const uint Signature = TLConstructors.TLDocumentAttributeImageSize; public TLInt W { get; set; } public TLInt H { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); W.ToStream(output); H.ToStream(output); } } public class TLDocumentAttributeAnimated : TLDocumentAttributeBase { public const uint Signature = TLConstructors.TLDocumentAttributeAnimated; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLDocumentAttributeSticker : TLDocumentAttributeBase { public const uint Signature = TLConstructors.TLDocumentAttributeSticker; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLDocumentAttributeSticker25 : TLDocumentAttributeSticker { public new const uint Signature = TLConstructors.TLDocumentAttributeSticker25; public TLString Alt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Alt = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Alt.ToBytes()); } public override TLObject FromStream(Stream input) { Alt = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Alt.ToStream(output); } } public class TLDocumentAttributeSticker29 : TLDocumentAttributeSticker25 { public new const uint Signature = TLConstructors.TLDocumentAttributeSticker29; public TLInputStickerSetBase Stickerset { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Alt = GetObject(bytes, ref position); Stickerset = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Alt.ToBytes(), Stickerset.ToBytes()); } public override TLObject FromStream(Stream input) { Alt = GetObject(input); Stickerset = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Alt.ToStream(output); Stickerset.ToStream(output); } } public class TLDocumentAttributeSticker56 : TLDocumentAttributeSticker29 { public new const uint Signature = TLConstructors.TLDocumentAttributeSticker56; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLMaskCoords _maskCoords; public TLMaskCoords MaskCoords { get { return _maskCoords; } set { SetField(out _maskCoords, value, ref _flags, (int) DocumentAttributeStickerFlags.MaskCoords); } } public bool Mask { get { return IsSet(Flags, (int) DocumentAttributeStickerFlags.Mask); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Alt = GetObject(bytes, ref position); Stickerset = GetObject(bytes, ref position); MaskCoords = GetObject(Flags, (int) DocumentAttributeStickerFlags.MaskCoords, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Alt.ToBytes(), Stickerset.ToBytes(), ToBytes(MaskCoords, Flags, (int) DocumentAttributeStickerFlags.MaskCoords)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Alt = GetObject(input); Stickerset = GetObject(input); MaskCoords = GetObject(Flags, (int) DocumentAttributeStickerFlags.MaskCoords, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Alt.ToStream(output); Stickerset.ToStream(output); ToStream(output, MaskCoords, Flags, (int) DocumentAttributeStickerFlags.MaskCoords); } } public class TLDocumentAttributeVideo66 : TLDocumentAttributeVideo { public new const uint Signature = TLConstructors.TLDocumentAttributeVideo66; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool RoundMessage { get { return IsSet(Flags, (int) DocumentAttributeVideoFlags.RoundMessage); } set { SetUnset(ref _flags, value, (int) DocumentAttributeVideoFlags.RoundMessage); } } public bool Mask { get { return IsSet(Flags, (int)DocumentAttributeStickerFlags.Mask); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); } } public class TLDocumentAttributeVideo : TLDocumentAttributeBase, IAttributeDuration, IAttributeSize { public const uint Signature = TLConstructors.TLDocumentAttributeVideo; public TLInt Duration { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Duration = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Duration.ToBytes(), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { Duration = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); } } public class TLDocumentAttributeAudio : TLDocumentAttributeBase, IAttributeDuration { public const uint Signature = TLConstructors.TLDocumentAttributeAudio; public TLInt Duration { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Duration = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Duration.ToBytes()); } public override TLObject FromStream(Stream input) { Duration = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Duration.ToStream(output); } } public class TLDocumentAttributeAudio32 : TLDocumentAttributeAudio { public new const uint Signature = TLConstructors.TLDocumentAttributeAudio32; public virtual TLString Title { get; set; } public virtual TLString Performer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Duration = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Performer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Duration.ToBytes(), Title.ToBytes(), Performer.ToBytes()); } public override TLObject FromStream(Stream input) { Duration = GetObject(input); Title = GetObject(input); Performer = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Duration.ToStream(output); Title.ToStream(output); Performer.ToStream(output); } } public class TLDocumentAttributeAudio46 : TLDocumentAttributeAudio32 { public new const uint Signature = TLConstructors.TLDocumentAttributeAudio46; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Voice { get { return IsSet(Flags, (int) DocumentAttributeAudioFlags.Voice); } set { SetUnset(ref _flags, value, (int) DocumentAttributeAudioFlags.Voice); } } protected TLString _title; public override TLString Title { get { return _title; } set { SetFlagValue(value, out _title, ref _flags, (int)DocumentAttributeAudioFlags.Title); } } protected TLString _performer; public override TLString Performer { get { return _performer; } set { SetFlagValue(value, out _performer, ref _flags, (int)DocumentAttributeAudioFlags.Performer); } } protected TLString _waveform; public TLString Waveform { get { return _waveform; } set { SetFlagValue(value, out _waveform, ref _flags, (int)DocumentAttributeAudioFlags.Waveform); } } private static void SetFlagValue(T value, out T field, ref TLInt flags, int flag) where T : TLObject { if (value != null) { Set(ref flags, flag); field = value; } else { Unset(ref flags, flag); field = default(T); } } private static void GetObject(byte[] bytes, ref int position, ref T field, TLInt flags, int flag) where T : TLObject { if (IsSet(flags, flag)) { field = GetObject(bytes, ref position); } } private static void GetObject(Stream input, ref T field, TLInt flags, int flag) where T : TLObject { if (IsSet(flags, flag)) { field = GetObject(input); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); GetObject(bytes, ref position, ref _title, _flags, (int) DocumentAttributeAudioFlags.Title); GetObject(bytes, ref position, ref _performer, _flags, (int) DocumentAttributeAudioFlags.Performer); GetObject(bytes, ref position, ref _waveform, _flags, (int) DocumentAttributeAudioFlags.Waveform); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Duration.ToBytes(), ToBytes(Title, Flags, (int) DocumentAttributeAudioFlags.Title), ToBytes(Performer, Flags, (int) DocumentAttributeAudioFlags.Performer), ToBytes(Waveform, Flags, (int) DocumentAttributeAudioFlags.Waveform)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Duration = GetObject(input); GetObject(input, ref _title, _flags, (int) DocumentAttributeAudioFlags.Title); GetObject(input, ref _performer, _flags, (int) DocumentAttributeAudioFlags.Performer); GetObject(input, ref _waveform, _flags, (int) DocumentAttributeAudioFlags.Waveform); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Duration.ToStream(output); ToStream(output, Title, Flags, (int) DocumentAttributeAudioFlags.Title); ToStream(output, Performer, Flags, (int) DocumentAttributeAudioFlags.Performer); ToStream(output, Waveform, Flags, (int) DocumentAttributeAudioFlags.Waveform); } } public class TLDocumentAttributeFileName : TLDocumentAttributeBase { public const uint Signature = TLConstructors.TLDocumentAttributeFileName; public TLString FileName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FileName = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FileName.ToBytes()); } public override TLObject FromStream(Stream input) { FileName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); FileName.ToStream(output); } } public class TLDocumentAttributeHasStickers : TLDocumentAttributeBase { public const uint Signature = TLConstructors.TLDocumentAttributeHasStickers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLDouble.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Runtime.Serialization; namespace Telegram.Api.TL { [DataContract] public class TLDouble : TLObject { public TLDouble() { } public TLDouble(double value) { Value = value; } [DataMember] public Double Value { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { Value = BitConverter.ToDouble(bytes, position); position += 8; return this; } public override byte[] ToBytes() { return BitConverter.GetBytes(Value); } public override TLObject FromStream(Stream input) { var buffer = new byte[8]; input.Read(buffer, 0, 8); Value = BitConverter.ToDouble(buffer, 0); return this; } public override void ToStream(Stream output) { output.Write(BitConverter.GetBytes(Value), 0, 8); } public override string ToString() { return Value.ToString(CultureInfo.InvariantCulture); } } } ================================================ FILE: Telegram.Api/TL/TLDraftMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.TL { [Flags] public enum DraftMessageEmptyFlags { Date = 0x1 // 0 } public abstract class TLDraftMessageBase : TLObject { public abstract bool DraftEquals(TLDraftMessageBase draft); public abstract bool IsEmpty(); public abstract TLSaveDraft ToSaveDraftObject(TLInputPeerBase peer); } public class TLDraftMessageEmpty82 : TLDraftMessageEmpty { public new const uint Signature = TLConstructors.TLDraftMessageEmpty82; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLInt _date; public TLInt Date { get { return _date; } set { SetField(out _date, value, ref _flags, (int) DraftMessageEmptyFlags.Date); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(_flags, (int) DraftMessageEmptyFlags.Date, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Date = GetObject(_flags, (int)DraftMessageEmptyFlags.Date, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Date, _flags, (int)DraftMessageEmptyFlags.Date); } public override bool DraftEquals(TLDraftMessageBase draft) { var emptyDraft = draft as TLDraftMessageEmpty; return draft == null || emptyDraft != null; } public override TLSaveDraft ToSaveDraftObject(TLInputPeerBase peer) { return new TLSaveDraft { Flags = new TLInt(0), Peer = peer, Message = TLString.Empty }; } public override string ToString() { return "TLDraftMessageEmpty82"; } } public class TLDraftMessageEmpty : TLDraftMessageBase { public const uint Signature = TLConstructors.TLDraftMessageEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override bool DraftEquals(TLDraftMessageBase draft) { return draft == null || draft is TLDraftMessageEmpty; } public override bool IsEmpty() { return true; } public override TLSaveDraft ToSaveDraftObject(TLInputPeerBase peer) { return new TLSaveDraft { Flags = new TLInt(0), Peer = peer, Message = TLString.Empty }; } public override string ToString() { return "TLDraftMessageEmpty"; } } public class TLDraftMessage : TLDraftMessageBase { public const uint Signature = TLConstructors.TLDraftMessage; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool NoWebpage { get { return IsSet(Flags, (int) SendFlags.NoWebpage); } set { SetUnset(ref _flags, value, (int) SendFlags.NoWebpage); } } private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { SetField(out _replyToMsgId, value, ref _flags, (int) SendFlags.ReplyToMsgId); } } public TLString Message { get; set; } private TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int) SendFlags.Entities); } } public TLInt Date { get; set; } public override TLSaveDraft ToSaveDraftObject(TLInputPeerBase peer) { var obj = new TLSaveDraft { Flags = new TLInt(0), ReplyToMsgId = ReplyToMsgId, Peer = peer, Message = Message, Entities = Entities, }; if (NoWebpage) { obj.DisableWebPagePreview(); } return obj; } public override bool DraftEquals(TLDraftMessageBase draftBase) { var draftEmpty = draftBase as TLDraftMessageEmpty; if (draftEmpty != null) { return IsEmpty(); } var draft = draftBase as TLDraftMessage; if (draft != null) { if (Flags.Value != draft.Flags.Value) return false; if (!TLString.Equals(Message, draft.Message, StringComparison.Ordinal)) return false; if (ReplyToMsgId != null && draft.ReplyToMsgId != null && ReplyToMsgId.Value != draft.ReplyToMsgId.Value) return false; if (Entities != null && draft.Entities != null && Entities.Count != draft.Entities.Count) return false; } else { return false; } return true; } public override bool IsEmpty() { return TLString.IsNullOrEmpty(Message) && ReplyToMsgId == null; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _replyToMsgId = GetObject(Flags, (int)SendFlags.ReplyToMsgId, null, bytes, ref position); Message = GetObject(bytes, ref position); _entities = GetObject>(Flags, (int)SendFlags.Entities, null, bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _replyToMsgId = GetObject(Flags, (int)SendFlags.ReplyToMsgId, null, input); Message = GetObject(input); _entities = GetObject>(Flags, (int)SendFlags.Entities, null, input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, _replyToMsgId, Flags, (int)SendFlags.ReplyToMsgId); Message.ToStream(output); ToStream(output, _entities, Flags, (int)SendFlags.Entities); Date.ToStream(output); } public override string ToString() { return string.Format("TLDraftMessage reply_to_msg_id={0} message={1} no_webpage={2} entities={3}", ReplyToMsgId, Message, NoWebpage, Entities != null? Entities.Count : 0); } } } ================================================ FILE: Telegram.Api/TL/TLEncryptedChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum EncryptedChatCustomFlags { OriginalKey = 0x1, ExtendedKey = 0x2, LinkPreview = 0x4 } public abstract class TLEncryptedChatBase : TLObject { public int Index { get { return Id.Value; } } public TLInt Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { Id = GetObject(bytes, ref position); return this; } #region Additional protected TLString _key; public TLString Key { get { return _key; } set { if (_key == null && value != null) { if (OriginalKey == null) { OriginalKey = value; } if (ExtendedKey == null) { var chat17 = this as TLEncryptedChat17; if (chat17 != null && chat17.Layer != null && chat17.Layer.Value >= Constants.MinSecretChatWithExtendedKeyVisualizationLayer) { ExtendedKey = value; } } } _key = value; } } public TLLong KeyFingerprint { get; set; } public TLString P { get; set; } public TLInt G { get; set; } public TLString A { get; set; } public TLInt MessageTTL { get; set; } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } protected TLString _originalKey; public TLString OriginalKey { get { return _originalKey; } set { if (value != null) { Set(ref _customFlags, (int)EncryptedChatCustomFlags.OriginalKey); _originalKey = value; } else { Unset(ref _customFlags, (int)EncryptedChatCustomFlags.OriginalKey); _originalKey = null; } } } protected TLString _extendedKey; public TLString ExtendedKey { get { return _extendedKey; } set { if (value != null) { Set(ref _customFlags, (int)EncryptedChatCustomFlags.ExtendedKey); _extendedKey = value; } else { Unset(ref _customFlags, (int)EncryptedChatCustomFlags.ExtendedKey); _extendedKey = null; } } } #endregion public virtual void Update(TLEncryptedChatBase chat) { Id = chat.Id; if (chat.Key != null) _key = chat._key; if (chat.KeyFingerprint != null) KeyFingerprint = chat.KeyFingerprint; if (chat.P != null) P = chat.P; if (chat.G != null) G = chat.G; if (chat.A != null) A = chat.A; if (chat.CustomFlags != null) CustomFlags = chat.CustomFlags; if (chat.OriginalKey != null) OriginalKey = chat.OriginalKey; if (chat.ExtendedKey != null) ExtendedKey = chat.ExtendedKey; } } public class TLEncryptedChatEmpty : TLEncryptedChatBase { public const uint Signature = TLConstructors.TLEncryptedChatEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); return this; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); } } public abstract class TLEncryptedChatCommon : TLEncryptedChatBase { public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLInt AdminId { get; set; } public TLInt ParticipantId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { base.FromBytes(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); return this; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); var chatCommon = chat as TLEncryptedChatCommon; if (chatCommon != null) { AccessHash = chatCommon.AccessHash; Date = chatCommon.Date; AdminId = chatCommon.AdminId; ParticipantId = chatCommon.ParticipantId; } } } public class TLEncryptedChatWaiting : TLEncryptedChatCommon { public const uint Signature = TLConstructors.TLEncryptedChatWaiting; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); output.Write(AdminId.ToBytes()); output.Write(ParticipantId.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); } } public class TLEncryptedChatRequested : TLEncryptedChatCommon { public const uint Signature = TLConstructors.TLEncryptedChatRequested; public TLString GA { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); GA = GetObject(bytes, ref position); return this; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); var chatRequested = chat as TLEncryptedChatRequested; if (chatRequested != null) { GA = chatRequested.GA; } } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GA = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); output.Write(AdminId.ToBytes()); output.Write(ParticipantId.ToBytes()); output.Write(GA.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); } } public class TLEncryptedChat20 : TLEncryptedChat17 { public new const uint Signature = TLConstructors.TLEncryptedChat20; public TLLong PFS_ExchangeId { get; set; } public TLString PFS_A { get; set; } public TLString PFS_Key { get; set; } public TLLong PFS_KeyFingerprint { get; set; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); var encryptedChat = chat as TLEncryptedChat20; if (encryptedChat != null) { PFS_ExchangeId = encryptedChat.PFS_ExchangeId; PFS_A = encryptedChat.PFS_A; PFS_Key = encryptedChat.PFS_Key; PFS_KeyFingerprint = encryptedChat.PFS_KeyFingerprint; } } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GAorB = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } RawInSeqNo = GetNullableObject(input); RawOutSeqNo = GetNullableObject(input); Layer = GetNullableObject(input); PFS_ExchangeId = GetNullableObject(input); PFS_A = GetNullableObject(input); PFS_Key = GetNullableObject(input); PFS_KeyFingerprint = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); output.Write(AdminId.ToBytes()); output.Write(ParticipantId.ToBytes()); output.Write(GAorB.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); RawInSeqNo.NullableToStream(output); RawOutSeqNo.NullableToStream(output); Layer.NullableToStream(output); PFS_ExchangeId.NullableToStream(output); PFS_A.NullableToStream(output); PFS_Key.NullableToStream(output); PFS_KeyFingerprint.NullableToStream(output); } public override string ToString() { return string.Format("EncryptedChat20={0} Hash={1}", Index, GetHashCode()); } } public class TLEncryptedChat17 : TLEncryptedChat { public new const uint Signature = TLConstructors.TLEncryptedChat17; private TLInt _rawInSeqNo; // from 0, increment by 1 after each received decryptedMessage/decryptedMessageService public TLInt RawInSeqNo { get { return _rawInSeqNo; } set { System.Diagnostics.Debug.WriteLine(" raw_in_seq_no chat={0} old={1} new={2}", Id, _rawInSeqNo, value); _rawInSeqNo = value; } } private TLInt _rawOutSeqNo; // from 0, increment by 1 after each sent decryptedMessage/decryptedMessageService public TLInt RawOutSeqNo { get { return _rawOutSeqNo; } set { System.Diagnostics.Debug.WriteLine(" raw_out_seq_no chat={0} old={1} new={2}", Id, _rawOutSeqNo, value); _rawOutSeqNo = value; } } private TLInt _layer; public TLInt Layer { get { return _layer; } set { System.Diagnostics.Debug.WriteLine(" layer chat={0} old={1} new={2}", Id, _layer, value); _layer = value; } } public TLBool IsConfirmed { get; set; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); var encryptedChat = chat as TLEncryptedChat17; if (encryptedChat != null) { RawInSeqNo = encryptedChat.RawInSeqNo; RawOutSeqNo = encryptedChat.RawOutSeqNo; Layer = encryptedChat.Layer; } } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GAorB = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } RawInSeqNo = GetNullableObject(input); RawOutSeqNo = GetNullableObject(input); Layer = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); output.Write(AdminId.ToBytes()); output.Write(ParticipantId.ToBytes()); output.Write(GAorB.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); RawInSeqNo.NullableToStream(output); RawOutSeqNo.NullableToStream(output); Layer.NullableToStream(output); } public override string ToString() { return string.Format("EncryptedChat17={0} Hash={1}", Index, GetHashCode()); } } public class TLEncryptedChat : TLEncryptedChatCommon { public const uint Signature = TLConstructors.TLEncryptedChat; public TLString GAorB { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); GAorB = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override void Update(TLEncryptedChatBase chat) { base.Update(chat); var encryptedChat = chat as TLEncryptedChat; if (encryptedChat != null) { GAorB = encryptedChat.GAorB; KeyFingerprint = encryptedChat.KeyFingerprint; } } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GAorB = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); output.Write(AdminId.ToBytes()); output.Write(ParticipantId.ToBytes()); output.Write(GAorB.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); } public override string ToString() { return string.Format("EncryptedChat={0} Hash={1}", Index, GetHashCode()); } } public class TLEncryptedChatDiscarded : TLEncryptedChatBase { public const uint Signature = TLConstructors.TLEncryptedChatDiscarded; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); _key = GetNullableObject(input); KeyFingerprint = GetNullableObject(input); P = GetNullableObject(input); G = GetNullableObject(input); A = GetNullableObject(input); MessageTTL = GetNullableObject(input); CustomFlags = GetNullableObject(input); if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey)) { OriginalKey = GetObject(input); } if (IsSet(CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey)) { ExtendedKey = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); Key.NullableToStream(output); KeyFingerprint.NullableToStream(output); P.NullableToStream(output); G.NullableToStream(output); A.NullableToStream(output); MessageTTL.NullableToStream(output); CustomFlags.NullableToStream(output); ToStream(output, OriginalKey, CustomFlags, (int)EncryptedChatCustomFlags.OriginalKey); ToStream(output, ExtendedKey, CustomFlags, (int)EncryptedChatCustomFlags.ExtendedKey); } } } ================================================ FILE: Telegram.Api/TL/TLEncryptedFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLEncryptedFileBase : TLObject { } public class TLEncryptedFileEmpty : TLEncryptedFileBase { public const uint Signature = TLConstructors.TLEncryptedFileEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLEncryptedFile : TLEncryptedFileBase { public const uint Signature = TLConstructors.TLEncryptedFile; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public TLInt Size { get; set; } public TLInt DCId { get; set; } public TLInt KeyFingerprint { get; set; } #region Additional public TLString FileName { get; set; } public string FileExt { get { return FileName != null ? Path.GetExtension(FileName.ToString()).Replace(".", string.Empty) : null; } } public TLInt Duration { get; set; } public string DurationString { get { if (Duration == null) return string.Empty; var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Size = GetObject(input); DCId = GetObject(input); KeyFingerprint = GetObject(input); FileName = GetNullableObject(input); Duration = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Size.ToBytes()); output.Write(DCId.ToBytes()); output.Write(KeyFingerprint.ToBytes()); FileName.NullableToStream(output); Duration.NullableToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLEncryptedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define MTPROTO using System; using System.Linq; using Org.BouncyCastle.Security; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLEncryptedTransportMessage : TLObject { public TLLong AuthKeyId { get; set; } public byte[] MsgKey { get; set; } //128 bit public byte[] Data { get; set; } public TLEncryptedTransportMessage Decrypt(byte[] authKey) { return Decrypt(this, authKey); } public static TLEncryptedTransportMessage Decrypt(TLEncryptedTransportMessage transportMessage, byte[] authKey) { var keyIV = TLUtils.GetDecryptKeyIV(authKey, transportMessage.MsgKey); transportMessage.Data = Utils.AesIge(transportMessage.Data, keyIV.Item1, keyIV.Item2, false); //var msgKey = TLUtils.GetDecryptMsgKey(authKey, transportMessage.Data); //if (!TLUtils.ByteArraysEqual(msgKey, transportMessage.MsgKey)) //{ // transportMessage.Data = null; //} return transportMessage; } public TLEncryptedTransportMessage Encrypt(byte[] authKey) { return Encrypt(this, authKey); } public static TLEncryptedTransportMessage Encrypt(TLEncryptedTransportMessage transportMessage, byte[] authKey) { #if MTPROTO var random = new SecureRandom(); var data = transportMessage.Data; var length = data.Length; var padding = 16 - (length % 16); byte[] paddingBytes = null; if (padding < 12) { padding += 16; } if (padding >= 12 && padding <= 1024) { paddingBytes = new byte[padding]; random.NextBytes(paddingBytes); } var dataWithPadding = data; if (paddingBytes != null) { dataWithPadding = TLUtils.Combine(data, paddingBytes); } var msgKey = TLUtils.GetEncryptMsgKey(authKey, dataWithPadding); var keyIV = TLUtils.GetEncryptKeyIV(authKey, msgKey); var encryptedData = Utils.AesIge(dataWithPadding, keyIV.Item1, keyIV.Item2, true); var authKeyId = TLUtils.GenerateLongAuthKeyId(authKey); transportMessage.AuthKeyId = new TLLong(authKeyId); transportMessage.MsgKey = msgKey; transportMessage.Data = encryptedData; return transportMessage; #else var random = new SecureRandom(); var data = transportMessage.Data; var length = data.Length; var padding = 16 - (length % 16); byte[] paddingBytes = null; if (padding > 0 && padding < 16) { paddingBytes = new byte[padding]; random.NextBytes(paddingBytes); } byte[] dataWithPadding = data; if (paddingBytes != null) { dataWithPadding = TLUtils.Combine(data, paddingBytes); } var msgKey = TLUtils.GetMsgKey(data); var keyIV = TLUtils.GetEncryptKeyIV(authKey, msgKey); var encryptedData = Utils.AesIge(dataWithPadding, keyIV.Item1, keyIV.Item2, true); var authKeyId = TLUtils.GenerateLongAuthKeyId(authKey); transportMessage.AuthKeyId = new TLLong(authKeyId); transportMessage.MsgKey = msgKey; transportMessage.Data = encryptedData; return transportMessage; #endif } public override TLObject FromBytes(byte[] bytes, ref int position) { var response = new TLEncryptedTransportMessage(); response.AuthKeyId = GetObject(bytes, ref position); response.MsgKey = bytes.SubArray(position, 16); position += 16; response.Data = bytes.SubArray(position, bytes.Length - position); position = bytes.Length; return response; } public override byte[] ToBytes() { return TLUtils.Combine( AuthKeyId.ToBytes(), MsgKey, Data); } } } ================================================ FILE: Telegram.Api/TL/TLExportedAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLExportedAuthorization : TLObject { public const uint Signature = TLConstructors.TLExportedAuthorization; public TLInt Id { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLExportedMessageLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLExportedMessageLink : TLObject { public const uint Signature = TLConstructors.TLExportedMessageLink; public TLString Link { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Link = GetObject(bytes, ref position); return this; } } public class TLExportedMessageLink74 : TLExportedMessageLink { public new const uint Signature = TLConstructors.TLExportedMessageLink74; public TLString Html { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Link = GetObject(bytes, ref position); Html = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLFavedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLFavedStickersBase : TLObject { } public class TLFavedStickersNotModified : TLFavedStickersBase { public const uint Signature = TLConstructors.TLFavedStickersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLFavedStickers : TLFavedStickersBase { public const uint Signature = TLConstructors.TLFavedStickers; public virtual TLInt Hash { get; set; } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Packs = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Packs.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Packs = GetObject>(input); Documents = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); } public void AddSticker(TLDocumentBase document) { Documents.Insert(0, document); Hash = TLUtils.GetFavedStickersHash(Documents); var document54 = document as TLDocument54; if (document54 != null) { var emoticon = document54.Emoticon; if (!string.IsNullOrEmpty(emoticon)) { var added = false; for (var i = 0; i < Packs.Count; i++) { if (Packs[i].Emoticon.ToString() == emoticon) { var item = Packs[i].Documents.FirstOrDefault(x => x.Value == document54.Index); if (item == null) { Packs[i].Documents.Insert(0, document54.Id); added = true; break; } } } if (!added) { Packs.Insert(0, new TLStickerPack{ Emoticon = new TLString(emoticon), Documents = new TLVector{ document54.Id }}); } } } } public void RemoveSticker(TLDocumentBase document) { for (var i = 0; i < Documents.Count; i++) { if (Documents[i].Index == document.Index) { Documents.RemoveAt(i); break; } } Hash = TLUtils.GetFavedStickersHash(Documents); var document54 = document as TLDocument54; if (document54 != null) { var emoticon = document54.Emoticon; if (!string.IsNullOrEmpty(emoticon)) { for (var i = 0; i < Packs.Count; i++) { if (Packs[i].Emoticon.ToString() == emoticon) { for (int j = 0; j < Packs[i].Documents.Count; j++) { if (Packs[i].Documents[j].Value == document54.Index) { Packs[i].Documents.RemoveAt(j); break; } } if (Packs[i].Documents.Count == 0) { Packs.RemoveAt(i); break; } } } } } } } } ================================================ FILE: Telegram.Api/TL/TLFeaturedStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public abstract class TLFeaturedStickersBase : TLObject { } public class TLFeaturedStickersNotModified : TLFeaturedStickersBase { public const uint Signature = TLConstructors.TLFeaturedStickersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLFeaturedStickers : TLFeaturedStickersBase, IStickers { public const uint Signature = TLConstructors.TLFeaturedStickers; public TLInt HashValue { get; set; } public TLVector SetsCovered { get; set; } public TLVector Sets { get { var sets = new TLVector(); foreach (var setCovered in SetsCovered) { sets.Add(setCovered.StickerSet); } return sets; } set { Execute.ShowDebugMessage("TLFeaturedStickers.Sets set"); } } public TLVector Unread { get; set; } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public TLString Hash { get; set; } public TLVector MessagesStickerSets { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); HashValue = GetObject(bytes, ref position); SetsCovered = GetObject>(bytes, ref position); Unread = GetObject>(bytes, ref position); Packs = new TLVector(); Documents = new TLVector(); MessagesStickerSets = new TLVector(); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), HashValue.ToBytes(), SetsCovered.ToBytes(), Unread.ToBytes()); } public override TLObject FromStream(Stream input) { HashValue = GetObject(input); SetsCovered = GetObject>(input); Unread = GetObject>(input); Packs = GetObject>(input); Documents = GetObject>(input); MessagesStickerSets = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); HashValue.ToStream(output); SetsCovered.ToStream(output); Unread.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); MessagesStickerSets.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLFileBase : TLObject { } public class TLFile : TLFileBase { public const uint Signature = TLConstructors.TLFile; public TLFileTypeBase Type { get; set; } public TLInt MTime { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); MTime = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } public class TLFileCdnRedirect : TLFileBase { public const uint Signature = TLConstructors.TLFileCdnRedirect; public TLInt DCId { get; set; } public TLString FileToken { get; set; } public TLString EncryptionKey { get; set; } public TLString EncryptionIV { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); FileToken = GetObject(bytes, ref position); EncryptionKey = GetObject(bytes, ref position); EncryptionIV = GetObject(bytes, ref position); return this; } } public class TLFileCdnRedirect76 : TLFileCdnRedirect { public new const uint Signature = TLConstructors.TLFileCdnRedirect76; public TLVector FileHashes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); FileToken = GetObject(bytes, ref position); EncryptionKey = GetObject(bytes, ref position); EncryptionIV = GetObject(bytes, ref position); FileHashes = GetObject>(bytes, ref position); return this; } } public class TLFileCdnRedirect70 : TLFileCdnRedirect { public new const uint Signature = TLConstructors.TLFileCdnRedirect70; public TLVector CdnFileHashes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); FileToken = GetObject(bytes, ref position); EncryptionKey = GetObject(bytes, ref position); EncryptionIV = GetObject(bytes, ref position); CdnFileHashes = GetObject>(bytes, ref position); return this; } } public class TLCdnFileHash : TLObject { public const uint Signature = TLConstructors.TLCdnFileHash; public TLInt Offset { get; set; } public TLInt Limit { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Limit = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } public class TLFileHash : TLObject { public const uint Signature = TLConstructors.TLFileHash; public TLInt Offset { get; set; } public TLInt Limit { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Limit = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLFileLocation.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLFileLocationBase : TLObject//, IFileData { public TLLong VolumeId { get; set; } public TLInt LocalId { get; set; } public TLLong Secret { get; set; } #region Additional //public string SendingFileName { get; set; } //public byte[] Buffer { get; set; } //public byte[] Bytes { get; set; } #endregion public virtual void Update(TLFileLocationBase fileLocation) { if (fileLocation != null) { //if (Buffer == null || LocalId.Value != fileLocation.LocalId.Value) //{ // Buffer = fileLocation.Buffer; //} VolumeId = fileLocation.VolumeId; LocalId = fileLocation.LocalId; Secret = fileLocation.Secret; } } } public class TLFileLocationUnavailable : TLFileLocationBase { public const uint Signature = TLConstructors.TLFileLocationUnavailable; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); VolumeId = GetObject(bytes, ref position); LocalId = GetObject(bytes, ref position); Secret = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), VolumeId.ToBytes(), LocalId.ToBytes(), Secret.ToBytes()); } public override TLObject FromStream(Stream input) { VolumeId = GetObject(input); LocalId = GetObject(input); Secret = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(VolumeId.ToBytes()); output.Write(LocalId.ToBytes()); output.Write(Secret.ToBytes()); } public override string ToString() { return string.Format("TLFileLocationUnavailable=[volume_id={0}, local_id={1}, secret={2}]", VolumeId.Value, LocalId.Value, Secret.Value); } } public class TLFileLocation : TLFileLocationBase { public const uint Signature = TLConstructors.TLFileLocation; public TLInt DCId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); VolumeId = GetObject(bytes, ref position); LocalId = GetObject(bytes, ref position); Secret = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), DCId.ToBytes(), VolumeId.ToBytes(), LocalId.ToBytes(), Secret.ToBytes()); } public override TLObject FromStream(Stream input) { DCId = GetObject(input); VolumeId = GetObject(input); LocalId = GetObject(input); Secret = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(DCId.ToBytes()); output.Write(VolumeId.ToBytes()); output.Write(LocalId.ToBytes()); output.Write(Secret.ToBytes()); } public override string ToString() { return string.Format("TLFileLocation=[dc_id={0}, volume_id={1}, local_id={2}, secret={3}]", DCId, VolumeId.Value, LocalId.Value, Secret.Value); } public override void Update(TLFileLocationBase baseFileLocation) { base.Update(baseFileLocation); var fileLocation = baseFileLocation as TLFileLocation; if (fileLocation != null) { DCId = fileLocation.DCId; } } public TLInputFileLocation ToInputFileLocation() { return new TLInputFileLocation { LocalId = LocalId, Secret = Secret, VolumeId = VolumeId }; } } } ================================================ FILE: Telegram.Api/TL/TLFileType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLFileTypeBase : TLObject { } public class TLFileTypeUnknown : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeUnknown--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeJpeg : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeJpeg; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeJpeg--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeGif : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeGif; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeGif--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypePng : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypePng; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypePng--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeMp3 : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeMp3; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeMp3--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeMov : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeMov; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeMov--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypePartial : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypePartial; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypePartial--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeMp4 : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeMp4; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeMp4--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFileTypeWebp : TLFileTypeBase { public const uint Signature = TLConstructors.TLFileTypeWebp; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFileTypeWebp--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } } ================================================ FILE: Telegram.Api/TL/TLForeignLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLForeignLinkBase : TLObject { } public class TLForeignLinkUnknown : TLForeignLinkBase { public const uint Signature = TLConstructors.TLForeignLinkUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLForeignLinkRequested : TLForeignLinkBase { public const uint Signature = TLConstructors.TLForeignLinkRequested; public TLBool HasPhone { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); HasPhone = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { HasPhone = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(HasPhone.ToBytes()); } } public class TLForeignLinkMutual : TLForeignLinkBase { public const uint Signature = TLConstructors.TLForeignLinkMutual; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLFoundGif.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLFoundGifBase : TLObject { } public class TLFoundGif : TLFoundGifBase { public const uint Signature = TLConstructors.TLFoundGif; public TLString Url { get; set; } public TLString ThumbUrl { get; set; } public TLString ContentUrl { get; set; } public TLString ContentType { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); ThumbUrl = GetObject(bytes, ref position); ContentUrl = GetObject(bytes, ref position); ContentType = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); ThumbUrl = GetObject(input); ContentUrl = GetObject(input); ContentType = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); ThumbUrl.ToStream(output); ContentUrl.ToStream(output); ContentType.ToStream(output); W.ToStream(output); H.ToStream(output); } } public class TLFoundGifCached : TLFoundGifBase { public const uint Signature = TLConstructors.TLFoundGifCached; public TLString Url { get; set; } public TLPhotoBase Photo { get; set; } public TLDocumentBase Document { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); Photo = GetObject(bytes, ref position); Document = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); Photo = GetObject(input); Document = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); Photo.ToStream(output); Document.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLFoundGifs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLFoundGifs : TLObject { public const uint Signature = TLConstructors.TLFoundGifs; public TLInt NextOffset { get; set; } public TLVector Results { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NextOffset = GetObject(bytes, ref position); Results = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { NextOffset = GetObject(input); Results = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); NextOffset.ToStream(output); Results.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLFutureSalt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLFutureSalt : TLObject { public const uint Signature = TLConstructors.TLFutureSalt; public TLInt ValidSince { get; set; } public TLInt ValidUntil { get; set; } public TLLong Salt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFutureSalt--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); ValidSince = GetObject(bytes, ref position); ValidUntil = GetObject(bytes, ref position); Salt = GetObject(bytes, ref position); TLUtils.WriteLine("ValidSince: " + TLUtils.MessageIdString(ValidSince)); TLUtils.WriteLine("ValidUntil: " + TLUtils.MessageIdString(ValidUntil)); TLUtils.WriteLine("Salt: " + Salt); return this; } } public class TLFutureSalts : TLObject { public const uint Signature = TLConstructors.TLFutureSalts; public TLLong ReqMsgId { get; set; } public TLInt Now { get; set; } public TLVector Salts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLFutureSalts--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); ReqMsgId = GetObject(bytes, ref position); Now = GetObject(bytes, ref position); TLUtils.WriteLine("ReqMsgId: " + ReqMsgId); TLUtils.WriteLine("Now: " + TLUtils.MessageIdString(Now)); TLUtils.WriteLine("Salts:"); Salts = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLGame.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public enum GameFlags { Document = 0x1 } public class TLGame : TLObject { public const uint Signature = TLConstructors.TLGame; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public TLString ShortName { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLPhotoBase Photo { get; set; } private TLDocumentBase _document; public TLDocumentBase Document { get { return _document; } set { SetField(out _document, value, ref _flags, (int) GameFlags.Document); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); ShortName = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); Photo = GetObject(bytes, ref position); Document = GetObject(Flags, (int) GameFlags.Document, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), AccessHash.ToBytes(), ShortName.ToBytes(), Title.ToBytes(), Description.ToBytes(), Photo.ToBytes(), ToBytes(Document, Flags, (int) GameFlags.Document)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); ShortName = GetObject(input); Title = GetObject(input); Description = GetObject(input); Photo = GetObject(input); Document = GetObject(Flags, (int) GameFlags.Document, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); AccessHash.ToStream(output); ShortName.ToStream(output); Title.ToStream(output); Description.ToStream(output); Photo.ToStream(output); ToStream(output, Document, Flags, (int) GameFlags.Document); } public override string ToString() { return string.Format("TLGame id={0} short_name={1} title={2} description={3} photo={4} document={5}", Id, ShortName, Title, Description, Photo, Document); } } } ================================================ FILE: Telegram.Api/TL/TLGeoPoint.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Globalization; using System.IO; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [KnownType(typeof(TLGeoPointEmpty))] [KnownType(typeof(TLGeoPoint))] [DataContract] public abstract class TLGeoPointBase : TLObject { } [DataContract] public class TLGeoPointEmpty : TLGeoPointBase { public const uint Signature = TLConstructors.TLGeoPointEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } [DataContract] public class TLGeoPoint82 : TLGeoPoint { public new const uint Signature = TLConstructors.TLGeoPoint82; [DataMember] public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Long = GetObject(bytes, ref position); Lat = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Long = GetObject(input); Lat = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Long.ToBytes()); output.Write(Lat.ToBytes()); output.Write(AccessHash.ToBytes()); } public override string ToString() { return string.Format("TLGeoPoint82 [lat={0} long={1} access_hash={2}]", Lat, Long, AccessHash); } } [DataContract] public class TLGeoPoint : TLGeoPointBase { public const uint Signature = TLConstructors.TLGeoPoint; [DataMember] public TLDouble Long { get; set; } [DataMember] public TLDouble Lat { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Long = GetObject(bytes, ref position); Lat = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Long = GetObject(input); Lat = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Long.ToBytes()); output.Write(Lat.ToBytes()); } public string GetFileName() { return string.Format("staticmap{0}_{1}.jpg", Lat.Value.ToString(new CultureInfo("en-US")), Long.Value.ToString(new CultureInfo("en-US"))); } public override string ToString() { return string.Format("TLGeoPoint[lat={0} long={1}]", Lat, Long); } } } ================================================ FILE: Telegram.Api/TL/TLGzipPacked.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; #if SILVERLIGHT using SharpGIS; #else using System.IO.Compression; #endif using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLGzipPacked : TLObject { public const uint Signature = TLConstructors.TLGzipPacked; public TLString PackedData { get; set; } public TLObject Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PackedData = GetObject(bytes, ref position); var decopressedData = new byte[] {}; var compressedData = PackedData.Data; var buffer = new byte[4096]; #if SILVERLIGHT var hgs = new GZipInflateStream(new MemoryStream(compressedData)); #else var hgs = new GZipStream(new MemoryStream(compressedData), CompressionMode.Decompress); #endif var bytesRead = hgs.Read(buffer, 0, buffer.Length); while (bytesRead > 0) { decopressedData = TLUtils.Combine(decopressedData, buffer.SubArray(0, bytesRead)); bytesRead = hgs.Read(buffer, 0, buffer.Length); } bytesRead = 0; Data = GetObject(decopressedData, ref bytesRead); return this; } } } ================================================ FILE: Telegram.Api/TL/TLHashtagItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLHashtagItem : TLObject { public const uint Signature = TLConstructors.TLHashtagItem; public TLString Hashtag { get; set; } public TLHashtagItem() { } public TLHashtagItem(string hashtag) { Hashtag = new TLString(hashtag); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hashtag = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hashtag.ToBytes()); } public override TLObject FromStream(Stream input) { Hashtag = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Hashtag.ToBytes()); } public override string ToString() { return Hashtag != null ? Hashtag.ToString() : string.Empty; } } } ================================================ FILE: Telegram.Api/TL/TLHighScore.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLHighScore : TLObject { public const uint Signature = TLConstructors.TLHighScore; public TLInt Pos { get; set; } public TLInt UserId { get; set; } public TLInt Score { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Pos.ToBytes(), UserId.ToBytes(), Score.ToBytes()); } public override TLObject FromStream(Stream input) { Pos = GetObject(input); UserId = GetObject(input); Score = GetObject(input); return this; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pos = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Score = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Pos.ToStream(output); UserId.ToStream(output); Score.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLHighScores.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLHighScores : TLObject { public const uint Signature = TLConstructors.TLHighScores; public TLVector HighScores { get; set; } public TLVector Users { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), HighScores.ToBytes(), Users.ToBytes()); } public override TLObject FromStream(Stream input) { HighScores = GetObject>(input); Users = GetObject>(input); return this; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); HighScores = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); HighScores.ToStream(output); Users.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLImportedContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLImportedContact : TLObject { public const uint Signature = TLConstructors.TLImportedContact; public TLInt UserId { get; set; } public TLLong ClientId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); ClientId = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLImportedContacts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLImportedContacts : TLObject { public const uint Signature = TLConstructors.TLImportedContacts; public TLVector Imported { get; set; } public TLVector RetryContacts { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Imported = GetObject>(bytes, ref position); RetryContacts = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public virtual TLImportedContacts GetEmptyObject() { return new TLImportedContacts { Imported = new TLVector(Imported.Count), RetryContacts = new TLVector(RetryContacts.Count), Users = new TLVector(Users.Count) }; } } public class TLImportedContacts69 : TLImportedContacts { public new const uint Signature = TLConstructors.TLImportedContacts69; public TLVector PopularInvites { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Imported = GetObject>(bytes, ref position); PopularInvites = GetObject>(bytes, ref position); RetryContacts = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLImportedContacts GetEmptyObject() { return new TLImportedContacts69 { Imported = new TLVector(Imported.Count), PopularInvites = new TLVector(PopularInvites.Count), RetryContacts = new TLVector(RetryContacts.Count), Users = new TLVector(Users.Count) }; } public override string ToString() { return string.Format("TLImportedContacts imported={0} popular_invites={1} retry_contacts={2} users={3}", Imported.Count, PopularInvites.Count, RetryContacts.Count, Users.Count); } } } ================================================ FILE: Telegram.Api/TL/TLInitConnection.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public enum InitConnectionFlags { Proxy = 0x1 } public class TLInitConnection : TLObject { public const uint Signature = 0x69796de9; public TLInt AppId { get; set; } public TLString DeviceModel { get; set; } public TLString SystemVersion { get; set; } public TLString AppVersion { get; set; } public TLString LangCode { get; set; } public TLObject Data { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), AppId.ToBytes(), DeviceModel.ToBytes(), SystemVersion.ToBytes(), AppVersion.ToBytes(), LangCode.ToBytes(), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); AppId.ToStream(output); DeviceModel.ToStream(output); SystemVersion.ToStream(output); AppVersion.ToStream(output); LangCode.ToStream(output); } public override TLObject FromStream(Stream input) { AppId = GetObject(input); DeviceModel = GetObject(input); SystemVersion = GetObject(input); AppVersion = GetObject(input); LangCode = GetObject(input); return this; } public override string ToString() { return string.Format("app_id={0} device_model={1} system_version={2} app_version={3} lang_code={4}", AppId, DeviceModel, SystemVersion, AppVersion, LangCode); } } public class TLInitConnection67 : TLInitConnection { public new const uint Signature = 0xc7481da6; public TLString SystemLangCode { get; set; } public TLString LangPack { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), AppId.ToBytes(), DeviceModel.ToBytes(), SystemVersion.ToBytes(), AppVersion.ToBytes(), SystemLangCode.ToBytes(), LangPack.ToBytes(), LangCode.ToBytes(), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); AppId.ToStream(output); DeviceModel.ToStream(output); SystemVersion.ToStream(output); AppVersion.ToStream(output); SystemLangCode.ToStream(output); LangPack.ToStream(output); LangCode.ToStream(output); } public override TLObject FromStream(Stream input) { AppId = GetObject(input); DeviceModel = GetObject(input); SystemVersion = GetObject(input); AppVersion = GetObject(input); SystemLangCode = GetObject(input); LangPack = GetObject(input); LangCode = GetObject(input); return this; } public override string ToString() { return string.Format("app_id={0} device_model={1} system_version={2} app_version={3} system_lang_code={4} lang_pack={5} lang_code={6}", AppId, DeviceModel, SystemVersion, AppVersion, SystemLangCode, LangPack, LangCode); } } public class TLInitConnection78 : TLInitConnection67 { public new const uint Signature = 0x785188b8; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLInputClientProxy _proxy; public TLInputClientProxy Proxy { get { return _proxy; } set { SetField(out _proxy, value, ref _flags, (int)InitConnectionFlags.Proxy); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), AppId.ToBytes(), DeviceModel.ToBytes(), SystemVersion.ToBytes(), AppVersion.ToBytes(), SystemLangCode.ToBytes(), LangPack.ToBytes(), LangCode.ToBytes(), ToBytes(_proxy, _flags, (int)InitConnectionFlags.Proxy), Data.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); AppId.ToStream(output); DeviceModel.ToStream(output); SystemVersion.ToStream(output); AppVersion.ToStream(output); SystemLangCode.ToStream(output); LangPack.ToStream(output); LangCode.ToStream(output); ToStream(output, _proxy, _flags, (int)InitConnectionFlags.Proxy); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); AppId = GetObject(input); DeviceModel = GetObject(input); SystemVersion = GetObject(input); AppVersion = GetObject(input); SystemLangCode = GetObject(input); LangPack = GetObject(input); LangCode = GetObject(input); _proxy = GetObject(_flags, (int)InitConnectionFlags.Proxy, null, input); return this; } public override string ToString() { return string.Format("app_id={0} device_model={1} system_version={2} app_version={3} system_lang_code={4} lang_pack={5} lang_code={6} proxy=[{7}]", AppId, DeviceModel, SystemVersion, AppVersion, SystemLangCode, LangPack, LangCode, Proxy); } } } ================================================ FILE: Telegram.Api/TL/TLInlineBotSwitchPM.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInlineBotSwitchPM : TLObject { public const uint Signature = TLConstructors.TLInlineBotSwitchPM; public TLString Text { get; set; } public TLString StartParam { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); StartParam = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), StartParam.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); StartParam = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); StartParam.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLInputAudio.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputAudioBase : TLObject { } public class TLInputAudioEmpty : TLInputAudioBase { public const uint Signature = TLConstructors.TLInputAudioEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputAudio : TLInputAudioBase { public const uint Signature = TLConstructors.TLInputAudio; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputBotInlineMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum InputBotInlineMessageFlags { NoWebpage = 0x1, // 0 Entities = 0x2, // 1 ReplyMarkup = 0x4, // 2 } public abstract class TLInputBotInlineMessageBase : TLObject { public TLReplyKeyboardBase ReplyMarkup { get; set; } } public class TLInputBotInlineMessageMediaAuto75 : TLInputBotInlineMessageMediaAuto51 { public new const uint Signature = TLConstructors.TLInputBotInlineMessageMediaAuto75; protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)InputBotInlineMessageFlags.Entities); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Caption.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Caption = TLString.Empty; Entities = GetObject>(Flags, (int)InputBotInlineMessageFlags.Entities, null, input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Caption.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaAuto51 : TLInputBotInlineMessageMediaAuto { public new const uint Signature = TLConstructors.TLInputBotInlineMessageMediaAuto51; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Caption.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Caption = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Caption.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaAuto : TLInputBotInlineMessageBase { public const uint Signature = TLConstructors.TLInputBotInlineMessageMediaAuto; public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Caption.ToStream(output); } } public class TLInputBotInlineMessageText51 : TLInputBotInlineMessageText { public new const uint Signature = TLConstructors.TLInputBotInlineMessageText51; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(NoWebpage, Flags, (int)InputBotInlineMessageFlags.NoWebpage), Message.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); NoWebpage = GetObject(Flags, (int)InputBotInlineMessageFlags.NoWebpage, null, input); Message = GetObject(input); Entities = GetObject>(Flags, (int)InputBotInlineMessageFlags.Entities, null, input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, NoWebpage, Flags, (int)InputBotInlineMessageFlags.NoWebpage); Message.ToStream(output); ToStream(output, Entities, Flags, (int)InputBotInlineMessageFlags.Entities); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageText : TLInputBotInlineMessageBase { public const uint Signature = TLConstructors.TLInputBotInlineMessageText; public TLInt Flags { get; set; } public TLBool NoWebpage { get; set; } public TLString Message { get; set; } public TLVector Entities { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(NoWebpage, Flags, (int)InputBotInlineMessageFlags.NoWebpage), Message.ToBytes(), ToBytes(Entities, Flags, (int)InputBotInlineMessageFlags.Entities)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); NoWebpage = GetObject(Flags, (int)InputBotInlineMessageFlags.NoWebpage, null, input); Message = GetObject(input); Entities = GetObject>(Flags, (int)InputBotInlineMessageFlags.Entities, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, NoWebpage, Flags, (int)InputBotInlineMessageFlags.NoWebpage); Message.ToStream(output); ToStream(output, Entities, Flags, (int)InputBotInlineMessageFlags.Entities); } } public class TLInputBotInlineMessageMediaGeo : TLInputBotInlineMessageBase { public const uint Signature = TLConstructors.TLInputBotInlineMessageMediaGeo; public TLInt Flags { get; set; } public TLGeoPointBase GeoPoint { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), GeoPoint.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); GeoPoint = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); GeoPoint.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaVenue78 : TLInputBotInlineMessageMediaVenue { public new const uint Signature = TLConstructors.TLInputBotInlineMessageMediaVenue78; public TLString VenueType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), GeoPoint.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes(), VenueType.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); GeoPoint = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); VenueType = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); GeoPoint.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); VenueType.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaVenue : TLInputBotInlineMessageMediaGeo { public new const uint Signature = TLConstructors.TLInputBotInlineMessageMediaVenue; public TLString Title { get; set; } public TLString Address { get; set; } public TLString Provider { get; set; } public TLString VenueId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), GeoPoint.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); GeoPoint = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); GeoPoint.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaContact82 : TLInputBotInlineMessageMediaContact { public new const uint Signature = TLConstructors.TLInputBotInlineMessageMediaContact82; public TLString VCard { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), VCard.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); VCard = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageMediaContact : TLInputBotInlineMessageBase { public const uint Signature = TLConstructors.TLInputBotInlineMessageMediaContact; public TLInt Flags { get; set; } public TLString PhoneNumber { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } public class TLInputBotInlineMessageGame : TLInputBotInlineMessageBase { public const uint Signature = TLConstructors.TLInputBotInlineMessageGame; public TLInt Flags { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ReplyMarkup = GetObject(Flags, (int)InputBotInlineMessageFlags.ReplyMarkup, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, ReplyMarkup, Flags, (int)InputBotInlineMessageFlags.ReplyMarkup); } } } ================================================ FILE: Telegram.Api/TL/TLInputBotInlineMessageId.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInputBotInlineMessageId : TLObject { public const uint Signature = TLConstructors.TLInputBotInlineMessageId; public TLInt DCId { get; set; } public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCId = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); DCId.ToStream(output); Id.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { DCId = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLInputBotInlineResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum InputBotInlineResultFlags { //Unread = 0x1, // 0 Title = 0x2, // 1 Description = 0x4, // 2 Url = 0x8, // 3 Thumb = 0x10, // 4 Content = 0x20, // 5 Size = 0x40, // 6 Duration = 0x80, // 7 } public abstract class TLInputBotInlineResultBase : TLObject { } public class TLInputBotInlineResult : TLInputBotInlineResultBase { public const uint Signature = TLConstructors.TLInputBotInlineResult; public TLInt Flags { get; set; } public TLString Id { get; set; } public TLString Type { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLString Url { get; set; } public virtual TLString ThumbUrl { get; protected set; } public virtual TLString ContentUrl { get; protected set; } public virtual TLString ContentType { get; protected set; } public virtual TLInt W { get; protected set; } public virtual TLInt H { get; protected set; } public virtual TLInt Duration { get; protected set; } public TLInputBotInlineMessageBase SendMessage { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Title, Flags, (int)InputBotInlineResultFlags.Title), ToBytes(Description, Flags, (int)InputBotInlineResultFlags.Description), ToBytes(Url, Flags, (int)InputBotInlineResultFlags.Url), ToBytes(ThumbUrl, Flags, (int)InputBotInlineResultFlags.Thumb), ToBytes(ContentUrl, Flags, (int)InputBotInlineResultFlags.Content), ToBytes(ContentType, Flags, (int)InputBotInlineResultFlags.Content), ToBytes(W, Flags, (int)InputBotInlineResultFlags.Size), ToBytes(H, Flags, (int)InputBotInlineResultFlags.Size), ToBytes(Duration, Flags, (int)InputBotInlineResultFlags.Duration), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); if (IsSet(Flags, (int)InputBotInlineResultFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Description)) { Description = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Url)) { Url = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Thumb)) { ThumbUrl = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Content)) { ContentUrl = GetObject(input); ContentType = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Size)) { W = GetObject(input); H = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Duration)) { Duration = GetObject(input); } SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Title, Flags, (int) InputBotInlineResultFlags.Title); ToStream(output, Description, Flags, (int)InputBotInlineResultFlags.Description); ToStream(output, Url, Flags, (int)InputBotInlineResultFlags.Url); ToStream(output, ThumbUrl, Flags, (int)InputBotInlineResultFlags.Thumb); ToStream(output, ContentUrl, Flags, (int)InputBotInlineResultFlags.Content); ToStream(output, ContentType, Flags, (int)InputBotInlineResultFlags.Content); ToStream(output, W, Flags, (int)InputBotInlineResultFlags.Size); ToStream(output, H, Flags, (int)InputBotInlineResultFlags.Size); ToStream(output, Duration, Flags, (int)InputBotInlineResultFlags.Duration); SendMessage.ToStream(output); } } public class TLInputBotInlineResult76 : TLInputBotInlineResult { public new const uint Signature = TLConstructors.TLInputBotInlineResult76; public TLInputWebDocument Thumb { get; set; } public override TLString ThumbUrl { get { return Thumb != null ? Thumb.Url : null; } } public TLInputWebDocument Content { get; set; } public override TLString ContentUrl { get { return Content != null ? Content.Url : null; } } public override TLString ContentType { get { return Content != null ? Content.MimeType : null; } } public override TLInt W { get { return Content != null ? Content.W : null; } } public override TLInt H { get { return Content != null ? Content.H : null; } } public override TLInt Duration { get { return Content != null ? Content.Duration : null; } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Title, Flags, (int)InputBotInlineResultFlags.Title), ToBytes(Description, Flags, (int)InputBotInlineResultFlags.Description), ToBytes(Url, Flags, (int)InputBotInlineResultFlags.Url), ToBytes(Thumb, Flags, (int)InputBotInlineResultFlags.Thumb), ToBytes(Content, Flags, (int)InputBotInlineResultFlags.Content), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); Title = GetObject(Flags, (int)InputBotInlineResultFlags.Title, null, input); Description = GetObject(Flags, (int)InputBotInlineResultFlags.Description, null, input); Url = GetObject(Flags, (int)InputBotInlineResultFlags.Url, null, input); Thumb = GetObject(Flags, (int)InputBotInlineResultFlags.Thumb, null, input); Content = GetObject(Flags, (int)InputBotInlineResultFlags.Content, null, input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Title, Flags, (int)InputBotInlineResultFlags.Title); ToStream(output, Description, Flags, (int)InputBotInlineResultFlags.Description); ToStream(output, Url, Flags, (int)InputBotInlineResultFlags.Url); ToStream(output, Thumb, Flags, (int)InputBotInlineResultFlags.Thumb); ToStream(output, Content, Flags, (int)InputBotInlineResultFlags.Content); SendMessage.ToStream(output); } } public class TLInputBotInlineResultPhoto : TLInputBotInlineResultBase { public const uint Signature = TLConstructors.TLInputBotInlineResultPhoto; public TLString Id { get; set; } public TLString Type { get; set; } public TLInputPhotoBase Photo { get; set; } public TLInputBotInlineMessageBase SendMessage { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Type.ToBytes(), Photo.ToBytes(), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Type = GetObject(input); Photo = GetObject(input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Type.ToStream(output); Photo.ToStream(output); SendMessage.ToStream(output); } } public class TLInputBotInlineResultDocument : TLInputBotInlineResultBase { public const uint Signature = TLConstructors.TLInputBotInlineResultDocument; public TLInt Flags { get; set; } public TLString Id { get; set; } public TLString Type { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLInputDocumentBase Document { get; set; } public TLInputBotInlineMessageBase SendMessage { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Type.ToBytes(), ToBytes(Title, Flags, (int)InputBotInlineResultFlags.Title), ToBytes(Description, Flags, (int)InputBotInlineResultFlags.Description), Document.ToBytes(), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Type = GetObject(input); if (IsSet(Flags, (int)InputBotInlineResultFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)InputBotInlineResultFlags.Description)) { Description = GetObject(input); } Document = GetObject(input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Type.ToStream(output); ToStream(output, Title, Flags, (int)InputBotInlineResultFlags.Title); ToStream(output, Description, Flags, (int)InputBotInlineResultFlags.Description); Document.ToStream(output); SendMessage.ToStream(output); } } public class TLInputBotInlineResultGame : TLInputBotInlineResultBase { public const uint Signature = TLConstructors.TLInputBotInlineResultGame; public TLString Id { get; set; } public TLString ShortName { get; set; } public TLInputBotInlineMessageBase SendMessage { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), ShortName.ToBytes(), SendMessage.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); ShortName = GetObject(input); SendMessage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); ShortName.ToStream(output); SendMessage.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLInputChatBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputChannelBase : TLObject { } public class TLInputChannelEmpty : TLInputChannelBase { public const uint Signature = TLConstructors.TLInputChannelEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override string ToString() { return "TLInputChannelEmpty"; } } public class TLInputChannel : TLInputChannelBase { public const uint Signature = TLConstructors.TLInputChannel; public TLInt ChannelId { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChannelId.ToBytes(), AccessHash.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputChannel channel_id={0} access_hash={1}", ChannelId, AccessHash); } } } ================================================ FILE: Telegram.Api/TL/TLInputChatPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputChatPhotoBase : TLObject { } public class TLInputChatPhotoEmpty : TLInputChatPhotoBase { public const uint Signature = TLConstructors.TLInputChatPhotoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputChatUploadedPhoto56 : TLInputChatPhotoBase { public const uint Signature = TLConstructors.TLInputChatUploadedPhoto56; public TLInputFile File { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); File = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes()); } } public class TLInputChatUploadedPhoto : TLInputChatPhotoBase { public const uint Signature = TLConstructors.TLInputChatUploadedPhoto; public TLInputFile File { get; set; } public TLInputPhotoCropBase Crop { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); File = GetObject(bytes, ref position); Crop = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Crop.ToBytes()); } } public class TLInputChatPhoto56 : TLInputChatPhotoBase { public const uint Signature = TLConstructors.TLInputChatPhoto; public TLInputPhotoBase Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } public class TLInputChatPhoto : TLInputChatPhotoBase { public const uint Signature = TLConstructors.TLInputChatPhoto; public TLInputPhotoBase Id { get; set; } public TLInputPhotoCropBase Crop { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Crop = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Crop.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputContactBase : TLObject { } public class TLInputContact : TLInputContactBase { public const uint Signature = TLConstructors.TLInputContact; public TLLong ClientId { get; set; } public TLString Phone { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ClientId.ToBytes(), Phone.ToBytes(), FirstName.ToBytes(), LastName.ToBytes()); } public override string ToString() { return string.Format("{0} {1}, {2}, {3}", FirstName, LastName, ClientId, Phone); } } } ================================================ FILE: Telegram.Api/TL/TLInputDocument.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputDocumentBase : TLObject { } public class TLInputDocumentEmpty : TLInputDocumentBase { public const uint Signature = TLConstructors.TLInputDocumentEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return "TLInputDocumentEmpty"; } } public class TLInputDocument : TLInputDocumentBase { public const uint Signature = TLConstructors.TLInputDocument; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); } public override string ToString() { return string.Format("TLInputDocument id={0}", Id); } } } ================================================ FILE: Telegram.Api/TL/TLInputEncryptedChat.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInputEncryptedChat : TLObject { public const uint Signature = TLConstructors.TLInputEncryptedChat; public TLInt ChatId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); AccessHash = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLInputEncryptedFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputEncryptedFileBase : TLObject { } public class TLInputEncryptedFileEmpty : TLInputEncryptedFileBase { public const uint Signature = TLConstructors.TLInputEncryptedFileEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLInputEncryptedFileUploaded : TLInputEncryptedFileBase { public const uint Signature = TLConstructors.TLInputEncryptedFileUploaded; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLString MD5Checksum { get; set; } public TLInt KeyFingerprint { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Parts = GetObject(bytes, ref position); MD5Checksum = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Parts.ToBytes(), MD5Checksum.ToBytes(), KeyFingerprint.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Parts = GetObject(input); MD5Checksum = GetObject(input); KeyFingerprint = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Parts.ToBytes()); output.Write(MD5Checksum.ToBytes()); output.Write(KeyFingerprint.ToBytes()); } } public class TLInputEncryptedFileBigUploaded : TLInputEncryptedFileBase { public const uint Signature = TLConstructors.TLInputEncryptedFileBigUploaded; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLInt KeyFingerprint { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Parts = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Parts.ToBytes(), KeyFingerprint.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Parts = GetObject(input); KeyFingerprint = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Parts.ToBytes()); output.Write(KeyFingerprint.ToBytes()); } } public class TLInputEncryptedFile : TLInputEncryptedFileBase { public const uint Signature = TLConstructors.TLInputEncryptedFile; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputEncryptedFileBigUploaded.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/TLInputEncryptedFileLocation.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/TLInputFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputFileBase : TLObject { } public class TLInputFile : TLInputFileBase { public const uint Signature = TLConstructors.TLInputFile; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLString Name { get; set; } public TLString MD5Checksum { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Parts = GetObject(bytes, ref position); Name = GetObject(bytes, ref position); MD5Checksum = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Parts.ToBytes(), Name.ToBytes(), MD5Checksum.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Parts = GetObject(input); Name = GetObject(input); MD5Checksum = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Parts.ToStream(output); Name.ToStream(output); MD5Checksum.ToStream(output); } } public class TLInputFileBig : TLInputFileBase { public const uint Signature = TLConstructors.TLInputFileBig; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLString Name { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Parts = GetObject(bytes, ref position); Name = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Parts.ToBytes(), Name.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputFileBig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/TLInputFileLocation.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { public abstract class TLInputFileLocationBase : TLObject { public abstract bool LocationEquals(TLInputFileLocationBase location); public abstract string GetPartFileName(int partNumbert, string prefix = "file"); public abstract string GetFileName(string prefix = "file", string ext = ".dat"); public abstract string GetLocationString(); } public class TLInputFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputFileLocation; public TLLong VolumeId { get; set; } public TLInt LocalId { get; set; } public TLLong Secret { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), VolumeId.ToBytes(), LocalId.ToBytes(), Secret.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputFileLocation; if (fileLocation == null) return false; return VolumeId.Value == fileLocation.VolumeId.Value && LocalId.Value == fileLocation.LocalId.Value && Secret.Value == fileLocation.Secret.Value; } public override string GetPartFileName(int partNumbert, string prefix = "file") { return string.Format(prefix + "{0}_{1}_{2}_{3}.dat", VolumeId.Value, LocalId.Value, Secret.Value, partNumbert); } public override string GetFileName(string prefix = "file", string ext = ".dat") { return string.Format(prefix + "{0}_{1}_{2}{3}", VolumeId.Value, LocalId.Value, Secret.Value, ext); } public override string GetLocationString() { return string.Format("volume_id={0} local_id={1}", VolumeId, LocalId); } } [Obsolete] public class TLInputVideoFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputVideoFileLocation; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputVideoFileLocation; if (fileLocation == null) return false; return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "video") { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "video", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Id); } } [Obsolete] public class TLInputAudioFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputAudioFileLocation; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputAudioFileLocation; if (fileLocation == null) return false; return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "audio") { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "audio", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Id); } } public class TLInputDocumentFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputDocumentFileLocation; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputDocumentFileLocation; if (fileLocation == null) return false; return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "document") { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "document", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Id); } } public class TLInputDocumentFileLocation54 : TLInputDocumentFileLocation { public new const uint Signature = TLConstructors.TLInputDocumentFileLocation54; public TLInt Version { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Version.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputDocumentFileLocation; if (fileLocation == null) return false; var fileLocation54 = location as TLInputDocumentFileLocation54; if (fileLocation54 != null) { return Id.Value == fileLocation54.Id.Value && AccessHash.Value == fileLocation54.AccessHash.Value && Version.Value == fileLocation54.Version.Value; } return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "document") { if (Version.Value > 0) { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, Version.Value, partNumbert); } return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "document", string ext = ".dat") { if (Version.Value > 0) { return string.Format(prefix + "{0}_{1}{2}", Id.Value, Version.Value, ext); } return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0} version={1}", Id, Version); } } public class TLInputEncryptedFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputEncryptedFileLocation; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputEncryptedFileLocation; if (fileLocation == null) return false; return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "encrypted") { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "encrypted", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Id); } } public abstract class TLInputWebFileLocationBase : TLInputFileLocationBase { public TLLong AccessHash { get; set; } } public class TLInputWebFileGeoPointLocation : TLInputWebFileLocationBase { public const uint Signature = TLConstructors.TLInputWebFileGeoPointLocation; public TLInputGeoPointBase GeoPoint { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public TLInt Zoom { get; set; } public TLInt Scale { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), GeoPoint.ToBytes(), AccessHash.ToBytes(), W.ToBytes(), H.ToBytes(), Zoom.ToBytes(), Scale.ToBytes()); } public override string GetPartFileName(int partNumbert, string prefix = "map") { return string.Format(prefix + "{0}_{1}_{2}_{3}_{4}_{5}_{6}.dat", GeoPoint, AccessHash.Value, W, H, Zoom, Scale, partNumbert); } public override string GetFileName(string prefix = "map", string ext = ".dat") { return string.Format(prefix + "{0}_{1}_{2}_{3}_{4}_{5}{6}", GeoPoint, AccessHash.Value, W, H, Zoom, Scale, ext); } public override string GetLocationString() { return string.Format("point={0} w={1} h={2} zoom={3} scale={4}", GeoPoint, W, H, Zoom, Scale); } public override bool LocationEquals(TLInputFileLocationBase locationBase) { if (locationBase == null) return false; var location = locationBase as TLInputWebFileGeoPointLocation; if (location == null) return false; return GeoPoint.GeoPointEquals(location.GeoPoint) && AccessHash.Value == location.AccessHash.Value && W.Value == location.W.Value && H.Value == location.H.Value && Zoom.Value == location.Zoom.Value && Scale.Value == location.Scale.Value; } } public class TLInputWebFileLocation : TLInputWebFileLocationBase { public const uint Signature = TLConstructors.TLInputWebFileLocation; public TLString Url { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), AccessHash.ToBytes()); } public override string GetPartFileName(int partNumbert, string prefix = "url") { return string.Format(prefix + "{0}_{1}_{2}.dat", Url.ToString().GetHashCode(), AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "url", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Url.ToString().GetHashCode(), AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Url.ToString().GetHashCode()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputWebFileLocation; if (fileLocation == null) return false; return Url.Value == fileLocation.Url.Value && AccessHash.Value == fileLocation.AccessHash.Value; } } public class TLInputSecureFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputSecureFileLocation; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override bool LocationEquals(TLInputFileLocationBase location) { if (location == null) return false; var fileLocation = location as TLInputSecureFileLocation; if (fileLocation == null) return false; return Id.Value == fileLocation.Id.Value && AccessHash.Value == fileLocation.AccessHash.Value; } public override string GetPartFileName(int partNumbert, string prefix = "document") { return string.Format(prefix + "{0}_{1}_{2}.dat", Id.Value, AccessHash.Value, partNumbert); } public override string GetFileName(string prefix = "document", string ext = ".dat") { return string.Format(prefix + "{0}_{1}{2}", Id.Value, AccessHash.Value, ext); } public override string GetLocationString() { return string.Format("id={0}", Id); } } public class TLInputTakeoutFileLocation : TLInputFileLocationBase { public const uint Signature = TLConstructors.TLInputTakeoutFileLocation; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override bool LocationEquals(TLInputFileLocationBase location) { var fileLocation = location as TLInputSecureFileLocation; if (fileLocation == null) return false; return true; } public override string GetPartFileName(int partNumbert, string prefix = "document") { return string.Format(prefix + "{0}.dat", partNumbert); } public override string GetFileName(string prefix = "document", string ext = ".dat") { return string.Format(prefix + "{2}", ext); } public override string GetLocationString() { return ""; } } } ================================================ FILE: Telegram.Api/TL/TLInputGame.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputGameBase : TLObject { } public class TLInputGameId : TLInputGameBase { public const uint Signature = TLConstructors.TLInputGameId; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); } public override string ToString() { return string.Format("TLInputGameId id={0} access_hash={1}", Id, AccessHash); } } public class TLInputGameShortName : TLInputGameBase { public const uint Signature = TLConstructors.TLInputGameShortName; public TLInputUserBase BotId { get; set; } public TLString ShortName { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), BotId.ToBytes(), ShortName.ToBytes()); } public override TLObject FromStream(Stream input) { BotId = GetObject(input); ShortName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); BotId.ToStream(output); ShortName.ToStream(output); } public override string ToString() { return string.Format("TLInputGameShortName bot_id={0} short_name={1}", BotId, ShortName); } } } ================================================ FILE: Telegram.Api/TL/TLInputGeoPoint.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Globalization; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputGeoPointBase : TLObject { public abstract bool GeoPointEquals(TLInputGeoPointBase locationGeoPoint); } public class TLInputGeoPointEmpty : TLInputGeoPointBase { public const uint Signature = TLConstructors.TLInputGeoPointEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return "empty"; } public override bool GeoPointEquals(TLInputGeoPointBase geoPointBase) { var geoPointEmpty = geoPointBase as TLInputGeoPointEmpty; if (geoPointEmpty != null) { return true; } return false; } } public class TLInputGeoPoint : TLInputGeoPointBase { public const uint Signature = TLConstructors.TLInputGeoPoint; public TLDouble Lat { get; set; } public TLDouble Long { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Lat.ToBytes(), Long.ToBytes()); } public override TLObject FromStream(Stream input) { Lat = GetObject(input); Long = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Lat.ToStream(output); Long.ToStream(output); } public string GetFileName() { return string.Format("staticmap{0}_{1}.jpg", Lat.Value.ToString(new CultureInfo("en-US")), Long.Value.ToString(new CultureInfo("en-US"))); } public override string ToString() { return string.Format("{0}_{1}", Lat, Long); } public override bool GeoPointEquals(TLInputGeoPointBase geoPointBase) { var geoPoint = geoPointBase as TLInputGeoPoint; if (geoPoint != null) { return Lat.Value == geoPoint.Lat.Value && Long.Value == geoPoint.Long.Value; } return false; } } } ================================================ FILE: Telegram.Api/TL/TLInputMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum InputMediaUploadedPhotoFlags { Stickers = 0x1, TTLSeconds = 0x2 } [Flags] public enum InputMediaPhotoFlags { TTLSeconds = 0x1 } [Flags] public enum InputMediaUploadedDocumentFlags { Stickers = 0x1, TTLSeconds = 0x2, Thumb = 0x4, NosoundVideo = 0x8, } [Flags] public enum InputMediaDocumentFlags { TTLSeconds = 0x1, } [Flags] public enum InputMediaPhotoExternalFlags { TTLSeconds = 0x1, } [Flags] public enum InputMediaDocumentExternalFlags { TTLSeconds = 0x1, } [Flags] public enum InputMediaInvoiceFlags { Photo = 0x1 } public interface IInputMediaCaption { TLString Caption { get; set; } } public interface IInputTTLMedia { TLInt TTLSeconds { get; set; } } public abstract class TLInputMediaBase : TLObject { #region Additional public byte[] MD5Hash { get; set; } #endregion } public class TLInputMediaEmpty : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLInputMediaUploadedDocument : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedDocument; public TLInputFileBase File { get; set; } public TLString FileName { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), FileName.ToBytes(), MimeType.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); FileName = GetObject(input); MimeType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); FileName.ToStream(output); MimeType.ToStream(output); } } public class TLInputMediaUploadedDocument22 : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedDocument22; public TLInputFileBase File { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); } } public class TLInputMediaUploadedDocument75 : TLInputMediaUploadedDocument70 { public new const uint Signature = TLConstructors.TLInputMediaUploadedDocument75; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), ToBytes(Thumb, Flags, (int)InputMediaUploadedDocumentFlags.Thumb), MimeType.ToBytes(), Attributes.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers), ToBytes(TTLSeconds, Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Thumb = GetObject(Flags, (int)InputMediaUploadedDocumentFlags.Thumb, null, input); MimeType = GetObject(input); Attributes = GetObject>(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedDocumentFlags.Stickers, null, input); TTLSeconds = GetObject(Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); ToStream(output, Thumb, Flags, (int)InputMediaUploadedDocumentFlags.Thumb); MimeType.ToStream(output); Attributes.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers); ToStream(output, TTLSeconds, Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds); } } public class TLInputMediaUploadedDocument70 : TLInputMediaUploadedDocument56, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaUploadedDocument70; private TLInputFileBase _thumb; public TLInputFileBase Thumb { get { return _thumb; } set { SetField(out _thumb, value, ref _flags, (int)InputMediaUploadedDocumentFlags.Thumb); } } private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds); } } public bool NosoundVideo { get { return IsSet(_flags, (int) InputMediaUploadedDocumentFlags.NosoundVideo); } set { SetUnset(ref _flags, value, (int) InputMediaUploadedDocumentFlags.NosoundVideo); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), ToBytes(Thumb, Flags, (int)InputMediaUploadedDocumentFlags.Thumb), MimeType.ToBytes(), Attributes.ToBytes(), Caption.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers), ToBytes(TTLSeconds, Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Thumb = GetObject(Flags, (int)InputMediaUploadedDocumentFlags.Thumb, null, input); MimeType = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedDocumentFlags.Stickers, null, input); TTLSeconds = GetObject(Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); ToStream(output, Thumb, Flags, (int)InputMediaUploadedDocumentFlags.Thumb); MimeType.ToStream(output); Attributes.ToStream(output); Caption.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers); ToStream(output, TTLSeconds, Flags, (int)InputMediaUploadedDocumentFlags.TTLSeconds); } } public class TLInputMediaUploadedDocument56 : TLInputMediaUploadedDocument45 { public new const uint Signature = TLConstructors.TLInputMediaUploadedDocument56; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLVector _stickers; public TLVector Stickers { get { return _stickers; } set { SetField(out _stickers, value, ref _flags, (int)InputMediaUploadedDocumentFlags.Stickers); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes(), Caption.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedDocumentFlags.Stickers, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); Caption.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers); } } public class TLInputMediaUploadedDocument45 : TLInputMediaBase, IAttributes, IInputMediaCaption { public const uint Signature = TLConstructors.TLInputMediaUploadedDocument45; public TLInputFileBase File { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedThumbDocument : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedThumbDocument; public TLInputFileBase File { get; set; } public TLInputFileBase Thumb { get; set; } public TLString FileName { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), FileName.ToBytes(), MimeType.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); FileName = GetObject(input); MimeType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); FileName.ToStream(output); MimeType.ToStream(output); } } public class TLInputMediaUploadedThumbDocument22 : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedThumbDocument22; public TLInputFileBase File { get; set; } public TLInputFileBase Thumb { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); } } [Obsolete] public class TLInputMediaUploadedThumbDocument56 : TLInputMediaUploadedThumbDocument45 { public new const uint Signature = TLConstructors.TLInputMediaUploadedThumbDocument56; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLVector _stickers; public TLVector Stickers { get { return _stickers; } set { SetField(out _stickers, value, ref _flags, (int)InputMediaUploadedDocumentFlags.Stickers); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), Thumb.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes(), Caption.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Thumb = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedDocumentFlags.Stickers, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); Thumb.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); Caption.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedDocumentFlags.Stickers); } } public class TLInputMediaUploadedThumbDocument45 : TLInputMediaBase, IAttributes, IInputMediaCaption { public const uint Signature = TLConstructors.TLInputMediaUploadedThumbDocument45; public TLInputFileBase File { get; set; } public TLInputFileBase Thumb { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaDocument : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaDocument; public TLInputDocumentBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public class TLInputMediaDocument75 : TLInputMediaDocument70 { public new const uint Signature = TLConstructors.TLInputMediaDocument75; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaDocumentFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); TTLSeconds = GetObject(Flags, (int)InputMediaDocumentFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, TTLSeconds, Flags, (int)InputMediaDocumentFlags.TTLSeconds); } } public class TLInputMediaDocument70 : TLInputMediaDocument45, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaDocument70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaDocumentFlags.TTLSeconds); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Caption.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaDocumentFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Caption = GetObject(input); TTLSeconds = GetObject(Flags, (int)InputMediaDocumentFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Caption.ToStream(output); ToStream(output, TTLSeconds, Flags, (int)InputMediaDocumentFlags.TTLSeconds); } } public class TLInputMediaDocument45 : TLInputMediaBase, IInputMediaCaption { public const uint Signature = TLConstructors.TLInputMediaDocument45; public TLInputDocumentBase Id { get; set; } public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedAudio : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedAudio; public TLInputFile File { get; set; } public TLInt Duration { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Duration.ToBytes(), MimeType.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Duration.ToStream(output); MimeType.ToStream(output); } } public class TLInputMediaAudio : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaAudio; public TLInputAudioBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } public class TLInputMediaUploadedPhoto : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedPhoto; public TLInputFileBase File { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); } } public class TLInputMediaUploadedPhoto28 : TLInputMediaUploadedPhoto, IInputMediaCaption { public new const uint Signature = TLConstructors.TLInputMediaUploadedPhoto28; public TLString Caption { get; set; } public TLInputMediaUploadedPhoto28() { } public TLInputMediaUploadedPhoto28(TLInputMediaUploadedPhoto inputMediaUploadedPhoto, TLString caption) { File = inputMediaUploadedPhoto.File; Caption = caption; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedPhoto56 : TLInputMediaUploadedPhoto28 { public new const uint Signature = TLConstructors.TLInputMediaUploadedPhoto56; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLVector _stickers; public TLVector Stickers { get { return _stickers; } set { SetField(out _stickers, value, ref _flags, (int)InputMediaUploadedPhotoFlags.Stickers); } } public TLInputMediaUploadedPhoto56() { } public TLInputMediaUploadedPhoto56(TLInputMediaUploadedPhoto inputMediaUploadedPhoto, TLString caption, TLVector stickers) { Flags = new TLInt(0); File = inputMediaUploadedPhoto.File; Caption = caption; Stickers = stickers; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), Caption.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Caption = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedPhotoFlags.Stickers, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); Caption.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers); } } public class TLInputMediaUploadedPhoto70 : TLInputMediaUploadedPhoto56, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaUploadedPhoto70; private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds); } } public TLInputMediaUploadedPhoto70() { } public TLInputMediaUploadedPhoto70(TLInputMediaUploadedPhoto inputMediaUploadedPhoto, TLString caption, TLVector stickers) { Flags = new TLInt(0); File = inputMediaUploadedPhoto.File; Caption = caption; Stickers = stickers; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), Caption.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers), ToBytes(TTLSeconds, Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Caption = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedPhotoFlags.Stickers, null, input); TTLSeconds = GetObject(Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); Caption.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers); ToStream(output, TTLSeconds, Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds); } } public class TLInputMediaUploadedPhoto75 : TLInputMediaUploadedPhoto70 { public new const uint Signature = TLConstructors.TLInputMediaUploadedPhoto75; public TLInputMediaUploadedPhoto75() { } public TLInputMediaUploadedPhoto75(TLInputMediaUploadedPhoto inputMediaUploadedPhoto, TLVector stickers) { Flags = new TLInt(0); File = inputMediaUploadedPhoto.File; Caption = TLString.Empty; Stickers = stickers; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), File.ToBytes(), ToBytes(Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers), ToBytes(TTLSeconds, Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); File = GetObject(input); Stickers = GetObject>(Flags, (int)InputMediaUploadedPhotoFlags.Stickers, null, input); TTLSeconds = GetObject(Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); File.ToStream(output); ToStream(output, Stickers, Flags, (int)InputMediaUploadedPhotoFlags.Stickers); ToStream(output, TTLSeconds, Flags, (int)InputMediaUploadedPhotoFlags.TTLSeconds); } } public class TLInputMediaPhoto : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaPhoto; public TLInputPhotoBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public class TLInputMediaPhoto28 : TLInputMediaPhoto, IInputMediaCaption { public new const uint Signature = TLConstructors.TLInputMediaPhoto28; public TLString Caption { get; set; } public TLInputMediaPhoto28() { } public TLInputMediaPhoto28(TLInputMediaPhoto inputMediaPhoto, TLString caption) { Id = inputMediaPhoto.Id; Caption = caption; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaPhoto70 : TLInputMediaPhoto28, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaPhoto70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaPhotoFlags.TTLSeconds); } } public TLInputMediaPhoto70() { } public TLInputMediaPhoto70(TLInputMediaPhoto inputMediaPhoto, TLString caption) { Flags = new TLInt(0); Id = inputMediaPhoto.Id; Caption = caption; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Caption.ToBytes(), ToBytes(TTLSeconds, Flags, (int) InputMediaPhotoFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Caption = GetObject(input); TTLSeconds = GetObject(Flags, (int) InputMediaPhotoFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Caption.ToStream(output); ToStream(output, TTLSeconds, Flags, (int)InputMediaPhotoFlags.TTLSeconds); } } public class TLInputMediaPhoto75 : TLInputMediaPhoto70 { public new const uint Signature = TLConstructors.TLInputMediaPhoto75; public TLInputMediaPhoto75() { } public TLInputMediaPhoto75(TLInputMediaPhoto inputMediaPhoto) { Flags = new TLInt(0); Id = inputMediaPhoto.Id; Caption = TLString.Empty; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaPhotoFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Caption = TLString.Empty; TTLSeconds = GetObject(Flags, (int)InputMediaPhotoFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, TTLSeconds, Flags, (int)InputMediaPhotoFlags.TTLSeconds); } } public class TLInputMediaGeoPoint : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaGeoPoint; public TLInputGeoPointBase GeoPoint { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), GeoPoint.ToBytes()); } public override TLObject FromStream(Stream input) { GeoPoint = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); GeoPoint.ToStream(output); } } public class TLInputMediaVenue : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaVenue; public TLInputGeoPointBase GeoPoint { get; set; } public TLString Title { get; set; } public TLString Address { get; set; } public TLString Provider { get; set; } public TLString VenueId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), GeoPoint.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes()); } public override TLObject FromStream(Stream input) { GeoPoint = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); GeoPoint.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); } } public class TLInputMediaVenue72 : TLInputMediaVenue { public new const uint Signature = TLConstructors.TLInputMediaVenue72; public TLString VenueType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), GeoPoint.ToBytes(), Title.ToBytes(), Address.ToBytes(), Provider.ToBytes(), VenueId.ToBytes(), VenueType.ToBytes()); } public override TLObject FromStream(Stream input) { GeoPoint = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); VenueType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); GeoPoint.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); VenueType.ToStream(output); } } public class TLInputMediaContact82 : TLInputMediaContact { public new const uint Signature = TLConstructors.TLInputMediaContact82; public TLString VCard { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), VCard.ToBytes()); } public override TLObject FromStream(Stream input) { PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); VCard = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); VCard.ToStream(output); } } public class TLInputMediaContact : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaContact; public TLString PhoneNumber { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), FirstName.ToBytes(), LastName.ToBytes()); } public override TLObject FromStream(Stream input) { PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); } } public class TLInputMediaUploadedVideo : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedVideo; public TLInputFileBase File { get; set; } public TLInt Duration { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), MimeType.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); MimeType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); MimeType.ToStream(output); } } public class TLInputMediaUploadedVideo28 : TLInputMediaUploadedVideo, IInputMediaCaption { public new const uint Signature = TLConstructors.TLInputMediaUploadedVideo28; public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedVideo36 : TLInputMediaUploadedVideo28 { public new const uint Signature = TLConstructors.TLInputMediaUploadedVideo36; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), MimeType.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); MimeType = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); MimeType.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedThumbVideo : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaUploadedThumbVideo; public TLInputFileBase File { get; set; } public TLInputFile Thumb { get; set; } public TLInt Duration { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public TLString MimeType { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), MimeType.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); MimeType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); MimeType.ToStream(output); } } public class TLInputMediaUploadedThumbVideo28 : TLInputMediaUploadedThumbVideo, IInputMediaCaption { public new const uint Signature = TLConstructors.TLInputMediaUploadedThumbVideo28; public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaUploadedThumbVideo36 : TLInputMediaUploadedThumbVideo28 { public new const uint Signature = TLConstructors.TLInputMediaUploadedThumbVideo36; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), File.ToBytes(), Thumb.ToBytes(), Duration.ToBytes(), W.ToBytes(), H.ToBytes(), MimeType.ToBytes(), Caption.ToBytes()); } public override TLObject FromStream(Stream input) { File = GetObject(input); Thumb = GetObject(input); Duration = GetObject(input); W = GetObject(input); H = GetObject(input); MimeType = GetObject(input); Caption = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); File.ToStream(output); Thumb.ToStream(output); Duration.ToStream(output); W.ToStream(output); H.ToStream(output); MimeType.ToStream(output); Caption.ToStream(output); } } public class TLInputMediaVideo : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaVideo; public TLInputVideoBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } } public class TLInputMediaVideo28 : TLInputMediaVideo, IInputMediaCaption { public new const uint Signature = TLConstructors.TLInputMediaVideo28; public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Caption.ToBytes()); } } public class TLInputMediaGifExternal : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaGifExternal; public TLString Url { get; set; } public TLString Q { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Q.ToBytes()); } } public class TLInputMediaPhotoExternal75 : TLInputMediaPhotoExternal70 { public new const uint Signature = TLConstructors.TLInputMediaPhotoExternal75; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Url.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaPhotoExternalFlags.TTLSeconds)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Url = GetObject(input); TTLSeconds = GetObject(Flags, (int)InputMediaPhotoFlags.TTLSeconds, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Url.ToStream(output); ToStream(output, TTLSeconds, Flags, (int)InputMediaPhotoFlags.TTLSeconds); } } public class TLInputMediaPhotoExternal70 : TLInputMediaPhotoExternal, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaPhotoExternal70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaPhotoExternalFlags.TTLSeconds); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Url.ToBytes(), Caption.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaPhotoExternalFlags.TTLSeconds)); } } public class TLInputMediaPhotoExternal : TLInputMediaBase, IInputMediaCaption { public const uint Signature = TLConstructors.TLInputMediaPhotoExternal; public TLString Url { get; set; } public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Caption.ToBytes()); } } public class TLInputMediaDocumentExternal75 : TLInputMediaDocumentExternal70 { public new const uint Signature = TLConstructors.TLInputMediaDocumentExternal75; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Url.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaDocumentExternalFlags.TTLSeconds)); } } public class TLInputMediaDocumentExternal70 : TLInputMediaDocumentExternal, IInputTTLMedia { public new const uint Signature = TLConstructors.TLInputMediaDocumentExternal70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)InputMediaDocumentExternalFlags.TTLSeconds); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Url.ToBytes(), Caption.ToBytes(), ToBytes(TTLSeconds, Flags, (int)InputMediaDocumentExternalFlags.TTLSeconds)); } } public class TLInputMediaDocumentExternal : TLInputMediaBase, IInputMediaCaption { public const uint Signature = TLConstructors.TLInputMediaDocumentExternal; public TLString Url { get; set; } public TLString Caption { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Caption.ToBytes()); } } public class TLInputMediaGame : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaGame; public TLInputGameBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public class TLInputMediaInvoice73 : TLInputMediaInvoice { public new const uint Signature = TLConstructors.TLInputMediaInvoice73; public TLDataJSON ProviderData { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Title.ToBytes(), Description.ToBytes(), ToBytes(Photo, Flags, (int)InputMediaInvoiceFlags.Photo), Invoice.ToBytes(), Payload.ToBytes(), Provider.ToBytes(), ProviderData.ToBytes(), StartParam.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Title = GetObject(input); Description = GetObject(input); Photo = GetObject(Flags, (int)InputMediaInvoiceFlags.Photo, null, input); Invoice = GetObject(input); Payload = GetObject(input); Provider = GetObject(input); ProviderData = GetObject(input); StartParam = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Title.ToStream(output); Description.ToStream(output); ToStream(output, Photo, Flags, (int)InputMediaInvoiceFlags.Photo); Invoice.ToStream(output); Payload.ToStream(output); Provider.ToStream(output); ProviderData.ToStream(output); StartParam.ToStream(output); } } public class TLInputMediaInvoice : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaInvoice; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Title { get; set; } public TLString Description { get; set; } private TLInputWebDocument _photo; public TLInputWebDocument Photo { get { return _photo; } set { SetField(out _photo, value, ref _flags, (int) InputMediaInvoiceFlags.Photo); } } public TLInvoice Invoice { get; set; } public TLString Payload { get; set; } public TLString Provider { get; set; } public TLString StartParam { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Title.ToBytes(), Description.ToBytes(), ToBytes(Photo, Flags, (int) InputMediaInvoiceFlags.Photo), Invoice.ToBytes(), Payload.ToBytes(), Provider.ToBytes(), StartParam.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Title = GetObject(input); Description = GetObject(input); Photo = GetObject(Flags, (int) InputMediaInvoiceFlags.Photo, null, input); Invoice = GetObject(input); Payload = GetObject(input); Provider = GetObject(input); StartParam = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Title.ToStream(output); Description.ToStream(output); ToStream(output, Photo, Flags, (int) InputMediaInvoiceFlags.Photo); Invoice.ToStream(output); Payload.ToStream(output); Provider.ToStream(output); StartParam.ToStream(output); } } public class TLInputMediaGeoLive : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputMediaGeoLive; public TLInputGeoPointBase GeoPoint { get; set; } public TLInt Period { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), GeoPoint.ToBytes(), Period.ToBytes()); } public override TLObject FromStream(Stream input) { GeoPoint = GetObject(input); Period = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); GeoPoint.ToStream(output); Period.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLInputMessageEntityMentionName.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/TLInputMessagesFilter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum InputMessagesFilterPhoneCallsFlags { Missed = 0x1, // 0 } public abstract class TLInputMessagesFilterBase : TLObject { } public class TLInputMessagesFilterEmpty : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterPhoto : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterPhoto; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterVideo : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterVideo; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterPhotoVideo : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterPhotoVideo; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterPhotoVideoDocument : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterPhotoVideoDocument; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterDocument : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterDocument; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterAudio : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterAudio; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterAudioDocuments : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterAudioDocuments; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterUrl : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessageFilterUrl; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterGif : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterGif; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterVoice : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterVoice; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterMusic : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterMusic; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterChatPhotos : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterChatPhotos; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterPhoneCalls : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterPhoneCalls; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Missed { get { return IsSet(Flags, (int) InputMessagesFilterPhoneCallsFlags.Missed); } set { SetUnset(ref _flags, value, (int) InputMessagesFilterPhoneCallsFlags.Missed); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } } public class TLInputMessagesFilterRoundVoice : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterRoundVoice; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterRoundVideo : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterRoundVideo; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterMyMentions : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterMyMentions; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterGeo : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterGeo; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputMessagesFilterContacts : TLInputMessagesFilterBase { public const uint Signature = TLConstructors.TLInputMessagesFilterContacts; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/TLInputNotifyPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { public abstract class TLInputNotifyPeerBase : TLObject { } public class TLInputNotifyPeer : TLInputNotifyPeerBase { public const uint Signature = TLConstructors.TLInputNotifyPeer; public TLInputPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } public override string ToString() { return "inputNotifyPeer " + Peer; } } public class TLInputNotifyUsers : TLInputNotifyPeerBase { public const uint Signature = TLConstructors.TLInputNotifyUsers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override string ToString() { return "inputNotifyUsers"; } } public class TLInputNotifyChats : TLInputNotifyPeerBase { public const uint Signature = TLConstructors.TLInputNotifyChats; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override string ToString() { return "inputNotifyChats"; } } [Obsolete] public class TLInputNotifyAll : TLInputNotifyPeerBase { public const uint Signature = TLConstructors.TLInputNotifyAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override string ToString() { return "inputNotifyAll"; } } } ================================================ FILE: Telegram.Api/TL/TLInputPaymentCredentials.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum InputPaymentCredentials { Save = 0x1, // 0 } public abstract class TLInputPaymentCredentialsBase : TLObject { } public class TLInputPaymentCredentialsSaved : TLInputPaymentCredentialsBase { public const uint Signature = TLConstructors.TLInputPaymentCredentialsSaved; public TLString Id { get; set; } public TLString TmpPassword { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), TmpPassword.ToBytes()); } } public class TLInputPaymentCredentials : TLInputPaymentCredentialsBase { public const uint Signature = TLConstructors.TLInputPaymentCredentials; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Save { get { return IsSet(Flags, (int) InputPaymentCredentials.Save); } set { SetUnset(ref _flags, value, (int) InputPaymentCredentials.Save); } } public TLDataJSON Data { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Data.ToBytes()); } } public class TLInputPaymentCredentialsApplePay : TLInputPaymentCredentialsBase { public const uint Signature = TLConstructors.TLInputPaymentCredentialsApplePay; public TLDataJSON PaymentData { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PaymentData.ToBytes()); } } public class TLInputPaymentCredentialsAndroidPay : TLInputPaymentCredentialsBase { public const uint Signature = TLConstructors.TLInputPaymentCredentialsAndroidPay; public TLDataJSON PaymentToken { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PaymentToken.ToBytes()); } } public class TLInputPaymentCredentialsAndroidPay74 : TLInputPaymentCredentialsAndroidPay { public new const uint Signature = TLConstructors.TLInputPaymentCredentialsAndroidPay74; public TLString GoogleTransactionId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PaymentToken.ToBytes(), GoogleTransactionId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputPeer.cs ================================================ using System.Linq; namespace Telegram.Api.TL { abstract class TLInputPeer : TLObject { } class TLInputPeerEmpty : TLInputPeer { public const uint Signature = TLConstructors.TLInputPeerEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLInputPeerEmpty--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override string ToString() { return "TLInputPeerEmpty"; } } class TLInputPeerSelf : TLInputPeer { public const uint Signature = TLConstructors.TLInputPeerSelf; public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLInputPeerSelf--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override string ToString() { return "TLInputPeerSelf"; } } class TLInputPeerContact : TLInputPeer { public const uint Signature = TLConstructors.TLInputPeerContact; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLInputPeerContact--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature) .Concat(UserId.ToBytes()) .ToArray(); } public override string ToString() { return "UserId " + UserId; } } class TLInputPeerForeign : TLInputPeer { public const uint Signature = TLConstructors.TLInputPeerForeign; public TLInt UserId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLInputPeerForeign--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature) .Concat(UserId.ToBytes()) .Concat(AccessHash.ToBytes()) .ToArray(); } public override string ToString() { return "UserId " + UserId + " AccessHash " + AccessHash; } } class TLInputPeerChat : TLInputPeer { public const uint Signature = TLConstructors.TLInputPeerChat; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { TLUtils.WriteLine("--Parse TLInputPeerChat--"); bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature) .Concat(ChatId.ToBytes()) .ToArray(); } public override string ToString() { return "ChatId " + ChatId; } } } ================================================ FILE: Telegram.Api/TL/TLInputPeerBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputPeerBase : TLObject { } public class TLInputPeerEmpty : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerEmpty; #region Additional public TLInt UserId { get; set; } public TLInt SelfId { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override string ToString() { return "TLInputPeerEmpty"; } } public class TLInputPeerSelf : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerSelf; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override string ToString() { return "TLInputPeerSelf"; } } public class TLInputPeerContact : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerContact; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(TLInputPeerUser.Signature), UserId.ToBytes(), new TLLong(0).ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerContact user_id={0}", UserId); } } public class TLInputPeerForeign : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerForeign; public TLInt UserId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(TLInputPeerUser.Signature), UserId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerForeign user_id={0} access_hash={1}", UserId, AccessHash); } } public class TLInputPeerChat : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerChat; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerChat chat_id={0}", ChatId); } } public class TLInputPeerBroadcast : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerBroadcast; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerBroadcast chat_id={0}", ChatId); } } public class TLInputPeerUser : TLInputPeerBase { public const uint Signature = TLConstructors.TLInputPeerUser; public TLInt UserId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerUser user_id={0} access_hash={1}", UserId, AccessHash); } } public class TLInputPeerChannel : TLInputPeerBroadcast { public new const uint Signature = TLConstructors.TLInputPeerChannel; public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerChannel channel_id={0} access_hash={1}", ChatId, AccessHash); } } public class TLInputPeerFeed : TLInputPeerBroadcast { public new const uint Signature = TLConstructors.TLInputPeerFeed; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ChatId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputPeerFeed feed_id={0}", ChatId); } } } ================================================ FILE: Telegram.Api/TL/TLInputPeerNotifyEvents.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { public abstract class TLInputPeerNotifyEventsBase : TLObject { } [Obsolete] public class TLInputPeerNotifyEventsEmpty : TLInputPeerNotifyEventsBase { public const uint Signature = TLConstructors.TLInputPeerNotifyEventsEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } [Obsolete] public class TLInputPeerNotifyEventsAll : TLInputPeerNotifyEventsBase { public const uint Signature = TLConstructors.TLInputPeerNotifyEventsAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api/TL/TLInputPeerNotifySettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLInputPeerNotifySettings78 : TLInputPeerNotifySettings48 { public new const uint Signature = TLConstructors.TLInputPeerNotifySettings78; protected TLInt _muteUntil; public override TLInt MuteUntil { get { return _muteUntil; } set { SetField(out _muteUntil, value, ref _flags, (int)PeerNotifySettingsFlags.MuteUntil); } } protected TLString _sound; public override TLString Sound { get { return _sound; } set { SetField(out _sound, value, ref _flags, (int)PeerNotifySettingsFlags.Sound); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(ShowPreviews, Flags, (int)PeerNotifySettingsFlags.ShowPreviews), ToBytes(Silent, Flags, (int)PeerNotifySettingsFlags.Silent), ToBytes(MuteUntil, Flags, (int)PeerNotifySettingsFlags.MuteUntil), ToBytes(Sound, Flags, (int)PeerNotifySettingsFlags.Sound)); } public override string ToString() { return string.Format("mute_until={0} sound={1} show_previews={2} silent={3}", MuteUntil, Sound, ShowPreviews, Silent); } } public class TLInputPeerNotifySettings48 : TLInputPeerNotifySettings { public new const uint Signature = TLConstructors.TLInputPeerNotifySettings48; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool ShowPreviews { get { return new TLBool(IsSet(Flags, (int)PeerNotifySettingsFlags.ShowPreviews)); } set { SetUnset(ref _flags, value != null && value.Value, (int)PeerNotifySettingsFlags.ShowPreviews); } } public TLBool Silent { get { return new TLBool(IsSet(Flags, (int)PeerNotifySettingsFlags.Silent)); } set { SetUnset(ref _flags, value != null && value.Value, (int)PeerNotifySettingsFlags.Silent); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), MuteUntil.ToBytes(), Sound.ToBytes()); } public override string ToString() { return string.Format("mute_until={0} sound={1} show_previews={2} silent={3}", MuteUntil, Sound, ShowPreviews, Silent); } } public class TLInputPeerNotifySettings : TLObject { public const uint Signature = TLConstructors.TLInputPeerNotifySettings; public virtual TLInt MuteUntil { get; set; } public virtual TLString Sound { get; set; } public virtual TLBool ShowPreviews { get; set; } public TLInt EventsMask { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MuteUntil.ToBytes(), Sound.ToBytes(), ShowPreviews.ToBytes(), EventsMask.ToBytes()); } public override string ToString() { return string.Format("mute_until={0} sound={1} show_previews={2} events_mask={3}", MuteUntil, Sound, ShowPreviews, EventsMask); } } } ================================================ FILE: Telegram.Api/TL/TLInputPhoneCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInputPhoneCall : TLObject { public const uint Signature = TLConstructors.TLInputPhoneCall; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLInputPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputPhotoBase : TLObject { } public class TLInputPhotoEmpty : TLInputPhotoBase { public const uint Signature = TLConstructors.TLInputPhotoEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return "TLInputPhotoEmpty"; } } public class TLInputPhoto : TLInputPhotoBase { public const uint Signature = TLConstructors.TLInputPhoto; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); } public override string ToString() { return string.Format("TLInputPhoto id={0}", Id); } } } ================================================ FILE: Telegram.Api/TL/TLInputPhotoCrop.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputPhotoCropBase : TLObject { } public class TLInputPhotoCropAuto : TLInputPhotoCropBase { public const uint Signature = TLConstructors.TLInputPhotoCropAuto; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputPhotoCrop : TLInputPhotoCropBase { public const uint Signature = TLConstructors.TLInputPhotoCrop; public TLDouble CropLeft { get; set; } public TLDouble CropTop { get; set; } public TLDouble CropWidth { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); CropLeft = GetObject(bytes, ref position); CropTop = GetObject(bytes, ref position); CropWidth = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), CropLeft.ToBytes(), CropTop.ToBytes(), CropWidth.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputPrivacyKey.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputPrivacyKeyBase : TLObject { } public class TLInputPrivacyKeyStatusTimestamp : TLInputPrivacyKeyBase { public const uint Signature = TLConstructors.TLInputPrivacyKeyStatusTimestamp; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyKeyChatInvite : TLInputPrivacyKeyBase { public const uint Signature = TLConstructors.TLInputPrivacyKeyChatInvite; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyKeyPhoneCall : TLInputPrivacyKeyBase { public const uint Signature = TLConstructors.TLInputPrivacyKeyPhoneCall; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLInputPrivacyRule.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputPrivacyRuleBase : TLObject { } public class TLInputPrivacyValueAllowContacts : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueAllowContacts; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyValueAllowAll : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueAllowAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyValueAllowUsers : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueAllowUsers; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Users = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Users.ToBytes()); } } public class TLInputPrivacyValueDisallowContacts : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueDisallowContacts; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyValueDisallowAll : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueDisallowAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } public class TLInputPrivacyValueDisallowUsers : TLInputPrivacyRuleBase { public const uint Signature = TLConstructors.TLInputPrivacyValueDisallowUsers; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Users = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Users.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputReportReason.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputReportReasonBase : TLObject { } public class TLInputReportReasonSpam : TLInputReportReasonBase { public const uint Signature = TLConstructors.TLInputReportReasonSpam; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLInputReportReasonViolence : TLInputReportReasonBase { public const uint Signature = TLConstructors.TLInputReportReasonViolence; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLInputReportReasonPornography : TLInputReportReasonBase { public const uint Signature = TLConstructors.TLInputReportReasonPornography; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLInputReportReasonCopyright : TLInputReportReasonBase { public const uint Signature = TLConstructors.TLInputReportReasonCopyright; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLInputReportReasonOther : TLInputReportReasonBase { public const uint Signature = TLConstructors.TLInputReportReasonOther; public TLString Text { get; set; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLInputSingleMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum InputSingleMediaFlags { Entities = 0x1, // 0 } public class TLInputSingleMedia76 : TLInputSingleMedia75 { public new const uint Signature = TLConstructors.TLInputSingleMedia76; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Media.ToBytes(), RandomId.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int)InputSingleMediaFlags.Entities)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Media = GetObject(input); RandomId = GetObject(input); Message = GetObject(input); Entities = GetObject>(Flags, (int)InputSingleMediaFlags.Entities, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Media.ToStream(output); RandomId.ToStream(output); Message.ToStream(output); ToStream(output, Entities, Flags, (int)InputSingleMediaFlags.Entities); } } public class TLInputSingleMedia75 : TLInputSingleMedia { public new const uint Signature = TLConstructors.TLInputSingleMedia75; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Message { get; set; } protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int) InputSingleMediaFlags.Entities); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Media.ToBytes(), Flags.ToBytes(), RandomId.ToBytes(), Message.ToBytes(), ToBytes(Entities, Flags, (int) InputSingleMediaFlags.Entities)); } public override TLObject FromStream(Stream input) { Media = GetObject(input); Flags = GetObject(input); RandomId = GetObject(input); Message = GetObject(input); Entities = GetObject>(Flags, (int) InputSingleMediaFlags.Entities, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Media.ToStream(output); Flags.ToStream(output); RandomId.ToStream(output); Message.ToStream(output); ToStream(output, Entities, Flags, (int) InputSingleMediaFlags.Entities); } } public class TLInputSingleMedia : TLInputMediaBase { public const uint Signature = TLConstructors.TLInputSingleMedia; public TLInputMediaBase Media { get; set; } public TLLong RandomId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Media.ToBytes(), RandomId.ToBytes()); } public override TLObject FromStream(Stream input) { Media = GetObject(input); RandomId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Media.ToStream(output); RandomId.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLInputStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputStickerSetBase : TLObject { public abstract string Name { get; } } public class TLInputStickerSetEmpty : TLInputStickerSetBase { public const uint Signature = TLConstructors.TLInputStickerSetEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return GetType().Name; } public override string Name { get { return @"tlg/empty"; } } } public class TLInputStickerSetId : TLInputStickerSetBase { public const uint Signature = TLConstructors.TLInputStickerSetId; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); } public override string ToString() { return string.Format("{0} Id={1}", GetType().Name, Id); } public override string Name { get { return Id.ToString(); } } } public class TLInputStickerSetShortName : TLInputStickerSetBase { public const uint Signature = TLConstructors.TLInputStickerSetShortName; public TLString ShortName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ShortName = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), ShortName.ToBytes()); } public override TLObject FromStream(Stream input) { ShortName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ShortName.ToStream(output); } public override string ToString() { return string.Format("{0} ShortName={1}", GetType().Name, ShortName); } public override string Name { get { return ShortName.ToString(); } } } } ================================================ FILE: Telegram.Api/TL/TLInputStickeredMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputStickeredMediaBase : TLObject { } public class TLInputStickeredMediaPhoto : TLInputStickeredMediaBase { public const uint Signature = TLConstructors.TLInputStickeredMediaPhoto; public TLInputPhotoBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputStickeredMediaPhoto id=[{0}]", Id); } } public class TLInputStickeredMediaDocument : TLInputStickeredMediaBase { public const uint Signature = TLConstructors.TLInputStickeredMediaDocument; public TLInputDocumentBase Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputStickeredMediaDocument id=[{0}]", Id); } } } ================================================ FILE: Telegram.Api/TL/TLInputUser.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public interface IInputUserId { TLInt UserId { get; set; } } public abstract class TLInputUserBase : TLObject { } public class TLInputUserEmpty : TLInputUserBase { public const uint Signature = TLConstructors.TLInputUserEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override string ToString() { return "user_id=empty"; } } public class TLInputUserSelf : TLInputUserBase { public const uint Signature = TLConstructors.TLInputUserSelf; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override string ToString() { return "user_id=self"; } } public class TLInputUserContact : TLInputUserBase, IInputUserId { public const uint Signature = TLConstructors.TLInputUserContact; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(TLInputUser.Signature), UserId.ToBytes(), new TLLong(0).ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override string ToString() { return "user_id=" + UserId; } } public class TLInputUserForeign : TLInputUserBase, IInputUserId { public const uint Signature = TLConstructors.TLInputUserForeign; public TLInt UserId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(TLInputUser.Signature), UserId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return "user_id=" + UserId; } } public class TLInputUser : TLInputUserBase, IInputUserId { public const uint Signature = TLConstructors.TLInputUser; public TLInt UserId { get; set; } public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), UserId.ToBytes(), AccessHash.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); AccessHash.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); AccessHash = GetObject(input); return this; } public override string ToString() { return "user_id=" + UserId; } } } ================================================ FILE: Telegram.Api/TL/TLInputVideo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputVideoBase : TLObject { } public class TLInputVideoEmpty : TLInputVideoBase { public const uint Signature = TLConstructors.TLInputVideoEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputVideo : TLInputVideoBase { public const uint Signature = TLConstructors.TLInputVideo; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLInputWebDocument.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInputWebDocument : TLInputDocumentBase { public const uint Signature = TLConstructors.TLInputWebDocument; public TLString Url { get; set; } public TLInt Size { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public TLInt W { get { var attributeSize = Attributes.FirstOrDefault(x => x is IAttributeSize) as IAttributeSize; if (attributeSize != null) { return attributeSize.W; } return null; } } public TLInt H { get { var attributeSize = Attributes.FirstOrDefault(x => x is IAttributeSize) as IAttributeSize; if (attributeSize != null) { return attributeSize.H; } return null; } } public TLInt Duration { get { var attributeDuration = Attributes.FirstOrDefault(x => x is IAttributeDuration) as IAttributeDuration; if (attributeDuration != null) { return attributeDuration.Duration; } return null; } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Size.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Url = GetObject(input); Size = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); Size.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); } public override string ToString() { return string.Format("TLInputWebDocument url={0}", Url); } } } ================================================ FILE: Telegram.Api/TL/TLInt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Runtime.Serialization; namespace Telegram.Api.TL { [DataContract] public class TLInt : TLObject { [DataMember] public int Value { get; set; } public TLInt() { } public TLInt(int value) { Value = value; } public override TLObject FromBytes(byte[] bytes, ref int position) { Value = BitConverter.ToInt32(bytes, position); position += 4; return this; } public override byte[] ToBytes() { return BitConverter.GetBytes(Value); } public override TLObject FromStream(Stream input) { var buffer = new byte[4]; input.Read(buffer, 0, 4); Value = BitConverter.ToInt32(buffer, 0); return this; } public override void ToStream(Stream output) { output.Write(BitConverter.GetBytes(Value), 0, 4); } public override string ToString() { return Value.ToString(CultureInfo.InvariantCulture); } private static readonly Random _random = new Random(); public static TLInt Random() { var randomNumber = new byte[4]; var random = _random; random.NextBytes(randomNumber); return new TLInt { Value = BitConverter.ToInt32(randomNumber, 0) }; } } } ================================================ FILE: Telegram.Api/TL/TLInt128.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Org.BouncyCastle.Security; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLInt128 : TLObject { public byte[] Value { get; set; } public override byte[] ToBytes() { return Value; } public static TLInt128 Random() { var randomNumber = new byte[16]; var random = new SecureRandom(); random.NextBytes(randomNumber); return new TLInt128{ Value = randomNumber }; } public override TLObject FromBytes(byte[] bytes, ref int position) { Value = bytes.SubArray(position, 16); position += 16; return this; } } } ================================================ FILE: Telegram.Api/TL/TLInt256.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLInt256 : TLObject { public byte[] Value { get; set; } public override byte[] ToBytes() { return Value; } public static TLInt256 Random() { var randomNumber = new byte[32]; var random = new Random(); random.NextBytes(randomNumber); return new TLInt256 { Value = randomNumber }; } public override TLObject FromBytes(byte[] bytes, ref int position) { Value = bytes.SubArray(position, 32); position += 32; return this; } } } ================================================ FILE: Telegram.Api/TL/TLInviteText.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLInviteText : TLObject { public const uint Signature = TLConstructors.TLInviteText; public TLString Message { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLInvoice.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum InvoiceFlags { Test = 0x1, // 0 NameRequested = 0x2, // 1 PhoneRequested = 0x4, // 2 EmailRequested = 0x8, // 3 ShippingAddressRequested = 0x10, // 4 Flexible = 0x20, // 5 } public class TLInvoice : TLInputMediaBase { public const uint Signature = TLConstructors.TLInvoice; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Currency { get; set; } public TLVector Prices { get; set; } public bool Test { get { return IsSet(Flags, (int) InvoiceFlags.Test); } } public bool NameRequested { get { return IsSet(Flags, (int) InvoiceFlags.NameRequested); } } public bool PhoneRequested { get { return IsSet(Flags, (int) InvoiceFlags.PhoneRequested); } } public bool EmailRequested { get { return IsSet(Flags, (int) InvoiceFlags.EmailRequested); } } public bool ShippingAddressRequested { get { return IsSet(Flags, (int) InvoiceFlags.ShippingAddressRequested); } } public bool Flexible { get { return IsSet(Flags, (int) InvoiceFlags.Flexible); } } #region Additional public bool ReceiverRequested { get { return NameRequested || PhoneRequested || EmailRequested; } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Currency = GetObject(bytes, ref position); Prices = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Currency.ToBytes(), Prices.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Currency = GetObject(input); Prices = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Currency.ToStream(output); Prices.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLInvokeAfterMsg.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLInvokeAfterMsg : TLObject { public const uint Signature = TLConstructors.TLInvokeAfterMsg; public TLLong MsgId { get; set; } public TLObject Object { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MsgId.ToBytes(), Object.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLIpPort.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; namespace Telegram.Api.TL { public class TLIpPort : TLObject { public TLInt Ip { get; set; } public TLInt Port { get; set; } public override string ToString() { return string.Format("TLIpPort ip={0}({1}) port={2}", GetIpString(), Ip, Port); } public string GetIpString() { var ip = Ip.ToBytes(); return string.Format("{0}.{1}.{2}.{3}", ip[3], ip[2], ip[1], ip[0]); } public override TLObject FromBytes(byte[] bytes, ref int position) { Ip = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Ip = GetObject(input); Port = GetObject(input); return this; } public override void ToStream(Stream output) { Ip.ToStream(output); Port.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLKeyboardButton.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum KeyboardButtonSwitchInlineFlags { SamePeer = 0x1, // 0 } public abstract class TLKeyboardButtonBase : TLObject { public TLString Text { get; set; } } public class TLKeyboardButton : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButton; public TLKeyboardButton() { } public TLKeyboardButton(TLString text) { Text = text; } public override string ToString() { return string.Format("TLKeyboardButton text={0}", Text); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); } } public class TLKeyboardButtonUrl : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonUrl; public TLString Url { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLKeyboardButtonUrl text={0} url={1}", Text, Url); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Url.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Url = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); output.Write(Url.ToBytes()); } } public class TLKeyboardButtonCallback : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonCallback; public TLString Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Data = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLKeyboardButtonCallback text={0} data={1}", Text, Data); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Data.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Data = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); output.Write(Data.ToBytes()); } } public class TLKeyboardButtonRequestPhone : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonRequestPhone; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLKeyboardButtonRequestPhone text={0}", Text); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); } } public class TLKeyboardButtonRequestGeoLocation : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonRequestGeoLocation; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLKeyboardButtonRequestLocation text={0}", Text); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); } } public class TLKeyboardButtonSwitchInline : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonSwitchInline; public TLString Query { get; set; } #region Additional public TLUser Bot { get; set; } #endregion public override string ToString() { return string.Format("TLKeyboardButtonSwitchInline text={0} query={1}", Text, Query); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Query = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Query.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Query = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); output.Write(Query.ToBytes()); } } public class TLKeyboardButtonSwitchInline55 : TLKeyboardButtonSwitchInline { public new const uint Signature = TLConstructors.TLKeyboardButtonSwitchInline55; public TLInt Flags { get; set; } public bool IsSamePeer { get { return IsSet(Flags, (int) KeyboardButtonSwitchInlineFlags.SamePeer); } } public static string KeyboardButtonSwitchInlineFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (KeyboardButtonSwitchInlineFlags) flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { return string.Format("TLKeyboardButtonSwitchInline55 flags={0} text={1} query={2}", KeyboardButtonSwitchInlineFlagsString(Flags), Text, Query); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); Query = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Text.ToBytes(), Query.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Text = GetObject(input); Query = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Text.ToBytes()); output.Write(Query.ToBytes()); } } public class TLKeyboardButtonGame : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonGame; public override string ToString() { return string.Format("TLKeyboardButtonGame text={0}", Text); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); } } public class TLKeyboardButtonBuy : TLKeyboardButtonBase { public const uint Signature = TLConstructors.TLKeyboardButtonBuy; public override string ToString() { return string.Format("TLKeyboardButtonBuy text={0}", Text); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Text.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLKeyboardButtonRow.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLKeyboardButtonRow : TLObject { public const uint Signature = TLConstructors.TLKeyboardButtonRow; public TLVector Buttons { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Buttons = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Buttons.ToBytes()); } public override TLObject FromStream(Stream input) { Buttons = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Buttons.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLLabeledPrice.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLLabeledPrice : TLObject { public const uint Signature = TLConstructors.TLLabeledPrice; public TLString Label { get; set; } public TLLong Amount { get; set; } #region Additional public TLString Currency { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Label = GetObject(bytes, ref position); Amount = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Label.ToBytes(), Amount.ToBytes()); } public override TLObject FromStream(Stream input) { Label = GetObject(input); Amount = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Label.ToStream(output); Amount.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLLangPackDifference.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLLangPackDifference : TLObject { public const uint Signature = TLConstructors.TLLangPackDifference; public TLString LangCode { get; set; } public TLInt FromVersion { get; set; } public TLInt Version { get; set; } public TLVector Strings { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); LangCode = GetObject(bytes, ref position); FromVersion = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); Strings = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); LangCode.ToStream(output); FromVersion.ToStream(output); Version.ToStream(output); Strings.ToStream(output); } public override TLObject FromStream(Stream input) { LangCode = GetObject(input); FromVersion = GetObject(input); Version = GetObject(input); Strings = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLLangPackLanguage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLLangPackLanguage : TLObject { public const uint Signature = TLConstructors.TLLangPackLanguage; public TLString Name { get; set; } public TLString NativeName { get; set; } public TLString LangCode { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Name = GetObject(bytes, ref position); NativeName = GetObject(bytes, ref position); LangCode = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Name.ToStream(output); NativeName.ToStream(output); LangCode.ToStream(output); } public override TLObject FromStream(Stream input) { Name = GetObject(input); NativeName = GetObject(input); LangCode = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLLangPackString.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum LangPackStringPluralizedFlags { ZeroValue = 0x1, // 0 OneValue = 0x2, // 1 TwoValue = 0x4, // 2 FewValue = 0x8, // 3 ManyValue = 0x10, // 4 OtherValue = 0x20, // 5 } public abstract class TLLangPackStringBase : TLObject { } public class TLLangPackString : TLLangPackStringBase { public const uint Signature = TLConstructors.TLLangPackString; public TLString Key { get; set; } public TLString Value { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Key = GetObject(bytes, ref position); Value = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Key.ToStream(output); Value.ToStream(output); } public override TLObject FromStream(Stream input) { Key = GetObject(input); Value = GetObject(input); return this; } } public class TLLangPackStringPluralized : TLLangPackStringBase { public const uint Signature = TLConstructors.TLLangPackStringPluralized; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Key { get; set; } private TLString _zeroValue; public TLString ZeroValue { get { return _zeroValue; } set { SetField(out _zeroValue, value, ref _flags, (int) LangPackStringPluralizedFlags.ZeroValue); } } private TLString _oneValue; public TLString OneValue { get { return _oneValue; } set { SetField(out _oneValue, value, ref _flags, (int)LangPackStringPluralizedFlags.OneValue); } } private TLString _twoValue; public TLString TwoValue { get { return _twoValue; } set { SetField(out _twoValue, value, ref _flags, (int)LangPackStringPluralizedFlags.TwoValue); } } private TLString _fewValue; public TLString FewValue { get { return _fewValue; } set { SetField(out _fewValue, value, ref _flags, (int)LangPackStringPluralizedFlags.FewValue); } } private TLString _manyValue; public TLString ManyValue { get { return _manyValue; } set { SetField(out _manyValue, value, ref _flags, (int)LangPackStringPluralizedFlags.ManyValue); } } private TLString _otherValue; public TLString OtherValue { get { return _otherValue; } set { SetField(out _otherValue, value, ref _flags, (int)LangPackStringPluralizedFlags.OtherValue); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Key = GetObject(bytes, ref position); ZeroValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.ZeroValue, null, bytes, ref position); OneValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.OneValue, null, bytes, ref position); TwoValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.TwoValue, null, bytes, ref position); FewValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.FewValue, null, bytes, ref position); ManyValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.ManyValue, null, bytes, ref position); OtherValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.OtherValue, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Key.ToStream(output); ToStream(output, ZeroValue, Flags, (int)LangPackStringPluralizedFlags.ZeroValue); ToStream(output, OneValue, Flags, (int)LangPackStringPluralizedFlags.OneValue); ToStream(output, TwoValue, Flags, (int)LangPackStringPluralizedFlags.TwoValue); ToStream(output, FewValue, Flags, (int)LangPackStringPluralizedFlags.FewValue); ToStream(output, ManyValue, Flags, (int)LangPackStringPluralizedFlags.ManyValue); ToStream(output, OtherValue, Flags, (int)LangPackStringPluralizedFlags.OtherValue); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Key = GetObject(input); ZeroValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.ZeroValue, null, input); OneValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.OneValue, null, input); TwoValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.TwoValue, null, input); FewValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.FewValue, null, input); ManyValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.ManyValue, null, input); OtherValue = GetObject(Flags, (int)LangPackStringPluralizedFlags.OtherValue, null, input); return this; } } public class TLLangPackStringDeleted : TLLangPackStringBase { public const uint Signature = TLConstructors.TLLangPackStringDeleted; public TLString Key { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Key = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Key.ToStream(output); } public override TLObject FromStream(Stream input) { Key = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLLinkBase : TLObject { public TLUserBase User { get; set; } } public class TLLink : TLLinkBase { public const uint Signature = TLConstructors.TLLink; public TLMyLinkBase MyLink { get; set; } public TLForeignLinkBase ForeignLink { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MyLink = GetObject(bytes, ref position); ForeignLink = GetObject(bytes, ref position); User = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { MyLink = GetObject(input); ForeignLink = GetObject(input); User = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); MyLink.ToStream(output); ForeignLink.ToStream(output); User.ToStream(output); } } public class TLLink24 : TLLinkBase { public const uint Signature = TLConstructors.TLLink24; public TLContactLinkBase MyLink { get; set; } public TLContactLinkBase ForeignLink { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MyLink = GetObject(bytes, ref position); ForeignLink = GetObject(bytes, ref position); User = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { MyLink = GetObject(input); ForeignLink = GetObject(input); User = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); MyLink.ToStream(output); ForeignLink.ToStream(output); User.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLLong.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Runtime.Serialization; using Org.BouncyCastle.Security; namespace Telegram.Api.TL { [DataContract] public class TLLong : TLObject { [DataMember] public Int64 Value { get; set; } public TLLong() { } public TLLong(long value) { Value = value; } private static readonly object _randomSyncRoot = new object(); private static Random _random; public static TLLong Random() { //System.Diagnostics.Debug.WriteLine("TLLong.Random 1"); var randomNumber = new byte[8]; lock (_randomSyncRoot) { //System.Diagnostics.Debug.WriteLine("TLLong.Random 2"); if (_random == null) { //System.Diagnostics.Debug.WriteLine("TLLong.Random 3"); _random = new Random(); // Note: SecureRandom doesnt work with Creators Update //System.Diagnostics.Debug.WriteLine("TLLong.Random 4"); } //System.Diagnostics.Debug.WriteLine("TLLong.Random 5"); _random.NextBytes(randomNumber); } //System.Diagnostics.Debug.WriteLine("TLLong.Random 6"); return new TLLong { Value = BitConverter.ToInt64(randomNumber, 0) }; } public override TLObject FromBytes(byte[] bytes, ref int position) { Value = BitConverter.ToInt64(bytes, position); position += 8; return this; } public override byte[] ToBytes() { return BitConverter.GetBytes(Value); } public override TLObject FromStream(Stream input) { var buffer = new byte[8]; input.Read(buffer, 0, 8); Value = BitConverter.ToInt64(buffer, 0); return this; } public override void ToStream(Stream output) { output.Write(BitConverter.GetBytes(Value), 0, 8); } public override string ToString() { return Value.ToString(CultureInfo.InvariantCulture);// + " " + TLUtils.MessageIdString(this); } } } ================================================ FILE: Telegram.Api/TL/TLMaskCoords.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLMaskCoords : TLObject { public const uint Signature = TLConstructors.TLMaskCoords; public TLInt N { get; set; } public TLDouble X { get; set; } public TLDouble Y { get; set; } public TLDouble Zoom { get; set; } public TLMaskCoords() { } public TLMaskCoords(int n, double x, double y, double zoom) { N = new TLInt(n); X = new TLDouble(x); Y = new TLDouble(y); Zoom = new TLDouble(zoom); } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), N.ToBytes(), X.ToBytes(), Y.ToBytes(), Zoom.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); N = GetObject(bytes, ref position); X = GetObject(bytes, ref position); Y = GetObject(bytes, ref position); Zoom = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); N.ToStream(output); X.ToStream(output); Y.ToStream(output); Zoom.ToStream(output); } public override TLObject FromStream(Stream input) { N = GetObject(input); X = GetObject(input); Y = GetObject(input); Zoom = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessage.Encrypted.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLEncryptedMessageBase : TLObject { public TLLong RandomId { get; set; } public TLInt ChatId { get; set; } public TLInt Date { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { RandomId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } public class TLEncryptedMessage : TLEncryptedMessageBase { public const uint Signature = TLConstructors.TLEncryptedMessage; public TLEncryptedFileBase File { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); File = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); RandomId.ToStream(output); ChatId.ToStream(output); Date.ToStream(output); Bytes.ToStream(output); File.ToStream(output); } public override TLObject FromStream(Stream input) { RandomId = GetObject(input); ChatId = GetObject(input); Date = GetObject(input); Bytes = GetObject(input); File = GetObject(input); return this; } } public class TLEncryptedMessageService : TLEncryptedMessageBase { public const uint Signature = TLConstructors.TLEncryptedMessageService; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); base.FromBytes(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); RandomId.ToStream(output); ChatId.ToStream(output); Date.ToStream(output); Bytes.ToStream(output); } public override TLObject FromStream(Stream input) { RandomId = GetObject(input); ChatId = GetObject(input); Date = GetObject(input); Bytes = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Windows; #if WIN_RT using Windows.UI.Xaml; #endif using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.Extensions; using Telegram.Api.TL.Interfaces; using Telegram.Logs; namespace Telegram.Api.TL { public enum MessageStatus { Sending = 1, Confirmed = 0, Failed = 2, Read = 3, Broadcast = 4, Compressing = 5, } [Flags] public enum MessageCustomFlags { FwdMessageId = 0x1, FwdFromChannelPeer = 0x2, BotInlineResult = 0x4, Documents = 0x8, InputPeer = 0x10, } [Flags] public enum MessageFlags { Unread = 0x1, // 0 Out = 0x2, // 1 FwdFrom = 0x4, // 2 ReplyToMsgId = 0x8, // 3 Mentioned = 0x10, // 4 MediaUnread = 0x20, // 5 ReplyMarkup = 0x40, // 6 Entities = 0x80, // 7 FromId = 0x100, // 8 Media = 0x200, // 9 Views = 0x400, // 10 ViaBotId = 0x800, // 11 Silent = 0x2000, // 13 Post = 0x4000, // 14 EditDate = 0x8000, // 15 PostAuthor = 0x10000, // 16 GroupedId = 0x20000, // 17 } public interface IReplyToMsgId { TLInt ReplyToMsgId { get; set; } TLMessageBase Reply { get; set; } ReplyInfo ReplyInfo { get; } TLPeerBase ToId { get; set; } } public abstract class TLMessageBase : TLObject, ISelectable { public virtual TLObject FwdFrom { get; set; } public virtual Visibility ViaBotVisibility { get { return Visibility.Collapsed; } } public virtual Visibility ReplyOrViaBotVisibility { get { return Visibility.Collapsed; } } public virtual Visibility FwdViaBotVisibility { get { return Visibility.Collapsed; } } public virtual TLUserBase ViaBot { get { return null; } } public static string MessageFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (MessageFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public static string MessageCustomFlagsString(TLLong flags) { if (flags == null) return string.Empty; var list = (MessageCustomFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public abstract int DateIndex { get; set; } private TLLong _randomId; public TLLong RandomId { get { return _randomId; } set { _randomId = value; } } public long RandomIndex { get { return RandomId != null ? RandomId.Value : 0; } set { RandomId = new TLLong(value); } } /// /// Message Id /// public TLInt Id { get; set; } public int Index { get { return Id != null ? Id.Value : 0; } set { Id = new TLInt(value); } } public virtual void Update(TLMessageBase message) { Id = message.Id; Status = message.Status; } public override string ToString() { return "Id=" + Index + " RndId=" + RandomIndex; } #region Additional public string WebPageTitle { get; set; } public bool NoWebpage { get; set; } public virtual TLMessageBase Reply { get; set; } public virtual ReplyInfo ReplyInfo { get { return null; } } public virtual Visibility ReplyVisibility { get { return Visibility.Collapsed; } } public virtual double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public MessageStatus _status; public virtual MessageStatus Status { get { return _status; } set { _status = value; } } public bool _isAnimated; public virtual bool ShowFrom { get { return false; } } private bool _isSelected; public bool IsSelected { get { return _isSelected; } set { SetField(ref _isSelected, value, () => IsSelected); } } public abstract Visibility SelectionVisibility { get; } private bool _isHighlighted; public bool IsHighlighted { get { return _isHighlighted; } set { SetField(ref _isHighlighted, value, () => IsHighlighted); } } public virtual int MediaSize { get { return 0; } } public virtual Visibility MediaSizeVisibility { get { return Visibility.Collapsed; } } public virtual bool IsSelf() { return false; } public virtual bool IsAudioVideoMessage() { return false; } public virtual bool HasTTL() { return false; } public static bool HasTTL(TLMessageMediaBase mediaBase) { var mediaPhoto = mediaBase as TLMessageMediaPhoto70; if (mediaPhoto != null && mediaPhoto.TTLSeconds != null && mediaPhoto.TTLSeconds.Value > 0) { return true; } var mediaDocument = mediaBase as TLMessageMediaDocument70; if (mediaDocument != null && mediaDocument.TTLSeconds != null && mediaDocument.TTLSeconds.Value > 0) { return true; } return false; } public virtual bool IsExpired() { return false; } public static bool IsExpired(TLMessageMediaBase mediaBase) { var mediaPhoto = mediaBase as TLMessageMediaPhoto70; if (mediaPhoto != null && mediaPhoto.Photo == null && mediaPhoto.TTLSeconds != null && mediaPhoto.TTLSeconds.Value > 0) { return true; } var mediaDocument = mediaBase as TLMessageMediaDocument70; if (mediaDocument != null && mediaDocument.Document == null && mediaDocument.TTLSeconds != null && mediaDocument.TTLSeconds.Value > 0) { return true; } return false; } public virtual bool IsSticker() { return false; } public static bool IsSticker(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null && document22.DocumentSize > 0 && document22.DocumentSize < Constants.StickerMaxSize) { var documentStickerAttribute = document22.Attributes.FirstOrDefault(x => x is TLDocumentAttributeSticker); if (documentStickerAttribute != null && string.Equals(document22.MimeType.ToString(), "image/webp", StringComparison.OrdinalIgnoreCase)) { return true; } } #endif return false; } public static bool IsSticker(IAttributes attributes, TLInt size) { #if WP8 if (size != null && size.Value > 0 && size.Value < Constants.StickerMaxSize) { var documentStickerAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeSticker); if (documentStickerAttribute != null) { return true; } } #endif return false; } public virtual bool IsGif() { return false; } public static bool IsGif(IAttributes attributes, TLInt size) { #if WP8 if (size == null || (size.Value > 0 && size.Value < Constants.GifMaxSize)) { var animatedAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAnimated); var videoAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeVideo); if (animatedAttribute != null && videoAttribute != null) { return true; } } #endif return false; } public static bool IsGif(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null && TLString.Equals(document22.MimeType, new TLString("video/mp4"), StringComparison.OrdinalIgnoreCase)) { return IsGif(document22, document22.Size); } var documentExternal = document as TLDocumentExternal; if (documentExternal != null && string.Equals(documentExternal.Type.ToString(), "gif", StringComparison.OrdinalIgnoreCase)) { return IsGif(documentExternal, null); } #endif return false; } public virtual bool IsMusic() { return false; } public static bool IsMusic(IAttributes attributes, TLInt size) { #if WP8 if (size == null || size.Value > 0) { var audioAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (audioAttribute != null && !audioAttribute.Voice) { return true; } } #endif return false; } public static bool IsMusic(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null) { return IsMusic(document22, document22.Size); } #endif return false; } public virtual bool IsVoice() { return false; } public static bool IsVoice(IAttributes attributes, TLInt size) { #if WP8 //if (size == null || size.Value > 0) // TLInlineBotResult non cached voice with unknown size { var audioAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (audioAttribute != null && audioAttribute.Voice) { return true; } } #endif return false; } public static bool IsVoice(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null) { return IsVoice(document22, document22.Size); } #endif return false; } public virtual bool IsRoundVideo() { return false; } public static bool IsRoundVideo(IAttributes attributes, TLInt size) { #if WP8 if (size == null || size.Value > 0) { var videoAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeVideo66) as TLDocumentAttributeVideo66; var animatedAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAnimated) as TLDocumentAttributeAnimated; if (videoAttribute != null && animatedAttribute == null) { return videoAttribute.RoundMessage; } } #endif return false; } public static bool IsRoundVideo(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null) { return IsRoundVideo(document22, document22.Size); } #endif return false; } public virtual bool IsVideo() { return false; } public static bool IsVideo(IAttributes attributes, TLInt size) { #if WP8 if (size == null || size.Value > 0) { var videoAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeVideo) as TLDocumentAttributeVideo; var animatedAttribute = attributes.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAnimated) as TLDocumentAttributeAnimated; if (videoAttribute != null && animatedAttribute == null) { return true; } } #endif return false; } public static bool IsVideo(TLDocumentBase document) { #if WP8 var document22 = document as TLDocument22; if (document22 != null) { return IsVideo(document22, document22.Size); } #endif return false; } public TLMessageBase Self { get { return this; } } public bool ShowSeparator { get; set; } #endregion public virtual void Edit(TLMessageBase messageBase) { } } public class ReplyInfo { public TLInt ReplyToMsgId { get; set; } public TLLong ReplyToRandomMsgId { get; set; } public TLObject Reply { get; set; } } public abstract class TLMessageCommon : TLMessageBase { private TLInt _fromId; public virtual TLInt FromId { get { return _fromId; } set { _fromId = value; } } public TLPeerBase ToId { get; set; } public virtual TLBool Out { get; set; } private TLBool _unread; public virtual void SetUnread(TLBool value) { _unread = value; } public virtual void SetUnreadSilent(TLBool value) { _unread = value; } public virtual TLBool Unread { get { return _unread; } set { SetField(ref _unread, value, () => Unread); NotifyOfPropertyChange(() => Status); } } public bool IsChannelMessage { get { if (FromId == null || FromId.Value <= 0) return true; if (ToId is TLPeerChannel) { var cacheService = InMemoryCacheService.Instance; var channel = cacheService.GetChat(ToId.Id) as TLChannel; if (channel != null && channel.IsBroadcast) return true; } return false; } } public override MessageStatus Status { get { if (_status == MessageStatus.Broadcast) { return _status; } if (!Unread.Value) { return MessageStatus.Read; } return _status; } set { if (_status == MessageStatus.Broadcast) return; if (_status == MessageStatus.Read) return; //System.Diagnostics.Debug.WriteLine("SetStatus hash={0} status={1}", GetHashCode(), value); SetField(ref _status, value, () => Status); } } public override int DateIndex { get { return Date.Value; } set { Date = new TLInt(value); } } public TLInt _date; public TLInt Date { get { return _date; } set { _date = value; } } public virtual Visibility ShareButtonVisibility { get { return Visibility.Collapsed; } } public override bool IsSelf() { var peerUser = ToId as TLPeerUser; if (peerUser != null) { return FromId.Value != -1 && FromId.Value == peerUser.Id.Value; } return false; } public override string ToString() { string dateTimeString = null; try { var clientDelta = MTProtoService.Instance.ClientTicksDelta; //var utc0SecsLong = Date.Value * 4294967296 - clientDelta; var utc0SecsInt = Date.Value - clientDelta / 4294967296.0; DateTime? dateTime = Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); dateTimeString = dateTime.Value.ToString("H:mm:ss dd.MM"); } catch (Exception ex) { } return base.ToString() + string.Format(" [{0} {4}] FromId={1} ToId=[{2}] U={3} S={5}", Date, FromId, ToId, Unread, dateTimeString, Status); } public override TLObject FromBytes(byte[] bytes, ref int position) { FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); Out = GetObject(bytes, ref position); _unread = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { FromId = GetObject(input); ToId = GetObject(input); Out = GetObject(input); _unread = GetObject(input); _date = GetObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); Status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(FromId.ToBytes()); ToId.ToStream(output); output.Write(Out.ToBytes()); output.Write(Unread.ToBytes()); output.Write(Date.ToBytes()); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessageCommon)message; FromId = m.FromId; ToId = m.ToId; Out = m.Out; if (Unread.Value != m.Unread.Value) { if (Unread.Value) { _unread = m.Unread; } } _date = m.Date; } #region Additional protected TLObject _from; public virtual TLObject From { get { if (_from != null) return _from; var cacheService = InMemoryCacheService.Instance; if (FromId == null || FromId.Value <= 0) { _from = cacheService.GetChat(ToId.Id); return _from; } if (ToId is TLPeerChannel) { var channel = cacheService.GetChat(ToId.Id) as TLChannel; if (channel != null && !channel.IsMegaGroup) { _from = channel; return _from; } } _from = cacheService.GetUser(FromId); return _from; } } protected TLObject _to; public virtual TLObject To { get { if (_to != null) return _to; var cacheService = InMemoryCacheService.Instance; if (ToId is TLPeerUser) { var user = cacheService.GetUser(ToId.Id); if (user != null) { _to = user; return _to; } } if (ToId is TLPeerChat) { var chat = cacheService.GetChat(ToId.Id); if (chat != null) { _to = chat; return _to; } } if (ToId is TLPeerChannel) { var channel = cacheService.GetChat(ToId.Id); if (channel != null) { _to = channel; return _to; } } return null; } } public override bool ShowFrom { get { if (this is TLMessageService) { return false; } if (FromId == null || FromId.Value <= 0) { return false; } if (ToId is TLPeerChat) return true; if (ToId is TLPeerChannel) { var cacheService = InMemoryCacheService.Instance; var channel = cacheService.GetChat(ToId.Id) as TLChannel; if (channel != null && channel.IsMegaGroup) return true; } return false; } } #endregion } public class TLMessageEmpty : TLMessageBase { public const uint Signature = TLConstructors.TLMessageEmpty; public override int DateIndex { get; set; } public override string ToString() { return base.ToString() + ", TLMessageEmpty"; } public override Visibility SelectionVisibility { get { return Visibility.Collapsed; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { var id = GetObject(input); if (id.Value != 0) { Id = id; } RandomId = GetObject(input) as TLLong; var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); RandomId.NullableToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } } public class TLMessagesContainter : TLMessageBase { public const uint Signature = TLConstructors.TLMessagesContainter; public TLMessageMediaBase WebPageMedia { get; set; } public TLVector FwdMessages { get; set; } public bool WithMyScore { get; set; } public TLMessage25 EditMessage { get; set; } public int EditUntil { get; set; } public string EditTimerString { get { var editUntil = EditUntil; var now = TLUtils.DateToUniversalTimeTLInt(MTProtoService.Instance.ClientTicksDelta, DateTime.Now).Value; if (editUntil < now) { return string.Empty; } var timeSpan = TimeSpan.FromSeconds(editUntil - now); if (timeSpan.TotalMinutes > 5.0) { return string.Empty; } if (timeSpan.TotalDays > 1.0) { return string.Format("({0})", TimeSpan.FromSeconds(editUntil - now)); } if (timeSpan.TotalHours > 1.0) { return string.Format("({0:hh\\:mm\\:ss})", TimeSpan.FromSeconds(editUntil - now)); } return string.Format("({0:mm\\:ss})", TimeSpan.FromSeconds(editUntil - now)); } } public override int DateIndex { get; set; } public override Visibility SelectionVisibility { get { return Visibility.Collapsed; } } public TLObject From { get { if (FwdMessages != null && FwdMessages.Count > 0) { var fwdMessage48 = FwdMessages[0] as TLMessage48; if (fwdMessage48 != null) { var fwdHeader = fwdMessage48.FwdHeader; if (fwdHeader != null) { var cacheService = InMemoryCacheService.Instance; if (fwdHeader.ChannelId != null) { return cacheService.GetChat(fwdHeader.ChannelId); } if (fwdHeader.FromId != null) { return cacheService.GetUser(fwdHeader.FromId); } } } var fwdMessage = FwdMessages[0] as TLMessage40; if (fwdMessage != null) { var fwdPeer = fwdMessage.FwdFromPeer; if (fwdPeer != null) { var cacheService = InMemoryCacheService.Instance; if (fwdPeer is TLPeerChannel) { return cacheService.GetChat(fwdPeer.Id); } return cacheService.GetUser(fwdPeer.Id); } } return FwdMessages[0].FwdFrom; } if (EditMessage != null) { var fwdMessage48 = EditMessage as TLMessage48; if (fwdMessage48 != null) { var fwdHeader = fwdMessage48.FwdHeader; if (fwdHeader != null) { var cacheService = InMemoryCacheService.Instance; if (fwdHeader.ChannelId != null) { return cacheService.GetChat(fwdHeader.ChannelId); } if (fwdHeader.FromId != null) { return cacheService.GetUser(fwdHeader.FromId); } } } return EditMessage.From; } return null; } } public TLString Message { get { if (FwdMessages != null && FwdMessages.Count > 0) { return FwdMessages[0].Message; } if (EditMessage != null) { return EditMessage.Message; } return null; } } public TLMessageMediaBase Media { get { if (FwdMessages != null && FwdMessages.Count > 0) { return FwdMessages[0].Media; } if (EditMessage != null) { return EditMessage.Media; } return null; } } } public class TLMessage73 : TLMessage70 { public new const uint Signature = TLConstructors.TLMessage73; protected TLLong _groupedId; public TLLong GroupedId { get { return _groupedId; } set { SetField(out _groupedId, value, ref _flags, (int)MessageFlags.GroupedId); } } public override void Edit(TLMessageBase messageBase) { base.Edit(messageBase); var message = messageBase as TLMessage73; if (message != null) { GroupedId = message.GroupedId; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(Flags, (int)MessageFlags.FromId, new TLInt(-1), bytes, ref position); ToId = GetObject(bytes, ref position); _fwdHeader = GetObject(Flags, (int)MessageFlags.FwdFrom, null, bytes, ref position); _viaBotId = GetObject(Flags, (int)MessageFlags.ViaBotId, null, bytes, ref position); _replyToMsgId = GetObject(Flags, (int)MessageFlags.ReplyToMsgId, null, bytes, ref position); _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(Flags, (int)MessageFlags.Media, new TLMessageMediaEmpty(), bytes, ref position); _replyMarkup = GetObject(Flags, (int)MessageFlags.ReplyMarkup, null, bytes, ref position); Entities = GetObject(Flags, (int)MessageFlags.Entities, new TLVector(), bytes, ref position); // Important to add empty Entities to avoid BrowseNavigationService.ParseText calls _views = GetObject(Flags, (int)MessageFlags.Views, new TLInt(0), bytes, ref position); _editDate = GetObject(Flags, (int)MessageFlags.EditDate, new TLInt(0), bytes, ref position); _postAuthor = GetObject(Flags, (int)MessageFlags.PostAuthor, null, bytes, ref position); _groupedId = GetObject(Flags, (int)MessageFlags.GroupedId, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); _fwdHeader = GetObject(Flags, (int)MessageFlags.FwdFrom, null, input); _viaBotId = GetObject(Flags, (int)MessageFlags.ViaBotId, null, input); _replyToMsgId = GetObject(Flags, (int)MessageFlags.ReplyToMsgId, null, input); _date = GetObject(input); Message = GetObject(input); _media = GetObject(Flags, (int)MessageFlags.Media, new TLMessageMediaEmpty(), input); _replyMarkup = GetObject(Flags, (int)MessageFlags.ReplyMarkup, null, input); Entities = GetObject(Flags, (int)MessageFlags.Entities, new TLVector(), input); // Important to add empty Entities to avoid BrowseNavigationService.ParseText calls _views = GetObject(Flags, (int)MessageFlags.Views, new TLInt(0), input); _editDate = GetObject(Flags, (int)MessageFlags.EditDate, new TLInt(0), input); _postAuthor = GetObject(Flags, (int)MessageFlags.PostAuthor, null, input); _groupedId = GetObject(Flags, (int)MessageFlags.GroupedId, null, input); CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } _status = (MessageStatus)GetObject(input).Value; _fwdMessageId = GetObject(CustomFlags, (int)MessageCustomFlags.FwdMessageId, null, input); _fwdFromChannelPeer = GetObject(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer, null, input); _inlineBotResultQueryId = GetObject(CustomFlags, (int)MessageCustomFlags.BotInlineResult, null, input); _inlineBotResultId = GetObject(CustomFlags, (int)MessageCustomFlags.BotInlineResult, null, input); _documents = GetObject>(CustomFlags, (int)MessageCustomFlags.Documents, null, input); _inputPeer = GetObject(CustomFlags, (int)MessageCustomFlags.InputPeer, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); try { // to set flags before writing to file Views = Views ?? new TLInt(0); EditDate = EditDate ?? new TLInt(0); Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); ToStream(output, FwdHeader, Flags, (int)MessageFlags.FwdFrom); ToStream(output, ViaBotId, Flags, (int)MessageFlags.ViaBotId); ToStream(output, ReplyToMsgId, Flags, (int)MessageFlags.ReplyToMsgId); Date.ToStream(output); Message.ToStream(output); ToStream(output, Media, Flags, (int)MessageFlags.Media); ToStream(output, ReplyMarkup, Flags, (int)MessageFlags.ReplyMarkup); ToStream(output, Entities, Flags, (int)MessageFlags.Entities); ToStream(output, Views, Flags, (int)MessageFlags.Views); ToStream(output, EditDate, Flags, (int)MessageFlags.EditDate); ToStream(output, PostAuthor, Flags, (int)MessageFlags.PostAuthor); ToStream(output, GroupedId, Flags, (int)MessageFlags.GroupedId); CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); status.ToStream(output); ToStream(output, _fwdMessageId, CustomFlags, (int)MessageCustomFlags.FwdMessageId); ToStream(output, _fwdFromChannelPeer, CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer); ToStream(output, _inlineBotResultQueryId, CustomFlags, (int)MessageCustomFlags.BotInlineResult); ToStream(output, _inlineBotResultId, CustomFlags, (int)MessageCustomFlags.BotInlineResult); ToStream(output, _documents, CustomFlags, (int)MessageCustomFlags.Documents); ToStream(output, _inputPeer, CustomFlags, (int)MessageCustomFlags.InputPeer); } catch (Exception ex) { var logString = string.Format("TLMessage73.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9} edit_date={10} fwd_header={11}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId, EditDate, FwdHeader != null); TLUtils.WriteException(logString, ex); } } public override void Update(TLMessageBase message) { var message73 = message as TLMessage73; if (message73 != null) { GroupedId = message73.GroupedId; base.Update(message); } } } public class TLMessage70 : TLMessage48 { public new const uint Signature = TLConstructors.TLMessage70; protected TLString _postAuthor; public TLString PostAuthor { get { return _postAuthor; } set { SetField(out _postAuthor, value, ref _flags, (int)MessageFlags.PostAuthor); } } private string _author; public override string Author { get { if (_author != null) return _author; if (!TLString.IsNullOrEmpty(PostAuthor)) { _author = PostAuthor.ToString(); return _author; } if (!(ToId is TLPeerChannel)) return null; if (FromId == null || FromId.Value < 0) return null; var cacheService = InMemoryCacheService.Instance; var user = cacheService.GetUser(FromId); _author = user != null ? user.FullName2 : string.Empty; return _author; } } public override Visibility AuthorVisibility { get { return !string.IsNullOrEmpty(Author) && !IsMusic() ? Visibility.Visible : Visibility.Collapsed; } } public bool TTLMediaExpired { get { var mediaPhoto = Media as TLMessageMediaPhoto70; if (mediaPhoto != null) { return mediaPhoto.Photo == null; } var mediaDocument = Media as TLMessageMediaDocument70; if (mediaDocument != null) { return mediaDocument.Document == null; } return false; } } protected TLInputPeerBase _inputPeer; public TLInputPeerBase InputPeer { get { return _inputPeer; } set { if (_inputPeer != null && value == null) { } SetField(out _inputPeer, value, ref _customFlags, (int)MessageCustomFlags.InputPeer); } } public override void Edit(TLMessageBase messageBase) { base.Edit(messageBase); var message = messageBase as TLMessage48; if (message != null) { EditDate = message.EditDate; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(Flags, (int)MessageFlags.FromId, new TLInt(-1), bytes, ref position); ToId = GetObject(bytes, ref position); _fwdHeader = GetObject(Flags, (int)MessageFlags.FwdFrom, null, bytes, ref position); _viaBotId = GetObject(Flags, (int)MessageFlags.ViaBotId, null, bytes, ref position); _replyToMsgId = GetObject(Flags, (int)MessageFlags.ReplyToMsgId, null, bytes, ref position); _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(Flags, (int)MessageFlags.Media, new TLMessageMediaEmpty(), bytes, ref position); _replyMarkup = GetObject(Flags, (int)MessageFlags.ReplyMarkup, null, bytes, ref position); _entities = GetObject>(Flags, (int)MessageFlags.Entities, null, bytes, ref position); _views = GetObject(Flags, (int)MessageFlags.Views, new TLInt(0), bytes, ref position); _editDate = GetObject(Flags, (int)MessageFlags.EditDate, new TLInt(0), bytes, ref position); _postAuthor = GetObject(Flags, (int)MessageFlags.PostAuthor, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); //#if DEBUG // var flagsString = MessageFlagsString(Flags); //#endif var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); _fwdHeader = GetObject(Flags, (int)MessageFlags.FwdFrom, null, input); _viaBotId = GetObject(Flags, (int)MessageFlags.ViaBotId, null, input); _replyToMsgId = GetObject(Flags, (int)MessageFlags.ReplyToMsgId, null, input); _date = GetObject(input); Message = GetObject(input); _media = GetObject(Flags, (int)MessageFlags.Media, new TLMessageMediaEmpty(), input); _replyMarkup = GetObject(Flags, (int)MessageFlags.ReplyMarkup, null, input); _entities = GetObject>(Flags, (int)MessageFlags.Entities, null, input); _views = GetObject(Flags, (int)MessageFlags.Views, new TLInt(0), input); _editDate = GetObject(Flags, (int)MessageFlags.EditDate, new TLInt(0), input); _postAuthor = GetObject(Flags, (int)MessageFlags.PostAuthor, null, input); CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } _status = (MessageStatus)GetObject(input).Value; _fwdMessageId = GetObject(CustomFlags, (int)MessageCustomFlags.FwdMessageId, null, input); _fwdFromChannelPeer = GetObject(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer, null, input); _inlineBotResultQueryId = GetObject(CustomFlags, (int)MessageCustomFlags.BotInlineResult, null, input); _inlineBotResultId = GetObject(CustomFlags, (int)MessageCustomFlags.BotInlineResult, null, input); _documents = GetObject>(CustomFlags, (int)MessageCustomFlags.Documents, null, input); _inputPeer = GetObject(CustomFlags, (int)MessageCustomFlags.InputPeer, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); try { // to set flags before writing to file Views = Views ?? new TLInt(0); EditDate = EditDate ?? new TLInt(0); Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); ToStream(output, FwdHeader, Flags, (int)MessageFlags.FwdFrom); ToStream(output, ViaBotId, Flags, (int)MessageFlags.ViaBotId); ToStream(output, ReplyToMsgId, Flags, (int)MessageFlags.ReplyToMsgId); Date.ToStream(output); Message.ToStream(output); ToStream(output, Media, Flags, (int)MessageFlags.Media); ToStream(output, ReplyMarkup, Flags, (int)MessageFlags.ReplyMarkup); ToStream(output, Entities, Flags, (int)MessageFlags.Entities); ToStream(output, Views, Flags, (int)MessageFlags.Views); ToStream(output, EditDate, Flags, (int)MessageFlags.EditDate); ToStream(output, PostAuthor, Flags, (int)MessageFlags.PostAuthor); CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); status.ToStream(output); ToStream(output, _fwdMessageId, CustomFlags, (int)MessageCustomFlags.FwdMessageId); ToStream(output, _fwdFromChannelPeer, CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer); ToStream(output, _inlineBotResultQueryId, CustomFlags, (int)MessageCustomFlags.BotInlineResult); ToStream(output, _inlineBotResultId, CustomFlags, (int)MessageCustomFlags.BotInlineResult); ToStream(output, _documents, CustomFlags, (int)MessageCustomFlags.Documents); ToStream(output, _inputPeer, CustomFlags, (int)MessageCustomFlags.InputPeer); } catch (Exception ex) { var logString = string.Format("TLMessage70.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9} edit_date={10} fwd_header={11}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId, EditDate, FwdHeader != null); TLUtils.WriteException(logString, ex); } } public override void Update(TLMessageBase message) { var message70 = message as TLMessage70; if (message70 != null) { // begin copy flags Out = message70.Out; IsMention = message70.IsMention; NotListened = message70.NotListened; Silent = message70.Silent; Post = message70.Post; // end copy flags Id = message70.Id; Status = message70.Status; FromId = message70.FromId; ToId = message70.ToId; if (Unread.Value && !message70.Unread.Value) { SetUnreadSilent(message70.Unread); } if (!Unread.Value && message70.Unread.Value) { #if DEBUG && WINDOWS_PHONE var builder = new StringBuilder(); var stackTrace = new StackTrace(); var frames = stackTrace.GetFrames(); foreach (var r in frames) { builder.AppendLine(string.Format("Method: {0}", r.GetMethod())); } //Helpers.Execute.ShowDebugMessage("Set read message as unread\ncurrent=" + this + "\nnew=" + message + "\n\n" + builder.ToString()); #endif } _date = message70.Date; Message = message70.Message; UpdateMedia(message); FwdFromId = message70.FwdFromId; FwdDate = message70.FwdDate; ReplyToMsgId = message70.ReplyToMsgId; if (message70.Reply != null) { Reply = message70.Reply; } if (message70.ReplyMarkup != null) { var oldCustomFlags = ReplyMarkup != null ? ReplyMarkup.CustomFlags : null; ReplyMarkup = message70.ReplyMarkup; ReplyMarkup.CustomFlags = oldCustomFlags; } if (message70.Entities != null) { Entities = message70.Entities; } FwdFromPeer = message70.FwdFromPeer; if (message70.FwdMessageId != null) FwdMessageId = message70.FwdMessageId; if (message70.FwdFromChannelPeer != null) FwdFromChannelPeer = message70.FwdFromChannelPeer; if (message70.Views != null) { var currentViews = Views != null ? Views.Value : 0; if (currentViews < message70.Views.Value) { Views = message70.Views; } } if (message70.ViaBotId != null) { ViaBotId = message70.ViaBotId; } if (message70.InlineBotResultQueryId != null) { InlineBotResultQueryId = message70.InlineBotResultQueryId; } if (message70.InlineBotResultId != null) { InlineBotResultId = message70.InlineBotResultId; } FwdHeader = message70.FwdHeader; if (message70.EditDate != null) { EditDate = message70.EditDate; } PostAuthor = message70.PostAuthor; if (message70.InputPeer != null) { InputPeer = message70.InputPeer; } } } private void UpdateMedia(TLMessageBase message) { var m = (TLMessage)message; var oldMedia = Media; var newMedia = m.Media; if (oldMedia.GetType() != newMedia.GetType()) { _media = m.Media; if (_media != null) SetMedia(); } else { var oldMediaGeoLive = oldMedia as TLMessageMediaGeoLive; var newMediaGeoLive = newMedia as TLMessageMediaGeoLive; if (oldMediaGeoLive != null && newMediaGeoLive != null) { oldMediaGeoLive.Geo = newMediaGeoLive.Geo; oldMediaGeoLive.Period = newMediaGeoLive.Period; return; } var oldMediaVenue = oldMedia as TLMessageMediaVenue; var newMediaVenue = newMedia as TLMessageMediaVenue; if (oldMediaVenue != null && newMediaVenue != null) { oldMediaVenue.Geo = newMediaVenue.Geo; return; } var oldMediaGeo = oldMedia as TLMessageMediaGeo; var newMediaGeo = newMedia as TLMessageMediaGeo; if (oldMediaGeo != null && newMediaGeo != null) { oldMediaGeo.Geo = newMediaGeo.Geo; return; } var oldInvoice = oldMedia as TLMessageMediaInvoice; var newInvoice = newMedia as TLMessageMediaInvoice; if (oldInvoice != null && newInvoice != null && newInvoice.ReceiptMsgId != null) { oldInvoice.ReceiptMsgId = newInvoice.ReceiptMsgId; return; } var oldMediaGame = oldMedia as TLMessageMediaGame; var newMediaGame = newMedia as TLMessageMediaGame; if (oldMediaGame != null && newMediaGame != null) { newMediaGame.Message = m.Message; if (oldMediaGame.Game.GetType() != newMediaGame.Game.GetType()) { _media = m.Media; } else { var oldGame = oldMediaGame.Game; var newGame = newMediaGame.Game; if (oldGame != null && newGame != null && (oldGame.Id.Value != newGame.Id.Value)) { newMediaGame.SourceMessage = this; _media = newMediaGame; } else { oldMediaGame.Message = m.Message; } } return; } var oldMediaWebPage = oldMedia as TLMessageMediaWebPage; var newMediaWebPage = newMedia as TLMessageMediaWebPage; if (oldMediaWebPage != null && newMediaWebPage != null) { if (oldMediaWebPage.WebPage.GetType() != newMediaWebPage.WebPage.GetType()) { _media = m.Media; } else { var oldWebPage = oldMediaWebPage.WebPage as TLWebPage35; var newWebPage = newMediaWebPage.WebPage as TLWebPage35; if (oldWebPage != null && newWebPage != null && (oldWebPage.Id.Value != newWebPage.Id.Value)) { _media = m.Media; } } return; } var oldMediaDocument = oldMedia as TLMessageMediaDocument; var newMediaDocument = newMedia as TLMessageMediaDocument; if (oldMediaDocument != null && newMediaDocument != null) { var oldDocument = oldMediaDocument.Document as TLDocument; var newDocument = newMediaDocument.Document as TLDocument; if (oldDocument == null || newDocument == null) { _media = m.Media; if (HasTTL()) { if (oldDocument != null) { newMediaDocument.Document = oldDocument; } var oldTTLMessageMedia = oldMediaDocument as ITTLMessageMedia; var newTTLMessageMedia = newMediaDocument as ITTLMessageMedia; if (oldTTLMessageMedia != null && newTTLMessageMedia != null) { newTTLMessageMedia.TTLParams = oldTTLMessageMedia.TTLParams; } } } else { if (oldDocument.Id.Value != newDocument.Id.Value || oldDocument.AccessHash.Value != newDocument.AccessHash.Value) { oldMediaDocument.Document = newMediaDocument.Document; } } return; } var oldMediaVideo = oldMedia as TLMessageMediaVideo; var newMediaVideo = newMedia as TLMessageMediaVideo; if (oldMediaVideo != null && newMediaVideo != null) { if (oldMediaVideo.Video.GetType() != newMediaVideo.Video.GetType()) { _media = m.Media; } else { var oldVideo = oldMediaVideo.Video as TLVideo; var newVideo = newMediaVideo.Video as TLVideo; if (oldVideo != null && newVideo != null && (oldVideo.Id.Value != newVideo.Id.Value || oldVideo.AccessHash.Value != newVideo.AccessHash.Value)) { var isoFileName = Media.IsoFileName; _media = m.Media; _media.IsoFileName = isoFileName; } } return; } var oldMediaAudio = oldMedia as TLMessageMediaAudio; var newMediaAudio = newMedia as TLMessageMediaAudio; if (oldMediaAudio != null && newMediaAudio != null) { if (oldMediaAudio.Audio.GetType() != newMediaAudio.Audio.GetType()) { _media = m.Media; } else { var oldAudio = oldMediaAudio.Audio as TLAudio; var newAudio = newMediaAudio.Audio as TLAudio; if (oldAudio != null && newAudio != null && (oldAudio.Id.Value != newAudio.Id.Value || oldAudio.AccessHash.Value != newAudio.AccessHash.Value)) { var isoFileName = Media.IsoFileName; var notListened = Media.NotListened; _media = m.Media; _media.IsoFileName = isoFileName; _media.NotListened = notListened; } } return; } var oldMediaPhoto = oldMedia as TLMessageMediaPhoto; var newMediaPhoto = newMedia as TLMessageMediaPhoto; if (oldMediaPhoto == null || newMediaPhoto == null) { _media = m.Media; } else { var oldPhoto = oldMediaPhoto.Photo as TLPhoto; var newPhoto = newMediaPhoto.Photo as TLPhoto; if (oldPhoto == null || newPhoto == null) { _media = m.Media; if (HasTTL()) { if (oldPhoto != null) { newMediaPhoto.Photo = oldPhoto; } var oldTTLMessageMedia = oldMediaPhoto as ITTLMessageMedia; var newTTLMessageMedia = newMediaPhoto as ITTLMessageMedia; if (oldTTLMessageMedia != null && newTTLMessageMedia != null) { newTTLMessageMedia.TTLParams = oldTTLMessageMedia.TTLParams; } } } else { if (oldPhoto.AccessHash.Value != newPhoto.AccessHash.Value) { var oldCachedSize = oldPhoto.Sizes.FirstOrDefault(x => x is TLPhotoCachedSize) as TLPhotoCachedSize; var oldMSize = oldPhoto.Sizes.FirstOrDefault( x => TLString.Equals(x.Type, new TLString("m"), StringComparison.OrdinalIgnoreCase)); foreach (var size in newPhoto.Sizes) { if (size is TLPhotoCachedSize) { size.TempUrl = oldCachedSize != null ? oldCachedSize.TempUrl : null; } else if (TLString.Equals(size.Type, new TLString("s"), StringComparison.OrdinalIgnoreCase)) { size.TempUrl = oldCachedSize != null ? oldCachedSize.TempUrl : null; } else { size.TempUrl = oldMSize != null ? oldMSize.TempUrl : null; } } oldMediaPhoto.Photo = newMediaPhoto.Photo; } } } } } } public class TLMessage48 : TLMessage45 { public new const uint Signature = TLConstructors.TLMessage48; protected TLVector _documents; public TLVector Documents { get { return _documents; } set { SetField(out _documents, value, ref _customFlags, (int)MessageCustomFlags.Documents); } } public Visibility HasStickers { get { var mediaPhoto = Media as TLMessageMediaPhoto; if (mediaPhoto != null) { var photo = mediaPhoto.Photo as TLPhoto56; if (photo != null) { return photo.HasStickers ? Visibility.Visible : Visibility.Collapsed; } } return Visibility.Collapsed; } } public bool Silent { get { return IsSet(Flags, (int)MessageFlags.Silent); } set { SetUnset(ref _flags, value, (int)MessageFlags.Silent); } } public bool Post { get { return IsSet(Flags, (int)MessageFlags.Post); } set { SetUnset(ref _flags, value, (int)MessageFlags.Post); } } protected TLMessageFwdHeader _fwdHeader; public TLMessageFwdHeader FwdHeader { get { return _fwdHeader; } set { SetField(out _fwdHeader, value, ref _flags, (int)MessageFlags.FwdFrom); } } protected TLInt _editDate; public TLInt EditDate { get { return _editDate; } set { SetField(out _editDate, value, ref _flags, (int)MessageFlags.EditDate); } } public Visibility EditDateVisibility { get { if (ViaBotId != null) return Visibility.Collapsed; var from = From; var user = from as TLUser; if (user != null && user.IsBot) return Visibility.Collapsed; return EditDate != null && EditDate.Value > 0 ? Visibility.Visible : Visibility.Collapsed; } } public override Visibility ReplyOrViaBotVisibility { get { var replyVisibility = ReplyVisibility; if (replyVisibility == Visibility.Visible) return Visibility.Visible; return ViaBotVisibility; } } public override Visibility ViaBotVisibility { get { if (ViaBotId != null && Media is TLMessageMediaContact) { return Visibility.Collapsed; } var viaBot = ViaBot; return viaBot != null && !viaBot.IsDeleted ? Visibility.Visible : Visibility.Collapsed; //return FwdHeader == null && ViaBotId != null ? Visibility.Visible : Visibility.Collapsed; } } public override Visibility FwdViaBotVisibility { get { if (ViaBotId != null && Media is TLMessageMediaContact) { return Visibility.Collapsed; } return FwdHeader != null && ViaBotId != null ? Visibility.Visible : Visibility.Collapsed; } } public override Visibility FwdFromPeerVisibility { get { var peerChannel = FwdHeader != null && FwdHeader.ChannelId != null; if (peerChannel) { var channelMediaGroup = Media as TLMessageMediaGroup; if (channelMediaGroup != null) { return Visibility.Visible; } var channelMediaPhoto = Media as TLMessageMediaPhoto; if (channelMediaPhoto != null) { return Visibility.Visible; } var channelMediaDocument = Media as TLMessageMediaDocument; if (channelMediaDocument != null) { if (IsMusic()) { return Visibility.Collapsed; } return Visibility.Visible; } var channelMediaVideo = Media as TLMessageMediaVideo; if (channelMediaVideo != null) { return Visibility.Visible; } var channelGeo = Media as TLMessageMediaGeo; if (channelGeo != null) { return Visibility.Visible; } } var mediaGroup = Media as TLMessageMediaGroup; if (FwdHeader != null && mediaGroup != null) { return Visibility.Visible; } var mediaPhoto = Media as TLMessageMediaPhoto; if (FwdHeader != null && mediaPhoto != null) { return Visibility.Visible; } var mediaVideo = Media as TLMessageMediaVideo; if (FwdHeader != null && mediaVideo != null) { return Visibility.Visible; } var mediaDocument = Media as TLMessageMediaDocument; if (FwdHeader != null && mediaDocument != null) { if (IsMusic()) { return Visibility.Collapsed; } return Visibility.Visible; } var mediaGeo = Media as TLMessageMediaGeo; if (FwdHeader != null && mediaGeo != null) { return Visibility.Visible; } var emptyMedia = Media as TLMessageMediaEmpty; var webPageMedia = Media as TLMessageMediaWebPage; return FwdHeader != null && !TLString.IsNullOrEmpty(Message) && (emptyMedia != null || webPageMedia != null) ? Visibility.Visible : Visibility.Collapsed; } } public double FwdMaxWidth { get { if (IsSticker()) return 171.0; if (IsVideo()) return 212.0; var mediaVideo = Media as TLMessageMediaVideo; if (mediaVideo != null) return 212.0; var mediaGeo = Media as TLMessageMediaGeo; var mediaVenue = Media as TLMessageMediaVenue; if (mediaGeo != null && mediaVenue == null) #if DEBUG return 302.0;//120.0; #else return 302.0;//161.0; #endif return 311.0; } } public override TLObject FwdFrom { get { if (FwdHeader != null) { return FwdHeader; } if (FwdFromPeer != null) { var cacheService = InMemoryCacheService.Instance; if (FwdFromPeer is TLPeerChannel) { return cacheService.GetChat(FwdFromPeer.Id); } return cacheService.GetUser(FwdFromPeer.Id); } if (FwdFromId != null) { var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(FwdFromId); } return null; } set { } } public override Visibility ShareButtonVisibility { get { if (Out.Value) return Visibility.Collapsed; var user = From as TLUser; if (user != null && (user.IsBot || ViaBotId != null)) { var entities = Entities; if (entities != null) { var url = entities.FirstOrDefault(x => x is TLMessageEntityUrl || x is TLMessageEntityTextUrl); if (url != null) return Visibility.Visible; } var mediaGame = Media as TLMessageMediaGame; if (mediaGame != null) return Visibility.Visible; var mediaPhoto = Media as TLMessageMediaPhoto; if (mediaPhoto != null) return Visibility.Visible; var mediaVideo = Media as TLMessageMediaVideo; if (mediaVideo != null) return Visibility.Visible; if (IsVideo()) return Visibility.Visible; } return Visibility.Collapsed; } } public override TLObject From { get { if (IsSelf()) { var fwdHeader = FwdHeader as TLMessageFwdHeader73; if (fwdHeader != null) { var user = fwdHeader.From as TLUser; if (user == null || !user.IsSelf) { return fwdHeader.From; } } } return base.From; } } public override void Edit(TLMessageBase messageBase) { base.Edit(messageBase); var message = messageBase as TLMessage48; if (message != null) { EditDate = message.EditDate; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = IsSet(Flags, (int)MessageFlags.FromId) ? GetObject(bytes, ref position) : new TLInt(-1); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdHeader = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _views = IsSet(Flags, (int)MessageFlags.Views) ? GetObject(bytes, ref position) : new TLInt(0); EditDate = IsSet(Flags, (int)MessageFlags.EditDate) ? GetObject(bytes, ref position) : new TLInt(0); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdHeader = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(input) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } if (IsSet(Flags, (int)MessageFlags.Views)) { Views = GetObject(input); } else { Views = new TLInt(0); } if (IsSet(Flags, (int)MessageFlags.EditDate)) { EditDate = GetObject(input); } else { EditDate = new TLInt(0); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResultQueryId = GetObject(input); _inlineBotResultId = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.Documents)) { _documents = GetObject>(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); try { Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdHeader.ToStream(output); //FwdFromPeer.ToStream(output); //FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); if (IsSet(Flags, (int)MessageFlags.Media)) { _media.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Views)) { if (Views == null) { var logString = string.Format("TLMessage48.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9} edit_date={10} fwd_header={11}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId, EditDate, FwdHeader != null); Log.Write(logString); } Views = Views ?? new TLInt(0); Views.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.EditDate)) { EditDate = EditDate ?? new TLInt(0); EditDate.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResultQueryId.ToStream(output); _inlineBotResultId.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.Documents)) { _documents.ToStream(output); } } catch (Exception ex) { var logString = string.Format("TLMessage48.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9} edit_date={10} fwd_header={11}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId, EditDate, FwdHeader != null); TLUtils.WriteException(logString, ex); } } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage48; if (m != null) { FwdHeader = m.FwdHeader; if (m.EditDate != null) { EditDate = m.EditDate; } } } } public class TLMessage45 : TLMessage40 { private string _author; public virtual string Author { get { if (_author != null) return _author; if (!(ToId is TLPeerChannel)) return null; if (FromId == null || FromId.Value < 0) return null; var cacheService = InMemoryCacheService.Instance; var user = cacheService.GetUser(FromId); _author = user != null ? user.FullName2 : string.Empty; return _author; } } public virtual Visibility AuthorVisibility { get { return ToId is TLPeerChannel && FromId != null && FromId.Value >= 0 && !IsMusic() ? Visibility.Visible : Visibility.Collapsed; } } public new const uint Signature = TLConstructors.TLMessage45; protected TLInt _viaBotId; public TLInt ViaBotId { get { return _viaBotId; } set { if (value != null) { Set(ref _flags, (int)MessageFlags.ViaBotId); _viaBotId = value; } else { Unset(ref _flags, (int)MessageFlags.ViaBotId); _viaBotId = null; } } } private TLUserBase _viaBot; public override TLUserBase ViaBot { get { if (_viaBot != null) return _viaBot; if (ViaBotId == null) return null; var cacheService = InMemoryCacheService.Instance; _viaBot = cacheService.GetUser(ViaBotId); return _viaBot; } } public override Visibility ViaBotVisibility { get { return FwdFromPeer == null && ViaBotId != null ? Visibility.Visible : Visibility.Collapsed; } } public override Visibility FwdViaBotVisibility { get { return FwdFromPeer != null && ViaBotId != null ? Visibility.Visible : Visibility.Collapsed; } } protected TLLong _inlineBotResultQueryId; public TLLong InlineBotResultQueryId { get { return _inlineBotResultQueryId; } set { if (value != null) { Set(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResultQueryId = value; } else { Unset(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResultQueryId = null; } } } protected TLString _inlineBotResultId; public TLString InlineBotResultId { get { return _inlineBotResultId; } set { if (value != null) { Set(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResultId = value; } else { Unset(ref _customFlags, (int)MessageCustomFlags.BotInlineResult); _inlineBotResultId = null; } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = IsSet(Flags, (int)MessageFlags.FromId) ? GetObject(bytes, ref position) : new TLInt(-1); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _views = IsSet(Flags, (int)MessageFlags.Views) ? GetObject(bytes, ref position) : new TLInt(0); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(input) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } if (IsSet(Flags, (int)MessageFlags.Views)) { Views = GetObject(input); } else { Views = new TLInt(0); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResultQueryId = GetObject(input); _inlineBotResultId = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); try { Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { _viaBotId.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); if (IsSet(Flags, (int)MessageFlags.Media)) { _media.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Views)) { if (Views == null) { var logString = string.Format("TLMessage40.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId); Log.Write(logString); } Views = Views ?? new TLInt(0); Views.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.BotInlineResult)) { _inlineBotResultQueryId.ToStream(output); _inlineBotResultId.ToStream(output); } } catch (Exception ex) { var logString = string.Format("TLMessage40.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId); TLUtils.WriteException(logString, ex); } } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage45; if (m != null) { if (m.ViaBotId != null) { ViaBotId = m.ViaBotId; } if (m.InlineBotResultQueryId != null) { InlineBotResultQueryId = m.InlineBotResultQueryId; } if (m.InlineBotResultId != null) { InlineBotResultId = m.InlineBotResultId; } } } } public class TLMessage40 : TLMessage36 { public new const uint Signature = TLConstructors.TLMessage40; public TLPeerBase FwdFromPeer { get; set; } protected TLInputPeerBase _fwdFromChannelPeer; public TLInputPeerBase FwdFromChannelPeer { get { return _fwdFromChannelPeer; } set { if (value != null) { Set(ref _customFlags, (int)MessageCustomFlags.FwdFromChannelPeer); _fwdFromChannelPeer = value; } else { Unset(ref _customFlags, (int)MessageCustomFlags.FwdFromChannelPeer); _fwdFromChannelPeer = null; } } } protected TLInt _fwdMessageId; public TLInt FwdMessageId { get { return _fwdMessageId; } set { if (value != null) { Set(ref _customFlags, (int)MessageCustomFlags.FwdMessageId); _fwdMessageId = value; } else { Unset(ref _customFlags, (int)MessageCustomFlags.FwdMessageId); _fwdMessageId = null; } } } public virtual Visibility FwdFromPeerVisibility { get { var peerChannel = FwdFromPeer as TLPeerChannel; if (peerChannel != null) { var channelMediaPhoto = Media as TLMessageMediaPhoto; if (channelMediaPhoto != null) { return Visibility.Visible; } var channelMediaDocument = Media as TLMessageMediaDocument; if (channelMediaDocument != null && IsVideo(channelMediaDocument.Document)) { return Visibility.Visible; } var channelMediaVideo = Media as TLMessageMediaVideo; if (channelMediaVideo != null) { return Visibility.Visible; } } var mediaPhoto = Media as TLMessageMediaPhoto; if (FwdFromPeer != null && mediaPhoto != null) { return Visibility.Visible; } var mediaVideo = Media as TLMessageMediaVideo; if (FwdFromPeer != null && mediaVideo != null) { return Visibility.Visible; } var mediaDocument = Media as TLMessageMediaDocument; if (FwdFromPeer != null && mediaDocument != null) { return Visibility.Visible; } var emptyMedia = Media as TLMessageMediaEmpty; var webPageMedia = Media as TLMessageMediaWebPage; return FwdFromPeer != null && !TLString.IsNullOrEmpty(Message) && (emptyMedia != null || webPageMedia != null) ? Visibility.Visible : Visibility.Collapsed; } } public TLMessageBase Group { get; set; } public void SetFromId() { Set(ref _flags, (int)MessageFlags.FromId); } public void SetMedia() { Set(ref _flags, (int)MessageFlags.Media); } public override TLObject FwdFrom { get { if (FwdFromId != null) { var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(FwdFromId); } if (FwdFromPeer != null) { var cacheService = InMemoryCacheService.Instance; if (FwdFromPeer is TLPeerChannel) { return cacheService.GetChat(FwdFromPeer.Id); } return cacheService.GetUser(FwdFromPeer.Id); } return null; } set { } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = IsSet(Flags, (int)MessageFlags.FromId) ? GetObject(bytes, ref position) : new TLInt(-1); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _views = IsSet(Flags, (int)MessageFlags.Views) ? GetObject(bytes, ref position) : new TLInt(0); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(input) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } if (IsSet(Flags, (int)MessageFlags.Views)) { Views = GetObject(input); } else { Views = new TLInt(0); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId = GetObject(input); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); try { Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromPeer.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); if (IsSet(Flags, (int)MessageFlags.Media)) { _media.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Views)) { if (Views == null) { var logString = string.Format("TLMessage40.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId); Log.Write(logString); } Views = Views ?? new TLInt(0); Views.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdMessageId)) { _fwdMessageId.ToStream(output); } if (IsSet(CustomFlags, (int)MessageCustomFlags.FwdFromChannelPeer)) { _fwdFromChannelPeer.ToStream(output); } } catch (Exception ex) { var logString = string.Format("TLMessage40.ToStream id={0} flags={1} fwd_from_peer={2} fwd_date={3} reply_to_msg_id={4} media={5} reply_markup={6} entities={7} views={8} from_id={9}", Index, MessageFlagsString(Flags), FwdFromPeer, FwdDate, ReplyToMsgId, Media, ReplyMarkup, Entities, Views, FromId); TLUtils.WriteException(logString, ex); } } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage40; if (m != null) { FwdFromPeer = m.FwdFromPeer; if (m.FwdMessageId != null) FwdMessageId = m.FwdMessageId; if (m.FwdFromChannelPeer != null) FwdFromChannelPeer = m.FwdFromChannelPeer; if (m.Views != null) { var currentViews = Views != null ? Views.Value : 0; if (currentViews < m.Views.Value) { Views = m.Views; } } } } } public class TLMessage36 : TLMessage34 { public new const uint Signature = TLConstructors.TLMessage36; protected TLInt _views; public TLInt Views { get { return _views; } set { if (value != null) { if (_views == null || _views.Value < value.Value) { Set(ref _flags, (int)MessageFlags.Views); _views = value; } } } } public Visibility ViewsVisibility { get { var message40 = this as TLMessage40; if (message40 != null) { return Views != null && Views.Value > 0 ? Visibility.Visible : Visibility.Collapsed; } return Visibility.Collapsed; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = IsSet(Flags, (int)MessageFlags.Media) ? GetObject(bytes, ref position) : new TLMessageMediaEmpty(); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); _media.ToStream(output); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } } public class TLMessage34 : TLMessage31 { public new const uint Signature = TLConstructors.TLMessage34; protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)MessageFlags.Entities); } } public override void Edit(TLMessageBase messageBase) { var message = messageBase as TLMessage34; if (message != null) { Message = message.Message; Entities = message.Entities; ReplyMarkup = message.ReplyMarkup; var oldGeoLive = Media as TLMessageMediaGeoLive; var newGeoLive = message.Media as TLMessageMediaGeoLive; if (oldGeoLive != null && newGeoLive != null) { oldGeoLive.Geo = newGeoLive.Geo; oldGeoLive.Period = newGeoLive.Period; } var oldInvoice = Media as TLMessageMediaInvoice; var newInvoice = message.Media as TLMessageMediaInvoice; if (oldInvoice != null && newInvoice != null && newInvoice.ReceiptMsgId != null) { oldInvoice.ReceiptMsgId = newInvoice.ReceiptMsgId; } var oldWebPage = Media as TLMessageMediaWebPage; var newWebPage = message.Media as TLMessageMediaWebPage; if ((oldWebPage == null && newWebPage != null) || (oldWebPage != null && newWebPage == null) || (oldWebPage != null && newWebPage != null && oldWebPage.WebPage.Id.Value != newWebPage.WebPage.Id.Value)) { _media = (TLMessageMediaBase)newWebPage ?? new TLMessageMediaEmpty(); } var oldGame = Media as TLMessageMediaGame; var newGame = message.Media as TLMessageMediaGame; if (oldGame != null && newGame != null) { oldGame.Message = message.Message; } var mediaCaption = message.Media as IMediaCaption; var cachedMediaCaption = Media as IMediaCaption; if (cachedMediaCaption != null && mediaCaption != null) { cachedMediaCaption.Caption = mediaCaption.Caption; } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(input); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); _media.ToStream(output); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage34; if (m != null) { if (m.Entities != null) { Entities = m.Entities; } } } } public class TLMessage31 : TLMessage25 { public new const uint Signature = TLConstructors.TLMessage31; protected TLReplyKeyboardBase _replyMarkup; public TLReplyKeyboardBase ReplyMarkup { get { return _replyMarkup; } set { SetField(out _replyMarkup, value, ref _flags, (int)MessageFlags.ReplyMarkup); } } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup = GetObject(input); } CustomFlags = GetNullableObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); _media.ToStream(output); if (IsSet(Flags, (int)MessageFlags.ReplyMarkup)) { ReplyMarkup.ToStream(output); } CustomFlags.NullableToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage31; if (m != null) { if (m.ReplyMarkup != null) { var oldCustomFlags = ReplyMarkup != null ? ReplyMarkup.CustomFlags : null; ReplyMarkup = m.ReplyMarkup; ReplyMarkup.CustomFlags = oldCustomFlags; } if (m.CustomFlags != null) { CustomFlags = m.CustomFlags; } } } } public class TLMessage25 : TLMessage17, IReplyToMsgId { public new const uint Signature = TLConstructors.TLMessage25; public TLInt FwdFromId { get; set; } public TLInt FwdDate { get; set; } protected TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { SetField(out _replyToMsgId, value, ref _flags, (int)MessageFlags.ReplyToMsgId); } } public override ReplyInfo ReplyInfo { get { return ReplyToMsgId != null ? new ReplyInfo { ReplyToMsgId = ReplyToMsgId, Reply = Reply } : null; } } public override Visibility ReplyVisibility { get { return ReplyToMsgId != null && ReplyToMsgId.Value != 0 ? Visibility.Visible : Visibility.Collapsed; } } public void SetFwd() { Set(ref _flags, (int)MessageFlags.FwdFrom); } public void SetReply() { Set(ref _flags, (int)MessageFlags.ReplyToMsgId); } public void SetListened() { Unset(ref _flags, (int)MessageFlags.MediaUnread); } public bool NotListened { get { return IsSet(_flags, (int)MessageFlags.MediaUnread); } set { SetUnset(ref _flags, value, (int)MessageFlags.MediaUnread); } } public override TLObject FwdFrom { get { if (FwdFromId == null) return null; var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(FwdFromId); } set { } } public override string ToString() { var messageString = Message != null ? Message.ToString() : string.Empty; var mediaString = Media.GetType().Name; //var mediaPhoto = Media as TLMessageMediaPhoto; //if (mediaPhoto != null) //{ // mediaString = mediaPhoto.ToString() + " "; //} var str = Media == null || Media is TLMessageMediaEmpty ? " Msg=" + messageString.Substring(0, Math.Min(messageString.Length, 5)) : " Media=" + mediaString; return base.ToString() + string.Format(" Flags={0}" + str, MessageFlagsString(Flags)); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(input); FwdDate = GetObject(input); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId.ToStream(output); FwdDate.ToStream(output); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId.ToStream(output); } output.Write(Date.ToBytes()); Message.ToStream(output); _media.ToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessage25; if (m != null) { FwdFromId = m.FwdFromId; FwdDate = m.FwdDate; ReplyToMsgId = m.ReplyToMsgId; if (m.Reply != null) { Reply = m.Reply; } } } } public class TLMessage17 : TLMessage { public new const uint Signature = TLConstructors.TLMessage17; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Out { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Out)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Out); } } } public override void SetUnread(TLBool value) { Unread = value; } public override void SetUnreadSilent(TLBool value) { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); } } public override TLBool Unread { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Unread)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); NotifyOfPropertyChange(() => Status); } } } public bool IsMention { get { return IsSet(_flags, (int)MessageFlags.Mentioned); } set { SetUnset(ref _flags, value, (int)MessageFlags.Mentioned); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); output.Write(FromId.ToBytes()); ToId.ToStream(output); output.Write(Date.ToBytes()); Message.ToStream(output); _media.ToStream(output); RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessage17)message; var fixUnread = false; if (!Unread.Value && m.Unread.Value) { fixUnread = true; #if DEBUG var builder = new StringBuilder(); #if WINDOWS_PHONE var stackTrace = new StackTrace(); var frames = stackTrace.GetFrames(); foreach (var r in frames) { builder.AppendLine(string.Format("Method: {0}", r.GetMethod())); } #endif Telegram.Api.Helpers.Execute.ShowDebugMessage("Set read message as unread\ncurrent=" + this + "\nnew=" + message + "\n\n" + builder.ToString()); #endif } Flags = m.Flags; if (fixUnread) { SetUnreadSilent(TLBool.False); } } } public class TLMessage : TLMessageCommon, IMessage { public const uint Signature = TLConstructors.TLMessage; public TLString Message { get; set; } public TLMessageMediaBase _media; public TLMessageMediaBase Media { get { return _media; } set { SetField(ref _media, value, () => Media); } } public override Visibility SelectionVisibility { get { return IsExpired() ? Visibility.Collapsed : Visibility.Visible; } } public override int MediaSize { get { return Media.MediaSize; } } public override Visibility MediaSizeVisibility { get { return _media is TLMessageMediaVideo ? Visibility.Visible : Visibility.Collapsed; } } public override bool IsMusic() { var mediaDocument = _media as TLMessageMediaDocument; if (mediaDocument != null) { return IsMusic(mediaDocument.Document); } return false; } public override bool IsVoice() { var mediaDocument = _media as TLMessageMediaDocument; if (mediaDocument != null) { return IsVoice(mediaDocument.Document); } return false; } public override bool IsRoundVideo() { var mediaDocument = _media as TLMessageMediaDocument; if (mediaDocument != null) { return IsRoundVideo(mediaDocument.Document); } return false; } public override bool IsVideo() { var mediaDocument = _media as TLMessageMediaDocument; if (mediaDocument != null) { return IsVideo(mediaDocument.Document); } return false; } public override bool IsSticker() { var mediaDocument = _media as TLMessageMediaDocument; if (mediaDocument != null) { return IsSticker(mediaDocument.Document); } return false; } public override bool IsExpired() { return IsExpired(_media); } public override bool HasTTL() { return HasTTL(_media); } public override bool IsGif() { var mediaDocument = _media as IMediaGif; if (mediaDocument != null) { return IsGif(mediaDocument.Document); } return false; } public override double MediaWidth { get { if (Media != null) { return Media.MediaWidth; } return base.MediaWidth; } } public override string ToString() { return base.ToString(); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); base.FromBytes(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { var id = GetObject(input); if (id.Value != 0) { Id = id; } base.FromStream(input); Message = GetObject(input); _media = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id = Id ?? new TLInt(0); output.Write(Id.ToBytes()); base.ToStream(output); Message.ToStream(output); _media.ToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessage)message; Message = m.Message; var oldMedia = Media; var newMedia = m.Media; if (oldMedia.GetType() != newMedia.GetType()) { _media = m.Media; } else { var oldInvoice = oldMedia as TLMessageMediaInvoice; var newInvoice = newMedia as TLMessageMediaInvoice; if (oldInvoice != null && newInvoice != null && newInvoice.ReceiptMsgId != null) { oldInvoice.ReceiptMsgId = newInvoice.ReceiptMsgId; return; } var oldMediaGame = oldMedia as TLMessageMediaGame; var newMediaGame = newMedia as TLMessageMediaGame; if (oldMediaGame != null && newMediaGame != null) { newMediaGame.Message = m.Message; if (oldMediaGame.Game.GetType() != newMediaGame.Game.GetType()) { _media = m.Media; } else { var oldGame = oldMediaGame.Game; var newGame = newMediaGame.Game; if (oldGame != null && newGame != null && (oldGame.Id.Value != newGame.Id.Value)) { newMediaGame.SourceMessage = this; _media = newMediaGame; } else { oldMediaGame.Message = m.Message; } } return; } var oldMediaWebPage = oldMedia as TLMessageMediaWebPage; var newMediaWebPage = newMedia as TLMessageMediaWebPage; if (oldMediaWebPage != null && newMediaWebPage != null) { if (oldMediaWebPage.WebPage.GetType() != newMediaWebPage.WebPage.GetType()) { _media = m.Media; } else { var oldWebPage = oldMediaWebPage.WebPage as TLWebPage35; var newWebPage = newMediaWebPage.WebPage as TLWebPage35; if (oldWebPage != null && newWebPage != null && (oldWebPage.Id.Value != newWebPage.Id.Value)) { _media = m.Media; } } return; } var oldMediaDocument = oldMedia as TLMessageMediaDocument; var newMediaDocument = newMedia as TLMessageMediaDocument; if (oldMediaDocument != null && newMediaDocument != null) { if (oldMediaDocument.Document.GetType() != newMediaDocument.Document.GetType()) { _media = m.Media; } else { var oldDocument = oldMediaDocument.Document as TLDocument; var newDocument = newMediaDocument.Document as TLDocument; if (oldDocument != null && newDocument != null && (oldDocument.Id.Value != newDocument.Id.Value || oldDocument.AccessHash.Value != newDocument.AccessHash.Value)) { var isoFileName = Media.IsoFileName; var notListened = Media.NotListened; #if WP8 var file = Media.File; #endif _media = m.Media; _media.IsoFileName = isoFileName; _media.NotListened = notListened; #if WP8 _media.File = file; #endif } } return; } var oldMediaVideo = oldMedia as TLMessageMediaVideo; var newMediaVideo = newMedia as TLMessageMediaVideo; if (oldMediaVideo != null && newMediaVideo != null) { if (oldMediaVideo.Video.GetType() != newMediaVideo.Video.GetType()) { _media = m.Media; } else { var oldVideo = oldMediaVideo.Video as TLVideo; var newVideo = newMediaVideo.Video as TLVideo; if (oldVideo != null && newVideo != null && (oldVideo.Id.Value != newVideo.Id.Value || oldVideo.AccessHash.Value != newVideo.AccessHash.Value)) { var isoFileName = Media.IsoFileName; _media = m.Media; _media.IsoFileName = isoFileName; } } return; } var oldMediaAudio = oldMedia as TLMessageMediaAudio; var newMediaAudio = newMedia as TLMessageMediaAudio; if (oldMediaAudio != null && newMediaAudio != null) { if (oldMediaAudio.Audio.GetType() != newMediaAudio.Audio.GetType()) { _media = m.Media; } else { var oldAudio = oldMediaAudio.Audio as TLAudio; var newAudio = newMediaAudio.Audio as TLAudio; if (oldAudio != null && newAudio != null && (oldAudio.Id.Value != newAudio.Id.Value || oldAudio.AccessHash.Value != newAudio.AccessHash.Value)) { var isoFileName = Media.IsoFileName; var notListened = Media.NotListened; _media = m.Media; _media.IsoFileName = isoFileName; _media.NotListened = notListened; } } return; } var oldMediaPhoto = oldMedia as TLMessageMediaPhoto; var newMediaPhoto = newMedia as TLMessageMediaPhoto; if (oldMediaPhoto == null || newMediaPhoto == null) { _media = m.Media; } else { var oldPhoto = oldMediaPhoto.Photo as TLPhoto; var newPhoto = newMediaPhoto.Photo as TLPhoto; if (oldPhoto == null || newPhoto == null) { _media = m.Media; } else { if (oldPhoto.AccessHash.Value != newPhoto.AccessHash.Value) { var oldCachedSize = oldPhoto.Sizes.FirstOrDefault(x => x is TLPhotoCachedSize) as TLPhotoCachedSize; var oldMSize = oldPhoto.Sizes.FirstOrDefault(x => TLString.Equals(x.Type, new TLString("m"), StringComparison.OrdinalIgnoreCase)); foreach (var size in newPhoto.Sizes) { if (size is TLPhotoCachedSize) { size.TempUrl = oldCachedSize != null ? oldCachedSize.TempUrl : null; } else if (TLString.Equals(size.Type, new TLString("s"), StringComparison.OrdinalIgnoreCase)) { size.TempUrl = oldCachedSize != null ? oldCachedSize.TempUrl : null; } else { size.TempUrl = oldMSize != null ? oldMSize.TempUrl : null; } } _media = m.Media; } } } } } #region Additional private TLInputMediaBase _inputMedia; /// /// To resend canceled message /// public TLInputMediaBase InputMedia { get { return _inputMedia; } set { SetField(ref _inputMedia, value, () => InputMedia); } } public List Links { get; set; } #endregion } [Obsolete] public class TLMessageForwarded17 : TLMessageForwarded { public new const uint Signature = TLConstructors.TLMessageForwarded17; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Out { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Out)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Out); } } } public override void SetUnread(TLBool value) { Unread = value; } public override TLBool Unread { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Unread)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); NotifyOfPropertyChange(() => Status); } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FwdFromId = GetObject(input); FwdDate = GetObject(input); FromId = GetObject(input); ToId = GetObject(input); _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FwdFromId.ToStream(output); FwdDate.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); _date.ToStream(output); Message.ToStream(output); _media.ToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessageForwarded17)message; Flags = m.Flags; } } [Obsolete] public class TLMessageForwarded : TLMessage { public new const uint Signature = TLConstructors.TLMessageForwarded; public TLInt FwdFromId { get; set; } public TLUserBase FwdFrom { get { var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(FwdFromId); } } public TLInt FwdDate { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); Out = GetObject(bytes, ref position); Unread = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _media = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { var id = GetObject(input); if (id.Value != 0) { Id = id; } FwdFromId = GetObject(input); FwdDate = GetObject(input); FromId = GetObject(input); ToId = GetObject(input); Out = GetObject(input); Unread = GetObject(input); _date = GetObject(input); Message = GetObject(input); _media = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id = Id ?? new TLInt(0); Id.ToStream(output); FwdFromId.ToStream(output); FwdDate.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); Out.ToStream(output); Unread.ToStream(output); _date.ToStream(output); Message.ToStream(output); _media.ToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessageForwarded)message; FwdFromId = m.FwdFromId; FwdDate = m.FwdDate; } } public class TLMessageService49 : TLMessageService40, IReplyToMsgId { public new const uint Signature = TLConstructors.TLMessageService49; private TLInt _replyToMsgId; public TLInt ReplyToMsgId { get { return _replyToMsgId; } set { SetField(out _replyToMsgId, value, ref _flags, (int)MessageFlags.ReplyToMsgId); } } public override ReplyInfo ReplyInfo { get { return ReplyToMsgId != null ? new ReplyInfo { ReplyToMsgId = ReplyToMsgId, Reply = Reply } : null; } } public TLMessageService49 Media { get { return this; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = IsSet(Flags, (int)MessageFlags.FromId) ? GetObject(bytes, ref position) : new TLInt(-1); ToId = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } _date = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(input); } _date = GetObject(input); // workaround: RandomId and Status were missing here, so Flags.31 (bits 100000...000) is recerved to handle this issue if (IsSet(Flags, int.MinValue)) { var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; } Action = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Set(ref _flags, int.MinValue); // workaround Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); ToStream(output, ReplyToMsgId, Flags, (int)MessageFlags.ReplyToMsgId); _date.ToStream(output); // workaround: RandomId and Status were missing here, so Flags.31 is recerved to handle this issue RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); Action.ToStream(output); CustomFlags.NullableToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessageService49; if (m != null) { if (m.ReplyToMsgId != null) { ReplyToMsgId = m.ReplyToMsgId; } } } public override string ToString() { return base.ToString() + string.Format("ReplyToMsgId={0} Reply={1}", ReplyToMsgId != null ? ReplyToMsgId.Value.ToString(CultureInfo.InvariantCulture) : "null", Reply != null ? Reply.GetType().Name : "null"); } } public class TLMessageService40 : TLMessageService17 { public new const uint Signature = TLConstructors.TLMessageService40; private TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public bool Silent { get { return IsSet(Flags, (int)MessageFlags.Silent); } } public bool Post { get { return IsSet(Flags, (int)MessageFlags.Post); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = IsSet(Flags, (int)MessageFlags.FromId) ? GetObject(bytes, ref position) : new TLInt(-1); ToId = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); _date = GetObject(input); // workaround: RandomId and Status were missing here, so Flags.31 (bits 100000...000) is recerved to handle this issue if (IsSet(Flags, int.MinValue)) { var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; } Action = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Set(ref _flags, int.MinValue); // workaround Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); _date.ToStream(output); // workaround: RandomId and Status were missing here, so Flags.31 is recerved to handle this issue RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); Action.ToStream(output); CustomFlags.NullableToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = message as TLMessageService40; if (m != null) { if (m.CustomFlags != null) { CustomFlags = m.CustomFlags; } } } public override string ToString() { return base.ToString() + " CustomFlags=" + MessageCustomFlagsString(CustomFlags); } } public class TLMessageService17 : TLMessageService { public new const uint Signature = TLConstructors.TLMessageService17; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Out { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Out)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Out); } } } public override void SetUnread(TLBool value) { Unread = value; } public override void SetUnreadSilent(TLBool value) { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); } } public override TLBool Unread { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Unread)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); NotifyOfPropertyChange(() => Status); } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); FromId = GetObject(bytes, ref position); ToId = GetObject(bytes, ref position); _date = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); var id = GetObject(input); if (id.Value != 0) { Id = id; } FromId = GetObject(input); ToId = GetObject(input); _date = GetObject(input); // workaround: RandomId and Status were missing here, so Flags.31 (bits 100000...000) is recerved to handle this issue if (IsSet(_flags, int.MinValue)) { var randomId = GetObject(input); if (randomId.Value != 0) { RandomId = randomId; } var status = GetObject(input); _status = (MessageStatus)status.Value; } Action = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Set(ref _flags, int.MinValue); // workaround Flags.ToStream(output); Id = Id ?? new TLInt(0); Id.ToStream(output); FromId.ToStream(output); ToId.ToStream(output); _date.ToStream(output); // workaround: RandomId and Status were missing here, so Flags.31 is recerved to handle this issue RandomId = RandomId ?? new TLLong(0); RandomId.ToStream(output); var status = new TLInt((int)Status); output.Write(status.ToBytes()); Action.ToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessageService17)message; Flags = m.Flags; } public override string ToString() { return base.ToString() + " Flags=" + MessageFlagsString(Flags); } } public class TLMessageService : TLMessageCommon { public const uint Signature = TLConstructors.TLMessageService; public TLMessageActionBase Action { get; set; } public override double MediaWidth { get { var phoneCall = Action as TLMessageActionPhoneCall; if (phoneCall != null) { return 12.0 + 284.0 + 12.0; } return base.MediaWidth; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); base.FromBytes(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { var id = GetObject(input); if (id.Value != 0) { Id = id; } base.FromStream(input); Action = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id = Id ?? new TLInt(0); Id.ToStream(output); base.ToStream(output); Action.ToStream(output); } public override void Update(TLMessageBase message) { base.Update(message); var m = (TLMessageService)message; if (Action != null) { Action.Update(m.Action); } else { Action = m.Action; } } public override void Edit(TLMessageBase messageBase) { var message = messageBase as TLMessageService; if (message != null) { var oldMessageMediaActionGame = Action as TLMessageActionGameScore; var newMessageMediaActionGame = message.Action as TLMessageActionGameScore; if (oldMessageMediaActionGame != null && newMessageMediaActionGame != null && oldMessageMediaActionGame.Score.Value != newMessageMediaActionGame.Score.Value) { oldMessageMediaActionGame.Score = newMessageMediaActionGame.Score; } } } public override Visibility SelectionVisibility { get { return Visibility.Collapsed; } } public override string ToString() { return base.ToString() + " action=" + Action; } } } ================================================ FILE: Telegram.Api/TL/TLMessageAction.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum MessageActionPhoneCallFlags { Reason = 0x1, // 0 Duration = 0x2, // 1 } [Flags] public enum MessageActionPaymentSentMeFlags { Info = 0x1, // 0 ShippingOptionId = 0x2, // 1 } public abstract class TLMessageActionBase : TLObject { public abstract void Update(TLMessageActionBase newAction); public TLPhotoBase Photo { get; set; } } public class TLMessageActionEmpty : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChatCreate : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatCreate; public TLString Title { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Title = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Title = GetObject(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Title.ToStream(output); Users.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatCreate; if (action != null) { Title = action.Title; Users = action.Users; } } } public class TLMessageActionChannelCreate : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChannelCreate; public TLString Title { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Title = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Title = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Title.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChannelCreate; if (action != null) { Title = action.Title; } } } public class TLMessageActionToggleComments : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionToggleComments; public TLBool Enabled { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Enabled = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Enabled = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Enabled.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionToggleComments; if (action != null) { Enabled = action.Enabled; } } } public class TLMessageActionChatEditTitle : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatEditTitle; public TLString Title { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Title = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Title = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Title.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatEditTitle; if (action != null) { Title = action.Title; } } } public class TLMessageActionChatEditPhoto : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatEditPhoto; //public TLPhotoBase Photo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Photo = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Photo = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Photo.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatEditPhoto; if (action != null) { if (Photo != null) { Photo.Update(action.Photo); } else { Photo = action.Photo; } } } } public class TLMessageActionChatDeletePhoto : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatDeletePhoto; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChannelJoined : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChannelJoined; public TLInt InviterId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); InviterId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { InviterId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); InviterId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChannelJoined; if (action != null) { InviterId = action.InviterId; } } } public abstract class TLMessageActionChatAddUserBase : TLMessageActionBase { } public class TLMessageActionChatAddUser : TLMessageActionChatAddUserBase { public const uint Signature = TLConstructors.TLMessageActionChatAddUser; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatAddUser; if (action != null) { UserId = action.UserId; } } } public class TLMessageActionChatAddUser41 : TLMessageActionChatAddUserBase { public const uint Signature = TLConstructors.TLMessageActionChatAddUser41; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Users.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatAddUser41; if (action != null) { Users = action.Users; } } } public class TLMessageActionChatDeleteUser : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatDeleteUser; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { var action = newAction as TLMessageActionChatDeleteUser; if (action != null) { UserId = action.UserId; } } } public class TLMessageActionChatJoinedByLink : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatJoinedByLink; public TLInt InviterId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); InviterId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { InviterId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); InviterId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionUnreadMessages : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionUnreadMessages; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionContactRegistered : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionContactRegistered; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionMessageGroup : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionMessageGroup; public TLMessageGroup Group { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Group = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Group = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Group.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChatMigrateTo : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatMigrateTo; public TLInt ChannelId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChatDeactivate : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatDeactivate; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChatActivate : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChatActivate; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionChannelMigrateFrom : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionChannelMigrateFrom; public TLString Title { get; set; } public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Title = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Title = GetObject(input); ChatId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Title.ToStream(output); ChatId.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionPinMessage : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionPinMessage; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionClearHistory : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionClearHistory; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionGameScore : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionGameScore; public TLLong GameId { get; set; } public TLInt Score { get; set; } public override string ToString() { return string.Format("{0} game_id={1} score={2}", GetType().Name, GameId, Score); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); GameId = GetObject(bytes, ref position); Score = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { GameId = GetObject(input); Score = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); GameId.ToStream(output); Score.ToStream(output); } public override void Update(TLMessageActionBase action) { var actionGameScore = action as TLMessageActionGameScore; if (actionGameScore != null) { GameId = actionGameScore.GameId; Score = actionGameScore.Score; } } } public class TLMessageActionPhoneCall : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionPhoneCall; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLLong CallId { get; set; } protected TLPhoneCallDiscardReasonBase _reason; public TLPhoneCallDiscardReasonBase Reason { get { return _reason; } set { SetField(out _reason, value, ref _flags, (int) MessageActionPhoneCallFlags.Reason); } } protected TLInt _duration; public TLInt Duration { get { return _duration; } set { SetField(out _duration, value, ref _flags, (int) MessageActionPhoneCallFlags.Duration); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); CallId = GetObject(bytes, ref position); _reason = GetObject(Flags, (int) MessageActionPhoneCallFlags.Reason, null, bytes, ref position); _duration = GetObject(Flags, (int) MessageActionPhoneCallFlags.Duration, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); CallId = GetObject(input); _reason = GetObject(Flags, (int) MessageActionPhoneCallFlags.Reason, null, input); _duration = GetObject(Flags, (int) MessageActionPhoneCallFlags.Duration, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); CallId.ToStream(output); ToStream(output, Reason, Flags, (int) MessageActionPhoneCallFlags.Reason); ToStream(output, Duration, Flags, (int) MessageActionPhoneCallFlags.Duration); } public override void Update(TLMessageActionBase action) { var actionPhoneCall = action as TLMessageActionPhoneCall; if (actionPhoneCall != null) { CallId = actionPhoneCall.CallId; Reason = actionPhoneCall.Reason; Duration = actionPhoneCall.Duration; } } } public abstract class TLMessageActionPaymentSentBase : TLMessageActionBase { public TLString Currency { get; set; } public TLLong TotalAmount { get; set; } } public class TLMessageActionPaymentSentMe : TLMessageActionPaymentSentBase { public const uint Signature = TLConstructors.TLMessageActionPaymentSentMe; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString Payload { get; set; } protected TLPaymentRequestedInfo _info; public TLPaymentRequestedInfo Info { get { return _info; } set { SetField(out _info, value, ref _flags, (int) MessageActionPaymentSentMeFlags.Info); } } protected TLString _shippingOptionId; public TLString ShippingOptionId { get { return _shippingOptionId; } set { SetField(out _shippingOptionId, value, ref _flags, (int) MessageActionPaymentSentMeFlags.ShippingOptionId); } } public TLPaymentCharge Charge { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Currency = GetObject(bytes, ref position); TotalAmount = GetObject(bytes, ref position); Payload = GetObject(bytes, ref position); _info = GetObject(Flags, (int) MessageActionPaymentSentMeFlags.Info, null, bytes, ref position); _shippingOptionId = GetObject(Flags, (int) MessageActionPaymentSentMeFlags.ShippingOptionId, null, bytes, ref position); Charge = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Currency = GetObject(input); TotalAmount = GetObject(input); Payload = GetObject(input); _info = GetObject(Flags, (int) MessageActionPaymentSentMeFlags.Info, null, input); _shippingOptionId = GetObject(Flags, (int) MessageActionPaymentSentMeFlags.ShippingOptionId, null, input); Charge = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Currency.ToStream(output); TotalAmount.ToStream(output); Payload.ToStream(output); ToStream(output, _info, Flags, (int) MessageActionPaymentSentMeFlags.Info); ToStream(output, _shippingOptionId, Flags, (int) MessageActionPaymentSentMeFlags.ShippingOptionId); Charge.ToStream(output); } public override void Update(TLMessageActionBase action) { var actionPaymentSentMe = action as TLMessageActionPaymentSentMe; if (actionPaymentSentMe != null) { Currency = actionPaymentSentMe.Currency; TotalAmount = actionPaymentSentMe.TotalAmount; Payload = actionPaymentSentMe.Payload; Info = actionPaymentSentMe.Info; ShippingOptionId = actionPaymentSentMe.ShippingOptionId; Charge = actionPaymentSentMe.Charge; } } } public class TLMessageActionPaymentSent : TLMessageActionPaymentSentBase { public const uint Signature = TLConstructors.TLMessageActionPaymentSent; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Currency = GetObject(bytes, ref position); TotalAmount = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Currency = GetObject(input); TotalAmount = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Currency.ToStream(output); TotalAmount.ToStream(output); } public override void Update(TLMessageActionBase action) { var actionPaymentSent = action as TLMessageActionPaymentSent; if (actionPaymentSent != null) { Currency = actionPaymentSent.Currency; TotalAmount = actionPaymentSent.TotalAmount; } } } public class TLMessageActionScreenshotTaken : TLMessageActionPaymentSentBase { public const uint Signature = TLConstructors.TLMessageActionScreenshotTaken; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLMessageActionBase action) { } } public class TLMessageActionCustomAction : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionCustomAction; public TLString Message { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Message = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionBotAllowed : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionBotAllowed; public TLString Domain { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Domain = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Domain = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Domain.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionSecureValuesSentMe : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionSecureValuesSentMe; public TLVector Values { get; set; } public TLSecureCredentialsEncrypted Credentials { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Values = GetObject>(bytes, ref position); Credentials = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Values = GetObject>(input); Credentials = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Values.ToStream(output); Credentials.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } public class TLMessageActionSecureValuesSent : TLMessageActionBase { public const uint Signature = TLConstructors.TLMessageActionSecureValuesSent; public TLVector Types { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Types = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Types = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Types.ToStream(output); } public override void Update(TLMessageActionBase newAction) { } } } ================================================ FILE: Telegram.Api/TL/TLMessageContainer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; using System.Linq; namespace Telegram.Api.TL { public class TLContainer : TLObject { public const uint Signature = TLConstructors.TLContainer; public List Messages { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = new List(); var length = BitConverter.ToInt32(bytes, position); position += 4; for (var i = 0; i < length; i++) { Messages.Add(GetObject(bytes, ref position)); } return this; } public override byte[] ToBytes() { var stream = new MemoryStream(); foreach (var message in Messages) { var bytes = message.ToBytes(); stream.Write(bytes, 0, bytes.Length); } return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), BitConverter.GetBytes(Messages.Count), stream.ToArray()); } } } ================================================ FILE: Telegram.Api/TL/TLMessageEditData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum MessageEditDataFlags { Caption = 0x1, // 0 } public class TLMessageEditData : TLObject { public const uint Signature = TLConstructors.TLMessageEditData; public TLInt Flags { get; set; } public bool Caption { get { return IsSet(Flags, (int) MessageEditDataFlags.Caption); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessageEntity.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLMessageEntityBase : TLObject { public TLInt Offset { get; set; } public TLInt Length { get; set; } } public class TLMessageEntityUnknown : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityMention : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityMention; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityHashtag : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityHashtag; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityBotCommand : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityBotCommand; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityUrl : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityUrl; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityEmail : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityEmail; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityBold : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityBold; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityItalic : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityItalic; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityCode : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityCode; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityPre : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityPre; public TLString Language { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); Language = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes(), Language.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); Language.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); Language = GetObject(input); return this; } } public class TLMessageEntityTextUrl : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityTextUrl; public TLString Url { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes(), Url.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); Url.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); Url = GetObject(input); return this; } } public class TLInputMessageEntityMentionName : TLMessageEntityBase { public const uint Signature = TLConstructors.TLInputMessageEntityMentionName; public TLInputUserBase User { get; set; } public string Name { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); User = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes(), User.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); User.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); User = GetObject(input); return this; } } public class TLMessageEntityMentionName : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityMentionName; public TLInt UserId { get; set; } public string Name { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes(), UserId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); UserId = GetObject(input); return this; } } public class TLMessageEntityPhone : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityPhone; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } public class TLMessageEntityCashtag : TLMessageEntityBase { public const uint Signature = TLConstructors.TLMessageEntityCashtag; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Offset = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Offset.ToBytes(), Length.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Offset.ToStream(output); Length.ToStream(output); } public override TLObject FromStream(Stream input) { Offset = GetObject(input); Length = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessageFwdHeader.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Services.Cache; namespace Telegram.Api.TL { [Flags] public enum MessageFwdHeaderFlags { From = 0x1, // 0 Channel = 0x2, // 1 ChannelPost = 0x4, // 2 PostAuthor = 0x8, // 3 Saved = 0x10, // 4 } public class TLMessageFwdHeader : TLObject { public const uint Signature = TLConstructors.TLMessageFwdHeader; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLInt _fromId; public TLInt FromId { get { return _fromId; } set { if (value != null) { _fromId = value; Set(ref _flags, (int)MessageFwdHeaderFlags.From); } else { Unset(ref _flags, (int)MessageFwdHeaderFlags.From); } } } public TLInt Date { get; set; } private TLInt _channelId; public TLInt ChannelId { get { return _channelId; } set { if (value != null) { _channelId = value; Set(ref _flags, (int) MessageFwdHeaderFlags.Channel); } else { Unset(ref _flags, (int)MessageFwdHeaderFlags.Channel); } } } private TLInt _channelPost; public TLInt ChannelPost { get { return _channelPost; } set { if (value != null) { _channelPost = value; Set(ref _flags, (int)MessageFwdHeaderFlags.ChannelPost); } else { Unset(ref _flags, (int)MessageFwdHeaderFlags.ChannelPost); } } } private string _fullName; public virtual string FullName { get { if (_fullName != null) return _fullName; var cacheService = InMemoryCacheService.Instance; var channel = ChannelId != null? cacheService.GetChat(ChannelId) : null; var user = FromId != null? cacheService.GetUser(FromId) : null; if (channel != null && user != null) { _fullName = string.Format("{0} ({1})", channel.FullName, user.FullName); return _fullName; } if (channel != null) { _fullName = channel.FullName; return _fullName; } if (user != null) { _fullName = user.FullName2; return _fullName; } return null; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); if (IsSet(Flags, (int) MessageFwdHeaderFlags.From)) { FromId = GetObject(bytes, ref position); } Date = GetObject(bytes, ref position); if (IsSet(Flags, (int) MessageFwdHeaderFlags.Channel)) { ChannelId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFwdHeaderFlags.ChannelPost)) { ChannelPost = GetObject(bytes, ref position); } return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); if (IsSet(Flags, (int) MessageFwdHeaderFlags.From)) { FromId = GetObject(input); } Date = GetObject(input); if (IsSet(Flags, (int) MessageFwdHeaderFlags.Channel)) { ChannelId = GetObject(input); } if (IsSet(Flags, (int)MessageFwdHeaderFlags.ChannelPost)) { ChannelPost = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, FromId, Flags, (int)MessageFwdHeaderFlags.From); Date.ToStream(output); ToStream(output, ChannelId, Flags, (int)MessageFwdHeaderFlags.Channel); ToStream(output, ChannelPost, Flags, (int)MessageFwdHeaderFlags.ChannelPost); } public TLPeerBase ToFwdFromPeer() { if (ChannelId != null) { return new TLPeerChannel{ Id = ChannelId }; } return new TLPeerUser { Id = FromId }; } } public class TLMessageFwdHeader73 : TLMessageFwdHeader70 { public new const uint Signature = TLConstructors.TLMessageFwdHeader73; private TLPeerBase _savedFromPeer; public TLPeerBase SavedFromPeer { get { return _savedFromPeer; } set { SetField(out _savedFromPeer, value, ref _flags, (int)MessageFwdHeaderFlags.Saved); } } private TLInt _savedFromMsgId; public TLInt SavedFromMsgId { get { return _savedFromMsgId; } set { SetField(out _savedFromMsgId, value, ref _flags, (int)MessageFwdHeaderFlags.Saved); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); FromId = GetObject(Flags, (int)MessageFwdHeaderFlags.From, null, bytes, ref position); Date = GetObject(bytes, ref position); ChannelId = GetObject(Flags, (int)MessageFwdHeaderFlags.Channel, null, bytes, ref position); ChannelPost = GetObject(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, bytes, ref position); PostAuthor = GetObject(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, bytes, ref position); SavedFromPeer = GetObject(Flags, (int)MessageFwdHeaderFlags.Saved, null, bytes, ref position); SavedFromMsgId = GetObject(Flags, (int)MessageFwdHeaderFlags.Saved, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); FromId = GetObject(Flags, (int)MessageFwdHeaderFlags.From, null, input); Date = GetObject(input); ChannelId = GetObject(Flags, (int)MessageFwdHeaderFlags.Channel, null, input); ChannelPost = GetObject(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, input); PostAuthor = GetObject(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, input); SavedFromPeer = GetObject(Flags, (int)MessageFwdHeaderFlags.Saved, null, input); SavedFromMsgId = GetObject(Flags, (int)MessageFwdHeaderFlags.Saved, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, FromId, Flags, (int)MessageFwdHeaderFlags.From); Date.ToStream(output); ToStream(output, ChannelId, Flags, (int)MessageFwdHeaderFlags.Channel); ToStream(output, ChannelPost, Flags, (int)MessageFwdHeaderFlags.ChannelPost); ToStream(output, PostAuthor, Flags, (int)MessageFwdHeaderFlags.PostAuthor); ToStream(output, SavedFromPeer, Flags, (int)MessageFwdHeaderFlags.Saved); ToStream(output, SavedFromMsgId, Flags, (int)MessageFwdHeaderFlags.Saved); } } public class TLMessageFwdHeader70 : TLMessageFwdHeader { public new const uint Signature = TLConstructors.TLMessageFwdHeader70; private TLString _postAuthor; public TLString PostAuthor { get { return _postAuthor; } set { SetField(out _postAuthor, value, ref _flags, (int) MessageFwdHeaderFlags.PostAuthor); } } private TLObject _from; public TLObject From { get { if (_from != null) return _from; if (FromId == null && ChannelId == null) return null; if (ChannelId != null) { var cacheService = InMemoryCacheService.Instance; _from = cacheService.GetChat(ChannelId); } else if (FromId != null) { var cacheService = InMemoryCacheService.Instance; _from = cacheService.GetUser(FromId); } return _from; } } private string _fullName; public override string FullName { get { if (_fullName != null) return _fullName; var cacheService = InMemoryCacheService.Instance; var channel = ChannelId != null ? cacheService.GetChat(ChannelId) : null; var user = FromId != null ? cacheService.GetUser(FromId) : null; if (channel != null && (user != null || !TLString.IsNullOrEmpty(PostAuthor))) { _fullName = string.Format("{0} ({1})", channel.FullName, user != null ? user.FullName : PostAuthor.ToString()); return _fullName; } if (channel != null) { _fullName = channel.FullName; return _fullName; } if (!TLString.IsNullOrEmpty(PostAuthor)) { return _fullName = PostAuthor.ToString(); } if (user != null) { _fullName = user.FullName2; return _fullName; } return null; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); FromId = GetObject(Flags, (int)MessageFwdHeaderFlags.From, null, bytes, ref position); Date = GetObject(bytes, ref position); ChannelId = GetObject(Flags, (int)MessageFwdHeaderFlags.Channel, null, bytes, ref position); ChannelPost = GetObject(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, bytes, ref position); PostAuthor = GetObject(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); FromId = GetObject(Flags, (int)MessageFwdHeaderFlags.From, null, input); Date = GetObject(input); ChannelId = GetObject(Flags, (int)MessageFwdHeaderFlags.Channel, null, input); ChannelPost = GetObject(Flags, (int)MessageFwdHeaderFlags.ChannelPost, null, input); PostAuthor = GetObject(Flags, (int)MessageFwdHeaderFlags.PostAuthor, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, FromId, Flags, (int)MessageFwdHeaderFlags.From); Date.ToStream(output); ToStream(output, ChannelId, Flags, (int)MessageFwdHeaderFlags.Channel); ToStream(output, ChannelPost, Flags, (int)MessageFwdHeaderFlags.ChannelPost); ToStream(output, PostAuthor, Flags, (int)MessageFwdHeaderFlags.PostAuthor); } } } ================================================ FILE: Telegram.Api/TL/TLMessageGroup.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLMessageGroup : TLObject { public const uint Signature = TLConstructors.TLMessageGroup; public TLInt MinId { get; set; } public TLInt MaxId { get; set; } public TLInt Count { get; set; } public TLInt Date { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MinId.ToBytes(), MaxId.ToBytes(), Count.ToBytes(), Date.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MinId = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); MinId.ToStream(output); MaxId.ToStream(output); Count.ToStream(output); Date.ToStream(output); } public override TLObject FromStream(Stream input) { MinId = GetObject(input); MaxId = GetObject(input); Count = GetObject(input); Date = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessageInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLMessageDetailedInfoBase : TLObject { public TLLong AnswerMessageId { get; set; } public TLInt Bytes { get; set; } public TLInt Status { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { AnswerMessageId = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); Status = GetObject(bytes, ref position); return this; } } public class TLMessageDetailedInfo : TLMessageDetailedInfoBase { public const uint Signature = TLConstructors.TLMessageDetailedInfo; public TLLong MessageId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MessageId = GetObject(bytes, ref position); return base.FromBytes(bytes, ref position); } } public class TLMessageNewDetailedInfo : TLMessageDetailedInfoBase { public const uint Signature = TLConstructors.TLMessageNewDetailedInfo; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return base.FromBytes(bytes, ref position); } } public class TLMessagesAllInfo : TLObject { public const uint Signature = TLConstructors.TLMessagesAllInfo; public TLVector MessageIds { get; set; } public TLString Info { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MessageIds = GetObject>(bytes, ref position); Info = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessageMedia.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; #if WP81 using Windows.Media.Transcoding; #endif using System.Linq; #if WIN_RT using Windows.UI.Xaml; #else using System.Windows; #endif #if WP8 using Windows.Storage; #endif using Telegram.Api.Services.Cache; using Telegram.Api.Extensions; using Telegram.Api.Services; namespace Telegram.Api.TL { [Flags] public enum MessageMediaPhotoFlags { Photo = 0x1, // 0 Caption = 0x2, // 1 TTLSeconds = 0x4, // 2 } [Flags] public enum MessageMediaDocumentFlags { Document = 0x1, // 0 Caption = 0x2, // 1 TTLSeconds = 0x4, // 2 } [Flags] public enum MessageMediaInvoiceFlags { Photo = 0x1, // 0 ShippingAddressRequested = 0x2, // 1 ReceiptMsgId = 0x4, // 2 Test = 0x8, // 3 } public interface IMediaCaption { TLString Caption { get; set; } } public interface ITTLMessageMedia { TLInt TTLSeconds { get; set; } TTLParams TTLParams { get; set; } } public interface IMediaGifBase { double DownloadingProgress { get; set; } double LastProgress { get; set; } bool IsCanceled { get; set; } string IsoFileName { get; set; } bool? AutoPlayGif { get; set; } bool Forbidden { get; set; } } public interface IMediaGif : IMediaGifBase { TLDocumentBase Document { get; } } public interface IDecryptedMediaGif : IMediaGifBase { TLDecryptedMessageMediaDocument Document { get; } } public interface IMessageMediaGeoPoint { TLGeoPointBase Geo { get; } } public abstract class TLMessageMediaBase : TLObject { public bool Forbidden { get; set; } public virtual bool? AutoPlayGif { get; set; } public TLMessageMediaBase Self { get { return this; } } public TLMessageMediaBase ThumbSelf { get { return this; } } public virtual int MediaSize { get { return 0; } } private double _uploadingProgress; public double UploadingProgress { get { return _uploadingProgress; } set { SetField(ref _uploadingProgress, value, () => UploadingProgress); } } private double _downloadingProgress; public double DownloadingProgress { get { return _downloadingProgress; } set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } } private double _compressingProgress; public double CompressingProgress { get { return _compressingProgress; } set { SetField(ref _compressingProgress, value, () => CompressingProgress); } } public double LastProgress { get; set; } private bool _notListened; public bool NotListened { get { return _notListened; } set { _notListened = value; } } private bool _out = true; public bool Out { get { return _out; } set { _out = value; } } /// /// For internal use /// public TLLong FileId { get; set; } public string IsoFileName { get; set; } #if WP8 public StorageFile File { get; set; } #endif #if WP81 public PrepareTranscodeResult TranscodeResult { get; set; } #endif private bool _isCanceled; public bool IsCanceled { get { return _isCanceled; } set { _isCanceled = value; } } public virtual double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } } public class TLMessageMediaEmpty : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLMessageMediaDocument75 : TLMessageMediaDocument70 { public new const uint Signature = TLConstructors.TLMessageMediaDocument75; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _document = GetObject(Flags, (int)MessageMediaDocumentFlags.Document, null, bytes, ref position); Caption = null; _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _document = GetObject(Flags, (int)MessageMediaDocumentFlags.Document, null, input); Caption = null; _ttlSeconds = GetObject(Flags, (int)MessageMediaDocumentFlags.TTLSeconds, null, input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Document, Flags, (int)MessageMediaDocumentFlags.Document); ToStream(output, TTLSeconds, Flags, (int)MessageMediaDocumentFlags.TTLSeconds); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Document != null ? "TLMessageMediaDocument75 " + Document : "TLMessageMediaDocument70"; } } public class TLMessageMediaDocument70 : TLMessageMediaDocument45, ITTLMessageMedia { public new const uint Signature = TLConstructors.TLMessageMediaDocument70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLDocumentBase _document; public override TLDocumentBase Document { get { return _document; } set { SetField(out _document, value, ref _flags, (int)MessageMediaDocumentFlags.Document); } } protected TLString _caption; public override TLString Caption { get { return _caption; } set { SetField(out _caption, value, ref _flags, (int)MessageMediaDocumentFlags.Caption); } } protected TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)MessageMediaDocumentFlags.TTLSeconds); } } public TTLParams TTLParams { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _document = GetObject(Flags, (int)MessageMediaDocumentFlags.Document, null, bytes, ref position); Caption = GetObject(Flags, (int)MessageMediaPhotoFlags.Caption, TLString.Empty, bytes, ref position); _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _document = GetObject(Flags, (int)MessageMediaDocumentFlags.Document, null, input); Caption = GetObject(Flags, (int)MessageMediaDocumentFlags.Caption, TLString.Empty, input); _ttlSeconds = GetObject(Flags, (int)MessageMediaDocumentFlags.TTLSeconds, null, input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Document, Flags, (int)MessageMediaDocumentFlags.Document); ToStream(output, Caption, Flags, (int)MessageMediaDocumentFlags.Caption); ToStream(output, TTLSeconds, Flags, (int)MessageMediaDocumentFlags.TTLSeconds); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Document != null ? "TLMessageMediaDocument70 " + Document : "TLMessageMediaDocument70"; } } public class TLMessageMediaDocument45 : TLMessageMediaDocument, IMediaCaption { public new const uint Signature = TLConstructors.TLMessageMediaDocument45; private bool? _autoPlayGif; public override bool? AutoPlayGif { get { if (TLMessageBase.IsRoundVideo(Document)) { return true; } return _autoPlayGif; } set { _autoPlayGif = value; } } public virtual TLString Caption { get; set; } public TLString Waveform { get { var document = Document as TLDocument22; if (document != null) { var documentAttributeAudio = document.Attributes.FirstOrDefault(x => x is TLDocumentAttributeAudio46) as TLDocumentAttributeAudio46; if (documentAttributeAudio != null) { return documentAttributeAudio.Waveform; } } return null; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Document = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Document = GetObject(input); Caption = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Document.ToStream(output); Caption.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } } public class TLMessageMediaDocument : TLMessageMediaBase, IMediaGif { public const uint Signature = TLConstructors.TLMessageMediaDocument; public virtual TLDocumentBase Document { get; set; } public TLDocumentBase Video { get { return Document; } } public override int MediaSize { get { return Document.DocumentSize; } } public override double MediaWidth { get { var document = Document as TLDocument22; if (document != null) { if (TLMessageBase.HasTTL(this)) { return 2.0 + 256.0 + 2.0; } if (TLMessageBase.IsSticker(document)) { var maxStickerDimension = 196.0; return 6.0 + GetStickerDimension(document, true, maxStickerDimension) + 6.0; } if (TLMessageBase.IsVoice(document)) { return 12.0 + 284.0 + 12.0; } if (TLMessageBase.IsRoundVideo(document)) { return 2.0 + 240.0 + 2.0; } if (TLMessageBase.IsVideo(document)) { return 2.0 + 230.0 + 2.0; } if (TLMessageBase.IsGif(document)) { var maxGifDimension = 323.0; return 2.0 + GetGifDimension(document.Thumb as IPhotoSize, document, true, maxGifDimension) + 2.0; } } return base.MediaWidth; } } public static double GetGifDimension(IPhotoSize thumb, IAttributes source, bool isWidth, double maxGifDimension) { TLDocumentAttributeVideo videoAttribute = null; if (source != null) { for (var i = 0; i < source.Attributes.Count; i++) { videoAttribute = source.Attributes[i] as TLDocumentAttributeVideo; if (videoAttribute != null) { break; } } } if (videoAttribute != null) { var width = videoAttribute.W.Value; var height = videoAttribute.H.Value; var maxDimension = width; if (maxDimension > 0) { var scaleFactor = maxGifDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } } if (thumb != null) { var width = thumb.W.Value; var height = thumb.H.Value; var maxDimension = width; if (maxDimension > 0) { var scaleFactor = maxGifDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } } return maxGifDimension; } public static double GetStickerDimension(IAttributes source, bool isWidth, double maxImageDimension) { TLDocumentAttributeImageSize imageSizeAttribute = null; for (var i = 0; i < source.Attributes.Count; i++) { imageSizeAttribute = source.Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { break; } } if (imageSizeAttribute != null) { var width = imageSizeAttribute.W.Value; var height = imageSizeAttribute.H.Value; var maxDimension = Math.Max(width, height); if (maxDimension > maxImageDimension) { var scaleFactor = maxImageDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } return isWidth ? width : height; } return isWidth ? double.NaN : maxImageDimension; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Document = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Document = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Document.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } } public class TLMessageMediaAudio : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaAudio; public TLAudioBase Audio { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Audio = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Audio = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Audio.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } } public class TLMessageMediaPhoto75 : TLMessageMediaPhoto70 { public new const uint Signature = TLConstructors.TLMessageMediaPhoto75; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _photo = GetObject(Flags, (int)MessageMediaPhotoFlags.Photo, null, bytes, ref position); Caption = null; _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _photo = GetObject(Flags, (int)MessageMediaPhotoFlags.Photo, null, input); Caption = null; _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Photo, Flags, (int)MessageMediaPhotoFlags.Photo); ToStream(output, TTLSeconds, Flags, (int)MessageMediaPhotoFlags.TTLSeconds); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Photo != null ? "TLMessageMediaPhoto75 " + Photo : "TLMessageMediaPhoto75"; } } public class TLMessageMediaPhoto70 : TLMessageMediaPhoto28, ITTLMessageMedia { public new const uint Signature = TLConstructors.TLMessageMediaPhoto70; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLPhotoBase _photo; public override TLPhotoBase Photo { get { return _photo; } set { SetField(out _photo, value, ref _flags, (int)MessageMediaPhotoFlags.Photo); } } protected TLString _caption; public override TLString Caption { get { return _caption; } set { SetField(out _caption, value, ref _flags, (int)MessageMediaPhotoFlags.Caption); } } protected TLInt _ttlSeconds; public TLInt TTLSeconds { get { return _ttlSeconds; } set { SetField(out _ttlSeconds, value, ref _flags, (int)MessageMediaPhotoFlags.TTLSeconds); } } public TTLParams TTLParams { get; set; } public override double MediaWidth { get { if (TLMessageBase.HasTTL(this) && Photo != null) { return 2.0 + 256.0 + 2.0; } return base.MediaWidth; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _photo = GetObject(Flags, (int)MessageMediaPhotoFlags.Photo, null, bytes, ref position); Caption = GetObject(Flags, (int)MessageMediaPhotoFlags.Caption, TLString.Empty, bytes, ref position); _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _photo = GetObject(Flags, (int)MessageMediaPhotoFlags.Photo, null, input); Caption = GetObject(Flags, (int)MessageMediaPhotoFlags.Caption, TLString.Empty, input); _ttlSeconds = GetObject(Flags, (int)MessageMediaPhotoFlags.TTLSeconds, null, input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Photo, Flags, (int)MessageMediaPhotoFlags.Photo); ToStream(output, Caption, Flags, (int)MessageMediaPhotoFlags.Caption); ToStream(output, TTLSeconds, Flags, (int)MessageMediaPhotoFlags.TTLSeconds); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Photo != null ? "TLMessageMediaPhoto70" + Photo : "TLMessageMediaPhoto70"; } } public class TLMessageMediaPhoto28 : TLMessageMediaPhoto, IMediaCaption { public new const uint Signature = TLConstructors.TLMessageMediaPhoto28; public virtual TLString Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Photo = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Photo = GetObject(input); Caption = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Photo.ToStream(output); Caption.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Photo.ToString(); } } public class TLMessageMediaPhoto : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaPhoto; public virtual TLPhotoBase Photo { get; set; } public override double MediaWidth { get { var minVerticalRatioToScale = 1.2; var scale = 1.2; // must be less than minVerticalRatioToScale to avoid large square photos var maxDimension = 323.0; var photo = Photo as TLPhoto; if (photo != null) { IPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(maxDimension - size.H.Value) > Math.Abs(maxDimension - photoSize.H.Value)) { size = photoSize; } } if (size != null) { if (size.H.Value > size.W.Value) { if (IsScaledVerticalPhoto(minVerticalRatioToScale, size.H, size.W)) { return 2.0 + scale * maxDimension / size.H.Value * size.W.Value + 2.0; } return 2.0 + maxDimension / size.H.Value * size.W.Value + 2.0; } return 2.0 + maxDimension + 2.0; } } return base.MediaWidth; } } public static bool IsScaledVerticalPhoto(double minRatio, TLInt heigth, TLInt width) { var ratio = (double)heigth.Value / width.Value; return ratio > minRatio; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Photo = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Photo = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Photo.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } public override string ToString() { return Photo.ToString(); } } public class TLMessageMediaVideo28 : TLMessageMediaVideo, IMediaCaption { public new const uint Signature = TLConstructors.TLMessageMediaVideo28; public TLString Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Video = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Video = GetObject(input); Caption = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Video.ToStream(output); Caption.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } } public class TLMessageMediaVideo : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaVideo; public TLVideoBase Video { get; set; } public override int MediaSize { get { return Video.VideoSize; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Video = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Video = GetObject(input); var isoFileName = GetObject(input); IsoFileName = isoFileName.ToString(); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Video.ToStream(output); var isoFileName = new TLString(IsoFileName); isoFileName.ToStream(output); } } public class TLMessageMediaGeo : TLMessageMediaBase, IMessageMediaGeoPoint { public const uint Signature = TLConstructors.TLMessageMediaGeo; public TLGeoPointBase Geo { get; set; } public override double MediaWidth { get { return 2.0 + 320.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Geo = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Geo = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Geo.ToStream(output); } } public class TLMessageMediaVenue72 : TLMessageMediaVenue { public new const uint Signature = TLConstructors.TLMessageMediaVenue72; public TLString VenueType { get; set; } #region Additional public Uri IconSource { get; set; } public TLUserBase User { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Geo = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Address = GetObject(bytes, ref position); Provider = GetObject(bytes, ref position); VenueId = GetObject(bytes, ref position); VenueType = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Geo = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); VenueType = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Geo.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); VenueType.ToStream(output); } } public class TLMessageMediaVenue : TLMessageMediaGeo { public new const uint Signature = TLConstructors.TLMessageMediaVenue; public TLString Title { get; set; } public TLString Address { get; set; } public TLString Provider { get; set; } public TLString VenueId { get; set; } public override double MediaWidth { get { return 2.0 + 320.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Geo = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Address = GetObject(bytes, ref position); Provider = GetObject(bytes, ref position); VenueId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Geo = GetObject(input); Title = GetObject(input); Address = GetObject(input); Provider = GetObject(input); VenueId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Geo.ToStream(output); Title.ToStream(output); Address.ToStream(output); Provider.ToStream(output); VenueId.ToStream(output); } } public class TLMessageMediaContact82 : TLMessageMediaContact { public new const uint Signature = TLConstructors.TLMessageMediaContact82; public TLString VCard { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneNumber = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); VCard = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); VCard = GetObject(input); UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); VCard.ToStream(output); UserId.ToStream(output); } } public class TLMessageMediaContact : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaContact; public TLString PhoneNumber { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public TLInt UserId { get; set; } public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } #region Additional public virtual string FullName { get { return string.Format("{0} {1}", FirstName, LastName); } } private TLUserBase _user; public TLUserBase User { get { if (_user != null) return _user; var cacheService = InMemoryCacheService.Instance; _user = cacheService.GetUser(UserId); if (_user == null) { if (UserId.Value > 0) { _user = new TLUser { FirstName = FirstName, LastName = LastName, Id = UserId, Phone = PhoneNumber, Photo = new TLPhotoEmpty { Id = new TLLong(0) } }; } else { _user = new TLUserNotRegistered { FirstName = FirstName, LastName = LastName, Id = UserId, Phone = PhoneNumber, Photo = new TLPhotoEmpty { Id = new TLLong(0) } }; } } return _user; } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneNumber = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PhoneNumber = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneNumber.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); UserId.ToStream(output); } public override string ToString() { return FullName; } } public abstract class TLMessageMediaUnsupportedBase : TLMessageMediaBase { } public class TLMessageMediaUnsupported : TLMessageMediaUnsupportedBase { public const uint Signature = TLConstructors.TLMessageMediaUnsupported; public TLString Bytes { get; set; } public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Bytes = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Bytes = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Bytes.ToStream(output); } } public class TLMessageMediaUnsupported24 : TLMessageMediaUnsupportedBase { public const uint Signature = TLConstructors.TLMessageMediaUnsupported24; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLMessageMediaWebPage : TLMessageMediaBase, IMediaGif { public const uint Signature = TLConstructors.TLMessageMediaWebPage; public TLWebPageBase WebPage { get; set; } #region Additional public TLDocumentBase Document { get { var webPage = WebPage as TLWebPage35; if (webPage != null) { return webPage.Document; } return null; } } public TLPhotoBase Photo { get { var webPage = WebPage as TLWebPage; if (webPage != null) { return webPage.Photo; } return null; } } #endregion public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); WebPage = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { WebPage = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); WebPage.ToStream(output); } } public class TLMessageMediaGame : TLMessageMediaBase, IMediaGif { public const uint Signature = TLConstructors.TLMessageMediaGame; public TLGame Game { get; set; } #region Additional public TLDocumentBase Document { get { if (Game != null) { return Game.Document; } return null; } } public TLPhotoBase Photo { get { if (Game != null) { return Game.Photo; } return null; } } #endregion public override double MediaWidth { get { return 12.0 + 311.0 + 12.0; } } public Visibility MessageVisibility { get { return !TLString.IsNullOrEmpty(Message) ? Visibility.Visible : Visibility.Collapsed; } } public Visibility DescriptionVisibility { get { return TLString.IsNullOrEmpty(Message) && Game != null && !TLString.IsNullOrEmpty(Game.Description) ? Visibility.Visible : Visibility.Collapsed; } } public TLString Message { get; set; } public TLMessageBase SourceMessage { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Game = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Game = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Game.ToStream(output); } } public class TLMessageMediaInvoice : TLMessageMediaBase { public const uint Signature = TLConstructors.TLMessageMediaInvoice; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool ShippingAddressRequested { get { return IsSet(Flags, (int)MessageMediaInvoiceFlags.ShippingAddressRequested); } set { SetUnset(ref _flags, value, (int)MessageMediaInvoiceFlags.ShippingAddressRequested); } } public bool Test { get { return IsSet(Flags, (int)MessageMediaInvoiceFlags.Test); } set { SetUnset(ref _flags, value, (int)MessageMediaInvoiceFlags.Test); } } public TLString Title { get; set; } public TLString Description { get; set; } private TLWebDocumentBase _photo; public TLWebDocumentBase Photo { get { return _photo; } set { SetField(out _photo, value, ref _flags, (int)MessageMediaInvoiceFlags.Photo); } } private TLInt _receiptMsgId; public TLInt ReceiptMsgId { get { return _receiptMsgId; } set { SetField(out _receiptMsgId, value, ref _flags, (int)MessageMediaInvoiceFlags.ReceiptMsgId); } } public TLString Currency { get; set; } public TLLong TotalAmount { get; set; } public TLString StartParam { get; set; } public Visibility DescriptionVisibility { get { return !TLString.IsNullOrEmpty(Description) ? Visibility.Visible : Visibility.Collapsed; } } public override double MediaWidth { get { return 2.0 + 323.0 + 2.0; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Description = GetObject(bytes, ref position); _photo = GetObject(Flags, (int)MessageMediaInvoiceFlags.Photo, null, bytes, ref position); _receiptMsgId = GetObject(Flags, (int)MessageMediaInvoiceFlags.ReceiptMsgId, null, bytes, ref position); Currency = GetObject(bytes, ref position); TotalAmount = GetObject(bytes, ref position); StartParam = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Title = GetObject(input); Description = GetObject(input); _photo = GetObject(Flags, (int)MessageMediaInvoiceFlags.Photo, null, input); _receiptMsgId = GetObject(Flags, (int)MessageMediaInvoiceFlags.ReceiptMsgId, null, input); Currency = GetObject(input); TotalAmount = GetObject(input); StartParam = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Title.ToStream(output); Description.ToStream(output); ToStream(output, Photo, Flags, (int)MessageMediaInvoiceFlags.Photo); ToStream(output, ReceiptMsgId, Flags, (int)MessageMediaInvoiceFlags.ReceiptMsgId); Currency.ToStream(output); TotalAmount.ToStream(output); StartParam.ToStream(output); } } public class TLMessageMediaGeoLive : TLMessageMediaGeo { public new const uint Signature = TLConstructors.TLMessageMediaGeoLive; public TLInt Period { get; set; } #region Additional public TLObject From { get; set; } public TLInt EditDate { get; set; } public TLInt Date { get; set; } public bool Active { get { if (Date != null) { if (Period.Value == 0) { return false; } var mtProtoService = MTProtoService.Instance; var clientDelta = mtProtoService.ClientTicksDelta; var now = TLUtils.DateToUniversalTimeTLInt(clientDelta, DateTime.Now); var expired = Date.Value + Period.Value <= now.Value; var defaultPeriod = Period.Value == 15 * 60 || Period.Value == 60 * 60 || Period.Value == 8 * 60 * 60; return defaultPeriod && !expired; //var mtProtoService = MTProtoService.Instance; //var clientDelta = mtProtoService.ClientTicksDelta; //if (clientDelta == 0) //{ // var defaultPeriod = Period.Value == 15 * 60 || Period.Value == 60 * 60 || Period.Value == 8 * 60 * 60; // if (!defaultPeriod) // { // return false; // } //} //var date = TLUtils.DateToUniversalTimeTLInt(clientDelta, DateTime.Now); //return Date.Value + Period.Value > date.Value; } return false; } } #endregion public override double MediaWidth { get { return 2.0 + 320.0 + 2.0; } } public TLMessageMediaBase ToMediaGeo() { return new TLMessageMediaGeo { Geo = Geo }; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Geo = GetObject(bytes, ref position); Period = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Geo = GetObject(input); Period = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Geo.ToStream(output); Period.ToStream(output); } } public interface IMessageMediaGroup { TLVector GroupCommon { get; } event EventHandler Calculate; } public class TLMessageMediaGroup : TLMessageMediaBase, IMessageMediaGroup { public const uint Signature = TLConstructors.TLMessageMediaGroup; public TLVector Group { get; set; } public TLVector GroupCommon { get { if (Group == null) { return new TLVector(); } var group = new TLVector(); foreach (var item in Group) { group.Add(item); } return group; } } public override double MediaWidth { get { return 1.0 + 311.0 + 1.0; } } public event EventHandler Calculate; public virtual void RaiseCalculate() { var handler = Calculate; if (handler != null) handler(this, EventArgs.Empty); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Group = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Group = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Group.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLMessageRange.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLMessageRange : TLObject { public const uint Signature = TLConstructors.TLMessageRange; public TLInt MinId { get; set; } public TLInt MaxId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MinId.ToBytes(), MaxId.ToBytes() ); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MinId = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); MinId.ToStream(output); MaxId.ToStream(output); } public override TLObject FromStream(Stream input) { MinId = GetObject(input); MaxId = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum MessagesFlags { Collapsed = 0x1 } [Flags] public enum FeedMessagesFlags { MaxPosition = 0x1, MinPosition = 0x2, ReadMaxPosition = 0x4, } public abstract class TLMessagesBase : TLObject { public TLVector Messages { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public abstract TLMessagesBase GetEmptyObject(); } public class TLMessages : TLMessagesBase { public const uint Signature = TLConstructors.TLMessages; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLMessagesBase GetEmptyObject() { return new TLMessages { Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLMessagesSlice : TLMessages { public new const uint Signature = TLConstructors.TLMessagesSlice; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLMessagesBase GetEmptyObject() { return new TLMessagesSlice { Count = Count, Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLChannelMessages : TLMessagesSlice { public new const uint Signature = TLConstructors.TLChannelMessages; public TLInt Flags { get; set; } public TLInt Pts { get; set; } public TLVector Collapsed { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); if (IsSet(Flags, (int) MessagesFlags.Collapsed)) { Collapsed = GetObject>(bytes, ref position); } Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLMessagesBase GetEmptyObject() { return new TLMessagesSlice { Count = Count, Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLChannelMessages53 : TLChannelMessages { public new const uint Signature = TLConstructors.TLChannelMessages53; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLMessagesBase GetEmptyObject() { return new TLMessagesSlice { Count = Count, Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLFeedMessagesNotModified : TLMessagesBase { public const uint Signature = TLConstructors.TLFeedMessagesNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = new TLVector(); Chats = new TLVector(); Users = new TLVector(); return this; } public override TLMessagesBase GetEmptyObject() { return new TLFeedMessages { Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } public class TLFeedMessages : TLMessagesBase { public const uint Signature = TLConstructors.TLFeedMessages; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLFeedPosition _maxPosition; public TLFeedPosition MaxPosition { get { return _maxPosition; } set { SetField(out _maxPosition, value, ref _flags, (int) FeedMessagesFlags.MaxPosition); } } protected TLFeedPosition _minPosition; public TLFeedPosition MinPosition { get { return _minPosition; } set { SetField(out _minPosition, value, ref _flags, (int)FeedMessagesFlags.MinPosition); } } protected TLFeedPosition _readMaxPosition; public TLFeedPosition ReadMaxPosition { get { return _readMaxPosition; } set { SetField(out _readMaxPosition, value, ref _flags, (int)FeedMessagesFlags.ReadMaxPosition); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); _maxPosition = GetObject(Flags, (int)FeedMessagesFlags.MaxPosition, null, bytes, ref position); _minPosition = GetObject(Flags, (int)FeedMessagesFlags.MinPosition, null, bytes, ref position); _readMaxPosition = GetObject(Flags, (int)FeedMessagesFlags.ReadMaxPosition, null, bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLMessagesBase GetEmptyObject() { return new TLFeedMessages { Flags = Flags, MaxPosition = MaxPosition, MinPosition = MinPosition, ReadMaxPosition = ReadMaxPosition, Messages = new TLVector(Messages.Count), Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count) }; } } } ================================================ FILE: Telegram.Api/TL/TLMessagesAcknowledgment.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLMessagesAcknowledgment : TLObject { public const uint Signature = TLConstructors.TLMessagesAcknowledgment; public TLVector MessageIds { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MessageIds = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessagesChannelParticipants.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLChannelParticipantsBase : TLObject { } public class TLChannelParticipants : TLChannelParticipantsBase { public const uint Signature = TLConstructors.TLChannelParticipants; public TLInt Count { get; set; } public TLVector Participants { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Participants = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Count = GetObject(input); Participants = GetObject>(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Count.ToStream(output); Participants.ToStream(output); Users.ToStream(output); } } public class TLChannelParticipantsNotModified : TLChatParticipantsBase { public const uint Signature = TLConstructors.TLChannelParticipantsNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLChannelsChannelParticipant : TLObject { public const uint Signature = TLConstructors.TLChannelsChannelParticipant; public TLChannelParticipantBase Participant { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Participant = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Participant = GetObject(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Participant.ToStream(output); Users.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLMessagesChatFull.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLMessagesChatFull : TLObject { public const uint Signature = TLConstructors.TLMessagesChatFull; public TLChatFull FullChat { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FullChat = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLMessagesStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLMessagesStickerSet : TLObject { public const uint Signature = TLConstructors.TLMessagesStickerSet; public TLStickerSetBase Set { get; set; } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Set = GetObject(bytes, ref position); Packs = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Set.ToBytes(), Packs.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Set = GetObject(input); Packs = GetObject>(input); Documents = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Set.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLMyLink.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLMyLinkBase : TLObject { } public class TLMyLinkEmpty : TLMyLinkBase { public const uint Signature = TLConstructors.TLMyLinkEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLMyLinkRequested : TLMyLinkBase { public const uint Signature = TLConstructors.TLMyLinkRequested; public TLBool Contact { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Contact = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Contact = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Contact.ToStream(output); } } public class TLMyLinkContact : TLMyLinkBase { public const uint Signature = TLConstructors.TLMyLinkContact; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLNearestDC.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLNearestDC : TLObject { public const uint Signature = TLConstructors.TLNearestDC; public TLString Country { get; set; } public TLInt ThisDC { get; set; } public TLInt NearestDC { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Country = GetObject(bytes,ref position); ThisDC = GetObject(bytes, ref position); NearestDC = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLNewSessionCreated.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { internal class TLNewSessionCreated : TLObject { public const uint Signature = TLConstructors.TLNewSessionCreated; public TLLong FirstMessageId { get; set; } public TLLong UniqueId { get; set; } public TLLong ServerSalt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FirstMessageId = GetObject(bytes, ref position); UniqueId = GetObject(bytes, ref position); ServerSalt = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLNonEncryptedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLNonEncryptedMessage : TLTransportMessageWithIdBase { public TLLong AuthKeyId { get; set; } public TLObject Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { AuthKeyId = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); var length = GetObject(bytes, ref position); Data = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { var dataBytes = Data.ToBytes(); var length = new TLInt(dataBytes.Length); return TLUtils.Combine( AuthKeyId.ToBytes(), MessageId.ToBytes(), length.ToBytes(), dataBytes); } } } ================================================ FILE: Telegram.Api/TL/TLNotifyPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLNotifyPeerBase : TLObject { } public class TLNotifyPeer : TLNotifyPeerBase { public TLPeerBase Peer { get; set; } public const uint Signature = TLConstructors.TLNotifyPeer; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); return this; } } public class TLNotifyUsers : TLNotifyPeerBase { public const uint Signature = TLConstructors.TLNotifyUsers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLNotifyChats : TLNotifyPeerBase { public const uint Signature = TLConstructors.TLNotifyChats; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } [Obsolete] public class TLNotifyAll : TLNotifyPeerBase { public const uint Signature = TLConstructors.TLNotifyAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLNull.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLNull : TLObject { public const uint Signature = TLConstructors.TLNull; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLObject.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq.Expressions; using System.Reflection; using System.Runtime.Serialization; using Telegram.Api.Services; using Telegram.Api.Services.Cache.EventArgs; #if WINDOWS_PHONE using System.Windows.Media.Imaging; #elif WIN_RT using Windows.UI.Xaml.Media.Imaging; #endif using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { [DataContract] public abstract class TLObject : TelegramPropertyChangedBase { public TLDialogBase Dialog { get; set; } public bool IsGlobalResult { get; set; } #region Flags public static byte[] ToBytes(TLObject obj, TLInt flags, int flag) { return obj != null && IsSet(flags, flag) ? obj.ToBytes() : new byte[] {}; } public static void ToStream(Stream output, TLObject obj, TLInt flags, int flag) { if (IsSet(flags, flag)) { obj.ToStream(output); } } public static void ToStream(Stream output, TLObject obj, TLLong customFlags, int flag) { if (IsSet(customFlags, flag)) { if (obj == null) { } obj.ToStream(output); } } protected static bool IsSet(TLLong flags, int flag) { var isSet = false; if (flags != null) { var intFlag = flag; isSet = (flags.Value & intFlag) == intFlag; } return isSet; } protected static bool IsSet(TLInt flags, int flag) { var isSet = false; if (flags != null) { var intFlag = flag; isSet = (flags.Value & intFlag) == intFlag; } return isSet; } protected static void Set(ref TLLong flags, int flag) { var intFlag = flag; if (flags != null) { flags.Value |= intFlag; } else { flags = new TLLong(intFlag); } } protected static void Set(ref TLInt flags, int flag) { var intFlag = flag; if (flags != null) { flags.Value |= intFlag; } else { flags = new TLInt(intFlag); } } protected static void Unset(ref TLInt flags, int flag) { var intFlag = flag; if (flags != null) { flags.Value &= ~intFlag; } else { flags = new TLInt(0); } } protected static void Unset(ref TLLong flags, int flag) { var intFlag = flag; if (flags != null) { flags.Value &= ~intFlag; } else { flags = new TLLong(0); } } protected static void SetUnset(ref TLInt flags, bool set, int flag) { if (set) { Set(ref flags, flag); } else { Unset(ref flags, flag); } } protected static void SetUnset(ref TLLong flags, bool set, int flag) { if (set) { Set(ref flags, flag); } else { Unset(ref flags, flag); } } protected static void SetField(out T field, T value, ref TLInt flags, int flag) where T : TLObject { if (value != null) { Set(ref flags, flag); field = value; } else { Unset(ref flags, flag); field = null; } } protected static void SetField(out T field, T value, ref TLLong flags, int flag) where T : TLObject { if (value != null) { Set(ref flags, flag); field = value; } else { Unset(ref flags, flag); field = null; } } #endregion public virtual TLObject FromBytes(byte[] bytes, ref int position) { throw new NotImplementedException(); } public virtual byte[] ToBytes() { throw new NotImplementedException(); } public virtual TLObject FromStream(Stream input) { throw new NotImplementedException(); } public virtual void ToStream(Stream output) { throw new NotImplementedException(); } public static T GetObject(byte[] bytes, ref int position) where T : TLObject { try { return (T)TLObjectGenerator.GetObject(bytes, position).FromBytes(bytes, ref position); } catch (Exception e) { Execute.ShowDebugMessage(e.ToString()); TLUtils.WriteLine(e.StackTrace, LogSeverity.Error); } return null; } public static T GetObject(Stream input) where T : TLObject { //try //{ return (T)TLObjectGenerator.GetObject(input).FromStream(input); //} //catch (Exception e) //{ // TLUtils.WriteLine(e.StackTrace, LogSeverity.Error); //} //return null; } public static T GetObject(TLInt flags, int flag, T defaultValue, byte[] bytes, ref int position) where T : TLObject { var value = IsSet(flags, flag) ? GetObject(bytes, ref position) : defaultValue; //if (value != null) //{ // Set(ref flags, flag); //} return value; } public static T GetObject(TLInt flags, int flag, T defaultValue, Stream inputStream) where T : TLObject { var value = IsSet(flags, flag) ? GetObject(inputStream) : defaultValue; //if (value != null) //{ // Set(ref flags, flag); //} return value; } public static T GetObject(TLLong customFlags, int flag, T defaultValue, Stream inputStream) where T : TLObject { var value = IsSet(customFlags, flag) ? GetObject(inputStream) : defaultValue; //if (value != null) //{ // Set(ref customFlags, flag); //} return value; } public static T GetNullableObject(Stream input) where T : TLObject { return TLObjectExtensions.NullableFromStream(input); } protected bool SetField(ref T field, T value, string propertyName) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; NotifyOfPropertyChange(propertyName); return true; } protected bool SetField(ref T field, T value, Expression> selectorExpression) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; NotifyOfPropertyChange(selectorExpression); return true; } private WriteableBitmap _bitmap; public WriteableBitmap Bitmap { get { return _bitmap; } set { SetField(ref _bitmap, value, () => Bitmap); } } public void SetBitmap(WriteableBitmap bitmap) { //if (_bitmap == null) //{ Bitmap = bitmap; //} //else //{ // _bitmap = bitmap; //} } public void ClearBitmap() { _bitmap = null; } } } ================================================ FILE: Telegram.Api/TL/TLObjectGenerator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using Telegram.Api.Helpers; using Telegram.Api.Services; using Telegram.Api.TL.Account; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.Contacts; using Telegram.Api.TL.Functions.Messages; namespace Telegram.Api.TL { public class TLObjectGenerator { private static readonly Dictionary> _baredTypes = new Dictionary> { {typeof (TLDouble), () => new TLDouble()}, {typeof (TLBool), () => new TLBool()}, {typeof (TLInt), () => new TLInt()}, {typeof (TLLong), () => new TLLong()}, {typeof (TLInt128), () => new TLInt128()}, {typeof (TLInt256), () => new TLInt256()}, {typeof (TLString), () => new TLString()}, {typeof (TLNonEncryptedMessage), () => new TLNonEncryptedMessage()}, {typeof (TLTransportMessage), () => new TLTransportMessage()}, {typeof (TLContainerTransportMessage), () => new TLContainerTransportMessage()}, {typeof (TLIpPort), () => new TLIpPort()}, }; private static readonly Dictionary> _clothedTypes = new Dictionary> { {TLUpdateUserBlocked.Signature, () => new TLUpdateUserBlocked()}, {TLUpdateNotifySettings.Signature, () => new TLUpdateNotifySettings()}, {TLNotifyPeer.Signature, () => new TLNotifyPeer()}, {TLNotifyUsers.Signature, () => new TLNotifyUsers()}, {TLNotifyChats.Signature, () => new TLNotifyChats()}, {TLNotifyAll.Signature, () => new TLNotifyAll()}, {TLDecryptedMessageLayer.Signature, () => new TLDecryptedMessageLayer()}, {TLUpdateDCOptions.Signature, () => new TLUpdateDCOptions()}, {TLDecryptedMessageMediaAudio.Signature, () => new TLDecryptedMessageMediaAudio()}, {TLDecryptedMessageMediaDocument.Signature, () => new TLDecryptedMessageMediaDocument()}, {TLInputMediaDocument.Signature, () => new TLInputMediaDocument()}, {TLInputMediaUploadedDocument.Signature, () => new TLInputMediaUploadedDocument()}, {TLInputMediaUploadedThumbDocument.Signature, () => new TLInputMediaUploadedThumbDocument()}, {TLInputMediaAudio.Signature, () => new TLInputMediaAudio()}, {TLInputMediaUploadedAudio.Signature, () => new TLInputMediaUploadedAudio()}, {TLInputDocument.Signature, () => new TLInputDocument()}, {TLInputDocumentEmpty.Signature, () => new TLInputDocumentEmpty()}, {TLInputAudio.Signature, () => new TLInputAudio()}, {TLInputAudioEmpty.Signature, () => new TLInputAudioEmpty()}, {TLMessageMediaAudio.Signature, () => new TLMessageMediaAudio()}, {TLMessageMediaDocument.Signature, () => new TLMessageMediaDocument()}, {TLAudioEmpty.Signature, () => new TLAudioEmpty()}, {TLAudio.Signature, () => new TLAudio()}, {TLDocumentEmpty.Signature, () => new TLDocumentEmpty()}, {TLDocument10.Signature, () => new TLDocument10()}, {TLUpdateChatParticipantAdd.Signature, () => new TLUpdateChatParticipantAdd()}, {TLUpdateChatParticipantDelete.Signature, () => new TLUpdateChatParticipantDelete()}, {TLInputEncryptedFileBigUploaded.Signature, () => new TLInputEncryptedFileBigUploaded()}, {TLInputFileBig.Signature, () => new TLInputFileBig()}, {TLDecryptedMessageActionSetMessageTTL.Signature, () => new TLDecryptedMessageActionSetMessageTTL()}, {TLDecryptedMessageActionReadMessages.Signature, () => new TLDecryptedMessageActionReadMessages()}, {TLDecryptedMessageActionDeleteMessages.Signature, () => new TLDecryptedMessageActionDeleteMessages()}, {TLDecryptedMessageActionScreenshotMessages.Signature, () => new TLDecryptedMessageActionScreenshotMessages()}, {TLDecryptedMessageActionFlushHistory.Signature, () => new TLDecryptedMessageActionFlushHistory()}, {TLDecryptedMessageActionNotifyLayer.Signature, () => new TLDecryptedMessageActionNotifyLayer()}, {TLDecryptedMessage.Signature, () => new TLDecryptedMessage()}, {TLDecryptedMessageService.Signature, () => new TLDecryptedMessageService()}, {TLUpdateNewEncryptedMessage.Signature, () => new TLUpdateNewEncryptedMessage()}, {TLUpdateEncryptedChatTyping.Signature, () => new TLUpdateEncryptedChatTyping()}, {TLUpdateEncryption.Signature, () => new TLUpdateEncryption()}, {TLUpdateEncryptedMessagesRead.Signature, () => new TLUpdateEncryptedMessagesRead()}, {TLEncryptedChatEmpty.Signature, () => new TLEncryptedChatEmpty()}, {TLEncryptedChatWaiting.Signature, () => new TLEncryptedChatWaiting()}, {TLEncryptedChatRequested.Signature, () => new TLEncryptedChatRequested()}, {TLEncryptedChat.Signature, () => new TLEncryptedChat()}, {TLEncryptedChatDiscarded.Signature, () => new TLEncryptedChatDiscarded()}, {TLInputEncryptedChat.Signature, () => new TLInputEncryptedChat()}, {TLInputEncryptedFileEmpty.Signature, () => new TLInputEncryptedFileEmpty()}, {TLInputEncryptedFileUploaded.Signature, () => new TLInputEncryptedFileUploaded()}, {TLInputEncryptedFile.Signature, () => new TLInputEncryptedFile()}, {TLInputEncryptedFileLocation.Signature, () => new TLInputEncryptedFileLocation()}, {TLEncryptedFileEmpty.Signature, () => new TLEncryptedFileEmpty()}, {TLEncryptedFile.Signature, () => new TLEncryptedFile()}, {TLEncryptedMessage.Signature, () => new TLEncryptedMessage()}, {TLEncryptedMessageService.Signature, () => new TLEncryptedMessageService()}, {TLDecryptedMessageMediaEmpty.Signature, () => new TLDecryptedMessageMediaEmpty()}, {TLDecryptedMessageMediaPhoto.Signature, () => new TLDecryptedMessageMediaPhoto()}, {TLDecryptedMessageMediaVideo.Signature, () => new TLDecryptedMessageMediaVideo()}, {TLDecryptedMessageMediaGeoPoint.Signature, () => new TLDecryptedMessageMediaGeoPoint()}, {TLDecryptedMessageMediaContact.Signature, () => new TLDecryptedMessageMediaContact()}, {TLDHConfig.Signature, () => new TLDHConfig()}, {TLDHConfigNotModified.Signature, () => new TLDHConfigNotModified()}, {TLSentEncryptedMessage.Signature, () => new TLSentEncryptedMessage()}, {TLSentEncryptedFile.Signature, () => new TLSentEncryptedFile()}, {TLMessageDetailedInfo.Signature, () => new TLMessageDetailedInfo()}, {TLMessageNewDetailedInfo.Signature, () => new TLMessageNewDetailedInfo()}, {TLMessagesAllInfo.Signature, () => new TLMessagesAllInfo()}, {TLUpdateNewMessage.Signature, () => new TLUpdateNewMessage()}, {TLUpdateMessageId.Signature, () => new TLUpdateMessageId()}, {TLUpdateReadMessages.Signature, () => new TLUpdateReadMessages()}, {TLUpdateDeleteMessages.Signature, () => new TLUpdateDeleteMessages()}, {TLUpdateRestoreMessages.Signature, () => new TLUpdateRestoreMessages()}, {TLUpdateUserTyping.Signature, () => new TLUpdateUserTyping()}, {TLUpdateChatUserTyping.Signature, () => new TLUpdateChatUserTyping()}, {TLUpdateChatParticipants.Signature, () => new TLUpdateChatParticipants()}, {TLUpdateUserStatus.Signature, () => new TLUpdateUserStatus()}, {TLUpdateUserName.Signature, () => new TLUpdateUserName()}, {TLUpdateUserPhoto.Signature, () => new TLUpdateUserPhoto()}, {TLUpdateContactRegistered.Signature, () => new TLUpdateContactRegistered()}, {TLUpdateContactLink.Signature, () => new TLUpdateContactLink()}, {TLUpdateActivation.Signature, () => new TLUpdateActivation()}, {TLUpdateNewAuthorization.Signature, () => new TLUpdateNewAuthorization()}, {TLDifferenceEmpty.Signature, () => new TLDifferenceEmpty()}, {TLDifference.Signature, () => new TLDifference()}, {TLDifferenceSlice.Signature, () => new TLDifferenceSlice()}, {TLUpdatesTooLong.Signature, () => new TLUpdatesTooLong()}, {TLUpdatesShortMessage.Signature, () => new TLUpdatesShortMessage()}, {TLUpdatesShortChatMessage.Signature, () => new TLUpdatesShortChatMessage()}, {TLUpdatesShort.Signature, () => new TLUpdatesShort()}, {TLUpdatesCombined.Signature, () => new TLUpdatesCombined()}, {TLUpdates.Signature, () => new TLUpdates()}, {TLFutureSalt.Signature, () => new TLFutureSalt()}, {TLFutureSalts.Signature, () => new TLFutureSalts()}, {TLGzipPacked.Signature, () => new TLGzipPacked()}, {TLState.Signature, () => new TLState()}, {TLFileTypeUnknown.Signature, () => new TLFileTypeUnknown()}, {TLFileTypeJpeg.Signature, () => new TLFileTypeJpeg()}, {TLFileTypeGif.Signature, () => new TLFileTypeGif()}, {TLFileTypePng.Signature, () => new TLFileTypePng()}, {TLFileTypeMp3.Signature, () => new TLFileTypeMp3()}, {TLFileTypeMov.Signature, () => new TLFileTypeMov()}, {TLFileTypePartial.Signature, () => new TLFileTypePartial()}, {TLFileTypeMp4.Signature, () => new TLFileTypeMp4()}, {TLFileTypeWebp.Signature, () => new TLFileTypeWebp()}, {TLFile.Signature, () => new TLFile()}, {TLInputFileLocation.Signature, () => new TLInputFileLocation()}, {TLInputVideoFileLocation.Signature, () => new TLInputVideoFileLocation()}, {TLInviteText.Signature, () => new TLInviteText()}, {TLDHGenOk.Signature, () => new TLDHGenOk()}, {TLDHGenRetry.Signature, () => new TLDHGenRetry()}, {TLDHGenFail.Signature, () => new TLDHGenFail()}, {TLServerDHInnerData.Signature, () => new TLServerDHInnerData()}, {TLServerDHParamsFail.Signature, () => new TLServerDHParamsFail()}, {TLServerDHParamsOk.Signature, () => new TLServerDHParamsOk()}, {TLPQInnerData.Signature, () => new TLPQInnerData()}, {TLResPQ.Signature, () => new TLResPQ()}, {TLContactsBlocked.Signature, () => new TLContactsBlocked()}, {TLContactsBlockedSlice.Signature, () => new TLContactsBlockedSlice()}, {TLContactBlocked.Signature, () => new TLContactBlocked()}, {TLImportedContacts.Signature, () => new TLImportedContacts()}, {TLImportedContact.Signature, () => new TLImportedContact()}, {TLInputContact.Signature, () => new TLInputContact()}, {TLContactStatus.Signature, () => new TLContactStatus()}, {TLForeignLinkUnknown.Signature, () => new TLForeignLinkUnknown()}, {TLForeignLinkRequested.Signature, () => new TLForeignLinkRequested()}, {TLForeignLinkMutual.Signature, () => new TLForeignLinkMutual()}, {TLMyLinkEmpty.Signature, () => new TLMyLinkEmpty()}, {TLMyLinkContact.Signature, () => new TLMyLinkContact()}, {TLMyLinkRequested.Signature, () => new TLMyLinkRequested()}, {TLLink.Signature, () => new TLLink()}, {TLUserFull.Signature, () => new TLUserFull()}, {TLPhotos.Signature, () => new TLPhotos()}, {TLPhotosSlice.Signature, () => new TLPhotosSlice()}, {TLPhotosPhoto.Signature, () => new TLPhotosPhoto()}, {TLInputPeerNotifyEventsEmpty.Signature, () => new TLInputPeerNotifyEventsEmpty()}, {TLInputPeerNotifyEventsAll.Signature, () => new TLInputPeerNotifyEventsAll()}, {TLInputPeerNotifySettings.Signature, () => new TLInputPeerNotifySettings()}, {TLInputNotifyPeer.Signature, () => new TLInputNotifyPeer()}, {TLInputNotifyUsers.Signature, () => new TLInputNotifyUsers()}, {TLInputNotifyChats.Signature, () => new TLInputNotifyChats()}, {TLInputNotifyAll.Signature, () => new TLInputNotifyAll()}, {TLInputUserEmpty.Signature, () => new TLInputUserEmpty()}, {TLInputUserSelf.Signature, () => new TLInputUserSelf()}, {TLInputUserContact.Signature, () => new TLInputUserContact()}, {TLInputUserForeign.Signature, () => new TLInputUserForeign()}, {TLInputPhotoCropAuto.Signature, () => new TLInputPhotoCropAuto()}, {TLInputPhotoCrop.Signature, () => new TLInputPhotoCrop()}, {TLInputChatPhotoEmpty.Signature, () => new TLInputChatPhotoEmpty()}, {TLInputChatUploadedPhoto.Signature, () => new TLInputChatUploadedPhoto()}, {TLInputChatPhoto.Signature, () => new TLInputChatPhoto()}, {TLMessagesChatFull.Signature, () => new TLMessagesChatFull()}, {TLChatFull.Signature, () => new TLChatFull()}, {TLChatParticipant.Signature, () => new TLChatParticipant()}, {TLChatParticipantsForbidden.Signature, () => new TLChatParticipantsForbidden()}, {TLChatParticipants.Signature, () => new TLChatParticipants()}, {TLPeerNotifySettingsEmpty.Signature, () => new TLPeerNotifySettingsEmpty()}, {TLPeerNotifySettings.Signature, () => new TLPeerNotifySettings()}, {TLPeerNotifyEventsEmpty.Signature, () => new TLPeerNotifyEventsEmpty()}, {TLPeerNotifyEventsAll.Signature, () => new TLPeerNotifyEventsAll()}, {TLChats.Signature, () => new TLChats()}, {TLMessages.Signature, () => new TLMessages()}, {TLMessagesSlice.Signature, () => new TLMessagesSlice()}, {TLExportedAuthorization.Signature, () => new TLExportedAuthorization()}, {TLInputFile.Signature, () => new TLInputFile()}, {TLInputPhotoEmpty.Signature, () => new TLInputPhotoEmpty()}, {TLInputPhoto.Signature, () => new TLInputPhoto()}, {TLInputGeoPoint.Signature, () => new TLInputGeoPoint()}, {TLInputGeoPointEmpty.Signature, () => new TLInputGeoPointEmpty()}, {TLInputVideo.Signature, () => new TLInputVideo()}, {TLInputVideoEmpty.Signature, () => new TLInputVideoEmpty()}, {TLInputMediaEmpty.Signature, () => new TLInputMediaEmpty()}, {TLInputMediaUploadedPhoto.Signature, () => new TLInputMediaUploadedPhoto()}, {TLInputMediaPhoto.Signature, () => new TLInputMediaPhoto()}, {TLInputMediaGeoPoint.Signature, () => new TLInputMediaGeoPoint()}, {TLInputMediaContact.Signature, () => new TLInputMediaContact()}, {TLInputMediaUploadedVideo.Signature, () => new TLInputMediaUploadedVideo()}, {TLInputMediaUploadedThumbVideo.Signature, () => new TLInputMediaUploadedThumbVideo()}, {TLInputMediaVideo.Signature, () => new TLInputMediaVideo()}, {TLInputMessagesFilterEmpty.Signature, () => new TLInputMessagesFilterEmpty()}, {TLInputMessagesFilterPhoto.Signature, () => new TLInputMessagesFilterPhoto()}, {TLInputMessagesFilterVideo.Signature, () => new TLInputMessagesFilterVideo()}, {TLInputMessagesFilterPhotoVideo.Signature, () => new TLInputMessagesFilterPhotoVideo()}, {TLInputMessagesFilterPhotoVideoDocument.Signature, () => new TLInputMessagesFilterPhotoVideoDocument()}, {TLInputMessagesFilterDocument.Signature, () => new TLInputMessagesFilterDocument()}, {TLInputMessagesFilterAudio.Signature, () => new TLInputMessagesFilterAudio()}, {TLInputMessagesFilterAudioDocuments.Signature, () => new TLInputMessagesFilterAudioDocuments()}, {TLInputMessagesFilterUrl.Signature, () => new TLInputMessagesFilterUrl()}, {TLSentMessageLink.Signature, () => new TLSentMessageLink()}, {TLStatedMessage.Signature, () => new TLStatedMessage()}, {TLStatedMessageLink.Signature, () => new TLStatedMessageLink()}, {TLStatedMessages.Signature, () => new TLStatedMessages()}, {TLStatedMessagesLinks.Signature, () => new TLStatedMessagesLinks()}, {TLAffectedHistory.Signature, () => new TLAffectedHistory()}, {TLNull.Signature, () => new TLNull()}, {TLBool.BoolTrue, () => new TLBool()}, {TLBool.BoolFalse, () => new TLBool()}, {TLChatEmpty.Signature, () => new TLChatEmpty()}, {TLChat.Signature, () => new TLChat()}, {TLChatForbidden.Signature, () => new TLChatForbidden()}, {TLSentMessage.Signature, () => new TLSentMessage()}, {TLMessageEmpty.Signature, () => new TLMessageEmpty()}, {TLMessage.Signature, () => new TLMessage()}, {TLMessageForwarded.Signature, () => new TLMessageForwarded()}, {TLMessageService.Signature, () => new TLMessageService()}, {TLMessageMediaEmpty.Signature, () => new TLMessageMediaEmpty()}, {TLMessageMediaPhoto.Signature, () => new TLMessageMediaPhoto()}, {TLMessageMediaVideo.Signature, () => new TLMessageMediaVideo()}, {TLMessageMediaGeo.Signature, () => new TLMessageMediaGeo()}, {TLMessageMediaContact.Signature, () => new TLMessageMediaContact()}, {TLMessageMediaUnsupported.Signature, () => new TLMessageMediaUnsupported()}, {TLMessageActionEmpty.Signature, () => new TLMessageActionEmpty()}, {TLMessageActionChatCreate.Signature, () => new TLMessageActionChatCreate()}, {TLMessageActionChatEditTitle.Signature, () => new TLMessageActionChatEditTitle()}, {TLMessageActionChatEditPhoto.Signature, () => new TLMessageActionChatEditPhoto()}, {TLMessageActionChatDeletePhoto.Signature, () => new TLMessageActionChatDeletePhoto()}, {TLMessageActionChatAddUser.Signature, () => new TLMessageActionChatAddUser()}, {TLMessageActionChatDeleteUser.Signature, () => new TLMessageActionChatDeleteUser()}, {TLPhoto.Signature, () => new TLPhoto()}, {TLPhotoEmpty.Signature, () => new TLPhotoEmpty()}, {TLPhotoSize.Signature, () => new TLPhotoSize()}, {TLPhotoSizeEmpty.Signature, () => new TLPhotoSizeEmpty()}, {TLPhotoCachedSize.Signature, () => new TLPhotoCachedSize()}, {TLVideoEmpty.Signature, () => new TLVideoEmpty()}, {TLVideo.Signature, () => new TLVideo()}, {TLGeoPointEmpty.Signature, () => new TLGeoPointEmpty()}, {TLGeoPoint.Signature, () => new TLGeoPoint()}, {TLDialog.Signature, () => new TLDialog()}, {TLDialogs.Signature, () => new TLDialogs()}, {TLDialogsSlice.Signature, () => new TLDialogsSlice()}, {TLInputPeerEmpty.Signature, () => new TLInputPeerEmpty()}, {TLInputPeerSelf.Signature, () => new TLInputPeerSelf()}, {TLInputPeerContact.Signature, () => new TLInputPeerContact()}, {TLInputPeerForeign.Signature, () => new TLInputPeerForeign()}, {TLInputPeerChat.Signature, () => new TLInputPeerChat()}, {TLPeerUser.Signature, () => new TLPeerUser()}, {TLPeerChat.Signature, () => new TLPeerChat()}, {TLUserStatusEmpty.Signature, () => new TLUserStatusEmpty()}, {TLUserStatusOnline.Signature, () => new TLUserStatusOnline()}, {TLUserStatusOffline.Signature, () => new TLUserStatusOffline()}, {TLChatPhotoEmpty.Signature, () => new TLChatPhotoEmpty()}, {TLChatPhoto.Signature, () => new TLChatPhoto()}, {TLUserProfilePhotoEmpty.Signature, () => new TLUserProfilePhotoEmpty()}, {TLUserProfilePhoto.Signature, () => new TLUserProfilePhoto()}, {TLUserEmpty.Signature, () => new TLUserEmpty()}, {TLUserSelf.Signature, () => new TLUserSelf()}, {TLUserContact.Signature, () => new TLUserContact()}, {TLUserRequest.Signature, () => new TLUserRequest()}, {TLUserForeign.Signature, () => new TLUserForeign()}, {TLUserDeleted.Signature, () => new TLUserDeleted()}, {TLSentCode.Signature, () => new TLSentCode()}, {TLRPCResult.Signature, () => new TLRPCResult()}, {TLRPCError.Signature, () => new TLRPCError()}, {TLRPCReqError.Signature, () => new TLRPCReqError()}, {TLNewSessionCreated.Signature, () => new TLNewSessionCreated()}, {TLNearestDC.Signature, () => new TLNearestDC()}, {TLMessagesAcknowledgment.Signature, () => new TLMessagesAcknowledgment()}, {TLContainer.Signature, () => new TLContainer()}, {TLFileLocationUnavailable.Signature, () => new TLFileLocationUnavailable()}, {TLFileLocation.Signature, () => new TLFileLocation()}, {TLDCOption.Signature, () => new TLDCOption()}, {TLContacts.Signature, () => new TLContacts()}, {TLContactsNotModified.Signature, () => new TLContactsNotModified()}, {TLContact.Signature, () => new TLContact()}, {TLConfig.Signature, () => new TLConfig()}, {TLCheckedPhone.Signature, () => new TLCheckedPhone()}, {TLBadServerSalt.Signature, () => new TLBadServerSalt()}, {TLBadMessageNotification.Signature, () => new TLBadMessageNotification()}, {TLAuthorization.Signature, () => new TLAuthorization()}, {TLPong.Signature, () => new TLPong()}, {TLWallPaper.Signature, () => new TLWallPaper()}, {TLWallPaperSolid.Signature, () => new TLWallPaperSolid()}, {TLSupport.Signature, () => new TLSupport()}, //16 layer {TLSentAppCode.Signature, () => new TLSentAppCode()}, //17 layer {TLSendMessageTypingAction.Signature, () => new TLSendMessageTypingAction()}, {TLSendMessageCancelAction.Signature, () => new TLSendMessageCancelAction()}, {TLSendMessageRecordVideoAction.Signature, () => new TLSendMessageRecordVideoAction()}, {TLSendMessageUploadVideoAction.Signature, () => new TLSendMessageUploadVideoAction()}, {TLSendMessageRecordAudioAction.Signature, () => new TLSendMessageRecordAudioAction()}, {TLSendMessageUploadAudioAction.Signature, () => new TLSendMessageUploadAudioAction()}, {TLSendMessageUploadPhotoAction.Signature, () => new TLSendMessageUploadPhotoAction()}, {TLSendMessageUploadDocumentAction.Signature, () => new TLSendMessageUploadDocumentAction()}, {TLSendMessageGeoLocationAction.Signature, () => new TLSendMessageGeoLocationAction()}, {TLSendMessageChooseContactAction.Signature, () => new TLSendMessageChooseContactAction()}, {TLUpdateUserTyping17.Signature, () => new TLUpdateUserTyping17()}, {TLUpdateChatUserTyping17.Signature, () => new TLUpdateChatUserTyping17()}, {TLMessage17.Signature, () => new TLMessage17()}, {TLMessageForwarded17.Signature, () => new TLMessageForwarded17()}, {TLMessageService17.Signature, () => new TLMessageService17()}, //17 layer encrypted {TLDecryptedMessage17.Signature, () => new TLDecryptedMessage17()}, {TLDecryptedMessageService17.Signature, () => new TLDecryptedMessageService17()}, {TLDecryptedMessageMediaAudio17.Signature, () => new TLDecryptedMessageMediaAudio17()}, {TLDecryptedMessageMediaVideo17.Signature, () => new TLDecryptedMessageMediaVideo17()}, {TLDecryptedMessageLayer17.Signature, () => new TLDecryptedMessageLayer17()}, {TLDecryptedMessageActionResend.Signature, () => new TLDecryptedMessageActionResend()}, {TLDecryptedMessageActionTyping.Signature, () => new TLDecryptedMessageActionTyping()}, //18 layer {TLUpdateServiceNotification.Signature, () => new TLUpdateServiceNotification()}, {TLContactFound.Signature, () => new TLContactFound()}, {TLContactsFound.Signature, () => new TLContactsFound()}, {TLUserSelf18.Signature, () => new TLUserSelf18()}, {TLUserContact18.Signature, () => new TLUserContact18()}, {TLUserRequest18.Signature, () => new TLUserRequest18()}, {TLUserForeign18.Signature, () => new TLUserForeign18()}, {TLUserDeleted18.Signature, () => new TLUserDeleted18()}, //19 layer {TLUserStatusRecently.Signature, () => new TLUserStatusRecently()}, {TLUserStatusLastWeek.Signature, () => new TLUserStatusLastWeek()}, {TLUserStatusLastMonth.Signature, () => new TLUserStatusLastMonth()}, {TLContactStatus19.Signature, () => new TLContactStatus19()}, {TLUpdatePrivacy.Signature, () => new TLUpdatePrivacy()}, {TLInputPrivacyKeyStatusTimestamp.Signature, () => new TLInputPrivacyKeyStatusTimestamp()}, {TLPrivacyKeyStatusTimestamp.Signature, () => new TLPrivacyKeyStatusTimestamp()}, {TLInputPrivacyValueAllowContacts.Signature, () => new TLInputPrivacyValueAllowContacts()}, {TLInputPrivacyValueAllowAll.Signature, () => new TLInputPrivacyValueAllowAll()}, {TLInputPrivacyValueAllowUsers.Signature, () => new TLInputPrivacyValueAllowUsers()}, {TLInputPrivacyValueDisallowContacts.Signature, () => new TLInputPrivacyValueDisallowContacts()}, {TLInputPrivacyValueDisallowAll.Signature, () => new TLInputPrivacyValueDisallowAll()}, {TLInputPrivacyValueDisallowUsers.Signature, () => new TLInputPrivacyValueDisallowUsers()}, {TLPrivacyValueAllowContacts.Signature, () => new TLPrivacyValueAllowContacts()}, {TLPrivacyValueAllowAll.Signature, () => new TLPrivacyValueAllowAll()}, {TLPrivacyValueAllowUsers.Signature, () => new TLPrivacyValueAllowUsers()}, {TLPrivacyValueDisallowContacts.Signature, () => new TLPrivacyValueDisallowContacts()}, {TLPrivacyValueDisallowAll.Signature, () => new TLPrivacyValueDisallowAll()}, {TLPrivacyValueDisallowUsers.Signature, () => new TLPrivacyValueDisallowUsers()}, {TLPrivacyRules.Signature, () => new TLPrivacyRules()}, {TLAccountDaysTTL.Signature, () => new TLAccountDaysTTL()}, //20 layer {TLSentChangePhoneCode.Signature, () => new TLSentChangePhoneCode()}, {TLUpdateUserPhone.Signature, () => new TLUpdateUserPhone()}, //20 layer encrypted {TLEncryptedChat20.Signature, () => new TLEncryptedChat20()}, {TLDecryptedMessageActionRequestKey.Signature, () => new TLDecryptedMessageActionRequestKey()}, {TLDecryptedMessageActionAcceptKey.Signature, () => new TLDecryptedMessageActionAcceptKey()}, {TLDecryptedMessageActionAbortKey.Signature, () => new TLDecryptedMessageActionAbortKey()}, {TLDecryptedMessageActionCommitKey.Signature, () => new TLDecryptedMessageActionCommitKey()}, {TLDecryptedMessageActionNoop.Signature, () => new TLDecryptedMessageActionNoop()}, //21 layer //22 layer {TLInputMediaUploadedDocument22.Signature, () => new TLInputMediaUploadedDocument22()}, {TLInputMediaUploadedThumbDocument22.Signature, () => new TLInputMediaUploadedThumbDocument22()}, {TLDocument22.Signature, () => new TLDocument22()}, {TLDocumentAttributeImageSize.Signature, () => new TLDocumentAttributeImageSize()}, {TLDocumentAttributeAnimated.Signature, () => new TLDocumentAttributeAnimated()}, {TLDocumentAttributeSticker.Signature, () => new TLDocumentAttributeSticker()}, {TLDocumentAttributeVideo.Signature, () => new TLDocumentAttributeVideo()}, {TLDocumentAttributeAudio.Signature, () => new TLDocumentAttributeAudio()}, {TLDocumentAttributeFileName.Signature, () => new TLDocumentAttributeFileName()}, {TLStickersNotModified.Signature, () => new TLStickersNotModified()}, {TLStickers.Signature, () => new TLStickers()}, {TLStickerPack.Signature, () => new TLStickerPack()}, {TLAllStickersNotModified.Signature, () => new TLAllStickersNotModified()}, {TLAllStickers.Signature, () => new TLAllStickers()}, //23 layer {TLDisabledFeature.Signature, () => new TLDisabledFeature()}, {TLConfig23.Signature, () => new TLConfig23()}, //23 layer encrypted {TLDecryptedMessageMediaExternalDocument.Signature, () => new TLDecryptedMessageMediaExternalDocument()}, //24 layer {TLUpdateNewMessage24.Signature, () => new TLUpdateNewMessage24()}, {TLUpdateReadMessages24.Signature, () => new TLUpdateReadMessages24()}, {TLUpdateDeleteMessages24.Signature, () => new TLUpdateDeleteMessages24()}, {TLUpdatesShortMessage24.Signature, () => new TLUpdatesShortMessage24()}, {TLUpdatesShortChatMessage24.Signature, () => new TLUpdatesShortChatMessage24()}, {TLUpdateReadHistoryInbox.Signature, () => new TLUpdateReadHistoryInbox()}, {TLUpdateReadHistoryOutbox.Signature, () => new TLUpdateReadHistoryOutbox()}, {TLDialog24.Signature, () => new TLDialog24()}, {TLStatedMessages24.Signature, () => new TLStatedMessages24()}, {TLStatedMessagesLinks24.Signature, () => new TLStatedMessagesLinks24()}, {TLStatedMessage24.Signature, () => new TLStatedMessage24()}, {TLStatedMessageLink24.Signature, () => new TLStatedMessageLink24()}, {TLSentMessage24.Signature, () => new TLSentMessage24()}, {TLSentMessageLink24.Signature, () => new TLSentMessageLink24()}, {TLAffectedMessages.Signature, () => new TLAffectedMessages()}, {TLAffectedHistory24.Signature, () => new TLAffectedHistory24()}, {TLMessageMediaUnsupported24.Signature, () => new TLMessageMediaUnsupported24()}, {TLChats24.Signature, () => new TLChats24()}, {TLUserSelf24.Signature, () => new TLUserSelf24()}, {TLCheckedPhone24.Signature, () => new TLCheckedPhone24()}, {TLContactLinkUnknown.Signature, () => new TLContactLinkUnknown()}, {TLContactLinkNone.Signature, () => new TLContactLinkNone()}, {TLContactLinkHasPhone.Signature, () => new TLContactLinkHasPhone()}, {TLContactLink.Signature, () => new TLContactLink()}, {TLUpdateContactLink24.Signature, () => new TLUpdateContactLink24()}, {TLLink24.Signature, () => new TLLink24()}, {TLConfig24.Signature, () => new TLConfig24()}, //25 layer {TLMessage25.Signature, () => new TLMessage25()}, {TLDocumentAttributeSticker25.Signature, () => new TLDocumentAttributeSticker25()}, {TLUpdatesShortMessage25.Signature, () => new TLUpdatesShortMessage25()}, {TLUpdatesShortChatMessage25.Signature, () => new TLUpdatesShortChatMessage25()}, //26 layer {TLSentMessage26.Signature, () => new TLSentMessage26()}, {TLSentMessageLink26.Signature, () => new TLSentMessageLink26()}, {TLConfig26.Signature, () => new TLConfig26()}, {TLUpdateWebPage.Signature, () => new TLUpdateWebPage()}, {TLWebPageEmpty.Signature, () => new TLWebPageEmpty()}, {TLWebPagePending.Signature, () => new TLWebPagePending()}, {TLWebPage.Signature, () => new TLWebPage()}, {TLMessageMediaWebPage.Signature, () => new TLMessageMediaWebPage()}, {TLAccountAuthorization.Signature, () => new TLAccountAuthorization()}, {TLAccountAuthorizations.Signature, () => new TLAccountAuthorizations()}, //27 layer {TLPassword.Signature, () => new TLPassword()}, {TLNoPassword.Signature, () => new TLNoPassword()}, {TLPasswordSettings.Signature, () => new TLPasswordSettings()}, {TLPasswordInputSettings.Signature, () => new TLPasswordInputSettings()}, {TLPasswordRecovery.Signature, () => new TLPasswordRecovery()}, //layer 28 {TLInputMediaUploadedPhoto28.Signature, () => new TLInputMediaUploadedPhoto28()}, {TLInputMediaPhoto28.Signature, () => new TLInputMediaPhoto28()}, {TLInputMediaUploadedVideo28.Signature, () => new TLInputMediaUploadedVideo28()}, {TLInputMediaUploadedThumbVideo28.Signature, () => new TLInputMediaUploadedThumbVideo28()}, {TLInputMediaVideo28.Signature, () => new TLInputMediaVideo28()}, {TLSendMessageUploadVideoAction28.Signature, () => new TLSendMessageUploadVideoAction28()}, {TLSendMessageUploadAudioAction28.Signature, () => new TLSendMessageUploadAudioAction28()}, {TLSendMessageUploadPhotoAction28.Signature, () => new TLSendMessageUploadPhotoAction28()}, {TLSendMessageUploadDocumentAction28.Signature, () => new TLSendMessageUploadDocumentAction28()}, {TLInputMediaVenue.Signature, () => new TLInputMediaVenue()}, {TLMessageMediaVenue.Signature, () => new TLMessageMediaVenue()}, {TLChatInviteEmpty.Signature, () => new TLChatInviteEmpty()}, {TLChatInviteExported.Signature, () => new TLChatInviteExported()}, {TLChatInviteAlready.Signature, () => new TLChatInviteAlready()}, {TLChatInvite.Signature, () => new TLChatInvite()}, {TLUpdateReadMessagesContents.Signature, () => new TLUpdateReadMessagesContents()}, {TLConfig28.Signature, () => new TLConfig28()}, {TLChatFull28.Signature, () => new TLChatFull28()}, {TLReceivedNotifyMessage.Signature, () => new TLReceivedNotifyMessage()}, {TLMessageActionChatJoinedByLink.Signature, () => new TLMessageActionChatJoinedByLink()}, {TLPhoto28.Signature, () => new TLPhoto28()}, {TLVideo28.Signature, () => new TLVideo28()}, {TLMessageMediaPhoto28.Signature, () => new TLMessageMediaPhoto28()}, {TLMessageMediaVideo28.Signature, () => new TLMessageMediaVideo28()}, //layer 29 {TLDocumentAttributeSticker29.Signature, () => new TLDocumentAttributeSticker29()}, {TLAllStickers29.Signature, () => new TLAllStickers29()}, {TLInputStickerSetEmpty.Signature, () => new TLInputStickerSetEmpty()}, {TLInputStickerSetId.Signature, () => new TLInputStickerSetId()}, {TLInputStickerSetShortName.Signature, () => new TLInputStickerSetShortName()}, {TLStickerSet.Signature, () => new TLStickerSet()}, {TLMessagesStickerSet.Signature, () => new TLMessagesStickerSet()}, //layer 30 {TLDCOption30.Signature, () => new TLDCOption30()}, //layer 31 {TLChatFull31.Signature, () => new TLChatFull31()}, {TLMessage31.Signature, () => new TLMessage31()}, {TLAuthorization31.Signature, () => new TLAuthorization31()}, {TLUserFull31.Signature, () => new TLUserFull31()}, {TLUser.Signature, () => new TLUser()}, {TLBotCommand.Signature, () => new TLBotCommand()}, {TLBotInfoEmpty.Signature, () => new TLBotInfoEmpty()}, {TLBotInfo.Signature, () => new TLBotInfo()}, {TLKeyboardButton.Signature, () => new TLKeyboardButton()}, {TLKeyboardButtonRow.Signature, () => new TLKeyboardButtonRow()}, {TLReplyKeyboardMarkup.Signature, () => new TLReplyKeyboardMarkup()}, {TLReplyKeyboardHide.Signature, () => new TLReplyKeyboardHide()}, {TLReplyKeyboardForceReply.Signature, () => new TLReplyKeyboardForceReply()}, //layer 32 {TLAllStickers32.Signature, () => new TLAllStickers32()}, {TLStickerSet32.Signature, () => new TLStickerSet32()}, {TLDocumentAttributeAudio32.Signature, () => new TLDocumentAttributeAudio32()}, //layer 33 {TLInputPeerUser.Signature, () => new TLInputPeerUser()}, {TLInputUser.Signature, () => new TLInputUser()}, {TLPhoto33.Signature, () => new TLPhoto33()}, {TLVideo33.Signature, () => new TLVideo33()}, {TLAudio33.Signature, () => new TLAudio33()}, {TLAppChangelogEmpty.Signature, () => new TLAppChangelogEmpty()}, {TLAppChangelog.Signature, () => new TLAppChangelog()}, //layer 34 {TLMessageEntityUnknown.Signature, () => new TLMessageEntityUnknown()}, {TLMessageEntityMention.Signature, () => new TLMessageEntityMention()}, {TLMessageEntityHashtag.Signature, () => new TLMessageEntityHashtag()}, {TLMessageEntityBotCommand.Signature, () => new TLMessageEntityBotCommand()}, {TLMessageEntityUrl.Signature, () => new TLMessageEntityUrl()}, {TLMessageEntityEmail.Signature, () => new TLMessageEntityEmail()}, {TLMessageEntityBold.Signature, () => new TLMessageEntityBold()}, {TLMessageEntityItalic.Signature, () => new TLMessageEntityItalic()}, {TLMessageEntityCode.Signature, () => new TLMessageEntityCode()}, {TLMessageEntityPre.Signature, () => new TLMessageEntityPre()}, {TLMessageEntityTextUrl.Signature, () => new TLMessageEntityTextUrl()}, {TLMessage34.Signature, () => new TLMessage34()}, {TLSentMessage34.Signature, () => new TLSentMessage34()}, {TLUpdatesShortMessage34.Signature, () => new TLUpdatesShortMessage34()}, {TLUpdatesShortChatMessage34.Signature, () => new TLUpdatesShortChatMessage34()}, //layer 35 {TLWebPage35.Signature, () => new TLWebPage35()}, //layer 36 {TLInputMediaUploadedVideo36.Signature, () => new TLInputMediaUploadedVideo36()}, {TLInputMediaUploadedThumbVideo36.Signature, () => new TLInputMediaUploadedThumbVideo36()}, {TLMessage36.Signature, () => new TLMessage36()}, {TLUpdatesShortSentMessage.Signature, () => new TLUpdatesShortSentMessage()}, //layer 37 {TLChatParticipantsForbidden37.Signature, () => new TLChatParticipantsForbidden37()}, {TLUpdateChatParticipantAdd37.Signature, () => new TLUpdateChatParticipantAdd37()}, {TLUpdateWebPage37.Signature, () => new TLUpdateWebPage37()}, //layer 40 {TLInputPeerChannel.Signature, () => new TLInputPeerChannel()}, {TLPeerChannel.Signature, () => new TLPeerChannel()}, {TLChat40.Signature, () => new TLChat40()}, {TLChatForbidden40.Signature, () => new TLChatForbidden40()}, {TLChannel.Signature, () => new TLChannel()}, {TLChannelForbidden.Signature, () => new TLChannelForbidden()}, {TLChannelFull.Signature, () => new TLChannelFull()}, {TLChannelParticipants40.Signature, () => new TLChannelParticipants40()}, {TLMessage40.Signature, () => new TLMessage40()}, {TLMessageService40.Signature, () => new TLMessageService40()}, {TLMessageActionChannelCreate.Signature, () => new TLMessageActionChannelCreate()}, {TLDialogChannel.Signature, () => new TLDialogChannel()}, {TLChannelMessages.Signature, () => new TLChannelMessages()}, {TLUpdateChannelTooLong.Signature, () => new TLUpdateChannelTooLong()}, {TLUpdateChannel.Signature, () => new TLUpdateChannel()}, {TLUpdateChannelGroup.Signature, () => new TLUpdateChannelGroup()}, {TLUpdateNewChannelMessage.Signature, () => new TLUpdateNewChannelMessage()}, {TLUpdateReadChannelInbox.Signature, () => new TLUpdateReadChannelInbox()}, {TLUpdateDeleteChannelMessages.Signature, () => new TLUpdateDeleteChannelMessages()}, {TLUpdateChannelMessageViews.Signature, () => new TLUpdateChannelMessageViews()}, {TLUpdatesShortMessage40.Signature, () => new TLUpdatesShortMessage40()}, {TLUpdatesShortChatMessage40.Signature, () => new TLUpdatesShortChatMessage40()}, {TLContactsFound40.Signature, () => new TLContactsFound40()}, //{TLInputChatEmpty.Signature, () => new TLInputChatEmpty()}, // delete //{TLInputChat.Signature, () => new TLInputChat()}, // delete {TLInputChannel.Signature, () => new TLInputChannel()}, {TLInputChannelEmpty.Signature, () => new TLInputChannelEmpty()}, {TLMessageRange.Signature, () => new TLMessageRange()}, {TLMessageGroup.Signature, () => new TLMessageGroup()}, {TLChannelDifferenceEmpty.Signature, () => new TLChannelDifferenceEmpty()}, {TLChannelDifferenceTooLong.Signature, () => new TLChannelDifferenceTooLong()}, {TLChannelDifference.Signature, () => new TLChannelDifference()}, {TLChannelMessagesFilterEmpty.Signature, () => new TLChannelMessagesFilterEmpty()}, {TLChannelMessagesFilter.Signature, () => new TLChannelMessagesFilter()}, {TLChannelMessagesFilterCollapsed.Signature, () => new TLChannelMessagesFilterCollapsed()}, {TLResolvedPeer.Signature, () => new TLResolvedPeer()}, {TLChannelParticipant.Signature, () => new TLChannelParticipant()}, {TLChannelParticipantSelf.Signature, () => new TLChannelParticipantSelf()}, {TLChannelParticipantModerator.Signature, () => new TLChannelParticipantModerator()}, {TLChannelParticipantEditor.Signature, () => new TLChannelParticipantEditor()}, {TLChannelParticipantKicked.Signature, () => new TLChannelParticipantKicked()}, {TLChannelParticipantCreator.Signature, () => new TLChannelParticipantCreator()}, {TLChannelParticipantsRecent.Signature, () => new TLChannelParticipantsRecent()}, {TLChannelParticipantsAdmins.Signature, () => new TLChannelParticipantsAdmins()}, {TLChannelParticipantsKicked.Signature, () => new TLChannelParticipantsKicked()}, {TLChannelRoleEmpty.Signature, () => new TLChannelRoleEmpty()}, {TLChannelRoleModerator.Signature, () => new TLChannelRoleModerator()}, {TLChannelRoleEditor.Signature, () => new TLChannelRoleEditor()}, {TLChannelParticipants.Signature, () => new TLChannelParticipants()}, {TLChannelsChannelParticipant.Signature, () => new TLChannelsChannelParticipant()}, {TLChatInvite40.Signature, () => new TLChatInvite40()}, {TLChatParticipantCreator.Signature, () => new TLChatParticipantCreator()}, {TLChatParticipantAdmin.Signature, () => new TLChatParticipantAdmin()}, {TLChatParticipants40.Signature, () => new TLChatParticipants40()}, {TLUpdateChatAdmins.Signature, () => new TLUpdateChatAdmins()}, {TLUpdateChatParticipantAdmin.Signature, () => new TLUpdateChatParticipantAdmin()}, // layer 41 {TLConfig41.Signature, () => new TLConfig41()}, {TLMessageActionChatMigrateTo.Signature, () => new TLMessageActionChatMigrateTo()}, {TLMessageActionChatDeactivate.Signature, () => new TLMessageActionChatDeactivate()}, {TLMessageActionChatActivate.Signature, () => new TLMessageActionChatActivate()}, {TLMessageActionChannelMigrateFrom.Signature, () => new TLMessageActionChannelMigrateFrom()}, {TLChannelParticipantsBots.Signature, () => new TLChannelParticipantsBots()}, {TLChat41.Signature, () => new TLChat41()}, {TLChannelFull41.Signature, () => new TLChannelFull41()}, {TLMessageActionChatAddUser41.Signature, () => new TLMessageActionChatAddUser41()}, // layer 42 {TLTermsOfService.Signature, () => new TLTermsOfService()}, {TLInputReportReasonSpam.Signature, () => new TLInputReportReasonSpam()}, {TLInputReportReasonViolence.Signature, () => new TLInputReportReasonViolence()}, {TLInputReportReasonPornography.Signature, () => new TLInputReportReasonPornography()}, {TLInputReportReasonOther.Signature, () => new TLInputReportReasonOther()}, // layer 43 {TLUpdateNewStickerSet.Signature, () => new TLUpdateNewStickerSet()}, {TLUpdateStickerSetsOrder.Signature, () => new TLUpdateStickerSetsOrder()}, {TLUpdateStickerSets.Signature, () => new TLUpdateStickerSets()}, {TLAllStickers43.Signature, () => new TLAllStickers43()}, // layer 44 {TLInputMediaGifExternal.Signature, () => new TLInputMediaGifExternal()}, {TLUser44.Signature, () => new TLUser44()}, {TLChannel44.Signature, () => new TLChannel44()}, {TLInputMessagesFilterGif.Signature, () => new TLInputMessagesFilterGif()}, {TLUpdateSavedGifs.Signature, () => new TLUpdateSavedGifs()}, {TLConfig44.Signature, () => new TLConfig44()}, {TLFoundGif.Signature, () => new TLFoundGif()}, {TLFoundGifCached.Signature, () => new TLFoundGifCached()}, {TLFoundGifs.Signature, () => new TLFoundGifs()}, {TLSavedGifsNotModified.Signature, () => new TLSavedGifsNotModified()}, {TLSavedGifs.Signature, () => new TLSavedGifs()}, // layer 45 {TLInputMediaUploadedDocument45.Signature, () => new TLInputMediaUploadedDocument45()}, {TLInputMediaUploadedThumbDocument45.Signature, () => new TLInputMediaUploadedThumbDocument45()}, {TLInputMediaDocument45.Signature, () => new TLInputMediaDocument45()}, {TLUser45.Signature, () => new TLUser45()}, {TLMessage45.Signature, () => new TLMessage45()}, {TLMessageMediaDocument45.Signature, () => new TLMessageMediaDocument45()}, {TLUpdateBotInlineQuery.Signature, () => new TLUpdateBotInlineQuery()}, {TLUpdatesShortMessage45.Signature, () => new TLUpdatesShortMessage45()}, {TLUpdatesShortChatMessage45.Signature, () => new TLUpdatesShortChatMessage45()}, {TLInputBotInlineMessageMediaAuto.Signature, () => new TLInputBotInlineMessageMediaAuto()}, {TLInputBotInlineMessageText.Signature, () => new TLInputBotInlineMessageText()}, {TLInputBotInlineResult.Signature, () => new TLInputBotInlineResult()}, {TLBotInlineMessageMediaAuto.Signature, () => new TLBotInlineMessageMediaAuto()}, {TLBotInlineMessageText.Signature, () => new TLBotInlineMessageText()}, //{TLBotInlineMediaResultDocument.Signature, () => new TLBotInlineMediaResultDocument()}, {TLBotInlineMediaResultPhoto.Signature, () => new TLBotInlineMediaResultPhoto()}, {TLBotInlineResult.Signature, () => new TLBotInlineResult()}, {TLBotResults.Signature, () => new TLBotResults()}, // layer 46 {TLDocumentAttributeAudio46.Signature, () => new TLDocumentAttributeAudio46()}, {TLInputMessagesFilterVoice.Signature, () => new TLInputMessagesFilterVoice()}, {TLInputMessagesFilterMusic.Signature, () => new TLInputMessagesFilterMusic()}, {TLInputPrivacyKeyChatInvite.Signature, () => new TLInputPrivacyKeyChatInvite()}, {TLPrivacyKeyChatInvite.Signature, () => new TLPrivacyKeyChatInvite()}, // layer 48 {TLMessage48.Signature, () => new TLMessage48()}, {TLInputPeerNotifySettings48.Signature, () => new TLInputPeerNotifySettings48()}, {TLPeerNotifySettings48.Signature, () => new TLPeerNotifySettings48()}, {TLUpdateEditChannelMessage.Signature, () => new TLUpdateEditChannelMessage()}, {TLUpdatesShortMessage48.Signature, () => new TLUpdatesShortMessage48()}, {TLUpdatesShortChatMessage48.Signature, () => new TLUpdatesShortChatMessage48()}, {TLConfig48.Signature, () => new TLConfig48()}, {TLExportedMessageLink.Signature, () => new TLExportedMessageLink()}, {TLMessageFwdHeader.Signature, () => new TLMessageFwdHeader()}, {TLMessageEditData.Signature, () => new TLMessageEditData()}, // layer 49 {TLChannel49.Signature, () => new TLChannel49()}, {TLChannelFull49.Signature, () => new TLChannelFull49()}, {TLMessageService49.Signature, () => new TLMessageService49()}, {TLMessageActionPinMessage.Signature, () => new TLMessageActionPinMessage()}, {TLPeerSettings.Signature, () => new TLPeerSettings()}, {TLUserFull49.Signature, () => new TLUserFull49()}, {TLUpdateChannelTooLong49.Signature, () => new TLUpdateChannelTooLong49()}, {TLUpdateChannelPinnedMessage.Signature, () => new TLUpdateChannelPinnedMessage()}, {TLBotInfo49.Signature, () => new TLBotInfo49()}, // layer 50 {TLSentCode50.Signature, () => new TLSentCode50()}, {TLCodeTypeSms.Signature, () => new TLCodeTypeSms()}, {TLCodeTypeCall.Signature, () => new TLCodeTypeCall()}, {TLCodeTypeFlashCall.Signature, () => new TLCodeTypeFlashCall()}, {TLSentCodeTypeApp.Signature, () => new TLSentCodeTypeApp()}, {TLSentCodeTypeSms.Signature, () => new TLSentCodeTypeSms()}, {TLSentCodeTypeCall.Signature, () => new TLSentCodeTypeCall()}, {TLSentCodeTypeFlashCall.Signature, () => new TLSentCodeTypeFlashCall()}, // layer 51 {TLUpdateBotCallbackQuery.Signature, () => new TLUpdateBotCallbackQuery()}, {TLUpdateInlineBotCallbackQuery.Signature, () => new TLUpdateInlineBotCallbackQuery()}, {TLUpdateBotInlineQuery51.Signature, () => new TLUpdateBotInlineQuery51()}, {TLUpdateBotInlineSend.Signature, () => new TLUpdateBotInlineSend()}, {TLUpdateEditMessage.Signature, () => new TLUpdateEditMessage()}, {TLKeyboardButtonUrl.Signature, () => new TLKeyboardButtonUrl()}, {TLKeyboardButtonCallback.Signature, () => new TLKeyboardButtonCallback()}, {TLKeyboardButtonRequestPhone.Signature, () => new TLKeyboardButtonRequestPhone()}, {TLKeyboardButtonRequestGeoLocation.Signature, () => new TLKeyboardButtonRequestGeoLocation()}, {TLKeyboardButtonSwitchInline.Signature, () => new TLKeyboardButtonSwitchInline()}, {TLBotCallbackAnswer.Signature, () => new TLBotCallbackAnswer()}, {TLReplyInlineMarkup.Signature, () => new TLReplyInlineMarkup()}, {TLInputBotInlineMessageMediaAuto51.Signature, () => new TLInputBotInlineMessageMediaAuto51()}, {TLInputBotInlineMessageText51.Signature, () => new TLInputBotInlineMessageText51()}, {TLInputBotInlineMessageMediaGeo.Signature, () => new TLInputBotInlineMessageMediaGeo()}, {TLInputBotInlineMessageMediaVenue.Signature, () => new TLInputBotInlineMessageMediaVenue()}, {TLInputBotInlineMessageMediaContact.Signature, () => new TLInputBotInlineMessageMediaContact()}, {TLInputBotInlineResultPhoto.Signature, () => new TLInputBotInlineResultPhoto()}, {TLInputBotInlineResultDocument.Signature, () => new TLInputBotInlineResultDocument()}, {TLBotInlineMessageMediaAuto51.Signature, () => new TLBotInlineMessageMediaAuto51()}, {TLBotInlineMessageText51.Signature, () => new TLBotInlineMessageText51()}, {TLBotInlineMessageMediaGeo.Signature, () => new TLBotInlineMessageMediaGeo()}, {TLBotInlineMessageMediaVenue.Signature, () => new TLBotInlineMessageMediaVenue()}, {TLBotInlineMessageMediaContact.Signature, () => new TLBotInlineMessageMediaContact()}, {TLBotInlineMediaResult.Signature, () => new TLBotInlineMediaResult()}, {TLInputBotInlineMessageId.Signature, () => new TLInputBotInlineMessageId()}, {TLBotResults51.Signature, () => new TLBotResults51()}, {TLInlineBotSwitchPM.Signature, () => new TLInlineBotSwitchPM()}, // layer 52 {TLConfig52.Signature, () => new TLConfig52()}, {TLMessageEntityMentionName.Signature, () => new TLMessageEntityMentionName()}, {TLInputMessageEntityMentionName.Signature, () => new TLInputMessageEntityMentionName()}, {TLPeerDialogs.Signature, () => new TLPeerDialogs()}, {TLTopPeer.Signature, () => new TLTopPeer()}, {TLTopPeerCategoryBotsPM.Signature, () => new TLTopPeerCategoryBotsPM()}, {TLTopPeerCategoryBotsInline.Signature, () => new TLTopPeerCategoryBotsInline()}, {TLTopPeerCategoryCorrespondents.Signature, () => new TLTopPeerCategoryCorrespondents()}, {TLTopPeerCategoryGroups.Signature, () => new TLTopPeerCategoryGroups()}, {TLTopPeerCategoryChannels.Signature, () => new TLTopPeerCategoryChannels()}, {TLTopPeerCategoryPeers.Signature, () => new TLTopPeerCategoryPeers()}, {TLTopPeersNotModified.Signature, () => new TLTopPeersNotModified()}, {TLTopPeers.Signature, () => new TLTopPeers()}, // layer 53 {TLChannelFull53.Signature, () => new TLChannelFull53()}, {TLDialog53.Signature, () => new TLDialog53()}, {TLChannelMessages53.Signature, () => new TLChannelMessages53()}, {TLUpdateDraftMessage.Signature, () => new TLUpdateDraftMessage()}, {TLChannelDifferenceTooLong53.Signature, () => new TLChannelDifferenceTooLong53()}, {TLInputMessagesFilterChatPhotos.Signature, () => new TLInputMessagesFilterChatPhotos()}, {TLUpdateReadChannelOutbox.Signature, () => new TLUpdateReadChannelOutbox()}, {TLDraftMessageEmpty.Signature, () => new TLDraftMessageEmpty()}, {TLDraftMessage.Signature, () => new TLDraftMessage()}, {TLChannelForbidden53.Signature, () => new TLChannelForbidden53()}, {TLMessageActionClearHistory.Signature, () => new TLMessageActionClearHistory()}, // layer 54 {TLConfig54.Signature, () => new TLConfig54()}, {TLFeaturedStickersNotModified.Signature, () => new TLFeaturedStickersNotModified()}, {TLFeaturedStickers.Signature, () => new TLFeaturedStickers()}, {TLUpdateReadFeaturedStickers.Signature, () => new TLUpdateReadFeaturedStickers()}, {TLBotCallbackAnswer54.Signature, () => new TLBotCallbackAnswer54()}, {TLDocument54.Signature, () => new TLDocument54()}, {TLInputDocumentFileLocation54.Signature, () => new TLInputDocumentFileLocation54()}, {TLRecentStickersNotModified.Signature, () => new TLRecentStickersNotModified()}, {TLRecentStickers.Signature, () => new TLRecentStickers()}, {TLUpdateRecentStickers.Signature, () => new TLUpdateRecentStickers()}, {TLChatInvite54.Signature, () => new TLChatInvite54()}, {TLStickerSetInstallResult.Signature, () => new TLStickerSetInstallResult()}, {TLStickerSetInstallResultArchive.Signature, () => new TLStickerSetInstallResultArchive()}, {TLArchivedStickers.Signature, () => new TLArchivedStickers()}, {TLStickerSetCovered.Signature, () => new TLStickerSetCovered()}, // layer 55 {TLInputMediaPhotoExternal.Signature, () => new TLInputMediaPhotoExternal()}, {TLInputMediaDocumentExternal.Signature, () => new TLInputMediaDocumentExternal()}, {TLAuthorization55.Signature, () => new TLAuthorization55()}, {TLUpdateConfig.Signature, () => new TLUpdateConfig()}, {TLUpdatePtsChanged.Signature, () => new TLUpdatePtsChanged()}, {TLConfig55.Signature, () => new TLConfig55()}, {TLKeyboardButtonSwitchInline55.Signature, () => new TLKeyboardButtonSwitchInline55()}, // layer 56 {TLUpdateBotCallbackQuery56.Signature, () => new TLUpdateBotCallbackQuery56()}, {TLUpdateInlineBotCallbackQuery56.Signature, () => new TLUpdateInlineBotCallbackQuery56()}, {TLUpdateStickerSetsOrder56.Signature, () => new TLUpdateStickerSetsOrder56()}, {TLStickerSetMultiCovered.Signature, () => new TLStickerSetMultiCovered()}, {TLInputMediaUploadedPhoto56.Signature, () => new TLInputMediaUploadedPhoto56()}, {TLInputMediaUploadedDocument56.Signature, () => new TLInputMediaUploadedDocument56()}, {TLInputMediaUploadedThumbDocument56.Signature, () => new TLInputMediaUploadedThumbDocument56()}, {TLInputStickeredMediaPhoto.Signature, () => new TLInputStickeredMediaPhoto()}, {TLInputStickeredMediaDocument.Signature, () => new TLInputStickeredMediaDocument()}, {TLPhoto56.Signature, () => new TLPhoto56()}, {TLMaskCoords.Signature, () => new TLMaskCoords()}, {TLDocumentAttributeSticker56.Signature, () => new TLDocumentAttributeSticker56()}, {TLDocumentAttributeHasStickers.Signature, () => new TLDocumentAttributeHasStickers()}, // layer 57 {TLInputMediaGame.Signature, () => new TLInputMediaGame()}, {TLInputGameId.Signature, () => new TLInputGameId()}, {TLInputGameShortName.Signature, () => new TLInputGameShortName()}, {TLGame.Signature, () => new TLGame()}, {TLHighScore.Signature, () => new TLHighScore()}, {TLHighScores.Signature, () => new TLHighScores()}, {TLInputBotInlineMessageGame.Signature, () => new TLInputBotInlineMessageGame()}, {TLInputBotInlineResultGame.Signature, () => new TLInputBotInlineResultGame()}, {TLKeyboardButtonGame.Signature, () => new TLKeyboardButtonGame()}, {TLMessageActionGameScore.Signature, () => new TLMessageActionGameScore()}, {TLMessageMediaGame.Signature, () => new TLMessageMediaGame()}, // layer 58 {TLUserFull58.Signature, () => new TLUserFull58()}, {TLChatsSlice.Signature, () => new TLChatsSlice()}, {TLUpdateChannelWebPage.Signature, () => new TLUpdateChannelWebPage()}, {TLDifferenceTooLong.Signature, () => new TLDifferenceTooLong()}, {TLBotResults58.Signature, () => new TLBotResults58()}, {TLBotCallbackAnswer58.Signature, () => new TLBotCallbackAnswer58()}, // layer 59 {TLChatsSlice59.Signature, () => new TLChatsSlice59()}, {TLUpdateServiceNotification59.Signature, () => new TLUpdateServiceNotification59()}, {TLWebPage59.Signature, () => new TLWebPage59()}, {TLWebPageNotModified.Signature, () => new TLWebPageNotModified()}, {TLAppChangelog59.Signature, () => new TLAppChangelog59()}, {TLTextEmpty.Signature, () => new TLTextEmpty()}, {TLTextPlain.Signature, () => new TLTextPlain()}, {TLTextBold.Signature, () => new TLTextBold()}, {TLTextItalic.Signature, () => new TLTextItalic()}, {TLTextUnderline.Signature, () => new TLTextUnderline()}, {TLTextStrike.Signature, () => new TLTextStrike()}, {TLTextFixed.Signature, () => new TLTextFixed()}, {TLTextUrl.Signature, () => new TLTextUrl()}, {TLTextEmail.Signature, () => new TLTextEmail()}, {TLTextConcat.Signature, () => new TLTextConcat()}, {TLPageBlockUnsupported.Signature, () => new TLPageBlockUnsupported()}, {TLPageBlockTitle.Signature, () => new TLPageBlockTitle()}, {TLPageBlockSubtitle.Signature, () => new TLPageBlockSubtitle()}, {TLPageBlockAuthorDate.Signature, () => new TLPageBlockAuthorDate()}, {TLPageBlockHeader.Signature, () => new TLPageBlockHeader()}, {TLPageBlockSubheader.Signature, () => new TLPageBlockSubheader()}, {TLPageBlockParagraph.Signature, () => new TLPageBlockParagraph()}, {TLPageBlockPreformatted.Signature, () => new TLPageBlockPreformatted()}, {TLPageBlockFooter.Signature, () => new TLPageBlockFooter()}, {TLPageBlockDivider.Signature, () => new TLPageBlockDivider()}, {TLPageBlockAnchor.Signature, () => new TLPageBlockAnchor()}, {TLPageBlockList.Signature, () => new TLPageBlockList()}, {TLPageBlockBlockquote.Signature, () => new TLPageBlockBlockquote()}, {TLPageBlockPullquote.Signature, () => new TLPageBlockPullquote()}, {TLPageBlockPhoto.Signature, () => new TLPageBlockPhoto()}, {TLPageBlockVideo.Signature, () => new TLPageBlockVideo()}, {TLPageBlockCover.Signature, () => new TLPageBlockCover()}, {TLPageBlockEmbed.Signature, () => new TLPageBlockEmbed()}, {TLPageBlockEmbedPost.Signature, () => new TLPageBlockEmbedPost()}, {TLPageBlockCollage.Signature, () => new TLPageBlockCollage()}, {TLPageBlockSlideshow.Signature, () => new TLPageBlockSlideshow()}, {TLPagePart.Signature, () => new TLPagePart()}, {TLPageFull.Signature, () => new TLPageFull()}, // layer 60 {TLUpdatePhoneCall.Signature, () => new TLUpdatePhoneCall()}, {TLConfig60.Signature, () => new TLConfig60()}, {TLSendMessageGamePlayAction.Signature, () => new TLSendMessageGamePlayAction()}, {TLInputPrivacyKeyPhoneCall.Signature, () => new TLInputPrivacyKeyPhoneCall()}, {TLPrivacyKeyPhoneCall.Signature, () => new TLPrivacyKeyPhoneCall()}, {TLInputPhoneCall.Signature, () => new TLInputPhoneCall()}, {TLPhoneCallEmpty.Signature, () => new TLPhoneCallEmpty()}, {TLPhoneCallWaiting.Signature, () => new TLPhoneCallWaiting()}, {TLPhoneCallRequested.Signature, () => new TLPhoneCallRequested()}, {TLPhoneCall.Signature, () => new TLPhoneCall()}, {TLPhoneCallDiscarded.Signature, () => new TLPhoneCallDiscarded()}, {TLPhoneConnection.Signature, () => new TLPhoneConnection()}, {TLPhoneCallProtocol.Signature, () => new TLPhoneCallProtocol()}, {TLPhonePhoneCall.Signature, () => new TLPhonePhoneCall()}, // layer 61 {TLUpdateDialogPinned.Signature, () => new TLUpdateDialogPinned()}, {TLUpdatePinnedDialogs.Signature, () => new TLUpdatePinnedDialogs()}, {TLConfig61.Signature, () => new TLConfig61()}, {TLPageBlockAuthorDate61.Signature, () => new TLPageBlockAuthorDate61()}, {TLPageBlockEmbed61.Signature, () => new TLPageBlockEmbed61()}, {TLPhoneCallDiscarded61.Signature, () => new TLPhoneCallDiscarded61()}, {TLPhoneConnection61.Signature, () => new TLPhoneConnection61()}, {TLPhoneCallDiscardReasonMissed.Signature, () => new TLPhoneCallDiscardReasonMissed()}, {TLPhoneCallDiscardReasonDisconnect.Signature, () => new TLPhoneCallDiscardReasonDisconnect()}, {TLPhoneCallDiscardReasonHangup.Signature, () => new TLPhoneCallDiscardReasonHangup()}, {TLPhoneCallDiscardReasonBusy.Signature, () => new TLPhoneCallDiscardReasonBusy()}, // layer 62 {TLMessageActionPhoneCall.Signature, () => new TLMessageActionPhoneCall()}, {TLInputMessagesFilterPhoneCalls.Signature, () => new TLInputMessagesFilterPhoneCalls()}, {TLUpdateBotWebhookJSON.Signature, () => new TLUpdateBotWebhookJSON()}, {TLUpdateBotWebhookJSONQuery.Signature, () => new TLUpdateBotWebhookJSONQuery()}, {TLDataJSON.Signature, () => new TLDataJSON()}, // layer 63 {TLConfig63.Signature, () => new TLConfig63()}, // layer 64 {TLInputMediaInvoice.Signature, () => new TLInputMediaInvoice()}, {TLMessageMediaInvoice.Signature, () => new TLMessageMediaInvoice()}, {TLMessageActionPaymentSentMe.Signature, () => new TLMessageActionPaymentSentMe()}, {TLMessageActionPaymentSent.Signature, () => new TLMessageActionPaymentSent()}, {TLUpdateBotShippingQuery.Signature, () => new TLUpdateBotShippingQuery()}, {TLUpdateBotPrecheckoutQuery.Signature, () => new TLUpdateBotPrecheckoutQuery()}, {TLKeyboardButtonBuy.Signature, () => new TLKeyboardButtonBuy()}, {TLLabeledPrice.Signature, () => new TLLabeledPrice()}, {TLInvoice.Signature, () => new TLInvoice()}, {TLPaymentCharge.Signature, () => new TLPaymentCharge()}, {TLPostAddress.Signature, () => new TLPostAddress()}, {TLPaymentRequestedInfo.Signature, () => new TLPaymentRequestedInfo()}, {TLPaymentSavedCredentialsCard.Signature, () => new TLPaymentSavedCredentialsCard()}, {TLWebDocument.Signature, () => new TLWebDocument()}, {TLInputWebDocument.Signature, () => new TLInputWebDocument()}, {TLInputWebFileLocation.Signature, () => new TLInputWebFileLocation()}, {TLWebFile.Signature, () => new TLWebFile()}, {TLPaymentForm.Signature, () => new TLPaymentForm()}, {TLValidatedRequestedInfo.Signature, () => new TLValidatedRequestedInfo()}, {TLPaymentResult.Signature, () => new TLPaymentResult()}, {TLPaymentVerificationNeeded.Signature, () => new TLPaymentVerificationNeeded()}, {TLPaymentReceipt.Signature, () => new TLPaymentReceipt()}, {TLSavedInfo.Signature, () => new TLSavedInfo()}, {TLInputPaymentCredentialsSaved.Signature, () => new TLInputPaymentCredentialsSaved()}, {TLInputPaymentCredentials.Signature, () => new TLInputPaymentCredentials()}, {TLTmpPassword.Signature, () => new TLTmpPassword()}, {TLShippingOption.Signature, () => new TLShippingOption()}, {TLPhoneCallRequested64.Signature, () => new TLPhoneCallRequested64()}, {TLPhoneCallAccepted.Signature, () => new TLPhoneCallAccepted()}, // layer 65, 66 {TLUser66.Signature, () => new TLUser66()}, {TLInputMessagesFilterRoundVideo.Signature, () => new TLInputMessagesFilterRoundVideo()}, {TLInputMessagesFilterRoundVoice.Signature, () => new TLInputMessagesFilterRoundVoice()}, {TLFileCdnRedirect.Signature, () => new TLFileCdnRedirect()}, {TLSendMessageRecordRoundAction.Signature, () => new TLSendMessageRecordRoundAction()}, {TLSendMessageUploadRoundAction.Signature, () => new TLSendMessageUploadRoundAction()}, {TLSendMessageUploadRoundAction66.Signature, () => new TLSendMessageUploadRoundAction66()}, {TLDocumentAttributeVideo66.Signature, () => new TLDocumentAttributeVideo66()}, {TLPageBlockChannel.Signature, () => new TLPageBlockChannel()}, {TLCdnConfig.Signature, () => new TLCdnConfig()}, {TLCdnPublicKey.Signature, () => new TLCdnPublicKey()}, {TLCdnFile.Signature, () => new TLCdnFile()}, {TLCdnFileReuploadNeeded.Signature, () => new TLCdnFileReuploadNeeded()}, // layer 67 {TLUpdateLangPackTooLong.Signature, () => new TLUpdateLangPackTooLong()}, {TLUpdateLangPack.Signature, () => new TLUpdateLangPack()}, {TLConfig67.Signature, () => new TLConfig67()}, {TLLangPackString.Signature, () => new TLLangPackString()}, {TLLangPackStringPluralized.Signature, () => new TLLangPackStringPluralized()}, {TLLangPackStringDeleted.Signature, () => new TLLangPackStringDeleted()}, {TLLangPackDifference.Signature, () => new TLLangPackDifference()}, {TLLangPackLanguage.Signature, () => new TLLangPackLanguage()}, // layer 68 {TLChannel68.Signature, () => new TLChannel68()}, {TLChannelForbidden68.Signature, () => new TLChannelForbidden68()}, {TLChannelFull68.Signature, () => new TLChannelFull68()}, {TLChannelParticipantAdmin.Signature, () => new TLChannelParticipantAdmin()}, {TLChannelParticipantBanned.Signature, () => new TLChannelParticipantBanned()}, {TLChannelParticipantsKicked68.Signature, () => new TLChannelParticipantsKicked68()}, {TLChannelParticipantsBanned.Signature, () => new TLChannelParticipantsBanned()}, {TLChannelParticipantsSearch.Signature, () => new TLChannelParticipantsSearch()}, {TLTopPeerCategoryPhoneCalls.Signature, () => new TLTopPeerCategoryPhoneCalls()}, {TLPageBlockAudio.Signature, () => new TLPageBlockAudio()}, {TLPagePart68.Signature, () => new TLPagePart68()}, {TLPageFull68.Signature, () => new TLPageFull68()}, {TLChannelAdminRights.Signature, () => new TLChannelAdminRights()}, {TLChannelBannedRights.Signature, () => new TLChannelBannedRights()}, {TLChannelAdminLogEventActionChangeTitle.Signature, () => new TLChannelAdminLogEventActionChangeTitle()}, {TLChannelAdminLogEventActionChangeAbout.Signature, () => new TLChannelAdminLogEventActionChangeAbout()}, {TLChannelAdminLogEventActionChangeUsername.Signature, () => new TLChannelAdminLogEventActionChangeUsername()}, {TLChannelAdminLogEventActionChangePhoto.Signature, () => new TLChannelAdminLogEventActionChangePhoto()}, {TLChannelAdminLogEventActionToggleInvites.Signature, () => new TLChannelAdminLogEventActionToggleInvites()}, {TLChannelAdminLogEventActionToggleSignatures.Signature, () => new TLChannelAdminLogEventActionToggleSignatures()}, {TLChannelAdminLogEventActionUpdatePinned.Signature, () => new TLChannelAdminLogEventActionUpdatePinned()}, {TLChannelAdminLogEventActionEditMessage.Signature, () => new TLChannelAdminLogEventActionEditMessage()}, {TLChannelAdminLogEventActionDeleteMessage.Signature, () => new TLChannelAdminLogEventActionDeleteMessage()}, {TLChannelAdminLogEventActionParticipantJoin.Signature, () => new TLChannelAdminLogEventActionParticipantJoin()}, {TLChannelAdminLogEventActionParticipantLeave.Signature, () => new TLChannelAdminLogEventActionParticipantLeave()}, {TLChannelAdminLogEventActionParticipantInvite.Signature, () => new TLChannelAdminLogEventActionParticipantInvite()}, {TLChannelAdminLogEventActionParticipantToggleBan.Signature, () => new TLChannelAdminLogEventActionParticipantToggleBan()}, {TLChannelAdminLogEventActionParticipantToggleAdmin.Signature, () => new TLChannelAdminLogEventActionParticipantToggleAdmin()}, {TLChannelAdminLogEvent.Signature, () => new TLChannelAdminLogEvent()}, {TLAdminLogResults.Signature, () => new TLAdminLogResults()}, {TLChannelAdminLogEventsFilter.Signature, () => new TLChannelAdminLogEventsFilter()}, // layer 69 {TLPopularContact.Signature, () => new TLPopularContact()}, {TLImportedContacts69.Signature, () => new TLImportedContacts69()}, // layer 70 {TLInputMediaUploadedPhoto70.Signature, () => new TLInputMediaUploadedPhoto70()}, {TLInputMediaPhoto70.Signature, () => new TLInputMediaPhoto70()}, {TLInputMediaUploadedDocument70.Signature, () => new TLInputMediaUploadedDocument70()}, {TLInputMediaDocument70.Signature, () => new TLInputMediaDocument70()}, {TLInputMediaPhotoExternal70.Signature, () => new TLInputMediaPhotoExternal70()}, {TLInputMediaDocumentExternal70.Signature, () => new TLInputMediaDocumentExternal70()}, {TLMessage70.Signature, () => new TLMessage70()}, {TLMessageMediaPhoto70.Signature, () => new TLMessageMediaPhoto70()}, {TLMessageMediaDocument70.Signature, () => new TLMessageMediaDocument70()}, {TLMessageActionScreenshotTaken.Signature, () => new TLMessageActionScreenshotTaken()}, {TLFileCdnRedirect70.Signature, () => new TLFileCdnRedirect70()}, {TLMessageFwdHeader70.Signature, () => new TLMessageFwdHeader70()}, {TLCdnFileHash.Signature, () => new TLCdnFileHash()}, // layer 71 {TLChannelFull71.Signature, () => new TLChannelFull71()}, {TLDialog71.Signature, () => new TLDialog71()}, {TLContacts71.Signature, () => new TLContacts71()}, {TLInputMessagesFilterMyMentions.Signature, () => new TLInputMessagesFilterMyMentions()}, {TLUpdateFavedStickers.Signature, () => new TLUpdateFavedStickers()}, {TLUpdateChannelReadMessagesContents.Signature, () => new TLUpdateChannelReadMessagesContents()}, {TLUpdateContactsReset.Signature, () => new TLUpdateContactsReset()}, {TLConfig71.Signature, () => new TLConfig71()}, {TLChannelDifferenceTooLong71.Signature, () => new TLChannelDifferenceTooLong71()}, {TLChannelAdminLogEventActionChangeStickerSet.Signature, () => new TLChannelAdminLogEventActionChangeStickerSet()}, {TLFavedStickersNotModified.Signature, () => new TLFavedStickersNotModified()}, {TLFavedStickers.Signature, () => new TLFavedStickers()}, // layer 72 {TLInputMediaVenue72.Signature, () => new TLInputMediaVenue72()}, {TLInputMediaGeoLive.Signature, () => new TLInputMediaGeoLive()}, {TLChannelFull72.Signature, () => new TLChannelFull72()}, {TLMessageMediaVenue72.Signature, () => new TLMessageMediaVenue72()}, {TLMessageMediaGeoLive.Signature, () => new TLMessageMediaGeoLive()}, {TLMessageActionCustomAction.Signature, () => new TLMessageActionCustomAction()}, {TLInputMessagesFilterGeo.Signature, () => new TLInputMessagesFilterGeo()}, {TLInputMessagesFilterContacts.Signature, () => new TLInputMessagesFilterContacts()}, {TLUpdateChannelAvailableMessages.Signature, () => new TLUpdateChannelAvailableMessages()}, {TLConfig72.Signature, () => new TLConfig72()}, {TLBotResults72.Signature, () => new TLBotResults72()}, {TLInputPaymentCredentialsApplePay.Signature, () => new TLInputPaymentCredentialsApplePay()}, {TLInputPaymentCredentialsAndroidPay.Signature, () => new TLInputPaymentCredentialsAndroidPay()}, {TLChannelAdminLogEventActionTogglePreHistoryHidden.Signature, () => new TLChannelAdminLogEventActionTogglePreHistoryHidden()}, {TLRecentMeUrlUnknown.Signature, () => new TLRecentMeUrlUnknown()}, {TLRecentMeUrlUser.Signature, () => new TLRecentMeUrlUser()}, {TLRecentMeUrlChat.Signature, () => new TLRecentMeUrlChat()}, {TLRecentMeUrlChatInvite.Signature, () => new TLRecentMeUrlChatInvite()}, {TLRecentMeUrlStickerSet.Signature, () => new TLRecentMeUrlStickerSet()}, {TLRecentMeUrls.Signature, () => new TLRecentMeUrls()}, {TLChannelParticipantsNotModified.Signature, () => new TLChannelParticipantsNotModified()}, // layer 73 {TLChannel73.Signature, () => new TLChannel73()}, {TLMessage73.Signature, () => new TLMessage73()}, {TLMessageFwdHeader73.Signature, () => new TLMessageFwdHeader73()}, {TLInputMediaInvoice73.Signature, () => new TLInputMediaInvoice73()}, {TLInputSingleMedia.Signature, () => new TLInputSingleMedia()}, // layer 74 {TLContactsFound74.Signature, () => new TLContactsFound74()}, {TLExportedMessageLink74.Signature, () => new TLExportedMessageLink74()}, {TLInputPaymentCredentialsAndroidPay74.Signature, () => new TLInputPaymentCredentialsAndroidPay74()}, // layer 75 {TLInputMediaUploadedPhoto75.Signature, () => new TLInputMediaUploadedPhoto75()}, {TLInputMediaPhoto75.Signature, () => new TLInputMediaPhoto75()}, {TLInputMediaUploadedDocument75.Signature, () => new TLInputMediaUploadedDocument75()}, {TLInputMediaDocument75.Signature, () => new TLInputMediaDocument75()}, {TLInputMediaPhotoExternal75.Signature, () => new TLInputMediaPhotoExternal75()}, {TLInputMediaDocumentExternal75.Signature, () => new TLInputMediaDocumentExternal75()}, {TLMessageMediaPhoto75.Signature, () => new TLMessageMediaPhoto75()}, {TLMessageMediaDocument75.Signature, () => new TLMessageMediaDocument75()}, {TLInputBotInlineMessageMediaAuto75.Signature, () => new TLInputBotInlineMessageMediaAuto75()}, {TLBotInlineMessageMediaAuto75.Signature, () => new TLBotInlineMessageMediaAuto75()}, {TLInputSingleMedia75.Signature, () => new TLInputSingleMedia75()}, // layer 76 {TLChannel76.Signature, () => new TLChannel76()}, {TLDialogFeed.Signature, () => new TLDialogFeed()}, {TLUpdateDialogPinned76.Signature, () => new TLUpdateDialogPinned76()}, {TLUpdatePinnedDialogs76.Signature, () => new TLUpdatePinnedDialogs76()}, {TLUpdateReadFeed.Signature, () => new TLUpdateReadFeed()}, {TLStickerSet76.Signature, () => new TLStickerSet76()}, {TLRecentStickers76.Signature, () => new TLRecentStickers76()}, {TLFeedPosition.Signature, () => new TLFeedPosition()}, {TLInputDialogPeerFeed.Signature, () => new TLInputDialogPeerFeed()}, {TLInputDialogPeer.Signature, () => new TLInputDialogPeer()}, {TLDialogPeerFeed.Signature, () => new TLDialogPeerFeed()}, {TLDialogPeer.Signature, () => new TLDialogPeer()}, {TLWebAuthorization.Signature, () => new TLWebAuthorization()}, {TLWebAuthorizations.Signature, () => new TLWebAuthorizations()}, {TLInputMessageId.Signature, () => new TLInputMessageId()}, {TLInputMessageReplyTo.Signature, () => new TLInputMessageReplyTo()}, {TLInputMessagePinned.Signature, () => new TLInputMessagePinned()}, {TLInputSingleMedia76.Signature, () => new TLInputSingleMedia76()}, {TLMessageEntityPhone.Signature, () => new TLMessageEntityPhone()}, {TLMessageEntityCashtag.Signature, () => new TLMessageEntityCashtag()}, {TLFeedMessagesNotModified.Signature, () => new TLFeedMessagesNotModified()}, {TLFeedMessages.Signature, () => new TLFeedMessages()}, {TLFeedBroadcastsUngrouped.Signature, () => new TLFeedBroadcastsUngrouped()}, {TLFeedBroadcasts.Signature, () => new TLFeedBroadcasts()}, {TLFeedSourcesNotModified.Signature, () => new TLFeedSourcesNotModified()}, {TLFeedSources.Signature, () => new TLFeedSources()}, {TLMessageActionBotAllowed.Signature, () => new TLMessageActionBotAllowed()}, {TLPeerFeed.Signature, () => new TLPeerFeed()}, {TLInputPeerFeed.Signature, () => new TLInputPeerFeed()}, {TLConfig76.Signature, () => new TLConfig76()}, {TLFoundStickerSetsNotModified.Signature, () => new TLFoundStickerSetsNotModified()}, {TLFoundStickerSets.Signature, () => new TLFoundStickerSets()}, {TLFileHash.Signature, () => new TLFileHash()}, {TLFileCdnRedirect76.Signature, () => new TLFileCdnRedirect76()}, {TLInputBotInlineResult76.Signature, () => new TLInputBotInlineResult76()}, {TLBotInlineResult76.Signature, () => new TLBotInlineResult76()}, {TLWebDocumentNoProxy.Signature, () => new TLWebDocumentNoProxy()}, // layer 77 // layer 78 {TLDCOption78.Signature, () => new TLDCOption78()}, {TLConfig78.Signature, () => new TLConfig78()}, {TLInputClientProxy.Signature, () => new TLInputClientProxy()}, {TLProxyDataEmpty.Signature, () => new TLProxyDataEmpty()}, {TLProxyDataPromo.Signature, () => new TLProxyDataPromo()}, // layer 79 {TLStickers79.Signature, () => new TLStickers79()}, {TLPeerNotifySettings78.Signature, () => new TLPeerNotifySettings78()}, {TLInputPeerNotifySettings78.Signature, () => new TLInputPeerNotifySettings78()}, {TLBotInlineMessageMediaVenue78.Signature, () => new TLBotInlineMessageMediaVenue78()}, {TLInputBotInlineMessageMediaVenue78.Signature, () => new TLInputBotInlineMessageMediaVenue78()}, // layer 80 {TLSentCode80.Signature, () => new TLSentCode80()}, {TLTermsOfService80.Signature, () => new TLTermsOfService80()}, {TLTermsOfServiceUpdateEmpty.Signature, () => new TLTermsOfServiceUpdateEmpty()}, {TLTermsOfServiceUpdate.Signature, () => new TLTermsOfServiceUpdate()}, // layer 81 {TLInputSecureFileLocation.Signature, () => new TLInputSecureFileLocation()}, {TLMessageActionSecureValuesSentMe.Signature, () => new TLMessageActionSecureValuesSentMe()}, {TLMessageActionSecureValuesSent.Signature, () => new TLMessageActionSecureValuesSent()}, {TLNoPassword81.Signature, () => new TLNoPassword81()}, {TLPassword81.Signature, () => new TLPassword81()}, {TLPasswordSettings81.Signature, () => new TLPasswordSettings81()}, {TLPasswordInputSettings81.Signature, () => new TLPasswordInputSettings81()}, {TLInputSecureFileUploaded.Signature, () => new TLInputSecureFileUploaded()}, {TLInputSecureFile.Signature, () => new TLInputSecureFile()}, {TLSecureFileEmpty.Signature, () => new TLSecureFileEmpty()}, {TLSecureFile.Signature, () => new TLSecureFile()}, {TLSecureData.Signature, () => new TLSecureData()}, {TLSecurePlainPhone.Signature, () => new TLSecurePlainPhone()}, {TLSecurePlainEmail.Signature, () => new TLSecurePlainEmail()}, {TLSecureValueTypePersonalDetails.Signature, () => new TLSecureValueTypePersonalDetails()}, {TLSecureValueTypePassport.Signature, () => new TLSecureValueTypePassport()}, {TLSecureValueTypeDriverLicense.Signature, () => new TLSecureValueTypeDriverLicense()}, {TLSecureValueTypeIdentityCard.Signature, () => new TLSecureValueTypeIdentityCard()}, {TLSecureValueTypeInternalPassport.Signature, () => new TLSecureValueTypeInternalPassport()}, {TLSecureValueTypeAddress.Signature, () => new TLSecureValueTypeAddress()}, {TLSecureValueTypeUtilityBill.Signature, () => new TLSecureValueTypeUtilityBill()}, {TLSecureValueTypeBankStatement.Signature, () => new TLSecureValueTypeBankStatement()}, {TLSecureValueTypeRentalAgreement.Signature, () => new TLSecureValueTypeRentalAgreement()}, {TLSecureValueTypePassportRegistration.Signature, () => new TLSecureValueTypePassportRegistration()}, {TLSecureValueTypeTemporaryRegistration.Signature, () => new TLSecureValueTypeTemporaryRegistration()}, {TLSecureValueTypePhone.Signature, () => new TLSecureValueTypePhone()}, {TLSecureValueTypeEmail.Signature, () => new TLSecureValueTypeEmail()}, {TLSecureValue.Signature, () => new TLSecureValue()}, {TLInputSecureValue.Signature, () => new TLInputSecureValue()}, {TLSecureValueHash.Signature, () => new TLSecureValueHash()}, {TLSecureValueErrorData.Signature, () => new TLSecureValueErrorData()}, {TLSecureValueErrorFrontSide.Signature, () => new TLSecureValueErrorFrontSide()}, {TLSecureValueErrorReverseSide.Signature, () => new TLSecureValueErrorReverseSide()}, {TLSecureValueErrorSelfie.Signature, () => new TLSecureValueErrorSelfie()}, {TLSecureValueErrorFile.Signature, () => new TLSecureValueErrorFile()}, {TLSecureValueErrorFiles.Signature, () => new TLSecureValueErrorFiles()}, {TLSecureCredentialsEncrypted.Signature, () => new TLSecureCredentialsEncrypted()}, {TLAuthorizationForm.Signature, () => new TLAuthorizationForm()}, {TLSentEmailCode.Signature, () => new TLSentEmailCode()}, {TLDeepLinkInfoEmpty.Signature, () => new TLDeepLinkInfoEmpty()}, {TLDeepLinkInfo.Signature, () => new TLDeepLinkInfo()}, {TLSavedPhoneContact.Signature, () => new TLSavedPhoneContact()}, {TLTakeout.Signature, () => new TLTakeout()}, // layer 82 {TLInputTakeoutFileLocation.Signature, () => new TLInputTakeoutFileLocation()}, {TLAppUpdate.Signature, () => new TLAppUpdate()}, {TLNoAppUpdate.Signature, () => new TLNoAppUpdate()}, {TLInputMediaContact82.Signature, () => new TLInputMediaContact82()}, {TLMessageMediaContact82.Signature, () => new TLMessageMediaContact82()}, {TLGeoPoint82.Signature, () => new TLGeoPoint82()}, {TLDialogsNotModified.Signature, () => new TLDialogsNotModified()}, {TLUpdateDialogUnreadMark.Signature, () => new TLUpdateDialogUnreadMark()}, {TLConfig82.Signature, () => new TLConfig82()}, {TLInputBotInlineMessageMediaContact82.Signature, () => new TLInputBotInlineMessageMediaContact82()}, {TLBotInlineMessageMediaContact82.Signature, () => new TLBotInlineMessageMediaContact82()}, {TLDraftMessageEmpty82.Signature, () => new TLDraftMessageEmpty82()}, {TLWebDocument82.Signature, () => new TLWebDocument82()}, {TLInputWebFileGeoPointLocation.Signature, () => new TLInputWebFileGeoPointLocation()}, {TLInputReportReasonCopyright.Signature, () => new TLInputReportReasonCopyright()}, {TLTopPeersDisabled.Signature, () => new TLTopPeersDisabled()}, // layer 83 {TLPassword83.Signature, () => new TLPassword83()}, {TLPasswordSettings83.Signature, () => new TLPasswordSettings83()}, {TLPasswordInputSettings83.Signature, () => new TLPasswordInputSettings83()}, {TLPasswordKdfAlgoUnknown.Signature, () => new TLPasswordKdfAlgoUnknown()}, {TLSecurePasswordKdfAlgoUnknown.Signature, () => new TLSecurePasswordKdfAlgoUnknown()}, {TLSecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000.Signature, () => new TLSecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000()}, {TLSecurePasswordKdfAlgoSHA512.Signature, () => new TLSecurePasswordKdfAlgoSHA512()}, {TLSecureSecretSettings.Signature, () => new TLSecureSecretSettings()}, // layer 84 {TLPassword84.Signature, () => new TLPassword84()}, {TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow.Signature, () => new TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow()}, {TLInputCheckPasswordEmpty.Signature, () => new TLInputCheckPasswordEmpty()}, {TLInputCheckPasswordSRP.Signature, () => new TLInputCheckPasswordSRP()}, // layer 85 {TLSecureValue85.Signature, () => new TLSecureValue85()}, {TLInputSecureValue85.Signature, () => new TLInputSecureValue85()}, {TLSecureValueError.Signature, () => new TLSecureValueError()}, {TLSecureValueErrorTranslationFile.Signature, () => new TLSecureValueErrorTranslationFile()}, {TLSecureValueErrorTranslationFiles.Signature, () => new TLSecureValueErrorTranslationFiles()}, {TLAuthorizationForm85.Signature, () => new TLAuthorizationForm85()}, {TLSecureRequiredType.Signature, () => new TLSecureRequiredType()}, {TLSecureRequiredTypeOneOf.Signature, () => new TLSecureRequiredTypeOneOf()}, {TLPassportConfigNotModified.Signature, () => new TLPassportConfigNotModified()}, {TLPassportConfig.Signature, () => new TLPassportConfig()}, // {TLConfigSimple.Signature, () => new TLConfigSimple()}, //45 layer encrypted {TLDecryptedMessage45.Signature, () => new TLDecryptedMessage45()}, {TLDecryptedMessageMediaPhoto45.Signature, () => new TLDecryptedMessageMediaPhoto45()}, {TLDecryptedMessageMediaVideo45.Signature, () => new TLDecryptedMessageMediaVideo45()}, {TLDecryptedMessageMediaDocument45.Signature, () => new TLDecryptedMessageMediaDocument45()}, {TLDecryptedMessageMediaVenue.Signature, () => new TLDecryptedMessageMediaVenue()}, {TLDecryptedMessageMediaWebPage.Signature, () => new TLDecryptedMessageMediaWebPage()}, //73 layer encrypted {TLDecryptedMessage73.Signature, () => new TLDecryptedMessage73()}, // functions {TLSendMessage.Signature, () => new TLSendMessage()}, {TLSendInlineBotResult.Signature, () => new TLSendInlineBotResult()}, {TLSendMedia.Signature, () => new TLSendMedia()}, {TLForwardMessage.Signature, () => new TLForwardMessage()}, {TLForwardMessages.Signature, () => new TLForwardMessages()}, {TLStartBot.Signature, () => new TLStartBot()}, {TLReadHistory.Signature, () => new TLReadHistory()}, {TLReadChannelHistory.Signature, () => new TLReadChannelHistory()}, {Functions.Messages.TLReadMessageContents.Signature, () => new Functions.Messages.TLReadMessageContents()}, {Functions.Channels.TLReadMessageContents.Signature, () => new Functions.Channels.TLReadMessageContents()}, {TLSendEncrypted.Signature, () => new TLSendEncrypted()}, {TLSendEncryptedFile.Signature, () => new TLSendEncryptedFile()}, {TLSendEncryptedService.Signature, () => new TLSendEncryptedService()}, {TLReadEncryptedHistory.Signature, () => new TLReadEncryptedHistory()}, {TLInitConnection.Signature, () => new TLInitConnection()}, {TLInitConnection67.Signature, () => new TLInitConnection67()}, // additional sigantures {TLEncryptedDialog.Signature, () => new TLEncryptedDialog()}, {TLUserExtendedInfo.Signature, () => new TLUserExtendedInfo()}, {TLDecryptedMessageActionEmpty.Signature, () => new TLDecryptedMessageActionEmpty()}, {TLPeerEncryptedChat.Signature, () => new TLPeerEncryptedChat()}, {TLBroadcastChat.Signature, () => new TLBroadcastChat()}, {TLPeerBroadcast.Signature, () => new TLPeerBroadcast()}, {TLBroadcastDialog.Signature, () => new TLBroadcastDialog()}, {TLInputPeerBroadcast.Signature, () => new TLInputPeerBroadcast()}, {TLServerFile.Signature, () => new TLServerFile()}, {TLEncryptedChat17.Signature, () => new TLEncryptedChat17()}, {TLMessageActionUnreadMessages.Signature, () => new TLMessageActionUnreadMessages()}, {TLMessagesContainter.Signature, () => new TLMessagesContainter()}, {TLHashtagItem.Signature, () => new TLHashtagItem()}, {TLMessageActionContactRegistered.Signature, () => new TLMessageActionContactRegistered()}, {TLPasscodeParams.Signature, () => new TLPasscodeParams()}, {TLRecentlyUsedSticker.Signature, () => new TLRecentlyUsedSticker()}, {TLActionInfo.Signature, () => new TLActionInfo()}, {TLResultInfo.Signature, () => new TLResultInfo()}, {TLMessageActionMessageGroup.Signature, () => new TLMessageActionMessageGroup()}, {TLMessageActionChannelJoined.Signature, () => new TLMessageActionChannelJoined()}, {TLChatSettings.Signature, () => new TLChatSettings()}, {TLDocumentExternal.Signature, () => new TLDocumentExternal()}, {TLDecryptedMessagesContainter.Signature, () => new TLDecryptedMessagesContainter()}, {TLCameraSettings.Signature, () => new TLCameraSettings()}, {TLPhotoPickerSettings.Signature, () => new TLPhotoPickerSettings()}, {TLProxyConfig.Signature, () => new TLProxyConfig()}, {TLCallsSecurity.Signature, () => new TLCallsSecurity()}, {TLStickerSetEmpty.Signature, () => new TLStickerSetEmpty()}, {TLMessageMediaGroup.Signature, () => new TLMessageMediaGroup()}, {TLDecryptedMessageMediaGroup.Signature, () => new TLDecryptedMessageMediaGroup()}, {TLSecureFileUploaded.Signature, () => new TLSecureFileUploaded()}, {TLProxyConfig76.Signature, () => new TLProxyConfig76()}, {TLSocks5Proxy.Signature, () => new TLSocks5Proxy()}, {TLMTProtoProxy.Signature, () => new TLMTProtoProxy()}, {TLContactsSettings.Signature, () => new TLContactsSettings()}, }; public static TimeSpan ElapsedClothedTypes; public static TimeSpan ElapsedBaredTypes; public static TimeSpan ElapsedVectorTypes; public static T GetObject(byte[] bytes, int position) where T : TLObject { //var stopwatch = Stopwatch.StartNew(); // bared types var stopwatch2 = Stopwatch.StartNew(); try { if (_baredTypes.ContainsKey(typeof (T))) { return (T) _baredTypes[typeof (T)].Invoke(); } } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedBaredTypes += stopwatch2.Elapsed; } var stopwatch = Stopwatch.StartNew(); uint signature = 0; try { // clothed types //var signatureBytes = bytes.SubArray(position, 4); //Array.Reverse(signatureBytes); signature = BitConverter.ToUInt32(bytes, position); Func getInstance; // exact matching if (_clothedTypes.TryGetValue(signature, out getInstance)) { return (T)getInstance.Invoke(); } //// matching with removed leading 0 //while (signature.StartsWith("0")) //{ // signature = signature.Remove(0, 1); // if (_clothedTypes.TryGetValue("#" + signature, out getInstance)) // { // return (T)getInstance.Invoke(); // } //} } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedClothedTypes += stopwatch.Elapsed; } var stopwatch3 = Stopwatch.StartNew(); //throw new Exception("Signature exception"); try { // TLVector if (bytes.StartsWith(position, TLConstructors.TLVector)) { //TODO: remove workaround for TLRPCRESULT: TLVECTOR if (typeof (T) == typeof (TLObject)) { Func getObject; var internalSignature = BitConverter.ToUInt32(bytes, position + 8); var length = BitConverter.ToInt32(bytes, position + 4); if (length > 0) { if (_clothedTypes.TryGetValue(internalSignature, out getObject)) { var obj = getObject.Invoke(); if (obj is TLUserBase) { return (T)Activator.CreateInstance(typeof(TLVector)); } } } if (bytes.StartsWith(position + 8, TLConstructors.TLStickerSet) || bytes.StartsWith(position + 8, TLConstructors.TLStickerSet32)) { return (T)Activator.CreateInstance(typeof(TLVector)); } else if (bytes.StartsWith(position + 8, TLConstructors.TLContactStatus19) || bytes.StartsWith(position + 8, TLConstructors.TLContactStatus)) { return (T)Activator.CreateInstance(typeof(TLVector)); } else if (bytes.StartsWith(position + 8, TLConstructors.TLWallPaper) || bytes.StartsWith(position + 8, TLConstructors.TLWallPaperSolid)) { return (T)Activator.CreateInstance(typeof(TLVector)); } else if (bytes.StartsWith(position + 8, TLConstructors.TLStickerSetCovered) || bytes.StartsWith(position + 8, TLConstructors.TLStickerSetMultiCovered)) { return (T)Activator.CreateInstance(typeof(TLVector)); } else if (bytes.StartsWith(position + 8, TLConstructors.TLSecureValue) || bytes.StartsWith(position + 8, TLConstructors.TLSecureValue85)) { return (T)Activator.CreateInstance(typeof(TLVector)); } TLUtils.WriteLine("TLVecto hack ", LogSeverity.Error); return (T) Activator.CreateInstance(typeof(TLVector)); } else { return (T) Activator.CreateInstance(typeof (T)); } } } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedVectorTypes += stopwatch3.Elapsed; } var signatureBytes = BitConverter.GetBytes(signature); Array.Reverse(signatureBytes); var signatureString = BitConverter.ToString(signatureBytes).Replace("-", string.Empty).ToLowerInvariant(); if (typeof (T) == typeof (TLObject)) { var error = string.Format(" ERROR TLObjectGenerator: Cannot find signature #{0} ({1})\n\n{2}", signatureString, signature, GetStackTrace()); TLUtils.WriteLine(error, LogSeverity.Error); Logs.Log.Write(error); Execute.ShowDebugMessage(error); } else { var error = string.Format(" ERROR TLObjectGenerator: Incorrect signature #{0} ({1}) for type {2}\n\n{3}", signatureString, signature, typeof(T), GetStackTrace()); TLUtils.WriteLine(error, LogSeverity.Error); Logs.Log.Write(error); Execute.ShowDebugMessage(error); } return null; } public static string GetStackTrace() { try { var type = typeof(Environment); foreach (var p in type.GetRuntimeProperties()) { if (p.Name == "StackTrace") { var v = p.GetValue(null, null); return v != null ? v.ToString() : null; } } } catch { } return null; } public static T GetNullableObject(Stream input) where T : TLObject { // clothed types var signatureBytes = new byte[4]; input.Read(signatureBytes, 0, 4); uint signature = BitConverter.ToUInt32(signatureBytes, 0); if (signature == TLNull.Signature) return null; input.Position = input.Position - 4; return GetObject(input); } public static T GetObject(Stream input) where T : TLObject { //var startPosition = input.Position; //var stopwatch = Stopwatch.StartNew(); // bared types var stopwatch2 = Stopwatch.StartNew(); try { if (_baredTypes.ContainsKey(typeof(T))) { return (T)_baredTypes[typeof(T)].Invoke(); } } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedBaredTypes += stopwatch2.Elapsed; } var stopwatch = Stopwatch.StartNew(); uint signature = 0; try { // clothed types var signatureBytes = new byte[4]; input.Read(signatureBytes, 0, 4); signature = BitConverter.ToUInt32(signatureBytes, 0); Func getInstance; // exact matching if (_clothedTypes.TryGetValue(signature, out getInstance)) { return (T)getInstance.Invoke(); } } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedClothedTypes += stopwatch.Elapsed; } var stopwatch3 = Stopwatch.StartNew(); //throw new Exception("Signature exception"); try { // TLVector if (signature == TLConstructors.TLVector) { //TODO: remove workaround for TLRPCRESULT: TLVECTOR if (typeof(T) == typeof(TLObject)) { TLUtils.WriteLine("TLVecto hack ", LogSeverity.Error); return (T)Activator.CreateInstance(typeof(TLVector)); } else { return (T)Activator.CreateInstance(typeof(T)); } } } catch (Exception ex) { Execute.ShowDebugMessage(ex.ToString()); } finally { ElapsedVectorTypes += stopwatch3.Elapsed; } var bytes = BitConverter.GetBytes(signature); Array.Reverse(bytes); var signatureString = BitConverter.ToString(bytes).Replace("-", string.Empty).ToLowerInvariant(); if (typeof(T) == typeof(TLObject)) { var error = string.Format(" ERROR TLObjectGenerator FromStream: Cannot find signature #{0} ({1})\n\n{2}", signatureString, signature, GetStackTrace()); TLUtils.WriteLine(error, LogSeverity.Error); Execute.ShowDebugMessage(error); } else { var error = string.Format(" ERROR TLObjectGenerator FromStream: Incorrect signature #{0} ({1}) for type {2}\n\n{3}", signatureString, signature, typeof(T), GetStackTrace()); //var count = 0; //while (input.Position < input.Length) //{ // input.Position = startPosition + count; // var signatureBytes = new byte[4]; // input.Read(signatureBytes, 0, 4); // signature = BitConverter.ToUInt32(signatureBytes, 0); // Func getInstance; // if (_clothedTypes.TryGetValue(signature, out getInstance)) // { // var instance = getInstance.Invoke(); // } // count++; //} TLUtils.WriteLine(error, LogSeverity.Error); Execute.ShowDebugMessage(error); } return null; } } } ================================================ FILE: Telegram.Api/TL/TLPQInnerData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPQInnerData : TLObject { public const uint Signature = TLConstructors.TLPQInnerData; public TLString PQ { get; set; } public TLString P { get; set; } public TLString Q { get; set; } public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLInt256 NewNonce { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PQ.ToBytes(), P.ToBytes(), Q.ToBytes(), Nonce.ToBytes(), ServerNonce.ToBytes(), NewNonce.ToBytes()); } } public class TLPQInnerDataDC : TLPQInnerData { public new const uint Signature = TLConstructors.TLPQInnerDataDC; public TLInt DCId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PQ.ToBytes(), P.ToBytes(), Q.ToBytes(), Nonce.ToBytes(), ServerNonce.ToBytes(), NewNonce.ToBytes(), DCId.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLPage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPageBase : TLObject { public TLVector Blocks { get; set; } public TLVector Photos { get; set; } public TLVector Documents { get; set; } } public class TLPagePart : TLPageBase { public const uint Signature = TLConstructors.TLPagePart; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Blocks = GetObject>(bytes, ref position); Photos = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Blocks.ToBytes(), Photos.ToBytes(), Documents.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Blocks.ToStream(output); Photos.ToStream(output); Documents.ToStream(output); } public override TLObject FromStream(Stream input) { Blocks = GetObject>(input); Photos = GetObject>(input); Documents = GetObject>(input); return this; } } public class TLPagePart68 : TLPageBase { public const uint Signature = TLConstructors.TLPagePart68; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Blocks = GetObject>(bytes, ref position); Photos = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Blocks.ToBytes(), Photos.ToBytes(), Documents.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Blocks.ToStream(output); Photos.ToStream(output); Documents.ToStream(output); } public override TLObject FromStream(Stream input) { Blocks = GetObject>(input); Photos = GetObject>(input); Documents = GetObject>(input); return this; } } public class TLPageFull : TLPageBase { public const uint Signature = TLConstructors.TLPageFull; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Blocks = GetObject>(bytes, ref position); Photos = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Blocks.ToBytes(), Photos.ToBytes(), Documents.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Blocks.ToStream(output); Photos.ToStream(output); Documents.ToStream(output); } public override TLObject FromStream(Stream input) { Blocks = GetObject>(input); Photos = GetObject>(input); Documents = GetObject>(input); return this; } } public class TLPageFull68 : TLPageBase { public const uint Signature = TLConstructors.TLPageFull68; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Blocks = GetObject>(bytes, ref position); Photos = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Blocks.ToBytes(), Photos.ToBytes(), Documents.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Blocks.ToStream(output); Photos.ToStream(output); Documents.ToStream(output); } public override TLObject FromStream(Stream input) { Blocks = GetObject>(input); Photos = GetObject>(input); Documents = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPageBlock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PageBlockVideoFlags { Autoplay = 0x1, // 0 Loop = 0x2, // 1 } [Flags] public enum PageBlockEmbedFlags { FullWidth = 0x1, // 0 Url = 0x2, // 1 Html = 0x4, // 2 AllowScrolling = 0x8, // 3 PosterPhotoId = 0x10, // 4 } public abstract class TLPageBlockBase : TLObject { } public class TLPageBlockUnsupported : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockUnsupported; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPageBlockTitle : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockTitle; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLPageBlockSubtitle : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockSubtitle; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public abstract class TLPageBlockPublishedDateBase : TLPageBlockBase { public TLInt PublishedDate { get; set; } } public class TLPageBlockAuthorDate : TLPageBlockPublishedDateBase { public const uint Signature = TLConstructors.TLPageBlockAuthorDate; public TLString Author { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Author = GetObject(bytes, ref position); PublishedDate = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Author.ToBytes(), PublishedDate.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Author.ToStream(output); PublishedDate.ToStream(output); } public override TLObject FromStream(Stream input) { Author = GetObject(input); PublishedDate = GetObject(input); return this; } } public class TLPageBlockAuthorDate61 : TLPageBlockPublishedDateBase { public const uint Signature = TLConstructors.TLPageBlockAuthorDate61; public TLRichTextBase Author { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Author = GetObject(bytes, ref position); PublishedDate = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Author.ToBytes(), PublishedDate.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Author.ToStream(output); PublishedDate.ToStream(output); } public override TLObject FromStream(Stream input) { Author = GetObject(input); PublishedDate = GetObject(input); return this; } } public class TLPageBlockHeader : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockHeader; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLPageBlockSubheader : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockSubheader; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLPageBlockParagraph : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockParagraph; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLPageBlockPreformatted : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockPreformatted; public TLRichTextBase Text { get; set; } public TLString Language { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Language = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Language.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); Language.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Language = GetObject(input); return this; } } public class TLPageBlockFooter : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockFooter; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLPageBlockDivider : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockDivider; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPageBlockAnchor : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockAnchor; public TLString Name { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Name = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Name.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Name.ToStream(output); } public override TLObject FromStream(Stream input) { Name = GetObject(input); return this; } } public class TLPageBlockList : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockList; public TLBool Ordered { get; set; } public TLVector Items { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Ordered = GetObject(bytes, ref position); Items = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Ordered.ToBytes(), Items.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Ordered.ToStream(output); Items.ToStream(output); } public override TLObject FromStream(Stream input) { Ordered = GetObject(input); Items = GetObject>(input); return this; } } public class TLPageBlockBlockquote : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockBlockquote; public TLRichTextBase Text { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockPullquote : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockPullquote; public TLRichTextBase Text { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockPhoto : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockPhoto; public TLLong PhotoId { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhotoId = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhotoId.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhotoId.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { PhotoId = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockVideo : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockVideo; public TLInt Flags { get; set; } public bool Autoplay { get { return IsSet(Flags, (int) PageBlockVideoFlags.Autoplay); } } public bool Loop { get { return IsSet(Flags, (int) PageBlockVideoFlags.Loop); } } public TLLong VideoId { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); VideoId = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), VideoId.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); VideoId.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); VideoId = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockCover : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockCover; public TLPageBlockBase Cover { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Cover = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Cover.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Cover.ToStream(output); } public override TLObject FromStream(Stream input) { Cover = GetObject(input); return this; } } public class TLPageBlockEmbed : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockEmbed; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool FullWidth { get { return IsSet(Flags, (int) PageBlockEmbedFlags.FullWidth); } } public bool AllowScrolling { get { return IsSet(Flags, (int) PageBlockEmbedFlags.AllowScrolling); } } protected TLString _url; public TLString Url { get { return _url; } set { SetField(out _url, value, ref _flags, (int) PageBlockEmbedFlags.Url); } } protected TLString _html; public TLString Html { get { return _html; } set { SetField(out _html, value, ref _flags, (int) PageBlockEmbedFlags.Html); } } public TLInt W { get; set; } public TLInt H { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _url = GetObject(Flags, (int) PageBlockEmbedFlags.Url, null, bytes, ref position); _html = GetObject(Flags, (int) PageBlockEmbedFlags.Html, null, bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(Url, Flags, (int) PageBlockEmbedFlags.Url), ToBytes(Html, Flags, (int) PageBlockEmbedFlags.Html), W.ToBytes(), H.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Url, Flags, (int) PageBlockEmbedFlags.Url); ToStream(output, Html, Flags, (int) PageBlockEmbedFlags.Html); W.ToStream(output); H.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _url = GetObject(Flags, (int) PageBlockEmbedFlags.Url, null, input); _html = GetObject(Flags, (int) PageBlockEmbedFlags.Html, null, input); W = GetObject(input); H = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockEmbed61 : TLPageBlockEmbed { public new const uint Signature = TLConstructors.TLPageBlockEmbed61; protected TLLong _posterPhotoId; public TLLong PosterPhotoId { get { return _posterPhotoId; } set { SetField(out _posterPhotoId, value, ref _flags, (int) PageBlockEmbedFlags.PosterPhotoId); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _url = GetObject(Flags, (int)PageBlockEmbedFlags.Url, null, bytes, ref position); _html = GetObject(Flags, (int)PageBlockEmbedFlags.Html, null, bytes, ref position); _posterPhotoId = GetObject(Flags, (int)PageBlockEmbedFlags.PosterPhotoId, null, bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(Url, Flags, (int)PageBlockEmbedFlags.Url), ToBytes(Html, Flags, (int)PageBlockEmbedFlags.Html), ToBytes(PosterPhotoId, Flags, (int)PageBlockEmbedFlags.PosterPhotoId), W.ToBytes(), H.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Url, Flags, (int)PageBlockEmbedFlags.Url); ToStream(output, Html, Flags, (int)PageBlockEmbedFlags.Html); ToStream(output, PosterPhotoId, Flags, (int)PageBlockEmbedFlags.PosterPhotoId); W.ToStream(output); H.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _url = GetObject(Flags, (int)PageBlockEmbedFlags.Url, null, input); _html = GetObject(Flags, (int)PageBlockEmbedFlags.Html, null, input); _posterPhotoId = GetObject(Flags, (int)PageBlockEmbedFlags.PosterPhotoId, null, input); W = GetObject(input); H = GetObject(input); Caption = GetObject(input); return this; } } public class TLPageBlockEmbedPost : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockEmbedPost; public TLString Url { get; set; } public TLLong WebPageId { get; set; } public TLLong AuthorPhotoId { get; set; } public TLString Author { get; set; } public TLInt Date { get; set; } public TLVector Blocks { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); WebPageId = GetObject(bytes, ref position); AuthorPhotoId = GetObject(bytes, ref position); Author = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Blocks = GetObject>(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), WebPageId.ToBytes(), AuthorPhotoId.ToBytes(), Author.ToBytes(), Date.ToBytes(), Blocks.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); WebPageId.ToStream(output); AuthorPhotoId.ToStream(output); Author.ToStream(output); Date.ToStream(output); Blocks.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Url = GetObject(input); WebPageId = GetObject(input); AuthorPhotoId = GetObject(input); Author = GetObject(input); Date = GetObject(input); Blocks = GetObject>(input); Caption = GetObject(input); return this; } } public class TLPageBlockCollage : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockCollage; public TLVector Items { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Items = GetObject>(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Items.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Items.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Items = GetObject>(input); Caption = GetObject(input); return this; } } public class TLPageBlockSlideshow : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockSlideshow; public TLVector Items { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Items = GetObject>(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Items.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Items.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { Items = GetObject>(input); Caption = GetObject(input); return this; } } public class TLPageBlockChannel : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockChannel; public TLChatBase Channel { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Channel = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Channel.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Channel.ToStream(output); } public override TLObject FromStream(Stream input) { Channel = GetObject(input); return this; } } public class TLPageBlockAudio : TLPageBlockBase { public const uint Signature = TLConstructors.TLPageBlockAudio; public TLLong AudioId { get; set; } public TLRichTextBase Caption { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); AudioId = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), AudioId.ToBytes(), Caption.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); AudioId.ToStream(output); Caption.ToStream(output); } public override TLObject FromStream(Stream input) { AudioId = GetObject(input); Caption = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPasscodeParams.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLPasscodeParams : TLObject { public const uint Signature = TLConstructors.TLPasscodeParams; public TLString Hash { get; set; } public TLString Salt { get; set; } public TLBool IsSimple { get; set; } public TLInt CloseTime { get; set; } public TLInt AutolockTimeout { get; set; } public TLBool Locked { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Salt = GetObject(bytes, ref position); IsSimple = GetObject(bytes, ref position); CloseTime = GetObject(bytes, ref position); AutolockTimeout = GetObject(bytes, ref position); Locked = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Salt.ToBytes(), IsSimple.ToBytes(), CloseTime.ToBytes(), AutolockTimeout.ToBytes(), Locked.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Salt = GetObject(input); IsSimple = GetObject(input); CloseTime = GetObject(input); AutolockTimeout = GetObject(input); Locked = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Salt.ToStream(output); IsSimple.ToStream(output); CloseTime.ToStream(output); AutolockTimeout.ToStream(output); Locked.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PasswordFlags { HasRecovery = 0x1, // 0 HasSecureValues = 0x2, // 1 HasPassword = 0x4, // 2 Hint = 0x8, // 3 EmailUnconfirmedPattern = 0x10, // 4 } public interface IPasswordSecret { TLString SecretRandom { get; set; } TLSecurePasswordKdfAlgoBase NewSecureAlgo { get; set; } } public interface IPasswordSRPParams { TLString SRPB { get; set; } TLLong SRPId { get; set; } TLPasswordKdfAlgoBase CurrentAlgo { get; set; } } public abstract class TLPasswordBase : TLObject { public TLString NewSalt { get; set; } public virtual TLString EmailUnconfirmedPattern { get; set; } public bool IsAvailable { get { return HasPassword || !TLString.IsNullOrEmpty(EmailUnconfirmedPattern); } } public bool IsAuthRecovery { get; set; } public abstract bool HasPassword { get; } public TLString CurrentPasswordHash { get; set; } } public class TLPassword : TLPasswordBase { public const uint Signature = TLConstructors.TLPassword; public TLString CurrentSalt { get; set; } public virtual TLString Hint { get; set; } public virtual TLBool HasRecovery { get; set; } public override bool HasPassword { get { return true; } } #region Additional public TLPasswordSettings Settings { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); CurrentSalt = GetObject(bytes, ref position); NewSalt = GetObject(bytes, ref position); Hint = GetObject(bytes, ref position); HasRecovery = GetObject(bytes, ref position); EmailUnconfirmedPattern = GetObject(bytes, ref position); return this; } } public class TLPassword81 : TLPassword { public new const uint Signature = TLConstructors.TLPassword81; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool HasRecovery { get { return new TLBool(IsSet(_flags, (int) PasswordFlags.HasRecovery)); } set { SetUnset(ref _flags, value != null && value.Value, (int)PasswordFlags.HasRecovery); } } public bool HasSecureValues { get { return IsSet(_flags, (int) PasswordFlags.HasSecureValues); } } public TLString NewSecureSalt { get; set; } public TLString SecretRandom { get; set; } #region Additional public TLString CurrentSecret { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); CurrentSalt = GetObject(bytes, ref position); NewSalt = GetObject(bytes, ref position); NewSecureSalt = GetObject(bytes, ref position); SecretRandom = GetObject(bytes, ref position); Hint = GetObject(bytes, ref position); EmailUnconfirmedPattern = GetObject(bytes, ref position); return this; } } public class TLPassword83 : TLPassword81 { public new const uint Signature = TLConstructors.TLPassword83; public override bool HasPassword { get { return IsSet(_flags, (int)PasswordFlags.HasPassword); } } protected TLPasswordKdfAlgoBase _currentAlgo; public TLPasswordKdfAlgoBase CurrentAlgo { get { return _currentAlgo; } set { SetField(out _currentAlgo, value, ref _flags, (int)PasswordFlags.HasPassword); } } protected TLString _hint; public override TLString Hint { get { return _hint; } set { SetField(out _hint, value, ref _flags, (int)PasswordFlags.Hint); } } protected TLString _emailUnconfirmedPattern; public override TLString EmailUnconfirmedPattern { get { return _emailUnconfirmedPattern; } set { SetField(out _emailUnconfirmedPattern, value, ref _flags, (int)PasswordFlags.EmailUnconfirmedPattern); } } public TLPasswordKdfAlgoBase NewAlgo { get; set; } public TLSecurePasswordKdfAlgoBase NewSecureAlgo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); _currentAlgo = GetObject(Flags, (int) PasswordFlags.HasPassword, null, bytes, ref position); _hint = GetObject(Flags, (int)PasswordFlags.Hint, null, bytes, ref position); _emailUnconfirmedPattern = GetObject(Flags, (int)PasswordFlags.EmailUnconfirmedPattern, null, bytes, ref position); NewAlgo = GetObject(bytes, ref position); NewSecureAlgo = GetObject(bytes, ref position); SecretRandom = GetObject(bytes, ref position); return this; } } public class TLPassword84 : TLPassword83, IPasswordSecret, IPasswordSRPParams { public new const uint Signature = TLConstructors.TLPassword84; public TLString SRPB { get; set; } public TLLong SRPId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); _currentAlgo = GetObject(Flags, (int)PasswordFlags.HasPassword, null, bytes, ref position); SRPB = GetObject(Flags, (int)PasswordFlags.HasPassword, null, bytes, ref position); SRPId = GetObject(Flags, (int)PasswordFlags.HasPassword, null, bytes, ref position); _hint = GetObject(Flags, (int)PasswordFlags.Hint, null, bytes, ref position); _emailUnconfirmedPattern = GetObject(Flags, (int)PasswordFlags.EmailUnconfirmedPattern, null, bytes, ref position); NewAlgo = GetObject(bytes, ref position); NewSecureAlgo = GetObject(bytes, ref position); SecretRandom = GetObject(bytes, ref position); return this; } } public class TLNoPassword : TLPasswordBase { public const uint Signature = TLConstructors.TLNoPassword; public override bool HasPassword { get { return false; } } #region Additional public TLPasswordSettings Settings { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewSalt = GetObject(bytes, ref position); EmailUnconfirmedPattern = GetObject(bytes, ref position); return this; } } public class TLNoPassword81 : TLNoPassword { public new const uint Signature = TLConstructors.TLNoPassword81; public TLString NewSecureSalt { get; set; } public TLString SecretRandom { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); NewSalt = GetObject(bytes, ref position); NewSecureSalt = GetObject(bytes, ref position); SecretRandom = GetObject(bytes, ref position); EmailUnconfirmedPattern = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPasswordInputSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PasswordInputSettingsFlags { Password = 0x1, Email = 0x2, NewSecureSecret = 0x4, } public class TLPasswordInputSettings : TLObject { public const uint Signature = TLConstructors.TLPasswordInputSettings; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLString _newSalt; public virtual TLString NewSalt { get { return _newSalt; } set { SetField(out _newSalt, value, ref _flags, (int)PasswordInputSettingsFlags.Password); } } protected TLString _newPasswordHash; public TLString NewPasswordHash { get { return _newPasswordHash; } set { SetField(out _newPasswordHash, value, ref _flags, (int)PasswordInputSettingsFlags.Password); } } protected TLString _hint; public TLString Hint { get { return _hint; } set { SetField(out _hint, value, ref _flags, (int)PasswordInputSettingsFlags.Password); } } protected TLString _email; public TLString Email { get { return _email; } set { SetField(out _email, value, ref _flags, (int)PasswordInputSettingsFlags.Email); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); NewSalt = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); NewPasswordHash = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); Hint = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); Email = GetObject(Flags, (int)PasswordInputSettingsFlags.Email, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(NewSalt, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(NewPasswordHash, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Hint, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Email, Flags, (int)PasswordInputSettingsFlags.Email)); } } public class TLPasswordInputSettings81 : TLPasswordInputSettings { public new const uint Signature = TLConstructors.TLPasswordInputSettings81; private TLString _newSecureSalt; public virtual TLString NewSecureSalt { get { return _newSecureSalt; } set { SetField(out _newSecureSalt, value, ref _flags, (int)PasswordInputSettingsFlags.NewSecureSecret); } } private TLString _newSecureSecret; public virtual TLString NewSecureSecret { get { return _newSecureSecret; } set { SetField(out _newSecureSecret, value, ref _flags, (int)PasswordInputSettingsFlags.NewSecureSecret); } } private TLLong _newSecureSecretId; public virtual TLLong NewSecureSecretId { get { return _newSecureSecretId; } set { SetField(out _newSecureSecretId, value, ref _flags, (int)PasswordInputSettingsFlags.NewSecureSecret); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); NewSalt = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); NewPasswordHash = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); Hint = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); Email = GetObject(Flags, (int)PasswordInputSettingsFlags.Email, null, bytes, ref position); NewSecureSalt = GetObject(Flags, (int)PasswordInputSettingsFlags.NewSecureSecret, null, bytes, ref position); NewSecureSecret = GetObject(Flags, (int)PasswordInputSettingsFlags.NewSecureSecret, null, bytes, ref position); NewSecureSecretId = GetObject(Flags, (int)PasswordInputSettingsFlags.NewSecureSecret, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(NewSalt, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(NewPasswordHash, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Hint, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Email, Flags, (int)PasswordInputSettingsFlags.Email), ToBytes(NewSecureSalt, Flags, (int)PasswordInputSettingsFlags.NewSecureSecret), ToBytes(NewSecureSecret, Flags, (int)PasswordInputSettingsFlags.NewSecureSecret), ToBytes(NewSecureSecretId, Flags, (int)PasswordInputSettingsFlags.NewSecureSecret)); } } public class TLPasswordInputSettings83 : TLPasswordInputSettings81 { public new const uint Signature = TLConstructors.TLPasswordInputSettings83; private TLPasswordKdfAlgoBase _newAlgo; public TLPasswordKdfAlgoBase NewAlgo { get { return _newAlgo; } set { SetField(out _newAlgo, value, ref _flags, (int)PasswordInputSettingsFlags.Password); } } private TLSecureSecretSettings _newSecureSettings; public TLSecureSecretSettings NewSecureSettings { get { return _newSecureSettings; } set { SetField(out _newSecureSettings, value, ref _flags, (int)PasswordInputSettingsFlags.NewSecureSecret); } } #region Additional public string NewPassword { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _newAlgo = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); _newPasswordHash = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); _hint = GetObject(Flags, (int)PasswordInputSettingsFlags.Password, null, bytes, ref position); _email = GetObject(Flags, (int)PasswordInputSettingsFlags.Email, null, bytes, ref position); _newSecureSettings = GetObject(Flags, (int)PasswordInputSettingsFlags.NewSecureSecret, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(NewAlgo, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(NewPasswordHash, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Hint, Flags, (int)PasswordInputSettingsFlags.Password), ToBytes(Email, Flags, (int)PasswordInputSettingsFlags.Email), ToBytes(NewSecureSettings, Flags, (int)PasswordInputSettingsFlags.NewSecureSecret)); } } } ================================================ FILE: Telegram.Api/TL/TLPasswordRecovery.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPasswordRecovery : TLObject { public const uint Signature = TLConstructors.TLPasswordRecovery; public TLString EmailPattern { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); EmailPattern = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPasswordSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PasswordSettingsFlags { Email = 0x1, // 0 SecureSettings = 0x2, // 1 } public class TLPasswordSettings : TLObject { public const uint Signature = TLConstructors.TLPasswordSettings; public virtual TLString Email { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Email = GetObject(bytes, ref position); return this; } } public class TLPasswordSettings81 : TLPasswordSettings { public new const uint Signature = TLConstructors.TLPasswordSettings81; public TLString SecureSalt { get; set; } public TLString SecureSecret { get; set; } public TLLong SecureSecretId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Email = GetObject(bytes, ref position); SecureSalt = GetObject(bytes, ref position); SecureSecret = GetObject(bytes, ref position); SecureSecretId = GetObject(bytes, ref position); return this; } } public class TLPasswordSettings83 : TLPasswordSettings81 { public new const uint Signature = TLConstructors.TLPasswordSettings83; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLString _email; public override TLString Email { get { return _email; } set { SetField(out _email, value, ref _flags, (int)PasswordSettingsFlags.Email); } } protected TLSecureSecretSettings _secureSettings; public TLSecureSecretSettings SecureSettings { get { return _secureSettings; } set { SetField(out _secureSettings, value, ref _flags, (int)PasswordSettingsFlags.SecureSettings); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); _email = GetObject(Flags, (int)PasswordSettingsFlags.Email, null, bytes, ref position); _secureSettings = GetObject(Flags, (int)PasswordSettingsFlags.SecureSettings, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPaymentCharge.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; namespace Telegram.Api.TL { public class TLPaymentCharge : TLObject { public const uint Signature = TLConstructors.TLPaymentCharge; public TLString Id { get; set; } public TLString ProviderChargeId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); ProviderChargeId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); ProviderChargeId = GetObject(input); return this; } public override void ToStream(Stream output) { Id.ToStream(output); ProviderChargeId.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLPaymentForm.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PaymentFormFlags { SavedInfo = 0x1, // 0 SavedCredentials = 0x2, // 1 CanSaveCredentials = 0x4, // 2 PasswordMissing = 0x8, // 3 Native = 0x10, // 4 } public class TLPaymentForm : TLObject { public const uint Signature = TLConstructors.TLPaymentForm; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool CanSaveCredentials { get { return IsSet(Flags, (int) PaymentFormFlags.CanSaveCredentials); } set { SetUnset(ref _flags, value, (int) PaymentFormFlags.CanSaveCredentials); } } public bool PasswordMissing { get { return IsSet(Flags, (int) PaymentFormFlags.PasswordMissing); } set { SetUnset(ref _flags, value, (int) PaymentFormFlags.PasswordMissing); } } public TLInt BotId { get; set; } public TLInvoice Invoice { get; set; } public TLInt ProviderId { get; set; } public TLString Url { get; set; } private TLString _nativeProvider; public TLString NativeProvider { get { return _nativeProvider; } set { SetField(out _nativeProvider, value, ref _flags, (int) PaymentFormFlags.Native); } } private TLDataJSON _nativeParams; public TLDataJSON NativeParams { get { return _nativeParams; } set { SetField(out _nativeParams, value, ref _flags, (int) PaymentFormFlags.Native); } } private TLPaymentRequestedInfo _savedInfo; public TLPaymentRequestedInfo SavedInfo { get { return _savedInfo; } set { SetField(out _savedInfo, value, ref _flags, (int) PaymentFormFlags.SavedInfo); } } private TLPaymentSavedCredentials _savedCredentials; public TLPaymentSavedCredentials SavedCredentials { get { return _savedCredentials; } set { SetField(out _savedCredentials, value, ref _flags, (int) PaymentFormFlags.SavedCredentials); } } public TLVector Users { get; set; } public bool IsNativeProvider { get { if (TLString.Equals(NativeProvider, new TLString("stripe"), StringComparison.Ordinal) && NativeParams != null) { return true; } return false; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); BotId = GetObject(bytes, ref position); Invoice = GetObject(bytes, ref position); ProviderId = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); _nativeProvider = GetObject(Flags, (int) PaymentFormFlags.Native, null, bytes, ref position); _nativeParams = GetObject(Flags, (int) PaymentFormFlags.Native, null, bytes, ref position); _savedInfo = GetObject(Flags, (int) PaymentFormFlags.SavedInfo, null, bytes, ref position); _savedCredentials = GetObject(Flags, (int) PaymentFormFlags.SavedCredentials, null, bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPaymentReceipt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PaymentReceiptFlags { Info = 0x1, // 0 Shipping = 0x2, // 1 } public class TLPaymentReceipt : TLObject { public const uint Signature = TLConstructors.TLPaymentReceipt; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Date { get; set; } public TLInt BotId { get; set; } public TLInvoice Invoice { get; set; } public TLInt ProviderId { get; set; } private TLPaymentRequestedInfo _info; public TLPaymentRequestedInfo SavedInfo { get { return _info; } set { SetField(out _info, value, ref _flags, (int) PaymentReceiptFlags.Info); } } private TLShippingOption _shipping; public TLShippingOption Shipping { get { return _shipping; } set { SetField(out _shipping, value, ref _flags, (int) PaymentReceiptFlags.Shipping); } } public TLString Currency { get; set; } public TLLong TotalAmount { get; set; } public TLString CredentialsTitle { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); BotId = GetObject(bytes, ref position); Invoice = GetObject(bytes, ref position); ProviderId = GetObject(bytes, ref position); _info = GetObject(Flags, (int) PaymentReceiptFlags.Info, null, bytes, ref position); _shipping = GetObject(Flags, (int) PaymentReceiptFlags.Shipping, null, bytes, ref position); Currency = GetObject(bytes, ref position); TotalAmount = GetObject(bytes, ref position); CredentialsTitle = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPaymentRequestedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PaymentRequestedInfoFlags { Name = 0x1, // 0 Phone = 0x2, // 1 Email = 0x4, // 2 ShippingAddress = 0x8, // 3 } public class TLPaymentRequestedInfo : TLObject { public const uint Signature = TLConstructors.TLPaymentRequestedInfo; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLString _name; public TLString Name { get { return _name; } set { SetField(out _name, value, ref _flags, (int)PaymentRequestedInfoFlags.Name); } } protected TLString _phone; public TLString Phone { get { return _phone; } set { SetField(out _phone, value, ref _flags, (int)PaymentRequestedInfoFlags.Phone); } } protected TLString _email; public TLString Email { get { return _email; } set { SetField(out _email, value, ref _flags, (int)PaymentRequestedInfoFlags.Email); } } protected TLPostAddress _shippingAddress; public TLPostAddress ShippingAddress { get { return _shippingAddress; } set { SetField(out _shippingAddress, value, ref _flags, (int)PaymentRequestedInfoFlags.ShippingAddress); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _name = GetObject(Flags, (int)PaymentRequestedInfoFlags.Name, null, bytes, ref position); _phone = GetObject(Flags, (int)PaymentRequestedInfoFlags.Phone, null, bytes, ref position); _email = GetObject(Flags, (int)PaymentRequestedInfoFlags.Email, null, bytes, ref position); _shippingAddress = GetObject(Flags, (int)PaymentRequestedInfoFlags.ShippingAddress, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(Name, Flags, (int)PaymentRequestedInfoFlags.Name), ToBytes(Phone, Flags, (int)PaymentRequestedInfoFlags.Phone), ToBytes(Email, Flags, (int)PaymentRequestedInfoFlags.Email), ToBytes(ShippingAddress, Flags, (int)PaymentRequestedInfoFlags.ShippingAddress)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); _name = GetObject(Flags, (int)PaymentRequestedInfoFlags.Name, null, input); _phone = GetObject(Flags, (int)PaymentRequestedInfoFlags.Phone, null, input); _email = GetObject(Flags, (int)PaymentRequestedInfoFlags.Email, null, input); _shippingAddress = GetObject(Flags, (int)PaymentRequestedInfoFlags.ShippingAddress, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, _name, Flags, (int)PaymentRequestedInfoFlags.Name); ToStream(output, _phone, Flags, (int)PaymentRequestedInfoFlags.Phone); ToStream(output, _email, Flags, (int)PaymentRequestedInfoFlags.Email); ToStream(output, _shippingAddress, Flags, (int)PaymentRequestedInfoFlags.ShippingAddress); } } } ================================================ FILE: Telegram.Api/TL/TLPaymentResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLPaymentResultBase : TLObject { } public class TLPaymentResult : TLPaymentResultBase { public const uint Signature = TLConstructors.TLPaymentResult; public TLUpdatesBase Updates { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Updates = GetObject(bytes, ref position); return this; } } public class TLPaymentVerificationNeeded : TLPaymentResultBase { public const uint Signature = TLConstructors.TLPaymentVerificationNeeded; public TLString Url { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPaymentSavedCredentialsCard.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPaymentSavedCredentials : TLObject { } public class TLPaymentSavedCredentialsCard : TLPaymentSavedCredentials { public const uint Signature = TLConstructors.TLPaymentSavedCredentialsCard; public TLString Id { get; set; } public TLString Title { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Title.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Title = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Title.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPeerBase : TLObject { public TLInt Id { get; set; } } public class TLPeerUser : TLPeerBase { public const uint Signature = TLConstructors.TLPeerUser; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "UserId=" + Id; } } public class TLPeerChat : TLPeerBase { public const uint Signature = TLConstructors.TLPeerChat; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "ChatId=" + Id; } } public class TLPeerEncryptedChat : TLPeerBase { public const uint Signature = TLConstructors.TLPeerEncryptedChat; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "EncryptedChatId=" + Id; } } public class TLPeerBroadcast : TLPeerBase { public const uint Signature = TLConstructors.TLPeerBroadcastChat; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "BroadcastChatId=" + Id; } } public class TLPeerChannel : TLPeerBase { public const uint Signature = TLConstructors.TLPeerChannel; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "ChannelId=" + Id; } } public class TLPeerFeed : TLPeerBase { public const uint Signature = TLConstructors.TLPeerFeed; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override string ToString() { return "FeedId=" + Id; } } } ================================================ FILE: Telegram.Api/TL/TLPeerDialogs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPeerDialogs : TLObject { public const uint Signature = TLConstructors.TLPeerDialogs; public TLVector Dialogs { get; set; } public TLVector Messages { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public TLState State { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Dialogs = GetObject>(bytes, ref position); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); State = GetObject(bytes, ref position); return this; } public TLDialogsBase ToDialogs() { return new TLDialogs { Dialogs = Dialogs, Messages = Messages, Chats = Chats, Users = Users }; } } } ================================================ FILE: Telegram.Api/TL/TLPeerNotifyEvents.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Runtime.Serialization; namespace Telegram.Api.TL { [KnownType(typeof(TLPeerNotifyEventsEmpty))] [KnownType(typeof(TLPeerNotifyEventsAll))] [DataContract] public abstract class TLPeerNotifyEventsBase : TLObject { } [Obsolete] [DataContract] public class TLPeerNotifyEventsEmpty : TLPeerNotifyEventsBase { public const uint Signature = TLConstructors.TLPeerNotifyEventsEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } [Obsolete] [DataContract] public class TLPeerNotifyEventsAll : TLPeerNotifyEventsBase { public const uint Signature = TLConstructors.TLPeerNotifyEventsAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPeerNotifySettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PeerNotifySettingsFlags { ShowPreviews = 0x1, // 0 Silent = 0x2, // 1 MuteUntil = 0x4, // 2 Sound = 0x8, // 3 } public abstract class TLPeerNotifySettingsBase : TLObject { #region Additional public DateTime? LastNotificationTime { get; set; } #endregion } public class TLPeerNotifySettings78 : TLPeerNotifySettings48 { public new const uint Signature = TLConstructors.TLPeerNotifySettings78; protected TLBool _showPreviews; public override TLBool ShowPreviews { get { return _showPreviews; } set { SetField(out _showPreviews, value, ref _flags, (int)PeerNotifySettingsFlags.ShowPreviews); } } protected TLBool _silent; public override TLBool Silent { get { return _silent; } set { SetField(out _silent, value, ref _flags, (int)PeerNotifySettingsFlags.Silent); } } protected TLInt _muteUntil; public override TLInt MuteUntil { get { return _muteUntil; } set { SetField(out _muteUntil, value, ref _flags, (int)PeerNotifySettingsFlags.MuteUntil); } } protected TLString _sound; public override TLString Sound { get { return _sound; } set { SetField(out _sound, value, ref _flags, (int)PeerNotifySettingsFlags.Sound); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); ShowPreviews = GetObject(Flags, (int)PeerNotifySettingsFlags.ShowPreviews, null, bytes, ref position); Silent = GetObject(Flags, (int)PeerNotifySettingsFlags.Silent, null, bytes, ref position); MuteUntil = GetObject(Flags, (int)PeerNotifySettingsFlags.MuteUntil, null, bytes, ref position); Sound = GetObject(Flags, (int)PeerNotifySettingsFlags.Sound, null, bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ShowPreviews = GetObject(Flags, (int)PeerNotifySettingsFlags.ShowPreviews, null, input); Silent = GetObject(Flags, (int)PeerNotifySettingsFlags.Silent, null, input); MuteUntil = GetObject(Flags, (int)PeerNotifySettingsFlags.MuteUntil, null, input); Sound = GetObject(Flags, (int)PeerNotifySettingsFlags.Sound, null, input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); ToStream(output, ShowPreviews, Flags, (int)PeerNotifySettingsFlags.ShowPreviews); ToStream(output, Silent, Flags, (int)PeerNotifySettingsFlags.Silent); ToStream(output, MuteUntil, Flags, (int)PeerNotifySettingsFlags.MuteUntil); ToStream(output, Sound, Flags, (int)PeerNotifySettingsFlags.Sound); } } public class TLPeerNotifySettings48 : TLPeerNotifySettings { public new const uint Signature = TLConstructors.TLPeerNotifySettings48; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool ShowPreviews { get { return new TLBool(IsSet(Flags, (int)PeerNotifySettingsFlags.ShowPreviews)); } set { SetUnset(ref _flags, value != null && value.Value, (int)PeerNotifySettingsFlags.ShowPreviews); } } public virtual TLBool Silent { get { return new TLBool(IsSet(Flags, (int)PeerNotifySettingsFlags.Silent)); } set { SetUnset(ref _flags, value != null && value.Value, (int)PeerNotifySettingsFlags.Silent); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); MuteUntil = GetObject(bytes, ref position); Sound = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); MuteUntil = GetObject(input); Sound = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(MuteUntil.ToBytes()); output.Write(Sound.ToBytes()); } } public class TLPeerNotifySettings : TLPeerNotifySettingsBase { public const uint Signature = TLConstructors.TLPeerNotifySettings; public virtual TLInt MuteUntil { get; set; } public virtual TLString Sound { get; set; } public virtual TLBool ShowPreviews { get; set; } public TLInt EventsMask { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MuteUntil = GetObject(bytes, ref position); Sound = GetObject(bytes, ref position); ShowPreviews = GetObject(bytes, ref position); EventsMask = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { MuteUntil = GetObject(input); Sound = GetObject(input); ShowPreviews = GetObject(input); EventsMask = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(MuteUntil.ToBytes()); output.Write(Sound.ToBytes()); output.Write(ShowPreviews.ToBytes()); output.Write(EventsMask.ToBytes()); } } [Obsolete] public class TLPeerNotifySettingsEmpty : TLPeerNotifySettingsBase { public const uint Signature = TLConstructors.TLPeerNotifySettingsEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLPeerSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum PeerSettingsFlags { ReportSpam = 0x1, } public class TLPeerSettings : TLObject { public const uint Signature = TLConstructors.TLPeerSettings; public TLInt Flags { get; set; } public bool ReportSpam { get { return IsSet(Flags, (int)PeerSettingsFlags.ReportSpam); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhoneCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Org.BouncyCastle.Security; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PhoneCallWaitingFlags { ReceiveDate = 0x1, // 0 } [Flags] public enum PhoneCallDiscardedFlags { Reason = 0x1, // 0 Duration = 0x2, // 1 NeedDebug = 0x4, // 2 NeedRating = 0x8, // 3 } public abstract class TLPhoneCallBase : TLObject { public TLLong Id { get; set; } } public interface IInputPhoneCall { TLLong Id { get; } TLLong AccessHash { get; } TLInputPhoneCall ToInputPhoneCall(); } public class TLPhoneCallEmpty : TLPhoneCallBase { public const uint Signature = TLConstructors.TLPhoneCallEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override string ToString() { return string.Format("TLPhoneCallEmpty id={0}", Id); } } public class TLPhoneCallWaiting : TLPhoneCallBase, IInputPhoneCall { public const uint Signature = TLConstructors.TLPhoneCallWaiting; public TLInt Flags { get; set; } public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLInt AdminId { get; set; } public TLInt ParticipantId { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public TLInt ReceiveDate { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); Protocol = GetObject(bytes, ref position); ReceiveDate = GetObject(Flags, (int) PhoneCallWaitingFlags.ReceiveDate, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), AdminId.ToBytes(), ParticipantId.ToBytes(), Protocol.ToBytes(), ToBytes(ReceiveDate, Flags, (int) PhoneCallWaitingFlags.ReceiveDate)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); AdminId.ToStream(output); ParticipantId.ToStream(output); Protocol.ToStream(output); ToStream(output, ReceiveDate, Flags, (int) PhoneCallWaitingFlags.ReceiveDate); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); Protocol = GetObject(input); ReceiveDate = GetObject(Flags, (int) PhoneCallWaitingFlags.ReceiveDate, null, input); return this; } public override string ToString() { return string.Format("TLPhoneCallWaiting flags={0} id={1} access_hash={2} date={3} admin_id={4} participant_id={5} protocol={6} receive_date={7}", Flags, Id, AccessHash, Date, AdminId, ParticipantId, Protocol, ReceiveDate); } public TLInputPhoneCall ToInputPhoneCall() { return new TLInputPhoneCall { Id = Id, AccessHash = AccessHash }; } } public class TLPhoneCallRequestedBase : TLPhoneCallBase, IInputPhoneCall { public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLInt AdminId { get; set; } public TLInt ParticipantId { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public TLInputPhoneCall ToInputPhoneCall() { return new TLInputPhoneCall { Id = Id, AccessHash = AccessHash }; } } public class TLPhoneCallRequested64 : TLPhoneCallRequestedBase { public const uint Signature = TLConstructors.TLPhoneCallRequested64; public TLString GAHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); GAHash = GetObject(bytes, ref position); Protocol = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), AdminId.ToBytes(), ParticipantId.ToBytes(), GAHash.ToBytes(), Protocol.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); AdminId.ToStream(output); ParticipantId.ToStream(output); GAHash.ToStream(output); Protocol.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GAHash = GetObject(input); Protocol = GetObject(input); return this; } public override string ToString() { return string.Format("TLPhoneCallRequested id={0} access_hash={1} date={2} admin_id={3} participant_id={4} protocol={5}", Id, AccessHash, Date, AdminId, ParticipantId, Protocol); } } public class TLPhoneCallRequested : TLPhoneCallRequestedBase { public const uint Signature = TLConstructors.TLPhoneCallRequested; public TLString GA { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); GA = GetObject(bytes, ref position); Protocol = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), AdminId.ToBytes(), ParticipantId.ToBytes(), GA.ToBytes(), Protocol.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); AdminId.ToStream(output); ParticipantId.ToStream(output); GA.ToStream(output); Protocol.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GA = GetObject(input); Protocol = GetObject(input); return this; } } public class TLPhoneCall : TLPhoneCallBase, IInputPhoneCall { public const uint Signature = TLConstructors.TLPhoneCall; public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLInt AdminId { get; set; } public TLInt ParticipantId { get; set; } public TLString GAorB { get; set; } public TLLong KeyFingerprint { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public TLPhoneConnection Connection { get; set; } public TLVector AlternativeConnections { get; set; } public TLInt StartDate { get; set; } public override string ToString() { return string.Format("TLPhoneCall id={0} access_hash={1} date={2} admin_id={3} participant_id={4} protocol={5} start_date={6}", Id, AccessHash, Date, AdminId, ParticipantId, Protocol, StartDate); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); GAorB = GetObject(bytes, ref position); KeyFingerprint = GetObject(bytes, ref position); Protocol = GetObject(bytes, ref position); Connection = GetObject(bytes, ref position); AlternativeConnections = GetObject>(bytes, ref position); StartDate = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), AdminId.ToBytes(), ParticipantId.ToBytes(), GAorB.ToBytes(), KeyFingerprint.ToBytes(), Protocol.ToBytes(), Connection.ToBytes(), AlternativeConnections.ToBytes(), StartDate.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); AdminId.ToStream(output); ParticipantId.ToStream(output); GAorB.ToStream(output); KeyFingerprint.ToStream(output); Protocol.ToStream(output); Connection.ToStream(output); AlternativeConnections.ToStream(output); StartDate.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GAorB = GetObject(input); KeyFingerprint = GetObject(input); Protocol = GetObject(input); Connection = GetObject(input); AlternativeConnections = GetObject>(input); StartDate = GetObject(input); return this; } public TLInputPhoneCall ToInputPhoneCall() { return new TLInputPhoneCall { Id = Id, AccessHash = AccessHash }; } } public class TLPhoneCallDiscarded : TLPhoneCallBase { public const uint Signature = TLConstructors.TLPhoneCallDiscarded; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } } public class TLPhoneCallDiscarded61 : TLPhoneCallDiscarded { public new const uint Signature = TLConstructors.TLPhoneCallDiscarded61; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLPhoneCallDiscardReasonBase Reason { get; set; } public TLInt Duration { get; set; } public bool NeedDebug { get { return IsSet(Flags, (int) PhoneCallDiscardedFlags.NeedDebug); } set { SetUnset(ref _flags, value, (int) PhoneCallDiscardedFlags.NeedDebug); } } public bool NeedRating { get { return IsSet(Flags, (int) PhoneCallDiscardedFlags.NeedRating); } set { SetUnset(ref _flags, value, (int) PhoneCallDiscardedFlags.NeedRating); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Reason = GetObject(Flags, (int) PhoneCallDiscardedFlags.Reason, null, bytes, ref position); Duration = GetObject(Flags, (int) PhoneCallDiscardedFlags.Duration, null, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(Reason, Flags, (int) PhoneCallDiscardedFlags.Reason), ToBytes(Duration, Flags, (int) PhoneCallDiscardedFlags.Duration)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, Reason, Flags, (int) PhoneCallDiscardedFlags.Reason); ToStream(output, Duration, Flags, (int) PhoneCallDiscardedFlags.Duration); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Reason = GetObject(Flags, (int) PhoneCallDiscardedFlags.Reason, null, input); Duration = GetObject(Flags, (int) PhoneCallDiscardedFlags.Duration, null, input); return this; } public override string ToString() { return string.Format("TLPhoneCallDiscarded id={0} reason={1} duration={2}", Id, Reason, Duration); } } public class TLPhoneCallAccepted : TLPhoneCallBase, IInputPhoneCall { public const uint Signature = TLConstructors.TLPhoneCallAccepted; public TLLong AccessHash { get; set; } public TLInt Date { get; set; } public TLInt AdminId { get; set; } public TLInt ParticipantId { get; set; } public TLPhoneCallProtocol Protocol { get; set; } public TLString GB { get; set; } public override string ToString() { return string.Format("TLPhoneAccepted id={0} access_hash={1} date={2} admin_id={3} participant_id={4} protocol={5}", Id, AccessHash, Date, AdminId, ParticipantId, Protocol); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); AdminId = GetObject(bytes, ref position); ParticipantId = GetObject(bytes, ref position); GB = GetObject(bytes, ref position); Protocol = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Date.ToBytes(), AdminId.ToBytes(), ParticipantId.ToBytes(), GB.ToBytes(), Protocol.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Date.ToStream(output); AdminId.ToStream(output); ParticipantId.ToStream(output); GB.ToStream(output); Protocol.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); AdminId = GetObject(input); ParticipantId = GetObject(input); GB = GetObject(input); Protocol = GetObject(input); return this; } public TLInputPhoneCall ToInputPhoneCall() { return new TLInputPhoneCall { Id = Id, AccessHash = AccessHash }; } } } ================================================ FILE: Telegram.Api/TL/TLPhoneCallDiscardReason.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPhoneCallDiscardReasonBase : TLObject { } public class TLPhoneCallDiscardReasonMissed : TLPhoneCallDiscardReasonBase { public const uint Signature = TLConstructors.TLPhoneCallDiscardReasonMissed; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPhoneCallDiscardReasonDisconnect : TLPhoneCallDiscardReasonBase { public const uint Signature = TLConstructors.TLPhoneCallDiscardReasonDisconnect; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPhoneCallDiscardReasonHangup : TLPhoneCallDiscardReasonBase { public const uint Signature = TLConstructors.TLPhoneCallDiscardReasonHangup; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPhoneCallDiscardReasonBusy : TLPhoneCallDiscardReasonBase { public const uint Signature = TLConstructors.TLPhoneCallDiscardReasonBusy; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhoneCallProtocol.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PhoneCallProtocolFlags { UdpP2P = 0x1, // 0 UdpReflector = 0x2, // 1 } public class TLPhoneCallProtocol : TLPhoneCallBase { public const uint Signature = TLConstructors.TLPhoneCallProtocol; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool UdpP2P { get { return IsSet(Flags, (int) PhoneCallProtocolFlags.UdpP2P); } set { SetUnset(ref _flags, value, (int) PhoneCallProtocolFlags.UdpP2P); } } public bool UdpReflector { get { return IsSet(Flags, (int) PhoneCallProtocolFlags.UdpReflector); } set { SetUnset(ref _flags, value, (int) PhoneCallProtocolFlags.UdpReflector); } } public TLInt MinLayer { get; set; } public TLInt MaxLayer { get; set; } public override string ToString() { return string.Format("TLPhoneCallProtocol min_layer={0} max_layer={1}", MinLayer, MaxLayer); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); MinLayer = GetObject(bytes, ref position); MaxLayer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), MinLayer.ToBytes(), MaxLayer.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); MinLayer.ToStream(output); MaxLayer.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); MinLayer = GetObject(input); MaxLayer = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhoneConnection.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLPhoneConnection : TLObject { public const uint Signature = TLConstructors.TLPhoneConnection; public TLString Ip { get; set; } public TLString IpV6 { get; set; } public TLInt Port { get; set; } public TLString PeerTag { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Ip = GetObject(bytes, ref position); IpV6 = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); PeerTag = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Ip.ToBytes(), IpV6.ToBytes(), Port.ToBytes(), PeerTag.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Ip.ToStream(output); IpV6.ToStream(output); Port.ToStream(output); PeerTag.ToStream(output); } public override TLObject FromStream(Stream input) { Ip = GetObject(input); IpV6 = GetObject(input); Port = GetObject(input); PeerTag = GetObject(input); return this; } } public class TLPhoneConnection61 : TLPhoneConnection { public new const uint Signature = TLConstructors.TLPhoneConnection61; public TLLong Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Ip = GetObject(bytes, ref position); IpV6 = GetObject(bytes, ref position); Port = GetObject(bytes, ref position); PeerTag = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Ip.ToBytes(), IpV6.ToBytes(), Port.ToBytes(), PeerTag.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Ip.ToStream(output); IpV6.ToStream(output); Port.ToStream(output); PeerTag.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Ip = GetObject(input); IpV6 = GetObject(input); Port = GetObject(input); PeerTag = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhonePhoneCall.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLPhonePhoneCall : TLObject { public const uint Signature = TLConstructors.TLPhonePhoneCall; public TLPhoneCallBase PhoneCall { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneCall = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneCall.ToBytes(), Users.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneCall.ToStream(output); Users.ToStream(output); } public override TLObject FromStream(Stream input) { PhoneCall = GetObject(input); Users = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PhotoFlags { HasStickers = 0x1 } public abstract class TLPhotoBase : TLObject { public abstract void Update(TLPhotoBase photo); public TLPhotoBase Self{ get { return this; } } } public abstract class TLPhotoCommon : TLPhotoBase { public TLFileLocationBase PhotoSmall { get; set; } public TLFileLocationBase PhotoBig { get; set; } public override void Update(TLPhotoBase photo) { var photoCommon = photo as TLPhotoCommon; if (photoCommon != null) { if (PhotoSmall != null) { PhotoSmall.Update(photoCommon.PhotoSmall); } else { PhotoSmall = photoCommon.PhotoSmall; } if (PhotoBig != null) { PhotoBig.Update(photoCommon.PhotoBig); } else { PhotoBig = photoCommon.PhotoBig; } } } } public abstract class TLMediaPhotoBase : TLPhotoBase { public TLLong Id { get; set; } public override void Update(TLPhotoBase photo) { var mediaPhoto = photo as TLMediaPhotoBase; if (mediaPhoto != null) { Id = mediaPhoto.Id; } } } public class TLPhotoEmpty : TLMediaPhotoBase { public const uint Signature = TLConstructors.TLPhotoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } } public class TLPhoto56 : TLPhoto33 { public new const uint Signature = TLConstructors.TLPhoto56; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool HasStickers { get { return IsSet(Flags, (int) PhotoFlags.HasStickers); } set { SetUnset(ref _flags, value, (int) PhotoFlags.HasStickers); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Sizes = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); Sizes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); Sizes.ToStream(output); } } public class TLPhoto33 : TLPhoto28 { public new const uint Signature = TLConstructors.TLPhoto33; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Sizes = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Date = GetObject(input); Sizes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Date.ToBytes()); Sizes.ToStream(output); } } public class TLPhoto28 : TLPhoto { public new const uint Signature = TLConstructors.TLPhoto28; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Geo = GetObject(bytes, ref position); Sizes = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); Geo = GetObject(input); Sizes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(UserId.ToBytes()); output.Write(Date.ToBytes()); Geo.ToStream(output); Sizes.ToStream(output); } public override void Update(TLPhotoBase photo) { var p = photo as TLPhoto28; if (p != null) { base.Update(p); AccessHash = p.AccessHash; UserId = p.UserId; Date = p.Date; Caption = p.Caption; Geo = p.Geo; if (AccessHash.Value != p.AccessHash.Value) { Sizes = p.Sizes; } else { for (var i = 0; i < Sizes.Count; i++) { Sizes[i].Update(p.Sizes[i]); } } } } } public class TLPhoto : TLMediaPhotoBase { public const uint Signature = TLConstructors.TLPhoto; public TLLong AccessHash { get; set; } public TLInt UserId { get; set; } public TLInt Date { get; set; } public TLString Caption { get; set; } public TLGeoPointBase Geo { get; set; } public TLVector Sizes { get; set; } public string GetFileName() { var photoSize = Sizes.FirstOrDefault() as TLPhotoSize; if (photoSize != null) { var fileLocation = photoSize.Location; if (fileLocation == null) return null; var fileName = String.Format("{0}_{1}_{2}.jpg", fileLocation.VolumeId, fileLocation.LocalId, fileLocation.Secret); return fileName; } return null; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); Geo = GetObject(bytes, ref position); Sizes = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); Caption = GetObject(input); Geo = GetObject(input); Sizes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(UserId.ToBytes()); output.Write(Date.ToBytes()); output.Write(Caption.ToBytes()); Geo.ToStream(output); Sizes.ToStream(output); } public override void Update(TLPhotoBase photo) { var p = photo as TLPhoto; if (p != null) { base.Update(p); AccessHash = p.AccessHash; UserId = p.UserId; Date = p.Date; Caption = p.Caption; Geo = p.Geo; if (AccessHash.Value != p.AccessHash.Value) { Sizes = p.Sizes; } else { for (var i = 0; i < Sizes.Count; i++) { Sizes[i].Update(p.Sizes[i]); } } } } public TLPhotoCachedSize CachedSize { get { return Sizes != null ? (TLPhotoCachedSize)Sizes.FirstOrDefault(x => x is TLPhotoCachedSize) : null; } } public override string ToString() { return string.Format("TLPhoto Sizes=[{0}]", string.Join(", ", Sizes.Select(x => x.ToString()))); } } public class TLUserProfilePhotoEmpty : TLPhotoBase { public const uint Signature = TLConstructors.TLUserProfilePhotoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLPhotoBase photo) { } } public class TLUserProfilePhoto : TLPhotoCommon { public const uint Signature = TLConstructors.TLUserProfilePhoto; public TLLong PhotoId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhotoId = GetObject(bytes, ref position); PhotoSmall = GetObject(bytes, ref position); PhotoBig = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PhotoId = GetObject(input); PhotoSmall = GetObject(input); PhotoBig = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(PhotoId != null ? PhotoId.ToBytes() : new TLLong(0).ToBytes()); PhotoSmall.ToStream(output); PhotoBig.ToStream(output); } } public class TLChatPhotoEmpty : TLPhotoBase { public const uint Signature = TLConstructors.TLChatPhotoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override void Update(TLPhotoBase photo) { } } public class TLChatPhoto : TLPhotoCommon { public const uint Signature = TLConstructors.TLChatPhoto; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhotoSmall = GetObject(bytes, ref position); PhotoBig = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { PhotoSmall = GetObject(input); PhotoBig = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhotoSmall.ToStream(output); PhotoBig.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLPhotoPickerSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum PhotoPickerSettingsFlags { External = 0x1, // 0 } public class TLPhotoPickerSettings : TLObject { public const uint Signature = TLConstructors.TLPhotoPickerSettings; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool External { get { return IsSet(Flags, (int)PhotoPickerSettingsFlags.External); } set { SetUnset(ref _flags, value, (int)PhotoPickerSettingsFlags.External); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhotoSize.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public interface IPhotoSize { TLInt W { get; set; } TLInt H { get; set; } } [KnownType(typeof(TLPhotoSizeEmpty))] [KnownType(typeof(TLPhotoSize))] [KnownType(typeof(TLPhotoCachedSize))] [DataContract] public abstract class TLPhotoSizeBase : TLObject { [DataMember] public TLString Type { get; set; } public string TempUrl { get; set; } public virtual void Update(TLPhotoSizeBase photoSizeBase) { if (photoSizeBase != null) { Type = photoSizeBase.Type; } } } [DataContract] public class TLPhotoSizeEmpty : TLPhotoSizeBase { public const uint Signature = TLConstructors.TLPhotoSizeEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Type.ToBytes()); } public override TLObject FromStream(Stream input) { Type = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Type.ToBytes()); } public override string ToString() { return string.Format("empty {0}", Type); } } [DataContract] public class TLPhotoSize : TLPhotoSizeBase, IPhotoSize { public const uint Signature = TLConstructors.TLPhotoSize; [DataMember] public TLFileLocationBase Location { get; set; } [DataMember] public TLInt W { get; set; } [DataMember] public TLInt H { get; set; } [DataMember] public TLInt Size { get; set; } public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); Location = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Type.ToBytes(), Location.ToBytes(), W.ToBytes(), H.ToBytes(), Size.ToBytes()); } public override TLObject FromStream(Stream input) { Type = GetObject(input); Location = GetObject(input); W = GetObject(input); H = GetObject(input); Size = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Type.ToBytes()); Location.ToStream(output); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Size.ToBytes()); } public override void Update(TLPhotoSizeBase photoSizeBase) { base.Update(photoSizeBase); var photoSize = photoSizeBase as TLPhotoSize; if (photoSize != null) { W = photoSize.W; H = photoSize.H; Size = photoSize.Size; if (Location != null) { Location.Update(photoSize.Location); } else { Location = photoSize.Location; } } } public override string ToString() { return string.Format("{0}{1}x{2} {3}", Type, W, H, Size); } } [DataContract] public class TLPhotoCachedSize : TLPhotoSizeBase, IPhotoSize { public const uint Signature = TLConstructors.TLPhotoCachedSize; [DataMember] public TLFileLocationBase Location { get; set; } [DataMember] public TLInt W { get; set; } [DataMember] public TLInt H { get; set; } [DataMember] public TLString Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); Location = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Type.ToBytes(), Location.ToBytes(), W.ToBytes(), H.ToBytes(), Bytes.ToBytes()); } public override TLObject FromStream(Stream input) { Type = GetObject(input); Location = GetObject(input); W = GetObject(input); H = GetObject(input); Bytes = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Type.ToBytes()); Location.ToStream(output); output.Write(W.ToBytes()); output.Write(H.ToBytes()); output.Write(Bytes.ToBytes()); } public override void Update(TLPhotoSizeBase photoSizeBase) { base.Update(photoSizeBase); var photoSize = photoSizeBase as TLPhotoCachedSize; if (photoSize != null) { W = photoSize.W; H = photoSize.H; Bytes = photoSize.Bytes; if (Location != null) { Location.Update(photoSize.Location); } else { Location = photoSize.Location; } } } public override string ToString() { return string.Format("cached {0}{1}x{2}", Type, H, W); } } } ================================================ FILE: Telegram.Api/TL/TLPhotos.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLPhotosBase : TLObject { public TLVector Photos { get; set; } public TLVector Users { get; set; } } public class TLPhotos : TLPhotosBase { public const uint Signature = TLConstructors.TLPhotos; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Photos = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } public class TLPhotosSlice : TLPhotosBase { public const uint Signature = TLConstructors.TLPhotosSlice; public TLInt Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Count = GetObject(bytes, ref position); Photos = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPhotosPhoto.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPhotosPhoto : TLObject { public const uint Signature = TLConstructors.TLPhotosPhoto; public TLPhotoBase Photo { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Photo = GetObject(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPong.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPing : TLObject { public const uint Signature = TLConstructors.TLPing; public TLLong PingId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PingId.ToBytes()); } } public class TLPingDelayDisconnect : TLObject { public const uint Signature = TLConstructors.TLPingDelayDisconnect; public TLLong PingId { get; set; } public TLInt DisconnectDelay { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PingId.ToBytes(), DisconnectDelay.ToBytes()); } } public class TLPong : TLObject { public const uint Signature = TLConstructors.TLPong; public TLLong MessageId { get; set; } public TLLong PingId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MessageId = GetObject(bytes, ref position); PingId = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPopularContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPopularContact : TLObject { public const uint Signature = TLConstructors.TLPopularContact; public TLLong ClientId { get; set; } public TLInt Importers { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ClientId = GetObject(bytes, ref position); Importers = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLPostAddress.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.IO; namespace Telegram.Api.TL { public class TLPostAddress : TLObject { public const uint Signature = TLConstructors.TLPostAddress; public TLString StreetLine1 { get; set; } public TLString StreetLine2 { get; set; } public TLString City { get; set; } public TLString State { get; set; } public TLString CountryIso2 { get; set; } public TLString PostCode { get; set; } public override string ToString() { var list = new List(); if (!TLString.IsNullOrEmpty(StreetLine1)) list.Add(StreetLine1); if (!TLString.IsNullOrEmpty(StreetLine2)) list.Add(StreetLine2); if (!TLString.IsNullOrEmpty(City)) list.Add(City); if (!TLString.IsNullOrEmpty(State)) list.Add(State); if (!TLString.IsNullOrEmpty(CountryIso2)) list.Add(CountryIso2); if (!TLString.IsNullOrEmpty(PostCode)) list.Add(PostCode); return string.Join(", ", list); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); StreetLine1 = GetObject(bytes, ref position); StreetLine2 = GetObject(bytes, ref position); City = GetObject(bytes, ref position); State = GetObject(bytes, ref position); CountryIso2 = GetObject(bytes, ref position); PostCode = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), StreetLine1.ToBytes(), StreetLine2.ToBytes(), City.ToBytes(), State.ToBytes(), CountryIso2.ToBytes(), PostCode.ToBytes()); } public override TLObject FromStream(Stream input) { StreetLine1 = GetObject(input); StreetLine2 = GetObject(input); City = GetObject(input); State = GetObject(input); CountryIso2 = GetObject(input); PostCode = GetObject(input); return this; } public override void ToStream(Stream output) { StreetLine1.ToStream(output); StreetLine2.ToStream(output); City.ToStream(output); State.ToStream(output); CountryIso2.ToStream(output); PostCode.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLPrivacyKey.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPrivacyKeyBase : TLObject { } public class TLPrivacyKeyStatusTimestamp : TLPrivacyKeyBase { public const uint Signature = TLConstructors.TLPrivacyKeyStatusTimestamp; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPrivacyKeyChatInvite : TLPrivacyKeyBase { public const uint Signature = TLConstructors.TLPrivacyKeyChatInvite; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLPrivacyKeyPhoneCall : TLPrivacyKeyBase { public const uint Signature = TLConstructors.TLPrivacyKeyPhoneCall; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLPrivacyRule.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPrivacyRuleBase : TLObject { public string Label { get; set; } public bool IsChecked { get; set; } public override string ToString() { return Label; } public abstract TLInputPrivacyRuleBase ToInputRule(); } public class TLPrivacyValueAllowContacts : TLPrivacyRuleBase { public const uint Signature = TLConstructors.TLPrivacyValueAllowContacts; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueAllowContacts(); } } public class TLPrivacyValueAllowAll : TLPrivacyRuleBase { public const uint Signature = TLConstructors.TLPrivacyValueAllowAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueAllowAll(); } } public class TLPrivacyValueAllowUsers : TLPrivacyRuleBase, IPrivacyValueUsersRule { public const uint Signature = TLConstructors.TLPrivacyValueAllowUsers; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Users = GetObject>(input); return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueAllowUsers{Users = new TLVector()}; } } public class TLPrivacyValueDisallowContacts : TLPrivacyRuleBase { public const uint Signature = TLConstructors.TLPrivacyValueDisallowContacts; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueDisallowContacts(); } } public class TLPrivacyValueDisallowAll : TLPrivacyRuleBase { public const uint Signature = TLConstructors.TLPrivacyValueDisallowAll; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueDisallowAll(); } } public class TLPrivacyValueDisallowUsers : TLPrivacyRuleBase, IPrivacyValueUsersRule { public const uint Signature = TLConstructors.TLPrivacyValueDisallowUsers; public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Users = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Users.ToStream(output); } public override TLObject FromStream(Stream input) { Users = GetObject>(input); return this; } public override TLInputPrivacyRuleBase ToInputRule() { return new TLInputPrivacyValueDisallowUsers{Users = new TLVector()}; } } public interface IPrivacyValueUsersRule { TLVector Users { get; set; } } } ================================================ FILE: Telegram.Api/TL/TLPrivacyRules.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLPrivacyRules : TLObject { public const uint Signature = TLConstructors.TLPrivacyRules; public TLVector Rules { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Rules = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLProxyConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ProxyConfigCustomFlags { IsEnabled = 0x1, UseForCalls = 0x2 } [Flags] public enum ProxyCustomFlags { Ping = 0x1, CheckTime = 0x2 } public enum ProxyStatus { Available, Unavailable, Connecting } public abstract class TLProxyConfigBase : TLObject { public virtual TLBool IsEnabled { get; set; } public virtual TLBool UseForCalls { get; set; } public abstract bool IsEmpty { get; } public abstract TLProxyBase GetProxy(); public abstract TLProxyConfigBase ToLastProxyConfig(); public static TLProxyConfigBase Empty { get { var proxyConfig = new TLProxyConfig76 { CustomFlags = new TLLong(0), IsEnabled = TLBool.False, UseForCalls = TLBool.False, SelectedIndex = new TLInt(-1), Items = new TLVector() }; return proxyConfig; } } } public class TLProxyConfig : TLProxyConfigBase { public const uint Signature = TLConstructors.TLProxyConfig; public TLString Server { get; set; } public TLInt Port { get; set; } public TLString Username { get; set; } public TLString Password { get; set; } public override bool IsEmpty { get { return TLString.IsNullOrEmpty(Server) || Port.Value < 0; } } public override TLProxyBase GetProxy() { return IsEmpty ? null : new TLSocks5Proxy { CustomFlags = new TLLong(0), Server = Server, Port = Port, Username = Username, Password = Password }; } public override TLProxyConfigBase ToLastProxyConfig() { return new TLProxyConfig76 { CustomFlags = new TLLong(0), IsEnabled = IsEnabled, SelectedIndex = new TLInt(0), Items = new TLVector { new TLSocks5Proxy { CustomFlags = new TLLong(0), Server = Server, Port = Port, Username = Username, Password = Password } } }; } public override TLObject FromStream(Stream input) { IsEnabled = GetObject(input); Server = GetObject(input); Port = GetObject(input); Username = GetObject(input); Password = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); IsEnabled.ToStream(output); Server.ToStream(output); Port.ToStream(output); Username.ToStream(output); Password.ToStream(output); } public override string ToString() { return string.Format("TLProxyConfig server={0} port={1} username={2} password={3}", Server, Port, Username, Password); } } public class TLProxyConfig76 : TLProxyConfigBase { public const uint Signature = TLConstructors.TLProxyConfig76; protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public override TLBool IsEnabled { get { return IsSet(CustomFlags, (int)ProxyConfigCustomFlags.IsEnabled) ? TLBool.True : TLBool.False; } set { SetUnset(ref _customFlags, value.Value, (int)ProxyConfigCustomFlags.IsEnabled); } } public override TLBool UseForCalls { get { return IsSet(CustomFlags, (int)ProxyConfigCustomFlags.UseForCalls) ? TLBool.True : TLBool.False; } set { SetUnset(ref _customFlags, value.Value, (int)ProxyConfigCustomFlags.UseForCalls); } } public TLInt SelectedIndex { get; set; } public TLVector Items { get; set; } public override bool IsEmpty { get { return SelectedIndex.Value < 0 || SelectedIndex.Value > Items.Count - 1 || Items[SelectedIndex.Value].IsEmpty; } } public override TLProxyConfigBase ToLastProxyConfig() { return this; } public override TLProxyBase GetProxy() { return IsEmpty ? null : Items[SelectedIndex.Value]; } public override TLObject FromStream(Stream input) { CustomFlags = GetObject(input); SelectedIndex = GetObject(input); Items = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); CustomFlags.ToStream(output); SelectedIndex.ToStream(output); Items.ToStream(output); } } public abstract class TLProxyBase : TLObject { protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } protected TLInt _ping; public TLInt Ping { get { return _ping; } set { SetField(out _ping, value, ref _customFlags, (int)ProxyCustomFlags.Ping); NotifyOfPropertyChange(() => Ping); } } protected TLInt _checkTime; public TLInt CheckTime { get { return _checkTime; } set { SetField(out _checkTime, value, ref _customFlags, (int)ProxyCustomFlags.CheckTime); } } public TLString Server { get; set; } public TLInt Port { get; set; } protected ProxyStatus _proxyStatus; public ProxyStatus Status { get { return _proxyStatus; } set { SetField(ref _proxyStatus, value, () => Status); NotifyOfPropertyChange(() => Self); } } public virtual string About { get { return string.Format("{0}:{1}", Server, Port); } } public abstract bool IsEmpty { get; } private bool _isSelected; public bool IsSelected { get { return _isSelected; } set { SetField(ref _isSelected, value, () => IsSelected); NotifyOfPropertyChange(() => Self); } } public abstract bool ProxyEquals(TLProxyBase proxy); public static bool ProxyEquals(TLProxyBase proxyItem1, TLProxyBase proxyItem2) { if (proxyItem1 != null && proxyItem2 == null) return false; if (proxyItem1 == null && proxyItem2 == null) return false; if (proxyItem1 == null && proxyItem2 != null) return false; return proxyItem1.ProxyEquals(proxyItem2); } public TLProxyBase Self { get { return this; } } public abstract string GetUrl(string prefix); public abstract TLInputClientProxy ToInputProxy(); } public class TLSocks5Proxy : TLProxyBase { public const uint Signature = TLConstructors.TLSocks5Proxy; public TLString Username { get; set; } public TLString Password { get; set; } public override bool IsEmpty { get { return TLString.IsNullOrEmpty(Server) || Port.Value < 0; } } public override bool ProxyEquals(TLProxyBase proxy) { var socks5Proxy = proxy as TLSocks5Proxy; if (socks5Proxy == null) return false; return TLString.Equals(Server, socks5Proxy.Server, StringComparison.OrdinalIgnoreCase) && Port.Value == socks5Proxy.Port.Value && TLString.Equals(Username, socks5Proxy.Username, StringComparison.Ordinal) && TLString.Equals(Password, socks5Proxy.Password, StringComparison.Ordinal); } public override TLObject FromStream(Stream input) { CustomFlags = GetObject(input); Server = GetObject(input); Port = GetObject(input); Username = GetObject(input); Password = GetObject(input); Ping = GetObject(CustomFlags, (int)ProxyCustomFlags.Ping, null, input); CheckTime = GetObject(CustomFlags, (int)ProxyCustomFlags.CheckTime, null, input); Status = Ping != null ? ProxyStatus.Available : ProxyStatus.Unavailable; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); CustomFlags.ToStream(output); Server.ToStream(output); Port.ToStream(output); Username.ToStream(output); Password.ToStream(output); ToStream(output, Ping, CustomFlags, (int)ProxyCustomFlags.Ping); ToStream(output, CheckTime, CustomFlags, (int)ProxyCustomFlags.CheckTime); } public override string ToString() { return string.Format("TLSocks5Proxy server={0} port={1} username={2} password={3}", Server, Port, Username, Password); } public override string GetUrl(string prefix) { var proxyString = prefix + string.Format("socks?server={0}&port={1}", Server, Port); if (!TLString.IsNullOrEmpty(Username) && !TLString.IsNullOrEmpty(Password)) { proxyString += string.Format("&user={0}&pass={1}", Username, Password); } return proxyString; } public override TLInputClientProxy ToInputProxy() { return null; } } public class TLMTProtoProxy : TLProxyBase { public const uint Signature = TLConstructors.TLMTProtoProxy; public TLString Secret { get; set; } public override bool IsEmpty { get { return TLString.IsNullOrEmpty(Server) || Port.Value < 0 || TLString.IsNullOrEmpty(Secret); } } public override bool ProxyEquals(TLProxyBase proxy) { var mtProtoProxy = proxy as TLMTProtoProxy; if (mtProtoProxy == null) return false; return TLString.Equals(Server, mtProtoProxy.Server, StringComparison.OrdinalIgnoreCase) && Port.Value == mtProtoProxy.Port.Value && TLString.Equals(Secret, mtProtoProxy.Secret, StringComparison.Ordinal); } public override TLObject FromStream(Stream input) { CustomFlags = GetObject(input); Server = GetObject(input); Port = GetObject(input); Secret = GetObject(input); Ping = GetObject(CustomFlags, (int)ProxyCustomFlags.Ping, null, input); CheckTime = GetObject(CustomFlags, (int)ProxyCustomFlags.CheckTime, null, input); Status = Ping != null ? ProxyStatus.Available : ProxyStatus.Unavailable; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); CustomFlags.ToStream(output); Server.ToStream(output); Port.ToStream(output); Secret.ToStream(output); ToStream(output, Ping, CustomFlags, (int)ProxyCustomFlags.Ping); ToStream(output, CheckTime, CustomFlags, (int)ProxyCustomFlags.CheckTime); } public override string ToString() { return string.Format("TLMTProtoProxy server={0} port={1} secret={2}", Server, Port, Secret); } public override string GetUrl(string prefix) { var proxyString = prefix + string.Format("proxy?server={0}&port={1}", Server, Port); if (!TLString.IsNullOrEmpty(Secret)) { proxyString += string.Format("&secret={0}", Secret); } return proxyString; } public override TLInputClientProxy ToInputProxy() { return new TLInputClientProxy { Address = Server, Port = Port }; } } } ================================================ FILE: Telegram.Api/TL/TLRPCDropAnswer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLRPCAnswerUnknown : TLObject { public const uint Signature = TLConstructors.TLRPCAnswerUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLRPCAnswerDroppedRunning : TLObject { public const uint Signature = TLConstructors.TLRPCAnswerDroppedRunning; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLRPCAnswerDropped : TLObject { public const uint Signature = TLConstructors.TLRPCAnswerDropped; public TLLong MsgId { get; set; } public TLInt SeqNo { get; set; } public TLInt Bytes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); MsgId = GetObject(bytes, ref position); SeqNo = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLRPCError.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; #if !WIN_RT using System.Net.Sockets; #endif namespace Telegram.Api.TL { public enum ErrorType { PHONE_MIGRATE, NETWORK_MIGRATE, FILE_MIGRATE, USER_MIGRATE, PHONE_NUMBER_INVALID, PHONE_CODE_EMPTY, PHONE_CODE_EXPIRED, PHONE_CODE_INVALID, PHONE_NUMBER_OCCUPIED, PHONE_NUMBER_UNOCCUPIED, FLOOD_WAIT, PEER_FLOOD, FIRSTNAME_INVALID, MIDDLENAME_INVALID, LASTNAME_INVALID, FIRSTNAMENATIVE_INVALID, MIDDLENAMENATIVE_INVALID, LASTNAMENATIVE_INVALID, QUERY_TOO_SHORT, USERNAME_INVALID, USERNAME_OCCUPIED, USERNAME_NOT_OCCUPIED, // 400 USERNAME_NOT_MODIFIED, // 400 CHANNELS_ADMIN_PUBLIC_TOO_MUCH, // 400 CHANNEL_PRIVATE, // 400 PEER_ID_INVALID, // 400 MESSAGE_EMPTY, // 400 MESSAGE_TOO_LONG, // 400 MSG_WAIT_FAILED, // 400 MESSAGE_ID_INVALID, // 400 MESSAGE_NOT_MODIFIED, // 400 MESSAGE_EDIT_TIME_EXPIRED, // 400 PASSWORD_HASH_INVALID, // 400 NEW_PASSWORD_BAD, // 400 NEW_SALT_INVALID, // 400 EMAIL_INVALID, // 400 EMAIL_UNCONFIRMED, // 400 EMAIL_VERIFY_EXPIRED, // 400 CODE_EMPTY, // 400 CODE_INVALID, // 400 PASSWORD_EMPTY, // 400 PASSWORD_RECOVERY_NA, // 400 PASSWORD_RECOVERY_EXPIRED, //400 CHAT_INVALID, // 400 CHAT_ADMIN_REQUIRED, // 400 CHAT_NOT_MODIFIED, // 400 CHAT_ABOUT_NOT_MODIFIED,// 400 INVITE_HASH_EMPTY, // 400 INVITE_HASH_INVALID, // 400 INVITE_HASH_EXPIRED, // 400 USERS_TOO_MUCH, // 400 BOTS_TOO_MUCH, // 400 ADMINS_TOO_MUCH, // 400 CHANNELS_TOO_MUCH, // 400 USER_CHANNELS_TOO_MUCH, // 400 USER_NOT_MUTUAL_CONTACT, // 400 USER_ALREADY_PARTICIPANT, // 400 USER_NOT_PARTICIPANT, // 400 STICKERSET_INVALID, // 400 LOCATION_INVALID, // 400 upload.getFile VOLUME_LOC_NOT_FOUND, // 400 upload.getFile SRP_ID_INVALID, SRP_PASSWORD_CHANGED, REQ_INFO_NAME_INVALID, REQ_INFO_PHONE_INVALID, REQ_INFO_EMAIL_INVALID, ADDRESS_COUNTRY_INVALID, ADDRESS_RESIDENCE_COUNTRY_INVALID, ADDRESS_CITY_INVALID, ADDRESS_POSTCODE_INVALID, ADDRESS_STATE_INVALID, ADDRESS_STREET_LINE1_INVALID, ADDRESS_STREET_LINE2_INVALID, SHIPPING_BOT_TIMEOUT, SHIPPING_NOT_AVAILABLE, BIRTHDATE_INVALID, GENDER_INVALID, DOCUMENT_NUMBER_INVALID, EXPIRYDATE_INVALID, PROVIDER_ACCOUNT_INVALID, PROVIDER_ACCOUNT_TIMEOUT, INVOICE_ALREADY_PAID, REQUESTED_INFO_INVALID, SHIPPING_OPTION_INVALID, PAYMENT_FAILED, PAYMENT_CREDENTIALS_INVALID, PAYMENT_CREDENTIALS_ID_INVALID, BOT_PRECHECKOUT_FAILED, FILE_TOKEN_INVALID, REQUEST_TOKEN_INVALID, FILES_EMPTY, FILES_TOO_MUCH, FILE_ERROR, TRANSLATION_ERROR, TRANSLATION_EMPTY, FRONT_SIDE_REQUIRED, REVERSE_SIDE_REQUIRED, SELFIE_REQUIRED, PHONE_VERIFICATION_NEEDED, EMAIL_VERIFICATION_NEEDED, APP_VERSION_OUTDATED, SESSION_PASSWORD_NEEDED,// 401 SESSION_REVOKED, // 401 USER_PRIVACY_RESTRICTED,// 403 //2FA_RECENT_CONFIRM, // 420 //2FA_CONFIRM_WAIT_XXX, // 420 RPC_CALL_FAIL, // 500 CANTPARSE } public enum ErrorCode { ERROR_SEE_OTHER = 303, BAD_REQUEST = 400, UNAUTHORIZED = 401, FORBIDDEN = 403, NOT_FOUND = 404, FLOOD = 420, INTERNAL = 500, #region Additional TIMEOUT = 408, #endregion } public class TLRPCReqError : TLRPCError { public new const uint Signature = TLConstructors.TLRPCReqError; public TLLong QueryId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); Code = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), QueryId.ToBytes(), Code.ToBytes(), Message.ToBytes()); } } public class TLRPCError : TLObject { public TLRPCError() { Code = new TLInt(0); } public TLRPCError(int errorCode) { Code = new TLInt(errorCode); } #region Additional #if !WIN_RT public SocketError? SocketError { get; set; } #endif public Exception Exception { get; set; } /// /// Await time before next request (ms) /// public int AwaitTime { get; set; } #endregion public bool CodeEquals(ErrorCode code) { if (Code != null && Enum.IsDefined(typeof (ErrorCode), Code.Value)) { return (ErrorCode) Code.Value == code; } return false; } public static bool CodeEquals(TLRPCError error, ErrorCode code) { if (error.Code != null && Enum.IsDefined(typeof(ErrorCode), error.Code.Value)) { return (ErrorCode)error.Code.Value == code; } return false; } public ErrorType GetErrorType() { var strings = Message.ToString().Split(':'); var typeString = strings[0]; if (Enum.IsDefined(typeof(ErrorType), typeString)) { var value = (ErrorType) Enum.Parse(typeof(ErrorType), typeString, true); return value; } return ErrorType.CANTPARSE; } public string GetErrorTypeString() { var strings = Message.ToString().Split(':'); return strings[0]; } public bool TypeStarsWith(string type) { var strings = Message.ToString().Split(':'); var typeString = strings[0]; return typeString.StartsWith(type, StringComparison.OrdinalIgnoreCase); } public bool TypeStarsWith(ErrorType type) { var strings = Message.ToString().Split(':'); var typeString = strings[0]; return typeString.StartsWith(type.ToString(), StringComparison.OrdinalIgnoreCase); } public bool TypeEquals(string type) { if (Message == null) return false; var strings = Message.ToString().Split(':'); var typeString = strings[0]; return string.Equals(type, typeString, StringComparison.OrdinalIgnoreCase); } public bool TypeEquals(ErrorType type) { if (Message == null) return false; var strings = Message.ToString().Split(':'); var typeString = strings[0]; if (Enum.IsDefined(typeof(ErrorType), typeString)) { var value = (ErrorType)Enum.Parse(typeof (ErrorType), typeString, true); return value == type; } return false; } public static bool TypeEquals(TLRPCError error, ErrorType type) { if (error == null) return false; return error.TypeEquals(type); } public const uint Signature = TLConstructors.TLRPCError; public TLInt Code { get; set; } public TLString Message { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Code = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Code.ToBytes(), Message.ToBytes()); } public override string ToString() { #if DEBUG return string.Format("{0} {1}{2}{3}", Code, Message, #if WINDOWS_PHONE SocketError != null ? "\nSocketError=" + SocketError : string.Empty, #else string.Empty, #endif Exception != null ? "\nException=" : string.Empty); #else return string.Format("{0} {1}", Code, Message); #endif } } } ================================================ FILE: Telegram.Api/TL/TLRPCResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLRPCResult : TLObject { public const uint Signature = TLConstructors.TLRPCResult; public TLLong RequestMessageId { get; set; } public TLObject Object { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); RequestMessageId = GetObject(bytes, ref position); Object = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLReceivedNotifyMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLReceivedNotifyMessage : TLObject { public const uint Signature = TLConstructors.TLReceivedNotifyMessage; public TLInt Id { get; set; } public TLInt Flags { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Flags = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(Flags.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLRecentMeUrl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLRecentMeUrlBase : TLObject { public TLString Url { get; set; } } public class TLRecentMeUrlUnknown : TLRecentMeUrlBase { public const uint Signature = TLConstructors.TLRecentMeUrlUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); } } public class TLRecentMeUrlUser : TLRecentMeUrlBase { public const uint Signature = TLConstructors.TLRecentMeUrlUser; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); UserId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); UserId.ToStream(output); } } public class TLRecentMeUrlChat : TLRecentMeUrlBase { public const uint Signature = TLConstructors.TLRecentMeUrlChat; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); ChatId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); ChatId.ToStream(output); } } public class TLRecentMeUrlChatInvite : TLRecentMeUrlBase { public const uint Signature = TLConstructors.TLRecentMeUrlChatInvite; public TLChatInviteBase ChatInvite { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); ChatInvite = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); ChatInvite = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); ChatInvite.ToStream(output); } } public class TLRecentMeUrlStickerSet : TLRecentMeUrlBase { public const uint Signature = TLConstructors.TLRecentMeUrlStickerSet; public TLStickerSetCoveredBase Set { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); Set = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Url = GetObject(input); Set = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); Set.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLRecentMeUrls.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLRecentMeUrls : TLObject { public const uint Signature = TLConstructors.TLRecentMeUrls; public TLVector Urls { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Urls = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Urls = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Urls.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLRecentStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLRecentStickersBase : TLObject { } public class TLRecentStickersNotModified : TLRecentStickersBase { public const uint Signature = TLConstructors.TLRecentStickersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLRecentStickers76 : TLRecentStickers { public new const uint Signature = TLConstructors.TLRecentStickers76; public TLVector Packs { get; set; } public TLVector Dates { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Packs = GetObject>(bytes, ref position); Documents = GetObject>(bytes, ref position); Dates = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Packs.ToBytes(), Documents.ToBytes(), Dates.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Packs = GetObject>(input); Documents = GetObject>(input); Dates = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); Dates.ToStream(output); } } public class TLRecentStickers : TLRecentStickersBase { public const uint Signature = TLConstructors.TLRecentStickers; public virtual TLInt Hash { get; set; } public TLVector Documents { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Documents = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Documents.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLRecentlyUsedSticker.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLRecentlyUsedSticker : TLObject { public const uint Signature = TLConstructors.TLRecentlyUsedSticker; public TLLong Id { get; set; } public TLLong Count { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Count.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Count = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Count.ToStream(output); } public override string ToString() { return string.Format("Id={0} Count={1}", Id, Count); } } } ================================================ FILE: Telegram.Api/TL/TLReplyKeyboardMarkup.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { enum ReplyKeyboardFlags { Resize = 0x1, SingleUse = 0x2, Personal = 0x4 } enum ReplyKeyboardCustomFlags { HasResponse = 0x1, } public interface IReplyKeyboardRows { TLVector Rows { get; set; } } public abstract class TLReplyKeyboardBase : TLObject { public TLInt Flags { get; set; } private TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public bool IsResizable { get { return IsSet(Flags, (int)ReplyKeyboardFlags.Resize); } } public bool IsSingleUse { get { return IsSet(Flags, (int)ReplyKeyboardFlags.SingleUse); } } public bool IsPersonal { get { return IsSet(Flags, (int)ReplyKeyboardFlags.Personal); } } public bool HasResponse { get { return IsSet(CustomFlags, (int) ReplyKeyboardCustomFlags.HasResponse); } set { Set(ref _customFlags, (int) ReplyKeyboardCustomFlags.HasResponse);} } public override string ToString() { var isPersonal = IsPersonal ? "p" : string.Empty; var isResizable = IsResizable ? "r" : string.Empty; var isSingleUse = IsSingleUse ? "s" : string.Empty; var hasResponse = HasResponse ? "h" : string.Empty; return string.Format("{0} {1} {2} {3}", isPersonal, isResizable, isSingleUse, hasResponse); } } public class TLReplyInlineMarkup : TLReplyKeyboardBase, IReplyKeyboardRows { public const uint Signature = TLConstructors.TLReplyInlineMarkup; public TLVector Rows { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Rows = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Rows.ToBytes()); } public override TLObject FromStream(Stream input) { Rows = GetObject>(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Rows.ToBytes()); CustomFlags.NullableToStream(output); } public override string ToString() { var rowsString = new List(); foreach (var row in Rows) { rowsString.Add(row.Buttons.Count.ToString()); } return "IM " + string.Join(" ", rowsString) + base.ToString(); } } public class TLReplyKeyboardMarkup : TLReplyKeyboardBase, IReplyKeyboardRows { public const uint Signature = TLConstructors.TLReplyKeyboardMarkup; public TLVector Rows { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Rows = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Rows.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Rows = GetObject>(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); output.Write(Rows.ToBytes()); CustomFlags.NullableToStream(output); } public override string ToString() { var rowsString = new List(); foreach (var row in Rows) { rowsString.Add(row.Buttons.Count.ToString()); } return "KM " + string.Join(" ", rowsString) + base.ToString(); } } public class TLReplyKeyboardHide : TLReplyKeyboardBase { public const uint Signature = TLConstructors.TLReplyKeyboardHide; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); CustomFlags.NullableToStream(output); } public override string ToString() { return "KH " + base.ToString(); } } public class TLReplyKeyboardForceReply : TLReplyKeyboardBase { public const uint Signature = TLConstructors.TLReplyKeyboardForceReply; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Flags.ToBytes()); CustomFlags.NullableToStream(output); } public override string ToString() { return "KFR " + base.ToString(); } } } ================================================ FILE: Telegram.Api/TL/TLRequest.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Telegram.Api.TL { } ================================================ FILE: Telegram.Api/TL/TLResPQ.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLResPQ : TLObject { public const uint Signature = TLConstructors.TLResPQ; public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLString PQ { get; set; } public TLVector ServerPublicKeyFingerprints { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Nonce = GetObject(bytes, ref position); ServerNonce = GetObject(bytes, ref position); PQ = GetObject(bytes, ref position); ServerPublicKeyFingerprints = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.ToBytes(), ServerNonce.ToBytes(), PQ.ToBytes(), ServerPublicKeyFingerprints.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLResolvedPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLResolvedPeer : TLObject { public const uint Signature = TLConstructors.TLResolvedPeer; public TLPeerBase Peer { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Peer = GetObject(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Peer.ToBytes()); output.Write(Chats.ToBytes()); output.Write(Users.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLResponse.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public class TLResponse { public byte[] AuthKeyId { get; set; } public byte[] MessageKey { get; set; } public byte[] EncryptedData { get; set; } public byte[] DecryptedData { get; set; } public byte[] Salt { get; set; } public byte[] SessionId { get; set; } public TLLong MessageId { get; set; } public TLInt SequenceNumber { get; set; } public Int32 MessageLength { get; set; } public byte[] MessageData { get; set; } public TLObject Data { get; set; } public static TLResponse Parse(byte[] bytes, byte[] authKey) { TLUtils.WriteLine("-------------------"); TLUtils.WriteLine("--Parse response --"); TLUtils.WriteLine("-------------------"); int position = 0; var response = new TLResponse(); response.AuthKeyId = bytes.SubArray(0, 8); TLUtils.WriteLine("AuthKeyId: " + BitConverter.ToString(response.AuthKeyId)); response.MessageKey = bytes.SubArray(8, 16); TLUtils.WriteLine("MessageKey: " + BitConverter.ToString(response.MessageKey)); response.EncryptedData = bytes.SubArray(24, bytes.Length - 24); //TLUtils.WriteLine("Encrypted data: " + BitConverter.ToString(response.Data)); var keyIV = TLUtils.GetDecryptKeyIV(authKey, response.MessageKey); response.DecryptedData = Utils.AesIge(response.EncryptedData, keyIV.Item1, keyIV.Item2, false); //TLUtils.WriteLine("Decrypted data: " + BitConverter.ToString(response.DecryptedData)); response.Salt = response.DecryptedData.SubArray(0, 8); TLUtils.WriteLine("Salt: " + BitConverter.ToString(response.Salt)); response.SessionId = response.DecryptedData.SubArray(8, 8); TLUtils.WriteLine("SessionId: " + BitConverter.ToString(response.SessionId)); position = 0; response.MessageId = TLObject.GetObject(response.DecryptedData.SubArray(16, 8), ref position); TLUtils.WriteLine("<-MESSAGEID: " + TLUtils.MessageIdString(response.MessageId)); position = 0; response.SequenceNumber = TLObject.GetObject(response.DecryptedData.SubArray(24, 4), ref position); TLUtils.WriteLine(" SEQUENCENUMBER: " + response.SequenceNumber); response.MessageLength = BitConverter.ToInt32(response.DecryptedData.SubArray(28, 4), 0); TLUtils.WriteLine("MessageLength: " + response.MessageLength); response.MessageData = response.DecryptedData.SubArray(32, response.MessageLength); TLUtils.WriteLine("MessageData: " + BitConverter.ToString(response.MessageData)); position = 0; response.Data = TLObject.GetObject(response.MessageData, ref position); return response; } } } ================================================ FILE: Telegram.Api/TL/TLResultInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLResultInfo : TLObject { public const uint Signature = TLConstructors.TLResultInfo; public TLString Type { get; set; } public TLInt Id { get; set; } public TLLong Count { get; set; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Type.ToStream(output); Id.ToStream(output); Count.ToStream(output); } public override TLObject FromStream(Stream input) { Type = GetObject(input); Id = GetObject(input); Count = GetObject(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLRichText.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLRichTextBase : TLObject { } public class TLTextEmpty : TLRichTextBase { public const uint Signature = TLConstructors.TLTextEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLTextPlain : TLRichTextBase { public const uint Signature = TLConstructors.TLTextPlain; public TLString Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextBold : TLRichTextBase { public const uint Signature = TLConstructors.TLTextBold; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextItalic : TLRichTextBase { public const uint Signature = TLConstructors.TLTextItalic; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextUnderline : TLRichTextBase { public const uint Signature = TLConstructors.TLTextUnderline; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextStrike : TLRichTextBase { public const uint Signature = TLConstructors.TLTextStrike; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextFixed : TLRichTextBase { public const uint Signature = TLConstructors.TLTextFixed; public TLRichTextBase Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); return this; } } public class TLTextUrl : TLRichTextBase { public const uint Signature = TLConstructors.TLTextUrl; public TLRichTextBase Text { get; set; } public TLString Url { get; set; } public TLLong WebPageId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); WebPageId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Url.ToBytes(), WebPageId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); Url.ToStream(output); WebPageId.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Url = GetObject(input); WebPageId = GetObject(input); return this; } } public class TLTextEmail : TLRichTextBase { public const uint Signature = TLConstructors.TLTextEmail; public TLRichTextBase Text { get; set; } public TLString Email { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); Email = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Text.ToBytes(), Email.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Text.ToStream(output); Email.ToStream(output); } public override TLObject FromStream(Stream input) { Text = GetObject(input); Email = GetObject(input); return this; } } public class TLTextConcat : TLRichTextBase { public const uint Signature = TLConstructors.TLTextConcat; public TLVector Texts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Texts = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Texts.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Texts.ToStream(output); } public override TLObject FromStream(Stream input) { Texts = GetObject>(input); return this; } } } ================================================ FILE: Telegram.Api/TL/TLSavedGifs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLSavedGifsBase : TLObject { } public class TLSavedGifsNotModified : TLSavedGifsBase { public const uint Signature = TLConstructors.TLSavedGifsNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSavedGifs : TLSavedGifsBase { public const uint Signature = TLConstructors.TLSavedGifs; public TLInt Hash { get; set; } public TLVector Gifs { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Gifs = GetObject>(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Gifs = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Gifs.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLSavedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum SavedInfoFlags { SavedInfo = 0x1, // 0 HasSavedCredentials = 0x2, // 1 } public class TLSavedInfo : TLObject { public const uint Signature = TLConstructors.TLSavedInfo; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool HasSavedCredentials { get { return IsSet(Flags, (int) SavedInfoFlags.HasSavedCredentials); } set { SetUnset(ref _flags, value, (int) SavedInfoFlags.HasSavedCredentials); } } private TLPaymentRequestedInfo _savedInfo; public TLPaymentRequestedInfo SavedInfo { get { return _savedInfo; } set { SetField(out _savedInfo, value, ref _flags, (int) SavedInfoFlags.SavedInfo); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _savedInfo = GetObject(Flags, (int) SavedInfoFlags.SavedInfo, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLSendMessageAction.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLSendMessageActionBase : TLObject { } public class TLSendMessageTypingAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageTypingAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageCancelAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageCancelAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageRecordVideoAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageRecordVideoAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadVideoAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageUploadVideoAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadVideoAction28 : TLSendMessageUploadVideoAction { public new const uint Signature = TLConstructors.TLSendMessageUploadVideoAction28; public TLInt Progress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Progress = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Progress.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Progress.ToStream(output); } public override TLObject FromStream(Stream input) { Progress = GetObject(input); return this; } } public class TLSendMessageRecordAudioAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageRecordAudioAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadAudioAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageUploadAudioAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadAudioAction28 : TLSendMessageUploadAudioAction { public new const uint Signature = TLConstructors.TLSendMessageUploadAudioAction28; public TLInt Progress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Progress = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Progress.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Progress.ToStream(output); } public override TLObject FromStream(Stream input) { Progress = GetObject(input); return this; } } public class TLSendMessageUploadPhotoAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageUploadPhotoAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadPhotoAction28 : TLSendMessageUploadPhotoAction { public new const uint Signature = TLConstructors.TLSendMessageUploadPhotoAction28; public TLInt Progress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Progress = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Progress.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Progress.ToStream(output); } public override TLObject FromStream(Stream input) { Progress = GetObject(input); return this; } } public class TLSendMessageUploadDocumentAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageUploadDocumentAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadDocumentAction28 : TLSendMessageUploadDocumentAction { public new const uint Signature = TLConstructors.TLSendMessageUploadDocumentAction28; public TLInt Progress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Progress = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Progress.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Progress.ToStream(output); } public override TLObject FromStream(Stream input) { Progress = GetObject(input); return this; } } public class TLSendMessageGeoLocationAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageGeoLocationAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageChooseContactAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageChooseContactAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageGamePlayAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageGamePlayAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageRecordRoundAction : TLSendMessageActionBase { public const uint Signature = TLConstructors.TLSendMessageRecordRoundAction; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } public class TLSendMessageUploadRoundAction : TLSendMessageUploadDocumentAction { public new const uint Signature = TLConstructors.TLSendMessageUploadRoundAction; public TLInt Progress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Progress = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Progress.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Progress.ToStream(output); } public override TLObject FromStream(Stream input) { Progress = GetObject(input); return this; } } public class TLSendMessageUploadRoundAction66 : TLSendMessageUploadDocumentAction { public new const uint Signature = TLConstructors.TLSendMessageUploadRoundAction66; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } } } ================================================ FILE: Telegram.Api/TL/TLSentChangePhoneCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Text; namespace Telegram.Api.TL { public class TLSentChangePhoneCode : TLObject { public const uint Signature = TLConstructors.TLSentChangePhoneCode; public TLString PhoneCodeHash { get; set; } public TLInt SendCodeTimeout { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneCodeHash = GetObject(bytes, ref position); SendCodeTimeout = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneCodeHash.ToBytes(), SendCodeTimeout.ToBytes()); } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("SentChangePhoneCode"); sb.AppendLine(string.Format("PhoneCodeHash " + PhoneCodeHash)); sb.AppendLine(string.Format("SendCodeTimeout " + SendCodeTimeout)); return sb.ToString(); } } } ================================================ FILE: Telegram.Api/TL/TLSentCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Text; namespace Telegram.Api.TL { [Flags] public enum SentCodeFlags { PhoneRegistered = 0x1, // 0 NextType = 0x2, // 1 Timeout = 0x4, // 2 TermsOfService = 0x8, // 3 } public abstract class TLSentCodeBase : TLObject { public virtual TLBool PhoneRegistered { get; set; } public TLString PhoneCodeHash { get; set; } public TLInt SendCallTimeout { get; set; } public TLBool IsPassword { get; set; } } public class TLSentCode80 : TLSentCode50 { public new const uint Signature = TLConstructors.TLSentCode80; protected TLTermsOfServiceBase _termsOfService; public TLTermsOfServiceBase TermsOfService { get { return _termsOfService; } set { SetField(out _termsOfService, value, ref _flags, (int)SentCodeFlags.TermsOfService); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); PhoneCodeHash = GetObject(bytes, ref position); NextType = GetObject(Flags, (int)SentCodeFlags.NextType, null, bytes, ref position); SendCallTimeout = GetObject(Flags, (int)SentCodeFlags.Timeout, null, bytes, ref position); _termsOfService = GetObject(Flags, (int)SentCodeFlags.TermsOfService, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("SentCode80"); sb.AppendLine(string.Format("PhoneRegistered " + PhoneRegistered)); sb.AppendLine(string.Format("Type " + Type)); sb.AppendLine(string.Format("PhoneCodeHash " + PhoneCodeHash)); sb.AppendLine(string.Format("NextType " + NextType)); sb.AppendLine(string.Format("SendCallTimeout " + SendCallTimeout)); sb.AppendLine(string.Format("TermsOfService " + TermsOfService)); return sb.ToString(); } } public class TLSentCode50 : TLSentCodeBase { public const uint Signature = TLConstructors.TLSentCode50; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool PhoneRegistered { get { return new TLBool(IsSet(Flags, (int)SentCodeFlags.PhoneRegistered)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)SentCodeFlags.PhoneRegistered); } } } public TLSentCodeTypeBase Type { get; set; } public TLCodeTypeBase NextType { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); PhoneCodeHash = GetObject(bytes, ref position); NextType = GetObject(Flags, (int)SentCodeFlags.NextType, null, bytes, ref position); SendCallTimeout = GetObject(Flags, (int)SentCodeFlags.Timeout, null, bytes, ref position); return this; } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("SentCode50"); sb.AppendLine(string.Format("PhoneRegistered " + PhoneRegistered)); sb.AppendLine(string.Format("Type " + Type)); sb.AppendLine(string.Format("PhoneCodeHash " + PhoneCodeHash)); sb.AppendLine(string.Format("NextType " + NextType)); sb.AppendLine(string.Format("SendCallTimeout " + SendCallTimeout)); return sb.ToString(); } } public class TLSentCode : TLSentCodeBase { public const uint Signature = TLConstructors.TLSentCode; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneRegistered = GetObject(bytes, ref position); PhoneCodeHash = GetObject(bytes, ref position); SendCallTimeout = GetObject(bytes, ref position); IsPassword = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneRegistered.ToBytes(), PhoneCodeHash.ToBytes(), SendCallTimeout.ToBytes(), IsPassword.ToBytes()); } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("SentCode"); sb.AppendLine(string.Format("PhoneRegistered " + PhoneRegistered)); sb.AppendLine(string.Format("PhoneCodeHash " + PhoneCodeHash)); sb.AppendLine(string.Format("SendCallTimeout " + SendCallTimeout)); sb.AppendLine(string.Format("IsPassword " + IsPassword)); return sb.ToString(); } } public class TLSentAppCode : TLSentCodeBase { public const uint Signature = TLConstructors.TLSentAppCode; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneRegistered = GetObject(bytes, ref position); PhoneCodeHash = GetObject(bytes, ref position); SendCallTimeout = GetObject(bytes, ref position); IsPassword = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneRegistered.ToBytes(), PhoneCodeHash.ToBytes(), SendCallTimeout.ToBytes(), IsPassword.ToBytes()); } public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("SentAppCode"); sb.AppendLine(string.Format("PhoneRegistered " + PhoneRegistered)); sb.AppendLine(string.Format("PhoneCodeHash " + PhoneCodeHash)); sb.AppendLine(string.Format("SendCallTimeout " + SendCallTimeout)); sb.AppendLine(string.Format("IsPassword " + IsPassword)); return sb.ToString(); } } } ================================================ FILE: Telegram.Api/TL/TLSentCodeType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public interface ILength { TLInt Length { get; set; } } public abstract class TLSentCodeTypeBase : TLObject { } public class TLSentCodeTypeApp : TLSentCodeTypeBase, ILength { public const uint Signature = TLConstructors.TLSentCodeTypeApp; public TLInt Length { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Length.ToBytes()); } } public class TLSentCodeTypeSms : TLSentCodeTypeBase, ILength { public const uint Signature = TLConstructors.TLSentCodeTypeSms; public TLInt Length { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Length.ToBytes()); } } public class TLSentCodeTypeCall : TLSentCodeTypeBase, ILength { public const uint Signature = TLConstructors.TLSentCodeTypeCall; public TLInt Length { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Length = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Length.ToBytes()); } } public class TLSentCodeTypeFlashCall : TLSentCodeTypeBase { public const uint Signature = TLConstructors.TLSentCodeTypeFlashCall; public TLString Pattern { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pattern = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Pattern.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLSentEncryptedFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSentEncryptedFile : TLObject { public const uint Signature = TLConstructors.TLSentEncryptedFile; public TLInt Date { get; set; } public TLEncryptedFileBase EncryptedFile { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); EncryptedFile = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLSentEncryptedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSentEncryptedMessage : TLObject { public const uint Signature = TLConstructors.TLSentEncryptedMessage; public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLSentMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLSentMessageBase : TLObject { public TLInt Id { get; set; } public TLInt Date { get; set; } public TLInt Pts { get; set; } public virtual TLInt GetSeq() { return null; } } public interface ISentMessageMedia { TLMessageMediaBase Media { get; set; } } public class TLSentMessage : TLSentMessageBase { public const uint Signature = TLConstructors.TLSentMessage; public TLInt Seq { get; set; } public override TLInt GetSeq() { return Seq; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Pts.ToBytes(), Seq.ToBytes()); } } public class TLSentMessage24 : TLSentMessageBase, IMultiPts { public const uint Signature = TLConstructors.TLSentMessage24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Pts.ToBytes(), PtsCount.ToBytes()); } } public class TLSentMessage26 : TLSentMessage24, ISentMessageMedia { public new const uint Signature = TLConstructors.TLSentMessage26; public TLMessageMediaBase Media { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Media.ToBytes(), Pts.ToBytes(), PtsCount.ToBytes()); } } public class TLSentMessage34 : TLSentMessage26 { public new const uint Signature = TLConstructors.TLSentMessage34; public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Entities = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Media.ToBytes(), Entities.ToBytes(), Pts.ToBytes(), PtsCount.ToBytes()); } } public class TLSentMessageLink : TLSentMessage { public new const uint Signature = TLConstructors.TLSentMessageLink; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); Links = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Pts.ToBytes(), Seq.ToBytes(), Links.ToBytes()); } } public class TLSentMessageLink24 : TLSentMessage24 { public new const uint Signature = TLConstructors.TLSentMessageLink24; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Links = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Pts.ToBytes(), PtsCount.ToBytes(), Links.ToBytes()); } } public class TLSentMessageLink26 : TLSentMessageLink24, ISentMessageMedia { public new const uint Signature = TLConstructors.TLSentMessageLink26; public TLMessageMediaBase Media { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Links = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes(), Media.ToBytes(), Pts.ToBytes(), PtsCount.ToBytes(), Links.ToBytes()); } } } ================================================ FILE: Telegram.Api/TL/TLServerDHInnerData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLServerDHInnerData : TLObject { public const uint Signature = TLConstructors.TLServerDHInnerData; public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } public TLInt G { get; set; } public TLString DHPrime { get; set; } public TLString GA { get; set; } public TLInt ServerTime { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Nonce.ToBytes(), ServerNonce.ToBytes(), G.ToBytes(), DHPrime.ToBytes(), GA.ToBytes(), ServerTime.ToBytes()); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Nonce = GetObject(bytes, ref position); ServerNonce = GetObject(bytes, ref position); G = GetObject(bytes, ref position); DHPrime = GetObject(bytes, ref position); GA = GetObject(bytes, ref position); ServerTime = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLServerDHParams.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLServerDHParamsBase : TLObject { public TLInt128 Nonce { get; set; } public TLInt128 ServerNonce { get; set; } } public class TLServerDHParamsFail : TLServerDHParamsBase { public const uint Signature = TLConstructors.TLServerDHParamsFail; public TLInt128 NewNonceHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Nonce = GetObject(bytes, ref position); ServerNonce = GetObject(bytes, ref position); NewNonceHash = GetObject(bytes, ref position); return this; } } public class TLServerDHParamsOk : TLServerDHParamsBase { public const uint Signature = TLConstructors.TLServerDHParamsOk; public TLString EncryptedAnswer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Nonce = GetObject(bytes, ref position); ServerNonce = GetObject(bytes, ref position); EncryptedAnswer = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLServerFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLServerFile : TLObject { public const uint Signature = TLConstructors.TLServerFile; public TLLong MD5Checksum { get; set; } public TLInputMediaBase Media { get; set; } public override TLObject FromStream(Stream input) { MD5Checksum = GetObject(input); Media = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); MD5Checksum.ToStream(output); Media.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLShippingOption.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLShippingOption : TLObject { public const uint Signature = TLConstructors.TLShippingOption; public TLString Id { get; set; } public TLString Title { get; set; } public TLVector Prices { get; set; } #region Additional public bool IsSelected { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Prices = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLSignatures.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public static class TLConstructors { public const uint TLUpdateUserBlocked = 0x80ece81a; public const uint TLUpdateNotifySettings = 0xbec268ef; public const uint TLNotifyPeer = 0x9fd40bd8; public const uint TLNotifyUsers = 0xb4c83b4c; public const uint TLNotifyChats = 0xc007cec3; public const uint TLNotifyAll = 0x74d07c60; public const uint TLDecryptedMessageActionReadMessages = 0xc4f40be; public const uint TLDecryptedMessageActionDeleteMessages = 0x65614304; public const uint TLDecryptedMessageActionScreenshotMessages = 0x8ac1f475; public const uint TLDecryptedMessageActionFlushHistory = 0x6719e45c; public const uint TLDecryptedMessageActionNotifyLayer = 0xf3048883; public const uint TLDecryptedMessageLayer = 0x99a438cf; public const uint TLSupport = 0x17c6b5f6; public const uint TLDecryptedMessageMediaAudio = 0x6080758f; public const uint TLDecryptedMessageMediaDocument = 0xb095434b; public const uint TLInputAudioFileLocation = 0x74dc404d; public const uint TLInputDocumentFileLocation = 0x4e45abe9; public const uint TLInputMediaUploadedDocument = 0x34e794bd; public const uint TLInputMediaUploadedThumbDocument = 0x3e46de5d; public const uint TLInputMediaDocument = 0xd184e841; public const uint TLInputMediaAudio = 0x89938781; public const uint TLInputMediaUploadedAudio = 0x4e498cab; public const uint TLInputAudio = 0x77d440ff; public const uint TLInputAudioEmpty = 0xd95adc84; public const uint TLInputDocument = 0x18798952; public const uint TLInputDocumentEmpty = 0x72f0eaae; public const uint TLMessageMediaAudio = 0xc6b68300; public const uint TLMessageMediaDocument = 0x2fda2204; public const uint TLAudioEmpty = 0x586988d8; public const uint TLAudio = 0xc7ac6496; public const uint TLDocumentEmpty = 0x36f8c871; public const uint TLDocument = 0x9efc6326; public const uint TLUpdateChatParticipantAdd = 0x3a0eeb22; public const uint TLUpdateChatParticipantDelete = 0x6e5f8c22; public const uint TLInputEncryptedFileBigUploaded = 0x2dc173c8; public const uint TLInputFileBig = 0xfa4f0bb5; public const uint TLDecryptedMessage = 0x1f814f1f; public const uint TLDecryptedMessageService = 0xaa48327d; public const uint TLUpdateNewEncryptedMessage = 0x12bcbd9a; public const uint TLUpdateEncryptedChatTyping = 0x1710f156; public const uint TLUpdateEncryption = 0xb4a2e88d; public const uint TLUpdateEncryptedMessagesRead = 0x38fe25b7; public const uint TLEncryptedChatEmpty = 0xab7ec0a0; public const uint TLEncryptedChatWaiting = 0x3bf703dc; public const uint TLEncryptedChatRequested = 0xc878527e; public const uint TLEncryptedChat = 0xfa56ce36; public const uint TLEncryptedChatDiscarded = 0x13d6dd27; public const uint TLInputEncryptedChat = 0xf141b5e1; public const uint TLInputEncryptedFileEmpty = 0x1837c364; public const uint TLInputEncryptedFileUploaded = 0x64bd0306; public const uint TLInputEncryptedFile = 0x5a17b5e5; public const uint TLInputEncryptedFileLocation = 0xf5235d55; public const uint TLEncryptedFileEmpty = 0xc21f497e; public const uint TLEncryptedFile = 0x4a70994c; public const uint TLEncryptedMessage = 0xed18c118; public const uint TLEncryptedMessageService = 0x23734b06; public const uint TLDecryptedMessageActionSetMessageTTL = 0xa1733aec; public const uint TLDecryptedMessageMediaEmpty = 0x089f5c4a; public const uint TLDecryptedMessageMediaPhoto = 0x32798a8c; public const uint TLDecryptedMessageMediaVideo = 0x4cee6ef3; public const uint TLDecryptedMessageMediaGeoPoint = 0x35480a59; public const uint TLDecryptedMessageMediaContact = 0x588a0a97; public const uint TLDHConfig = 0x2c221edd; public const uint TLDHConfigNotModified = 0xc0e24635; public const uint TLSentEncryptedMessage = 0x560f8935; public const uint TLSentEncryptedFile = 0x9493ff32; public const uint TLRPCAnswerUnknown = 0x5e2ad36e; public const uint TLRPCAnswerDroppedRunning = 0xcd78e586; public const uint TLRPCAnswerDropped = 0xa43ad8b7; public const uint TLMessageDetailedInfo = 0x276d3ec6; public const uint TLMessageNewDetailedInfo = 0x809db6df; public const uint TLMessagesAllInfo = 0x8cc0d131; public const uint TLInvokeAfterMsg = 0xcb9f372d; public const uint TLDifferenceEmpty = 0x5d75a138; public const uint TLDifference = 0xf49ca0; public const uint TLDifferenceSlice = 0xa8fb1981; public const uint TLUpdateNewMessage = 0x013abdb3; public const uint TLUpdateMessageId = 0x4e90bfd6; public const uint TLUpdateReadMessages = 0xc6649e31; public const uint TLUpdateDeleteMessages = 0xa92bfe26; public const uint TLUpdateRestoreMessages = 0xd15de04d; public const uint TLUpdateUserTyping = 0x6baa8508; public const uint TLUpdateChatUserTyping = 0x3c46cfe6; public const uint TLUpdateChatParticipants = 0x07761198; public const uint TLUpdateUserStatus = 0x1bfbd823; public const uint TLUpdateUserName = 0xa7332b73; public const uint TLUpdateUserPhoto = 0x95313b0c; public const uint TLUpdateContactRegistered = 0x2575bbb9; public const uint TLUpdateContactLink = 0x51a48a9a; public const uint TLUpdateActivation = 0x6f690963; public const uint TLUpdateNewAuthorization = 0x8f06529a; public const uint TLUpdateDCOptions = 0x8e5e9873; public const uint TLUpdatesTooLong = 0xe317af7e; public const uint TLUpdateShortMessage = 0xd3f45784; public const uint TLUpdateShortChatMessage = 0x2b2fbd4e; public const uint TLUpdateShort = 0x78d4dec1; public const uint TLUpdatesCombined = 0x725b04c3; public const uint TLUpdates = 0x74ae4240; public const uint TLFutureSalt = 0x0949d9dc; public const uint TLFutureSalts = 0xae500895; public const uint TLGzipPacked = 0x3072cfa1; public const uint TLState = 0xa56c2a3e; public const uint TLFileTypeUnknown = 0xaa963b05; public const uint TLFileTypeJpeg = 0x7efe0e; public const uint TLFileTypeGif = 0xcae1aadf; public const uint TLFileTypePng = 0x0a4f63c0; public const uint TLFileTypeMp3 = 0x528a0677; public const uint TLFileTypeMov = 0x4b09ebbc; public const uint TLFileTypePartial = 0x40bc6f52; public const uint TLFileTypeMp4 = 0xb3cea0e4; public const uint TLFileTypeWebp = 0x1081464c; public const uint TLFile = 0x096a18d5; public const uint TLInputFileLocation = 0x14637196; public const uint TLInputVideoFileLocation = 0x3d0364ec; public const uint TLInviteText = 0x18cb9f78; public const uint TLDHGenOk = 0x3bcbf734; public const uint TLDHGenRetry = 0x46dc1fb9; public const uint TLDHGenFail = 0xa69dae02; public const uint TLServerDHInnerData = 0xb5890dba; public const uint TLServerDHParamsFail = 0x79cb045d; public const uint TLServerDHParamsOk = 0xd0e8075c; public const uint TLPQInnerData = 0x83c95aec; public const uint TLPQInnerDataDC = 0xa9f55f95; public const uint TLResPQ = 0x05162463; public const uint TLContactsBlocked = 0x1c138d15; public const uint TLContactsBlockedSlice = 0x900802a1; public const uint TLContactBlocked = 0x561bc879; public const uint TLImportedContacts = 0xad524315; public const uint TLImportedContact = 0xd0028438; public const uint TLInputContact = 0xf392b7f4; public const uint TLContactStatus = 0xaa77b873; public const uint TLForeignLinkUnknown = 0x133421f8; public const uint TLForeignLinkRequested = 0xa7801f47; public const uint TLForeignLinkMutual = 0x1bea8ce1; public const uint TLMyLinkEmpty = 0xd22a1c60; public const uint TLMyLinkRequested = 0x6c69efee; public const uint TLMyLinkContact = 0xc240ebd9; public const uint TLLink = 0xeccea3f5; public const uint TLUserFull = 0x771095da; public const uint TLPhotos = 0x8dca6aa5; public const uint TLPhotosSlice = 0x15051f54; public const uint TLPhotosPhoto = 0x20212ca8; public const uint TLInputPeerNotifyEventsEmpty = 0xf03064d8; public const uint TLInputPeerNotifyEventsAll = 0xe86a2c74; public const uint TLInputPeerNotifySettings = 0x46a2ce98; public const uint TLInputNotifyPeer = 0xb8bc5b0c; public const uint TLInputNotifyUsers = 0x193b4417; public const uint TLInputNotifyChats = 0x4a95e84e; public const uint TLInputNotifyAll = 0xa429b886; public const uint TLInputUserEmpty = 0xb98886cf; public const uint TLInputUserSelf = 0xf7c1b13f; public const uint TLInputUserContact = 0x86e94f65; public const uint TLInputUserForeign = 0x655e74ff; public const uint TLInputPhotoCropAuto = 0xade6b004; public const uint TLInputPhotoCrop = 0xd9915325; public const uint TLInputChatPhotoEmpty = 0x1ca48f57; public const uint TLInputChatUploadedPhoto = 0x94254732; public const uint TLInputChatPhoto = 0xb2e1bf08; public const uint TLMessagesChatFull = 0xe5d7d19c; public const uint TLChatFull = 0x630e61be; public const uint TLChatParticipant = 0xc8d7493e; public const uint TLChatParticipantsForbidden = 0x0fd2bb8a; public const uint TLChatParticipants = 0x7841b415; public const uint TLPeerNotifySettingsEmpty = 0x70a68512; public const uint TLPeerNotifySettings = 0x8d5e11ee; public const uint TLPeerNotifyEventsEmpty = 0xadd53cb3; public const uint TLPeerNotifyEventsAll = 0x6d1ded88; public const uint TLChats = 0x8150cbd8; public const uint TLMessages = 0x8c718e87; public const uint TLMessagesSlice = 0x0b446ae3; public const uint TLExportedAuthorization = 0xdf969c2d; public const uint TLInputFile = 0xf52ff27f; public const uint TLInputPhotoEmpty = 0x1cd7bf0d; public const uint TLInputPhoto = 0xfb95c6c4; public const uint TLInputGeoPointEmpty = 0xe4c123d6; public const uint TLInputGeoPoint = 0xf3b7acc9; public const uint TLInputVideoEmpty = 0x5508ec75; public const uint TLInputVideo = 0xee579652; public const uint TLInputMediaEmpty = 0x9664f57f; public const uint TLInputMediaUploadedPhoto = 0x2dc53a7d; public const uint TLInputMediaPhoto = 0x8f2ab2ec; public const uint TLInputMediaGeoPoint = 0xf9c44144; public const uint TLInputMediaContact = 0xa6e45987; public const uint TLInputMediaUploadedVideo = 0x133ad6f6; public const uint TLInputMediaUploadedThumbVideo = 0x9912dabf; public const uint TLInputMediaVideo = 0x7f023ae6; public const uint TLInputMessageFilterEmpty = 0x57e2f66c; public const uint TLInputMessageFilterPhoto = 0x9609a51c; public const uint TLInputMessageFilterVideo = 0x9fc00e65; public const uint TLInputMessageFilterPhotoVideo = 0x56e9f0e4; public const uint TLInputMessageFilterPhotoVideoDocument = 0xd95e73bb; public const uint TLInputMessageFilterDocument = 0x9eddf188; public const uint TLInputMessageFilterAudio = 0xcfc87522; public const uint TLInputMessageFilterAudioDocuments = 0x5afbf764; public const uint TLInputMessageFilterUrl = 0x7ef0dd87; public const uint TLStatedMessage = 0xd07ae726; public const uint TLStatedMessageLink = 0xa9af2881; public const uint TLStatedMessages = 0x969478bb; public const uint TLStatedMessagesLinks = 0x3e74f5c6; public const uint TLAffectedHistory = 0xb7de36f2; public const uint TLNull = 0x56730bcc; public const uint TLChatEmpty = 0x9ba2d800; public const uint TLChat = 0x6e9c9bc7; public const uint TLChatForbidden = 0xfb0ccc41; public const uint TLSentMessage = 0xd1f4d35c; public const uint TLSentMessageLink = 0xe9db4a3f; public const uint TLMessageEmpty = 0x83e5de54; public const uint TLMessage = 0x22eb6aba; public const uint TLMessageForwarded = 0x05f46804; public const uint TLMessageService = 0x9f8d60bb; public const uint TLMessageMediaEmpty = 0x3ded6320; public const uint TLMessageMediaPhoto = 0xc8c45a2a; public const uint TLMessageMediaVideo = 0xa2d24290; public const uint TLMessageMediaGeo = 0x56e0d474; public const uint TLMessageMediaContact = 0x5e7d2f39; public const uint TLMessageMediaUnsupported = 0x29632a36; public const uint TLMessageActionEmpty = 0xb6aef7b0; public const uint TLMessageActionChatCreate = 0xa6638b9a; public const uint TLMessageActionChatEditTitle = 0xb5a1ce5a; public const uint TLMessageActionChatEditPhoto = 0x7fcb13a8; public const uint TLMessageActionChatDeletePhoto = 0x95e3fbef; public const uint TLMessageActionChatAddUser = 0x5e3cfc4b; public const uint TLMessageActionChatDeleteUser = 0xb2ae9b0c; public const uint TLPhotoEmpty = 0x2331b22d; public const uint TLPhoto = 0x22b56751; public const uint TLPhotoSizeEmpty = 0x0e17e23c; public const uint TLPhotoSize = 0x77bfb61b; public const uint TLPhotoCachedSize = 0xe9a734fa; public const uint TLVideoEmpty = 0xc10658a8; public const uint TLVideo = 0x388fa391; public const uint TLGeoPointEmpty = 0x1117dd5f; public const uint TLGeoPoint = 0x2049d70c; public const uint TLDialogs = 0x15ba6c40; public const uint TLDialogsSlice = 0x71e094f3; public const uint TLDialog = 0xab3a99ac; public const uint TLInputPeerEmpty = 0x7f3b18ea; public const uint TLInputPeerSelf = 0x7da07ec9; public const uint TLInputPeerContact = 0x1023dbe8; public const uint TLInputPeerForeign = 0x9b447325; public const uint TLInputPeerChat = 0x179be863; public const uint TLPeerUser = 0x9db1bc6d; public const uint TLPeerChat = 0xbad0e5bb; public const uint TLVector = 0x1cb5c415; public const uint TLUserStatusEmpty = 0x09d05049; public const uint TLUserStatusOnline = 0xedb93949; public const uint TLUserStatusOffline = 0x8c703f; public const uint TLChatPhotoEmpty = 0x37c1011c; public const uint TLChatPhoto = 0x6153276a; public const uint TLUserProfilePhotoEmpty = 0x4f11bae1; public const uint TLUserProfilePhoto = 0xd559d8c8; public const uint TLUserEmpty = 0x200250ba; public const uint TLUserSelf = 0x720535ec; public const uint TLUserContact = 0xf2fb8319; public const uint TLUserRequest = 0x22e8ceb0; public const uint TLUserForeign = 0x5214c89d; public const uint TLUserDeleted = 0xb29ad7cc; public const uint TLSentCode = 0xefed51d9; public const uint TLRPCResult = 0xf35c6d01; public const uint TLRPCError = 0x2144ca19; public const uint TLRPCReqError = 0x7ae432f5; public const uint TLNewSessionCreated = 0x9ec20908; public const uint TLNearestDC = 0x8e1a1775; public const uint TLMessagesAcknowledgment = 0x62d6b459; public const uint TLContainer = 0x73f1f8dc; public const uint TLFileLocationUnavailable = 0x7c596b46; public const uint TLFileLocation = 0x53d69076; public const uint TLDCOption = 0x2ec2a43c; public const uint TLContacts = 0x6f8b8cb2; public const uint TLContactsNotModified = 0xb74ba9d2; public const uint TLContact = 0xf911c994; public const uint TLConfig = 0x2e54dd74; public const uint TLConfig23 = 0x7dae33e0; public const uint TLCheckedPhone = 0xe300cc3b; public const uint TLBadServerSalt = 0xedab447b; public const uint TLBadMessageNotification = 0xa7eff811; public const uint TLAuthorization = 0xf6b673a4; public const uint TLWallPaper = 0xccb03657; public const uint TLWallPaperSolid = 0x63117f24; public const uint TLPing = 0x7abe77ec; public const uint TLPong = 0x347773c5; public const uint TLPingDelayDisconnect = 0xf3427b8c; public const uint TLContactFound = 0xea879f95; public const uint TLContactsFound = 0x566000e; // layer 16 public const uint TLSentAppCode = 0xe325edcf; // layer 17 public const uint TLSendMessageTypingAction = 0x16bf744e; public const uint TLSendMessageCancelAction = 0xfd5ec8f5; public const uint TLSendMessageRecordVideoAction = 0xa187d66f; public const uint TLSendMessageUploadVideoAction = 0x92042ff7; public const uint TLSendMessageRecordAudioAction = 0xd52f73f7; public const uint TLSendMessageUploadAudioAction = 0xe6ac8a6f; public const uint TLSendMessageUploadPhotoAction = 0x990a3c1a; public const uint TLSendMessageUploadDocumentAction = 0x8faee98e; public const uint TLSendMessageGeoLocationAction = 0x176f8ba1; public const uint TLSendMessageChooseContactAction = 0x628cbc6f; public const uint TLUpdateUserTyping17 = 0x5c486927; public const uint TLUpdateChatUserTyping17 = 0x9a65ea1f; public const uint TLMessage17 = 0x567699b3; public const uint TLMessageForwarded17 = 0xa367e716; public const uint TLMessageService17 = 0x1d86f70e; // layer 17 encrypted public const uint TLDecryptedMessage17 = 0x204d3878; public const uint TLDecryptedMessageService17 = 0x73164160; public const uint TLDecryptedMessageMediaVideo17 = 0x524a415d; public const uint TLDecryptedMessageMediaAudio17 = 0x57e0a9cb; public const uint TLDecryptedMessageLayer17 = 0x1be31789; public const uint TLDecryptedMessageActionResend = 0x511110b0; public const uint TLDecryptedMessageActionTyping = 0xccb27641; // layer 18 public const uint TLUpdateServiceNotification = 0x382dd3e4; public const uint TLUserSelf18 = 0x7007b451; public const uint TLUserContact18 = 0xcab35e18; public const uint TLUserRequest18 = 0xd9ccc4ef; public const uint TLUserForeign18 = 0x75cf7a8; public const uint TLUserDeleted18 = 0xd6016d7a; // layer 19 public const uint TLUserStatusRecently = 0xe26f42f1; public const uint TLUserStatusLastWeek = 0x7bf09fc; public const uint TLUserStatusLastMonth = 0x77ebc742; public const uint TLContactStatus19 = 0xd3680c61; public const uint TLUpdatePrivacy = 0xee3b272a; public const uint TLInputPrivacyKeyStatusTimestamp = 0x4f96cb18; public const uint TLPrivacyKeyStatusTimestamp = 0xbc2eab30; public const uint TLInputPrivacyValueAllowContacts = 0xd09e07b; public const uint TLInputPrivacyValueAllowAll = 0x184b35ce; public const uint TLInputPrivacyValueAllowUsers = 0x131cc67f; public const uint TLInputPrivacyValueDisallowContacts = 0xba52007; public const uint TLInputPrivacyValueDisallowAll = 0xd66b66c9; public const uint TLInputPrivacyValueDisallowUsers = 0x90110467; public const uint TLPrivacyValueAllowContacts = 0xfffe1bac; public const uint TLPrivacyValueAllowAll = 0x65427b82; public const uint TLPrivacyValueAllowUsers = 0x4d5bbe0c; public const uint TLPrivacyValueDisallowContacts = 0xf888fa1a; public const uint TLPrivacyValueDisallowAll = 0x8b73e763; public const uint TLPrivacyValueDisallowUsers = 0xc7f49b7; public const uint TLPrivacyRules = 0x554abb6f; public const uint TLAccountDaysTTL = 0xb8d0afdf; // layer 20 public const uint TLSentChangePhoneCode = 0xa4f58c4c; public const uint TLUpdateUserPhone = 0x12b9417b; // layer 20 encrypted public const uint TLDecryptedMessageActionRequestKey = 0xf3c9611b; public const uint TLDecryptedMessageActionAcceptKey = 0x6fe1735b; public const uint TLDecryptedMessageActionAbortKey = 0xdd05ec6b; public const uint TLDecryptedMessageActionCommitKey = 0xec2e0b9b; public const uint TLDecryptedMessageActionNoop = 0xa82fdd63; // layer 21 // layer 22 public const uint TLInputMediaUploadedDocument22 = 0xffe76b78; public const uint TLInputMediaUploadedThumbDocument22 = 0x41481486; public const uint TLDocument22 = 0xf9a39f4f; public const uint TLDocumentAttributeImageSize = 0x6c37c15c; public const uint TLDocumentAttributeAnimated = 0x11b58939; public const uint TLDocumentAttributeSticker = 0xfb0a5727; public const uint TLDocumentAttributeVideo = 0x5910cccb; public const uint TLDocumentAttributeAudio = 0x51448e5; public const uint TLDocumentAttributeFileName = 0x15590068; public const uint TLStickersNotModified = 0xf1749a22; public const uint TLStickers = 0x8a8ecd32; public const uint TLStickerPack = 0x12b299d4; public const uint TLAllStickersNotModified = 0xe86602c3; public const uint TLAllStickers = 0xdcef3102; // layer 23 public const uint TLDisabledFeature = 0xae636f24; // layer 23 encrypted public const uint TLDecryptedMessageMediaExternalDocument = 0xfa95b0dd; // layer 24 public const uint TLUpdateNewMessage24 = 0x1f2b0afd; public const uint TLUpdateReadMessages24 = 0x2e5ab668; public const uint TLUpdateDeleteMessages24 = 0xa20db0e5; public const uint TLUpdateShortMessage24 = 0xb87da3b1; public const uint TLUpdateShortChatMessage24 = 0x20e85ded; public const uint TLUpdateReadHistoryInbox = 0x9961fd5c; public const uint TLUpdateReadHistoryOutbox = 0x2f2f21bf; public const uint TLDialog24 = 0xc1dd804a; public const uint TLStatedMessages24 = 0x7d84b48; public const uint TLStatedMessagesLinks24 = 0x51be5d19; public const uint TLStatedMessage24 = 0x96240c6a; public const uint TLStatedMessageLink24 = 0x948a288; public const uint TLSentMessage24 = 0x900eac40; public const uint TLSentMessageLink24 = 0xe923400d; public const uint TLAffectedMessages = 0x84d19185; public const uint TLAffectedHistory24 = 0xb45c69d1; public const uint TLMessageMediaUnsupported24 = 0x9f84f49e; public const uint TLChats24 = 0x64ff9fd5; public const uint TLUserSelf24 = 0x1c60e608; public const uint TLCheckedPhone24 = 0x811ea28e; public const uint TLContactLinkUnknown = 0x5f4f9247; public const uint TLContactLinkNone = 0xfeedd3ad; public const uint TLContactLinkHasPhone = 0x268f3f59; public const uint TLContactLink = 0xd502c2d0; public const uint TLUpdateContactLink24 = 0x9d2e67c5; public const uint TLLink24 = 0x3ace484c; public const uint TLConfig24 = 0x3e6f732a; // layer 25 public const uint TLMessage25 = 0xa7ab1991; public const uint TLDocumentAttributeSticker25 = 0x994c9882; public const uint TLUpdatesShortMessage25 = 0xed5c2127; public const uint TLUpdatesShortChatMessage25 = 0x52238b3c; // layer 26 public const uint TLSentMessage26 = 0x4c3d47f3; public const uint TLSentMessageLink26 = 0x35a1a663; public const uint TLConfig26 = 0x68bac247; public const uint TLUpdateWebPage = 0x2cc36971; public const uint TLWebPageEmpty = 0xeb1477e8; public const uint TLWebPagePending = 0xc586da1c; public const uint TLWebPage = 0xa31ea0b5; public const uint TLMessageMediaWebPage = 0xa32dd600; public const uint TLAccountAuthorization = 0x7bf2e6f6; public const uint TLAccountAuthorizations = 0x1250abde; // layer 27 public const uint TLNoPassword = 0x96dabc18; public const uint TLPassword = 0x7c18141c; public const uint TLPasswordSettings = 0xb7b72ab3; public const uint TLPasswordInputSettings = 0x86916deb; //0xbcfc532c; public const uint TLPasswordRecovery = 0x137948a5; // layer 28 public const uint TLInvokeWithoutUpdates = 0xbf9459b7; public const uint TLInputMediaUploadedPhoto28 = 0xf7aff1c0; public const uint TLInputMediaPhoto28 = 0xe9bfb4f3; public const uint TLInputMediaUploadedVideo28 = 0xe13fd4bc; public const uint TLInputMediaUploadedThumbVideo28 = 0x96fb97dc; public const uint TLInputMediaVideo28 = 0x936a4ebd; public const uint TLSendMessageUploadVideoAction28 = 0xe9763aec; public const uint TLSendMessageUploadAudioAction28 = 0xf351d7ab; public const uint TLSendMessageUploadDocumentAction28 = 0xaa0cd9e4; public const uint TLSendMessageUploadPhotoAction28 = 0xd1d34a26; public const uint TLInputMediaVenue = 0x2827a81a; public const uint TLMessageMediaVenue = 0x7912b71f; public const uint TLReceivedNotifyMessage = 0xa384b779; public const uint TLChatInviteEmpty = 0x69df3769; public const uint TLChatInviteExported = 0xfc2e05bc; public const uint TLChatInviteAlready = 0x5a686d7c; public const uint TLChatInvite = 0xce917dcd; public const uint TLMessageActionChatJoinedByLink = 0xf89cf5e8; public const uint TLUpdateReadMessagesContents = 0x68c13933; public const uint TLChatFull28 = 0xcade0791; public const uint TLConfig28 = 0x4e32b894; public const uint TLMessageMediaPhoto28 = 0x3d8ce53d; public const uint TLMessageMediaVideo28 = 0x5bcf1675; public const uint TLPhoto28 = 0xc3838076; public const uint TLVideo28 = 0xee9f4a4d; // layer 29 public const uint TLDocumentAttributeSticker29 = 0x3a556302; public const uint TLAllStickers29 = 0x5ce352ec; public const uint TLInputStickerSetEmpty = 0xffb62b95; public const uint TLInputStickerSetId = 0x9de7a269; public const uint TLInputStickerSetShortName = 0x861cc8a0; public const uint TLStickerSet = 0xa7a43b17; public const uint TLMessagesStickerSet = 0xb60a24a6; // layer 30 public const uint TLDCOption30 = 0x5d8c6cc; // layer 31 public const uint TLAuthorization31 = 0xff036af1; public const uint TLMessage31 = 0xc3060325; public const uint TLChatFull31 = 0x2e02a614; public const uint TLUserFull31 = 0x5a89ac5b; public const uint TLUser = 0x22e49072; public const uint TLBotCommand = 0xc27ac8c7; public const uint TLBotInfoEmpty = 0xbb2e37ce; public const uint TLBotInfo = 0x9cf585d; public const uint TLKeyboardButton = 0xa2fa4880; public const uint TLKeyboardButtonRow = 0x77608b83; public const uint TLReplyKeyboardMarkup = 0x3502758c; public const uint TLReplyKeyboardHide = 0xa03e5b85; public const uint TLReplyKeyboardForceReply = 0xf4108aa0; // layer 32 public const uint TLDocumentAttributeAudio32 = 0xded218e0; public const uint TLAllStickers32 = 0xd51dafdb; public const uint TLStickerSet32 = 0xcd303b41; // layer 33 public const uint TLInputPeerUser = 0x7b8e7de6; public const uint TLInputUser = 0xd8292816; public const uint TLPhoto33 = 0xcded42fe; public const uint TLVideo33 = 0xf72887d3; public const uint TLAudio33 = 0xf9e35055; public const uint TLAppChangelogEmpty = 0xaf7e0394; public const uint TLAppChangelog = 0x4668e6bd; // layer 34 public const uint TLMessageEntityUnknown = 0xbb92ba95; public const uint TLMessageEntityMention = 0xfa04579d; public const uint TLMessageEntityHashtag = 0x6f635b0d; public const uint TLMessageEntityBotCommand = 0x6cef8ac7; public const uint TLMessageEntityUrl = 0x6ed02538; public const uint TLMessageEntityEmail = 0x64e475c2; public const uint TLMessageEntityBold = 0xbd610bc9; public const uint TLMessageEntityItalic = 0x826f8b60; public const uint TLMessageEntityCode = 0x28a20571; public const uint TLMessageEntityPre = 0x73924be0; public const uint TLMessageEntityTextUrl = 0x76a6d327; public const uint TLMessage34 = 0xf07814c8; public const uint TLSentMessage34 = 0x8a99d8e0; public const uint TLUpdatesShortMessage34 = 0x3f32d858; public const uint TLUpdatesShortChatMessage34 = 0xf9409b3d; // layer 35 public const uint TLWebPage35 = 0xca820ed7; // layer 36 public const uint TLInputMediaUploadedVideo36 = 0x82713fdf; public const uint TLInputMediaUploadedThumbVideo36 = 0x7780ddf9; public const uint TLMessage36 = 0x2bebfa86; public const uint TLUpdatesShortSentMessage = 0x11f1331c; // layer 37 public const uint TLChatParticipantsForbidden37 = 0xfc900c2b; public const uint TLUpdateChatParticipantAdd37 = 0xea4b0e5c; public const uint TLUpdateWebPage37 = 0x7f891213; // layer 40 public const uint TLInputPeerChannel = 0x20adaef8; public const uint TLPeerChannel = 0xbddde532; public const uint TLChat40 = 0x7312bc48; public const uint TLChatForbidden40 = 0x7328bdb; public const uint TLChannel = 0x678e9587; //0x1bcc63f2; public const uint TLChannelForbidden = 0x2d85832c; public const uint TLChannelFull = 0xfab31aa3; //0xf6945b65; public const uint TLChannelParticipants40 = 0xb561ad0c; public const uint TLMessage40 = 0x5ba66c13; public const uint TLMessageService40 = 0xc06b9607; public const uint TLMessageActionChannelCreate = 0x95d2ac92; public const uint TLMessageActionToggleComments = 0xf2863903; public const uint TLDialogChannel = 0x5b8496b2; public const uint TLChannelMessages = 0xbc0f17bc; public const uint TLUpdateChannelTooLong = 0x60946422; public const uint TLUpdateChannelGroup = 0xc36c1e3c; public const uint TLUpdateNewChannelMessage = 0x62ba04d9; public const uint TLUpdateReadChannelInbox = 0x4214f37f;// 0x87b87b7d; public const uint TLUpdateDeleteChannelMessages = 0xc37521c9;// 0x11da3046; public const uint TLUpdateChannelMessageViews = 0x98a12b4b;//0xf3349b09; public const uint TLUpdateChannel = 0xb6d45656; public const uint TLUpdatesShortMessage40 = 0xf7d91a46; public const uint TLUpdatesShortChatMessage40 = 0xcac7fdd2; public const uint TLContactsFound40 = 0x1aa1f784; //public const uint TLInputChatEmpty = 0xd9ff343c; //public const uint TLInputChat = 0x43a5b9c3; public const uint TLInputChannel = 0xafeb712e;// 0x30c6ce73; public const uint TLInputChannelEmpty = 0xee8c1e86; public const uint TLMessageRange = 0xae30253; public const uint TLMessageGroup = 0xe8346f53; public const uint TLChannelDifferenceEmpty = 0x3e11affb; public const uint TLChannelDifferenceTooLong = 0x5e167646; public const uint TLChannelDifference = 0x2064674e; public const uint TLChannelMessagesFilterEmpty = 0x94d42ee7; public const uint TLChannelMessagesFilter = 0xcd77d957; public const uint TLChannelMessagesFilterCollapsed = 0xfa01232e; public const uint TLResolvedPeer = 0x7f077ad9; public const uint TLChannelParticipant = 0x15ebac1d; public const uint TLChannelParticipantSelf = 0xa3289a6d; public const uint TLChannelParticipantModerator = 0x91057fef; public const uint TLChannelParticipantEditor = 0x98192d61; public const uint TLChannelParticipantKicked = 0x8cc5e69a; public const uint TLChannelParticipantCreator = 0xe3e2e1f9; public const uint TLChannelParticipantsRecent = 0xde3f3c79; public const uint TLChannelParticipantsAdmins = 0xb4608969; public const uint TLChannelParticipantsKicked = 0x3c37bb7a; public const uint TLChannelRoleEmpty = 0xb285a0c6; public const uint TLChannelRoleModerator = 0x9618d975; public const uint TLChannelRoleEditor = 0x820bfe8c; public const uint TLChannelParticipants = 0xf56ee2a8; public const uint TLChannelsChannelParticipant = 0xd0d9b163; public const uint TLChatInvite40 = 0x93e99b60; public const uint TLChatParticipants40 = 0x3f460fed; public const uint TLChatParticipantCreator = 0xda13538a; public const uint TLChatParticipantAdmin = 0xe2d6e436; public const uint TLUpdateChatAdmins = 0x6e947941; public const uint TLUpdateChatParticipantAdmin = 0xb6901959; public const uint TLConfig41 = 0x6cb6e65e; public const uint TLMessageActionChatMigrateTo = 0x51bdb021; public const uint TLMessageActionChatDeactivate = 0x64ad20a8; public const uint TLMessageActionChatActivate = 0x40ad8cb2; public const uint TLMessageActionChannelMigrateFrom = 0xb055eaee; public const uint TLChannelParticipantsBots = 0xb0d1865b; public const uint TLChat41 = 0xd91cdd54; public const uint TLChannelFull41 = 0x9e341ddf; public const uint TLMessageActionChatAddUser41 = 0x488a7337; // layer 42 public const uint TLInputReportReasonSpam = 0x58dbcab8; public const uint TLInputReportReasonViolence = 0x1e22c78d; public const uint TLInputReportReasonPornography = 0x2e59d922; public const uint TLInputReportReasonOther = 0xe1746d0a; public const uint TLTermsOfService = 0xf1ee3e90; // layer 43 public const uint TLUpdateNewStickerSet = 0x688a30aa; public const uint TLUpdateStickerSetsOrder = 0xf0dfb451; public const uint TLUpdateStickerSets = 0x43ae3dec; public const uint TLAllStickers43 = 0xedfd405f; // layer 44 public const uint TLInputMediaGifExternal = 0x4843b0fd; public const uint TLUser44 = 0x603539b4; public const uint TLChannel44 = 0x4b1b7506; public const uint TLInputMessagesFilterGif = 0xffc86587; public const uint TLUpdateSavedGifs = 0x9375341e; public const uint TLConfig44 = 0x6bbc5f8; public const uint TLFoundGif = 0x162ecc1f; public const uint TLFoundGifCached = 0x9c750409; public const uint TLFoundGifs = 0x450a1c0a; public const uint TLSavedGifsNotModified = 0xe8025ca2; public const uint TLSavedGifs = 0x2e0709a5; // layer 45 public const uint TLInputMediaUploadedDocument45 = 0x1d89306d; public const uint TLInputMediaUploadedThumbDocument45 = 0xad613491; public const uint TLInputMediaDocument45 = 0x1a77f29c; public const uint TLUser45 = 0xd10d979a; public const uint TLMessage45 = 0xc992e15c; public const uint TLMessageMediaDocument45 = 0xf3e02ea8; public const uint TLUpdateBotInlineQuery = 0xc01eea08; public const uint TLUpdatesShortMessage45 = 0x13e4deaa; public const uint TLUpdatesShortChatMessage45 = 0x248afa62; public const uint TLInputBotInlineMessageMediaAuto = 0x2e43e587; public const uint TLInputBotInlineMessageText = 0xadf0df71; public const uint TLInputBotInlineResult = 0x2cbbe15a; public const uint TLBotInlineMessageMediaAuto = 0xfc56e87d; public const uint TLBotInlineMessageText = 0xa56197a9; public const uint TLBotInlineMediaResultDocument = 0xf897d33e; public const uint TLBotInlineMediaResultPhoto = 0xc5528587; public const uint TLBotInlineResult = 0x9bebaeb9; public const uint TLBotResults = 0x1170b0a3; // layer 46 public const uint TLDocumentAttributeAudio46 = 0x9852f9c6; public const uint TLInputMessagesFilterVoice = 0x50f5c392; public const uint TLInputMessagesFilterMusic = 0x3751b49e; public const uint TLInputPrivacyKeyChatInvite = 0xbdfb0426; public const uint TLPrivacyKeyChatInvite = 0x500e6dfa; // layer 48 public const uint TLMessage48 = 0xc09be45f; public const uint TLInputPeerNotifySettings48 = 0x38935eb2; public const uint TLPeerNotifySettings48 = 0x9acda4c0; public const uint TLUpdateEditChannelMessage = 0x1b3f4df7; public const uint TLUpdatesShortMessage48 = 0x914fbf11; public const uint TLUpdatesShortChatMessage48 = 0x16812688; public const uint TLConfig48 = 0x317ceef4; public const uint TLConfig54 = 0xf401a4bf; public const uint TLExportedMessageLink = 0x1f486803; public const uint TLMessageFwdHeader = 0xc786ddcb; public const uint TLMessageEditData = 0x26b5dde6; // layer 49 public const uint TLPeerSettings = 0x818426cd; public const uint TLMessageService49 = 0x9e19a1f6; public const uint TLMessageActionPinMessage = 0x94bd38ed; public const uint TLChannel49 = 0xa14dca52; public const uint TLChannelFull49 = 0x97bee562; public const uint TLUserFull49 = 0x5932fc03; public const uint TLBotInfo49 = 0x98e81d3a; public const uint TLUpdateChannelPinnedMessage = 0x98592475; public const uint TLUpdateChannelTooLong49 = 0xeb0467fb; // layer 50 public const uint TLSentCode50 = 0x5e002502; public const uint TLCodeTypeSms = 0x72a3158c; public const uint TLCodeTypeCall = 0x741cd3e3; public const uint TLCodeTypeFlashCall = 0x226ccefb; public const uint TLSentCodeTypeApp = 0x3dbb5986; public const uint TLSentCodeTypeSms = 0xc000bba2; public const uint TLSentCodeTypeCall = 0x5353e5a7; public const uint TLSentCodeTypeFlashCall = 0xab03c6d9; // layer 51 public const uint TLUpdateBotCallbackQuery = 0xa68c688c; public const uint TLUpdateInlineBotCallbackQuery = 0x2cbd95af; public const uint TLUpdateBotInlineQuery51 = 0x54826690; public const uint TLUpdateBotInlineSend = 0xe48f964; public const uint TLUpdateEditMessage = 0xe40370a3; public const uint TLKeyboardButtonUrl = 0x258aff05; public const uint TLKeyboardButtonCallback = 0x683a5e46; public const uint TLKeyboardButtonRequestPhone = 0xb16a6c29; public const uint TLKeyboardButtonRequestGeoLocation = 0xfc796b3f; public const uint TLKeyboardButtonSwitchInline = 0xea1b7a14; public const uint TLBotCallbackAnswer = 0x1264f1c6; public const uint TLReplyInlineMarkup = 0x48a30254; public const uint TLInputBotInlineMessageMediaAuto51 = 0x292fed13; public const uint TLInputBotInlineMessageText51 = 0x3dcd7a87; public const uint TLInputBotInlineMessageMediaGeo = 0xf4a59de1; public const uint TLInputBotInlineMessageMediaVenue = 0xaaafadc8; public const uint TLInputBotInlineMessageMediaContact = 0x2daf01a7; public const uint TLInputBotInlineResultPhoto = 0xa8d864a7; public const uint TLInputBotInlineResultDocument = 0xfff8fdc4; public const uint TLBotInlineMessageMediaAuto51 = 0xa74b15b; public const uint TLBotInlineMessageText51 = 0x8c7f65e2; public const uint TLBotInlineMessageMediaGeo = 0x3a8fd8b8; public const uint TLBotInlineMessageMediaVenue = 0x4366232e; public const uint TLBotInlineMessageMediaContact = 0x35edb4d4; public const uint TLBotInlineMediaResult = 0x17db940b; public const uint TLInputBotInlineMessageId = 0x890c3d89; public const uint TLBotResults51 = 0x256709a6; public const uint TLInlineBotSwitchPM = 0x3c20629f; // layer 52 public const uint TLConfig52 = 0xc9411388; public const uint TLMessageEntityMentionName = 0x352dca58; public const uint TLInputMessageEntityMentionName = 0x208e68c9; public const uint TLPeerDialogs = 0x3371c354; public const uint TLTopPeer = 0xedcdc05b; public const uint TLTopPeerCategoryBotsPM = 0xab661b5b; public const uint TLTopPeerCategoryBotsInline = 0x148677e2; public const uint TLTopPeerCategoryCorrespondents = 0x637b7ed; public const uint TLTopPeerCategoryGroups = 0xbd17a14a; public const uint TLTopPeerCategoryChannels = 0x161d9628; public const uint TLTopPeerCategoryPeers = 0xfb834291; public const uint TLTopPeersNotModified = 0xde266ef5; public const uint TLTopPeers = 0x70b772a8; // layer 53 public const uint TLInputMessagesFilterChatPhotos = 0x3a20ecb8; public const uint TLUpdateReadChannelOutbox = 0x25d6c9c7; public const uint TLChannelFull53 = 0xc3d5512f; public const uint TLDialog53 = 0x66ffba14; public const uint TLChannelMessages53 = 0x99262e37; public const uint TLUpdateDraftMessage = 0xee2bb969; public const uint TLChannelDifferenceTooLong53 = 0x410dee07; public const uint TLChannelMessagesFilter53 = 0xcd77d957; public const uint TLDraftMessageEmpty = 0xba4baec5; public const uint TLDraftMessage = 0xfd8e711f; public const uint TLChannelForbidden53 = 0x8537784f; public const uint TLMessageActionClearHistory = 0x9fbab604; // layer 54 public const uint TLFeaturedStickersNotModified = 0x4ede3cf; public const uint TLUpdateReadFeaturedStickers = 0x571d2742; public const uint TLBotCallbackAnswer54 = 0xb10df1fb; //0x31fde6e4; public const uint TLInputDocumentFileLocation54 = 0x430f0724; public const uint TLDocument54 = 0x87232bc7; public const uint TLUpdateRecentStickers = 0x9a422c20; public const uint TLRecentStickersNotModified = 0xb17f890; public const uint TLRecentStickers = 0x5ce20970; public const uint TLChatInvite54 = 0xdb74f558; public const uint TLStickerSetInstallResult = 0x38641628; public const uint TLStickerSetInstallResultArchive = 0x35e410a8; public const uint TLFeaturedStickers = 0xf89d88e5; public const uint TLArchivedStickers = 0x4fcba9c8; public const uint TLStickerSetCovered = 0x6410a5d2; // layer 55 public const uint TLInputMediaPhotoExternal = 0xb55f4f18; public const uint TLInputMediaDocumentExternal = 0xe5e9607c; public const uint TLAuthorization55 = 0xcd050916; public const uint TLUpdateConfig = 0xa229dd06; public const uint TLUpdatePtsChanged = 0x3354678f; public const uint TLConfig55 = 0x9a6b2e2a; public const uint TLKeyboardButtonSwitchInline55 = 0x568a748; // layer 56 public const uint TLUpdateBotCallbackQuery56 = 0x81c5615f; public const uint TLUpdateInlineBotCallbackQuery56 = 0xd618a28b; public const uint TLUpdateStickerSetsOrder56 = 0xbb2d201; public const uint TLStickerSetMultiCovered = 0x3407e51b; public const uint TLInputMediaUploadedPhoto56 = 0x630c9af1; public const uint TLInputMediaUploadedDocument56 = 0xd070f1e9; public const uint TLInputMediaUploadedThumbDocument56 = 0x50d88cae; public const uint TLPhoto56 = 0x9288dd29; public const uint TLDocumentAttributeSticker56 = 0x6319d612; public const uint TLDocumentAttributeHasStickers = 0x9801d2f7; public const uint TLMaskCoords = 0xaed6dbb2; public const uint TLInputStickeredMediaPhoto = 0x4a992157; public const uint TLInputStickeredMediaDocument = 0x438865b; public const uint TLInputChatUploadedPhoto56 = 0x927c55b4; public const uint TLInputChatPhoto56 = 0x8953ad37; // layer 57 public const uint TLInputMediaGame = 0xd33f43f3; public const uint TLInputGameId = 0x32c3e77; public const uint TLInputGameShortName = 0xc331e80a; public const uint TLGame = 0xbdf9653b; public const uint TLHighScore = 0x58fffcd0; public const uint TLHighScores = 0x9a3bfd99; public const uint TLInputBotInlineMessageGame = 0x4b425864; public const uint TLInputBotInlineResultGame = 0x4fa417f2; public const uint TLKeyboardButtonGame = 0x50f41ccf; public const uint TLMessageActionGameScore = 0x92a72876; public const uint TLMessageMediaGame = 0xfdb19008; // layer 58 public const uint TLUserFull58 = 0xf220f3f; public const uint TLChatsSlice = 0x78f69146; public const uint TLUpdateChannelWebPage = 0x40771900; public const uint TLDifferenceTooLong = 0x4afe8f6d; public const uint TLBotResults58 = 0xccd3563d; public const uint TLBotCallbackAnswer58 = 0x36585ea4; // layer 59 public const uint TLChatsSlice59 = 0x9cd81144; public const uint TLUpdateServiceNotification59 = 0xebe46819; public const uint TLWebPage59 = 0x5f07b4bc; public const uint TLWebPageNotModified = 0x85849473; public const uint TLAppChangelog59 = 0x2a137e7c; public const uint TLTextEmpty = 0xdc3d824f; public const uint TLTextPlain = 0x744694e0; public const uint TLTextBold = 0x6724abc4; public const uint TLTextItalic = 0xd912a59c; public const uint TLTextUnderline = 0xc12622c4; public const uint TLTextStrike = 0x9bf8bb95; public const uint TLTextFixed = 0x6c3f19b9; public const uint TLTextUrl = 0x3c2884c1; public const uint TLTextEmail = 0xde5a0dd6; public const uint TLTextConcat = 0x7e6260d7; public const uint TLPageBlockUnsupported = 0x13567e8a; public const uint TLPageBlockTitle = 0x70abc3fd; public const uint TLPageBlockSubtitle = 0x8ffa9a1f; public const uint TLPageBlockAuthorDate = 0x3d5b64f2; public const uint TLPageBlockHeader = 0xbfd064ec; public const uint TLPageBlockSubheader = 0xf12bb6e1; public const uint TLPageBlockParagraph = 0x467a0766; public const uint TLPageBlockPreformatted = 0xc070d93e; public const uint TLPageBlockFooter = 0x48870999; public const uint TLPageBlockDivider = 0xdb20b188; public const uint TLPageBlockAnchor = 0xce0d37b0; public const uint TLPageBlockList = 0x3a58c7f4; public const uint TLPageBlockBlockquote = 0x263d7c26; public const uint TLPageBlockPullquote = 0x4f4456d3; public const uint TLPageBlockPhoto = 0xe9c69982; public const uint TLPageBlockVideo = 0xd9d71866; public const uint TLPageBlockCover = 0x39f23300; public const uint TLPageBlockEmbed = 0xd935d8fb; public const uint TLPageBlockEmbedPost = 0x292c7be9; public const uint TLPageBlockCollage = 0x8b31c4f; public const uint TLPageBlockSlideshow = 0x130c8963; public const uint TLPagePart = 0x8dee6c44; public const uint TLPageFull = 0xd7a19d69; // layer 60 public const uint TLUpdatePhoneCall = 0xab0f6b1e; public const uint TLConfig60 = 0xb6735d71; public const uint TLSendMessageGamePlayAction = 0xdd6a8f48; public const uint TLInputPrivacyKeyPhoneCall = 0xfabadc5f; public const uint TLPrivacyKeyPhoneCall = 0x3d662b7b; public const uint TLInputPhoneCall = 0x1e36fded; public const uint TLPhoneCallEmpty = 0x5366c915; public const uint TLPhoneCallWaiting = 0x1b8f4ad1; public const uint TLPhoneCallRequested = 0x6c448ae8; public const uint TLPhoneCall = 0xffe6ab67; public const uint TLPhoneCallDiscarded = 0xcc3740bd; public const uint TLPhoneConnection = 0x6b7411c9; public const uint TLPhoneCallProtocol = 0xa2bb35cb; public const uint TLPhonePhoneCall = 0xec82e140; // layer 61 public const uint TLUpdateDialogPinned = 0xd711a2cc; public const uint TLUpdatePinnedDialogs = 0xd8caf68d; public const uint TLConfig61 = 0x3af6fb5f; public const uint TLPageBlockAuthorDate61 = 0xbaafe5e0; public const uint TLPageBlockEmbed61 = 0xcde200d1; public const uint TLPhoneCallDiscarded61 = 0x50ca4de1; public const uint TLPhoneConnection61 = 0x9d4c17c0; public const uint TLPhoneCallDiscardReasonMissed = 0x85e42301; public const uint TLPhoneCallDiscardReasonDisconnect = 0xe095c1a0; public const uint TLPhoneCallDiscardReasonHangup = 0x57adc690; public const uint TLPhoneCallDiscardReasonBusy = 0xfaf7e8c9; // layer 62 public const uint TLMessageActionPhoneCall = 0x80e11a7f; public const uint TLInputMessagesFilterPhoneCalls = 0x80c99768; public const uint TLUpdateBotWebhookJSON = 0x8317c0c3; public const uint TLUpdateBotWebhookJSONQuery = 0x9b9240a6; public const uint TLDataJSON = 0x7d748d04; // layer 63 public const uint TLConfig63 = 0xcb601684; // layer 64 public const uint TLInputMediaInvoice = 0x92153685; public const uint TLMessageMediaInvoice = 0x84551347; public const uint TLMessageActionPaymentSentMe = 0x8f31b327; public const uint TLMessageActionPaymentSent = 0x40699cd0; public const uint TLUpdateBotShippingQuery = 0xe0cdc940; public const uint TLUpdateBotPrecheckoutQuery = 0x5d2f3aa9; public const uint TLKeyboardButtonBuy = 0xafd93fbb; public const uint TLLabeledPrice = 0xcb296bf8; public const uint TLInvoice = 0xc30aa358; public const uint TLPaymentCharge = 0xea02c27e; public const uint TLPostAddress = 0x1e8caaeb; public const uint TLPaymentRequestedInfo = 0x909c3f94; public const uint TLPaymentSavedCredentialsCard = 0xcdc27a1f; public const uint TLWebDocument = 0xc61acbd8; public const uint TLInputWebDocument = 0x9bed434d; public const uint TLInputWebFileLocation = 0xc239d686; public const uint TLWebFile = 0x21e753bc; public const uint TLPaymentForm = 0x3f56aea3; public const uint TLValidatedRequestedInfo = 0xd1451883; public const uint TLPaymentResult = 0x4e5f810d; public const uint TLPaymentVerificationNeeded = 0x6b56b921; public const uint TLPaymentReceipt = 0x500911e1; public const uint TLSavedInfo = 0xfb8fe43c; public const uint TLInputPaymentCredentialsSaved = 0xc10eb2cf; public const uint TLInputPaymentCredentials = 0x3417d728; public const uint TLTmpPassword = 0xdb64fd34; public const uint TLShippingOption = 0xb6213cdf; public const uint TLPhoneCallRequested64 = 0x83761ce4; public const uint TLPhoneCallAccepted = 0x6d003d3f; // layer 65, 66 public const uint TLUser66 = 0x2e13f4c3; public const uint TLInputMessagesFilterRoundVoice = 0x7a7c17a4; public const uint TLInputMessagesFilterRoundVideo = 0xb549da53; public const uint TLFileCdnRedirect = 0x1508485a; public const uint TLSendMessageRecordRoundAction = 0x88f27fbc; public const uint TLSendMessageUploadRoundAction = 0x243e1c66; public const uint TLSendMessageUploadRoundAction66 = 0xbb718624; public const uint TLDocumentAttributeVideo66 = 0xef02ce6; public const uint TLPageBlockChannel = 0xef1751b5; public const uint TLCdnFileReuploadNeeded = 0xeea8e46e; public const uint TLCdnFile = 0xa99fca4f; public const uint TLCdnPublicKey = 0xc982eaba; public const uint TLCdnConfig = 0x5725e40a; // layer 67 public const uint TLUpdateLangPackTooLong = 0x10c2404b; public const uint TLUpdateLangPack = 0x56022f4d; public const uint TLConfig67 = 0x7feec888; public const uint TLLangPackString = 0xcad181f6; public const uint TLLangPackStringPluralized = 0x6c47ac9f; public const uint TLLangPackStringDeleted = 0x2979eeb2; public const uint TLLangPackDifference = 0xf385c1f6; public const uint TLLangPackLanguage = 0x117698f1; // layer 68 public const uint TLChannel68 = 0xcb44b1c; public const uint TLChannelForbidden68 = 0x289da732; public const uint TLChannelFull68 = 0x95cb5f57; public const uint TLChannelParticipantAdmin = 0xa82fa898; public const uint TLChannelParticipantBanned = 0x222c1886; public const uint TLChannelParticipantsKicked68 = 0xa3b54985; public const uint TLChannelParticipantsBanned = 0x1427a5e1; public const uint TLChannelParticipantsSearch = 0x656ac4b; public const uint TLTopPeerCategoryPhoneCalls = 0x1e76a78c; public const uint TLPageBlockAudio = 0x31b81a7f; public const uint TLPagePart68 = 0x8e3f9ebe; public const uint TLPageFull68 = 0x556ec7aa; public const uint TLChannelAdminRights = 0x5d7ceba5; public const uint TLChannelBannedRights = 0x58cf4249; public const uint TLChannelAdminLogEventActionChangeTitle = 0xe6dfb825; public const uint TLChannelAdminLogEventActionChangeAbout = 0x55188a2e; public const uint TLChannelAdminLogEventActionChangeUsername = 0x6a4afc38; public const uint TLChannelAdminLogEventActionChangePhoto = 0xb82f55c3; public const uint TLChannelAdminLogEventActionToggleInvites = 0x1b7907ae; public const uint TLChannelAdminLogEventActionToggleSignatures = 0x26ae0971; public const uint TLChannelAdminLogEventActionUpdatePinned = 0xe9e82c18; public const uint TLChannelAdminLogEventActionEditMessage = 0x709b2405; public const uint TLChannelAdminLogEventActionDeleteMessage = 0x42e047bb; public const uint TLChannelAdminLogEventActionParticipantJoin = 0x183040d3; public const uint TLChannelAdminLogEventActionParticipantLeave = 0xf89777f2; public const uint TLChannelAdminLogEventActionParticipantInvite = 0xe31c34d8; public const uint TLChannelAdminLogEventActionParticipantToggleBan = 0xe6d83d7e; public const uint TLChannelAdminLogEventActionParticipantToggleAdmin = 0xd5676710; public const uint TLChannelAdminLogEvent = 0x3b5a3e40; public const uint TLAdminLogResults = 0xed8af74d; public const uint TLChannelAdminLogEventsFilter = 0xea107ae4; // layer 69 public const uint TLImportedContacts69 = 0x77d01c3b; public const uint TLPopularContact = 0x5ce14175; // layer 70 public const uint TLInputMediaUploadedPhoto70 = 0x2f37e231; public const uint TLInputMediaPhoto70 = 0x81fa373a; public const uint TLInputMediaUploadedDocument70 = 0xe39621fd; public const uint TLInputMediaDocument70 = 0x5acb668e; public const uint TLInputMediaPhotoExternal70 = 0x922aec1; public const uint TLInputMediaDocumentExternal70 = 0xb6f74335; public const uint TLMessage70 = 0x90dddc11; public const uint TLMessageMediaPhoto70 = 0xb5223b0f; public const uint TLMessageMediaDocument70 = 0x7c4414d3; public const uint TLMessageActionScreenshotTaken = 0x4792929b; public const uint TLFileCdnRedirect70 = 0xea52fe5a; public const uint TLMessageFwdHeader70 = 0xfadff4ac; public const uint TLCdnFileHash = 0x77eec38f; // layer 71 public const uint TLChannelFull71 = 0x17f45fcf; public const uint TLDialog71 = 0xe4def5db; public const uint TLContacts71 = 0xeae87e42; public const uint TLInputMessagesFilterMyMentions = 0xc1f8e69a; public const uint TLUpdateFavedStickers = 0xe511996d; public const uint TLUpdateChannelReadMessagesContents = 0x89893b45; public const uint TLUpdateContactsReset = 0x7084a7be; public const uint TLConfig71 = 0x8df376a4; public const uint TLChannelDifferenceTooLong71 = 0x6a9d7b35; public const uint TLChannelAdminLogEventActionChangeStickerSet = 0xb1c3caa7; public const uint TLFavedStickersNotModified = 0x9e8fa6d3; public const uint TLFavedStickers = 0xf37f2f16; // layer 72 public const uint TLInputMediaVenue72 = 0xc13d1c11; public const uint TLInputMediaGeoLive = 0x7b1a118f; public const uint TLChannelFull72 = 0x76af5481; public const uint TLMessageMediaVenue72 = 0x2ec0533f; public const uint TLMessageMediaGeoLive = 0x7c3c2609; public const uint TLMessageActionCustomAction = 0xfae69f56; public const uint TLInputMessagesFilterGeo = 0xe7026d0d; public const uint TLInputMessagesFilterContacts = 0xe062db83; public const uint TLUpdateChannelAvailableMessages = 0x70db6837; public const uint TLConfig72 = 0x9c840964; public const uint TLBotResults72 = 0x947ca848; public const uint TLInputPaymentCredentialsApplePay = 0xaa1c39f; public const uint TLInputPaymentCredentialsAndroidPay = 0x795667a6; public const uint TLChannelAdminLogEventActionTogglePreHistoryHidden = 0x5f5c95f1; public const uint TLRecentMeUrlUnknown = 0x46e1d13d; public const uint TLRecentMeUrlUser = 0x8dbc3336; public const uint TLRecentMeUrlChat = 0xa01b22f9; public const uint TLRecentMeUrlChatInvite = 0xeb49081d; public const uint TLRecentMeUrlStickerSet = 0xbc0a57dc; public const uint TLRecentMeUrls = 0xe0310d7; public const uint TLChannelParticipantsNotModified = 0xf0173fe9; // layer 73 public const uint TLChannel73 = 0x450b7115; public const uint TLMessage73 = 0x44f9b43d; public const uint TLMessageFwdHeader73 = 0x559ebe6d; public const uint TLInputSingleMedia = 0x5eaa7809; public const uint TLInputMediaInvoice73 = 0xf4e096c3; public const uint TLDecryptedMessage73 = 0x91cc4674; // layer 74 public const uint TLContactsFound74 = 0xb3134d9d; public const uint TLExportedMessageLink74 = 0x5dab1af4; public const uint TLInputPaymentCredentialsAndroidPay74 = 0xca05d50e; // layer 75 public const uint TLInputMediaUploadedPhoto75 = 0x1e287d04; public const uint TLInputMediaPhoto75 = 0xb3ba0635; public const uint TLInputMediaUploadedDocument75 = 0x5b38c6c1; public const uint TLInputMediaDocument75 = 0x23ab23d2; public const uint TLInputMediaPhotoExternal75 = 0xe5bbfe1a; public const uint TLInputMediaDocumentExternal75 = 0xfb52dc99; public const uint TLMessageMediaPhoto75 = 0x695150d7; public const uint TLMessageMediaDocument75 = 0x9cb070d7; public const uint TLInputBotInlineMessageMediaAuto75 = 0x3380c786; public const uint TLBotInlineMessageMediaAuto75 = 0x764cf810; public const uint TLInputSingleMedia75 = 0x31bc3d25; // layer 76 public const uint TLChannel76 = 0xc88974ac; public const uint TLDialogFeed = 0x36086d42; public const uint TLUpdateDialogPinned76 = 0x19d27f3c; public const uint TLUpdatePinnedDialogs76 = 0xea4cb65b; public const uint TLUpdateReadFeed = 0x6fa68e41; public const uint TLStickerSet76 = 0x5585a139; public const uint TLRecentStickers76 = 0x22f3afb3; public const uint TLFeedPosition = 0x5059dc73; public const uint TLFeedMessagesNotModified = 0x4678d0cf; public const uint TLFeedMessages = 0x55c3a1b1; public const uint TLFeedBroadcasts = 0x4f4feaf1; public const uint TLFeedBroadcastsUngrouped = 0x9a687cba; public const uint TLFeedSourcesNotModified = 0x88b12a17; public const uint TLFeedSources = 0x8e8bca3d; public const uint TLInputDialogPeerFeed = 0x2c38b8cf; public const uint TLInputDialogPeer = 0xfcaafeb7; public const uint TLDialogPeerFeed = 0xda429411; public const uint TLDialogPeer = 0xe56dbf05; public const uint TLWebAuthorization = 0xcac943f2; public const uint TLWebAuthorizations = 0xed56c9fc; public const uint TLInputMessageId = 0xa676a322; public const uint TLInputMessageReplyTo = 0xbad88395; public const uint TLInputMessagePinned = 0x86872538; public const uint TLInputSingleMedia76 = 0x1cc6e91f; public const uint TLMessageEntityPhone = 0x9b69e34b; public const uint TLMessageEntityCashtag = 0x4c4e743f; public const uint TLMessageActionBotAllowed = 0xabe9affe; public const uint TLConfig76 = 0x86b5778e; public const uint TLFoundStickerSetsNotModified = 0xd54b65d; public const uint TLFoundStickerSets = 0x5108d648; public const uint TLFileHash = 0x6242c773; public const uint TLFileCdnRedirect76 = 0xf18cda44; public const uint TLInputBotInlineResult76 = 0x88bf9319; public const uint TLBotInlineResult76 = 0x11965f3a; public const uint TLWebDocumentNoProxy = 0xf9c8bcc6; // layer 77 // layer 78 public const uint TLDCOption78 = 0x18b7a10d; public const uint TLConfig78 = 0xeb7bb160; public const uint TLInputClientProxy = 0x75588b3f; public const uint TLProxyDataEmpty = 0xe09e1fb8; public const uint TLProxyDataPromo = 0x2bf7ee23; // layer 79 public const uint TLInputPeerNotifySettings78 = 0x9c3d198e; public const uint TLPeerNotifySettings78 = 0xaf509d20; public const uint TLStickers79 = 0xe4599bbd; public const uint TLInputBotInlineMessageMediaVenue78 = 0x417bbf11; public const uint TLBotInlineMessageMediaVenue78 = 0x8a86659c; // layer 80 public const uint TLSentCode80 = 0x38faab5f; public const uint TLTermsOfService80 = 0x780a0310; public const uint TLTermsOfServiceUpdateEmpty = 0xe3309f7f; public const uint TLTermsOfServiceUpdate = 0x28ecf961; // layer 81 public const uint TLInputSecureFileLocation = 0xcbc7ee28; public const uint TLMessageActionSecureValuesSentMe = 0x1b287353; public const uint TLMessageActionSecureValuesSent = 0xd95c6154; public const uint TLNoPassword81 = 0x5ea182f6; public const uint TLPassword81 = 0xca39b447; public const uint TLPasswordSettings81 = 0x7bd9c3f1; public const uint TLPasswordInputSettings81 = 0x21ffa60d; public const uint TLInputSecureFileUploaded = 0x3334b0f0; public const uint TLInputSecureFile = 0x5367e5be; public const uint TLSecureFileEmpty = 0x64199744; public const uint TLSecureFile = 0xe0277a62; public const uint TLSecureData = 0x8aeabec3; public const uint TLSecurePlainPhone = 0x7d6099dd; public const uint TLSecurePlainEmail = 0x21ec5a5f; public const uint TLSecureValueTypePersonalDetails = 0x9d2a81e3; public const uint TLSecureValueTypePassport = 0x3dac6a00; public const uint TLSecureValueTypeDriverLicense = 0x6e425c4; public const uint TLSecureValueTypeIdentityCard = 0xa0d0744b; public const uint TLSecureValueTypeInternalPassport = 0x99a48f23; public const uint TLSecureValueTypeAddress = 0xcbe31e26; public const uint TLSecureValueTypeUtilityBill = 0xfc36954e; public const uint TLSecureValueTypeBankStatement = 0x89137c0d; public const uint TLSecureValueTypeRentalAgreement = 0x8b883488; public const uint TLSecureValueTypePassportRegistration = 0x99e3806a; public const uint TLSecureValueTypeTemporaryRegistration = 0xea02ec33; public const uint TLSecureValueTypePhone = 0xb320aadb; public const uint TLSecureValueTypeEmail = 0x8e3ca7ee; public const uint TLSecureValue = 0xb4b4b699; public const uint TLInputSecureValue = 0x67872e8; public const uint TLSecureValueHash = 0xed1ecdb0; public const uint TLSecureValueErrorData = 0xe8a40bd9; public const uint TLSecureValueErrorFrontSide = 0xbe3dfa; public const uint TLSecureValueErrorReverseSide = 0x868a2aa5; public const uint TLSecureValueErrorSelfie = 0xe537ced6; public const uint TLSecureValueErrorFile = 0x7a700873; public const uint TLSecureValueErrorFiles = 0x666220e9; public const uint TLSecureCredentialsEncrypted = 0x33f0ea47; public const uint TLAuthorizationForm = 0xcb976d53; public const uint TLSentEmailCode = 0x811f854f; public const uint TLDeepLinkInfoEmpty = 0x66afa166; public const uint TLDeepLinkInfo = 0x6a4ee832; public const uint TLSavedPhoneContact = 0x1142bd56; public const uint TLTakeout = 0x4dba4501; // layer 82 public const uint TLInputTakeoutFileLocation = 0x29be5899; public const uint TLAppUpdate = 0x1da7158f; public const uint TLNoAppUpdate = 0xc45a6536; public const uint TLInvokeWithMessagesRange = 0x365275f2; public const uint TLInputMediaContact82 = 0xf8ab7dfb; public const uint TLMessageMediaContact82 = 0xcbf24940; public const uint TLGeoPoint82 = 0x296f104; public const uint TLDialogsNotModified = 0xf0e3e596; public const uint TLUpdateDialogUnreadMark = 0xe16459c3; public const uint TLConfig82 = 0x3213dbba; public const uint TLInputBotInlineMessageMediaContact82 = 0xa6edbffd; public const uint TLBotInlineMessageMediaContact82 = 0x18d1cdc2; public const uint TLDraftMessageEmpty82 = 0x1b0c841a; public const uint TLWebDocument82 = 0x1c570ed1; public const uint TLInputWebFileGeoPointLocation = 0x9f2221c9; public const uint TLInputReportReasonCopyright = 0x9b89f93a; public const uint TLTopPeersDisabled = 0xb52c939d; // layer 83 public const uint TLPassword83 = 0x68873ba5; public const uint TLPasswordSettings83 = 0x9a5c33e5; public const uint TLPasswordInputSettings83 = 0xc23727c9; public const uint TLPasswordKdfAlgoUnknown = 0xd45ab096; public const uint TLSecurePasswordKdfAlgoUnknown = 0x4a8537; public const uint TLSecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 = 0xbbf2dda0; public const uint TLSecurePasswordKdfAlgoSHA512 = 0x86471d92; public const uint TLSecureSecretSettings = 0x1527bcac; // layer 84 public const uint TLPassword84 = 0xad2641f8; public const uint TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow = 0x3a912d4a; public const uint TLInputCheckPasswordEmpty = 0x9880f658; public const uint TLInputCheckPasswordSRP = 0xd27ff082; // layer 85 public const uint TLSecureValue85 = 0x187fa0ca; public const uint TLInputSecureValue85 = 0xdb21d0a7; public const uint TLSecureValueError = 0x869d758f; public const uint TLSecureValueErrorTranslationFile = 0xa1144770; public const uint TLSecureValueErrorTranslationFiles = 0x34636dd8; public const uint TLAuthorizationForm85 = 0xad2e1cd8; public const uint TLSecureRequiredType = 0x829d99da; public const uint TLSecureRequiredTypeOneOf = 0x27477b4; public const uint TLPassportConfigNotModified = 0xbfb9f457; public const uint TLPassportConfig = 0xa098d6af; // public const uint TLConfigSimple = 0xd997c3c5; // layer 45 encrypted public const uint TLDecryptedMessage45 = 0x36b091de; public const uint TLDecryptedMessageMediaPhoto45 = 0xf1fa8d78; public const uint TLDecryptedMessageMediaVideo45 = 0x970c8c0e; public const uint TLDecryptedMessageMediaDocument45 = 0x7afe8ae2; public const uint TLDecryptedMessageMediaVenue = 0x8a0df56f; public const uint TLDecryptedMessageMediaWebPage = 0xe50511d8; // additional signatures public const uint TLMessageActionChannelJoined = 0xffffff00; public const uint TLUserExtendedInfo = 0xffffff01; public const uint TLDialogSecret = 0xffffff02; public const uint TLDecryptedMessageActionEmpty = 0xffffff03; public const uint TLPeerEncryptedChat = 0xffffff04; public const uint TLBroadcastChat = 0xffffff05; public const uint TLPeerBroadcastChat = 0xffffff06; public const uint TLBroadcastDialog = 0xffffff07; public const uint TLInputPeerBroadcast = 0xffffff08; public const uint TLServerFile = 0xffffff09; public const uint TLMessageActionContactRegistered = 0xffffff0a; public const uint TLPasscodeParams = 0xffffff0b; public const uint TLRecentlyUsedSticker = 0xffffff0c; public const uint TLActionInfo = 0xffffff0d; public const uint TLResultInfo = 0xffffff0e; public const uint TLEncryptedChat20 = 0xffffff0f; public const uint TLEncryptedChat17 = 0xffffff10; public const uint TLMessageActionUnreadMessages = 0xffffff11; public const uint TLMessagesContainter = 0xffffff12; public const uint TLHashtagItem = 0xffffff13; public const uint TLMessageActionMessageGroup = 0xffffff14; public const uint TLChatSettings = 0xffffff15; public const uint TLDocumentExternal = 0xffffff16; public const uint TLDecryptedMessagesContainter = 0xffffff17; public const uint TLCameraSettings = 0xffffff18; public const uint TLPhotoPickerSettings = 0xffffff19; public const uint TLProxyConfig = 0xffffff1a; public const uint TLCallsSecurity = 0xffffff1b; public const uint TLStickerSetEmpty = 0xffffff1c; public const uint TLMessagesGroup = 0xffffff1d; public const uint TLMessageMediaGroup = 0xffffff1e; public const uint TLDecryptedMessageMediaGroup = 0xffffff1f; public const uint TLPeerFeed = 0xffffff20; public const uint TLInputPeerFeed = 0xffffff21; public const uint TLProxyConfig76 = 0xffffff22; public const uint TLSocks5Proxy = 0xffffff23; public const uint TLMTProtoProxy = 0xffffff24; public const uint TLContactsSettings = 0xffffff25; public const uint TLSecureFileUploaded = 0xffffff26; } } ================================================ FILE: Telegram.Api/TL/TLState.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLState : TLObject { public const uint Signature = TLConstructors.TLState; public TLInt Pts { get; set; } public TLInt Qts { get; set; } public TLInt Date { get; set; } public TLInt Seq { get; set; } public TLInt UnreadCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Pts = GetObject(bytes, ref position); Qts = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); UnreadCount = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Pts = GetNullableObject(input); Qts = GetNullableObject(input); Date = GetNullableObject(input); Seq = GetNullableObject(input); UnreadCount = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Pts.NullableToStream(output); Qts.NullableToStream(output); Date.NullableToStream(output); Seq.NullableToStream(output); UnreadCount.NullableToStream(output); } public override string ToString() { return string.Format("p={0} q={1} s={2} u_c={3} d={4} [{5}]", Pts, Qts, Seq, UnreadCount, Date, Date != null ? TLUtils.ToDateTime(Date) : DateTime.MinValue); } } } ================================================ FILE: Telegram.Api/TL/TLStatedMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLStatedMessageBase : TLObject { public TLMessageBase Message { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public TLInt Pts { get; set; } public abstract TLStatedMessageBase GetEmptyObject(); public virtual TLInt GetSeq() { return null; } } public interface ILinks { TLVector Links { get; set; } } public class TLStatedMessage : TLStatedMessageBase { public const uint Signature = TLConstructors.TLStatedMessage; public TLInt Seq { get; set; } public override TLInt GetSeq() { return Seq; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override TLStatedMessageBase GetEmptyObject() { return new TLStatedMessage { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Pts = Pts, Seq = Seq }; } } public class TLStatedMessage24 : TLStatedMessageBase, IMultiPts { public const uint Signature = TLConstructors.TLStatedMessage24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override TLStatedMessageBase GetEmptyObject() { return new TLStatedMessage24 { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Pts = Pts, PtsCount = PtsCount }; } } public class TLStatedMessageLink : TLStatedMessage, ILinks { public new const uint Signature = TLConstructors.TLStatedMessageLink; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Links = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override TLStatedMessageBase GetEmptyObject() { return new TLStatedMessageLink { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Links = new TLVector(Links.Count), Pts = Pts, Seq = Seq }; } } public class TLStatedMessageLink24 : TLStatedMessage24, ILinks { public new const uint Signature = TLConstructors.TLStatedMessageLink24; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Links = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override TLStatedMessageBase GetEmptyObject() { return new TLStatedMessageLink24 { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Links = new TLVector(Links.Count), Pts = Pts, PtsCount = PtsCount }; } } } ================================================ FILE: Telegram.Api/TL/TLStatedMessages.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLStatedMessagesBase : TLObject { public TLVector Messages { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public TLInt Pts { get; set; } public abstract TLStatedMessagesBase GetEmptyObject(); public virtual TLInt GetSeq() { return null; } } public class TLStatedMessages : TLStatedMessagesBase { public const uint Signature = TLConstructors.TLStatedMessages; public TLInt Seq { get; set; } public override TLInt GetSeq() { return Seq; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override TLStatedMessagesBase GetEmptyObject() { return new TLStatedMessages { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Messages = new TLVector(Messages.Count), Pts = Pts, Seq = Seq }; } } public class TLStatedMessages24 : TLStatedMessagesBase, IMultiPts { public const uint Signature = TLConstructors.TLStatedMessages24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override TLStatedMessagesBase GetEmptyObject() { return new TLStatedMessages24 { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Messages = new TLVector(Messages.Count), Pts = Pts, PtsCount = PtsCount }; } } public class TLStatedMessagesLinks : TLStatedMessages, ILinks { public new const uint Signature = TLConstructors.TLStatedMessagesLinks; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Links = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override TLStatedMessagesBase GetEmptyObject() { return new TLStatedMessagesLinks { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Messages = new TLVector(Messages.Count), Links = new TLVector(Links.Count), Pts = Pts, Seq = Seq }; } } public class TLStatedMessagesLinks24 : TLStatedMessages24, ILinks { public new const uint Signature = TLConstructors.TLStatedMessagesLinks24; public TLVector Links { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Links = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override TLStatedMessagesBase GetEmptyObject() { return new TLStatedMessagesLinks24 { Chats = new TLVector(Chats.Count), Users = new TLVector(Users.Count), Messages = new TLVector(Messages.Count), Links = new TLVector(Links.Count), Pts = Pts, PtsCount = PtsCount }; } } } ================================================ FILE: Telegram.Api/TL/TLStickerPack.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLStickerPack : TLObject { public const uint Signature = TLConstructors.TLStickerPack; public TLString Emoticon { get; set; } public TLVector Documents { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Emoticon = GetObject(bytes, ref position); Documents = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Emoticon.ToBytes(), Documents.ToBytes()); } public override TLObject FromStream(Stream input) { Emoticon = GetObject(input); Documents = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Emoticon.ToStream(output); Documents.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLStickerSet.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum StickerSetFlags { Installed = 0x1, Disabled = 0x2, Official = 0x4, Masks = 0x8 } public abstract class TLStickerSetBase : TLObject { public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public TLString Title { get; set; } public TLString ShortName { get; set; } #region Additional public TLVector Stickers { get; set; } public bool Unread { get; set; } public bool IsSelected { get; set; } #endregion } public class TLStickerSet : TLStickerSetBase { public const uint Signature = TLConstructors.TLStickerSet; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); ShortName = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), Title.ToBytes(), ShortName.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); ShortName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Title.ToStream(output); ShortName.ToStream(output); } } public class TLStickerSet76 : TLStickerSet32 { public new const uint Signature = TLConstructors.TLStickerSet76; protected TLInt _installedDate; public TLInt InstalledDate { get { return _installedDate; } set { SetField(out _installedDate, value, ref _flags, (int) StickerSetFlags.Installed); } } public int SortDate { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); InstalledDate = GetObject(Flags, (int) StickerSetFlags.Installed, null, bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); ShortName = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Hash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(InstalledDate, Flags, (int) StickerSetFlags.Installed), Id.ToBytes(), AccessHash.ToBytes(), Title.ToBytes(), ShortName.ToBytes(), Count.ToBytes(), Hash.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); InstalledDate = GetObject(Flags, (int) StickerSetFlags.Installed, null, input); Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); ShortName = GetObject(input); Count = GetObject(input); Hash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, InstalledDate, Flags, (int) StickerSetFlags.Installed); Id.ToStream(output); AccessHash.ToStream(output); Title.ToStream(output); ShortName.ToStream(output); Count.ToStream(output); Hash.ToStream(output); } public override string ToString() { return string.Format("TLStickerSet76 id={0} short_name={1} flags={2}", Id, ShortName, StickerSetFlagsString(Flags)); } } public class TLStickerSet32 : TLStickerSet { public new const uint Signature = TLConstructors.TLStickerSet32; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Count { get; set; } public TLInt Hash { get; set; } public bool Installed { get { return IsSet(Flags, (int) StickerSetFlags.Installed); } set { SetUnset(ref _flags, value, (int) StickerSetFlags.Installed); } } public bool Archived { get { return IsSet(Flags, (int)StickerSetFlags.Disabled); } set { SetUnset(ref _flags, value, (int)StickerSetFlags.Disabled); } } public bool Official { get { return IsSet(Flags, (int)StickerSetFlags.Official); } set { SetUnset(ref _flags, value, (int)StickerSetFlags.Official); } } public bool Masks { get { return IsSet(Flags, (int)StickerSetFlags.Masks); } set { SetUnset(ref _flags, value, (int)StickerSetFlags.Masks); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); ShortName = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Hash = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), AccessHash.ToBytes(), Title.ToBytes(), ShortName.ToBytes(), Count.ToBytes(), Hash.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(input); Title = GetObject(input); ShortName = GetObject(input); Count = GetObject(input); Hash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); AccessHash.ToStream(output); Title.ToStream(output); ShortName.ToStream(output); Count.ToStream(output); Hash.ToStream(output); } public static string StickerSetFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (StickerSetFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public override string ToString() { return string.Format("TLStickerSet32 id={0} short_name={1} flags={2}", Id, ShortName, StickerSetFlagsString(Flags)); } } public class TLStickerSetEmpty : TLStickerSetBase { public const uint Signature = TLConstructors.TLStickerSetEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLStickerSetCovered.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLStickerSetCoveredBase : TLObject { public TLStickerSetBase StickerSet { get; set; } } public class TLStickerSetCovered : TLStickerSetCoveredBase { public const uint Signature = TLConstructors.TLStickerSetCovered; public TLDocumentBase Cover { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); StickerSet = GetObject(bytes, ref position); Cover = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), StickerSet.ToBytes(), Cover.ToBytes()); } public override TLObject FromStream(Stream input) { StickerSet = GetObject(input); Cover = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); StickerSet.ToStream(output); Cover.ToStream(output); } } public class TLStickerSetMultiCovered : TLStickerSetCoveredBase { public const uint Signature = TLConstructors.TLStickerSetMultiCovered; public TLVector Covers { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); StickerSet = GetObject(bytes, ref position); Covers = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), StickerSet.ToBytes(), Covers.ToBytes()); } public override TLObject FromStream(Stream input) { StickerSet = GetObject(input); Covers = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); StickerSet.ToStream(output); Covers.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLStickerSetInstallResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Linq; using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public abstract class TLStickerSetInstallResultBase : TLObject { } public class TLStickerSetInstallResult : TLStickerSetInstallResultBase { public const uint Signature = TLConstructors.TLStickerSetInstallResult; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return "TLStickerSetInstallResult"; } } public class TLStickerSetInstallResultArchive : TLStickerSetInstallResultBase, IStickers { public const uint Signature = TLConstructors.TLStickerSetInstallResultArchive; public TLString Hash { get; set; } public TLVector SetsCovered { get; set; } #region Additional public TLVector Sets { get { var sets = new TLVector(); foreach (var setCovered in SetsCovered) { sets.Add(setCovered.StickerSet); } return sets; } set { Execute.ShowDebugMessage("TLStickerSetInstallResultArchive.Sets set"); } } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public TLVector MessagesStickerSets { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); SetsCovered = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), SetsCovered.ToBytes()); } public override TLObject FromStream(Stream input) { SetsCovered = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); SetsCovered.ToStream(output); } public override string ToString() { return string.Format("TLStickerSetInstallResultArchive sets=[{0}]", string.Join(", ", Sets.Select(x => x.Id))); } } } ================================================ FILE: Telegram.Api/TL/TLStickers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLStickersBase : TLObject { } public class TLStickersNotModified : TLStickersBase { public const uint Signature = TLConstructors.TLStickersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLStickers79 : TLStickersBase { public const uint Signature = TLConstructors.TLStickers79; public TLInt Hash { get; set; } public TLVector Stickers { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Stickers = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Stickers.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Stickers = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Stickers.ToStream(output); } } public class TLStickers : TLStickersBase { public const uint Signature = TLConstructors.TLStickers; public TLString Hash { get; set; } public TLVector Stickers { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); Stickers = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes(), Stickers.ToBytes()); } public override TLObject FromStream(Stream input) { Hash = GetObject(input); Stickers = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); Stickers.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLString.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Runtime.Serialization; using System.Text; using Org.BouncyCastle.Security; using Telegram.Api.Helpers; namespace Telegram.Api.TL { [DataContract] public class TLString : TLObject { public TLString(){ } public TLString(string s) { if (s == null) s = ""; var data = Encoding.UTF8.GetBytes(s); //Length = data.Length; Data = data; // NOTE: remove Reverse here } public static TLString Random(int count) { var random = new SecureRandom(); var randomBytes = new byte[count]; random.NextBytes(randomBytes); return FromBigEndianData(randomBytes); } public static TLString Empty { get { return new TLString(""); } } //little endian data with leading 0x00 padding [DataMember] public byte[] Data { get; set; } // NOT: now its big endian with 0x0 padding at the end public static TLString FromBigEndianData(byte[] data) { var str = new TLString(); str.Data = data; // NOTE: remove Reverse here return str; } // UInt64 - little endian public static TLString FromUInt64(UInt64 data) { var str = new TLString(); // revert to big endian and remove first zero bytes var bigEndianBytes = RemoveFirstZeroBytes(BitConverter.GetBytes(data).Reverse().ToArray()); // revert to little endian again str.Data = bigEndianBytes; // NOTE: remove Reverse here return str; } private static byte[] RemoveFirstZeroBytes(IList bytes) { var result = new List(bytes); while (result.Count > 0 && result[0] == 0x00) { result.RemoveAt(0); } return result.ToArray(); } public BigInteger ToBigInteger() { var data = new List(Data); while (data[0] == 0x00) { data.RemoveAt(0); } return new BigInteger(Data.Reverse().Concat(new byte[] {0x00}).ToArray()); //NOTE: add reverse here } public override TLObject FromBytes(byte[] bytes, ref int position) { int bytesRead; int length; if (bytes[position] == 0xfe) { var lengthBytes = bytes.SubArray(position + 1, 3); length = BitConverter.ToInt32(lengthBytes.Concat(new byte[] { 0x00 }).ToArray(), 0); bytesRead = 4; } else { length = bytes[position]; bytesRead = 1; } Data = bytes.SubArray(position + bytesRead, length); //NOTE: remove Reverse here bytesRead += Data.Length; var padding = (bytesRead % 4 == 0) ? 0 : (4 - (bytesRead % 4)); bytesRead += padding; if (bytesRead % 4 != 0) throw new Exception("Length must be divisible on 4"); position += bytesRead; return this; } // length + big endian data + zero bytes public override byte[] ToBytes() { var length = (Data.Length >= 254) ? 4 + Data.Length : 1 + Data.Length; var padding = (length % 4 == 0)? 0 : (4 - (length % 4)); length = length + padding; var bytes = new byte[length]; if (Data.Length >= 254) { bytes[0] = 0xFE; var lengthBytes = BitConverter.GetBytes(Data.Length); Array.Copy(lengthBytes, 0, bytes, 1, 3); Array.Copy(Data, 0, bytes, 4, Data.Length); //NOTE: Remove Reverse here } else { bytes[0] = (byte)Data.Length; Array.Copy(Data, 0, bytes, 1, Data.Length); //NOTE: Remove Reverse here } return bytes; } public override TLObject FromStream(Stream input) { int bytesRead; int length; var bytes = new byte[1]; input.Read(bytes, 0, 1); if (bytes[0] == 0xfe) { var lengthBytes = new byte[3]; input.Read(lengthBytes, 0, 3); length = BitConverter.ToInt32(lengthBytes.Concat(new byte[] { 0x00 }).ToArray(), 0); bytesRead = 4; } else { length = bytes[0]; bytesRead = 1; } Data = new byte[length]; input.Read(Data, 0, Data.Length); // bytes.SubArray(position + bytesRead, length); //NOTE: remove Reverse here bytesRead += Data.Length; var padding = (bytesRead % 4 == 0) ? 0 : (4 - (bytesRead % 4)); bytesRead += padding; if (bytesRead % 4 != 0) throw new Exception("Length must be divisible on 4"); input.Position += padding; return this; } public override void ToStream(Stream output) { var buffer = ToBytes(); output.Write(buffer, 0, buffer.Length); } private WeakReference _str; public override string ToString() { #if SILVERLIGHT || WIN_RT string str; if (_str != null && _str.TryGetTarget(out str)) return str; str = Data == null ? string.Empty : Encoding.UTF8.GetString(Data, 0, Data.Length); _str = new WeakReference(str); return str; #else string str; if (_str != null && _str.TryGetTarget(out str)) return str; str = Data == null? string.Empty : Encoding.UTF8.GetString(Data); _str = new WeakReference(str); return str; #endif } public string Value { get { return ToString(); } } public static bool IsNullOrEmpty(TLString str) { return str == null || string.IsNullOrEmpty(str.ToString()); } public static bool Equals(TLString str1, TLString str2, StringComparison comparison) { if (str1 == null && str2 == null) { return true; } if (str1 != null && str2 == null) { return false; } if (str1 == null) { return false; } return string.Equals(str1.ToString(), str2.ToString(), comparison); } } } ================================================ FILE: Telegram.Api/TL/TLSupport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSupport : TLObject { public const uint Signature = TLConstructors.TLSupport; public TLString PhoneNumber { get; set; } public TLUserBase User { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneNumber = GetObject(bytes, ref position); User = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLTermsOfService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum TermsOfServiceFlags { Popup = 0x1, MinAgeConfirm = 0x2 } public abstract class TLTermsOfServiceBase : TLObject { } public class TLTermsOfService80 : TLTermsOfService { public new const uint Signature = TLConstructors.TLTermsOfService80; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Popup { get { return IsSet(_flags, (int)TermsOfServiceFlags.Popup); } set { SetUnset(ref _flags, value, (int)TermsOfServiceFlags.Popup); } } public TLDataJSON Id { get; set; } public TLVector Entities { get; set; } public bool MinAgeConfirm { get { return IsSet(_flags, (int)TermsOfServiceFlags.MinAgeConfirm); } set { SetUnset(ref _flags, value, (int)TermsOfServiceFlags.MinAgeConfirm); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); Entities = GetObject>(bytes, ref position); return this; } } public class TLTermsOfService : TLTermsOfServiceBase { public const uint Signature = TLConstructors.TLTermsOfService; public TLString Text { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Text = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLTmpPassword.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLTmpPassword : TLObject { public const uint Signature = TLConstructors.TLTmpPassword; public TLString TmpPassword { get; set; } public TLInt ValidUntil { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); TmpPassword = GetObject(bytes, ref position); ValidUntil = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { TmpPassword = GetObject(input); ValidUntil = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); TmpPassword.ToStream(output); ValidUntil.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLTopPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLTopPeer : TLObject { public const uint Signature = TLConstructors.TLTopPeer; public TLPeerBase Peer { get; set; } public TLDouble Rating { get; set; } public TLObject Object { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); Rating = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Rating.ToBytes()); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); Rating = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); Rating.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLTopPeerCategory.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLTopPeerCategoryBase : TLObject { } public class TLTopPeerCategoryBotsPM : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryBotsPM; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeerCategoryBotsInline : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryBotsInline; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeerCategoryCorrespondents : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryCorrespondents; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeerCategoryGroups : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryGroups; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeerCategoryChannels : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryChannels; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeerCategoryPhoneCalls : TLTopPeerCategoryBase { public const uint Signature = TLConstructors.TLTopPeerCategoryPhoneCalls; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLTopPeerCategoryPeers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLTopPeerCategoryPeers : TLObject { public const uint Signature = TLConstructors.TLTopPeerCategoryPeers; public TLTopPeerCategoryBase Category { get; set; } public TLInt Count { get; set; } public TLVector Peers { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Category = GetObject(bytes, ref position); Count = GetObject(bytes, ref position); Peers = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Category.ToBytes(), Count.ToBytes(), Peers.ToBytes()); } public override TLObject FromStream(Stream input) { Category = GetObject(input); Count = GetObject(input); Peers = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Category.ToStream(output); Count.ToStream(output); Peers.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLTopPeers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLTopPeersBase : TLObject { } public class TLTopPeers : TLTopPeersBase { public const uint Signature = TLConstructors.TLTopPeers; public TLVector Categories { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Categories = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Categories.ToBytes(), Chats.ToBytes(), Users.ToBytes()); } public override TLObject FromStream(Stream input) { Categories = GetObject>(input); Chats = GetObject>(input); Users = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Categories.ToStream(output); Chats.ToStream(output); Users.ToStream(output); } } public class TLTopPeersNotModified : TLTopPeersBase { public const uint Signature = TLConstructors.TLTopPeersNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLTopPeersDisabled : TLTopPeersBase { public const uint Signature = TLConstructors.TLTopPeersDisabled; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLUpdate.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { [Flags] public enum UpdateFlags { Geo = 0x1, // 0 MessageId = 0x2, // 1 } [Flags] public enum UpdateServiceNotificationFlags { Popup = 0x1, // 0 InboxDate = 0x2, // 1 } [Flags] public enum UpdateDilogPinnedFlags { Pinned = 0x1, // 0 } [Flags] public enum UpdatePinnedDialogsFlags { Order = 0x1, // 0 } [Flags] public enum UpdateBotPrecheckoutQueryFlags { Info = 0x1, // 0 ShippingOptionId = 0x2, // 1 } [Flags] public enum UpdateReadFeedFlags { UnreadCount = 0x1, // 0 } [Flags] public enum UpdateDialogUnreadMarkFlags { Unread = 0x1, // 0 } public abstract class TLUpdateBase : TLObject { public abstract IList GetPts(); } public interface IMultiPts { TLInt Pts { get; set; } TLInt PtsCount { get; set; } } public interface IMultiChannelPts { TLInt ChannelPts { get; set; } TLInt ChannelPtsCount { get; set; } } public class TLUpdateNewMessage : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateNewMessage; public TLMessageBase Message { get; set; } public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); var messageCommon = Message as TLMessageCommon; if (messageCommon != null) messageCommon.SetUnreadSilent(TLBool.True); Pts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); Pts.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); Pts = GetObject(input); return this; } public override IList GetPts() { return new List { Pts }; } } public class TLUpdateNewMessage24 : TLUpdateNewMessage, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateNewMessage24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); var messageCommon = Message as TLMessageCommon; if (messageCommon != null) messageCommon.SetUnreadSilent(TLBool.True); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateChatParticipantAdd37 : TLUpdateChatParticipantAdd { public new const uint Signature = TLConstructors.TLUpdateChatParticipantAdd37; public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); InviterId.ToStream(output); Date.ToStream(output); Version.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); InviterId = GetObject(input); Date = GetObject(input); Version = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatParticipantAdd : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChatParticipantAdd; public TLInt ChatId { get; set; } public TLInt UserId { get; set; } public TLInt InviterId { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); InviterId = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); InviterId.ToStream(output); Version.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); InviterId = GetObject(input); Version = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatParticipantDelete : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChatParticipantDelete; public TLInt ChatId { get; set; } public TLInt UserId { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); Version.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); Version = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateNewEncryptedMessage : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateNewEncryptedMessage; public TLEncryptedMessageBase Message { get; set; } public TLInt Qts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Qts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); Qts.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); Qts = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateEncryption : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateEncryption; public TLEncryptedChatBase Chat { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Chat = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Chat.ToStream(output); Date.ToStream(output); } public override TLObject FromStream(Stream input) { Chat = GetObject(input); Date = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateMessageId : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateMessageId; public TLInt Id { get; set; } public TLLong RandomId { get; set; } public override string ToString() { return string.Format("TLUpdateMessageId id={0} random_id={1}", Id, RandomId); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); RandomId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); RandomId.ToStream(output); } public override TLObject FromStream(Stream input) { Id = GetObject(input); RandomId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateReadMessages : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateReadMessages; public TLVector Messages { get; set; } public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); return this; } public override IList GetPts() { return new List { Pts }; } } public class TLUpdateReadMessages24 : TLUpdateReadMessages, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateReadMessages24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateReadMessagesContents : TLUpdateReadMessages, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateReadMessagesContents; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public abstract class TLUpdateReadHistory : TLUpdateBase, IMultiPts { public TLPeerBase Peer { get; set; } public TLInt MaxId { get; set; } public TLInt Pts { get; set; } public TLInt PtsCount { get; set; } } public class TLUpdateReadHistoryInbox : TLUpdateReadHistory { public const uint Signature = TLConstructors.TLUpdateReadHistoryInbox; public override string ToString() { return string.Format("TLUpdateReadHistoryInbox peer={0} max_id={1} pts={2} pts_count={3}", Peer, MaxId, Pts, PtsCount); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); MaxId.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); MaxId = GetObject(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateReadHistoryOutbox : TLUpdateReadHistory { public const uint Signature = TLConstructors.TLUpdateReadHistoryOutbox; public override string ToString() { return string.Format("TLUpdateReadHistoryOutbox peer={0} max_id={1} pts={2} pts_count={3}", Peer, MaxId, Pts, PtsCount); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); MaxId.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); MaxId = GetObject(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateEncryptedMessagesRead : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateEncryptedMessagesRead; public TLInt ChatId { get; set; } public TLInt MaxDate { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); MaxDate = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); MaxDate.ToStream(output); Date.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); MaxDate = GetObject(input); Date = GetObject(input); return this; } public override IList GetPts() { return new List(); } public override string ToString() { return string.Format("{0} ChatId={1} MaxDate={2} Date={3}", GetType().Name, ChatId, MaxDate, Date); } } public class TLUpdateDeleteMessages : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateDeleteMessages; public TLVector Messages { get; set; } public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); return this; } public override IList GetPts() { return new List { Pts }; } } public class TLUpdateDeleteMessages24 : TLUpdateDeleteMessages, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateDeleteMessages24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateRestoreMessages : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateRestoreMessages; public TLVector Messages { get; set; } public TLInt Pts { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Messages = GetObject>(bytes, ref position); Pts = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Messages.ToStream(output); Pts.ToStream(output); } public override TLObject FromStream(Stream input) { Messages = GetObject>(input); Pts = GetObject(input); return this; } public override IList GetPts() { return new List { Pts }; } } public interface IUserTypingAction { TLSendMessageActionBase Action { get; set; } } public abstract class TLUpdateTypingBase : TLUpdateBase { public TLInt UserId { get; set; } } public class TLUpdateUserTyping : TLUpdateTypingBase { public const uint Signature = TLConstructors.TLUpdateUserTyping; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserTyping17 : TLUpdateUserTyping, IUserTypingAction { public new const uint Signature = TLConstructors.TLUpdateUserTyping17; public TLSendMessageActionBase Action { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Action.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Action = GetObject(input); return this; } } public class TLUpdateChatUserTyping : TLUpdateTypingBase { public const uint Signature = TLConstructors.TLUpdateChatUserTyping; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatUserTyping17 : TLUpdateChatUserTyping, IUserTypingAction { public new const uint Signature = TLConstructors.TLUpdateChatUserTyping17; public TLSendMessageActionBase Action { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Action = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); Action.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); Action = GetObject(input); return this; } } public class TLUpdateEncryptedChatTyping : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateEncryptedChatTyping; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatParticipants : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChatParticipants; public TLChatParticipantsBase Participants { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Participants = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Participants.ToStream(output); } public override TLObject FromStream(Stream input) { Participants = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserStatus : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateUserStatus; public TLInt UserId { get; set; } public TLUserStatus Status { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Status = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Status.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Status = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserName : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateUserName; public TLInt UserId { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); FirstName.ToStream(output); LastName.ToStream(output); UserName.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); FirstName = GetObject(input); LastName = GetObject(input); UserName = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserPhoto : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateUserPhoto; public TLInt UserId { get; set; } public TLInt Date { get; set; } public TLPhotoBase Photo { get; set; } public TLBool Previous { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Photo = GetObject(bytes, ref position); Previous = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Date.ToStream(output); Photo.ToStream(output); Previous.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Date = GetObject(input); Photo = GetObject(input); Previous = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateContactRegistered : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateContactRegistered; public TLInt UserId { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Date.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Date = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public abstract class TLUpdateContactLinkBase : TLUpdateBase { public TLInt UserId { get; set; } } public class TLUpdateContactLink : TLUpdateContactLinkBase { public const uint Signature = TLConstructors.TLUpdateContactLink; public TLMyLinkBase MyLink { get; set; } public TLForeignLinkBase ForeignLink { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); MyLink = GetObject(bytes, ref position); ForeignLink = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); MyLink.ToStream(output); ForeignLink.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); MyLink = GetObject(input); ForeignLink = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateContactLink24 : TLUpdateContactLinkBase { public const uint Signature = TLConstructors.TLUpdateContactLink24; public TLContactLinkBase MyLink { get; set; } public TLContactLinkBase ForeignLink { get; set; } public override string ToString() { return string.Format("TLUpdateContactLink24 user_id={0} my_link={1} foreign_link={2}", UserId, MyLink, ForeignLink); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); MyLink = GetObject(bytes, ref position); ForeignLink = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); MyLink.ToStream(output); ForeignLink.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); MyLink = GetObject(input); ForeignLink = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateActivation : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateActivation; public TLInt UserId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateNewAuthorization : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateNewAuthorization; public TLLong AuthKeyId { get; set; } public TLInt Date { get; set; } public TLString Device { get; set; } public TLString Location { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); AuthKeyId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Device = GetObject(bytes, ref position); Location = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); AuthKeyId.ToStream(output); Date.ToStream(output); Device.ToStream(output); Location.ToStream(output); } public override TLObject FromStream(Stream input) { AuthKeyId = GetObject(input); Date = GetObject(input); Device = GetObject(input); Location = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateDCOptions : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateDCOptions; public TLVector DCOptions { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DCOptions = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); DCOptions.ToStream(output); } public override TLObject FromStream(Stream input) { DCOptions = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateNotifySettings : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateNotifySettings; public TLNotifyPeerBase Peer { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); NotifySettings.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); NotifySettings = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserBlocked : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateUserBlocked; public TLInt UserId { get; set; } public TLBool Blocked { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Blocked = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Blocked.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Blocked = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdatePrivacy : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdatePrivacy; public TLPrivacyKeyBase Key { get; set; } public TLVector Rules { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Key = GetObject(bytes, ref position); Rules = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Key.ToStream(output); Rules.ToStream(output); } public override TLObject FromStream(Stream input) { Key = GetObject(input); Rules = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateUserPhone : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateUserPhone; public TLInt UserId { get; set; } public TLString Phone { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); UserId = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Phone.ToStream(output); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Phone = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateServiceNotification : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateServiceNotification; public TLString Type { get; set; } public TLString Message { get; set; } public TLMessageMediaBase Media { get; set; } public virtual TLBool Popup { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Popup = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Type.ToStream(output); Message.ToStream(output); Media.ToStream(output); Popup.ToStream(output); } public override TLObject FromStream(Stream input) { Type = GetObject(input); Message = GetObject(input); Media = GetObject(input); Popup = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateServiceNotification59 : TLUpdateServiceNotification { public new const uint Signature = TLConstructors.TLUpdateServiceNotification59; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Popup { get { return new TLBool(IsSet(_flags, (int)UpdateServiceNotificationFlags.Popup)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)UpdateServiceNotificationFlags.Popup); } } } public TLInt InboxDate { get; set; } public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); InboxDate = GetObject(Flags, (int)UpdateServiceNotificationFlags.InboxDate, null, bytes, ref position); Type = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Media = GetObject(bytes, ref position); Entities = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, InboxDate, Flags, (int)UpdateServiceNotificationFlags.InboxDate); Type.ToStream(output); Message.ToStream(output); Media.ToStream(output); Entities.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); InboxDate = GetObject(Flags, (int)UpdateServiceNotificationFlags.InboxDate, null, input); Type = GetObject(input); Message = GetObject(input); Media = GetObject(input); Entities = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateWebPage37 : TLUpdateWebPage, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateWebPage37; public TLInt Pts { get; set; } public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); WebPage = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); WebPage.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { WebPage = GetObject(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateWebPage : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateWebPage; public TLWebPageBase WebPage { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); WebPage = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); WebPage.ToStream(output); } public override TLObject FromStream(Stream input) { WebPage = GetObject(input); return this; } public override IList GetPts() { return new List(); } } [Flags] public enum UpdateChannelTooLongFlags { ChannelPts = 0x1 } public class TLUpdateChannelTooLong49 : TLUpdateChannelTooLong { public new const uint Signature = TLConstructors.TLUpdateChannelTooLong49; public TLInt Flags { get; set; } public TLInt ChannelPts { get; set; } public override string ToString() { return string.Format("TLUpdateChannelTooLong49 channel_id={0} channel_pts={1} flags={2}", ChannelId, ChannelPts, Flags); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); ChannelId = GetObject(bytes, ref position); ChannelPts = GetObject(Flags, (int)UpdateChannelTooLongFlags.ChannelPts, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ChannelId.ToStream(output); ToStream(output, ChannelPts, Flags, (int)UpdateChannelTooLongFlags.ChannelPts); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); ChannelId = GetObject(input); ChannelPts = GetObject(Flags, (int)UpdateChannelTooLongFlags.ChannelPts, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelTooLong : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelTooLong; public TLInt ChannelId { get; set; } public override string ToString() { return "TLUpdateChannelTooLong channel_id=" + ChannelId; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelGroup : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelGroup; public TLInt ChannelId { get; set; } public TLMessageGroup Group { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); Group = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); Group.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); Group = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateNewChannelMessage : TLUpdateBase, IMultiChannelPts { public const uint Signature = TLConstructors.TLUpdateNewChannelMessage; public TLMessageBase Message { get; set; } public TLInt ChannelPts { get; set; } public TLInt ChannelPtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); var messageCommon = Message as TLMessageCommon; if (messageCommon != null) messageCommon.SetUnreadSilent(TLBool.True); ChannelPts = GetObject(bytes, ref position); ChannelPtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); ChannelPts.ToStream(output); ChannelPtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); ChannelPts = GetObject(input); ChannelPtsCount = GetObject(input); return this; } public override IList GetPts() { return new List(); } public override string ToString() { var toId = Message is TLMessageCommon ? ((TLMessageCommon) Message).ToId : null; return string.Format("{0} message_id={1} channel=[{2}]", GetType(), Message.Index, toId); } } public class TLUpdateReadChannelInbox : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateReadChannelInbox; public TLInt ChannelId { get; set; } public TLInt MaxId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); MaxId.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); MaxId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateDeleteChannelMessages : TLUpdateBase, IMultiChannelPts { public const uint Signature = TLConstructors.TLUpdateDeleteChannelMessages; public TLInt ChannelId { get; set; } public TLVector Messages { get; set; } public TLInt ChannelPts { get; set; } public TLInt ChannelPtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); ChannelPts = GetObject(bytes, ref position); ChannelPtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); Messages.ToStream(output); ChannelPts.ToStream(output); ChannelPtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); Messages = GetObject>(input); ChannelPts = GetObject(input); ChannelPtsCount = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelMessageViews : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelMessageViews; public TLInt ChannelId { get; set; } public TLInt Id { get; set; } public TLInt Views { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Views = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); Id.ToStream(output); Views.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); Id = GetObject(input); Views = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannel : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannel; public TLInt ChannelId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); return this; } public override string ToString() { return "TLUpdateChannel channel_id=" + ChannelId; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatAdmins : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChatAdmins; public TLInt ChatId { get; set; } public TLBool Enabled { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); Enabled = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); Enabled.ToStream(output); Version.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); Enabled = GetObject(input); Version = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChatParticipantAdmin : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChatParticipantAdmin; public TLInt ChatId { get; set; } public TLInt UserId { get; set; } public TLBool IsAdmin { get; set; } public TLInt Version { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChatId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); IsAdmin = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChatId.ToStream(output); UserId.ToStream(output); IsAdmin.ToStream(output); Version.ToStream(output); } public override TLObject FromStream(Stream input) { ChatId = GetObject(input); UserId = GetObject(input); IsAdmin = GetObject(input); Version = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateNewStickerSet : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateNewStickerSet; public TLMessagesStickerSet Stickerset { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Stickerset = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Stickerset.ToStream(output); } public override TLObject FromStream(Stream input) { Stickerset = GetObject(input); return this; } public override IList GetPts() { return new List(); } } [Flags] public enum UpdateStickerSetsOrderFlags { Masks = 0x1 } public class TLUpdateStickerSetsOrder56 : TLUpdateStickerSetsOrder { public new const uint Signature = TLConstructors.TLUpdateStickerSetsOrder56; public TLInt Flags { get; set; } public bool Masks { get { return IsSet(Flags, (int)UpdateStickerSetsOrderFlags.Masks); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Order = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Order.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Order = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateStickerSetsOrder : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateStickerSetsOrder; public TLVector Order { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Order = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Order.ToStream(output); } public override TLObject FromStream(Stream input) { Order = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateStickerSets : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateStickerSets; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateSavedGifs : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateSavedGifs; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotInlineQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotInlineQuery; public TLLong QueryId { get; set; } public TLInt UserId { get; set; } public TLString Query { get; set; } public TLString Offset { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Query = GetObject(bytes, ref position); Offset = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); UserId.ToStream(output); Query.ToStream(output); Offset.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); UserId = GetObject(input); Query = GetObject(input); Offset = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotInlineQuery51 : TLUpdateBotInlineQuery { public new const uint Signature = TLConstructors.TLUpdateBotInlineQuery51; public TLInt Flags { get; set; } public TLGeoPointBase Geo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Query = GetObject(bytes, ref position); Geo = GetObject(Flags, (int)UpdateFlags.Geo, null, bytes, ref position); Offset = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); UserId.ToStream(output); Query.ToStream(output); ToStream(output, Geo, Flags, (int)UpdateFlags.Geo); Offset.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); UserId = GetObject(input); Query = GetObject(input); Geo = GetObject(Flags, (int)UpdateFlags.Geo, null, input); Offset = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotInlineSend : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotInlineSend; public TLInt Flags { get; set; } public TLInt UserId { get; set; } public TLString Query { get; set; } public TLGeoPointBase Geo { get; set; } public TLString Id { get; set; } public TLInputBotInlineMessageId MessageId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Query = GetObject(bytes, ref position); Geo = GetObject(Flags, (int)UpdateFlags.Geo, null, bytes, ref position); Id = GetObject(bytes, ref position); MessageId = GetObject(Flags, (int)UpdateFlags.MessageId, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); UserId.ToStream(output); Query.ToStream(output); ToStream(output, Geo, Flags, (int)UpdateFlags.Geo); Id.ToStream(output); ToStream(output, MessageId, Flags, (int)UpdateFlags.MessageId); } public override TLObject FromStream(Stream input) { UserId = GetObject(input); Query = GetObject(input); Geo = GetObject(Flags, (int)UpdateFlags.Geo, null, input); Id = GetObject(input); MessageId = GetObject(Flags, (int)UpdateFlags.MessageId, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateEditChannelMessage : TLUpdateBase, IMultiChannelPts { public const uint Signature = TLConstructors.TLUpdateEditChannelMessage; public TLMessageBase Message { get; set; } public TLInt ChannelPts { get; set; } public TLInt ChannelPtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); //Execute.ShowDebugMessage(string.Format("TLUpdateEditChannelMessage.FromBytes channel_pts={0} channel_pts_count={1} message={2}", ChannelPts, ChannelPtsCount, Message)); Message = GetObject(bytes, ref position); ChannelPts = GetObject(bytes, ref position); ChannelPtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); ChannelPts.ToStream(output); ChannelPtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); ChannelPts = GetObject(input); ChannelPtsCount = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelPinnedMessage : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelPinnedMessage; public TLInt ChannelId { get; set; } public TLInt Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); Id.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); Id = GetObject(input); return this; } public override IList GetPts() { return new List(); } } [Flags] public enum UpdateBotCallbackQueryFlags { Data = 0x1, GameId = 0x2, } public class TLUpdateBotCallbackQuery56 : TLUpdateBotCallbackQuery { public new const uint Signature = TLConstructors.TLUpdateBotCallbackQuery56; public TLInt Flags { get; set; } public TLInt GameId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); Data = GetObject(Flags, (int)UpdateBotCallbackQueryFlags.Data, null, bytes, ref position); GameId = GetObject(Flags, (int)UpdateBotCallbackQueryFlags.GameId, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); UserId.ToStream(output); Peer.ToStream(output); MessageId.ToStream(output); ToStream(output, Data, Flags, (int)UpdateBotCallbackQueryFlags.Data); ToStream(output, GameId, Flags, (int)UpdateBotCallbackQueryFlags.GameId); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); UserId = GetObject(input); Peer = GetObject(input); MessageId = GetObject(input); Data = GetObject(Flags, (int)UpdateBotCallbackQueryFlags.Data, null, input); GameId = GetObject(Flags, (int)UpdateBotCallbackQueryFlags.GameId, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotCallbackQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotCallbackQuery; public TLLong QueryId { get; set; } public TLInt UserId { get; set; } public TLPeerBase Peer { get; set; } public TLInt MessageId { get; set; } public TLString Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); Data = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); UserId.ToStream(output); Peer.ToStream(output); MessageId.ToStream(output); Data.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); UserId = GetObject(input); Peer = GetObject(input); MessageId = GetObject(input); Data = GetObject(input); return this; } public override IList GetPts() { return new List(); } } [Flags] public enum UpdateInlineBotCallbackQueryFlags { Data = 0x1, GameId = 0x2 } public class TLUpdateInlineBotCallbackQuery56 : TLUpdateInlineBotCallbackQuery { public new const uint Signature = TLConstructors.TLUpdateInlineBotCallbackQuery56; public TLInt Flags { get; set; } public TLInt GameId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); Data = GetObject(Flags, (int)UpdateInlineBotCallbackQueryFlags.Data, null, bytes, ref position); GameId = GetObject(Flags, (int)UpdateInlineBotCallbackQueryFlags.GameId, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); UserId.ToStream(output); MessageId.ToStream(output); ToStream(output, Data, Flags, (int)UpdateBotCallbackQueryFlags.Data); ToStream(output, GameId, Flags, (int)UpdateBotCallbackQueryFlags.GameId); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); UserId = GetObject(input); MessageId = GetObject(input); Data = GetObject(Flags, (int)UpdateInlineBotCallbackQueryFlags.Data, null, input); GameId = GetObject(Flags, (int)UpdateInlineBotCallbackQueryFlags.GameId, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateInlineBotCallbackQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateInlineBotCallbackQuery; public TLLong QueryId { get; set; } public TLInt UserId { get; set; } public TLInputBotInlineMessageId MessageId { get; set; } public TLString Data { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); MessageId = GetObject(bytes, ref position); Data = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); UserId.ToStream(output); MessageId.ToStream(output); Data.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); UserId = GetObject(input); MessageId = GetObject(input); Data = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateEditMessage : TLUpdateBase, IMultiPts { public const uint Signature = TLConstructors.TLUpdateEditMessage; public TLMessageBase Message { get; set; } public TLInt Pts { get; set; } public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Execute.ShowDebugMessage(string.Format("TLUpdateEditMessage.FromBytes pts={0} pts_count={1} message={2}", Pts, PtsCount, Message)); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Message.ToStream(output); Pts.ToStream(output); PtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { Message = GetObject(input); Pts = GetObject(input); PtsCount = GetObject(input); return this; } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdateReadChannelOutbox : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateReadChannelOutbox; public TLInt ChannelId { get; set; } public TLInt MaxId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); MaxId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); MaxId.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); MaxId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateDraftMessage : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateDraftMessage; public TLPeerBase Peer { get; set; } public TLDraftMessageBase Draft { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); Draft = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); Draft.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); Draft = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateReadFeaturedStickers : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateReadFeaturedStickers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateRecentStickers : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateRecentStickers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateConfig : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateConfig; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdatePtsChanged : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdatePtsChanged; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelWebPage : TLUpdateWebPage, IMultiChannelPts { public new const uint Signature = TLConstructors.TLUpdateChannelWebPage; public TLInt ChannelId { get; set; } public TLInt ChannelPts { get; set; } public TLInt ChannelPtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); WebPage = GetObject(bytes, ref position); ChannelPts = GetObject(bytes, ref position); ChannelPtsCount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); WebPage.ToStream(output); ChannelPts.ToStream(output); ChannelPtsCount.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); WebPage = GetObject(input); ChannelPts = GetObject(input); ChannelPtsCount = GetObject(input); return this; } public override IList GetPts() { return new List(); //TLUtils.GetPtsRange(Pts, PtsCount); } } public class TLUpdatePhoneCall : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdatePhoneCall; public TLPhoneCallBase PhoneCall { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneCall = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); PhoneCall.ToStream(output); } public override TLObject FromStream(Stream input) { PhoneCall = GetObject(input); return this; } public override IList GetPts() { return new List(); } public override string ToString() { return string.Format("TLUpdatePhoneCall PhoneCall={0}", PhoneCall); } } public abstract class TLUpdateDialogPinnedBase : TLUpdateBase { protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Pinned { get { return IsSet(Flags, (int)UpdateDilogPinnedFlags.Pinned); } set { SetUnset(ref _flags, value, (int)UpdateDilogPinnedFlags.Pinned); } } } public class TLUpdateDialogPinned76 : TLUpdateDialogPinnedBase { public const uint Signature = TLConstructors.TLUpdateDialogPinned76; public TLDialogPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateDialogPinned : TLUpdateDialogPinnedBase { public const uint Signature = TLConstructors.TLUpdateDialogPinned; public TLPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public abstract class TLUpdatePinnedDialogsBase : TLUpdateBase { protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } } public class TLUpdatePinnedDialogs76 : TLUpdatePinnedDialogsBase { public const uint Signature = TLConstructors.TLUpdatePinnedDialogs76; protected TLVector _order; public TLVector Order { get { return _order; } set { SetField(out _order, value, ref _flags, (int)UpdatePinnedDialogsFlags.Order); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Order = GetObject>(Flags, (int)UpdatePinnedDialogsFlags.Order, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Order, Flags, (int)UpdatePinnedDialogsFlags.Order); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Order = GetObject>(Flags, (int)UpdatePinnedDialogsFlags.Order, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdatePinnedDialogs : TLUpdatePinnedDialogsBase { public const uint Signature = TLConstructors.TLUpdatePinnedDialogs; protected TLVector _order; public TLVector Order { get { return _order; } set { SetField(out _order, value, ref _flags, (int)UpdatePinnedDialogsFlags.Order); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Order = GetObject>(Flags, (int)UpdatePinnedDialogsFlags.Order, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); ToStream(output, Order, Flags, (int)UpdatePinnedDialogsFlags.Order); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Order = GetObject>(Flags, (int)UpdatePinnedDialogsFlags.Order, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotWebhookJSON : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotWebhookJSON; public TLString DataJSON { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); DataJSON = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); DataJSON.ToStream(output); } public override TLObject FromStream(Stream input) { DataJSON = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotWebhookJSONQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotWebhookJSONQuery; public TLLong QueryId { get; set; } public TLString DataJSON { get; set; } public TLInt Timeout { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); DataJSON = GetObject(bytes, ref position); Timeout = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); DataJSON.ToStream(output); Timeout.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); DataJSON = GetObject(input); Timeout = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotShippingQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotShippingQuery; public TLLong QueryId { get; set; } public TLInt UserId { get; set; } public TLString Payload { get; set; } public TLPostAddress ShippingAddress { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Payload = GetObject(bytes, ref position); ShippingAddress = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); QueryId.ToStream(output); UserId.ToStream(output); Payload.ToStream(output); ShippingAddress.ToStream(output); } public override TLObject FromStream(Stream input) { QueryId = GetObject(input); UserId = GetObject(input); Payload = GetObject(input); ShippingAddress = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateBotPrecheckoutQuery : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateBotPrecheckoutQuery; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLLong QueryId { get; set; } public TLInt UserId { get; set; } public TLString Payload { get; set; } protected TLPaymentRequestedInfo _info; public TLPaymentRequestedInfo Info { get { return _info; } set { SetField(out _info, value, ref _flags, (int)UpdateBotPrecheckoutQueryFlags.Info); } } protected TLString _shippingOptionId; public TLString ShippingOptionId { get { return _shippingOptionId; } set { SetField(out _shippingOptionId, value, ref _flags, (int)UpdateBotPrecheckoutQueryFlags.ShippingOptionId); } } public TLString Currency { get; set; } public TLLong TotalAmount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); QueryId = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Payload = GetObject(bytes, ref position); _info = GetObject(Flags, (int)UpdateBotPrecheckoutQueryFlags.Info, null, bytes, ref position); _shippingOptionId = GetObject(Flags, (int)UpdateBotPrecheckoutQueryFlags.ShippingOptionId, null, bytes, ref position); Currency = GetObject(bytes, ref position); TotalAmount = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); QueryId.ToStream(output); UserId.ToStream(output); Payload.ToStream(output); ToStream(output, Info, Flags, (int)UpdateBotPrecheckoutQueryFlags.Info); ToStream(output, ShippingOptionId, Flags, (int)UpdateBotPrecheckoutQueryFlags.ShippingOptionId); Currency.ToStream(output); TotalAmount.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); QueryId = GetObject(input); UserId = GetObject(input); Payload = GetObject(input); _info = GetObject(Flags, (int)UpdateBotPrecheckoutQueryFlags.Info, null, input); _shippingOptionId = GetObject(Flags, (int)UpdateBotPrecheckoutQueryFlags.ShippingOptionId, null, input); Currency = GetObject(input); TotalAmount = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateLangPackTooLong : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateLangPackTooLong; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateLangPack : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateLangPack; public TLLangPackDifference Difference { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Difference = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Difference.ToStream(output); } public override TLObject FromStream(Stream input) { Difference = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateFavedStickers : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateFavedStickers; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelReadMessagesContents : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelReadMessagesContents; public TLInt ChannelId { get; set; } public TLVector Messages { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); Messages = GetObject>(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); Messages.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); Messages = GetObject>(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateContactsReset : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateContactsReset; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override IList GetPts() { return new List(); } } public class TLUpdateChannelAvailableMessages : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateChannelAvailableMessages; public TLInt ChannelId { get; set; } public TLInt AvailableMinId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); ChannelId = GetObject(bytes, ref position); AvailableMinId = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); ChannelId.ToStream(output); AvailableMinId.ToStream(output); } public override TLObject FromStream(Stream input) { ChannelId = GetObject(input); AvailableMinId = GetObject(input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateReadFeed : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateReadFeed; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt FeedId { get; set; } public TLFeedPosition MaxPosition { get; set; } protected TLInt _unreadCount; public TLInt UnreadCount { get { return _unreadCount; } set { SetField(out _unreadCount, value, ref _flags, (int)UpdateReadFeedFlags.UnreadCount); } } protected TLInt _unreadMutedCount; public TLInt UnreadMutedCount { get { return _unreadMutedCount; } set { SetField(out _unreadMutedCount, value, ref _flags, (int)UpdateReadFeedFlags.UnreadCount); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); FeedId = GetObject(bytes, ref position); MaxPosition = GetObject(bytes, ref position); _unreadCount = GetObject(Flags, (int)UpdateReadFeedFlags.UnreadCount, null, bytes, ref position); _unreadMutedCount = GetObject(Flags, (int)UpdateReadFeedFlags.UnreadCount, null, bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); FeedId.ToStream(output); MaxPosition.ToStream(output); ToStream(output, _unreadCount, Flags, (int)UpdateReadFeedFlags.UnreadCount); ToStream(output, _unreadMutedCount, Flags, (int)UpdateReadFeedFlags.UnreadCount); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); FeedId = GetObject(input); MaxPosition = GetObject(input); _unreadCount = GetObject(Flags, (int)UpdateReadFeedFlags.UnreadCount, null, input); _unreadMutedCount = GetObject(Flags, (int)UpdateReadFeedFlags.UnreadCount, null, input); return this; } public override IList GetPts() { return new List(); } } public class TLUpdateDialogUnreadMark : TLUpdateBase { public const uint Signature = TLConstructors.TLUpdateDialogUnreadMark; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Unread { get { return IsSet(_flags, (int)UpdateDialogUnreadMarkFlags.Unread); } set { SetUnset(ref _flags, value, (int)UpdateDialogUnreadMarkFlags.Unread); } } public TLDialogPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Peer = GetObject(input); return this; } public override IList GetPts() { return new List(); } } } ================================================ FILE: Telegram.Api/TL/TLUpdates.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Telegram.Api.TL { public abstract class TLUpdatesBase : TLObject { public abstract IList GetSeq(); public abstract IList GetPts(); } public class TLUpdatesTooLong : TLUpdatesBase { public const uint Signature = TLConstructors.TLUpdatesTooLong; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return new List(); } } public class TLUpdatesShortSentMessage : TLUpdatesBase, ISentMessageMedia, IMultiPts { public const uint Signature = TLConstructors.TLUpdatesShortSentMessage; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt Id { get; set; } public TLInt Pts { get; set; } public TLInt PtsCount { get; set; } public TLInt Date { get; set; } public TLMessageMediaBase Media { get; set; } public TLVector Entities { get; set; } public bool HasMedia { get { return IsSet(Flags, (int) MessageFlags.Media); } } public bool HasEntities { get { return IsSet(Flags, (int) MessageFlags.Entities); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.Media)) { Media = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _flags.Value |= (int) MessageFlags.Unread; return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("TLUpdatesShortSentMessage id={0} media={1} flags={2}", Id, Media, TLMessageBase.MessageFlagsString(Flags)); } } public class TLUpdatesShortMessage : TLUpdatesBase { public const uint Signature = TLConstructors.TLUpdateShortMessage; public TLInt Id { get; set; } public TLInt UserId { get; set; } public TLString Message { get; set; } public TLInt Pts { get; set; } public TLInt Date { get; set; } public TLInt Seq { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override IList GetSeq() { return new List { Seq }; } public override IList GetPts() { return new List { Pts }; } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage24 : TLUpdatesShortMessage, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateShortMessage24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage25 : TLUpdatesShortMessage24 { public new const uint Signature = TLConstructors.TLUpdatesShortMessage25; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt FwdFromId { get; set; } public TLInt FwdDate { get; set; } public TLInt ReplyToMsgId { get; set; } public TLBool Out { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Out)); } } public TLBool Unread { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Unread)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage34 : TLUpdatesShortMessage25 { public new const uint Signature = TLConstructors.TLUpdatesShortMessage34; public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage40 : TLUpdatesShortMessage34 { public new const uint Signature = TLConstructors.TLUpdatesShortMessage40; public TLPeerBase FwdFrom { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFrom = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } #if DEBUG var messageString = Message.ToString(); var logString = string.Format("TLUpdateShortMessage40 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} reply_to_msg_id={9} entities={10}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ReplyToMsgId, Entities); Logs.Log.Write(logString); #endif return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage45 : TLUpdatesShortMessage40 { public new const uint Signature = TLConstructors.TLUpdatesShortMessage45; public TLInt ViaBotId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFrom = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } //#if DEBUG // var messageString = Message.ToString(); // var logString = string.Format("TLUpdateShortMessage45 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} via_bot_id={9} reply_to_msg_id={10} entities={11}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ViaBotId, ReplyToMsgId, Entities); // Logs.Log.Write(logString); //#endif return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortMessage48 : TLUpdatesShortMessage45 { public new const uint Signature = TLConstructors.TLUpdatesShortMessage48; public TLMessageFwdHeader FwdHeader { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdHeader = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _flags.Value |= (int)MessageFlags.Unread; //#if DEBUG // var messageString = Message.ToString(); // var logString = string.Format("TLUpdateShortMessage45 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} via_bot_id={9} reply_to_msg_id={10} entities={11}, fwd_header={12}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ViaBotId, ReplyToMsgId, Entities, FwdHeader); // Logs.Log.Write(logString); //#endif return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("UserMessage: FromId: {0} Message: {1}", UserId, Message); } } public class TLUpdatesShortChatMessage : TLUpdatesShortMessage { public new const uint Signature = TLConstructors.TLUpdateShortChatMessage; public TLInt ChatId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("ChatMessage: ChatId: {0} FromId: {1} Message: {2}", ChatId, UserId, Message); } } public class TLUpdatesShortChatMessage24 : TLUpdatesShortChatMessage, IMultiPts { public new const uint Signature = TLConstructors.TLUpdateShortChatMessage24; public TLInt PtsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("ChatMessage: ChatId: {0} FromId: {1} Message: {2}", ChatId, UserId, Message); } } public class TLUpdatesShortChatMessage25 : TLUpdatesShortChatMessage24 { public new const uint Signature = TLConstructors.TLUpdatesShortChatMessage25; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInt FwdFromId { get; set; } public TLInt FwdDate { get; set; } public TLInt ReplyToMsgId { get; set; } public TLBool Out { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Out)); } } public TLBool Unread { get { return new TLBool(IsSet(_flags, (int)MessageFlags.Unread)); } set { if (value != null) { SetUnset(ref _flags, value.Value, (int)MessageFlags.Unread); } } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return TLUtils.GetPtsRange(Pts, PtsCount); } public override string ToString() { return string.Format("ChatMessage: ChatId: {0} FromId: {1} Message: {2}", ChatId, UserId, Message); } } public class TLUpdatesShortChatMessage34 : TLUpdatesShortChatMessage25 { public new const uint Signature = TLConstructors.TLUpdatesShortChatMessage34; public TLVector Entities { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFromId = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } return this; } } public class TLUpdatesShortChatMessage40 : TLUpdatesShortChatMessage34 { public new const uint Signature = TLConstructors.TLUpdatesShortChatMessage40; public TLPeerBase FwdFrom { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFrom = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } #if DEBUG var messageString = Message.ToString(); var logString = string.Format("TLUpdateShortChatMessage40 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} reply_to_msg_id={9} entities={10}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ReplyToMsgId, Entities); Logs.Log.Write(logString); #endif return this; } } public class TLUpdatesShortChatMessage45 : TLUpdatesShortChatMessage40 { public new const uint Signature = TLConstructors.TLUpdatesShortChatMessage45; public TLInt ViaBotId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdFrom = GetObject(bytes, ref position); FwdDate = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } #if DEBUG var messageString = Message.ToString(); var logString = string.Format("TLUpdateShortChatMessage44 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} reply_to_msg_id={9} via_bot_id={10} entities={11}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ViaBotId, ReplyToMsgId, Entities); Logs.Log.Write(logString); #endif return this; } } public class TLUpdatesShortChatMessage48 : TLUpdatesShortChatMessage45 { public new const uint Signature = TLConstructors.TLUpdatesShortChatMessage48; public TLMessageFwdHeader FwdHeader { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); ChatId = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); Pts = GetObject(bytes, ref position); PtsCount = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); if (IsSet(Flags, (int)MessageFlags.FwdFrom)) { FwdHeader = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ViaBotId)) { ViaBotId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.ReplyToMsgId)) { ReplyToMsgId = GetObject(bytes, ref position); } if (IsSet(Flags, (int)MessageFlags.Entities)) { Entities = GetObject>(bytes, ref position); } _flags.Value |= (int)MessageFlags.Unread; #if DEBUG var messageString = Message.ToString(); var logString = string.Format("TLUpdateShortChatMessage48 id={0} flags={1} user_id={2} message={3} pts={4} pts_count={5} date={6} fwd_from={7} fwd_date={8} reply_to_msg_id={9} via_bot_id={10} entities={11} fwd_header={12}", Id, TLMessageBase.MessageFlagsString(Flags), UserId, messageString.Substring(0, Math.Min(messageString.Length, 5)), Pts, PtsCount, Date, FwdFrom, FwdDate, ViaBotId, ReplyToMsgId, Entities, FwdHeader); Logs.Log.Write(logString); #endif return this; } } public class TLUpdatesShort : TLUpdatesBase { public const uint Signature = TLConstructors.TLUpdateShort; public TLUpdateBase Update { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Update = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override IList GetSeq() { return new List(); } public override IList GetPts() { return Update.GetPts(); } public override string ToString() { return "TLUpdatesShort Update: " + Update; } } public class TLUpdates : TLUpdatesBase { public const uint Signature = TLConstructors.TLUpdates; public TLVector Updates { get; set; } public TLVector Users { get; set; } public TLVector Chats { get; set; } public TLInt Date { get; set; } public TLInt Seq { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Updates = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Date = GetObject(bytes, ref position); Seq = GetObject(bytes, ref position); return this; } public override string ToString() { var info = new StringBuilder(); info.AppendLine("TLUpdates"); for (var i = 0; i < Updates.Count; i++) { info.AppendLine(Updates[i].ToString()); } return info.ToString(); } public override IList GetSeq() { return new List{Seq}; } public override IList GetPts() { return Updates.SelectMany(x => x.GetPts()).ToList(); } } public class TLUpdatesCombined : TLUpdates { public new const uint Signature = TLConstructors.TLUpdatesCombined; public TLInt SeqStart { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Updates = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Date = GetObject(bytes, ref position); SeqStart = GetObject(bytes, ref position); // seq младший Seq = GetObject(bytes, ref position); // seq старший return this; } public override IList GetSeq() { var list = new List(); for (var i = SeqStart.Value; i <= Seq.Value; i++) { list.Add(new TLInt(i)); } return list; } public override IList GetPts() { return Updates.SelectMany(x => x.GetPts()).ToList(); } } } ================================================ FILE: Telegram.Api/TL/TLUserBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.IO; #if WINDOWS_PHONE using System.Windows; using Microsoft.Phone.UserData; #elif WIN_RT using Windows.UI.Xaml; #endif using Telegram.Api.TL.Interfaces; using Telegram.Api.Extensions; using Telegram.Api.Resources; namespace Telegram.Api.TL { [Flags] public enum UserFlags { AccessHash = 0x1, // 0 FirstName = 0x2, // 1 LastName = 0x4, UserName = 0x8, Phone = 0x10, Photo = 0x20, Status = 0x40, // 6 // = 0x80, // 7 // = 0x100, // 8 // = 0x200, // 9 Self = 0x400, // 10 Contact = 0x800, ContactMutual = 0x1000, Deleted = 0x2000, Bot = 0x4000, BotAllHistory = 0x8000, BotGroupsBlocked = 0x10000, Verified = 0x20000, Restricted = 0x40000, BotInlinePlaceholder = 0x80000, Min = 0x100000, // 20 BotInlineGeo = 0x200000, LangCode = 0x400000, } [Flags] public enum UserCustomFlags { Blocked = 0x1, // 0 About = 0x2, // 1 BotInlineGeoAccess = 0x4, NotifyGeoAccessDate = 0x8, ReadInboxMaxId = 0x10, ReadOutboxMaxId = 0x20, BotOpenUrlPermission = 0x40, BotPassTelegramNameToWebPagesPermission = 0x80, CommonChatsCount = 0x100, BotPaymentsPermission = 0x200, } public interface IReadMaxId { TLInt ReadInboxMaxId { get; set; } TLInt ReadOutboxMaxId { get; set; } } public interface IUserName { TLString UserName { get; set; } } public interface INotifySettings { TLPeerNotifySettingsBase NotifySettings { get; set; } } public class TLUserExtendedInfo : TLObject { public const uint Signature = TLConstructors.TLUserExtendedInfo; public TLString FirstName { get; set; } public TLString LastName { get; set; } public override TLObject FromStream(Stream input) { FirstName = GetObject(input); LastName = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); } } public class TLUserPhone : TLObject { public TLInt Kind { get; set; } public TLString Number { get; set; } public TLString Description { get; set; } protected bool _isSelected; public bool IsSelected { get { return _isSelected; } set { SetField(ref _isSelected, value, () => IsSelected); } } protected bool _isIconVisible; public bool IsIconVisible { get { return _isIconVisible; } set { SetField(ref _isIconVisible, value, () => IsIconVisible); } } } public class TLUserNotRegistered : TLUserBase { public TLVector Phones { get; set; } public override TLInputUserBase ToInputUser() { return null; } public override TLInputPeerBase ToInputPeer() { return null; } public override string GetUnsendedTextFileName() { return "u" + Id + ".dat"; } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } public abstract class TLUserBase : TLObject, IInputPeer, ISelectable, IFullName, INotifySettings, IVIsibility { public abstract bool IsDeleted { get; set; } public abstract bool IsSelf { get; set; } public abstract bool IsForeign { get; } //access_hash, !phone, !contact, !contact_mutual public abstract bool IsRequest { get; } //access_hash, phone, !contact, !contact_mutual public abstract bool IsContact { get; set; } //access_hash, phone, contact public abstract bool IsContactMutual { get; set; } //access_hash, phone, contact_mutual public bool IsAdmin { get; set; } public string AccessToken { get; set; } public TLUserBase Self { get { return this; } } public int Index { get { return Id.Value; } set { Id = new TLInt(value); } } public TLInt Id { get; set; } public TLString _firstName; public TLString FirstName { get { return _firstName; } set { SetField(ref _firstName, value, () => FirstName); NotifyOfPropertyChange(() => FullName2); } } public TLString _lastName; public TLString LastName { get { return _lastName; } set { SetField(ref _lastName, value, () => LastName); NotifyOfPropertyChange(() => FullName2); } } public TLString Phone { get; set; } public TLPhotoBase _photo; public TLPhotoBase Photo { get { return _photo; } set { SetField(ref _photo, value, () => Photo); } } public TLUserStatus _status; public TLUserStatus Status { get { return _status; } set { if (_status != value) { _status = value; NotifyOfPropertyChange(() => Status); NotifyOfPropertyChange(() => StatusCommon); } } } public TLUserBase StatusCommon { get { return this; } } public int StatusValue { get { if (Status is TLUserStatusOnline) { return int.MaxValue; } var offline = Status as TLUserStatusOffline; if (offline != null) { return offline.WasOnline.Value; } return int.MinValue; } } public static string UserFlagsString(TLInt flags) { if (flags == null) return string.Empty; var list = (UserFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } public static string UserCustomFlagsString(TLLong flags) { if (flags == null) return string.Empty; var list = (UserCustomFlags)flags.Value; return string.Format("{0} [{1}]", flags, list); } #region Additional public virtual bool IsVerified { get { return Index == 777000; } set { throw new NotImplementedException(); } } public IList FullNameWords { get; set; } public bool RemoveUserAction { get; set; } public TLContact Contact { get; set; } public override string ToString() { return string.Format("{0} {1} {2}", GetType().Name, Index, FullName); } public static string GetFirstName(TLString FirstName, TLString LastName, TLString Phone) { var firstName = FirstName != null ? FirstName.ToString().Trim() : string.Empty; if (!string.IsNullOrEmpty(firstName)) { return firstName; } var lastName = LastName != null ? LastName.ToString().Trim() : string.Empty; if (!string.IsNullOrEmpty(lastName)) { return lastName; } if (string.IsNullOrEmpty(firstName) && string.IsNullOrEmpty(lastName)) { return Phone != null ? "+" + Phone : string.Empty; } return string.Empty; } public virtual string ShortName { get { if (IsSelf) { return AppResources.SavedMessages; } if (this is TLUserEmpty) { return AppResources.EmptyUser; } if (IsDeleted) { return AppResources.DeletedUser; } var firstName = FirstName != null ? FirstName.ToString() : string.Empty; var lastName = LastName != null ? LastName.ToString() : string.Empty; if (ExtendedInfo != null) { firstName = ExtendedInfo.FirstName != null ? ExtendedInfo.FirstName.ToString() : string.Empty; lastName = ExtendedInfo.LastName != null ? ExtendedInfo.LastName.ToString() : string.Empty; } if (string.Equals(firstName, lastName, StringComparison.OrdinalIgnoreCase)) { return firstName; } if (!string.IsNullOrEmpty(firstName)) { return firstName; } if (!string.IsNullOrEmpty(lastName)) { return lastName; } return Phone != null ? "+" + Phone : string.Empty; } } public virtual string FullName { get { if (IsSelf) { return AppResources.SavedMessages; } if (this is TLUserEmpty) { return AppResources.EmptyUser; } if (IsDeleted) { return AppResources.DeletedUser; } var firstName = FirstName != null ? FirstName.ToString() : string.Empty; var lastName = LastName != null ? LastName.ToString() : string.Empty; if (ExtendedInfo != null) { firstName = ExtendedInfo.FirstName != null ? ExtendedInfo.FirstName.ToString() : string.Empty; lastName = ExtendedInfo.LastName != null ? ExtendedInfo.LastName.ToString() : string.Empty; } if (string.IsNullOrEmpty(firstName) && string.IsNullOrEmpty(lastName)) { return Phone != null ? "+" + Phone : string.Empty; } if (string.Equals(firstName, lastName, StringComparison.OrdinalIgnoreCase)) { return firstName; } if (string.IsNullOrEmpty(firstName)) { return lastName; } if (string.IsNullOrEmpty(lastName)) { return firstName; } return string.Format("{0} {1}", firstName, lastName); } } public virtual string FullName2 { get { if (this is TLUserEmpty) { return AppResources.EmptyUser; } if (IsDeleted) { return AppResources.DeletedUser; } var firstName = FirstName != null ? FirstName.ToString() : string.Empty; var lastName = LastName != null ? LastName.ToString() : string.Empty; if (ExtendedInfo != null) { firstName = ExtendedInfo.FirstName != null ? ExtendedInfo.FirstName.ToString() : string.Empty; lastName = ExtendedInfo.LastName != null ? ExtendedInfo.LastName.ToString() : string.Empty; } if (string.IsNullOrEmpty(firstName) && string.IsNullOrEmpty(lastName)) { return Phone != null ? "+" + Phone : string.Empty; } if (string.Equals(firstName, lastName, StringComparison.OrdinalIgnoreCase)) { return firstName; } if (string.IsNullOrEmpty(firstName)) { return lastName; } if (string.IsNullOrEmpty(lastName)) { return firstName; } return string.Format("{0} {1}", firstName, lastName); } } public virtual bool HasPhone { get { return Phone != null && !string.IsNullOrEmpty(Phone.ToString()); } } public abstract TLInputUserBase ToInputUser(); public virtual void Update(TLUserBase user) { try { _firstName = user.FirstName; _lastName = user.LastName; Phone = user.Phone; if (Photo != null && user.Photo != null && Photo.GetType() == user.Photo.GetType()) { Photo.Update(user.Photo); } else { _photo = user.Photo; } _status = user.Status; if (user.Contact != null) { Contact = user.Contact; } if (user.Link != null) { Link = user.Link; } if (user.ProfilePhoto != null) { ProfilePhoto = user.ProfilePhoto; } if (user.NotifySettings != null) { NotifySettings = user.NotifySettings; } if (user.ExtendedInfo != null) { ExtendedInfo = user.ExtendedInfo; } if (user.Blocked != null) { Blocked = user.Blocked; } } catch (Exception e) { } } public abstract TLInputPeerBase ToInputPeer(); public virtual string GetUnsendedTextFileName() { return "u" + Id + ".dat"; } public TLUserExtendedInfo ExtendedInfo { get; set; } #region UserFull information public TLLinkBase Link { get; set; } public TLPhotoBase ProfilePhoto { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public virtual TLBool Blocked { get; set; } public TLBotInfoBase BotInfo { get; set; } #endregion public Visibility DeleteActionVisibility { get; set; } #endregion public TLInputNotifyPeerBase ToInputNotifyPeer() { return new TLInputNotifyPeer { Peer = ToInputPeer() }; } private bool _isVisible; public bool IsVisible { get { return _isVisible; } set { SetField(ref _isVisible, value, () => IsVisible); } } public bool _isSelected; public bool IsSelected { get { return _isSelected; } set { SetField(ref _isSelected, value, () => IsSelected); } } private string _selectedText; public string SelectedText { get { return _selectedText; } set { SetField(ref _selectedText, value, () => SelectedText); } } #region PhoneBook public TLLong ClientId { get; set; } public string Mobile { get; set; } public string Mobile2 { get; set; } public string Home { get; set; } public string Home2 { get; set; } public string Work { get; set; } public string Work2 { get; set; } public string Company { get; set; } public string Pager { get; set; } public string HomeFax { get; set; } public string WorkFax { get; set; } #endregion public static string GetLastNameKey(TLUserBase person) { if (person.LastName == null) return ('#').ToString(); char key = char.ToLower(person.LastName.Value[0]); if (key < 'a' || key > 'z') { if (key < 'а' || key > 'я') { key = '#'; } } return key.ToString(); } public static int CompareByLastName(object obj1, object obj2) { var p1 = (TLUserBase)obj1; var p2 = (TLUserBase)obj2; if (p1.LastName == null && p2.LastName != null) { return -1; } if (p1.LastName != null && p2.LastName == null) { return 1; } if (p1.LastName == null && p2.LastName == null) { return 0; } int result = String.Compare(p1.LastName.Value, p2.LastName.Value, StringComparison.Ordinal); //if (result == 0) //{ // result = String.Compare(p1.FirstName.Value, p2.FirstName.Value, StringComparison.Ordinal); //} return result; } } public class TLUser66 : TLUser45 { public new const uint Signature = TLConstructors.TLUser66; private TLString _langCode; public TLString LangCode { get { return _langCode; } set { SetField(out _langCode, value, ref _flags, (int)UserFlags.LangCode); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), bytes, ref position); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, bytes, ref position); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, bytes, ref position); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, bytes, ref position); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, bytes, ref position); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), bytes, ref position); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), bytes, ref position); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), bytes, ref position); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, bytes, ref position); _botInlinePlaceholder = GetObject(Flags, (int)UserFlags.BotInlinePlaceholder, TLString.Empty, bytes, ref position); _langCode = GetObject(Flags, (int)UserFlags.LangCode, TLString.Empty, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(AccessHash, Flags, (int)UserFlags.AccessHash), ToBytes(FirstName, Flags, (int)UserFlags.FirstName), ToBytes(LastName, Flags, (int)UserFlags.LastName), ToBytes(UserName, Flags, (int)UserFlags.UserName), ToBytes(Phone, Flags, (int)UserFlags.Phone), ToBytes(Photo, Flags, (int)UserFlags.Photo), ToBytes(Status, Flags, (int)UserFlags.Status), ToBytes(BotInfoVersion, Flags, (int)UserFlags.Bot), ToBytes(RestrictionReason, Flags, (int)UserFlags.Restricted), ToBytes(BotInlinePlaceholder, Flags, (int)UserFlags.BotInlinePlaceholder), ToBytes(LangCode, Flags, (int)UserFlags.LangCode)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), input); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, input); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, input); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, input); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, input); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), input); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), input); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), input); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, input); BotInlinePlaceholder = GetObject(Flags, (int)UserFlags.BotInlinePlaceholder, TLString.Empty, input); LangCode = GetObject(Flags, (int)UserFlags.LangCode, TLString.Empty, input); CustomFlags = GetNullableObject(input); NotifySettings = GetNullableObject(input); ExtendedInfo = GetNullableObject(input); BotInfo = GetNullableObject(input); // as bit _blocked = GetObject(CustomFlags, (int)UserCustomFlags.Blocked, null, input); _about = GetObject(CustomFlags, (int)UserCustomFlags.About, null, input); _notifyGeoAccessDate = GetObject(CustomFlags, (int)UserCustomFlags.NotifyGeoAccessDate, null, input); _readInboxMaxId = GetObject(CustomFlags, (int)UserCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)UserCustomFlags.ReadOutboxMaxId, null, input); _commonChatsCount = GetObject(CustomFlags, (int)UserCustomFlags.CommonChatsCount, null, input); return this; } public override void Update(TLUserBase userBase) { var user = userBase as TLUser66; if (user != null) { if (user.Min) { _firstName = user.FirstName ?? TLString.Empty; _lastName = user.LastName ?? TLString.Empty; _photo = user.Photo ?? new TLUserProfilePhotoEmpty(); return; } // set bits Flags = user.Flags; //IsSelf = user.IsSelf; //IsContact = user.IsContact; //IsMutualContact = user.IsMutualContact; //IsDeleted = user.IsDeleted; //IsBot = user.IsBot; //IsBotAllHistory = user.IsBotAllHistory; //IsBotGroupsBlocked = user.IsBotGroupsBlocked; //IsVerified = user.IsVerified; //IsRestricted = user.IsRestricted; //IsBotInlineGeo = user.IsBotInlineGeo; // end set bits Id = user.Id; AccessHash = user.AccessHash ?? new TLLong(0); _firstName = user.FirstName ?? TLString.Empty; _lastName = user.LastName ?? TLString.Empty; UserName = user.UserName ?? TLString.Empty; Phone = user.Phone ?? TLString.Empty; if (Photo != null && user.Photo != null && Photo.GetType() == user.Photo.GetType()) { Photo.Update(user.Photo); } else { _photo = user.Photo ?? new TLUserProfilePhotoEmpty(); } _status = user.Status ?? new TLUserStatusEmpty(); BotInfoVersion = user.BotInfoVersion ?? new TLInt(0); RestrictionReason = user.RestrictionReason ?? TLString.Empty; _botInlinePlaceholder = user.BotInlinePlaceholder ?? TLString.Empty; _langCode = user.LangCode ?? TLString.Empty; if (user.ReadInboxMaxId != null && (ReadInboxMaxId == null || ReadInboxMaxId.Value < user.ReadInboxMaxId.Value)) { ReadInboxMaxId = user.ReadInboxMaxId; } if (user.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < user.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = user.ReadOutboxMaxId; } if (user.About != null) { About = user.About; } if (user.NotifyGeoAccessDate != null) { NotifyGeoAccessDate = user.NotifyGeoAccessDate; } if (user.BotInlineGeoAccess) { BotInlineGeoAccess = true; } if (user.BotInfo != null) { BotInfo = user.BotInfo; } if (user.Contact != null) { Contact = user.Contact; } if (user.Link != null) { Link = user.Link; } if (user.ProfilePhoto != null) { ProfilePhoto = user.ProfilePhoto; } if (user.NotifySettings != null) { NotifySettings = user.NotifySettings; } if (user.ExtendedInfo != null) { ExtendedInfo = user.ExtendedInfo; } if (user.Blocked != null) { Blocked = user.Blocked; } if (user.CommonChatsCount != null) { CommonChatsCount = user.CommonChatsCount; } } //base.Update(userBase); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, AccessHash, Flags, (int)UserFlags.AccessHash); ToStream(output, FirstName, Flags, (int)UserFlags.FirstName); ToStream(output, LastName, Flags, (int)UserFlags.LastName); ToStream(output, UserName, Flags, (int)UserFlags.UserName); ToStream(output, Phone, Flags, (int)UserFlags.Phone); ToStream(output, Photo, Flags, (int)UserFlags.Photo); ToStream(output, Status, Flags, (int)UserFlags.Status); ToStream(output, BotInfoVersion, Flags, (int)UserFlags.Bot); ToStream(output, RestrictionReason, Flags, (int)UserFlags.Restricted); ToStream(output, BotInlinePlaceholder, Flags, (int)UserFlags.BotInlinePlaceholder); ToStream(output, LangCode, Flags, (int)UserFlags.LangCode); CustomFlags.NullableToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); BotInfo.NullableToStream(output); // as bit ToStream(output, Blocked, CustomFlags, (int)UserCustomFlags.Blocked); ToStream(output, About, CustomFlags, (int)UserCustomFlags.About); ToStream(output, NotifyGeoAccessDate, CustomFlags, (int)UserCustomFlags.NotifyGeoAccessDate); ToStream(output, ReadInboxMaxId, CustomFlags, (int)UserCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)UserCustomFlags.ReadOutboxMaxId); ToStream(output, CommonChatsCount, CustomFlags, (int)UserCustomFlags.CommonChatsCount); } } public class TLUser45 : TLUser44, IReadMaxId { public new const uint Signature = TLConstructors.TLUser45; protected TLString _botInlinePlaceholder; public TLString BotInlinePlaceholder { get { return _botInlinePlaceholder; } set { SetField(out _botInlinePlaceholder, value, ref _flags, (int)UserFlags.BotInlinePlaceholder); } } protected TLString _about; public TLString About { get { return _about; } set { SetField(out _about, value, ref _customFlags, (int)UserCustomFlags.About); } } public bool BotInlineGeoAccess { get { return IsSet(CustomFlags, (int)UserCustomFlags.BotInlineGeoAccess); } set { SetUnset(ref _customFlags, value, (int)UserCustomFlags.BotInlineGeoAccess); } } public bool BotOpenUrlPermission { get { return IsSet(CustomFlags, (int)UserCustomFlags.BotOpenUrlPermission); } set { SetUnset(ref _customFlags, value, (int)UserCustomFlags.BotOpenUrlPermission); } } public bool BotPassTelegramNameToWebPagesPermission { get { return IsSet(CustomFlags, (int)UserCustomFlags.BotPassTelegramNameToWebPagesPermission); } set { SetUnset(ref _customFlags, value, (int)UserCustomFlags.BotPassTelegramNameToWebPagesPermission); } } public bool BotPaymentsPermission { get { return IsSet(CustomFlags, (int)UserCustomFlags.BotPaymentsPermission); } set { SetUnset(ref _customFlags, value, (int)UserCustomFlags.BotPaymentsPermission); } } protected TLInt _notifyGeoAccessDate; public TLInt NotifyGeoAccessDate { get { return _notifyGeoAccessDate; } set { SetField(out _notifyGeoAccessDate, value, ref _customFlags, (int)UserCustomFlags.NotifyGeoAccessDate); } } protected TLInt _readInboxMaxId; public TLInt ReadInboxMaxId { get { return _readInboxMaxId; } set { SetField(out _readInboxMaxId, value, ref _customFlags, (int)UserCustomFlags.ReadInboxMaxId); } } protected TLInt _readOutboxMaxId; public TLInt ReadOutboxMaxId { get { return _readOutboxMaxId; } set { SetField(out _readOutboxMaxId, value, ref _customFlags, (int)UserCustomFlags.ReadOutboxMaxId); } } protected TLInt _commonChatsCount; public TLInt CommonChatsCount { get { return _commonChatsCount; } set { SetField(out _commonChatsCount, value, ref _customFlags, (int)UserCustomFlags.CommonChatsCount); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), bytes, ref position); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, bytes, ref position); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, bytes, ref position); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, bytes, ref position); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, bytes, ref position); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), bytes, ref position); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), bytes, ref position); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), bytes, ref position); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, bytes, ref position); _botInlinePlaceholder = GetObject(Flags, (int)UserFlags.BotInlinePlaceholder, TLString.Empty, bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(AccessHash, Flags, (int)UserFlags.AccessHash), ToBytes(FirstName, Flags, (int)UserFlags.FirstName), ToBytes(LastName, Flags, (int)UserFlags.LastName), ToBytes(UserName, Flags, (int)UserFlags.UserName), ToBytes(Phone, Flags, (int)UserFlags.Phone), ToBytes(Photo, Flags, (int)UserFlags.Photo), ToBytes(Status, Flags, (int)UserFlags.Status), ToBytes(BotInfoVersion, Flags, (int)UserFlags.Bot), ToBytes(RestrictionReason, Flags, (int)UserFlags.Restricted), ToBytes(BotInlinePlaceholder, Flags, (int)UserFlags.BotInlinePlaceholder)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), input); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, input); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, input); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, input); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, input); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), input); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), input); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), input); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, input); BotInlinePlaceholder = GetObject(Flags, (int)UserFlags.BotInlinePlaceholder, TLString.Empty, input); CustomFlags = GetNullableObject(input); NotifySettings = GetNullableObject(input); ExtendedInfo = GetNullableObject(input); BotInfo = GetNullableObject(input); // as bit _blocked = GetObject(CustomFlags, (int)UserCustomFlags.Blocked, null, input); _about = GetObject(CustomFlags, (int)UserCustomFlags.About, null, input); _notifyGeoAccessDate = GetObject(CustomFlags, (int)UserCustomFlags.NotifyGeoAccessDate, null, input); _readInboxMaxId = GetObject(CustomFlags, (int)UserCustomFlags.ReadInboxMaxId, null, input); _readOutboxMaxId = GetObject(CustomFlags, (int)UserCustomFlags.ReadOutboxMaxId, null, input); _commonChatsCount = GetObject(CustomFlags, (int)UserCustomFlags.CommonChatsCount, null, input); return this; } public override void Update(TLUserBase userBase) { var user = userBase as TLUser45; if (user != null) { if (user.Min) { _firstName = user.FirstName ?? TLString.Empty; _lastName = user.LastName ?? TLString.Empty; _photo = user.Photo ?? new TLUserProfilePhotoEmpty(); return; } // set bits Flags = user.Flags; //IsSelf = user.IsSelf; //IsContact = user.IsContact; //IsMutualContact = user.IsMutualContact; //IsDeleted = user.IsDeleted; //IsBot = user.IsBot; //IsBotAllHistory = user.IsBotAllHistory; //IsBotGroupsBlocked = user.IsBotGroupsBlocked; //IsVerified = user.IsVerified; //IsRestricted = user.IsRestricted; //IsBotInlineGeo = user.IsBotInlineGeo; // end set bits Id = user.Id; AccessHash = user.AccessHash ?? new TLLong(0); _firstName = user.FirstName ?? TLString.Empty; _lastName = user.LastName ?? TLString.Empty; UserName = user.UserName ?? TLString.Empty; Phone = user.Phone ?? TLString.Empty; if (Photo != null && user.Photo != null && Photo.GetType() == user.Photo.GetType()) { Photo.Update(user.Photo); } else { _photo = user.Photo ?? new TLUserProfilePhotoEmpty(); } _status = user.Status ?? new TLUserStatusEmpty(); BotInfoVersion = user.BotInfoVersion ?? new TLInt(0); RestrictionReason = user.RestrictionReason ?? TLString.Empty; _botInlinePlaceholder = user.BotInlinePlaceholder ?? TLString.Empty; if (user.ReadInboxMaxId != null && (ReadInboxMaxId == null || ReadInboxMaxId.Value < user.ReadInboxMaxId.Value)) { ReadInboxMaxId = user.ReadInboxMaxId; } if (user.ReadOutboxMaxId != null && (ReadOutboxMaxId == null || ReadOutboxMaxId.Value < user.ReadOutboxMaxId.Value)) { ReadOutboxMaxId = user.ReadOutboxMaxId; } if (user.About != null) { About = user.About; } if (user.NotifyGeoAccessDate != null) { NotifyGeoAccessDate = user.NotifyGeoAccessDate; } if (user.BotInlineGeoAccess) { BotInlineGeoAccess = true; } if (user.BotInfo != null) { BotInfo = user.BotInfo; } if (user.Contact != null) { Contact = user.Contact; } if (user.Link != null) { Link = user.Link; } if (user.ProfilePhoto != null) { ProfilePhoto = user.ProfilePhoto; } if (user.NotifySettings != null) { NotifySettings = user.NotifySettings; } if (user.ExtendedInfo != null) { ExtendedInfo = user.ExtendedInfo; } if (user.Blocked != null) { Blocked = user.Blocked; } if (user.CommonChatsCount != null) { CommonChatsCount = user.CommonChatsCount; } } //base.Update(userBase); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, AccessHash, Flags, (int)UserFlags.AccessHash); ToStream(output, FirstName, Flags, (int)UserFlags.FirstName); ToStream(output, LastName, Flags, (int)UserFlags.LastName); ToStream(output, UserName, Flags, (int)UserFlags.UserName); ToStream(output, Phone, Flags, (int)UserFlags.Phone); ToStream(output, Photo, Flags, (int)UserFlags.Photo); ToStream(output, Status, Flags, (int)UserFlags.Status); ToStream(output, BotInfoVersion, Flags, (int)UserFlags.Bot); ToStream(output, RestrictionReason, Flags, (int)UserFlags.Restricted); ToStream(output, BotInlinePlaceholder, Flags, (int)UserFlags.BotInlinePlaceholder); CustomFlags.NullableToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); BotInfo.NullableToStream(output); // as bit ToStream(output, Blocked, CustomFlags, (int)UserCustomFlags.Blocked); ToStream(output, About, CustomFlags, (int)UserCustomFlags.About); ToStream(output, NotifyGeoAccessDate, CustomFlags, (int)UserCustomFlags.NotifyGeoAccessDate); ToStream(output, ReadInboxMaxId, CustomFlags, (int)UserCustomFlags.ReadInboxMaxId); ToStream(output, ReadOutboxMaxId, CustomFlags, (int)UserCustomFlags.ReadOutboxMaxId); ToStream(output, CommonChatsCount, CustomFlags, (int)UserCustomFlags.CommonChatsCount); } } public class TLUser44 : TLUser { public new const uint Signature = TLConstructors.TLUser44; public TLString RestrictionReason { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), bytes, ref position); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, bytes, ref position); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, bytes, ref position); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, bytes, ref position); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, bytes, ref position); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), bytes, ref position); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), bytes, ref position); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), bytes, ref position); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, bytes, ref position); if (IsSet(Flags, (int)UserFlags.Bot) || IsSet(Flags, (int)UserFlags.BotAllHistory)) { return this; } if (IsSet(Flags, (int)UserFlags.AccessHash)) { if (IsSet(Flags, (int)UserFlags.Contact) || IsSet(Flags, (int)UserFlags.ContactMutual)) { var userContact = new TLUserContact18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userContact; } if (IsSet(Flags, (int)UserFlags.Phone)) { var userRequest = new TLUserRequest18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userRequest; } var userForeign = new TLUserForeign18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, _photo = _photo, _status = _status, }; return userForeign; } if (IsSet(Flags, (int)UserFlags.Deleted)) { var userDeleted = new TLUserDeleted18 { Id = Id, _firstName = _firstName, _lastName = _lastName, UserName = UserName }; return userDeleted; } if (IsSet(Flags, (int)UserFlags.Self)) { var userSelf = new TLUserSelf24 { Id = Id, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userSelf; } Helpers.Execute.ShowDebugMessage("TLUser unknown " + FullName); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(AccessHash, Flags, (int)UserFlags.AccessHash), ToBytes(FirstName, Flags, (int)UserFlags.FirstName), ToBytes(LastName, Flags, (int)UserFlags.LastName), ToBytes(UserName, Flags, (int)UserFlags.UserName), ToBytes(Phone, Flags, (int)UserFlags.Phone), ToBytes(Photo, Flags, (int)UserFlags.Photo), ToBytes(Status, Flags, (int)UserFlags.Status), ToBytes(BotInfoVersion, Flags, (int)UserFlags.Bot), ToBytes(RestrictionReason, Flags, (int)UserFlags.Restricted)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), input); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, input); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, input); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, input); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, input); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), input); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), input); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), input); RestrictionReason = GetObject(Flags, (int)UserFlags.Restricted, TLString.Empty, input); CustomFlags = GetNullableObject(input); NotifySettings = GetNullableObject(input); ExtendedInfo = GetNullableObject(input); BotInfo = GetNullableObject(input); // as bit _blocked = GetObject(CustomFlags, (int)UserCustomFlags.Blocked, null, input); return this; } public override void Update(TLUserBase userBase) { base.Update(userBase); var user = userBase as TLUser44; if (user != null) { if (user.RestrictionReason != null) { RestrictionReason = user.RestrictionReason; } } } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, AccessHash, Flags, (int)UserFlags.AccessHash); ToStream(output, FirstName, Flags, (int)UserFlags.FirstName); ToStream(output, LastName, Flags, (int)UserFlags.LastName); ToStream(output, UserName, Flags, (int)UserFlags.UserName); ToStream(output, Phone, Flags, (int)UserFlags.Phone); ToStream(output, Photo, Flags, (int)UserFlags.Photo); ToStream(output, Status, Flags, (int)UserFlags.Status); ToStream(output, BotInfoVersion, Flags, (int)UserFlags.Bot); ToStream(output, RestrictionReason, Flags, (int)UserFlags.Restricted); CustomFlags.NullableToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); BotInfo.NullableToStream(output); // as bit ToStream(output, Blocked, CustomFlags, (int)UserCustomFlags.Blocked); } } public class TLUser : TLUserBase, IUserName { public const uint Signature = TLConstructors.TLUser; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override bool IsForeign { get { return IsSet(Flags, (int)UserFlags.AccessHash) && !IsSet(Flags, (int)UserFlags.Phone) && !IsSet(Flags, (int)UserFlags.Self) && !IsSet(Flags, (int)UserFlags.Contact) && !IsSet(Flags, (int)UserFlags.ContactMutual); } } public override bool IsRequest { get { return IsSet(Flags, (int)UserFlags.AccessHash) && IsSet(Flags, (int)UserFlags.Phone) && !IsSet(Flags, (int)UserFlags.Self) && !IsSet(Flags, (int)UserFlags.Contact) && !IsSet(Flags, (int)UserFlags.ContactMutual); } } public override bool IsSelf { get { return IsSet(Flags, (int)UserFlags.Self); } set { SetUnset(ref _flags, value, (int)UserFlags.Self); } } public override bool IsContact { get { return IsSet(Flags, (int)UserFlags.Contact); } set { SetUnset(ref _flags, value, (int)UserFlags.Contact); } } public override bool IsContactMutual { get { return IsSet(Flags, (int)UserFlags.ContactMutual); } set { SetUnset(ref _flags, value, (int)UserFlags.ContactMutual); } } public override bool IsDeleted { get { return IsSet(Flags, (int)UserFlags.Deleted); } set { SetUnset(ref _flags, value, (int)UserFlags.Deleted); } } public bool IsBot { get { return IsSet(Flags, (int)UserFlags.Bot); } set { SetUnset(ref _flags, value, (int)UserFlags.Bot); } } public bool IsBotAllHistory { get { return IsSet(Flags, (int)UserFlags.BotAllHistory); } set { SetUnset(ref _flags, value, (int)UserFlags.BotAllHistory); } } public bool IsBotGroupsBlocked { get { return IsSet(Flags, (int)UserFlags.BotGroupsBlocked); } set { SetUnset(ref _flags, value, (int)UserFlags.BotGroupsBlocked); } } public override bool IsVerified { get { return IsSet(Flags, (int)UserFlags.Verified); } set { SetUnset(ref _flags, value, (int)UserFlags.Verified); } } public bool IsRestricted { get { return IsSet(Flags, (int)ChannelFlags.Restricted); } set { SetUnset(ref _flags, value, (int)UserFlags.Restricted); } } public bool Min { get { return IsSet(Flags, (int)UserFlags.Min); } } public bool IsBotInlineGeo { get { return IsSet(Flags, (int)UserFlags.BotInlineGeo); } set { SetUnset(ref _flags, value, (int)UserFlags.BotInlineGeo); } } public bool IsInlineBot { get { return IsSet(Flags, (int)UserFlags.BotInlinePlaceholder); } } public TLLong AccessHash { get; set; } public TLString UserName { get; set; } public TLInt BotInfoVersion { get; set; } protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } protected TLBool _blocked; public override TLBool Blocked { get { return _blocked; } set { if (value != null) { Set(ref _customFlags, (int)UserCustomFlags.Blocked); _blocked = value; } } } public override string ToString() { return base.ToString() + string.Format(" flags={0} custom_flags={1}", UserFlagsString(Flags), UserCustomFlagsString(CustomFlags)); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), bytes, ref position); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, bytes, ref position); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, bytes, ref position); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, bytes, ref position); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, bytes, ref position); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), bytes, ref position); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), bytes, ref position); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), bytes, ref position); if (IsSet(Flags, (int)UserFlags.Bot) || IsSet(Flags, (int)UserFlags.BotAllHistory)) { return this; } if (IsSet(Flags, (int)UserFlags.AccessHash)) { if (IsSet(Flags, (int)UserFlags.Contact) || IsSet(Flags, (int)UserFlags.ContactMutual)) { var userContact = new TLUserContact18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userContact; } if (IsSet(Flags, (int)UserFlags.Phone)) { var userRequest = new TLUserRequest18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userRequest; } var userForeign = new TLUserForeign18 { Id = Id, AccessHash = AccessHash, _firstName = _firstName, _lastName = _lastName, UserName = UserName, _photo = _photo, _status = _status, }; return userForeign; } if (IsSet(Flags, (int)UserFlags.Deleted)) { var userDeleted = new TLUserDeleted18 { Id = Id, _firstName = _firstName, _lastName = _lastName, UserName = UserName }; return userDeleted; } if (IsSet(Flags, (int)UserFlags.Self)) { var userSelf = new TLUserSelf24 { Id = Id, _firstName = _firstName, _lastName = _lastName, UserName = UserName, Phone = Phone, _photo = _photo, _status = _status, }; return userSelf; } Helpers.Execute.ShowDebugMessage("TLUser unknown " + FullName); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), ToBytes(AccessHash, Flags, (int)UserFlags.AccessHash), ToBytes(FirstName, Flags, (int)UserFlags.FirstName), ToBytes(LastName, Flags, (int)UserFlags.LastName), ToBytes(UserName, Flags, (int)UserFlags.UserName), ToBytes(Phone, Flags, (int)UserFlags.Phone), ToBytes(Photo, Flags, (int)UserFlags.Photo), ToBytes(Status, Flags, (int)UserFlags.Status), ToBytes(BotInfoVersion, Flags, (int)UserFlags.Bot)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); AccessHash = GetObject(Flags, (int)UserFlags.AccessHash, new TLLong(0), input); _firstName = GetObject(Flags, (int)UserFlags.FirstName, TLString.Empty, input); _lastName = GetObject(Flags, (int)UserFlags.LastName, TLString.Empty, input); UserName = GetObject(Flags, (int)UserFlags.UserName, TLString.Empty, input); Phone = GetObject(Flags, (int)UserFlags.Phone, TLString.Empty, input); _photo = GetObject(Flags, (int)UserFlags.Photo, new TLUserProfilePhotoEmpty(), input); _status = GetObject(Flags, (int)UserFlags.Status, new TLUserStatusEmpty(), input); BotInfoVersion = GetObject(Flags, (int)UserFlags.Bot, new TLInt(0), input); CustomFlags = GetNullableObject(input); NotifySettings = GetNullableObject(input); ExtendedInfo = GetNullableObject(input); BotInfo = GetNullableObject(input); // as bit _blocked = GetObject(CustomFlags, (int)UserCustomFlags.Blocked, null, input); return this; } public override void Update(TLUserBase userBase) { base.Update(userBase); var user = userBase as TLUser; if (user != null) { Flags = user.Flags; Id = user.Id; AccessHash = user.AccessHash; UserName = user.UserName; BotInfoVersion = user.BotInfoVersion; //if (user.CustomFlags != null) // will be erased user.NotifyGeoAccessDate user.BotInlineGeoAccess after user.getFullUser //{ // CustomFlags = user.CustomFlags; //} if (user.BotInfo != null) { BotInfo = user.BotInfo; } } } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); ToStream(output, AccessHash, Flags, (int)UserFlags.AccessHash); ToStream(output, FirstName, Flags, (int)UserFlags.FirstName); ToStream(output, LastName, Flags, (int)UserFlags.LastName); ToStream(output, UserName, Flags, (int)UserFlags.UserName); ToStream(output, Phone, Flags, (int)UserFlags.Phone); ToStream(output, Photo, Flags, (int)UserFlags.Photo); ToStream(output, Status, Flags, (int)UserFlags.Status); ToStream(output, BotInfoVersion, Flags, (int)UserFlags.Bot); CustomFlags.NullableToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); BotInfo.NullableToStream(output); // as bit ToStream(output, Blocked, CustomFlags, (int)UserCustomFlags.Blocked); } public override TLInputUserBase ToInputUser() { if (IsSet(Flags, (int)UserFlags.AccessHash)) { if (IsSet(Flags, (int)UserFlags.Contact) || IsSet(Flags, (int)UserFlags.ContactMutual)) { var userContact = new TLInputUser { UserId = Id, AccessHash = new TLLong(0) }; return userContact; } var userForeign = new TLInputUser { UserId = Id, AccessHash = AccessHash }; return userForeign; } if (IsSet(Flags, (int)UserFlags.Deleted)) { var userDeleted = new TLInputUser { UserId = Id, AccessHash = new TLLong(0) }; return userDeleted; } if (IsSet(Flags, (int)UserFlags.Self)) { var userSelf = new TLInputUserSelf(); return userSelf; } Helpers.Execute.ShowDebugMessage("TLUser.ToInputUser unknown " + FullName); return null; } public override TLInputPeerBase ToInputPeer() { if (IsSet(Flags, (int)UserFlags.AccessHash)) { if (IsSet(Flags, (int)UserFlags.Contact) || IsSet(Flags, (int)UserFlags.ContactMutual)) { var userContact = new TLInputPeerUser { UserId = Id, AccessHash = new TLLong(0) }; return userContact; } var userForeign = new TLInputPeerUser { UserId = Id, AccessHash = AccessHash }; return userForeign; } if (IsSet(Flags, (int)UserFlags.Deleted)) { var userDeleted = new TLInputPeerUser { UserId = Id, AccessHash = new TLLong(0) }; return userDeleted; } if (IsSet(Flags, (int)UserFlags.Self)) { var userSelf = new TLInputPeerSelf(); return userSelf; } Helpers.Execute.ShowDebugMessage("TLUser.ToInputPeer unknown " + FullName); return null; } //public string AccessToken { get; set; } } public class TLUserEmpty : TLUserBase { public const uint Signature = TLConstructors.TLUserEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); } public override void Update(TLUserBase user) { return; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLInputUserBase ToInputUser() { return new TLInputUser { UserId = Id, AccessHash = new TLLong(0) }; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerUser { UserId = Id, AccessHash = new TLLong(0) }; } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } public abstract class TLUserSelfBase : TLUserBase { public override bool HasPhone { get { return true; } } public override TLInputUserBase ToInputUser() { return new TLInputUserSelf(); } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerSelf(); } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return true; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } public class TLUserSelf : TLUserSelfBase { public const uint Signature = TLConstructors.TLUserSelf; public TLBool Inactive { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); Inactive = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes(), Inactive.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); Inactive = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); output.Write(Inactive.ToBytes()); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); Inactive = ((TLUserSelf)user).Inactive; } } public class TLUserSelf18 : TLUserSelfBase, IUserName { public const uint Signature = TLConstructors.TLUserSelf18; public TLString UserName { get; set; } public TLBool Inactive { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); Inactive = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes(), Inactive.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); Inactive = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); output.Write(Inactive.ToBytes()); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var user18 = user as TLUserSelf18; if (user18 != null) { UserName = user18.UserName; } } public override string ToString() { var userNameString = UserName != null ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserSelf24 : TLUserSelfBase, IUserName { public const uint Signature = TLConstructors.TLUserSelf24; public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var userName = user as IUserName; if (userName != null) { UserName = userName.UserName; } } public override string ToString() { var userNameString = UserName != null ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserContact18 : TLUserContact, IUserName { public new const uint Signature = TLConstructors.TLUserContact18; public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes(), AccessHash.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); AccessHash = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var user18 = user as TLUserContact18; if (user18 != null) { UserName = user18.UserName; } } public override string ToString() { var userNameString = !TLString.IsNullOrEmpty(UserName) ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserContact : TLUserBase { public const uint Signature = TLConstructors.TLUserContact; public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), AccessHash.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); AccessHash = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); AccessHash = ((TLUserContact)user).AccessHash; } public override TLInputUserBase ToInputUser() { return new TLInputUser { UserId = Id, AccessHash = new TLLong(0) }; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerUser { UserId = Id, AccessHash = new TLLong(0) }; } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return true; } set { } } public override bool IsContactMutual { get { return Contact != null && Contact.Mutual.Value; } set { } } } public class TLUserRequest18 : TLUserRequest, IUserName { public new const uint Signature = TLConstructors.TLUserRequest18; public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes(), AccessHash.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); AccessHash = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var user18 = user as TLUserRequest18; if (user18 != null) { UserName = user18.UserName; } } public override string ToString() { var userNameString = UserName != null ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserRequest : TLUserBase { public const uint Signature = TLConstructors.TLUserRequest; public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Phone = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), AccessHash.ToBytes(), Phone.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); AccessHash = GetObject(input); Phone = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(AccessHash.ToBytes()); output.Write(Phone.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override TLInputUserBase ToInputUser() { return new TLInputUser { UserId = Id, AccessHash = AccessHash }; } public override void Update(TLUserBase user) { base.Update(user); AccessHash = ((TLUserRequest)user).AccessHash; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerUser { UserId = Id, AccessHash = AccessHash }; } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return true; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } public class TLUserForeign18 : TLUserForeign, IUserName { public new const uint Signature = TLConstructors.TLUserForeign18; public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes(), AccessHash.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); AccessHash = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); output.Write(AccessHash.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var user18 = user as TLUserForeign18; if (user18 != null) { UserName = user18.UserName; } } public override string ToString() { var userNameString = UserName != null ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserForeign : TLUserBase { public const uint Signature = TLConstructors.TLUserForeign; public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); _photo = GetObject(bytes, ref position); _status = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), AccessHash.ToBytes(), Photo.ToBytes(), Status.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); AccessHash = GetObject(input); _photo = GetObject(input); _status = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(AccessHash.ToBytes()); Photo.ToStream(output); Status.ToStream(output); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override TLInputUserBase ToInputUser() { return new TLInputUser { UserId = Id, AccessHash = AccessHash }; } public override void Update(TLUserBase user) { base.Update(user); AccessHash = ((TLUserForeign)user).AccessHash; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerUser { UserId = Id, AccessHash = AccessHash }; } public override bool IsDeleted { get { return false; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return true; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } public class TLUserDeleted18 : TLUserDeleted, IUserName { public new const uint Signature = TLConstructors.TLUserDeleted18; public TLString UserName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); UserName = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes(), UserName.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); UserName = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); output.Write(UserName.ToBytes()); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override void Update(TLUserBase user) { base.Update(user); var user18 = user as TLUserDeleted18; if (user18 != null) { UserName = user18.UserName; } } public override string ToString() { var userNameString = UserName != null ? " @" + UserName : string.Empty; return base.ToString() + userNameString; } } public class TLUserDeleted : TLUserBase { public const uint Signature = TLConstructors.TLUserDeleted; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); _firstName = GetObject(bytes, ref position); _lastName = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), FirstName.ToBytes(), LastName.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); _firstName = GetObject(input); _lastName = GetObject(input); NotifySettings = GetObject(input) as TLPeerNotifySettingsBase; ExtendedInfo = GetObject(input) as TLUserExtendedInfo; Contact = GetObject(input) as TLContact; return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Id.ToBytes()); output.Write(FirstName.ToBytes()); output.Write(LastName.ToBytes()); NotifySettings.NullableToStream(output); ExtendedInfo.NullableToStream(output); Contact.NullableToStream(output); } public override TLInputUserBase ToInputUser() { return new TLInputUser { UserId = Id, AccessHash = new TLLong(0) }; } public override TLInputPeerBase ToInputPeer() { return new TLInputPeerUser { UserId = Id, AccessHash = new TLLong(0) }; } public override bool IsDeleted { get { return true; } set { } } public override bool IsSelf { get { return false; } set { } } public override bool IsForeign { get { return false; } } public override bool IsRequest { get { return false; } } public override bool IsContact { get { return false; } set { } } public override bool IsContactMutual { get { return false; } set { } } } } ================================================ FILE: Telegram.Api/TL/TLUserFull.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum UserFullFlags { Blocked = 0x1, // 0 About = 0x2, // 1 ProfilePhoto = 0x4, // 2 BotInfo = 0x8, // 3 } public class TLUserFull : TLObject { public const uint Signature = TLConstructors.TLUserFull; public TLUserBase User { get; set; } public TLLinkBase Link { get; set; } public TLPhotoBase ProfilePhoto { get; set; } public TLPeerNotifySettingsBase NotifySettings { get; set; } public virtual TLBool Blocked { get; set; } public TLString RealFirstName { get; set; } public TLString RealLastName { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); User = GetObject(bytes, ref position); Link = GetObject(bytes, ref position); ProfilePhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); Blocked = GetObject(bytes, ref position); RealFirstName = GetObject(bytes, ref position); RealLastName = GetObject(bytes, ref position); return this; } public virtual TLUserBase ToUser() { User.Link = Link; User.ProfilePhoto = ProfilePhoto; User.NotifySettings = NotifySettings; User.Blocked = Blocked; return User; } } public class TLUserFull31 : TLUserFull { public new const uint Signature = TLConstructors.TLUserFull31; public TLBotInfoBase BotInfo { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); User = GetObject(bytes, ref position); Link = GetObject(bytes, ref position); ProfilePhoto = GetObject(bytes, ref position); NotifySettings = GetObject(bytes, ref position); Blocked = GetObject(bytes, ref position); BotInfo = GetObject(bytes, ref position); return this; } public override TLUserBase ToUser() { User.Link = Link; User.ProfilePhoto = ProfilePhoto; User.NotifySettings = NotifySettings; User.Blocked = Blocked; User.BotInfo = BotInfo; return User; } } public class TLUserFull49 : TLUserFull31 { public new const uint Signature = TLConstructors.TLUserFull49; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public override TLBool Blocked { get { return new TLBool(IsSet(Flags, (int) UserFullFlags.Blocked)); } set { SetUnset(ref _flags, value != null && value.Value, (int) UserFullFlags.Blocked); } } public TLString About { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); User = GetObject(bytes, ref position); About = GetObject(Flags, (int)UserFullFlags.About, TLString.Empty, bytes, ref position); Link = GetObject(bytes, ref position); ProfilePhoto = GetObject(Flags, (int)UserFullFlags.ProfilePhoto, null, bytes, ref position); NotifySettings = GetObject(bytes, ref position); BotInfo = GetObject(Flags, (int) UserFullFlags.BotInfo, new TLBotInfoEmpty(), bytes, ref position); return this; } public override TLUserBase ToUser() { User.Link = Link; var user45 = User as TLUser45; if (user45 != null) user45.About = About; if (ProfilePhoto != null) User.ProfilePhoto = ProfilePhoto; User.NotifySettings = NotifySettings; User.Blocked = Blocked; User.BotInfo = BotInfo; return User; } } public class TLUserFull58 : TLUserFull49 { public new const uint Signature = TLConstructors.TLUserFull58; public TLInt CommonChatsCount { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); User = GetObject(bytes, ref position); About = GetObject(Flags, (int)UserFullFlags.About, TLString.Empty, bytes, ref position); Link = GetObject(bytes, ref position); ProfilePhoto = GetObject(Flags, (int)UserFullFlags.ProfilePhoto, null, bytes, ref position); NotifySettings = GetObject(bytes, ref position); BotInfo = GetObject(Flags, (int)UserFullFlags.BotInfo, new TLBotInfoEmpty(), bytes, ref position); CommonChatsCount = GetObject(bytes, ref position); return this; } public override TLUserBase ToUser() { User.Link = Link; var user45 = User as TLUser45; if (user45 != null) { user45.About = About; user45.CommonChatsCount = CommonChatsCount; } if (ProfilePhoto != null) User.ProfilePhoto = ProfilePhoto; User.NotifySettings = NotifySettings; User.Blocked = Blocked; User.BotInfo = BotInfo; return User; } } } ================================================ FILE: Telegram.Api/TL/TLUserStatus.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [KnownType(typeof(TLUserStatusEmpty))] [KnownType(typeof(TLUserStatusOnline))] [KnownType(typeof(TLUserStatusOffline))] [KnownType(typeof(TLUserStatusRecently))] [KnownType(typeof(TLUserStatusLastWeek))] [KnownType(typeof(TLUserStatusLastMonth))] [DataContract] public abstract class TLUserStatus : TLObject{ } [DataContract] public class TLUserStatusEmpty : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { var buffer = ToBytes(); output.Write(buffer, 0, buffer.Length); } } [DataContract] public class TLUserStatusOnline : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusOnline; [DataMember] public TLInt Expires { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Expires.ToBytes()); } public override TLObject FromStream(Stream input) { Expires = GetObject(input); return this; } public override void ToStream(Stream output) { var buffer = ToBytes(); output.Write(buffer, 0, buffer.Length); } } [DataContract] public class TLUserStatusOffline : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusOffline; [DataMember] public TLInt WasOnline { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); WasOnline = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), WasOnline.ToBytes()); } public override TLObject FromStream(Stream input) { WasOnline = GetObject(input); return this; } public override void ToStream(Stream output) { var buffer = ToBytes(); output.Write(buffer, 0, buffer.Length); } } [DataContract] public class TLUserStatusRecently : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusRecently; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } [DataContract] public class TLUserStatusLastWeek : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusLastWeek; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } [DataContract] public class TLUserStatusLastMonth : TLUserStatus { public const uint Signature = TLConstructors.TLUserStatusLastMonth; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api/TL/TLUtils.Log.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.ObjectModel; using System.Globalization; using System.Linq; using Telegram.Api.Helpers; #if WIN_RT using Windows.UI.Popups; using Windows.UI.Core; #endif using Telegram.Api.Aggregator; using Telegram.Api.Services.Cache; using Telegram.Logs; #if WINDOWS_PHONE using System.Threading; using System.Windows; #endif namespace Telegram.Api.TL { public enum LogSeverity { Error, Warning, Info } public static partial class TLUtils { private static void LogBugsenseError(string caption, Exception e) { var eventAggregator = TelegramEventAggregator.Instance; eventAggregator.Publish(new ExceptionInfo{ Caption = caption, Exception = e }); } private static bool _isLogEnabled = false; public static bool IsLogEnabled { get { return _isLogEnabled; } set { _isLogEnabled = value; } } private static bool _isDebugEnabled = false; public static bool IsDebugEnabled { get { return _isDebugEnabled; } set { _isDebugEnabled = value; } } private static bool _isLongPollLogEnabled = false; public static bool IsLongPollDebugEnabled { get { return _isLongPollLogEnabled; } set { _isLongPollLogEnabled = value; } } #if DEBUG private static bool _isPerformanceLogEnabled = false; #else private static bool _isPerformanceLogEnabled = false; #endif public static bool IsPerformanceLogEnabled { get { return _isPerformanceLogEnabled; } set { _isPerformanceLogEnabled = value; } } public static ObservableCollection LongPollItems = new ObservableCollection(); public static ObservableCollection PerformanceItems = new ObservableCollection(); public static ObservableCollection DebugItems = new ObservableCollection(); public static ObservableCollection LogItems = new ObservableCollection(); public static void WritePerformance(string str) { if (!IsPerformanceLogEnabled) return; Execute.BeginOnUIThread(() => PerformanceItems.Add(str)); } public static void WriteLog(string str) { if (!IsLogEnabled) return; var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); Execute.BeginOnUIThread(() => LogItems.Add(timestamp + ": " + str)); } public static void WriteLongPoll(string str) { if (!IsLongPollDebugEnabled) return; Execute.BeginOnUIThread(() => LongPollItems.Add(str)); } public static void WriteLine(LogSeverity severity = LogSeverity.Info) { if (!IsDebugEnabled && severity != LogSeverity.Error) return; Execute.BeginOnUIThread(() => DebugItems.Add(" ")); } public static void WriteLineAtBegin(string str, LogSeverity severity = LogSeverity.Info) { if (!IsDebugEnabled && severity != LogSeverity.Error) return; Execute.BeginOnUIThread(() => DebugItems.Insert(0, str)); } public static void WriteException(string caption, Exception e) { Execute.ShowDebugMessage(caption + Environment.NewLine + e); #if LOG_REGISTRATION WriteLog(caption + Environment.NewLine + e); #endif Log.Write(caption + Environment.NewLine + e); Execute.BeginOnUIThread(() => { DebugItems.Add(caption + Environment.NewLine + e); LogBugsenseError(caption, e); }); } public static void WriteException(Exception e) { WriteException(null, e); } public static void WriteLine(string str, LogSeverity severity = LogSeverity.Info) { #if DEBUG if (!IsDebugEnabled && severity != LogSeverity.Error) return; Execute.BeginOnUIThread(() => DebugItems.Add(str)); #endif } public static void WriteLine(string fieldName, T fieldValue, LogSeverity severity = LogSeverity.Info) { if (!IsDebugEnabled && severity != LogSeverity.Error) return; Execute.BeginOnUIThread(() => DebugItems.Add(String.Format("{0}: {1}", fieldName, fieldValue))); } public static string WriteThreadInfo() { var threadId = #if WINDOWS_PHONE Thread.CurrentThread.ManagedThreadId; #elif WIN_RT Environment.CurrentManagedThreadId; #endif return "ThreadId " + threadId; } } } ================================================ FILE: Telegram.Api/TL/TLUtils.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define MTPROTO using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; using Telegram.Api.TL.Functions.Channels; using Telegram.Api.TL.Functions.Messages; using Telegram.Logs; using Telegram.Api.Helpers; using Telegram.Api.Services; namespace Telegram.Api.TL { public static partial class TLUtils { public static TLInputClientProxy GetInputProxy(TLProxyConfigBase proxyConfig) { TLInputClientProxy inputProxy = null; if (proxyConfig != null && !proxyConfig.IsEmpty && proxyConfig.IsEnabled.Value) { var proxy = proxyConfig.GetProxy(); inputProxy = proxy != null ? proxy.ToInputProxy() : null; } return inputProxy; } public static TLDCOption GetDCOption(TLConfig config, TLInt dcId, bool media = false) { TLDCOption dcOption = null; if (config != null) { dcOption = config.DCOptions.FirstOrDefault(x => x.IsValidIPv4WithTCPO25Option(dcId) && x.Media.Value == media); if (dcOption == null) { dcOption = config.DCOptions.FirstOrDefault(x => x.IsValidIPv4Option(dcId) && x.Media.Value == media); } } return dcOption; } public static short GetProtocolDCId(int dcId, bool media, bool testServer) { dcId = testServer ? 10000 + dcId : dcId; return media ? (short)-dcId : (short)dcId; } public static byte[] ParseSecret(TLDCOption dcOption) { var dcOption78 = dcOption as TLDCOption78; if (dcOption78 != null && !TLString.IsNullOrEmpty(dcOption78.Secret)) { return dcOption78.Secret.Data; //ParseSecret(dcOption78.Secret); } return null; } public static byte[] ParseSecret(TLString str) { if (TLString.IsNullOrEmpty(str)) return null; var hexStr = str.ToString().ToLowerInvariant(); for (var i = 0; i < hexStr.Length; i++) { if (hexStr[i] >= '0' && hexStr[i] <= '9') { continue; } if (hexStr[i] >= 'a' && hexStr[i] <= 'f') { continue; } return null; } var bytes = new byte[hexStr.Length / 2]; for (var i = 0; i < hexStr.Length; i += 2) { bytes[i / 2] = Convert.ToByte(hexStr.Substring(i, 2), 16); } return bytes; } public static string ContentTypeToFileExt(TLString contentType) { if (contentType != null) { if (TLString.Equals(contentType, new TLString("image/jpg"), StringComparison.OrdinalIgnoreCase)) { return ".jpg"; } if (TLString.Equals(contentType, new TLString("video/mp4"), StringComparison.OrdinalIgnoreCase)) { return ".mp4"; } } return null; } public static TLInt ToTLInt(TLString value) { try { var intValue = Convert.ToInt32(value.Value); return new TLInt(intValue); } catch (Exception ex) { } return null; } public static TLString ToTLString(TLInt value) { try { var intValue = value.Value.ToString(CultureInfo.InvariantCulture); return new TLString(intValue); } catch (Exception ex) { } return null; } public static int GetTopPeersHash(TLTopPeers topPeers) { long acc = 0; foreach (var category in topPeers.Categories) { foreach (var topPeer in category.Peers) { acc = ((acc * 20261) + 0x80000000 + topPeer.Peer.Id.Value) % 0x80000000; } } return (int)acc; } public static int GetAllStickersHash(IList sets) { long acc = 0; foreach (var set in sets) { var stickerSet32 = set as TLStickerSet32; if (stickerSet32 != null) { if (stickerSet32.Archived) continue; acc = ((acc * 20261) + 0x80000000 + stickerSet32.Hash.Value) % 0x80000000; } } return (int)acc; } public static int GetFeaturedStickersHash(IList sets, IList unreadSets) { long acc = 0; foreach (var set in sets) { var stickerSet32 = set as TLStickerSet32; if (stickerSet32 != null) { if (stickerSet32.Archived) continue; var high_id = (int)(stickerSet32.Id.Value >> 32); var low_id = (int)stickerSet32.Id.Value; acc = ((acc * 20261) + 0x80000000L + high_id) % 0x80000000L; acc = ((acc * 20261) + 0x80000000L + low_id) % 0x80000000L; if (unreadSets.FirstOrDefault(x => x.Value == stickerSet32.Id.Value) != null) { acc = ((acc * 20261) + 0x80000000L + 1) % 0x80000000L; } } } return (int)acc; } public static TLInt GetFavedStickersHash(IList documents) { long acc = 0; foreach (var documentBase in documents) { var document = documentBase as TLDocument; if (document == null) continue; var high_id = (int)(document.Id.Value >> 32); var low_id = (int)document.Id.Value; acc = ((acc * 20261) + 0x80000000L + high_id) % 0x80000000L; acc = ((acc * 20261) + 0x80000000L + low_id) % 0x80000000L; } return new TLInt((int)acc); } public static TLInt GetRecentStickersHash(IList documents) { long acc = 0; foreach (var documentBase in documents) { var document = documentBase as TLDocument; if (document == null) continue; var high_id = (int)(document.Id.Value >> 32); var low_id = (int)document.Id.Value; acc = ((acc * 20261) + 0x80000000L + high_id) % 0x80000000L; acc = ((acc * 20261) + 0x80000000L + low_id) % 0x80000000L; } return new TLInt((int)acc); } public static int GetContactsHash(TLInt savedCount, IList contacts) { savedCount = savedCount ?? new TLInt(0); if (contacts == null) { return 0; } long acc = 0; acc = ((acc * 20261) + 0x80000000L + savedCount.Value) % 0x80000000L; foreach (var contact in contacts) { if (contact == null) continue; acc = ((acc * 20261) + 0x80000000L + contact.Id.Value) % 0x80000000L; } return (int)acc; } public static void AddStickerSetCovered(IStickers stickers, TLMessagesStickerSet messagesSet, TLVector coveredSets, TLStickerSetCoveredBase coveredSet) { coveredSets.Insert(0, coveredSet); //stickers.SetsCovered.Insert(0, messagesSet.Set); stickers.Hash = new TLString(GetAllStickersHash(stickers.Sets).ToString(CultureInfo.InvariantCulture)); var packsDict = new Dictionary(); for (var i = 0; i < messagesSet.Packs.Count; i++) { packsDict[messagesSet.Packs[i].Emoticon.ToString()] = messagesSet.Packs[i]; } for (var i = 0; i < messagesSet.Packs.Count; i++) { TLStickerPack pack; if (packsDict.TryGetValue(messagesSet.Packs[i].Emoticon.ToString(), out pack)) { for (var j = messagesSet.Packs[i].Documents.Count - 1; j >= 0; j--) { pack.Documents.Insert(0, messagesSet.Packs[i].Documents[j]); } } else { stickers.Packs.Insert(0, messagesSet.Packs[i]); } } for (var i = messagesSet.Documents.Count - 1; i >= 0; i--) { stickers.Documents.Insert(0, messagesSet.Documents[i]); } } public static void AddStickerSet(IStickers stickers, TLMessagesStickerSet messagesSet) { stickers.Sets.Insert(0, messagesSet.Set); stickers.Hash = new TLString(GetAllStickersHash(stickers.Sets).ToString(CultureInfo.InvariantCulture)); var packsDict = new Dictionary(); for (var i = 0; i < messagesSet.Packs.Count; i++) { packsDict[messagesSet.Packs[i].Emoticon.ToString()] = messagesSet.Packs[i]; } for (var i = 0; i < messagesSet.Packs.Count; i++) { TLStickerPack pack; if (packsDict.TryGetValue(messagesSet.Packs[i].Emoticon.ToString(), out pack)) { for (var j = messagesSet.Packs[i].Documents.Count - 1; j >= 0; j--) { pack.Documents.Insert(0, messagesSet.Packs[i].Documents[j]); } } else { stickers.Packs.Insert(0, messagesSet.Packs[i]); } } for (var i = messagesSet.Documents.Count - 1; i >= 0; i--) { stickers.Documents.Insert(0, messagesSet.Documents[i]); } } public static TLMessagesStickerSet RemoveStickerSetCovered(IStickers stickers, TLStickerSetBase set, TLVector coveredSets) { TLStickerSetCoveredBase s = null; for (var i = 0; i < coveredSets.Count; i++) { if (coveredSets[i].StickerSet.Id.Value == set.Id.Value) { s = coveredSets[i]; coveredSets.RemoveAt(i); break; } } var s32 = s.StickerSet as TLStickerSet32; var set32 = set as TLStickerSet32; if (s32 != null && set32 != null) { s32.Flags = set32.Flags; } stickers.Hash = new TLString(GetAllStickersHash(stickers.Sets).ToString(CultureInfo.InvariantCulture)); var documents = new TLVector(); var documentsDict = new Dictionary(); for (var i = 0; i < stickers.Documents.Count; i++) { var document = stickers.Documents[i] as TLDocument54; if (document != null) { var inputStickerSetId = document.StickerSet as TLInputStickerSetId; if (inputStickerSetId != null && inputStickerSetId.Id.Value == set.Id.Value) { documents.Add(document); documentsDict[document.Id.Value] = document.Id.Value; stickers.Documents.RemoveAt(i--); continue; } var inputStickerSetShortName = document.StickerSet as TLInputStickerSetShortName; if (inputStickerSetShortName != null && inputStickerSetShortName.ShortName.ToString() == set.ShortName.ToString()) { documents.Add(document); documentsDict[document.Id.Value] = document.Id.Value; stickers.Documents.RemoveAt(i--); } } } var packs = new TLVector(); for (var i = 0; i < stickers.Packs.Count; i++) { var pack = new TLStickerPack { Emoticon = stickers.Packs[i].Emoticon, Documents = new TLVector() }; for (var j = 0; j < stickers.Packs[i].Documents.Count; j++) { if (documentsDict.ContainsKey(stickers.Packs[i].Documents[j].Value)) { pack.Documents.Add(stickers.Packs[i].Documents[j]); stickers.Packs[i].Documents.RemoveAt(j--); } } if (pack.Documents.Count > 0) { packs.Add(pack); } if (stickers.Packs[i].Documents.Count == 0) { stickers.Packs.RemoveAt(i--); } } return new TLMessagesStickerSet { Set = s.StickerSet, Packs = packs, Documents = documents }; } public static TLMessagesStickerSet RemoveStickerSet(IStickers stickers, TLStickerSetBase set) { TLStickerSetBase s = null; for (var i = 0; i < stickers.Sets.Count; i++) { if (stickers.Sets[i].Id.Value == set.Id.Value) { s = stickers.Sets[i]; stickers.Sets.RemoveAt(i); break; } } var s32 = s as TLStickerSet32; var set32 = set as TLStickerSet32; if (s32 != null && set32 != null) { s32.Flags = set32.Flags; } stickers.Hash = new TLString(GetAllStickersHash(stickers.Sets).ToString(CultureInfo.InvariantCulture)); var documents = new TLVector(); var documentsDict = new Dictionary(); for (var i = 0; i < stickers.Documents.Count; i++) { var document = stickers.Documents[i] as TLDocument54; if (document != null) { var inputStickerSetId = document.StickerSet as TLInputStickerSetId; if (inputStickerSetId != null && inputStickerSetId.Id.Value == set.Id.Value) { documents.Add(document); documentsDict[document.Id.Value] = document.Id.Value; stickers.Documents.RemoveAt(i--); continue; } var inputStickerSetShortName = document.StickerSet as TLInputStickerSetShortName; if (inputStickerSetShortName != null && inputStickerSetShortName.ShortName.ToString() == set.ShortName.ToString()) { documents.Add(document); documentsDict[document.Id.Value] = document.Id.Value; stickers.Documents.RemoveAt(i--); } } } var packs = new TLVector(); for (var i = 0; i < stickers.Packs.Count; i++) { var pack = new TLStickerPack { Emoticon = stickers.Packs[i].Emoticon, Documents = new TLVector() }; for (var j = 0; j < stickers.Packs[i].Documents.Count; j++) { if (documentsDict.ContainsKey(stickers.Packs[i].Documents[j].Value)) { pack.Documents.Add(stickers.Packs[i].Documents[j]); stickers.Packs[i].Documents.RemoveAt(j--); } } if (pack.Documents.Count > 0) { packs.Add(pack); } if (stickers.Packs[i].Documents.Count == 0) { stickers.Packs.RemoveAt(i--); } } return new TLMessagesStickerSet { Set = s ?? set32, Packs = packs, Documents = documents }; } public static bool IsValidAction(TLObject obj) { var readChannelHistoryAction = obj as TLReadChannelHistory; if (readChannelHistoryAction != null) { return true; } var readHistoryAction = obj as TLReadHistory; if (readHistoryAction != null) { return true; } var readMessageContents = obj as Functions.Messages.TLReadMessageContents; if (readMessageContents != null) { return true; } var readChannelMessageContents = obj as Functions.Channels.TLReadMessageContents; if (readChannelMessageContents != null) { return true; } var sendMessageAction = obj as TLSendMessage; if (sendMessageAction != null) { return true; } var sendMediaAction = obj as TLSendMedia; if (sendMediaAction != null) { var mediaGame = sendMediaAction.Media as TLInputMediaGame; if (mediaGame != null) { return true; } var mediaContact = sendMediaAction.Media as TLInputMediaContact; if (mediaContact != null) { return true; } var mediaGeoPoint = sendMediaAction.Media as TLInputMediaGeoPoint; if (mediaGeoPoint != null) { return true; } var mediaVenue = sendMediaAction.Media as TLInputMediaVenue; if (mediaVenue != null) { return true; } } var forwardMessagesAction = obj as TLForwardMessages; if (forwardMessagesAction != null) { return true; } var forwardMessageAction = obj as TLForwardMessage; if (forwardMessageAction != null) { return true; } var startBotAction = obj as TLStartBot; if (startBotAction != null) { return true; } var sendInlineBotResult = obj as TLSendInlineBotResult; if (sendInlineBotResult != null) { return true; } var sendEncrypted = obj as TLSendEncrypted; if (sendEncrypted != null) { return true; } var sendEncryptedFile = obj as TLSendEncryptedFile; if (sendEncryptedFile != null) { return true; } var sendEncryptedService = obj as TLSendEncryptedService; if (sendEncryptedService != null) { return true; } var readEncryptedHistory = obj as TLReadEncryptedHistory; if (readEncryptedHistory != null) { return true; } return false; } public static TLMessage48 GetShortMessage( TLInt id, TLInt fromId, TLPeerBase toId, TLInt date, TLString message) { var m = new TLMessage73 { Flags = new TLInt(0), Id = id, FromId = fromId, ToId = toId, Out = TLBool.False, _date = date, Message = message, _media = new TLMessageMediaEmpty() }; if (m.FromId != null) m.SetFromId(); if (m._media != null) m.SetMedia(); return m; } public static TLMessage36 GetMessage( TLInt fromId, TLPeerBase toId, MessageStatus status, TLBool outFlag, TLBool unreadFlag, TLInt date, TLString message, TLMessageMediaBase media, TLLong randomId, TLInt replyToMsgId) { var m = new TLMessage73 { Flags = new TLInt(0), FromId = fromId, ToId = toId, _status = status, Out = outFlag, Unread = unreadFlag, _date = date, Message = message, _media = media, RandomId = randomId, ReplyToMsgId = replyToMsgId }; if (m.FromId != null) m.SetFromId(); if (m._media != null) m.SetMedia(); if (m.ReplyToMsgId != null && m.ReplyToMsgId.Value != 0) m.SetReply(); return m; } [MethodImpl(MethodImplOptions.NoOptimization)] public static bool ByteArraysEqual(byte[] a, byte[] b) { if (ReferenceEquals(a, b)) { return true; } if (((a == null) || (b == null)) || (a.Length != b.Length)) { return false; } var flag = true; for (var i = 0; i < a.Length; i++) { flag &= a[i] == b[i]; } return flag; } public static IList GetPtsRange(IMultiPts multiPts) { var pts = multiPts.Pts; var ptsCount = multiPts.PtsCount; return GetPtsRange(pts, ptsCount); } public static IList GetPtsRange(TLInt pts, TLInt ptsCount) { var ptsList = new List(ptsCount.Value); for (var i = ptsCount.Value - 1; i >= 0; i--) { ptsList.Add(new TLInt(pts.Value - i)); } return ptsList; } public static bool IsDisplayedDecryptedMessage(TLDecryptedMessageBase message, bool displayEmpty = false) { if (message == null) return false; #if DEBUG //return true; #endif return IsDisplayedDecryptedMessageInternal(message, displayEmpty); } public static bool CheckPrime(byte[] prime, int g) { if (!(g >= 2 && g <= 7)) { return false; } if (prime.Length != 256 || prime[0] <= 127) { return false; } var dhBI = new BigInteger(1, prime); if (g == 2) { // p mod 8 = 7 for g = 2; var res = dhBI.Mod(BigInteger.ValueOf(8)); if (res.IntValue != 7) { return false; } } else if (g == 3) { // p mod 3 = 2 for g = 3; var res = dhBI.Mod(BigInteger.ValueOf(3)); if (res.IntValue != 2) { return false; } } else if (g == 5) { // p mod 5 = 1 or 4 for g = 5; var res = dhBI.Mod(BigInteger.ValueOf(5)); int val = res.IntValue; if (val != 1 && val != 4) { return false; } } else if (g == 6) { // p mod 24 = 19 or 23 for g = 6; var res = dhBI.Mod(BigInteger.ValueOf(24)); int val = res.IntValue; if (val != 19 && val != 23) { return false; } } else if (g == 7) { // p mod 7 = 3, 5 or 6 for g = 7. var res = dhBI.Mod(BigInteger.ValueOf(7)); int val = res.IntValue; if (val != 3 && val != 5 && val != 6) { return false; } } var hex = BitConverter.ToString(prime).Replace("-", String.Empty).ToUpperInvariant(); if (hex.Equals("C71CAEB9C6B1C9048E6C522F70F13F73980D40238E3E21C14934D037563D930F48198A0AA7C14058229493D22530F4DBFA336F6E0AC925139543AED44CCE7C3720FD51F69458705AC68CD4FE6B6B13ABDC9746512969328454F18FAF8C595F642477FE96BB2A941D5BCD1D4AC8CC49880708FA9B378E3C4F3A9060BEE67CF9A4A4A695811051907E162753B56B0F6B410DBA74D8A84B2A14B3144E0EF1284754FD17ED950D5965B4B9DD46582DB1178D169C6BC465B0D6FF9CA3928FEF5B9AE4E418FC15E83EBEA0F87FA9FF5EED70050DED2849F47BF959D956850CE929851F0D8115F635B105EE2E4E15D04B2454BF6F4FADF034B10403119CD8E3B92FCC5B")) { return true; } var dhBI2 = dhBI.Subtract(BigInteger.ValueOf(1)).Divide(BigInteger.ValueOf(2)); return !(!dhBI.IsProbablePrime(30) || !dhBI2.IsProbablePrime(30)); } public static bool CheckGaAndGb(byte[] ga, byte[] prime) { var g_a = new BigInteger(1, ga); var p = new BigInteger(1, prime); return CheckGaAndGb(g_a, p); } public static bool CheckGaAndGb(BigInteger ga, BigInteger prime) { return !(ga.CompareTo(BigInteger.ValueOf(1)) != 1 || ga.CompareTo(prime.Subtract(BigInteger.ValueOf(1))) != -1); } public static bool IsDisplayedDecryptedMessageInternal(TLDecryptedMessageBase message, bool displayEmpty = false) { var serviceMessage = message as TLDecryptedMessageService; if (serviceMessage != null) { var emptyAction = serviceMessage.Action as TLDecryptedMessageActionEmpty; if (emptyAction != null) { if (displayEmpty) { return true; } return false; } var notifyLayerAction = serviceMessage.Action as TLDecryptedMessageActionNotifyLayer; if (notifyLayerAction != null) { return false; } var deleteMessagesAction = serviceMessage.Action as TLDecryptedMessageActionDeleteMessages; if (deleteMessagesAction != null) { return false; } var readMessagesAction = serviceMessage.Action as TLDecryptedMessageActionReadMessages; if (readMessagesAction != null) { return false; } var flushHistoryAction = serviceMessage.Action as TLDecryptedMessageActionFlushHistory; if (flushHistoryAction != null) { return false; } var resendAction = serviceMessage.Action as TLDecryptedMessageActionResend; if (resendAction != null) { return false; } var requestKey = serviceMessage.Action as TLDecryptedMessageActionRequestKey; if (requestKey != null) { return false; } var commitKey = serviceMessage.Action as TLDecryptedMessageActionCommitKey; if (commitKey != null) { return false; } var acceptKey = serviceMessage.Action as TLDecryptedMessageActionAcceptKey; if (acceptKey != null) { return false; } var noop = serviceMessage.Action as TLDecryptedMessageActionNoop; if (noop != null) { return false; } var abortKey = serviceMessage.Action as TLDecryptedMessageActionAbortKey; if (abortKey != null) { return false; } } return true; } public static TLInt GetOutSeqNo(TLInt currentUserId, TLEncryptedChat17 chat) { var isAdmin = chat.AdminId.Value == currentUserId.Value; var seqNo = 2 * chat.RawOutSeqNo.Value + (isAdmin ? 1 : 0); return new TLInt(seqNo); } public static TLInt GetInSeqNo(TLInt currentUserId, TLEncryptedChat17 chat) { var isAdmin = chat.AdminId.Value == currentUserId.Value; var seqNo = 2 * chat.RawInSeqNo.Value + (isAdmin ? 0 : 1); return new TLInt(seqNo); } public static TLString EncryptMessage2(TLObject decryptedMessage, TLInt currentUserId, TLEncryptedChatCommon chat) { Debug.WriteLine("TLUtils.EncryptMessage2"); var random = new Random(); var key = chat.Key.Data; var keyHash = Utils.ComputeSHA1(key); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); var decryptedBytes = decryptedMessage.ToBytes(); var bytes = Combine(BitConverter.GetBytes(decryptedBytes.Length), decryptedBytes); var padding = 16 - bytes.Length % 16; if (padding < 12) { padding += 16; } var paddingBytes = new byte[padding]; random.NextBytes(paddingBytes); var bytesWithPadding = Combine(bytes, paddingBytes); var x = chat.AdminId.Value == currentUserId.Value ? 0 : 8; //8; var msgKeyLarge = Utils.ComputeSHA256(Combine(key.SubArray(88 + x, 32), bytesWithPadding)); var msgKey = msgKeyLarge.SubArray(8, 16); var sha256_a = Utils.ComputeSHA256(Combine(msgKey, key.SubArray(x, 36))); var sha256_b = Utils.ComputeSHA256(Combine(key.SubArray(40 + x, 36), msgKey)); var aesKey = Combine(sha256_a.SubArray(0, 8), sha256_b.SubArray(8, 16), sha256_a.SubArray(24, 8)); var aesIV = Combine(sha256_b.SubArray(0, 8), sha256_a.SubArray(8, 16), sha256_b.SubArray(24, 8)); var encryptedBytes = Utils.AesIge(bytesWithPadding, aesKey, aesIV, true); var resultBytes = Combine(keyFingerprint.ToBytes(), msgKey, encryptedBytes); return TLString.FromBigEndianData(resultBytes); } public static TLDecryptedMessageBase DecryptMessage2(TLString data, TLInt currentUserId, TLEncryptedChat chat, out bool commitChat) { Debug.WriteLine("TLUtils.DecryptMessage2"); commitChat = false; var bytes = data.Data; var keyFingerprint = BitConverter.ToInt64(bytes, 0); var msgKey = bytes.SubArray(8, 16); var key = chat.Key.Data; var keyHash = Utils.ComputeSHA1(key); var calculatedKeyFingerprint = BitConverter.ToInt64(keyHash, keyHash.Length - 8); if (keyFingerprint != calculatedKeyFingerprint) { var chat20 = chat as TLEncryptedChat20; if (chat20 != null && chat20.PFS_Key != null) { var pfsKeyHash = Utils.ComputeSHA1(chat20.PFS_Key.Data); var pfsKeyFingerprint = BitConverter.ToInt64(pfsKeyHash, pfsKeyHash.Length - 8); if (pfsKeyFingerprint == keyFingerprint) { chat20.Key = chat20.PFS_Key; chat20.PFS_Key = null; chat20.PFS_KeyFingerprint = null; chat20.PFS_A = null; chat20.PFS_ExchangeId = null; commitChat = true; } else { return null; } } else { return null; } } var x = chat.AdminId.Value == currentUserId.Value ? 8 : 0; //0; var sha256_a = Utils.ComputeSHA256(Combine(msgKey, key.SubArray(x, 36))); var sha256_b = Utils.ComputeSHA256(Combine(key.SubArray(40 + x, 36), msgKey)); var aesKey = Combine(sha256_a.SubArray(0, 8), sha256_b.SubArray(8, 16), sha256_a.SubArray(24, 8)); var aesIV = Combine(sha256_b.SubArray(0, 8), sha256_a.SubArray(8, 16), sha256_b.SubArray(24, 8)); var encryptedBytes = bytes.SubArray(24, bytes.Length - 24); var decryptedBytes = Utils.AesIge(encryptedBytes, aesKey, aesIV, false); var length = BitConverter.ToInt32(decryptedBytes, 0); if (length <= 0 || (4 + length) > decryptedBytes.Length) { Log.Write("TLUtils.DecryptMessage length <= 0 || (4 + length) > decryptedBytes.Length"); return null; } var calculatedMsgKeyLarge = Utils.ComputeSHA256(Combine(key.SubArray(88 + x, 32), decryptedBytes)); var calculatedMsgKey = calculatedMsgKeyLarge.SubArray(8, 16); for (var i = 0; i < 16; i++) { if (msgKey[i] != calculatedMsgKey[i]) { Log.Write("TLUtils.DecryptMessage msgKey != calculatedMsgKey"); return null; } } var position = 4; var decryptedObject = TLObject.GetObject(decryptedBytes, ref position); var decryptedMessageLayer = decryptedObject as TLDecryptedMessageLayer; var decryptedMessageLayer17 = decryptedObject as TLDecryptedMessageLayer17; TLDecryptedMessageBase decryptedMessage = null; if (decryptedMessageLayer17 != null) { var randomBytes = decryptedMessageLayer17.RandomBytes.Data; if (randomBytes == null || randomBytes.Length < Constants.MinRandomBytesLength) { Log.Write("TLUtils.DecryptMessage randomBytes.Length<" + Constants.MinRandomBytesLength); return null; } decryptedMessage = decryptedMessageLayer17.Message; var decryptedMessage17 = decryptedMessage as ISeqNo; if (decryptedMessage17 != null) { decryptedMessage17.InSeqNo = decryptedMessageLayer17.InSeqNo; decryptedMessage17.OutSeqNo = decryptedMessageLayer17.OutSeqNo; } } else if (decryptedMessageLayer != null) { decryptedMessage = decryptedMessageLayer.Message; } else if (decryptedObject is TLDecryptedMessageBase) { decryptedMessage = (TLDecryptedMessageBase)decryptedObject; } return decryptedMessage; } public static TLString EncryptMessage(TLObject decryptedMessage, TLInt currentUserId, TLEncryptedChatCommon chat) { Debug.WriteLine("TLUtils.EncryptMessage"); var chat20 = chat as TLEncryptedChat20; if (chat20 != null && chat20.Layer.Value >= Constants.MinSecretChatWithMTProto2Layer) { return EncryptMessage2(decryptedMessage, currentUserId, chat); } var random = new Random(); var key = chat.Key.Data; var keyHash = Utils.ComputeSHA1(key); var keyFingerprint = new TLLong(BitConverter.ToInt64(keyHash, 12)); var decryptedBytes = decryptedMessage.ToBytes(); var bytes = Combine(BitConverter.GetBytes(decryptedBytes.Length), decryptedBytes); var sha1Hash = Utils.ComputeSHA1(bytes); var msgKey = sha1Hash.SubArray(sha1Hash.Length - 16, 16); var padding = (bytes.Length % 16 == 0) ? 0 : (16 - (bytes.Length % 16)); var paddingBytes = new byte[padding]; random.NextBytes(paddingBytes); var bytesWithPadding = Combine(bytes, paddingBytes); var x = 0; var sha1_a = Utils.ComputeSHA1(Combine(msgKey, key.SubArray(x, 32))); var sha1_b = Utils.ComputeSHA1(Combine(key.SubArray(32 + x, 16), msgKey, key.SubArray(48 + x, 16))); var sha1_c = Utils.ComputeSHA1(Combine(key.SubArray(64 + x, 32), msgKey)); var sha1_d = Utils.ComputeSHA1(Combine(msgKey, key.SubArray(96 + x, 32))); var aesKey = Combine(sha1_a.SubArray(0, 8), sha1_b.SubArray(8, 12), sha1_c.SubArray(4, 12)); var aesIV = Combine(sha1_a.SubArray(8, 12), sha1_b.SubArray(0, 8), sha1_c.SubArray(16, 4), sha1_d.SubArray(0, 8)); var encryptedBytes = Utils.AesIge(bytesWithPadding, aesKey, aesIV, true); var resultBytes = Combine(keyFingerprint.ToBytes(), msgKey, encryptedBytes); return TLString.FromBigEndianData(resultBytes); } public static TLDecryptedMessageBase DecryptMessage(TLString data, TLInt currentUserId, TLEncryptedChat chat, out bool commitChat) { Debug.WriteLine("TLUtils.DecryptMessage"); commitChat = false; var bytes = data.Data; var keyFingerprint = BitConverter.ToInt64(bytes, 0); var msgKey = bytes.SubArray(8, 16); var key = chat.Key.Data; var keyHash = Utils.ComputeSHA1(key); var calculatedKeyFingerprint = BitConverter.ToInt64(keyHash, keyHash.Length - 8); if (keyFingerprint != calculatedKeyFingerprint) { var chat20 = chat as TLEncryptedChat20; if (chat20 != null && chat20.PFS_Key != null) { var pfsKeyHash = Utils.ComputeSHA1(chat20.PFS_Key.Data); var pfsKeyFingerprint = BitConverter.ToInt64(pfsKeyHash, pfsKeyHash.Length - 8); if (pfsKeyFingerprint == keyFingerprint) { chat20.Key = chat20.PFS_Key; chat20.PFS_Key = null; chat20.PFS_KeyFingerprint = null; chat20.PFS_A = null; chat20.PFS_ExchangeId = null; commitChat = true; } else { return null; } } else { return null; } } var x = 0; var sha1_a = Utils.ComputeSHA1(Combine(msgKey, key.SubArray(x, 32))); var sha1_b = Utils.ComputeSHA1(Combine(key.SubArray(32 + x, 16), msgKey, key.SubArray(48 + x, 16))); var sha1_c = Utils.ComputeSHA1(Combine(key.SubArray(64 + x, 32), msgKey)); var sha1_d = Utils.ComputeSHA1(Combine(msgKey, key.SubArray(96 + x, 32))); var aesKey = Combine(sha1_a.SubArray(0, 8), sha1_b.SubArray(8, 12), sha1_c.SubArray(4, 12)); var aesIV = Combine(sha1_a.SubArray(8, 12), sha1_b.SubArray(0, 8), sha1_c.SubArray(16, 4), sha1_d.SubArray(0, 8)); var encryptedBytes = bytes.SubArray(24, bytes.Length - 24); var decryptedBytes = Utils.AesIge(encryptedBytes, aesKey, aesIV, false); var msgKeyEquals = true; var length = BitConverter.ToInt32(decryptedBytes, 0); if (length <= 0 || 4 + length > decryptedBytes.Length) { Log.Write("TLUtils.DecryptMessage length <= 0 || (4 + length) > decryptedBytes.Length"); msgKeyEquals = false; } var calculatedMsgKey = msgKeyEquals ? Utils.ComputeSHA1(decryptedBytes.SubArray(0, 4 + length)) : new byte[] { }; for (var i = 0; i < 16; i++) { if (msgKeyEquals && msgKey[i] != calculatedMsgKey[i + 4]) { msgKeyEquals = false; } } if (!msgKeyEquals) { Log.Write("TLUtils.DecryptMessage msgKey != calculatedMsgKey"); var result = DecryptMessage2(data, currentUserId, chat, out commitChat); return result; } var position = 4; var decryptedObject = TLObject.GetObject(decryptedBytes, ref position); var decryptedMessageLayer = decryptedObject as TLDecryptedMessageLayer; var decryptedMessageLayer17 = decryptedObject as TLDecryptedMessageLayer17; TLDecryptedMessageBase decryptedMessage = null; if (decryptedMessageLayer17 != null) { var randomBytes = decryptedMessageLayer17.RandomBytes.Data; if (randomBytes == null || randomBytes.Length < Constants.MinRandomBytesLength) { Log.Write("TLUtils.DecryptMessage randomBytes.Length<" + Constants.MinRandomBytesLength); return null; } decryptedMessage = decryptedMessageLayer17.Message; var decryptedMessage17 = decryptedMessage as ISeqNo; if (decryptedMessage17 != null) { decryptedMessage17.InSeqNo = decryptedMessageLayer17.InSeqNo; decryptedMessage17.OutSeqNo = decryptedMessageLayer17.OutSeqNo; } } else if (decryptedMessageLayer != null) { decryptedMessage = decryptedMessageLayer.Message; } else if (decryptedObject is TLDecryptedMessageBase) { decryptedMessage = (TLDecryptedMessageBase)decryptedObject; } return decryptedMessage; } public static T OpenObjectFromFile(object syncRoot, string fileName) where T : class { try { Debug.WriteLine("::OpenFile " + fileName); lock (syncRoot) { using (var fileStream = FileUtils.GetLocalFileStreamForRead(fileName)) { if (fileStream.Length > 0) { var serializer = new DataContractSerializer(typeof(T)); return serializer.ReadObject(fileStream) as T; } } } } catch (Exception e) { var caption = String.Format("MTPROTO FILE ERROR: cannot read {0} from file {1}", typeof(T), fileName); WriteLine(caption, LogSeverity.Error); WriteException(caption, e); } return default(T); } public static T OpenObjectFromMTProtoFile(object syncRoot, string fileName, out long length) where T : TLObject { length = 0; try { Debug.WriteLine("::OpenMTProtoFile " + fileName); lock (syncRoot) { using (var fileStream = FileUtils.GetLocalFileStreamForRead(fileName)) { if (fileStream.Length > 0) { length = fileStream.Length; return TLObject.GetObject(fileStream); } } } } catch (Exception e) { var caption = String.Format("MTPROTO FILE ERROR: cannot read {0} from file {1}", typeof(T), fileName); WriteLine(caption, LogSeverity.Error); WriteException(caption, e); } return default(T); } public static T OpenObjectFromMTProtoFile(object syncRoot, string fileName) where T : TLObject { try { Debug.WriteLine("::OpenMTProtoFile " + fileName); lock (syncRoot) { using (var fileStream = FileUtils.GetLocalFileStreamForRead(fileName)) { if (fileStream.Length > 0) { return TLObject.GetObject(fileStream); } } } } catch (Exception e) { var caption = String.Format("MTPROTO FILE ERROR: cannot read {0} from file {1}", typeof(T), fileName); WriteLine(caption, LogSeverity.Error); WriteException(caption, e); } return default(T); } public static void SaveObjectToFile(object syncRoot, string fileName, T data) { try { lock (syncRoot) { using (var fileStream = FileUtils.GetLocalFileStreamForWrite(fileName)) { var dcs = new DataContractSerializer(typeof(T)); dcs.WriteObject(fileStream, data); } } } catch (Exception e) { var caption = String.Format("FILE ERROR: cannot write {0} to file {1}", typeof(T), fileName); WriteLine(caption, LogSeverity.Error); WriteException(caption, e); } } public static void SaveObjectToMTProtoFile(object syncRoot, string fileName, T data) where T : TLObject { try { lock (syncRoot) { FileUtils.SaveWithTempFile(fileName, data); } } catch (Exception e) { var caption = String.Format("MTPROTO FILE ERROR: cannot write {0} to file {1}", typeof(T), fileName); WriteLine(caption, LogSeverity.Error); WriteException(caption, e); } } public static TLPeerBase GetPeerFromMessage(TLDecryptedMessageBase message) { TLPeerBase peer = null; var commonMessage = message; if (commonMessage != null) { if (commonMessage.ChatId != null) { peer = new TLPeerEncryptedChat { Id = commonMessage.ChatId }; } } else { WriteLine("Cannot get peer from non TLDecryptedMessage", LogSeverity.Error); } return peer; } public static TLPeerBase GetPeerFromMessage(TLMessageBase message) { TLPeerBase peer = null; var commonMessage = message as TLMessageCommon; if (commonMessage != null) { if (commonMessage.ToId is TLPeerChannel) { peer = commonMessage.ToId; } else if (commonMessage.ToId is TLPeerChat) { peer = commonMessage.ToId; } else { if (commonMessage.Out.Value) { peer = commonMessage.ToId; } else { peer = new TLPeerUser { Id = commonMessage.FromId }; } } } else { WriteLine("Cannot get peer from non TLMessageCommon", LogSeverity.Error); } return peer; } public static bool IsChannelMessage(TLMessageBase message, out TLPeerChannel channel) { var isChannel = false; channel = null; var messageCommon = message as TLMessageCommon; if (messageCommon != null) { channel = messageCommon.ToId as TLPeerChannel; isChannel = channel != null; } return isChannel; } public static bool InsertItem(IList items, T item, Func getField, Func equalitysField = null) where T : TLObject { var fieldValue = getField(item); for (var i = 0; i < items.Count; i++) { if (getField(items[i]) > fieldValue) { items.Insert(i, item); return true; } if (getField(items[i]) == fieldValue && equalitysField != null && equalitysField(items[i]) == equalitysField(item)) { return false; } } items.Add(item); return true; } public static bool InsertItemByDesc(IList items, T item, Func getField, Func equalityField = null) where T : TLObject { var fieldValue = getField(item); for (var i = 0; i < items.Count; i++) { if (getField(items[i]) < fieldValue) { items.Insert(i, item); return true; } if (getField(items[i]) == fieldValue && equalityField != null && equalityField(items[i]) == equalityField(item)) { return false; } } items.Add(item); return true; } public static IEnumerable FindInnerObjects(TLTransportMessage obj) where T : TLObject { var result = obj.MessageData as T; if (result != null) { yield return (T)obj.MessageData; } else { var gzipData = obj.MessageData as TLGzipPacked; if (gzipData != null) { result = gzipData.Data as T; if (result != null) { yield return result; } } var container = obj.MessageData as TLContainer; if (container != null) { foreach (var message in container.Messages) { result = message.MessageData as T; if (result != null) { yield return (T)message.MessageData; } gzipData = message.MessageData as TLGzipPacked; if (gzipData != null) { result = gzipData.Data as T; if (result != null) { yield return result; } } } } } } public static int InputPeerToId(TLInputPeerBase inputPeer, TLInt selfId) { var chat = inputPeer as TLInputPeerChat; if (chat != null) { return chat.ChatId.Value; } var contact = inputPeer as TLInputPeerContact; if (contact != null) { return contact.UserId.Value; } var foreign = inputPeer as TLInputPeerForeign; if (foreign != null) { return foreign.UserId.Value; } var user = inputPeer as TLInputPeerUser; if (user != null) { return user.UserId.Value; } var self = inputPeer as TLInputPeerSelf; if (self != null) { return selfId.Value; } return -1; } public static TLPeerBase InputPeerToPeer(TLInputPeerBase inputPeer, int selfId) { var channel = inputPeer as TLInputPeerChannel; if (channel != null) { return new TLPeerChannel { Id = channel.ChatId }; } var broadcast = inputPeer as TLInputPeerBroadcast; if (broadcast != null) { return new TLPeerBroadcast { Id = broadcast.ChatId }; } var chat = inputPeer as TLInputPeerChat; if (chat != null) { return new TLPeerChat { Id = chat.ChatId }; } var contact = inputPeer as TLInputPeerContact; if (contact != null) { return new TLPeerUser { Id = contact.UserId }; } var foreign = inputPeer as TLInputPeerForeign; if (foreign != null) { return new TLPeerUser { Id = foreign.UserId }; } var user = inputPeer as TLInputPeerUser; if (user != null) { return new TLPeerUser { Id = user.UserId }; } var self = inputPeer as TLInputPeerSelf; if (self != null) { return new TLPeerUser { Id = new TLInt(selfId) }; } return null; } public static int MergeItemsDesc(Func dateIndexFunc, IList current, IList updated, int offset, int maxId, int count, out IList removedItems, Func indexFunc, Func skipTailFunc) { removedItems = new List(); var currentIndex = 0; var updatedIndex = 0; var index = new Dictionary(); foreach (var item in current) { var id = indexFunc(item); if (id > 0) { index[id] = id; } } //skip just added or sending items while (updatedIndex < updated.Count && currentIndex < current.Count && dateIndexFunc(updated[updatedIndex]) < dateIndexFunc(current[currentIndex])) { currentIndex++; } // insert before current items while (updatedIndex < updated.Count && (current.Count < currentIndex || (currentIndex < current.Count && dateIndexFunc(updated[updatedIndex]) > dateIndexFunc(current[currentIndex])))) { if (dateIndexFunc(current[currentIndex]) == 0) { currentIndex++; continue; } if (index.ContainsKey(indexFunc(updated[updatedIndex]))) { updatedIndex++; continue; } current.Insert(currentIndex, updated[updatedIndex]); updatedIndex++; currentIndex++; } // update existing items if (updatedIndex < updated.Count) { for (; currentIndex < current.Count; currentIndex++) { if (indexFunc != null && indexFunc(current[currentIndex]) == 0) { continue; } for (; updatedIndex < updated.Count; updatedIndex++) { // missing item at current list if (dateIndexFunc(updated[updatedIndex]) > dateIndexFunc(current[currentIndex])) { current.Insert(currentIndex, updated[updatedIndex]); updatedIndex++; break; } // equal item if (dateIndexFunc(updated[updatedIndex]) == dateIndexFunc(current[currentIndex])) { updatedIndex++; break; } // deleted item if (dateIndexFunc(updated[updatedIndex]) < dateIndexFunc(current[currentIndex])) { var removedItem = current[currentIndex]; removedItems.Add(removedItem); current.RemoveAt(currentIndex); currentIndex--; break; } } // at the end of updated list if (updatedIndex == updated.Count) { currentIndex++; break; } } } // all other items were deleted if (updated.Count > 0 && updated.Count < count && current.Count != currentIndex) { for (var i = current.Count - 1; i >= updatedIndex; i--) { if (skipTailFunc != null && skipTailFunc(current[i])) { continue; } current.RemoveAt(i); } return currentIndex - 1; } // add after current items while (updatedIndex < updated.Count) { current.Add(updated[updatedIndex]); updatedIndex++; currentIndex++; } return currentIndex - 1; } public static TLInt DateToUniversalTimeTLInt(long clientDelta, DateTime date) { clientDelta = MTProtoService.Instance.ClientTicksDelta; var unixTime = (int)Utils.DateTimeToUnixTimestamp(date) + clientDelta / 4294967296.0; //int * 2^32 + clientDelta return new TLInt((int)unixTime); } public static TLInt ToTLInt(DateTime date) { var unixTime = (int)Utils.DateTimeToUnixTimestamp(date); //int * 2^32 + clientDelta return new TLInt(unixTime); } public static byte[] GenerateAuthKeyId(byte[] authKey) { var authKeyHash = Utils.ComputeSHA1(authKey); var authKeyId = authKeyHash.SubArray(12, 8); return authKeyId; } public static long GenerateLongAuthKeyId(byte[] authKey) { var authKeyHash = Utils.ComputeSHA1(authKey); var authKeyId = authKeyHash.SubArray(12, 8); return BitConverter.ToInt64(authKeyId, 0); } private const int encryptXParam = 0; private const int decryptXParam = 8; public static WindowsPhone.Tuple GetEncryptKeyIV(byte[] authKey, byte[] msgKey) { return GetKeyIVCommon(authKey, msgKey, encryptXParam); } public static WindowsPhone.Tuple GetDecryptKeyIV(byte[] authKey, byte[] msgKey) { return GetKeyIVCommon(authKey, msgKey, decryptXParam); } private static WindowsPhone.Tuple GetKeyIVCommon(byte[] authKey, byte[] msgKey, int x) { #if MTPROTO var sha256_a = Utils.ComputeSHA256(Combine(msgKey, authKey.SubArray(x, 36))); var sha256_b = Utils.ComputeSHA256(Combine(authKey.SubArray(40 + x, 36), msgKey)); var aesKey = Combine( sha256_a.SubArray(0, 8), sha256_b.SubArray(8, 16), sha256_a.SubArray(24, 8)); var aesIV = Combine( sha256_b.SubArray(0, 8), sha256_a.SubArray(8, 16), sha256_b.SubArray(24, 8)); #else var sha1_a = Utils.ComputeSHA1(Combine(msgKey, authKey.SubArray(x, 32))); var sha1_b = Utils.ComputeSHA1(Combine(authKey.SubArray(32 + x, 16), msgKey, authKey.SubArray(48 + x, 16))); var sha1_c = Utils.ComputeSHA1(Combine(authKey.SubArray(64 + x, 32), msgKey)); var sha1_d = Utils.ComputeSHA1(Combine(msgKey, authKey.SubArray(96 + x, 32))); var aesKey = Combine( sha1_a.SubArray(0, 8), sha1_b.SubArray(8, 12), sha1_c.SubArray(4, 12)); var aesIV = Combine( sha1_a.SubArray(8, 12), sha1_b.SubArray(0, 8), sha1_c.SubArray(16, 4), sha1_d.SubArray(0, 8)); #endif return new WindowsPhone.Tuple(aesKey, aesIV); } #if MTPROTO public static byte[] GetEncryptMsgKey(byte[] authKey, byte[] dataWithPadding) { return GetMsgKeyCommon(authKey, dataWithPadding, encryptXParam); } public static byte[] GetDecryptMsgKey(byte[] authKey, byte[] dataWithPadding) { return GetMsgKeyCommon(authKey, dataWithPadding, decryptXParam); } private static byte[] GetMsgKeyCommon(byte[] authKey, byte[] dataWithPadding, int x) { var bytes = Combine(authKey.SubArray(88 + x, 32), dataWithPadding); var msgKeyLarge = Utils.ComputeSHA256(bytes); var msgKey = msgKeyLarge.SubArray(8, 16); return msgKey; } #else public static byte[] GetMsgKey(byte[] data) { var bytes = Utils.ComputeSHA1(data); var last16Bytes = bytes.SubArray(4, 16); return last16Bytes; } #endif public static byte[] Combine(params byte[][] arrays) { var length = 0; for (var i = 0; i < arrays.Length; i++) { length += arrays[i].Length; } var result = new byte[length]; ////[arrays.Sum(a => a.Length)]; var offset = 0; foreach (var array in arrays) { Buffer.BlockCopy(array, 0, result, offset, array.Length); offset += array.Length; } return result; } public static string MessageIdString(byte[] bytes) { var ticks = BitConverter.ToInt64(bytes, 0); var date = Utils.UnixTimestampToDateTime(ticks >> 32); return BitConverter.ToString(bytes) + " " + ticks + "%4=" + ticks % 4 + " " + date; } public static string MessageIdString(TLLong messageId) { var bytes = BitConverter.GetBytes(messageId.Value); var ticks = BitConverter.ToInt64(bytes, 0); var date = Utils.UnixTimestampToDateTime(ticks >> 32); return BitConverter.ToString(bytes) + " " + ticks + "%4=" + ticks % 4 + " " + date; } public static string MessageIdString(TLInt messageId) { var ticks = messageId.Value; var date = Utils.UnixTimestampToDateTime(ticks >> 32); return BitConverter.ToString(BitConverter.GetBytes(messageId.Value)) + " " + ticks + "%4=" + ticks % 4 + " " + date; } public static DateTime ToDateTime(TLInt date) { var ticks = date.Value; return Utils.UnixTimestampToDateTime(ticks >> 32); } public static void ThrowNotSupportedException(this byte[] bytes, string objectType) { throw new NotSupportedException(String.Format("Not supported {0} signature: {1}", objectType, BitConverter.ToString(bytes.SubArray(0, 4)))); } public static void ThrowNotSupportedException(this byte[] bytes, int position, string objectType) { throw new NotSupportedException(String.Format("Not supported {0} signature: {1}", objectType, BitConverter.ToString(bytes.SubArray(position, position + 4)))); } public static void ThrowExceptionIfIncorrect(this byte[] bytes, ref int position, uint signature) { //if (!bytes.SubArray(position, 4).StartsWith(signature)) //{ // throw new ArgumentException(String.Format("Incorrect signature: actual - {1}, expected - {0}", SignatureToBytesString(signature), BitConverter.ToString(bytes.SubArray(0, 4)))); //} position += 4; } public static void ThrowExceptionIfIncorrect(this byte[] bytes, ref int position, string signature) { //if (!bytes.SubArray(position, 4).StartsWith(signature)) //{ // throw new ArgumentException(String.Format("Incorrect signature: actual - {1}, expected - {0}", SignatureToBytesString(signature), BitConverter.ToString(bytes.SubArray(0, 4)))); //} position += 4; } private static bool StartsWith(this byte[] array, byte[] startArray) { for (var i = 0; i < startArray.Length; i++) { if (array[i] != startArray[i]) return false; } return true; } private static bool StartsWith(this byte[] array, int position, byte[] startArray) { for (var i = 0; i < startArray.Length; i++) { if (array[position + i] != startArray[i]) return false; } return true; } public static bool StartsWith(this byte[] bytes, uint signature) { var sign = BitConverter.ToUInt32(bytes, 0); return sign == signature; } public static bool StartsWith(this Stream input, uint signature) { var bytes = new byte[4]; input.Read(bytes, 0, 4); var sign = BitConverter.ToUInt32(bytes, 0); return sign == signature; } public static bool StartsWith(this byte[] bytes, string signature) { if (signature[0] != '#') throw new ArgumentException("Incorrect first symbol of signature: expexted - #, actual - " + signature[0]); var signatureBytes = SignatureToBytes(signature); return bytes.StartsWith(signatureBytes); } public static bool StartsWith(this byte[] bytes, int position, uint signature) { var sign = BitConverter.ToUInt32(bytes, position); return sign == signature; } public static bool StartsWith(this byte[] bytes, int position, string signature) { if (signature[0] != '#') throw new ArgumentException("Incorrect first symbol of signature: expexted - #, actual - " + signature[0]); var signatureBytes = SignatureToBytes(signature); return bytes.StartsWith(position, signatureBytes); } public static string SignatureToBytesString(string signature) { if (signature[0] != '#') throw new ArgumentException("Incorrect first symbol of signature: expexted - #, actual - " + signature[0]); return BitConverter.ToString(SignatureToBytes(signature)); } public static byte[] SignatureToBytes(uint signature) { return BitConverter.GetBytes(signature); } public static byte[] SignatureToBytes(string signature) { if (signature[0] != '#') throw new ArgumentException("Incorrect first symbol of signature: expexted - #, actual - " + signature[0]); var bytesString = signature.Length % 2 == 0 ? new string(signature.Replace("#", "0").ToArray()) : new string(signature.Replace("#", String.Empty).ToArray()); var bytes = Utils.StringToByteArray(bytesString); Array.Reverse(bytes); return bytes; } public static TLDecryptedMessageLayer GetDecryptedMessageLayer(TLInt layer, TLInt inSeqNo, TLInt outSeqNo, TLDecryptedMessageBase message) { var randomBytes = new byte[15]; var random = new SecureRandom(); random.NextBytes(randomBytes); var decryptedMessageLayer17 = new TLDecryptedMessageLayer17(); decryptedMessageLayer17.Layer = layer; decryptedMessageLayer17.InSeqNo = inSeqNo; decryptedMessageLayer17.OutSeqNo = outSeqNo; decryptedMessageLayer17.RandomBytes = TLString.FromBigEndianData(randomBytes); decryptedMessageLayer17.Message = message; return decryptedMessageLayer17; } } } ================================================ FILE: Telegram.Api/TL/TLValidatedRequestedInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum ValidatedRequestedInfoFlags { Id = 0x1, // 0 ShippingOptions = 0x2, // 1 } public class TLValidatedRequestedInfo : TLObject { public const uint Signature = TLConstructors.TLValidatedRequestedInfo; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } private TLString _id; public TLString Id { get { return _id; } set { SetField(out _id, value, ref _flags, (int) ValidatedRequestedInfoFlags.Id); } } private TLVector _shippingOptions; public TLVector ShippingOptions { get { return _shippingOptions; } set { SetField(out _shippingOptions, value, ref _flags, (int) ValidatedRequestedInfoFlags.ShippingOptions); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); _id = GetObject(Flags, (int) ValidatedRequestedInfoFlags.Id, null, bytes, ref position); _shippingOptions = GetObject>(Flags, (int)ValidatedRequestedInfoFlags.ShippingOptions, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLVector.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Serialization; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [DataContract] public class TLVector : TLObject, IList where T : TLObject { public const uint Signature = TLConstructors.TLVector; [DataMember] public IList Items { get; set; } public TLVector() { Items = new List(); } public TLVector(int count) { Items = new List(count); } public TLVector(IList items) { Items = items; } public T this[int index] { get { return Items[index]; } set { Items[index] = value; } } public int IndexOf(T item) { return Items.IndexOf(item); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); var length = GetObject(bytes, ref position); Items = new List(length.Value); for (var i = 0; i < length.Value; i++) { Items.Add(GetObject(bytes, ref position)); } return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), BitConverter.GetBytes(Items.Count), TLUtils.Combine(Items.Select(x => x.ToBytes()).ToArray()) ); } public override TLObject FromStream(Stream input) { var length = GetObject(input); Items = new List(length.Value); try { for (var i = 0; i < length.Value; i++) { Items.Add(GetObject(input)); } } catch (Exception ex) { } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(new TLInt(Items.Count).ToBytes()); for (var i = 0; i < Items.Count; i++) { Items[i].ToStream(output); } } public IEnumerator GetEnumerator() { return Items.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public void Add(T item) { Items.Add(item); } public void Clear() { Items.Clear(); } public bool Contains(T item) { return Items.Contains(item); } public void CopyTo(T[] array, int arrayIndex) { Items.CopyTo(array, arrayIndex); } public bool Remove(T item) { return Items.Remove(item); } public void RemoveAt(int index) { Items.RemoveAt(index); } public void Insert(int index, T item) { Items.Insert(index, item); } public int Count { get { return Items.Count; } } public bool IsReadOnly { get { return Items.IsReadOnly; } } public int IndexOf(TLDCOption dcOption) { for (var i = 0; i < Items.Count; i++) { if (Items[i] == dcOption) return i; } return -1; } } } ================================================ FILE: Telegram.Api/TL/TLVideo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLVideoBase : TLObject { public TLLong Id { get; set; } public virtual int VideoSize { get { return 0; } } } public class TLVideoEmpty : TLVideoBase { public const uint Signature = TLConstructors.TLVideoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } } public class TLVideo33 : TLVideo28 { public new const uint Signature = TLConstructors.TLVideo33; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); //UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), //UserId.ToBytes(), Date.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); //UserId = GetObject(input); Date = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); //UserId.ToStream(output); Date.ToStream(output); Duration.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); W.ToStream(output); H.ToStream(output); } } public class TLVideo28 : TLVideo { public new const uint Signature = TLConstructors.TLVideo28; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), UserId.ToBytes(), Date.ToBytes(), Duration.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); Duration = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); UserId.ToStream(output); Date.ToStream(output); Duration.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); W.ToStream(output); H.ToStream(output); } } public class TLVideo : TLVideoBase { public const uint Signature = TLConstructors.TLVideo; public TLLong AccessHash { get; set; } public TLInt UserId { get; set; } public TLInt Date { get; set; } public TLString Caption { get; set; } public TLInt Duration { get; set; } public TLString MimeType { get; set; } public TLInt Size { get; set; } public TLPhotoSizeBase Thumb { get; set; } public TLInt DCId { get; set; } public TLInt W { get; set; } public TLInt H { get; set; } public string GetFileName() { return string.Format("video{0}_{1}.mp4", Id, AccessHash); } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); UserId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); Caption = GetObject(bytes, ref position); Duration = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); Thumb = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); W = GetObject(bytes, ref position); H = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes(), UserId.ToBytes(), Date.ToBytes(), Caption.ToBytes(), Duration.ToBytes(), MimeType.ToBytes(), Size.ToBytes(), Thumb.ToBytes(), DCId.ToBytes(), W.ToBytes(), H.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); UserId = GetObject(input); Date = GetObject(input); Caption = GetObject(input); Duration = GetObject(input); MimeType = GetObject(input); Size = GetObject(input); Thumb = GetObject(input); DCId = GetObject(input); W = GetObject(input); H = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); UserId.ToStream(output); Date.ToStream(output); Caption.ToStream(output); Duration.ToStream(output); MimeType.ToStream(output); Size.ToStream(output); Thumb.ToStream(output); DCId.ToStream(output); W.ToStream(output); H.ToStream(output); } #region Additional public override int VideoSize { get { return Size != null ? Size.Value : 0; } } public string DurationString { get { var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public TLInputFile ThumbInputFile { get; set; } #endregion public TLInputVideoFileLocation ToInputFileLocation() { return new TLInputVideoFileLocation {AccessHash = AccessHash, Id = Id}; } } } ================================================ FILE: Telegram.Api/TL/TLWallpaperSolid.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLWallPaperBase : TLObject { public TLInt Id { get; set; } public TLString Title { get; set; } public TLInt Color { get; set; } public TLLong CustomFlags { get; set; } } public class TLWallPaper : TLWallPaperBase { public const uint Signature = TLConstructors.TLWallPaper; public TLVector Sizes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); Sizes = GetObject>(bytes, ref position); Color = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Title = GetObject(input); Sizes = GetObject>(input); Color = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Title.ToStream(output); Sizes.ToStream(output); Color.ToStream(output); CustomFlags.NullableToStream(output); } } public class TLWallPaperSolid : TLWallPaperBase { public const uint Signature = TLConstructors.TLWallPaperSolid; public TLInt BgColor { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Title = GetObject(bytes, ref position); BgColor = GetObject(bytes, ref position); Color = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Title = GetObject(input); BgColor = GetObject(input); Color = GetObject(input); CustomFlags = GetNullableObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Title.ToStream(output); BgColor.ToStream(output); Color.ToStream(output); CustomFlags.NullableToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLWebDocument.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using System.Linq; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLWebDocumentBase : TLObject, IAttributes { public TLString Url { get; set; } public TLInt Size { get; set; } public TLString MimeType { get; set; } public TLVector Attributes { get; set; } public TLInt W { get { var attributeSize = Attributes.FirstOrDefault(x => x is IAttributeSize) as IAttributeSize; if (attributeSize != null) { return attributeSize.W; } return null; } } public TLInt H { get { var attributeSize = Attributes.FirstOrDefault(x => x is IAttributeSize) as IAttributeSize; if (attributeSize != null) { return attributeSize.H; } return null; } } public TLInt Duration { get { var attributeDuration = Attributes.FirstOrDefault(x => x is IAttributeDuration) as IAttributeDuration; if (attributeDuration != null) { return attributeDuration.Duration; } return null; } } public Uri Uri { get { if (TLString.IsNullOrEmpty(Url)) return null; return new Uri(Url.ToString(), UriKind.Absolute); } } } public class TLWebDocument82 : TLWebDocumentBase { public const uint Signature = TLConstructors.TLWebDocument82; public TLLong AccessHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), AccessHash.ToBytes(), Size.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Url = GetObject(input); AccessHash = GetObject(input); Size = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); AccessHash.ToStream(output); Size.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); } } public class TLWebDocument : TLWebDocumentBase { public const uint Signature = TLConstructors.TLWebDocument; public TLLong AccessHash { get; set; } public TLInt DCId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); DCId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), AccessHash.ToBytes(), Size.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes(), DCId.ToBytes()); } public override TLObject FromStream(Stream input) { Url = GetObject(input); AccessHash = GetObject(input); Size = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); DCId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); AccessHash.ToStream(output); Size.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); DCId.ToStream(output); } } public class TLWebDocumentNoProxy : TLWebDocumentBase { public const uint Signature = TLConstructors.TLWebDocumentNoProxy; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Url = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Attributes = GetObject>(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Url.ToBytes(), Size.ToBytes(), MimeType.ToBytes(), Attributes.ToBytes()); } public override TLObject FromStream(Stream input) { Url = GetObject(input); Size = GetObject(input); MimeType = GetObject(input); Attributes = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Url.ToStream(output); Size.ToStream(output); MimeType.ToStream(output); Attributes.ToStream(output); } } } ================================================ FILE: Telegram.Api/TL/TLWebFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLWebFile : TLFile { public new const uint Signature = TLConstructors.TLWebFile; public TLInt Size { get; set; } public TLString MimeType { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Size = GetObject(bytes, ref position); MimeType = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); MTime = GetObject(bytes, ref position); Bytes = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api/TL/TLWebPage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; #if WINDOWS_PHONE using System.Net; using System.Windows; #elif WIN_RT using Windows.UI.Xaml; #endif using Telegram.Api.Extensions; using Telegram.Api.TL; namespace Telegram.Api { [Flags] public enum WebPageFlags { Type = 0x1, SiteName = 0x2, Title = 0x4, Description = 0x8, Photo = 0x10, Embed = 0x20, EmbedSize = 0x40, Duration = 0x80, Author = 0x100, Document = 0x200, CachedPage = 0x400, } public abstract class TLWebPageBase : TLObject { public TLLong Id { get; set; } #region Additional public abstract Visibility SiteNameVisibility { get; } public abstract Visibility AuthorVisibility { get; } public abstract Visibility TitleVisibility { get; } public abstract Visibility DescriptionVisibility { get; } #endregion } public class TLWebPageEmpty : TLWebPageBase { public const uint Signature = TLConstructors.TLWebPageEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override Visibility SiteNameVisibility { get { return Visibility.Collapsed; } } public override Visibility AuthorVisibility { get { return Visibility.Collapsed; } } public override Visibility TitleVisibility { get { return Visibility.Collapsed; } } public override Visibility DescriptionVisibility { get { return Visibility.Collapsed; } } } public class TLWebPagePending : TLWebPageBase { public const uint Signature = TLConstructors.TLWebPagePending; public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Date.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); Date = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Date.ToStream(output); } public override Visibility SiteNameVisibility { get { return Visibility.Collapsed; } } public override Visibility AuthorVisibility { get { return Visibility.Collapsed; } } public override Visibility TitleVisibility { get { return Visibility.Collapsed; } } public override Visibility DescriptionVisibility { get { return Visibility.Collapsed; } } } public class TLWebPage : TLWebPageBase { public const uint Signature = TLConstructors.TLWebPage; public TLInt Flags { get; set; } public TLString Url { get; set; } public TLString DisplayUrl { get; set; } public TLString Type { get; set; } public TLString SiteName { get; set; } public TLString Title { get; set; } public TLString Description { get; set; } public TLPhotoBase Photo { get; set; } public TLString EmbedUrl { get; set; } public TLString EmbedType { get; set; } public TLInt EmbedWidth { get; set; } public TLInt EmbedHeight { get; set; } public TLInt Duration { get; set; } public string DurationString { get { if (Duration == null) return null; var timeSpan = TimeSpan.FromSeconds(Duration.Value); if (timeSpan.Hours > 0) { return timeSpan.ToString(@"h\:mm\:ss"); } return timeSpan.ToString(@"m\:ss"); } } public TLString Author { get; set; } public override Visibility SiteNameVisibility { get { return TLString.IsNullOrEmpty(SiteName) ? Visibility.Collapsed : Visibility.Visible; } } public override Visibility AuthorVisibility { get { return TLString.IsNullOrEmpty(Author) ? Visibility.Collapsed : Visibility.Visible; } } public override Visibility TitleVisibility { get { return TLString.IsNullOrEmpty(Title)? Visibility.Collapsed : Visibility.Visible; } } public override Visibility DescriptionVisibility { get { return TLString.IsNullOrEmpty(Description) ? Visibility.Collapsed : Visibility.Visible; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); DisplayUrl = GetObject(bytes, ref position); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(bytes, ref position); EmbedType = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(bytes, ref position); EmbedHeight = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(bytes, ref position); } return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Url.ToBytes(), DisplayUrl.ToBytes(), ToBytes(Type, Flags, (int)WebPageFlags.Type), ToBytes(SiteName, Flags, (int)WebPageFlags.SiteName), ToBytes(Title, Flags, (int)WebPageFlags.Title), ToBytes(Description, Flags, (int)WebPageFlags.Description), ToBytes(Photo, Flags, (int)WebPageFlags.Photo), ToBytes(EmbedUrl, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedType, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedWidth, Flags, (int)WebPageFlags.EmbedSize), ToBytes(EmbedHeight, Flags, (int)WebPageFlags.EmbedSize), ToBytes(Duration, Flags, (int)WebPageFlags.Duration), ToBytes(Author, Flags, (int)WebPageFlags.Author)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Url = GetObject(input); DisplayUrl = GetObject(input); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(input); EmbedType = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(input); EmbedHeight = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Url.ToStream(output); DisplayUrl.ToStream(output); ToStream(output, Type, Flags, (int)WebPageFlags.Type); ToStream(output, SiteName, Flags, (int)WebPageFlags.SiteName); ToStream(output, Title, Flags, (int)WebPageFlags.Title); ToStream(output, Description, Flags, (int)WebPageFlags.Description); ToStream(output, Photo, Flags, (int)WebPageFlags.Photo); ToStream(output, EmbedUrl, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedType, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedWidth, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, EmbedHeight, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, Duration, Flags, (int)WebPageFlags.Duration); ToStream(output, Author, Flags, (int) WebPageFlags.Author); } } public class TLWebPage35 : TLWebPage { public new const uint Signature = TLConstructors.TLWebPage35; public TLDocumentBase Document { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); DisplayUrl = GetObject(bytes, ref position); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(bytes, ref position); EmbedType = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(bytes, ref position); EmbedHeight = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Document)) { Document = GetObject(bytes, ref position); } return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Url.ToBytes(), DisplayUrl.ToBytes(), ToBytes(Type, Flags, (int)WebPageFlags.Type), ToBytes(SiteName, Flags, (int)WebPageFlags.SiteName), ToBytes(Title, Flags, (int)WebPageFlags.Title), ToBytes(Description, Flags, (int)WebPageFlags.Description), ToBytes(Photo, Flags, (int)WebPageFlags.Photo), ToBytes(EmbedUrl, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedType, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedWidth, Flags, (int)WebPageFlags.EmbedSize), ToBytes(EmbedHeight, Flags, (int)WebPageFlags.EmbedSize), ToBytes(Duration, Flags, (int)WebPageFlags.Duration), ToBytes(Author, Flags, (int)WebPageFlags.Author), ToBytes(Document, Flags, (int)WebPageFlags.Document)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Url = GetObject(input); DisplayUrl = GetObject(input); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(input); EmbedType = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(input); EmbedHeight = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Document)) { Document = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Url.ToStream(output); DisplayUrl.ToStream(output); ToStream(output, Type, Flags, (int)WebPageFlags.Type); ToStream(output, SiteName, Flags, (int)WebPageFlags.SiteName); ToStream(output, Title, Flags, (int)WebPageFlags.Title); ToStream(output, Description, Flags, (int)WebPageFlags.Description); ToStream(output, Photo, Flags, (int)WebPageFlags.Photo); ToStream(output, EmbedUrl, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedType, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedWidth, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, EmbedHeight, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, Duration, Flags, (int)WebPageFlags.Duration); ToStream(output, Author, Flags, (int)WebPageFlags.Author); ToStream(output, Document, Flags, (int)WebPageFlags.Document); } } public class TLWebPage59 : TLWebPage35 { public new const uint Signature = TLConstructors.TLWebPage59; public TLInt Hash { get; set; } public TLPageBase CachedPage { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Url = GetObject(bytes, ref position); DisplayUrl = GetObject(bytes, ref position); Hash = GetObject(bytes, ref position); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(bytes, ref position); EmbedType = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(bytes, ref position); EmbedHeight = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.Document)) { Document = GetObject(bytes, ref position); } if (IsSet(Flags, (int)WebPageFlags.CachedPage)) { CachedPage = GetObject(bytes, ref position); } return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Id.ToBytes(), Url.ToBytes(), DisplayUrl.ToBytes(), Hash.ToBytes(), ToBytes(Type, Flags, (int)WebPageFlags.Type), ToBytes(SiteName, Flags, (int)WebPageFlags.SiteName), ToBytes(Title, Flags, (int)WebPageFlags.Title), ToBytes(Description, Flags, (int)WebPageFlags.Description), ToBytes(Photo, Flags, (int)WebPageFlags.Photo), ToBytes(EmbedUrl, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedType, Flags, (int)WebPageFlags.Embed), ToBytes(EmbedWidth, Flags, (int)WebPageFlags.EmbedSize), ToBytes(EmbedHeight, Flags, (int)WebPageFlags.EmbedSize), ToBytes(Duration, Flags, (int)WebPageFlags.Duration), ToBytes(Author, Flags, (int)WebPageFlags.Author), ToBytes(Document, Flags, (int)WebPageFlags.Document), ToBytes(CachedPage, Flags, (int)WebPageFlags.CachedPage)); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Id = GetObject(input); Url = GetObject(input); DisplayUrl = GetObject(input); Hash = GetObject(input); if (IsSet(Flags, (int)WebPageFlags.Type)) { Type = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.SiteName)) { SiteName = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Title)) { Title = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Description)) { Description = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Photo)) { Photo = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Embed)) { EmbedUrl = GetObject(input); EmbedType = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.EmbedSize)) { EmbedWidth = GetObject(input); EmbedHeight = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Duration)) { Duration = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Author)) { Author = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.Document)) { Document = GetObject(input); } if (IsSet(Flags, (int)WebPageFlags.CachedPage)) { CachedPage = GetObject(input); } return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Id.ToStream(output); Url.ToStream(output); DisplayUrl.ToStream(output); Hash.ToStream(output); ToStream(output, Type, Flags, (int)WebPageFlags.Type); ToStream(output, SiteName, Flags, (int)WebPageFlags.SiteName); ToStream(output, Title, Flags, (int)WebPageFlags.Title); ToStream(output, Description, Flags, (int)WebPageFlags.Description); ToStream(output, Photo, Flags, (int)WebPageFlags.Photo); ToStream(output, EmbedUrl, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedType, Flags, (int)WebPageFlags.Embed); ToStream(output, EmbedWidth, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, EmbedHeight, Flags, (int)WebPageFlags.EmbedSize); ToStream(output, Duration, Flags, (int)WebPageFlags.Duration); ToStream(output, Author, Flags, (int)WebPageFlags.Author); ToStream(output, Document, Flags, (int)WebPageFlags.Document); ToStream(output, CachedPage, Flags, (int)WebPageFlags.CachedPage); } } public class TLWebPageNotModified : TLWebPageBase { public const uint Signature = TLConstructors.TLWebPageNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override Visibility SiteNameVisibility { get { return Visibility.Collapsed; } } public override Visibility AuthorVisibility { get { return Visibility.Collapsed; } } public override Visibility TitleVisibility { get { return Visibility.Collapsed; } } public override Visibility DescriptionVisibility { get { return Visibility.Collapsed; } } } } ================================================ FILE: Telegram.Api/Telegram.Api.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {0C2F1B61-A8FE-45FB-8538-AA6925A415B6} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.Api Telegram.Api v4.0 $(TargetFrameworkVersion) WindowsPhone71 Silverlight false true true ..\ true true full false Bin\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;LAYER_29;LAYER_40 true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;LAYER_29;LAYER_40 true true prompt 4 true bin\Debug Private Beta\ TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;PRIVATE_BETA; true full AnyCPU prompt MinimumRecommendedRules.ruleset bin\Release Private Beta\ TRACE;SILVERLIGHT;WINDOWS_PHONE;PRIVATE_BETA;LOG_REGISTRATION; true true pdbonly AnyCPU prompt MinimumRecommendedRules.ruleset ..\Libraries\BouncyCastle.Crypto.WP71.dll ..\packages\Rx-Core.2.2.2\lib\windowsphone71\System.Reactive.Core.dll ..\packages\Rx-Interfaces.2.2.2\lib\windowsphone71\System.Reactive.Interfaces.dll ..\packages\Rx-Linq.2.2.2\lib\windowsphone71\System.Reactive.Linq.dll Compression\GZipDeflateStream.cs Constants.cs CRC.cs Extensions\ActionExtensions.cs Extensions\HttpWebRequestExtensions.cs Extensions\StreamExtensions.cs Extensions\TLObjectExtensions.cs Helpers\Execute.cs Helpers\FileUtils.cs Helpers\PhoneHelper.cs Helpers\SettingsHelper.cs Helpers\Utils.cs MD5\MD5.cs MD5\MD5CryptoServiceProvider.cs MD5\MD5Managed.cs Services\Cache\Context.cs Services\Cache\EventArgs\DialogAddedEventArgs.cs Services\Cache\EventArgs\TopMessageUpdatedEventArgs.cs Services\Cache\ICacheService.cs Services\Cache\InMemoryCacheService.cs Services\Cache\InMemoryDatabase.cs Services\Connection\ConnectionService.cs Services\DCOptionItem.cs Services\DelayedItem.cs Services\FileManager\AudioFileManager.cs Services\FileManager\DocumentFileManager.cs Services\FileManager\DownloadableItem.cs Services\FileManager\DownloadablePart.cs Services\FileManager\DownloadingCanceledEventArgs.cs Services\FileManager\EncryptedFileManager.cs Services\FileManager\FileManager.cs Services\FileManager\IAudioFileManager.cs Services\FileManager\IDocumentFileManager.cs Services\FileManager\IEncryptedFileManager.cs Services\FileManager\IFileManager.cs Services\FileManager\IUploadAudioFileManager.cs Services\FileManager\IUploadFileManager.cs Services\FileManager\IUploadVideoFileManager.cs Services\FileManager\IVideoFileManager.cs Services\FileManager\ProgressChangedEventArgs.cs Services\FileManager\UploadAudioFileManager.cs Services\FileManager\UploadFileManager.cs Services\FileManager\UploadVideoFileManager.cs Services\FileManager\VideoFileManager.cs Services\FileManager\Worker.cs Services\HistoryItem.cs Services\IMTProtoService.cs Services\MTProtoService.Account.cs Services\MTProtoService.Auth.cs Services\MTProtoService.ByTransport.cs Services\MTProtoService.Config.cs Services\MTProtoService.Contacts.cs Services\MTProtoService.cs Services\MTProtoService.DHKeyExchange.cs Services\MTProtoService.Help.cs Services\MTProtoService.Helpers.cs Services\MTProtoService.HttpLongPoll.cs Services\MTProtoService.Messages.cs Services\MTProtoService.Photos.cs Services\MTProtoService.SecretChats.cs Services\MTProtoService.SendingQueue.cs Services\MTProtoService.Stuff.cs Services\MTProtoService.Updates.cs Services\MTProtoService.Upload.cs Services\MTProtoService.Users.cs Services\ServiceBase.cs Services\Updates\IUpdatesService.cs Services\Updates\ReceiveUpdatesEventArgs.cs Services\Updates\UpdatesBySeqComparer.cs Services\Updates\UpdatesService.cs TL\Enums.cs TL\Account\TLCheckUsername.cs TL\Account\TLDeleteAccount.cs TL\Account\TLGetAccountTTL.cs TL\Account\TLGetNotifySettings.cs TL\Account\TLGetPrivacy.cs TL\Account\TLRegisterDevice.cs TL\Account\TLResetNotifySettings.cs TL\Account\TLSetPrivacy.cs TL\Account\TLUnregisterDevice.cs TL\Account\TLUpdateNotifySettings.cs TL\Account\TLUpdateProfile.cs TL\Account\TLUpdateStatus.cs TL\Account\TLUpdateUserName.cs TL\Functions\Auth\TLCheckPhone.cs TL\Functions\Auth\TLExportAuthorization.cs TL\Functions\Auth\TLImportAuthorization.cs TL\Functions\Auth\TLLogOut.cs TL\Functions\Auth\TLResetAuthorizations.cs TL\Functions\Auth\TLSendCall.cs TL\Functions\Auth\TLSendCode.cs TL\Functions\Auth\TLSendInvites.cs TL\Functions\Auth\TLSendSms.cs TL\Functions\Auth\TLSignIn.cs TL\Functions\Auth\TLSignUp.cs TL\Functions\Contacts\TLBlock.cs TL\Functions\Contacts\TLDeleteContact.cs TL\Functions\Contacts\TLDeleteContacts.cs TL\Functions\Contacts\TLGetBlocked.cs TL\Functions\Contacts\TLGetContacts.cs TL\Functions\Contacts\TLGetStatuses.cs TL\Functions\Contacts\TLImportContacts.cs TL\Functions\Contacts\TLSearch.cs TL\Functions\Contacts\TLUnblock.cs TL\Functions\DHKeyExchange\TLReqDHParams.cs TL\Functions\DHKeyExchange\TLReqPQ.cs TL\Functions\DHKeyExchange\TLSetClientDHParams.cs TL\Functions\Help\TLGetConfig.cs TL\Functions\Help\TLGetInviteText.cs TL\Functions\Help\TLGetNearestDC.cs TL\Functions\Help\TLGetSupport.cs TL\Functions\Help\TLInvokeWithLayerN.cs TL\Functions\Messages\TLAcceptEncryption.cs TL\Functions\Messages\TLAddChatUser.cs TL\Functions\Messages\TLCreateChat.cs TL\Functions\Messages\TLDeleteChatUser.cs TL\Functions\Messages\TLDeleteHistory.cs TL\Functions\Messages\TLDeleteMessages.cs TL\Functions\Messages\TLDiscardEncryption.cs TL\Functions\Messages\TLEditChatPhoto.cs TL\Functions\Messages\TLEditChatTitle.cs TL\Functions\Messages\TLForwardMessage.cs TL\Functions\Messages\TLForwardMessages.cs TL\Functions\Messages\TLGetChats.cs TL\Functions\Messages\TLGetDHConfig.cs TL\Functions\Messages\TLGetDialogs.cs TL\Functions\Messages\TLGetFullChat.cs TL\Functions\Messages\TLGetHistory.cs TL\Functions\Messages\TLGetMessages.cs TL\Functions\Messages\TLReadEncryptedHistory.cs TL\Functions\Messages\TLReadHistory.cs TL\Functions\Messages\TLReadMessageContents.cs TL\Functions\Messages\TLReceivedMessages.cs TL\Functions\Messages\TLReceivedQueue.cs TL\Functions\Messages\TLRequestEncryption.cs TL\Functions\Messages\TLRestoreMessages.cs TL\Functions\Messages\TLSearch.cs TL\Functions\Messages\TLSendBroadcast.cs TL\Functions\Messages\TLSendEncrypted.cs TL\Functions\Messages\TLSendEncryptedFile.cs TL\Functions\Messages\TLSendEncryptedService.cs TL\Functions\Messages\TLSendMedia.cs TL\Functions\Messages\TLSendMessage.cs TL\Functions\Messages\TLSetEncryptedTyping.cs TL\Functions\Messages\TLSetTyping.cs TL\Functions\Photos\TLGetUserPhotos.cs TL\Functions\Photos\TLUpdateProfilePhoto.cs TL\Functions\Photos\TLUploadProfilePhoto.cs TL\Functions\Stuff\TLGetFutureSalts.cs TL\Functions\Stuff\TLHttpWait.cs TL\Functions\Stuff\TLMessageAcknowledgments.cs TL\Functions\Stuff\TLRPCDropAnswer.cs TL\Functions\Updates\TLGetDifference.cs TL\Functions\Updates\TLGetState.cs TL\Functions\Upload\TLGetFile.cs TL\Functions\Upload\TLSaveFilePart.cs TL\Functions\Users\TLGetFullUser.cs TL\Functions\Users\TLGetUsers.cs TL\Interfaces\IBytes.cs TL\Interfaces\IFullName.cs TL\Interfaces\IInputPeer.cs TL\Interfaces\ISelectable.cs TL\Interfaces\IVIsibility.cs TL\SignatureAttribute.cs TL\TLAffectedHistory.cs TL\TLAudio.cs TL\TLAuthorization.cs TL\TLBadMessageNotification.cs TL\TLBadServerSalt.cs TL\TLBool.cs TL\TLChat.cs TL\TLChatFull.cs TL\TLChatParticipant.cs TL\TLChatParticipants.cs TL\TLChats.cs TL\TLCheckedPhone.cs TL\TLClientDHInnerData.cs TL\TLConfig.cs TL\TLContact.cs TL\TLContactBlocked.cs TL\TLContactFound.cs TL\TLContacts.cs TL\TLContactsBlocked.cs TL\TLContactsFound.cs TL\TLContactStatus.cs TL\TLContainerTransportMessage.cs TL\TLDCOption.cs TL\TLDecryptedMessage.cs TL\TLDecryptedMessageAction.cs TL\TLDecryptedMessageLayer.cs TL\TLDecryptedMessageMedia.cs TL\TLDHConfig.cs TL\TLDHGen.cs TL\TLDialog.cs TL\TLDialogs.cs TL\TLDifference.cs TL\TLDocument.cs TL\TLDouble.cs TL\TLEncryptedChat.cs TL\TLEncryptedFile.cs TL\TLEncryptedMessage.cs TL\TLExportedAuthorization.cs TL\TLFile.cs TL\TLFileLocation.cs TL\TLFileType.cs TL\TLForeignLink.cs TL\TLFutureSalt.cs TL\TLGeoPoint.cs TL\TLGzipPacked.cs TL\TLImportedContact.cs TL\TLImportedContacts.cs TL\TLInitConnection.cs TL\TLInputAudio.cs TL\TLInputChatPhoto.cs TL\TLInputContact.cs TL\TLInputDocument.cs TL\TLInputEncryptedChat.cs TL\TLInputEncryptedFile.cs TL\TLInputEncryptedFileLocation.cs TL\TLInputFile.cs TL\TLInputFileLocation.cs TL\TLInputGeoPoint.cs TL\TLInputMedia.cs TL\TLInputMessagesFilter.cs TL\TLInputNotifyPeer.cs TL\TLInputPeerBase.cs TL\TLInputPeerNotifyEvents.cs TL\TLInputPeerNotifySettings.cs TL\TLInputPhoto.cs TL\TLInputPhotoCrop.cs TL\TLInputUser.cs TL\TLInputVideo.cs TL\TLInt.cs TL\TLInt128.cs TL\TLInt256.cs TL\TLInviteText.cs TL\TLInvokeAfterMsg.cs TL\TLLink.cs TL\TLLong.cs TL\TLMessage.cs TL\TLMessage.Encrypted.cs TL\TLMessageAction.cs TL\TLMessageContainer.cs TL\TLMessageInfo.cs TL\TLMessageMedia.cs TL\TLMessages.cs TL\TLMessagesAcknowledgment.cs TL\TLMessagesChatFull.cs TL\TLMyLink.cs TL\TLNearestDC.cs TL\TLNewSessionCreated.cs TL\TLNonEncryptedMessage.cs TL\TLNotifyPeer.cs TL\TLNull.cs TL\TLObject.cs TL\TLObjectGenerator.cs TL\TLPeer.cs TL\TLPeerNotifyEvents.cs TL\TLPeerNotifySettings.cs TL\TLPhoto.cs TL\TLPhotos.cs TL\TLPhotoSize.cs TL\TLPhotosPhoto.cs TL\TLPong.cs TL\TLPQInnerData.cs TL\TLRequest.cs TL\TLResponse.cs TL\TLResPQ.cs TL\TLRPCDropAnswer.cs TL\TLRPCError.cs TL\TLRPCResult.cs TL\TLSendMessageAction.cs TL\TLSentCode.cs TL\TLSentEncryptedFile.cs TL\TLSentEncryptedMessage.cs TL\TLSentMessage.cs TL\TLServerDHInnerData.cs TL\TLServerDHParams.cs TL\TLServerFile.cs TL\TLSignatures.cs TL\TLState.cs TL\TLStatedMessage.cs TL\TLStatedMessages.cs TL\TLString.cs TL\TLSupport.cs TL\TLUpdate.cs TL\TLUpdates.cs TL\TLUserBase.cs TL\TLUserFull.cs TL\TLUserStatus.cs TL\TLUtils.cs TL\TLUtils.Log.cs TL\TLVector.cs TL\TLVideo.cs TL\TLWallpaperSolid.cs Transport\DataEventArgs.cs Transport\HttpTransport.cs Transport\ITransport.cs Transport\ITransportService.cs Transport\TCPTransport.cs Transport\TCPTransportBase.cs Transport\TCPTransportResult.cs Transport\TransportService.cs ================================================ FILE: Telegram.Api/Transport/DataEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.Transport { public class DataEventArgs : EventArgs { public byte[] Data { get; set; } public DateTime? LastReceiveTime { get; set; } public int NextPacketLength { get; set; } public DataEventArgs(byte[] data) { Data = data; } public DataEventArgs(byte[] data, int packetLength, DateTime? lastReceiveTime) { Data = data; NextPacketLength = packetLength; LastReceiveTime = lastReceiveTime; } } } ================================================ FILE: Telegram.Api/Transport/HttpTransport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Text; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.Services; using Telegram.Api.TL; using Action = System.Action; using TransportType = Telegram.Api.Services.TransportType; namespace Telegram.Api.Transport { public class HttpTransport : ITransport { public ulong Ping { get { return 0; } } public MTProtoTransportType MTProtoType { get; protected set; } public long MinMessageId { get; set; } public Dictionary MessageIdDict { get; set; } public bool Additional { get; set; } private bool _once; public void UpdateTicksDelta(TLLong msgId) { lock (SyncRoot) { if (_once) return; _once = true; var clientTime = GenerateMessageId().Value; var serverTime = msgId.Value; ClientTicksDelta += serverTime - clientTime; } } public event EventHandler ConnectionLost; public event EventHandler Connecting; public event EventHandler Connected; public DateTime? FirstReceiveTime { get { throw new NotImplementedException(); } } public DateTime? LastReceiveTime { get { throw new NotImplementedException(); } } public int PacketLength { get { throw new NotImplementedException(); } } public int LastPacketLength { get { throw new NotImplementedException(); } } public DateTime? FirstSendTime { get { throw new NotImplementedException(); } } public DateTime? LastSendTime { get { throw new NotImplementedException(); } } public WindowsPhone.Tuple GetCurrentPacketInfo() { throw new NotImplementedException(); } public string GetTransportInfo() { throw new NotImplementedException(); } public int Id { get; protected set; } private readonly object _previousMessageRoot = new object(); public long PreviousMessageId; public TLLong GenerateMessageId(bool checkPreviousMessageId = false) { var clientDelta = ClientTicksDelta; // serverTime = clientTime + clientDelta var now = DateTime.Now; //var unixTime = (long)Utils.DateTimeToUnixTimestamp(now) << 32; var unixTime = (long)(Utils.DateTimeToUnixTimestamp(now) * 4294967296) + clientDelta; //2^32 long correctUnixTime; var addingTicks = 4 - (unixTime % 4); if ((unixTime % 4) == 0) { correctUnixTime = unixTime; } else { correctUnixTime = unixTime + addingTicks; } // check with previous messageId lock (_previousMessageRoot) { if (PreviousMessageId != 0 && checkPreviousMessageId) { correctUnixTime = Math.Max(PreviousMessageId + 4, correctUnixTime); } PreviousMessageId = correctUnixTime; } // refactor this: // addTicks = 4 - (unixTime % 4) // fixedUnixTime = unixTime + addTicks // max(fixedUnixTime, previousMessageId + 4) //if ((unixTime % 4) == 0) //{ // correctUnixTime = unixTime; //} //else //{ // for (int i = 0; i < 300; i++) // { // var temp = unixTime - i; // if ((temp % 4) == 0) // { // correctUnixTime = unixTime; // break; // } // } //} //TLUtils.WriteLine("TLMessage ID: " + correctUnixTime); //TLUtils.WriteLine("MessageId % 4 =" + (correctUnixTime % 4)); //TLUtils.WriteLine("Corresponding time: " + Utils.UnixTimestampToDateTime(correctUnixTime >> 32)); if (correctUnixTime == 0) throw new Exception("Bad message id"); return new TLLong(correctUnixTime); } #region NonEncryptedHistory private readonly object _nonEncryptedHistoryRoot = new object(); private readonly Dictionary _nonEncryptedHistory = new Dictionary(); public IList RemoveTimeOutRequests(double timeout = Constants.TimeoutInterval) { var now = DateTime.Now; var timedOutKeys = new List(); var timedOutValues = new List(); lock (_nonEncryptedHistoryRoot) { foreach (var historyKeyValue in _nonEncryptedHistory) { var historyValue = historyKeyValue.Value; if (historyValue.SendTime != default(DateTime) && historyValue.SendTime.AddSeconds(timeout) < now) { timedOutKeys.Add(historyKeyValue.Key); timedOutValues.Add(historyKeyValue.Value); } } foreach (var key in timedOutKeys) { _nonEncryptedHistory.Remove(key); } } return timedOutValues; } public void EnqueueNonEncryptedItem(HistoryItem item) { lock (_nonEncryptedHistoryRoot) { _nonEncryptedHistory[item.Hash] = item; } } public HistoryItem DequeueFirstNonEncryptedItem() { HistoryItem item; lock (_nonEncryptedHistoryRoot) { item = _nonEncryptedHistory.Values.FirstOrDefault(); if (item != null) { _nonEncryptedHistory.Remove(item.Hash); } } return item; } public bool RemoveNonEncryptedItem(HistoryItem item) { bool result; lock (_nonEncryptedHistoryRoot) { result = _nonEncryptedHistory.Remove(item.Hash); } return result; } public void ClearNonEncryptedHistory(Exception e = null) { lock (_nonEncryptedHistoryRoot) { foreach (var historyItem in _nonEncryptedHistory) { var error = new StringBuilder(); error.AppendLine("Clear NonEncrypted History: "); if (e != null) { error.AppendLine(e.ToString()); } historyItem.Value.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString(error.ToString()) }); } _nonEncryptedHistory.Clear(); } } public string PrintNonEncryptedHistory() { var sb = new StringBuilder(); lock (_nonEncryptedHistoryRoot) { sb.AppendLine("NonEncryptedHistory items:"); foreach (var historyItem in _nonEncryptedHistory.Values) { sb.AppendLine(historyItem.Caption); } } return sb.ToString(); } #endregion public void StartListening() { } private readonly object _syncRoot = new object(); public object SyncRoot { get { return _syncRoot; } } public int DCId { get; set; } public byte[] Secret { get; set; } public byte[] AuthKey { get; set; } public TLLong SessionId { get; set; } public TLLong Salt { get; set; } public int SequenceNumber { get; set; } public long ClientTicksDelta { get; set; } public bool Initiated { get; set; } public bool Initialized { get; set; } public bool IsInitializing { get; set; } public bool IsAuthorized { get; set; } public bool IsAuthorizing { get; set; } public string Host { get { return _host; } } public int Port { get { return 80; } } public string StaticHost { get; protected set; } public int StaticPort { get; protected set; } public string ActualHost { get; protected set; } public int ActualPort { get; protected set; } public TLProxyConfigBase ProxyConfig { get; protected set; } public TransportType Type { get { return TransportType.Http; } } public bool Closed { get; private set; } private string _host; public HttpTransport(string address, MTProtoTransportType mtProtoType, TLProxyConfigBase proxyConfig) { var host = string.IsNullOrEmpty(address) ? Constants.FirstServerIpAddress : address; _host = string.Format("http://{0}:80/api", host); MTProtoType = mtProtoType; ProxyConfig = proxyConfig; MessageIdDict = new Dictionary(); } public void ConnectAsync(Action callback, Action faultCallback) { } public event EventHandler PacketReceived; private void RaiseGetBytes(byte[] data) { var eventHandler = PacketReceived; if (eventHandler != null) { eventHandler.Invoke(this, new DataEventArgs(data)); } } private static HttpWebRequest CreateRequest(int contentLength, string address) { var request = (HttpWebRequest)WebRequest.Create(address); request.Method = "POST"; #if SILVERLIGHT request.Headers["Connection"] = "Keep-alive"; request.Headers["Content-Length"] = contentLength.ToString(CultureInfo.InvariantCulture); #else request.KeepAlive = true; request.ContentLength = contentLength; ServicePointManager.Expect100Continue = false; #endif //IWebProxy proxy = request.Proxy; //if (proxy != null) //{ // string proxyuri = proxy.GetProxy(request.RequestUri).ToString(); // request.UseDefaultCredentials = true; // request.Proxy = new WebProxy(proxyuri, false); // request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; //} return request; } public void SendPacketAsync(string caption, byte[] message, Action callback, Action faultCallback = null) { //var guid = Guid.NewGuid(); var stopwatch = Stopwatch.StartNew(); TLUtils.WriteLine(" HTTP: Send " + caption); var request = CreateRequest(message.Length, _host); request.BeginAsync(message, result => { TLUtils.WriteLine(); TLUtils.WriteLine(); TLUtils.WriteLine(" HTTP: Receive " + caption + " (" + stopwatch.Elapsed + ")"); RaiseGetBytes(result); ///callback(result); }, () => { TLUtils.WriteLine(); TLUtils.WriteLine(); TLUtils.WriteLine(" HTTP: Receive Falt " + caption + " (" + stopwatch.Elapsed + ")"); faultCallback.SafeInvoke(null); }); } public byte[] SendBytes(byte[] message) { //95.142.192.65:80 //173.240.5.253:443 #if SILVERLIGHT throw new NotImplementedException("Sync mode is not supported in Windows Phone"); #else var request = CreateRequest(message.Length, _host); var dataStream = request.GetRequestStream(); dataStream.Write(message, 0, message.Length); dataStream.Close(); var response = request.GetResponse(); //TLUtils.WriteLine(((HttpWebResponse)response).StatusDescription); dataStream = response.GetResponseStream(); var buffer = new byte[Int32.Parse(response.Headers["Content-Length"])]; var bytesRead = 0; var totalBytesRead = bytesRead; while (totalBytesRead < buffer.Length) { bytesRead = dataStream.Read(buffer, bytesRead, buffer.Length - bytesRead); totalBytesRead += bytesRead; } dataStream.Close(); dataStream.Close(); response.Close(); RaiseGetBytes(buffer); return buffer; #endif } public void Close() { } } } ================================================ FILE: Telegram.Api/Transport/ITransport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using Telegram.Api.Services; using Telegram.Api.TL; namespace Telegram.Api.Transport { public interface ITransport { ulong Ping { get; } MTProtoTransportType MTProtoType { get; } event EventHandler Connecting; event EventHandler Connected; event EventHandler ConnectionLost; event EventHandler PacketReceived; void SendPacketAsync(string caption, byte[] data, Action callback, Action faultCallback = null); void Close(); // check hang connection DateTime? FirstSendTime { get; } DateTime? LastReceiveTime { get; } int PacketLength { get; } int LastPacketLength { get; } // debug WindowsPhone.Tuple GetCurrentPacketInfo(); string GetTransportInfo(); string PrintNonEncryptedHistory(); TLLong GenerateMessageId(bool checkPreviousMessageId = false); void EnqueueNonEncryptedItem(HistoryItem item); HistoryItem DequeueFirstNonEncryptedItem(); bool RemoveNonEncryptedItem(HistoryItem item); void ClearNonEncryptedHistory(Exception e = null); IList RemoveTimeOutRequests(double timeout = Constants.TimeoutInterval); void UpdateTicksDelta(TLLong msgId); object SyncRoot { get; } int Id { get; } int DCId { get; set; } byte[] Secret { get; set; } byte[] AuthKey { get; set; } TLLong SessionId { get; set; } long MinMessageId { get; set; } Dictionary MessageIdDict { get; set; } TLLong Salt { get; set; } int SequenceNumber { get; set; } long ClientTicksDelta { get; set; } string Host { get; } int Port { get; } string StaticHost { get; } int StaticPort { get; } string ActualHost { get; } int ActualPort { get; } TLProxyConfigBase ProxyConfig { get; } TransportType Type { get; } //сделан initConnection bool Initiated { get; set; } //создан ключ bool Initialized { get; set; } bool IsInitializing { get; set; } //перенесена авторизация из активного dc (import/export authorization) bool IsAuthorized { get; set; } bool IsAuthorizing { get; set; } //вызван метод Close bool Closed { get; } } public enum MTProtoTransportType { Main, File, Special, } } ================================================ FILE: Telegram.Api/Transport/ITransportService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using Telegram.Api.Services; using Telegram.Api.TL; namespace Telegram.Api.Transport { public interface ITransportService { void SetProxyConfig(TLProxyConfigBase proxyConfig); TLProxyConfigBase GetProxyConfig(); ITransport GetTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated); ITransport GetFileTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated); ITransport GetFileTransport2(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated); ITransport GetSpecialTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated); ITransport GetSpecialTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, TLProxyBase proxy, out bool isCreated); void Close(); void CloseTransport(ITransport transport); void CloseSpecialTransport(ITransport transport); event EventHandler TransportConnecting; event EventHandler TransportConnected; event EventHandler ConnectionLost; event EventHandler FileConnectionLost; event EventHandler SpecialConnectionLost; event EventHandler CheckConfig; } public delegate ITransport GetTransportFunc(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated); public delegate ITransport GetTransportWithProxyFunc(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, TLProxyBase proxy, out bool isCreated); } ================================================ FILE: Telegram.Api/Transport/SocksProxy.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; using Windows.Networking; using Windows.Storage.Streams; using Telegram.Api.Helpers; using Windows.Networking.Sockets; #if WIN_RT #else using System.Net.Sockets; using Microsoft.Phone.Net.NetworkInformation; #endif namespace Telegram.Api.Transport { /// /// Provides sock5 functionality to clients (Connect only). /// public class SocksProxy { private SocksProxy() { } #region ErrorMessages private static string[] errorMsgs = { "Operation completed successfully.", "General SOCKS server failure.", "Connection not allowed by ruleset.", "Network unreachable.", "Host unreachable.", "Connection refused.", "TTL expired.", "Command not supported.", "Address type not supported.", "Unknown error." }; #endregion private static bool Send(DataWriter dataWriter, byte[] buffer, int offset, int length) { var sendBuffer = buffer.SubArray(offset, length); dataWriter.WriteBytes(sendBuffer); var resul = dataWriter.StoreAsync().AsTask().Result; return true; } private static int Receive(DataReader dataReader, byte[] buffer, int offset, int length) { var bytesTransferred = dataReader.LoadAsync((uint)buffer.Length).AsTask().Result; var receiveBuffer = new byte[bytesTransferred]; dataReader.ReadBytes(receiveBuffer); Array.Copy(receiveBuffer, buffer, receiveBuffer.Length); return (int) bytesTransferred; } public static async Task ConnectToSocks5Proxy(double timeout, StreamSocket s, DataWriter _dataWriter, DataReader _dataReader, string proxyAddress, ushort proxyPort, string destAddress, ushort destPort, string userName, string password) { var destIP = new HostName(destAddress); var proxyIP = new HostName(proxyAddress); var request = new byte[256]; var response = new byte[256]; ushort nIndex; // open a TCP connection to SOCKS server... //Connect(s, proxyEndPoint); await s.ConnectAsync(proxyIP, proxyPort.ToString(CultureInfo.InvariantCulture)).WithTimeout(timeout); nIndex = 0; request[nIndex++] = 0x05; // Version 5. request[nIndex++] = 0x02; // 2 Authentication methods are in packet... request[nIndex++] = 0x00; // NO AUTHENTICATION REQUIRED request[nIndex++] = 0x02; // USERNAME/PASSWORD Send(_dataWriter, request, 0, nIndex); var nGot = Receive(_dataReader, response, 0, response.Length); // Receive 2 byte response... if (nGot != 2) throw new ConnectionException("Bad response received from proxy server."); if (response[1] == 0xFF) { // No authentication method was accepted close the socket. s.Dispose(); throw new ConnectionException("None of the authentication method was accepted by proxy server."); } byte[] rawBytes; //Username/Password Authentication protocol if (response[1] == 0x02) { nIndex = 0; request[nIndex++] = 0x01; // Version 5. // add user name request[nIndex++] = (byte)userName.Length; rawBytes = Encoding.UTF8.GetBytes(userName); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; // add password request[nIndex++] = (byte)password.Length; rawBytes = Encoding.UTF8.GetBytes(password); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; // Send the Username/Password request Send(_dataWriter, request, 0, nIndex); nGot = Receive(_dataReader, response, 0, response.Length); if (nGot != 2) throw new ConnectionException("Bad response received from proxy server."); if (response[1] != 0x00) throw new ConnectionException("Bad Usernaem/Password."); } //// This version only supports connect command. //// UDP and Bind are not supported. // Send connect request now... nIndex = 0; request[nIndex++] = 0x05; // version 5. request[nIndex++] = 0x01; // command = connect. request[nIndex++] = 0x00; // Reserve = must be 0x00 // Destination adress in an IP. switch (destIP.Type) { case HostNameType.Ipv4: // Address is IPV4 format request[nIndex++] = 0x01; rawBytes = destIP.GetAddressBytes(); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; break; case HostNameType.Ipv6: // Address is IPV6 format request[nIndex++] = 0x04; rawBytes = destIP.GetAddressBytes(); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; break; //case HostNameType.DomainName: // // Dest. address is domain name. // request[nIndex++] = 0x03; // Address is full-qualified domain name. // request[nIndex++] = Convert.ToByte(destAddress.Length); // length of address. // rawBytes = Encoding.UTF8.GetBytes(destAddress); // rawBytes.CopyTo(request, nIndex); // nIndex += (ushort)rawBytes.Length; // break; } // using big-edian byte order byte[] portBytes = BitConverter.GetBytes(destPort); for (int i = portBytes.Length - 1; i >= 0; i--) request[nIndex++] = portBytes[i]; // send connect request. Send(_dataWriter, request, 0, nIndex); nGot = Receive(_dataReader, response, 0, response.Length); if (response[1] != 0x00) throw new ConnectionException(errorMsgs[response[1]]); // Success Connected... return s; } #if !WIN_RT private static bool Send(Socket s, byte[] buffer, int offset, int length) { var send1Event = new AutoResetEvent(false); var sendArgs = new SocketAsyncEventArgs(); sendArgs.SetBuffer(buffer, offset, length); sendArgs.Completed += (sender, eventArgs) => { send1Event.Set(); }; var result = s.SendAsync(sendArgs); send1Event.WaitOne(); return result; } private static int Receive(Socket s, byte[] buffer, int offset, int length) { var receive1Event = new AutoResetEvent(false); var receive1Args = new SocketAsyncEventArgs(); receive1Args.SetBuffer(buffer, offset, length); receive1Args.Completed += (sender, eventArgs) => { receive1Event.Set(); }; var result = s.ReceiveAsync(receive1Args); receive1Event.WaitOne(); return receive1Args.BytesTransferred; } private static bool Connect(Socket s, IPEndPoint remoteEndpoit) { var connectEvent = new AutoResetEvent(false); var connectArgs = new SocketAsyncEventArgs(); connectArgs.RemoteEndPoint = remoteEndpoit; connectArgs.Completed += (sender, eventArgs) => { connectEvent.Set(); }; s.ConnectAsync(connectArgs); connectEvent.WaitOne(); return connectArgs.SocketError == System.Net.Sockets.SocketError.Success; } public static Socket ConnectToSocks5Proxy(Socket s, string proxyAdress, ushort proxyPort, string destAddress, ushort destPort, string userName, string password) { IPAddress destIP = null; IPAddress proxyIP = null; var request = new byte[256]; var response = new byte[256]; ushort nIndex; try { proxyIP = IPAddress.Parse(proxyAdress); } catch (FormatException) { // get the IP address NameResolutionResult resolutionResult = null; var dnsResolveEvent = new AutoResetEvent(false); var endpoint = new DnsEndPoint(proxyAdress, 0); DeviceNetworkInformation.ResolveHostNameAsync(endpoint, result => { resolutionResult = result; dnsResolveEvent.Set(); }, null); dnsResolveEvent.WaitOne(); proxyIP = resolutionResult.IPEndPoints[0].Address; } // Parse destAddress (assume it in string dotted format "212.116.65.112" ) try { destIP = IPAddress.Parse(destAddress); } catch (FormatException) { // wrong assumption its in domain name format "www.microsoft.com" } var proxyEndPoint = new IPEndPoint(proxyIP, proxyPort); // open a TCP connection to SOCKS server... var connected = Connect(s, proxyEndPoint); if (!connected) { throw new ConnectionException("Can't connect to proxy server."); } nIndex = 0; request[nIndex++] = 0x05; // Version 5. request[nIndex++] = 0x02; // 2 Authentication methods are in packet... request[nIndex++] = 0x00; // NO AUTHENTICATION REQUIRED request[nIndex++] = 0x02; // USERNAME/PASSWORD Send(s, request, 0, nIndex); var nGot = Receive(s, response, 0, response.Length); // Receive 2 byte response... if (nGot != 2) throw new ConnectionException("Bad response received from proxy server."); if (response[1] == 0xFF) { // No authentication method was accepted close the socket. s.Close(); throw new ConnectionException("None of the authentication method was accepted by proxy server."); } byte[] rawBytes; //Username/Password Authentication protocol if (response[1] == 0x02) { nIndex = 0; request[nIndex++] = 0x01; // Version 5. // add user name request[nIndex++] = (byte)userName.Length; rawBytes = Encoding.UTF8.GetBytes(userName); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; // add password request[nIndex++] = (byte)password.Length; rawBytes = Encoding.UTF8.GetBytes(password); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; // Send the Username/Password request Send(s, request, 0, nIndex); nGot = Receive(s, response, 0, response.Length); if (nGot != 2) throw new ConnectionException("Bad response received from proxy server."); if (response[1] != 0x00) throw new ConnectionException("Bad Usernaem/Password."); } //// This version only supports connect command. //// UDP and Bind are not supported. // Send connect request now... nIndex = 0; request[nIndex++] = 0x05; // version 5. request[nIndex++] = 0x01; // command = connect. request[nIndex++] = 0x00; // Reserve = must be 0x00 if (destIP != null) { // Destination adress in an IP. switch (destIP.AddressFamily) { case AddressFamily.InterNetwork: // Address is IPV4 format request[nIndex++] = 0x01; rawBytes = destIP.GetAddressBytes(); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; break; case AddressFamily.InterNetworkV6: // Address is IPV6 format request[nIndex++] = 0x04; rawBytes = destIP.GetAddressBytes(); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; break; } } else { // Dest. address is domain name. request[nIndex++] = 0x03; // Address is full-qualified domain name. request[nIndex++] = Convert.ToByte(destAddress.Length); // length of address. rawBytes = Encoding.UTF8.GetBytes(destAddress); rawBytes.CopyTo(request, nIndex); nIndex += (ushort)rawBytes.Length; } // using big-edian byte order byte[] portBytes = BitConverter.GetBytes(destPort); for (int i = portBytes.Length - 1; i >= 0; i--) request[nIndex++] = portBytes[i]; // send connect request. Send(s, request, 0, nIndex); nGot = Receive(s, response, 0, response.Length); if (response[1] != 0x00) throw new ConnectionException(errorMsgs[response[1]]); // Success Connected... return s; } #endif } public class ConnectionException : Exception { public ConnectionException(string message) : base(message) { } } public static class NetworkConverter { public static bool IsLoopBackForIPv4(string ipv4) { var data = GetBytesForIPv4(ipv4); return data[3] == 1 && data[0] == 127 && data[1] == 0 && data[2] == 0; } public static bool IsLoopBackForIPv6(string ipv6) { var data = GetWordsForIPv6(ipv6); return IsLoopBackForIPv6(data); } public static bool IsLoopBack(this HostName hostName) { switch (hostName.Type) { case HostNameType.Ipv4: return IsLoopBackForIPv4(hostName.CanonicalName); case HostNameType.Ipv6: return IsLoopBackForIPv6(hostName.CanonicalName); } throw new NotSupportedException(); } public static bool IsLoopBackForIPv6(ushort[] data) { for (var i = 0; i != 5; ++i) if (data[i] != 0) return false; if (data[5] == 0) return data[6] == 0 && data[7] == 1; if (data[5] != 0xFFFF) return false; return data[6] == 0x7F00 && data[7] == 1; } public static byte[] GetPortBytes(int port) { var portBytes = BitConverter.GetBytes((ushort)port); if (BitConverter.IsLittleEndian) Array.Reverse(portBytes); return portBytes; } public static int ToPort(byte[] data) { if (BitConverter.IsLittleEndian) Array.Reverse(data); return BitConverter.ToUInt16(data, 0); } public static byte[] GetAddressBytes(this HostName hostName) { switch (hostName.Type) { case HostNameType.Ipv4: return GetBytesForIPv4(hostName.CanonicalName); case HostNameType.Ipv6: return GetBytesForIPv6(hostName.CanonicalName); } throw new NotSupportedException(); } public static byte[] GetBytesForIPv6(string ipv6) { var result = new byte[16]; var idxDst = 0; var words = GetWordsForIPv6(ipv6); for (var idxSrc = 0; idxSrc != words.Length; ++idxSrc) { var v = words[idxSrc]; result[idxDst++] = (byte)((v >> 8) & 0xFF); result[idxDst++] = (byte)(v & 0xFF); } return result; } public static byte[] GetBytesForIPv4(string ipv4) { var result = ipv4.Split('.').Select(byte.Parse) .ToArray(); return result; } public static ushort[] GetWordsForIPv6(string ipv6) { var data = new ushort[8]; ipv6 = ipv6.Replace(" ", string.Empty); if (ipv6.StartsWith("::ffff:")) { data[5] = 0xFFFF; var ipv4 = ipv6.Substring(7); if (ipv4.IndexOf(':') != -1) { var parts = ipv4.Split(':') .Select(x => ushort.Parse(x, System.Globalization.NumberStyles.HexNumber)) .ToArray(); data[6] = parts[0]; data[7] = parts[1]; } else { var d = GetBytesForIPv4(ipv4); data[6] = (ushort)((d[0] << 8) + d[1]); data[7] = (ushort)((d[2] << 8) + d[3]); } } else { var parts = ipv6.Split(':') .Select(x => string.IsNullOrWhiteSpace(x) ? -1 : int.Parse(x, System.Globalization.NumberStyles.HexNumber)) .ToArray(); var prefixSize = Array.IndexOf(parts, -1); if (prefixSize == -1) { if (parts.Length != 8) throw new ArgumentOutOfRangeException(); data = parts.Select(x => (ushort)x).ToArray(); } else { var nonEmptyIndex = prefixSize; while (nonEmptyIndex < (parts.Length - 1) && parts[nonEmptyIndex + 1] == -1) nonEmptyIndex += 1; var suffixSize = parts.Length - nonEmptyIndex - 1; for (var i = 0; i != prefixSize; ++i) data[i] = (ushort)parts[i]; var suffixIndexSrc = parts.Length - suffixSize; var suffixIndexDst = data.Length - suffixSize; for (var i = 0; i != suffixSize; ++i) data[suffixIndexDst++] = (ushort)parts[suffixIndexSrc++]; } } return data; } public static string ToIPv4(byte[] data) { return string.Join(".", data.Reverse().Select(x => x.ToString())); } public static string ToIPv6(byte[] data) { var words = new ushort[8]; var idxDst = 0; for (var idxSrc = 0; idxSrc != data.Length; idxSrc += 2) words[idxDst++] = (ushort)((data[idxSrc] << 8) + data[idxSrc + 1]); return ToIPv6(words); } public static string ToIPv6(ushort[] data) { var zeroRanges = new List>(); var startIndex = -1; var indexCount = 0; for (var i = 0; i != 8; ++i) { var v = data[i]; if (v == 0) { if (startIndex == -1) { startIndex = i; indexCount = 1; } else indexCount += 1; } else if (v != 0 && startIndex != -1) { zeroRanges.Add(Tuple.Create(startIndex, indexCount)); startIndex = -1; } } if (startIndex != -1) zeroRanges.Add(Tuple.Create(startIndex, indexCount)); if (zeroRanges.Count != 0) { var largestRange = zeroRanges.OrderByDescending(x => x.Item2).First(); startIndex = largestRange.Item1; indexCount = largestRange.Item2; } ushort[] wordsPrefix, wordsSuffix; if (startIndex != -1) { wordsPrefix = data.Take(startIndex).ToArray(); wordsSuffix = data.Skip(startIndex + indexCount).ToArray(); } else { wordsPrefix = data; wordsSuffix = null; } var result = new StringBuilder(); if (wordsPrefix.Length != 0) result.Append(string.Join(":", wordsPrefix.Select(x => x.ToString("x")))); if (wordsSuffix != null) result .Append("::") .Append(string.Join(":", wordsSuffix.Select(x => x.ToString("x")))); return result.ToString(); } } } ================================================ FILE: Telegram.Api/Transport/TCPTransport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define TCP_OBFUSCATED_2 using System; using System.Globalization; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; using Action = System.Action; using SocketError = System.Net.Sockets.SocketError; namespace Telegram.Api.Transport { public class TcpTransport : TcpTransportBase { private readonly object _isConnectedSocketRoot = new object(); private readonly object _encryptedStreamSyncRoot = new object(); private readonly Socket _socket; private const int BufferSize = 64; private readonly byte[] _buffer; private readonly SocketAsyncEventArgs _listener = new SocketAsyncEventArgs(); private readonly IPAddress _address; public TcpTransport(string host, int port, string staticHost, int staticPort, MTProtoTransportType mtProtoType, TLProxyConfigBase proxyConfig) : base(host, port, staticHost, staticPort, mtProtoType, proxyConfig) { // ipv6 support _address = proxyConfig != null && !proxyConfig.IsEmpty ? IPAddress.Parse(staticHost) : IPAddress.Parse(host); _socket = new Socket(_address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); _buffer = new byte[BufferSize]; _listener.SetBuffer(_buffer, 0, _buffer.Length); _listener.Completed += OnReceived; } public override string GetTransportInfo() { var info = new StringBuilder(); info.AppendLine("TCP transport"); info.AppendLine(string.Format("Socket {0}:{1}, Connected={2}, Ttl={3}, HashCode={4}", Host, Port, _socket.Connected, _socket.Ttl, _socket.GetHashCode())); info.AppendLine(string.Format("Listener LastOperation={0}, SocketError={1}, RemoteEndPoint={2}, SocketHash={3}", _listener.LastOperation, _listener.SocketError, _listener.RemoteEndPoint, _listener.ConnectSocket != null ? _listener.ConnectSocket.GetHashCode().ToString() : "null")); info.AppendLine(string.Format("FirstReceiveTime={0}", FirstReceiveTime.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); info.AppendLine(string.Format("FirstSendTime={0}", FirstSendTime.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); info.AppendLine(string.Format("LastSendTime={0}", LastSendTime.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); return info.ToString(); } public override void SendPacketAsync(string caption, byte[] data, Action callback, Action faultCallback = null) { var now = DateTime.Now; if (!FirstSendTime.HasValue) { FirstSendTime = now; } LastSendTime = now; Execute.BeginOnThreadPool(() => { TLUtils.WriteLine(" TCP: Send " + caption); lock (_isConnectedSocketRoot) { var manualResetEvent = new ManualResetEvent(false); if (!_socket.Connected) { if (caption.StartsWith("msgs_ack")) { TLUtils.WriteLine("!!!!!!MSGS_ACK FAULT!!!!!!!", LogSeverity.Error); faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Send, new Exception("MSGS_ACK_FAULT"))); return; } ConnectAsync(() => { manualResetEvent.Set(); try { lock (_encryptedStreamSyncRoot) { var args = CreateArgs(data, callback); _socket.SendAsync(args); } } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Send, ex)); WRITE_LOG("Socket.ConnectAsync SendAsync[1]", ex); } }, error => { manualResetEvent.Set(); faultCallback.SafeInvoke(error); }); var connected = manualResetEvent.WaitOne(25000); if (!connected) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Connect, new Exception("Connect timeout exception 25s"))); } } else { try { lock (_encryptedStreamSyncRoot) { var args = CreateArgs(data, callback); _socket.SendAsync(args); } } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Send, ex)); WRITE_LOG("Socket.SendAsync[1]", ex); } } } }); } private SocketAsyncEventArgs CreateArgs(byte[] data, Action callback = null) { var packet = CreatePacket(data); #if TCP_OBFUSCATED_2 packet = Encrypt(packet); #endif var args = new SocketAsyncEventArgs(); args.SetBuffer(packet, 0, packet.Length); args.Completed += (sender, eventArgs) => { callback.SafeInvoke(eventArgs.SocketError == SocketError.Success); }; return args; } private void ConnectAsync(Action callback, Action faultCallback) { WRITE_LOG(string.Format("Socket.ConnectAsync[#3] {0} ({1}:{2})", Id, Host, Port)); TLSocks5Proxy socks5Proxy = ProxyConfig != null && ProxyConfig.IsEnabled.Value && !ProxyConfig.IsEmpty ? ProxyConfig.GetProxy() as TLSocks5Proxy : null; if (socks5Proxy != null) { try { ActualHost = StaticHost; ActualPort = StaticPort; RaiseConnectingAsync(); SocksProxy.ConnectToSocks5Proxy(_socket, socks5Proxy.Server.ToString(), (ushort)socks5Proxy.Port.Value, StaticHost, (ushort)StaticPort, socks5Proxy.Username.ToString(), socks5Proxy.Password.ToString()); OnConnected(new SocketAsyncEventArgs { SocketError = SocketError.Success }, callback, faultCallback); } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Connect, ex)); WRITE_LOG("Socket.ConnectAsync[#3]", ex); } } else { System.Diagnostics.Debug.WriteLine(" Connecting mtproto=[server={0} port={1}]", Host, Port); var args = new SocketAsyncEventArgs { RemoteEndPoint = new IPEndPoint(_address, Port) }; args.Completed += (o, e) => OnConnected(e, callback, faultCallback); try { ActualHost = Host; ActualPort = Port; RaiseConnectingAsync(); _socket.ConnectAsync(args); } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Connect, ex)); WRITE_LOG("Socket.ConnectAsync[#3]", ex); } } } #if TCP_OBFUSCATED_2 protected override byte[] GetInitBuffer() { var buffer = new byte[64]; var random = new Random(); while (true) { random.NextBytes(buffer); var val = (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | (buffer[0]); var val2 = (buffer[7] << 24) | (buffer[6] << 16) | (buffer[5] << 8) | (buffer[4]); if (buffer[0] != 0xef && val != 0x44414548 && val != 0x54534f50 && val != 0x20544547 && val != 0x4954504f && val != 0xeeeeeeee && val2 != 0x00000000) { buffer[56] = buffer[57] = buffer[58] = buffer[59] = 0xef; break; } } var keyIvEncrypt = buffer.SubArray(8, 48); EncryptKey = keyIvEncrypt.SubArray(0, 32); EncryptIV = keyIvEncrypt.SubArray(32, 16); Array.Reverse(keyIvEncrypt); DecryptKey = keyIvEncrypt.SubArray(0, 32); DecryptIV = keyIvEncrypt.SubArray(32, 16); var encryptedBuffer = Encrypt(buffer); for (var i = 56; i < encryptedBuffer.Length; i++) { buffer[i] = encryptedBuffer[i]; } return buffer; } #endif private void OnConnected(SocketAsyncEventArgs args, Action callback = null, Action faultCallback = null) { WRITE_LOG(string.Format("Socket.OnConnected[#4] {0} socketError={1}", Id, args.SocketError)); try { if (args.SocketError != SocketError.Success) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Connect, args.SocketError)); } else { RaiseConnectedAsync(); ReceiveAsync(); try { lock (_encryptedStreamSyncRoot) { var buffer = GetInitBuffer(); var sendArgs = new SocketAsyncEventArgs(); sendArgs.SetBuffer(buffer, 0, buffer.Length); sendArgs.Completed += (o, e) => callback.SafeInvoke(); _socket.SendAsync(sendArgs); } } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Send, ex)); WRITE_LOG("Socket.OnConnected[#4]", ex); } } } catch (Exception ex) { faultCallback.SafeInvoke(new TcpTransportResult(SocketAsyncOperation.Connect, ex)); WRITE_LOG("Socket.OnConnected[#4] SendAsync", ex); } } private void ReceiveAsync() { if (Closed) { //Execute.ShowDebugMessage("TCPTransport ReceiveAsync closed=true"); return; } try { if (_socket != null) { if (_socket.Connected) { try { _socket.ReceiveAsync(_listener); } catch (Exception ex) { WRITE_LOG("Socket.ReceiveAsync[#5] ReceiveAsync", ex); if (ex is ObjectDisposedException) { return; } } } else { //Execute.ShowDebugMessage("TCPTransport ReceiveAsync socket.Connected=false"); //throw new Exception("Socket is not connected"); } } else { throw new NullReferenceException("Socket is null"); } } catch (Exception ex) { WRITE_LOG("Socket.ReceiveAsync[#5]", ex); } } private void OnReceived(object sender, SocketAsyncEventArgs e) { var socket = sender as Socket; if (socket == null || socket != _socket) { return; } if (e.SocketError != SocketError.Success) { //Log.Write(string.Format(" TCPTransport.OnReceived transport={0} error={1}", Id, e.SocketError)); Execute.ShowDebugMessage(string.Format("!!!TCPTransport OnReceived connection lost; BytesTransferred={0} SocketError={1}", e.BytesTransferred, e.SocketError)); ReceiveAsync(); return; } if (e.BytesTransferred > 0) { //Log.Write(string.Format(" TCPTransport.OnReceived transport={0} bytes_transferred={1}", Id, e.BytesTransferred)); var now = DateTime.Now; if (!FirstReceiveTime.HasValue) { FirstReceiveTime = now; } LastReceiveTime = now; // AES-CTR decrypt #if TCP_OBFUSCATED_2 var buffer = e.Buffer.SubArray(e.Offset, e.BytesTransferred); buffer = Decrypt(buffer); OnBufferReceived(buffer, 0, buffer.Length); #else OnBufferReceived(e.Buffer, e.Offset, e.BytesTransferred); #endif } else { Closed = true; RaiseConnectionLost(); //Log.Write(" TCPTransport.Recconect reason=BytesTransferred=0 transport=" + Id); //Execute.ShowDebugMessage(string.Format("TCPTransport id={0} dc_id={1} hash={2} OnReceived connection lost bytesTransferred=0; close transport; error={3}", Id, DCId, GetHashCode(), e.SocketError)); } ReceiveAsync(); } public override void Close() { WRITE_LOG(string.Format("Close socket {2} {0}:{1}", Host, Port, Id)); if (_socket != null) { _socket.Close(); Closed = true; } StopCheckConfigTimer(); } public DateTime? LastSendTime { get; protected set; } } } ================================================ FILE: Telegram.Api/Transport/TCPTransportBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define TCP_OBFUSCATED_2 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.Services; using Telegram.Api.TL; using TransportType = Telegram.Api.Services.TransportType; namespace Telegram.Api.Transport { public abstract class TcpTransportBase : ITransport { public virtual ulong Ping { get { return 0; } } public MTProtoTransportType MTProtoType { get; protected set; } public long MinMessageId { get; set; } public Dictionary MessageIdDict { get; set; } public string Host { get; protected set; } public int Port { get; protected set; } public string StaticHost { get; protected set; } public int StaticPort { get; protected set; } public string ActualHost { get; protected set; } public int ActualPort { get; protected set; } public TLProxyConfigBase ProxyConfig { get; protected set; } public virtual TransportType Type { get { return TransportType.Tcp; } } private readonly Timer _timer; protected TcpTransportBase(string host, int port, string staticHost, int staticPort, MTProtoTransportType mtProtoType, TLProxyConfigBase proxyConfig) { MessageIdDict = new Dictionary(); Host = host; Port = port; StaticHost = staticHost; StaticPort = staticPort; MTProtoType = mtProtoType; ProxyConfig = proxyConfig; var random = new Random(); Id = random.Next(0, 255); _timer = new Timer(OnTimerTick, _timer, Timeout.Infinite, Timeout.Infinite); } #region Check Config public event EventHandler CheckConfig; protected virtual void RaiseCheckConfig() { Execute.BeginOnThreadPool(() => { var handler = CheckConfig; if (handler != null) handler(this, EventArgs.Empty); }); } private void OnTimerTick(object state) { _timer.Change(Timeout.Infinite, Timeout.Infinite); RaiseCheckConfig(); } protected void StartCheckConfigTimer() { if (MTProtoType != MTProtoTransportType.Main) return; _timer.Change(TimeSpan.FromSeconds(Constants.CheckConfigTimeout), Timeout.InfiniteTimeSpan); } protected void StopCheckConfigTimer() { _timer.Change(Timeout.Infinite, Timeout.Infinite); } #endregion public bool Initiated { get; set; } public bool Initialized { get; set; } public bool IsInitializing { get; set; } public bool IsAuthorized { get; set; } public bool IsAuthorizing { get; set; } public bool Closed { get; protected set; } private readonly object _syncRoot = new object(); public object SyncRoot { get { return _syncRoot; } } public int Id { get; protected set; } public int DCId { get; set; } public byte[] Secret { get; set; } public byte[] AuthKey { get; set; } public TLLong SessionId { get; set; } public TLLong Salt { get; set; } private int _sequenceNumber; public int SequenceNumber { get { return _sequenceNumber; } set { _sequenceNumber = value; } } private long _clientTicksDelta; public long ClientTicksDelta { get { return _clientTicksDelta; } set { _clientTicksDelta = value; } } private bool _once; public void UpdateTicksDelta(TLLong msgId) { if (_once) return; // to avoid lock lock (SyncRoot) { if (_once) return; _once = true; var clientTime = GenerateMessageId().Value; var serverTime = msgId.Value; ClientTicksDelta += serverTime - clientTime; } //Execute.ShowDebugMessage("ITransport.UpdateTicksDelta dc_id=" + DCId); } public abstract void SendPacketAsync(string caption, byte[] data, Action callback, Action faultCallback = null); public abstract void Close(); public int PacketLength { get { return _packetLength; } } private int _lastPacketLength; public int LastPacketLength { get { return _lastPacketLength; } } public WindowsPhone.Tuple GetCurrentPacketInfo() { return new WindowsPhone.Tuple(_packetLengthBytesRead, _packetLength, _bytesReceived); } public abstract string GetTransportInfo(); public DateTime? FirstSendTime { get; protected set; } public DateTime? FirstReceiveTime { get; protected set; } public DateTime? LastReceiveTime { get; protected set; } protected static byte[] CreatePacket(byte[] buffer) { const int maxShortLength = 0x7E; var shortLength = buffer.Length / 4; var length = (shortLength > maxShortLength) ? 4 + buffer.Length : 1 + buffer.Length; var bytes = new byte[length]; if (shortLength > maxShortLength) { bytes[0] = 0x7F; var shortLengthBytes = BitConverter.GetBytes(shortLength); Array.Copy(shortLengthBytes, 0, bytes, 1, 3); Array.Copy(buffer, 0, bytes, 4, buffer.Length); } else { bytes[0] = (byte)shortLength; Array.Copy(buffer, 0, bytes, 1, buffer.Length); } return bytes; } protected static int GetPacketLength(byte[] bytes, int position, out int bytesRead) { if (bytes.Length <= position) { if (bytes.Length != 0 && position != 0) { Execute.ShowDebugMessage("TCPTransport.0x7F l<=p p=" + position + " l=" + bytes.Length); } bytesRead = 0; return 0; } int shortLength; if (bytes[position] == 0x7F) { if (bytes.Length < (position + 1 + 3)) { Execute.ShowDebugMessage("TCPTransport.0x7F error p=" + position + " l=" + bytes.Length); } var lengthBytes = bytes.SubArray(1 + position, 3); shortLength = BitConverter.ToInt32(TLUtils.Combine(lengthBytes, new byte[] { 0x00 }), 0); bytesRead = 4; } else { //Execute.ShowDebugMessage("TCPTransport.!=0x7F " + position); shortLength = bytes[position]; bytesRead = 1; } return shortLength * 4; } protected virtual byte[] GetInitBuffer() { var buffer = new byte[64]; var random = new Random(); while (true) { random.NextBytes(buffer); var val = (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | (buffer[0]); var val2 = (buffer[7] << 24) | (buffer[6] << 16) | (buffer[5] << 8) | (buffer[4]); if (buffer[0] != 0xef && val != 0x44414548 && val != 0x54534f50 && val != 0x20544547 && val != 0x4954504f && val != 0xeeeeeeee && val2 != 0x00000000) { buffer[56] = buffer[57] = buffer[58] = buffer[59] = 0xef; break; } } return buffer; } private int _bytesReceived; private int _packetLength = 0; private byte[] _previousTail = new byte[0]; private bool _usePreviousTail; private int _packetLengthBytesRead = 0; readonly MemoryStream _stream = new MemoryStream(32 * 1024); protected void OnBufferReceived(byte[] buffer, int offset, int bytesTransferred) { if (bytesTransferred > 0) { StopCheckConfigTimer(); _bytesReceived += bytesTransferred; if (_packetLength == 0) { byte[] fullBuffer; if (_usePreviousTail) { _usePreviousTail = false; fullBuffer = TLUtils.Combine(_previousTail, buffer); _previousTail = new byte[0]; } else { fullBuffer = buffer; } _packetLength = GetPacketLength(fullBuffer, offset, out _packetLengthBytesRead); } _stream.Write(buffer, offset, bytesTransferred); if (_bytesReceived >= _packetLength + _packetLengthBytesRead) { var bytes = _stream.ToArray(); var data = bytes.SubArray(_packetLengthBytesRead, _packetLength); _previousTail = new byte[] { }; if (_bytesReceived > _packetLength + _packetLengthBytesRead) { _previousTail = bytes.SubArray(_packetLengthBytesRead + _packetLength, _bytesReceived - (_packetLengthBytesRead + _packetLength)); } _stream.SetLength(0); _stream.Write(_previousTail, 0, _previousTail.Length); _bytesReceived = _previousTail.Length; if (_previousTail.Length > 0) { if (_previousTail.Length >= 4) { _packetLength = GetPacketLength(_previousTail, 0, out _packetLengthBytesRead); if (_packetLength != 0 && _previousTail.Length >= _packetLength + _packetLengthBytesRead) { Execute.ShowDebugMessage("TCPTransport.0x7F forgot package length=" + _packetLength + " tail=" + _previousTail.Length); } } else { _packetLengthBytesRead = 0; _packetLength = 0; _usePreviousTail = true; } } else { _packetLength = GetPacketLength(_previousTail, 0, out _packetLengthBytesRead); } _lastPacketLength = data.Length; if (MinMessageId == 0 && AuthKey != null) { SetMinMessageId(data); } RaisePacketReceived(new DataEventArgs(data, PacketLength, LastReceiveTime)); } } else { Execute.ShowDebugMessage("TCP bytesTransferred=" + bytesTransferred); } } private void SetMinMessageId(byte[] bytes) { try { var position = 0; var encryptedMessage = (TLEncryptedTransportMessage)new TLEncryptedTransportMessage().FromBytes(bytes, ref position); encryptedMessage.Decrypt(AuthKey); position = 0; TLTransportMessage transportMessage; transportMessage = TLObject.GetObject(encryptedMessage.Data, ref position); MinMessageId = transportMessage.MessageId.Value; System.Diagnostics.Debug.WriteLine("TCPTransport set min message_id={0} seq_no={1}", transportMessage.MessageId, transportMessage.SeqNo); } catch (Exception ex) { Execute.ShowDebugMessage("SetMessageId exception " + ex); } } #region MessageId private static readonly object _messageIdRoot = new object(); public static long PreviousMessageId; public TLLong GenerateMessageId(bool checkPreviousMessageId = false) { long correctUnixTime; lock (_messageIdRoot) { var clientDelta = ClientTicksDelta; // serverTime = clientTime + clientDelta var now = DateTime.Now; //var unixTime = (long)Utils.DateTimeToUnixTimestamp(now) << 32; var unixTime = (long)(Utils.DateTimeToUnixTimestamp(now) * 4294967296) + clientDelta; //2^32 var addingTicks = 4 - (unixTime % 4); if ((unixTime % 4) == 0) { correctUnixTime = unixTime; } else { correctUnixTime = unixTime + addingTicks; } // check with previous messageId if (PreviousMessageId != 0 && checkPreviousMessageId) { correctUnixTime = Math.Max(PreviousMessageId + 4, correctUnixTime); } PreviousMessageId = correctUnixTime; } if (correctUnixTime == 0) throw new Exception("Bad message id"); return new TLLong(correctUnixTime); } #endregion #region NonEncryptedHistory private readonly object _nonEncryptedHistoryRoot = new object(); private readonly Dictionary _nonEncryptedHistory = new Dictionary(); public void EnqueueNonEncryptedItem(HistoryItem item) { lock (_nonEncryptedHistoryRoot) { _nonEncryptedHistory[item.Hash] = item; } #if LOG_REGISTRATION var info = new StringBuilder(); info.AppendLine(String.Format("Socket.EnqueueNonEncryptedItem {0} item {1} hash={2}", Id, item.Caption, item.Hash)); info.AppendLine("Items: " + _nonEncryptedHistory.Count); foreach (var historyItem in _nonEncryptedHistory.Values) { info.AppendLine(historyItem.Caption + " " + historyItem.Hash); } TLUtils.WriteLog(info.ToString()); #endif } public IList RemoveTimeOutRequests(double timeout = Constants.TimeoutInterval) { var now = DateTime.Now; var timedOutKeys = new List(); var timedOutValues = new List(); lock (_nonEncryptedHistoryRoot) { foreach (var historyKeyValue in _nonEncryptedHistory) { var historyValue = historyKeyValue.Value; if (historyValue.SendTime != default(DateTime) && historyValue.SendTime.AddSeconds(timeout) < now) { timedOutKeys.Add(historyKeyValue.Key); timedOutValues.Add(historyKeyValue.Value); } } if (timedOutKeys.Count > 0) { #if LOG_REGISTRATION var info = new StringBuilder(); info.AppendLine(String.Format("Socket.RemoveTimeOutRequests {0}", Id)); info.AppendLine("Items before: " + _nonEncryptedHistory.Count); foreach (var historyItem in _nonEncryptedHistory.Values) { info.AppendLine(historyItem.Caption + " " + historyItem.Hash); } #endif foreach (var key in timedOutKeys) { _nonEncryptedHistory.Remove(key); } #if LOG_REGISTRATION info.AppendLine("Items after: " + _nonEncryptedHistory.Count); foreach (var historyItem in _nonEncryptedHistory.Values) { info.AppendLine(historyItem.Caption + " " + historyItem.Hash); } TLUtils.WriteLog(info.ToString()); #endif } } return timedOutValues; } public HistoryItem DequeueFirstNonEncryptedItem() { HistoryItem item; lock (_nonEncryptedHistoryRoot) { item = _nonEncryptedHistory.Values.FirstOrDefault(); if (item != null) { _nonEncryptedHistory.Remove(item.Hash); } } return item; } public bool RemoveNonEncryptedItem(HistoryItem item) { bool result; lock (_nonEncryptedHistoryRoot) { #if LOG_REGISTRATION var info = new StringBuilder(); info.AppendLine(String.Format("Socket.RemoveNonEncryptedItem {0} item {1} hash={2}", Id, item.Caption, item.Hash)); info.AppendLine("Items before: " + _nonEncryptedHistory.Count); foreach (var historyItem in _nonEncryptedHistory.Values) { info.AppendLine(historyItem.Caption + " " + historyItem.Hash); } #endif result = _nonEncryptedHistory.Remove(item.Hash); #if LOG_REGISTRATION info.AppendLine("Items after: " + _nonEncryptedHistory.Count); foreach (var historyItem in _nonEncryptedHistory.Values) { info.AppendLine(historyItem.Caption + " " + historyItem.Hash); } TLUtils.WriteLog(info.ToString()); #endif } return result; } public void ClearNonEncryptedHistory(Exception e = null) { lock (_nonEncryptedHistoryRoot) { var error = new StringBuilder(); error.Append(String.Format("Socket.ClearNonEncryptedHistory {0} count={1}", Id, _nonEncryptedHistory.Count)); if (e != null) { error.AppendLine(e.ToString()); } #if LOG_REGISTRATION TLUtils.WriteLog(error.ToString()); #endif foreach (var historyItem in _nonEncryptedHistory) { #if LOG_REGISTRATION TLUtils.WriteLog(String.Format("Socket.ClearNonEncryptedHistory {0} item {1}", Id, historyItem.Value.Caption)); #endif historyItem.Value.FaultCallback.SafeInvoke(new TLRPCError { Code = new TLInt(404), Message = new TLString(error.ToString()) }); } _nonEncryptedHistory.Clear(); } } public string PrintNonEncryptedHistory() { var sb = new StringBuilder(); lock (_nonEncryptedHistoryRoot) { sb.AppendLine("NonEncryptedHistory items:"); foreach (var historyItem in _nonEncryptedHistory.Values) { sb.AppendLine(historyItem.Caption + " msgId " + historyItem.Hash); } } return sb.ToString(); } #endregion #region Events public event EventHandler PacketReceived; protected virtual void RaisePacketReceived(DataEventArgs args) { var handler = PacketReceived; if (handler != null) { Execute.BeginOnThreadPool(() => { handler(this, args); }); } } public event EventHandler Connecting; private bool _connectingRaised; protected virtual void RaiseConnectingAsync() { if (_connectingRaised) return; _connectingRaised = true; StartCheckConfigTimer(); var handler = Connecting; if (handler != null) { Execute.BeginOnThreadPool(() => handler(this, EventArgs.Empty)); } } public event EventHandler Connected; protected virtual void RaiseConnectedAsync() { var handler = Connected; if (handler != null) { Execute.BeginOnThreadPool(() => handler(this, EventArgs.Empty)); } } public event EventHandler ConnectionLost; protected virtual void RaiseConnectionLost() { var handler = ConnectionLost; if (handler != null) { Execute.BeginOnThreadPool(() => handler(this, EventArgs.Empty)); } } #endregion public override string ToString() { return String.Format("Id={0} {1}) {2}:{3} (AuthKey {4})\n Salt {5}\n SessionId {6} TicksDelta {7}", Id, DCId, Host, Port, AuthKey != null, Salt, SessionId, ClientTicksDelta); } protected virtual void WRITE_LOG(string str) { #if LOG_REGISTRATION TLUtils.WriteLog(str); #endif } protected virtual void WRITE_LOG(string str, Exception ex) { var type = ex != null ? ex.GetType().Name : "null"; WRITE_LOG(String.Format("{0} {1} {2}={3}", str, Id, type, ex)); } #if TCP_OBFUSCATED_2 protected byte[] EncryptKey; protected byte[] EncryptIV; protected byte[] DecryptKey; protected byte[] DecryptIV; private byte[] EncryptCountBuf; private uint EncryptNum; public byte[] Encrypt(byte[] data) { if (EncryptCountBuf == null) { EncryptCountBuf = new byte[16]; EncryptNum = 0; } return Utils.AES_ctr128_encrypt(data, EncryptKey, ref EncryptIV, ref EncryptCountBuf, ref EncryptNum); } private byte[] DecryptCountBuf; private uint DecryptNum; public byte[] Decrypt(byte[] data) { if (DecryptCountBuf == null) { DecryptCountBuf = new byte[16]; DecryptNum = 0; } return Utils.AES_ctr128_encrypt(data, DecryptKey, ref DecryptIV, ref DecryptCountBuf, ref DecryptNum); } #endif } } ================================================ FILE: Telegram.Api/Transport/TCPTransportResult.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; #if WINDOWS_PHONE using System.Net.Sockets; using SocketError = System.Net.Sockets.SocketError; #endif using System.Text; namespace Telegram.Api.Transport { public class TcpTransportResult { #if WINDOWS_PHONE public SocketError Error { get; set; } public SocketAsyncOperation Operation { get; set; } #endif public Exception Exception { get; set; } public TcpTransportResult(Exception exception) { Exception = exception; } #if WINDOWS_PHONE public TcpTransportResult(SocketAsyncOperation operation, SocketError error) { Operation = operation; Error = error; } public TcpTransportResult(SocketAsyncOperation operation, Exception exception) { Operation = operation; Exception = exception; } #endif public override string ToString() { var sb = new StringBuilder(); #if WINDOWS_PHONE sb.AppendLine("Operation=" + Operation); sb.AppendLine("Error=" + Error); #endif sb.AppendLine("Exception=" + Exception); return sb.ToString(); } } } ================================================ FILE: Telegram.Api/Transport/TransportService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define NATIVE using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using Telegram.Api.Services; using Telegram.Api.TL; namespace Telegram.Api.Transport { public class TransportService : ITransportService { public TransportService() { } private readonly object _proxyConfigSyncRoot = new object(); private TLProxyConfigBase _proxyConfig; public TLProxyConfigBase GetProxyConfig() { if (_proxyConfig != null) { return _proxyConfig; } _proxyConfig = TLUtils.OpenObjectFromMTProtoFile(_proxyConfigSyncRoot, Constants.ProxyConfigFileName) ?? TLProxyConfigBase.Empty; _proxyConfig = _proxyConfig.ToLastProxyConfig(); return _proxyConfig; } public void SetProxyConfig(TLProxyConfigBase proxyConfig) { _proxyConfig = proxyConfig; TLUtils.SaveObjectToMTProtoFile(_proxyConfigSyncRoot, Constants.ProxyConfigFileName, _proxyConfig); } private readonly Dictionary _cache = new Dictionary(); private readonly Dictionary _fileCache = new Dictionary(); private readonly Dictionary _specialCache = new Dictionary(); public ITransport GetFileTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated) { var key = string.Format("{0} {1} {2} {3}", host, port, protocolDCId, type); if (_fileCache.ContainsKey(key)) { isCreated = false; return _fileCache[key]; } #if WINDOWS_PHONE if (type == TransportType.Http) { var transport = new HttpTransport(host, MTProtoTransportType.File, GetProxyConfig()); _fileCache.Add(key, transport); isCreated = true; return transport; //transport.SetAddress(host, port, () => callback(transport)); } else #endif { var transport = #if WIN_RT new TcpTransportWinRT(host, port, staticHost, staticPort, MTProtoTransportType.File, GetProxyConfig()); #elif NATIVE new NativeTcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.File, protocolDCId, protocolSecret, GetProxyConfig()); #else new TcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.File, GetProxyConfig()); #endif transport.ConnectionLost += OnConnectionLost; TLUtils.WritePerformance(string.Format(" TCP: New file transport {0}:{1}", host, port)); _fileCache.Add(key, transport); isCreated = true; Debug.WriteLine(" TCP: New transport {0}:{1}", host, port); return transport; //trasport.SetAddress(host, port, () => callback(trasport)); } } private readonly Dictionary _fileCache2 = new Dictionary(); public ITransport GetFileTransport2(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated) { var key = string.Format("{0} {1} {2} {3}", host, port, protocolDCId, type); if (_fileCache2.ContainsKey(key)) { isCreated = false; return _fileCache2[key]; } #if WINDOWS_PHONE if (type == TransportType.Http) { var transport = new HttpTransport(host, MTProtoTransportType.File, GetProxyConfig()); _fileCache2.Add(key, transport); isCreated = true; return transport; //transport.SetAddress(host, port, () => callback(transport)); } else #endif { var transport = #if WIN_RT new TcpTransportWinRT(host, port, staticHost, staticPort, MTProtoTransportType.File, GetProxyConfig()); #elif NATIVE new NativeTcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.File, protocolDCId, protocolSecret, GetProxyConfig()); #else new TcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.File, GetProxyConfig()); #endif transport.ConnectionLost += OnConnectionLost; TLUtils.WritePerformance(string.Format(" TCP: New file transport 2 {0}:{1}", host, port)); _fileCache2.Add(key, transport); isCreated = true; Debug.WriteLine(" TCP: New transport {0}:{1}", host, port); return transport; //trasport.SetAddress(host, port, () => callback(trasport)); } } public ITransport GetTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated) { var key = string.Format("{0} {1} {2} {3}", host, port, protocolDCId, type); if (_cache.ContainsKey(key)) { isCreated = false; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Old transport {2} {0}:{1}", host, port, _cache[key].Id)); #endif return _cache[key]; } #if WINDOWS_PHONE if (type == TransportType.Http) { var transport = new HttpTransport(host, MTProtoTransportType.Main, GetProxyConfig()); _cache.Add(key, transport); isCreated = true; return transport; //transport.SetAddress(host, port, () => callback(transport)); } else #endif { var transport = #if WIN_RT new TcpTransportWinRT(host, port, staticHost, staticPort, MTProtoTransportType.Main, GetProxyConfig()); #elif NATIVE new NativeTcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Main, protocolDCId, protocolSecret, GetProxyConfig()); #else new TcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Main, GetProxyConfig()); #endif transport.Connecting += OnConnecting; transport.Connected += OnConnected; transport.ConnectionLost += OnConnectionLost; transport.CheckConfig += OnCheckConfig; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("New transport {2} {0}:{1}", host, port, transport.Id)); #endif TLUtils.WritePerformance(string.Format(" TCP: New transport {0}:{1}", host, port)); _cache.Add(key, transport); isCreated = true; Debug.WriteLine(" TCP: New transport {0}:{1}", host, port); return transport; //trasport.SetAddress(host, port, () => callback(trasport)); } } public ITransport GetSpecialTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, out bool isCreated) { var random = TLLong.Random(); // Important! To ping multiple connections to one proxy, will be closed after first ping otherwise var proxyConfig = GetProxyConfig(); var proxy = proxyConfig != null ? proxyConfig.GetProxy() : null; var key = string.Format("{0} {1} {2} {3} {4} {5}", host, port, protocolDCId, type, random, proxy != null ? string.Format("{0}:{1}", proxy.Server, proxy.Port) : string.Empty); if (_specialCache.ContainsKey(key)) { isCreated = false; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Old transport {2} {0}:{1}", host, port, _specialCache[key].Id)); #endif return _specialCache[key]; } #if WINDOWS_PHONE if (type == TransportType.Http) { var transport = new HttpTransport(host, MTProtoTransportType.Special, GetProxyConfig()); _specialCache.Add(key, transport); isCreated = true; return transport; //transport.SetAddress(host, port, () => callback(transport)); } else #endif { var transport = #if WIN_RT new TcpTransportWinRT(host, port, staticHost, staticPort, MTProtoTransportType.Special, GetProxyConfig()); #elif NATIVE new NativeTcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Special, protocolDCId, protocolSecret, GetProxyConfig()); #else new TcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Special, GetProxyConfig()); #endif transport.Connecting += OnConnecting; transport.Connected += OnConnected; transport.ConnectionLost += OnConnectionLost; transport.CheckConfig += OnCheckConfig; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("New transport {2} {0}:{1}", host, port, transport.Id)); #endif TLUtils.WritePerformance(string.Format(" TCP: New transport {0}:{1}", host, port)); _specialCache.Add(key, transport); isCreated = true; Debug.WriteLine(" TCP: New transport {0}:{1}", host, port); return transport; //trasport.SetAddress(host, port, () => callback(trasport)); } } public ITransport GetSpecialTransport(string host, int port, string staticHost, int staticPort, TransportType type, short protocolDCId, byte[] protocolSecret, TLProxyBase proxy, out bool isCreated) { var random = TLLong.Random(); // Important! To ping multiple connections to one proxy, will be closed after first ping otherwise var key = string.Format("{0} {1} {2} {3} {4} {5}", host, port, protocolDCId, type, random, proxy != null ? string.Format("{0}:{1}", proxy.Server, proxy.Port) : string.Empty); if (_specialCache.ContainsKey(key)) { isCreated = false; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("Old transport {2} {0}:{1}", host, port, _specialCache[key].Id)); #endif return _specialCache[key]; } #if WINDOWS_PHONE if (type == TransportType.Http) { var transport = new HttpTransport(host, MTProtoTransportType.Special, GetProxyConfig()); _specialCache.Add(key, transport); isCreated = true; return transport; //transport.SetAddress(host, port, () => callback(transport)); } else #endif { var proxyConfig = new TLProxyConfig76 { CustomFlags = new TLLong(0), IsEnabled = TLBool.True, SelectedIndex = new TLInt(0), UseForCalls = TLBool.False, Items = new TLVector { proxy } }; var transport = #if WIN_RT new TcpTransportWinRT(host, port, staticHost, staticPort, MTProtoTransportType.Special, proxyConfig); #elif NATIVE new NativeTcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Special, protocolDCId, protocolSecret, proxyConfig); #else new TcpTransport(host, port, staticHost, staticPort, MTProtoTransportType.Special, proxyConfig); #endif transport.Connecting += OnConnecting; transport.Connected += OnConnected; transport.ConnectionLost += OnConnectionLost; transport.CheckConfig += OnCheckConfig; #if LOG_REGISTRATION TLUtils.WriteLog(string.Format("New transport {2} {0}:{1}", host, port, transport.Id)); #endif TLUtils.WritePerformance(string.Format(" TCP: New transport {0}:{1}", host, port)); _specialCache.Add(key, transport); isCreated = true; Debug.WriteLine(" TCP: New transport {0}:{1}", host, port); return transport; //trasport.SetAddress(host, port, () => callback(trasport)); } } public event EventHandler CheckConfig; protected virtual void RaiseCheckConfig() { var handler = CheckConfig; if (handler != null) handler(this, EventArgs.Empty); } private void OnCheckConfig(object sender, EventArgs e) { var transport = sender as ITransport; if (transport != null && transport.MTProtoType == MTProtoTransportType.Main) { Logs.Log.Write(string.Format("TransportService CheckConfig Transport=[dc_id={0} ip={1} port={2} proxy=[{3}]]", transport.DCId, transport.Host, transport.Port, transport.ProxyConfig)); RaiseCheckConfig(); } } public void Close() { var transports = new List(_cache.Values); foreach (var transport in transports) { transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; transport.Close(); } _cache.Clear(); var fileTransports = new List(_fileCache.Values); foreach (var transport in fileTransports) { transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; transport.Close(); } _fileCache.Clear(); var fileTransports2 = new List(_fileCache2.Values); foreach (var transport in fileTransports2) { transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; transport.Close(); } _fileCache2.Clear(); /*var specialTransports = new List(_specialCache.Values); foreach (var transport in specialTransports) { transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; transport.Close(); } _specialCache.Clear();*/ } public void CloseTransport(ITransport transport) { foreach (var value in _cache.Values.Where(x => string.Equals(x.Host, transport.Host, StringComparison.OrdinalIgnoreCase))) { value.Close(); transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; } _cache.Remove(string.Format("{0} {1} {2}", transport.Host, transport.Port, transport.Type)); foreach (var value in _fileCache.Values.Where(x => string.Equals(x.Host, transport.Host, StringComparison.OrdinalIgnoreCase))) { value.Close(); transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; } _fileCache.Remove(string.Format("{0} {1} {2}", transport.Host, transport.Port, transport.Type)); foreach (var value in _fileCache2.Values.Where(x => string.Equals(x.Host, transport.Host, StringComparison.OrdinalIgnoreCase))) { value.Close(); transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; } _fileCache2.Remove(string.Format("{0} {1} {2}", transport.Host, transport.Port, transport.Type)); } public void CloseSpecialTransport(ITransport transport) { transport.Connecting -= OnConnecting; transport.Connected -= OnConnected; transport.ConnectionLost -= OnConnectionLost; transport.Close(); _specialCache.Remove(GetSpecialTransportKey(transport)); } private static string GetSpecialTransportKey(ITransport transport) { var proxy = transport.ProxyConfig != null ? transport.ProxyConfig.GetProxy() : null; return string.Format("{0} {1} {2} {3}", transport.Host, transport.Port, transport.Type, proxy != null ? string.Format("{0}:{1}", proxy.Server, proxy.Port) : String.Empty); } public event EventHandler TransportConnecting; protected virtual void RaiseTransportConnecting(ITransport transport) { var handler = TransportConnecting; if (handler != null) handler(this, new TransportEventArgs { Transport = transport }); } public void OnConnecting(object sender, EventArgs args) { RaiseTransportConnecting(sender as ITransport); } public event EventHandler TransportConnected; protected virtual void RaiseTransportConnected(ITransport transport) { var handler = TransportConnected; if (handler != null) handler(this, new TransportEventArgs { Transport = transport }); } public void OnConnected(object sender, EventArgs args) { RaiseTransportConnected(sender as ITransport); } public event EventHandler ConnectionLost; protected virtual void RaiseConnectionLost(ITransport transport) { var handler = ConnectionLost; if (handler != null) handler(this, new TransportEventArgs { Transport = transport }); } public event EventHandler FileConnectionLost; protected virtual void RaiseFileConnectionLost(ITransport transport) { var handler = FileConnectionLost; if (handler != null) handler(this, new TransportEventArgs { Transport = transport }); } public event EventHandler SpecialConnectionLost; protected virtual void RaiseSpecialConnectionLost(ITransport transport) { var handler = SpecialConnectionLost; if (handler != null) handler(this, new TransportEventArgs { Transport = transport }); } private void OnConnectionLost(object sender, EventArgs e) { var transport = (ITransport)sender; if (transport.MTProtoType == MTProtoTransportType.File) { RaiseFileConnectionLost(sender as ITransport); } else if (transport.MTProtoType == MTProtoTransportType.Special) { RaiseSpecialConnectionLost(sender as ITransport); } else { RaiseConnectionLost(sender as ITransport); } } } public class TransportEventArgs : EventArgs { public ITransport Transport { get; set; } } } ================================================ FILE: Telegram.Api/WindowsPhone/BigInteger.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; using System.Threading; /* Optimization Have proper popcount function for IsPowerOfTwo Use unsafe ops to avoid bounds check CoreAdd could avoid some resizes by checking for equal sized array that top overflow For bitwise operators, hoist the conditionals out of their main loop Optimize BitScanBackward Use a carry variable to make shift opts do half the number of array ops. Schoolbook multiply is O(n^2), use Karatsuba /Toom-3 for large numbers */ namespace System.Numerics { public struct BigInteger : IComparable, IFormattable, IComparable, IEquatable { //LSB on [0] readonly uint[] data; readonly short sign; static readonly uint[] ZERO = new uint[1]; static readonly uint[] ONE = new uint[1] { 1 }; BigInteger(short sign, uint[] data) { this.sign = sign; this.data = data; } public BigInteger(int value) { if (value == 0) { sign = 0; data = ZERO; } else if (value > 0) { sign = 1; data = new uint[] { (uint)value }; } else { sign = -1; data = new uint[1] { (uint)-value }; } } [CLSCompliantAttribute(false)] public BigInteger(uint value) { if (value == 0) { sign = 0; data = ZERO; } else { sign = 1; data = new uint[1] { value }; } } public BigInteger(long value) { if (value == 0) { sign = 0; data = ZERO; } else if (value > 0) { sign = 1; uint low = (uint)value; uint high = (uint)(value >> 32); data = new uint[high != 0 ? 2 : 1]; data[0] = low; if (high != 0) data[1] = high; } else { sign = -1; value = -value; uint low = (uint)value; uint high = (uint)((ulong)value >> 32); data = new uint[high != 0 ? 2 : 1]; data[0] = low; if (high != 0) data[1] = high; } } [CLSCompliantAttribute(false)] public BigInteger(ulong value) { if (value == 0) { sign = 0; data = ZERO; } else { sign = 1; uint low = (uint)value; uint high = (uint)(value >> 32); data = new uint[high != 0 ? 2 : 1]; data[0] = low; if (high != 0) data[1] = high; } } static bool Negative(byte[] v) { return ((v[7] & 0x80) != 0); } static ushort Exponent(byte[] v) { return (ushort)((((ushort)(v[7] & 0x7F)) << (ushort)4) | (((ushort)(v[6] & 0xF0)) >> 4)); } static ulong Mantissa(byte[] v) { uint i1 = ((uint)v[0] | ((uint)v[1] << 8) | ((uint)v[2] << 16) | ((uint)v[3] << 24)); uint i2 = ((uint)v[4] | ((uint)v[5] << 8) | ((uint)(v[6] & 0xF) << 16)); return (ulong)((ulong)i1 | ((ulong)i2 << 32)); } const int bias = 1075; public BigInteger(double value) { if (double.IsNaN(value) || Double.IsInfinity(value)) throw new OverflowException(); byte[] bytes = BitConverter.GetBytes(value); ulong mantissa = Mantissa(bytes); if (mantissa == 0) { // 1.0 * 2**exp, we have a power of 2 int exponent = Exponent(bytes); if (exponent == 0) { sign = 0; data = ZERO; return; } BigInteger res = Negative(bytes) ? MinusOne : One; res = res << (exponent - 0x3ff); this.sign = res.sign; this.data = res.data; } else { // 1.mantissa * 2**exp int exponent = Exponent(bytes); mantissa |= 0x10000000000000ul; BigInteger res = mantissa; res = exponent > bias ? res << (exponent - bias) : res >> (bias - exponent); this.sign = (short)(Negative(bytes) ? -1 : 1); this.data = res.data; } } public BigInteger(float value) : this((double)value) { } const Int32 DecimalScaleFactorMask = 0x00FF0000; const Int32 DecimalSignMask = unchecked((Int32)0x80000000); public BigInteger(decimal value) { // First truncate to get scale to 0 and extract bits int[] bits = Decimal.GetBits(Decimal.Truncate(value)); int size = 3; while (size > 0 && bits[size - 1] == 0) size--; if (size == 0) { sign = 0; data = ZERO; return; } sign = (short)((bits[3] & DecimalSignMask) != 0 ? -1 : 1); data = new uint[size]; data[0] = (uint)bits[0]; if (size > 1) data[1] = (uint)bits[1]; if (size > 2) data[2] = (uint)bits[2]; } [CLSCompliantAttribute(false)] public BigInteger(byte[] value) { if (value == null) throw new ArgumentNullException("value"); int len = value.Length; if (len == 0 || (len == 1 && value[0] == 0)) { sign = 0; data = ZERO; return; } if ((value[len - 1] & 0x80) != 0) sign = -1; else sign = 1; if (sign == 1) { while (value[len - 1] == 0) { if (--len == 0) { sign = 0; data = ZERO; return; } } int full_words, size; full_words = size = len / 4; if ((len & 0x3) != 0) ++size; data = new uint[size]; int j = 0; for (int i = 0; i < full_words; ++i) { data[i] = (uint)value[j++] | (uint)(value[j++] << 8) | (uint)(value[j++] << 16) | (uint)(value[j++] << 24); } size = len & 0x3; if (size > 0) { int idx = data.Length - 1; for (int i = 0; i < size; ++i) data[idx] |= (uint)(value[j++] << (i * 8)); } } else { int full_words, size; full_words = size = len / 4; if ((len & 0x3) != 0) ++size; data = new uint[size]; uint word, borrow = 1; ulong sub = 0; int j = 0; for (int i = 0; i < full_words; ++i) { word = (uint)value[j++] | (uint)(value[j++] << 8) | (uint)(value[j++] << 16) | (uint)(value[j++] << 24); sub = (ulong)word - borrow; word = (uint)sub; borrow = (uint)(sub >> 32) & 0x1u; data[i] = ~word; } size = len & 0x3; if (size > 0) { word = 0; uint store_mask = 0; for (int i = 0; i < size; ++i) { word |= (uint)(value[j++] << (i * 8)); store_mask = (store_mask << 8) | 0xFF; } sub = word - borrow; word = (uint)sub; borrow = (uint)(sub >> 32) & 0x1u; data[data.Length - 1] = ~word & store_mask; } if (borrow != 0) //FIXME I believe this can't happen, can someone write a test for it? throw new Exception("non zero final carry"); } } public bool IsEven { get { return sign == 0 || (data[0] & 0x1) == 0; } } public bool IsOne { get { return sign == 1 && data.Length == 1 && data[0] == 1; } } //Gem from Hacker's Delight //Returns the number of bits set in @x static int PopulationCount(uint x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0F0F0F0F; x = x + (x >> 8); x = x + (x >> 16); return (int)(x & 0x0000003F); } public bool IsPowerOfTwo { get { bool foundBit = false; if (sign != 1) return false; //This function is pop count == 1 for positive numbers for (int i = 0; i < data.Length; ++i) { int p = PopulationCount(data[i]); if (p > 0) { if (p > 1 || foundBit) return false; foundBit = true; } } return foundBit; } } public bool IsZero { get { return sign == 0; } } public int Sign { get { return sign; } } public static BigInteger MinusOne { get { return new BigInteger(-1, ONE); } } public static BigInteger One { get { return new BigInteger(1, ONE); } } public static BigInteger Zero { get { return new BigInteger(0, ZERO); } } public static explicit operator int(BigInteger value) { if (value.sign == 0) return 0; if (value.data.Length > 1) throw new OverflowException(); uint data = value.data[0]; if (value.sign == 1) { if (data > (uint)int.MaxValue) throw new OverflowException(); return (int)data; } else if (value.sign == -1) { if (data > 0x80000000u) throw new OverflowException(); return -(int)data; } return 0; } [CLSCompliantAttribute(false)] public static explicit operator uint(BigInteger value) { if (value.sign == 0) return 0; if (value.data.Length > 1 || value.sign == -1) throw new OverflowException(); return value.data[0]; } public static explicit operator short(BigInteger value) { int val = (int)value; if (val < short.MinValue || val > short.MaxValue) throw new OverflowException(); return (short)val; } [CLSCompliantAttribute(false)] public static explicit operator ushort(BigInteger value) { uint val = (uint)value; if (val > ushort.MaxValue) throw new OverflowException(); return (ushort)val; } public static explicit operator byte(BigInteger value) { uint val = (uint)value; if (val > byte.MaxValue) throw new OverflowException(); return (byte)val; } [CLSCompliantAttribute(false)] public static explicit operator sbyte(BigInteger value) { int val = (int)value; if (val < sbyte.MinValue || val > sbyte.MaxValue) throw new OverflowException(); return (sbyte)val; } public static explicit operator long(BigInteger value) { if (value.sign == 0) return 0; if (value.data.Length > 2) throw new OverflowException(); uint low = value.data[0]; if (value.data.Length == 1) { if (value.sign == 1) return (long)low; long res = (long)low; return -res; } uint high = value.data[1]; if (value.sign == 1) { if (high >= 0x80000000u) throw new OverflowException(); return (((long)high) << 32) | low; } if (high > 0x80000000u) throw new OverflowException(); return -((((long)high) << 32) | (long)low); } [CLSCompliantAttribute(false)] public static explicit operator ulong(BigInteger value) { if (value.sign == 0) return 0; if (value.data.Length > 2 || value.sign == -1) throw new OverflowException(); uint low = value.data[0]; if (value.data.Length == 1) return low; uint high = value.data[1]; return (((ulong)high) << 32) | low; } public static explicit operator double(BigInteger value) { //FIXME try { return double.Parse(value.ToString(), System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } catch (OverflowException) { return value.sign == -1 ? double.NegativeInfinity : double.PositiveInfinity; } } public static explicit operator float(BigInteger value) { //FIXME try { return float.Parse(value.ToString(), System.Globalization.CultureInfo.InvariantCulture.NumberFormat); } catch (OverflowException) { return value.sign == -1 ? float.NegativeInfinity : float.PositiveInfinity; } } public static explicit operator decimal(BigInteger value) { if (value.sign == 0) return Decimal.Zero; uint[] data = value.data; if (data.Length > 3) throw new OverflowException(); int lo = 0, mi = 0, hi = 0; if (data.Length > 2) hi = (Int32)data[2]; if (data.Length > 1) mi = (Int32)data[1]; if (data.Length > 0) lo = (Int32)data[0]; return new Decimal(lo, mi, hi, value.sign < 0, 0); } public static implicit operator BigInteger(int value) { return new BigInteger(value); } [CLSCompliantAttribute(false)] public static implicit operator BigInteger(uint value) { return new BigInteger(value); } public static implicit operator BigInteger(short value) { return new BigInteger(value); } [CLSCompliantAttribute(false)] public static implicit operator BigInteger(ushort value) { return new BigInteger(value); } public static implicit operator BigInteger(byte value) { return new BigInteger(value); } [CLSCompliantAttribute(false)] public static implicit operator BigInteger(sbyte value) { return new BigInteger(value); } public static implicit operator BigInteger(long value) { return new BigInteger(value); } [CLSCompliantAttribute(false)] public static implicit operator BigInteger(ulong value) { return new BigInteger(value); } public static explicit operator BigInteger(double value) { return new BigInteger(value); } public static explicit operator BigInteger(float value) { return new BigInteger(value); } public static explicit operator BigInteger(decimal value) { return new BigInteger(value); } public static BigInteger operator +(BigInteger left, BigInteger right) { if (left.sign == 0) return right; if (right.sign == 0) return left; if (left.sign == right.sign) return new BigInteger(left.sign, CoreAdd(left.data, right.data)); int r = CoreCompare(left.data, right.data); if (r == 0) return new BigInteger(0, ZERO); if (r > 0) //left > right return new BigInteger(left.sign, CoreSub(left.data, right.data)); return new BigInteger(right.sign, CoreSub(right.data, left.data)); } public static BigInteger operator -(BigInteger left, BigInteger right) { if (right.sign == 0) return left; if (left.sign == 0) return new BigInteger((short)-right.sign, right.data); if (left.sign == right.sign) { int r = CoreCompare(left.data, right.data); if (r == 0) return new BigInteger(0, ZERO); if (r > 0) //left > right return new BigInteger(left.sign, CoreSub(left.data, right.data)); return new BigInteger((short)-right.sign, CoreSub(right.data, left.data)); } return new BigInteger(left.sign, CoreAdd(left.data, right.data)); } public static BigInteger operator *(BigInteger left, BigInteger right) { if (left.sign == 0 || right.sign == 0) return new BigInteger(0, ZERO); if (left.data[0] == 1 && left.data.Length == 1) { if (left.sign == 1) return right; return new BigInteger((short)-right.sign, right.data); } if (right.data[0] == 1 && right.data.Length == 1) { if (right.sign == 1) return left; return new BigInteger((short)-left.sign, left.data); } uint[] a = left.data; uint[] b = right.data; uint[] res = new uint[a.Length + b.Length]; for (int i = 0; i < a.Length; ++i) { uint ai = a[i]; int k = i; ulong carry = 0; for (int j = 0; j < b.Length; ++j) { carry = carry + ((ulong)ai) * b[j] + res[k]; res[k++] = (uint)carry; carry >>= 32; } while (carry != 0) { carry += res[k]; res[k++] = (uint)carry; carry >>= 32; } } int m; for (m = res.Length - 1; m >= 0 && res[m] == 0; --m) ; if (m < res.Length - 1) res = Resize(res, m + 1); return new BigInteger((short)(left.sign * right.sign), res); } public static BigInteger operator /(BigInteger dividend, BigInteger divisor) { if (divisor.sign == 0) throw new DivideByZeroException(); if (dividend.sign == 0) return dividend; uint[] quotient; uint[] remainder_value; DivModUnsigned(dividend.data, divisor.data, out quotient, out remainder_value); int i; for (i = quotient.Length - 1; i >= 0 && quotient[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < quotient.Length - 1) quotient = Resize(quotient, i + 1); return new BigInteger((short)(dividend.sign * divisor.sign), quotient); } public static BigInteger operator %(BigInteger dividend, BigInteger divisor) { if (divisor.sign == 0) throw new DivideByZeroException(); if (dividend.sign == 0) return dividend; uint[] quotient; uint[] remainder_value; DivModUnsigned(dividend.data, divisor.data, out quotient, out remainder_value); int i; for (i = remainder_value.Length - 1; i >= 0 && remainder_value[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < remainder_value.Length - 1) remainder_value = Resize(remainder_value, i + 1); return new BigInteger(dividend.sign, remainder_value); } public static BigInteger operator -(BigInteger value) { if (value.sign == 0) return value; return new BigInteger((short)-value.sign, value.data); } public static BigInteger operator +(BigInteger value) { return value; } public static BigInteger operator ++(BigInteger value) { if (value.sign == 0) return One; short sign = value.sign; uint[] data = value.data; if (data.Length == 1) { if (sign == -1 && data[0] == 1) return new BigInteger(0, ZERO); if (sign == 0) return new BigInteger(1, ONE); } if (sign == -1) data = CoreSub(data, 1); else data = CoreAdd(data, 1); return new BigInteger(sign, data); } public static BigInteger operator --(BigInteger value) { if (value.sign == 0) return MinusOne; short sign = value.sign; uint[] data = value.data; if (data.Length == 1) { if (sign == 1 && data[0] == 1) return new BigInteger(0, ZERO); if (sign == 0) return new BigInteger(-1, ONE); } if (sign == -1) data = CoreAdd(data, 1); else data = CoreSub(data, 1); return new BigInteger(sign, data); } public static BigInteger operator &(BigInteger left, BigInteger right) { if (left.sign == 0) return left; if (right.sign == 0) return right; uint[] a = left.data; uint[] b = right.data; int ls = left.sign; int rs = right.sign; bool neg_res = (ls == rs) && (ls == -1); uint[] result = new uint[Math.Max(a.Length, b.Length)]; ulong ac = 1, bc = 1, borrow = 1; int i; for (i = 0; i < result.Length; ++i) { uint va = 0; if (i < a.Length) va = a[i]; if (ls == -1) { ac = ~va + ac; va = (uint)ac; ac = (uint)(ac >> 32); } uint vb = 0; if (i < b.Length) vb = b[i]; if (rs == -1) { bc = ~vb + bc; vb = (uint)bc; bc = (uint)(bc >> 32); } uint word = va & vb; if (neg_res) { borrow = word - borrow; word = ~(uint)borrow; borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; } for (i = result.Length - 1; i >= 0 && result[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < result.Length - 1) result = Resize(result, i + 1); return new BigInteger(neg_res ? (short)-1 : (short)1, result); } public static BigInteger operator |(BigInteger left, BigInteger right) { if (left.sign == 0) return right; if (right.sign == 0) return left; uint[] a = left.data; uint[] b = right.data; int ls = left.sign; int rs = right.sign; bool neg_res = (ls == -1) || (rs == -1); uint[] result = new uint[Math.Max(a.Length, b.Length)]; ulong ac = 1, bc = 1, borrow = 1; int i; for (i = 0; i < result.Length; ++i) { uint va = 0; if (i < a.Length) va = a[i]; if (ls == -1) { ac = ~va + ac; va = (uint)ac; ac = (uint)(ac >> 32); } uint vb = 0; if (i < b.Length) vb = b[i]; if (rs == -1) { bc = ~vb + bc; vb = (uint)bc; bc = (uint)(bc >> 32); } uint word = va | vb; if (neg_res) { borrow = word - borrow; word = ~(uint)borrow; borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; } for (i = result.Length - 1; i >= 0 && result[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < result.Length - 1) result = Resize(result, i + 1); return new BigInteger(neg_res ? (short)-1 : (short)1, result); } public static BigInteger operator ^(BigInteger left, BigInteger right) { if (left.sign == 0) return right; if (right.sign == 0) return left; uint[] a = left.data; uint[] b = right.data; int ls = left.sign; int rs = right.sign; bool neg_res = (ls == -1) ^ (rs == -1); uint[] result = new uint[Math.Max(a.Length, b.Length)]; ulong ac = 1, bc = 1, borrow = 1; int i; for (i = 0; i < result.Length; ++i) { uint va = 0; if (i < a.Length) va = a[i]; if (ls == -1) { ac = ~va + ac; va = (uint)ac; ac = (uint)(ac >> 32); } uint vb = 0; if (i < b.Length) vb = b[i]; if (rs == -1) { bc = ~vb + bc; vb = (uint)bc; bc = (uint)(bc >> 32); } uint word = va ^ vb; if (neg_res) { borrow = word - borrow; word = ~(uint)borrow; borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; } for (i = result.Length - 1; i >= 0 && result[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < result.Length - 1) result = Resize(result, i + 1); return new BigInteger(neg_res ? (short)-1 : (short)1, result); } public static BigInteger operator ~(BigInteger value) { if (value.sign == 0) return new BigInteger(-1, ONE); uint[] data = value.data; int sign = value.sign; bool neg_res = sign == 1; uint[] result = new uint[data.Length]; ulong carry = 1, borrow = 1; int i; for (i = 0; i < result.Length; ++i) { uint word = data[i]; if (sign == -1) { carry = ~word + carry; word = (uint)carry; carry = (uint)(carry >> 32); } word = ~word; if (neg_res) { borrow = word - borrow; word = ~(uint)borrow; borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; } for (i = result.Length - 1; i >= 0 && result[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < result.Length - 1) result = Resize(result, i + 1); return new BigInteger(neg_res ? (short)-1 : (short)1, result); } //returns the 0-based index of the most significant set bit //returns 0 if no bit is set, so extra care when using it static int BitScanBackward(uint word) { for (int i = 31; i >= 0; --i) { uint mask = 1u << i; if ((word & mask) == mask) return i; } return 0; } public static BigInteger operator <<(BigInteger value, int shift) { if (shift == 0 || value.sign == 0) return value; if (shift < 0) return value >> -shift; uint[] data = value.data; int sign = value.sign; int topMostIdx = BitScanBackward(data[data.Length - 1]); int bits = shift - (31 - topMostIdx); int extra_words = (bits >> 5) + ((bits & 0x1F) != 0 ? 1 : 0); uint[] res = new uint[data.Length + extra_words]; int idx_shift = shift >> 5; int bit_shift = shift & 0x1F; int carry_shift = 32 - bit_shift; if (carry_shift == 32) { for (int i = 0; i < data.Length; ++i) { uint word = data[i]; res[i + idx_shift] |= word << bit_shift; } } else { for (int i = 0; i < data.Length; ++i) { uint word = data[i]; res[i + idx_shift] |= word << bit_shift; if (i + idx_shift + 1 < res.Length) res[i + idx_shift + 1] = word >> carry_shift; } } return new BigInteger((short)sign, res); } public static BigInteger operator >>(BigInteger value, int shift) { if (shift == 0 || value.sign == 0) return value; if (shift < 0) return value << -shift; uint[] data = value.data; int sign = value.sign; int topMostIdx = BitScanBackward(data[data.Length - 1]); int idx_shift = shift >> 5; int bit_shift = shift & 0x1F; int extra_words = idx_shift; if (bit_shift > topMostIdx) ++extra_words; int size = data.Length - extra_words; if (size <= 0) { if (sign == 1) return new BigInteger(0, ZERO); return new BigInteger(-1, ONE); } uint[] res = new uint[size]; int carry_shift = 32 - bit_shift; if (carry_shift == 32) { for (int i = data.Length - 1; i >= idx_shift; --i) { uint word = data[i]; if (i - idx_shift < res.Length) res[i - idx_shift] |= word >> bit_shift; } } else { for (int i = data.Length - 1; i >= idx_shift; --i) { uint word = data[i]; if (i - idx_shift < res.Length) res[i - idx_shift] |= word >> bit_shift; if (i - idx_shift - 1 >= 0) res[i - idx_shift - 1] = word << carry_shift; } } //Round down instead of toward zero if (sign == -1) { for (int i = 0; i < idx_shift; i++) { if (data[i] != 0u) { var tmp = new BigInteger((short)sign, res); --tmp; return tmp; } } if (bit_shift > 0 && (data[idx_shift] << carry_shift) != 0u) { var tmp = new BigInteger((short)sign, res); --tmp; return tmp; } } return new BigInteger((short)sign, res); } public static bool operator <(BigInteger left, BigInteger right) { return Compare(left, right) < 0; } public static bool operator <(BigInteger left, long right) { return left.CompareTo(right) < 0; } public static bool operator <(long left, BigInteger right) { return right.CompareTo(left) > 0; } [CLSCompliantAttribute(false)] public static bool operator <(BigInteger left, ulong right) { return left.CompareTo(right) < 0; } [CLSCompliantAttribute(false)] public static bool operator <(ulong left, BigInteger right) { return right.CompareTo(left) > 0; } public static bool operator <=(BigInteger left, BigInteger right) { return Compare(left, right) <= 0; } public static bool operator <=(BigInteger left, long right) { return left.CompareTo(right) <= 0; } public static bool operator <=(long left, BigInteger right) { return right.CompareTo(left) >= 0; } [CLSCompliantAttribute(false)] public static bool operator <=(BigInteger left, ulong right) { return left.CompareTo(right) <= 0; } [CLSCompliantAttribute(false)] public static bool operator <=(ulong left, BigInteger right) { return right.CompareTo(left) >= 0; } public static bool operator >(BigInteger left, BigInteger right) { return Compare(left, right) > 0; } public static bool operator >(BigInteger left, long right) { return left.CompareTo(right) > 0; } public static bool operator >(long left, BigInteger right) { return right.CompareTo(left) < 0; } [CLSCompliantAttribute(false)] public static bool operator >(BigInteger left, ulong right) { return left.CompareTo(right) > 0; } [CLSCompliantAttribute(false)] public static bool operator >(ulong left, BigInteger right) { return right.CompareTo(left) < 0; } public static bool operator >=(BigInteger left, BigInteger right) { return Compare(left, right) >= 0; } public static bool operator >=(BigInteger left, long right) { return left.CompareTo(right) >= 0; } public static bool operator >=(long left, BigInteger right) { return right.CompareTo(left) <= 0; } [CLSCompliantAttribute(false)] public static bool operator >=(BigInteger left, ulong right) { return left.CompareTo(right) >= 0; } [CLSCompliantAttribute(false)] public static bool operator >=(ulong left, BigInteger right) { return right.CompareTo(left) <= 0; } public static bool operator ==(BigInteger left, BigInteger right) { return Compare(left, right) == 0; } public static bool operator ==(BigInteger left, long right) { return left.CompareTo(right) == 0; } public static bool operator ==(long left, BigInteger right) { return right.CompareTo(left) == 0; } [CLSCompliantAttribute(false)] public static bool operator ==(BigInteger left, ulong right) { return left.CompareTo(right) == 0; } [CLSCompliantAttribute(false)] public static bool operator ==(ulong left, BigInteger right) { return right.CompareTo(left) == 0; } public static bool operator !=(BigInteger left, BigInteger right) { return Compare(left, right) != 0; } public static bool operator !=(BigInteger left, long right) { return left.CompareTo(right) != 0; } public static bool operator !=(long left, BigInteger right) { return right.CompareTo(left) != 0; } [CLSCompliantAttribute(false)] public static bool operator !=(BigInteger left, ulong right) { return left.CompareTo(right) != 0; } [CLSCompliantAttribute(false)] public static bool operator !=(ulong left, BigInteger right) { return right.CompareTo(left) != 0; } public override bool Equals(object obj) { if (!(obj is BigInteger)) return false; return Equals((BigInteger)obj); } public bool Equals(BigInteger other) { if (sign != other.sign) return false; int alen = data != null ? data.Length : 0; int blen = other.data != null ? other.data.Length : 0; if (alen != blen) return false; for (int i = 0; i < alen; ++i) { if (data[i] != other.data[i]) return false; } return true; } public bool Equals(long other) { return CompareTo(other) == 0; } public override string ToString() { return ToString(10, null); } string ToStringWithPadding(string format, uint radix, IFormatProvider provider) { if (format.Length > 1) { int precision = Convert.ToInt32(format.Substring(1), CultureInfo.InvariantCulture.NumberFormat); string baseStr = ToString(radix, provider); if (baseStr.Length < precision) { string additional = new String('0', precision - baseStr.Length); if (baseStr[0] != '-') { return additional + baseStr; } else { return "-" + additional + baseStr.Substring(1); } } return baseStr; } return ToString(radix, provider); } public string ToString(string format) { return ToString(format, null); } public string ToString(IFormatProvider provider) { return ToString(null, provider); } public string ToString(string format, IFormatProvider provider) { if (format == null || format == "") return ToString(10, provider); switch (format[0]) { case 'd': case 'D': case 'g': case 'G': case 'r': case 'R': return ToStringWithPadding(format, 10, provider); case 'x': case 'X': return ToStringWithPadding(format, 16, null); default: throw new FormatException(string.Format("format '{0}' not implemented", format)); } } static uint[] MakeTwoComplement(uint[] v) { uint[] res = new uint[v.Length]; ulong carry = 1; for (int i = 0; i < v.Length; ++i) { uint word = v[i]; carry = (ulong)~word + carry; word = (uint)carry; carry = (uint)(carry >> 32); res[i] = word; } uint last = res[res.Length - 1]; int idx = FirstNonFFByte(last); uint mask = 0xFF; for (int i = 1; i < idx; ++i) mask = (mask << 8) | 0xFF; res[res.Length - 1] = last & mask; return res; } string ToString(uint radix, IFormatProvider provider) { const string characterSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (characterSet.Length < radix) throw new ArgumentException("charSet length less than radix", "characterSet"); if (radix == 1) throw new ArgumentException("There is no such thing as radix one notation", "radix"); if (sign == 0) return "0"; if (data.Length == 1 && data[0] == 1) return sign == 1 ? "1" : "-1"; List digits = new List(1 + data.Length * 3 / 10); BigInteger a; if (sign == 1) a = this; else { uint[] dt = data; if (radix > 10) dt = MakeTwoComplement(dt); a = new BigInteger(1, dt); } while (a != 0) { BigInteger rem; a = DivRem(a, radix, out rem); digits.Add(characterSet[(int)rem]); } if (sign == -1 && radix == 10) { NumberFormatInfo info = null; if (provider != null) info = provider.GetFormat(typeof(NumberFormatInfo)) as NumberFormatInfo; if (info != null) { string str = info.NegativeSign; for (int i = str.Length - 1; i >= 0; --i) digits.Add(str[i]); } else { digits.Add('-'); } } char last = digits[digits.Count - 1]; if (sign == 1 && radix > 10 && (last < '0' || last > '9')) digits.Add('0'); digits.Reverse(); return new String(digits.ToArray()); } #if NET_4_0 [MonoTODO] public static BigInteger Parse (string value, NumberStyles style) { throw new NotImplementedException (); } [MonoTODO] public static BigInteger Parse (string value, IFormatProvider provider) { throw new NotImplementedException (); } [MonoTODO] public static BigInteger Parse ( string value, NumberStyles style, IFormatProvider provider) { throw new InvalidOperationException (); } [MonoTODO] public static bool TryParse ( string value, NumberStyles style, IFormatProvider provider, out BigInteger result) { throw new NotImplementedException (); } #endif static Exception GetFormatException() { return new FormatException("Input string was not in the correct format"); } static bool ProcessTrailingWhitespace(bool tryParse, string s, int position, ref Exception exc) { int len = s.Length; for (int i = position; i < len; i++) { char c = s[i]; if (c != 0 && !Char.IsWhiteSpace(c)) { if (!tryParse) exc = GetFormatException(); return false; } } return true; } public static BigInteger Min(BigInteger left, BigInteger right) { int ls = left.sign; int rs = right.sign; if (ls < rs) return left; if (rs < ls) return right; int r = CoreCompare(left.data, right.data); if (ls == -1) r = -r; if (r <= 0) return left; return right; } public static BigInteger Max(BigInteger left, BigInteger right) { int ls = left.sign; int rs = right.sign; if (ls > rs) return left; if (rs > ls) return right; int r = CoreCompare(left.data, right.data); if (ls == -1) r = -r; if (r >= 0) return left; return right; } public static BigInteger Abs(BigInteger value) { return new BigInteger((short)Math.Abs(value.sign), value.data); } public static BigInteger DivRem(BigInteger dividend, BigInteger divisor, out BigInteger remainder) { if (divisor.sign == 0) throw new DivideByZeroException(); if (dividend.sign == 0) { remainder = dividend; return dividend; } uint[] quotient; uint[] remainder_value; DivModUnsigned(dividend.data, divisor.data, out quotient, out remainder_value); int i; for (i = remainder_value.Length - 1; i >= 0 && remainder_value[i] == 0; --i) ; if (i == -1) { remainder = new BigInteger(0, ZERO); } else { if (i < remainder_value.Length - 1) remainder_value = Resize(remainder_value, i + 1); remainder = new BigInteger(dividend.sign, remainder_value); } for (i = quotient.Length - 1; i >= 0 && quotient[i] == 0; --i) ; if (i == -1) return new BigInteger(0, ZERO); if (i < quotient.Length - 1) quotient = Resize(quotient, i + 1); return new BigInteger((short)(dividend.sign * divisor.sign), quotient); } public static BigInteger Pow(BigInteger value, int exponent) { if (exponent < 0) throw new ArgumentOutOfRangeException("exponent", "exp must be >= 0"); if (exponent == 0) return One; if (exponent == 1) return value; BigInteger result = One; while (exponent != 0) { if ((exponent & 1) != 0) result = result * value; if (exponent == 1) break; value = value * value; exponent >>= 1; } return result; } public static BigInteger ModPow(BigInteger value, BigInteger exponent, BigInteger modulus) { if (exponent.sign == -1) throw new ArgumentOutOfRangeException("exponent", "power must be >= 0"); if (modulus.sign == 0) throw new DivideByZeroException(); BigInteger result = One % modulus; while (exponent.sign != 0) { if (!exponent.IsEven) { result = result * value; result = result % modulus; } if (exponent.IsOne) break; value = value * value; value = value % modulus; exponent >>= 1; } return result; } public static BigInteger GreatestCommonDivisor(BigInteger left, BigInteger right) { if (left.sign != 0 && left.data.Length == 1 && left.data[0] == 1) return new BigInteger(1, ONE); if (right.sign != 0 && right.data.Length == 1 && right.data[0] == 1) return new BigInteger(1, ONE); if (left.IsZero) return Abs(right); if (right.IsZero) return Abs(left); BigInteger x = new BigInteger(1, left.data); BigInteger y = new BigInteger(1, right.data); BigInteger g = y; while (x.data.Length > 1) { g = x; x = y % x; y = g; } if (x.IsZero) return g; // TODO: should we have something here if we can convert to long? // // Now we can just do it with single precision. I am using the binary gcd method, // as it should be faster. // uint yy = x.data[0]; uint xx = (uint)(y % yy); int t = 0; while (((xx | yy) & 1) == 0) { xx >>= 1; yy >>= 1; t++; } while (xx != 0) { while ((xx & 1) == 0) xx >>= 1; while ((yy & 1) == 0) yy >>= 1; if (xx >= yy) xx = (xx - yy) >> 1; else yy = (yy - xx) >> 1; } return yy << t; } /*LAMESPEC Log doesn't specify to how many ulp is has to be precise We are equilavent to MS with about 2 ULP */ public static double Log(BigInteger value, Double baseValue) { if (value.sign == -1 || baseValue == 1.0d || baseValue == -1.0d || baseValue == Double.NegativeInfinity || double.IsNaN(baseValue)) return double.NaN; if (baseValue == 0.0d || baseValue == Double.PositiveInfinity) return value.IsOne ? 0 : double.NaN; if (value.sign == 0) return double.NegativeInfinity; int length = value.data.Length - 1; int bitCount = -1; for (int curBit = 31; curBit >= 0; curBit--) { if ((value.data[length] & (1 << curBit)) != 0) { bitCount = curBit + length * 32; break; } } long bitlen = bitCount; Double c = 0, d = 1; BigInteger testBit = One; long tempBitlen = bitlen; while (tempBitlen > Int32.MaxValue) { testBit = testBit << Int32.MaxValue; tempBitlen -= Int32.MaxValue; } testBit = testBit << (int)tempBitlen; for (long curbit = bitlen; curbit >= 0; --curbit) { if ((value & testBit).sign != 0) c += d; d *= 0.5; testBit = testBit >> 1; } return (System.Math.Log(c) + System.Math.Log(2) * bitlen) / System.Math.Log(baseValue); } public static double Log(BigInteger value) { return Log(value, Math.E); } public static double Log10(BigInteger value) { return Log(value, 10); } [CLSCompliantAttribute(false)] public bool Equals(ulong other) { return CompareTo(other) == 0; } public override int GetHashCode() { uint hash = (uint)(sign * 0x01010101u); int len = data != null ? data.Length : 0; for (int i = 0; i < len; ++i) hash ^= data[i]; return (int)hash; } public static BigInteger Add(BigInteger left, BigInteger right) { return left + right; } public static BigInteger Subtract(BigInteger left, BigInteger right) { return left - right; } public static BigInteger Multiply(BigInteger left, BigInteger right) { return left * right; } public static BigInteger Divide(BigInteger dividend, BigInteger divisor) { return dividend / divisor; } public static BigInteger Remainder(BigInteger dividend, BigInteger divisor) { return dividend % divisor; } public static BigInteger Negate(BigInteger value) { return -value; } public int CompareTo(object obj) { if (obj == null) return 1; if (!(obj is BigInteger)) return -1; return Compare(this, (BigInteger)obj); } public int CompareTo(BigInteger other) { return Compare(this, other); } [CLSCompliantAttribute(false)] public int CompareTo(ulong other) { if (sign < 0) return -1; if (sign == 0) return other == 0 ? 0 : -1; if (data.Length > 2) return 1; uint high = (uint)(other >> 32); uint low = (uint)other; return LongCompare(low, high); } int LongCompare(uint low, uint high) { uint h = 0; if (data.Length > 1) h = data[1]; if (h > high) return 1; if (h < high) return -1; uint l = data[0]; if (l > low) return 1; if (l < low) return -1; return 0; } public int CompareTo(long other) { int ls = sign; int rs = Math.Sign(other); if (ls != rs) return ls > rs ? 1 : -1; if (ls == 0) return 0; if (data.Length > 2) return sign; if (other < 0) other = -other; uint low = (uint)other; uint high = (uint)((ulong)other >> 32); int r = LongCompare(low, high); if (ls == -1) r = -r; return r; } public static int Compare(BigInteger left, BigInteger right) { int ls = left.sign; int rs = right.sign; if (ls != rs) return ls > rs ? 1 : -1; int r = CoreCompare(left.data, right.data); if (ls < 0) r = -r; return r; } static int TopByte(uint x) { if ((x & 0xFFFF0000u) != 0) { if ((x & 0xFF000000u) != 0) return 4; return 3; } if ((x & 0xFF00u) != 0) return 2; return 1; } static int FirstNonFFByte(uint word) { if ((word & 0xFF000000u) != 0xFF000000u) return 4; else if ((word & 0xFF0000u) != 0xFF0000u) return 3; else if ((word & 0xFF00u) != 0xFF00u) return 2; return 1; } public byte[] ToByteArray() { if (sign == 0) return new byte[1]; //number of bytes not counting upper word int bytes = (data.Length - 1) * 4; bool needExtraZero = false; uint topWord = data[data.Length - 1]; int extra; //if the topmost bit is set we need an extra if (sign == 1) { extra = TopByte(topWord); uint mask = 0x80u << ((extra - 1) * 8); if ((topWord & mask) != 0) { needExtraZero = true; } } else { extra = TopByte(topWord); } byte[] res = new byte[bytes + extra + (needExtraZero ? 1 : 0)]; if (sign == 1) { int j = 0; int end = data.Length - 1; for (int i = 0; i < end; ++i) { uint word = data[i]; res[j++] = (byte)word; res[j++] = (byte)(word >> 8); res[j++] = (byte)(word >> 16); res[j++] = (byte)(word >> 24); } while (extra-- > 0) { res[j++] = (byte)topWord; topWord >>= 8; } } else { int j = 0; int end = data.Length - 1; uint carry = 1, word; ulong add; for (int i = 0; i < end; ++i) { word = data[i]; add = (ulong)~word + carry; word = (uint)add; carry = (uint)(add >> 32); res[j++] = (byte)word; res[j++] = (byte)(word >> 8); res[j++] = (byte)(word >> 16); res[j++] = (byte)(word >> 24); } add = (ulong)~topWord + (carry); word = (uint)add; carry = (uint)(add >> 32); if (carry == 0) { int ex = FirstNonFFByte(word); bool needExtra = (word & (1 << (ex * 8 - 1))) == 0; int to = ex + (needExtra ? 1 : 0); if (to != extra) res = Resize(res, bytes + to); while (ex-- > 0) { res[j++] = (byte)word; word >>= 8; } if (needExtra) res[j++] = 0xFF; } else { res = Resize(res, bytes + 5); res[j++] = (byte)word; res[j++] = (byte)(word >> 8); res[j++] = (byte)(word >> 16); res[j++] = (byte)(word >> 24); res[j++] = 0xFF; } } return res; } static byte[] Resize(byte[] v, int len) { byte[] res = new byte[len]; Array.Copy(v, res, Math.Min(v.Length, len)); return res; } static uint[] Resize(uint[] v, int len) { uint[] res = new uint[len]; Array.Copy(v, res, Math.Min(v.Length, len)); return res; } static uint[] CoreAdd(uint[] a, uint[] b) { if (a.Length < b.Length) { uint[] tmp = a; a = b; b = tmp; } int bl = a.Length; int sl = b.Length; uint[] res = new uint[bl]; ulong sum = 0; int i = 0; for (; i < sl; i++) { sum = sum + a[i] + b[i]; res[i] = (uint)sum; sum >>= 32; } for (; i < bl; i++) { sum = sum + a[i]; res[i] = (uint)sum; sum >>= 32; } if (sum != 0) { res = Resize(res, bl + 1); res[i] = (uint)sum; } return res; } /*invariant a > b*/ static uint[] CoreSub(uint[] a, uint[] b) { int bl = a.Length; int sl = b.Length; uint[] res = new uint[bl]; ulong borrow = 0; int i; for (i = 0; i < sl; ++i) { borrow = (ulong)a[i] - b[i] - borrow; res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } for (; i < bl; i++) { borrow = (ulong)a[i] - borrow; res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } //remove extra zeroes for (i = bl - 1; i >= 0 && res[i] == 0; --i) ; if (i < bl - 1) res = Resize(res, i + 1); return res; } static uint[] CoreAdd(uint[] a, uint b) { int len = a.Length; uint[] res = new uint[len]; ulong sum = b; int i; for (i = 0; i < len; i++) { sum = sum + a[i]; res[i] = (uint)sum; sum >>= 32; } if (sum != 0) { res = Resize(res, len + 1); res[i] = (uint)sum; } return res; } static uint[] CoreSub(uint[] a, uint b) { int len = a.Length; uint[] res = new uint[len]; ulong borrow = b; int i; for (i = 0; i < len; i++) { borrow = (ulong)a[i] - borrow; res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } //remove extra zeroes for (i = len - 1; i >= 0 && res[i] == 0; --i) ; if (i < len - 1) res = Resize(res, i + 1); return res; } static int CoreCompare(uint[] a, uint[] b) { int al = a != null ? a.Length : 0; int bl = b != null ? b.Length : 0; if (al > bl) return 1; if (bl > al) return -1; for (int i = al - 1; i >= 0; --i) { uint ai = a[i]; uint bi = b[i]; if (ai > bi) return 1; if (ai < bi) return -1; } return 0; } static int GetNormalizeShift(uint value) { int shift = 0; if ((value & 0xFFFF0000) == 0) { value <<= 16; shift += 16; } if ((value & 0xFF000000) == 0) { value <<= 8; shift += 8; } if ((value & 0xF0000000) == 0) { value <<= 4; shift += 4; } if ((value & 0xC0000000) == 0) { value <<= 2; shift += 2; } if ((value & 0x80000000) == 0) { value <<= 1; shift += 1; } return shift; } static void Normalize(uint[] u, int l, uint[] un, int shift) { uint carry = 0; int i; if (shift > 0) { int rshift = 32 - shift; for (i = 0; i < l; i++) { uint ui = u[i]; un[i] = (ui << shift) | carry; carry = ui >> rshift; } } else { for (i = 0; i < l; i++) { un[i] = u[i]; } } while (i < un.Length) { un[i++] = 0; } if (carry != 0) { un[l] = carry; } } static void Unnormalize(uint[] un, out uint[] r, int shift) { int length = un.Length; r = new uint[length]; if (shift > 0) { int lshift = 32 - shift; uint carry = 0; for (int i = length - 1; i >= 0; i--) { uint uni = un[i]; r[i] = (uni >> shift) | carry; carry = (uni << lshift); } } else { for (int i = 0; i < length; i++) { r[i] = un[i]; } } } const ulong Base = 0x100000000; static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] r) { int m = u.Length; int n = v.Length; if (n <= 1) { // Divide by single digit // ulong rem = 0; uint v0 = v[0]; q = new uint[m]; r = new uint[1]; for (int j = m - 1; j >= 0; j--) { rem *= Base; rem += u[j]; ulong div = rem / v0; rem -= div * v0; q[j] = (uint)div; } r[0] = (uint)rem; } else if (m >= n) { int shift = GetNormalizeShift(v[n - 1]); uint[] un = new uint[m + 1]; uint[] vn = new uint[n]; Normalize(u, m, un, shift); Normalize(v, n, vn, shift); q = new uint[m - n + 1]; r = null; // Main division loop // for (int j = m - n; j >= 0; j--) { ulong rr, qq; int i; rr = Base * un[j + n] + un[j + n - 1]; qq = rr / vn[n - 1]; rr -= qq * vn[n - 1]; for (; ; ) { // Estimate too big ? // if ((qq >= Base) || (qq * vn[n - 2] > (rr * Base + un[j + n - 2]))) { qq--; rr += (ulong)vn[n - 1]; if (rr < Base) continue; } break; } // Multiply and subtract // long b = 0; long t = 0; for (i = 0; i < n; i++) { ulong p = vn[i] * qq; t = (long)un[i + j] - (long)(uint)p - b; un[i + j] = (uint)t; p >>= 32; t >>= 32; b = (long)p - t; } t = (long)un[j + n] - b; un[j + n] = (uint)t; // Store the calculated value // q[j] = (uint)qq; // Add back vn[0..n] to un[j..j+n] // if (t < 0) { q[j]--; ulong c = 0; for (i = 0; i < n; i++) { c = (ulong)vn[i] + un[j + i] + c; un[j + i] = (uint)c; c >>= 32; } c += (ulong)un[j + n]; un[j + n] = (uint)c; } } Unnormalize(un, out r, shift); } else { q = new uint[] { 0 }; r = u; } } } } ================================================ FILE: Telegram.Api/WindowsPhone/Tuple.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.WindowsPhone { public class Tuple { public T1 Item1 { get; set; } public T2 Item2 { get; set; } public T3 Item3 { get; set; } public Tuple(T1 item1, T2 item2, T3 item3) { Item1 = item1; Item2 = item2; Item3 = item3; } } public class Tuple { public T1 Item1 { get; set; } public T2 Item2 { get; set; } public Tuple(T1 item1, T2 item2) { Item1 = item1; Item2 = item2; } } } ================================================ FILE: Telegram.Api/packages.config ================================================  ================================================ FILE: Telegram.Api.PCL/Hash/CRC32/CRC.WinRT.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #if WIN_RT using System; using System.IO; namespace Telegram.Api { /// /// Calculates a 32bit Cyclic Redundancy Checksum (CRC) using the same polynomial /// used by Zip. This type is used internally by DotNetZip; it is generally not used /// directly by applications wishing to create, read, or manipulate zip archive /// files. /// internal class CRC32 { private const int BUFFER_SIZE = 8192; private static readonly UInt32[] crc32Table; private UInt32 runningCrc32Result = 0xFFFFFFFF; private Int64 totalBytesRead; static CRC32() { unchecked { // PKZip specifies CRC32 with a polynomial of 0xEDB88320; // This is also the CRC-32 polynomial used bby Ethernet, FDDI, // bzip2, gzip, and others. // Often the polynomial is shown reversed as 0x04C11DB7. // For more details, see http://en.wikipedia.org/wiki/Cyclic_redundancy_check UInt32 dwPolynomial = 0xEDB88320; UInt32 i, j; crc32Table = new UInt32[256]; UInt32 dwCrc; for (i = 0; i < 256; i++) { dwCrc = i; for (j = 8; j > 0; j--) { if ((dwCrc & 1) == 1) { dwCrc = (dwCrc >> 1) ^ dwPolynomial; } else { dwCrc >>= 1; } } crc32Table[i] = dwCrc; } } } /// /// indicates the total number of bytes read on the CRC stream. /// This is used when writing the ZipDirEntry when compressing files. /// public Int64 TotalBytesRead { get { return totalBytesRead; } } /// /// Indicates the current CRC for all blocks slurped in. /// public Int32 Crc32Result { get { // return one's complement of the running result return unchecked((Int32)(~runningCrc32Result)); } } /// /// Returns the CRC32 for the specified stream. /// /// The stream over which to calculate the CRC32 /// the CRC32 calculation public Int32 GetCrc32(Stream input) { return GetCrc32AndCopy(input, null); } /// /// Returns the CRC32 for the specified stream, and writes the input into the /// output stream. /// /// The stream over which to calculate the CRC32 /// The stream into which to deflate the input /// the CRC32 calculation public Int32 GetCrc32AndCopy(Stream input, Stream output) { if (input == null) throw new ArgumentException("The input stream must not be null."); unchecked { //UInt32 crc32Result; //crc32Result = 0xFFFFFFFF; var buffer = new byte[BUFFER_SIZE]; int readSize = BUFFER_SIZE; totalBytesRead = 0; int count = input.Read(buffer, 0, readSize); if (output != null) output.Write(buffer, 0, count); totalBytesRead += count; while (count > 0) { SlurpBlock(buffer, 0, count); count = input.Read(buffer, 0, readSize); if (output != null) output.Write(buffer, 0, count); totalBytesRead += count; } return (Int32)(~runningCrc32Result); } } /// /// Get the CRC32 for the given (word,byte) combo. This is a computation /// defined by PKzip. /// /// The word to start with. /// The byte to combine it with. /// The CRC-ized result. public Int32 ComputeCrc32(Int32 W, byte B) { return _InternalComputeCrc32((UInt32)W, B); } internal Int32 _InternalComputeCrc32(UInt32 W, byte B) { return (Int32)(crc32Table[(W ^ B) & 0xFF] ^ (W >> 8)); } /// /// Update the value for the running CRC32 using the given block of bytes. /// This is useful when using the CRC32() class in a Stream. /// /// block of bytes to slurp /// starting point in the block /// how many bytes within the block to slurp public void SlurpBlock(byte[] block, int offset, int count) { if (block == null) throw new ArgumentException("The data buffer must not be null."); for (int i = 0; i < count; i++) { int x = offset + i; runningCrc32Result = ((runningCrc32Result) >> 8) ^ crc32Table[(block[x]) ^ ((runningCrc32Result) & 0x000000FF)]; } totalBytesRead += count; } // pre-initialize the crc table for speed of lookup. private uint gf2_matrix_times(uint[] matrix, uint vec) { uint sum = 0; int i = 0; while (vec != 0) { if ((vec & 0x01) == 0x01) sum ^= matrix[i]; vec >>= 1; i++; } return sum; } private void gf2_matrix_square(uint[] square, uint[] mat) { for (int i = 0; i < 32; i++) square[i] = gf2_matrix_times(mat, mat[i]); } /// /// Combines the given CRC32 value with the current running total. /// /// /// This is useful when using a divide-and-conquer approach to calculating a CRC. /// Multiple threads can each calculate a CRC32 on a segment of the data, and then /// combine the individual CRC32 values at the end. /// /// the crc value to be combined with this one /// the length of data the CRC value was calculated on public void Combine(int crc, int length) { var even = new uint[32]; // even-power-of-two zeros operator var odd = new uint[32]; // odd-power-of-two zeros operator if (length == 0) return; uint crc1 = ~runningCrc32Result; var crc2 = (uint)crc; // put operator for one zero bit in odd odd[0] = 0xEDB88320; // the CRC-32 polynomial uint row = 1; for (int i = 1; i < 32; i++) { odd[i] = row; row <<= 1; } // put operator for two zero bits in even gf2_matrix_square(even, odd); // put operator for four zero bits in odd gf2_matrix_square(odd, even); var len2 = (uint)length; // apply len2 zeros to crc1 (first square will put the operator for one // zero byte, eight zero bits, in even) do { // apply zeros operator for this bit of len2 gf2_matrix_square(even, odd); if ((len2 & 1) == 1) crc1 = gf2_matrix_times(even, crc1); len2 >>= 1; if (len2 == 0) break; // another iteration of the loop with odd and even swapped gf2_matrix_square(odd, even); if ((len2 & 1) == 1) crc1 = gf2_matrix_times(odd, crc1); len2 >>= 1; } while (len2 != 0); crc1 ^= crc2; runningCrc32Result = ~crc1; //return (int) crc1; return; } public byte[] ComputeHash(byte[] data) { return BitConverter.GetBytes(GetCrc32(new MemoryStream(data))); } } } #endif ================================================ FILE: Telegram.Api.PCL/Properties/AssemblyInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Api.PCL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Api.PCL")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] ================================================ FILE: Telegram.Api.PCL/Resources/AppResources.cs ================================================ using Windows.ApplicationModel.Resources; namespace Telegram.Api.Resources { internal class AppResources { private static ResourceLoader resourceMan; //private static global::System.Globalization.CultureInfo resourceCulture; internal AppResources() { } internal static ResourceLoader ResourceManager { get { if (ReferenceEquals(resourceMan, null)) { var temp = ResourceLoader.GetForViewIndependentUse("TelegramClient.Tasks/Resources"); resourceMan = temp; } return resourceMan; } } /// /// Looks up a localized string similar to Deleted User. /// internal static string DeletedUser { get { return ResourceManager.GetString("DeletedUser"); } } /// /// Looks up a localized string similar to Empty User. /// internal static string EmptyUser { get { return ResourceManager.GetString("EmptyUser"); } } /// /// Looks up a localized string similar to Saved Messages. /// internal static string SavedMessages { get { return ResourceManager.GetString("SavedMessages"); } } } } ================================================ FILE: Telegram.Api.PCL/Resources/de/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Gelöschtes Konto Gelöschtes Konto Saved Messages ================================================ FILE: Telegram.Api.PCL/Resources/en/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Deleted account Deleted account Saved messages ================================================ FILE: Telegram.Api.PCL/Resources/es/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Cuenta eliminada Cuenta eliminada Saved Messages ================================================ FILE: Telegram.Api.PCL/Resources/it/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Account eliminato Account eliminato Saved Messages ================================================ FILE: Telegram.Api.PCL/Resources/nl/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Verwijderd account Verwijderd account Saved Messages ================================================ FILE: Telegram.Api.PCL/Resources/pt/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Conta excluída Conta excluída Saved Messages ================================================ FILE: Telegram.Api.PCL/Resources/ru/Resources.resw ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Удаленный аккаунт Удаленный аккаунт Избранное ================================================ FILE: Telegram.Api.PCL/Telegram.Api.PCL.csproj ================================================  12.0 Debug AnyCPU {DE897F51-AF1F-48FE-9DBB-6B308F9740D1} Library Properties Telegram.Api Telegram.Api.PCL en-US 512 {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Profile32 v4.6 ..\..\..\ true true full false bin\Debug\ TRACE;DEBUG;WIN_RT;WP8 prompt 4 pdbonly true bin\Release\ TRACE;WIN_RT;WP8 prompt 4 Compression\GZipDeflateStream.cs Constants.cs Hash\CRC32\CRC.cs Extensions\ActionExtensions.cs Extensions\HttpWebRequestExtensions.cs Extensions\StreamExtensions.cs Extensions\TLObjectExtensions.cs Helpers\Execute.cs Helpers\FileUtils.cs Helpers\SettingsHelper.cs Helpers\Utils.cs Hash\MD5\MD5.cs Hash\MD5\MD5CryptoServiceProvider.cs Hash\MD5\MD5Managed.cs Services\Cache\Context.cs Services\Cache\EventArgs\DialogAddedEventArgs.cs Services\Cache\EventArgs\TopMessageUpdatedEventArgs.cs Services\Cache\ICacheService.cs Services\Cache\InMemoryCacheService.cs Services\Cache\InMemoryDatabase.cs Services\Connection\ConnectionService.cs Services\DCOptionItem.cs Services\DelayedItem.cs Services\FileManager\AudioFileManager.cs Services\FileManager\DocumentFileManager.cs Services\FileManager\DownloadableItem.cs Services\FileManager\DownloadablePart.cs Services\FileManager\DownloadingCanceledEventArgs.cs Services\FileManager\EncryptedFileManager.cs Services\FileManager\FileManager.cs Services\FileManager\IAudioFileManager.cs Services\FileManager\IDocumentFileManager.cs Services\FileManager\IEncryptedFileManager.cs Services\FileManager\IFileManager.cs Services\FileManager\IUploadAudioFileManager.cs Services\FileManager\IUploadFileManager.cs Services\FileManager\IUploadVideoFileManager.cs Services\FileManager\IVideoFileManager.cs Services\FileManager\ProgressChangedEventArgs.cs Services\FileManager\UploadAudioFileManager.cs Services\FileManager\UploadFileManager.cs Services\FileManager\UploadVideoFileManager.cs Services\FileManager\VideoFileManager.cs Services\FileManager\Worker.cs Services\HistoryItem.cs Services\IMTProtoService.cs Services\MTProtoService.Account.cs Services\MTProtoService.Auth.cs Services\MTProtoService.ByTransport.cs Services\MTProtoService.Config.cs Services\MTProtoService.Contacts.cs Services\MTProtoService.cs Services\MTProtoService.DHKeyExchange.cs Services\MTProtoService.Help.cs Services\MTProtoService.Helpers.cs Services\MTProtoService.HttpLongPoll.cs Services\MTProtoService.Messages.cs Services\MTProtoService.Photos.cs Services\MTProtoService.SecretChats.cs Services\MTProtoService.SendingQueue.cs Services\MTProtoService.Stuff.cs Services\MTProtoService.Updates.cs Services\MTProtoService.Upload.cs Services\MTProtoService.Users.cs Services\ServiceBase.cs Services\Updates\IUpdatesService.cs Services\Updates\ReceiveUpdatesEventArgs.cs Services\Updates\UpdatesBySeqComparer.cs Services\Updates\UpdatesService.cs TL\Functions\Account\TLCheckUsername.cs TL\Functions\Account\TLDeleteAccount.cs TL\Functions\Account\TLGetAccountTTL.cs TL\Functions\Account\TLGetNotifySettings.cs TL\Functions\Account\TLGetPrivacy.cs TL\Functions\Account\TLRegisterDevice.cs TL\Functions\Account\TLResetNotifySettings.cs TL\Functions\Account\TLSetPrivacy.cs TL\Functions\Account\TLUnregisterDevice.cs TL\Functions\Account\TLUpdateNotifySettings.cs TL\Functions\Account\TLUpdateProfile.cs TL\Functions\Account\TLUpdateStatus.cs TL\Functions\Account\TLUpdateUserName.cs TL\Functions\Auth\TLCheckPhone.cs TL\Functions\Auth\TLExportAuthorization.cs TL\Functions\Auth\TLImportAuthorization.cs TL\Functions\Auth\TLLogOut.cs TL\Functions\Auth\TLResetAuthorizations.cs TL\Functions\Auth\TLSendCall.cs TL\Functions\Auth\TLSendCode.cs TL\Functions\Auth\TLSendInvites.cs TL\Functions\Auth\TLSendSms.cs TL\Functions\Auth\TLSignIn.cs TL\Functions\Auth\TLSignUp.cs TL\Functions\Contacts\TLBlock.cs TL\Functions\Contacts\TLDeleteContact.cs TL\Functions\Contacts\TLDeleteContacts.cs TL\Functions\Contacts\TLGetBlocked.cs TL\Functions\Contacts\TLGetContacts.cs TL\Functions\Contacts\TLGetStatuses.cs TL\Functions\Contacts\TLImportContacts.cs TL\Functions\Contacts\TLSearch.cs TL\Functions\Contacts\TLUnblock.cs TL\Functions\DHKeyExchange\TLReqDHParams.cs TL\Functions\DHKeyExchange\TLReqPQ.cs TL\Functions\DHKeyExchange\TLSetClientDHParams.cs TL\Functions\Help\TLGetConfig.cs TL\Functions\Help\TLGetInviteText.cs TL\Functions\Help\TLGetNearestDC.cs TL\Functions\Help\TLGetSupport.cs TL\Functions\Help\TLInvokeWithLayerN.cs TL\Functions\Messages\TLAcceptEncryption.cs TL\Functions\Messages\TLAddChatUser.cs TL\Functions\Messages\TLCreateChat.cs TL\Functions\Messages\TLDeleteChatUser.cs TL\Functions\Messages\TLDeleteHistory.cs TL\Functions\Messages\TLDeleteMessages.cs TL\Functions\Messages\TLDiscardEncryption.cs TL\Functions\Messages\TLEditChatPhoto.cs TL\Functions\Messages\TLEditChatTitle.cs TL\Functions\Messages\TLForwardMessage.cs TL\Functions\Messages\TLForwardMessages.cs TL\Functions\Messages\TLGetChats.cs TL\Functions\Messages\TLGetDHConfig.cs TL\Functions\Messages\TLGetDialogs.cs TL\Functions\Messages\TLGetFullChat.cs TL\Functions\Messages\TLGetHistory.cs TL\Functions\Messages\TLGetMessages.cs TL\Functions\Messages\TLReadEncryptedHistory.cs TL\Functions\Messages\TLReadHistory.cs TL\Functions\Messages\TLReadMessageContents.cs TL\Functions\Messages\TLReceivedMessages.cs TL\Functions\Messages\TLReceivedQueue.cs TL\Functions\Messages\TLRequestEncryption.cs TL\Functions\Messages\TLRestoreMessages.cs TL\Functions\Messages\TLSearch.cs TL\Functions\Messages\TLSendBroadcast.cs TL\Functions\Messages\TLSendEncrypted.cs TL\Functions\Messages\TLSendEncryptedFile.cs TL\Functions\Messages\TLSendEncryptedService.cs TL\Functions\Messages\TLSendMedia.cs TL\Functions\Messages\TLSendMessage.cs TL\Functions\Messages\TLSetEncryptedTyping.cs TL\Functions\Messages\TLSetTyping.cs TL\Functions\Photos\TLGetUserPhotos.cs TL\Functions\Photos\TLUpdateProfilePhoto.cs TL\Functions\Photos\TLUploadProfilePhoto.cs TL\Functions\Stuff\TLGetFutureSalts.cs TL\Functions\Stuff\TLHttpWait.cs TL\Functions\Stuff\TLMessageAcknowledgments.cs TL\Functions\Stuff\TLRPCDropAnswer.cs TL\Functions\Updates\TLGetDifference.cs TL\Functions\Updates\TLGetState.cs TL\Functions\Upload\TLGetFile.cs TL\Functions\Upload\TLSaveFilePart.cs TL\Functions\Users\TLGetFullUser.cs TL\Functions\Users\TLGetUsers.cs TL\Interfaces\IBytes.cs TL\Interfaces\IFullName.cs TL\Interfaces\IInputPeer.cs TL\Interfaces\ISelectable.cs TL\Interfaces\IVIsibility.cs TL\TLAffectedHistory.cs TL\TLAudio.cs TL\TLAuthorization.cs TL\TLBadMessageNotification.cs TL\TLBadServerSalt.cs TL\TLBool.cs TL\TLChat.cs TL\TLChatFull.cs TL\TLChatParticipant.cs TL\TLChatParticipants.cs TL\TLChats.cs TL\TLCheckedPhone.cs TL\TLClientDHInnerData.cs TL\TLConfig.cs TL\TLContact.cs TL\TLContactBlocked.cs TL\TLContactFound.cs TL\TLContacts.cs TL\TLContactsBlocked.cs TL\TLContactsFound.cs TL\TLContactStatus.cs TL\TLContainerTransportMessage.cs TL\TLDCOption.cs TL\TLDecryptedMessage.cs TL\TLDecryptedMessageAction.cs TL\TLDecryptedMessageLayer.cs TL\TLDecryptedMessageMedia.cs TL\TLDHConfig.cs TL\TLDHGen.cs TL\TLDialog.cs TL\TLDialogs.cs TL\TLDifference.cs TL\TLDocument.cs TL\TLDouble.cs TL\TLEncryptedChat.cs TL\TLEncryptedFile.cs TL\TLEncryptedMessage.cs TL\TLExportedAuthorization.cs TL\TLFile.cs TL\TLFileLocation.cs TL\TLFileType.cs TL\TLForeignLink.cs TL\TLFutureSalt.cs TL\TLGeoPoint.cs TL\TLGzipPacked.cs TL\TLImportedContact.cs TL\TLImportedContacts.cs TL\TLInitConnection.cs TL\TLInputAudio.cs TL\TLInputChatPhoto.cs TL\TLInputContact.cs TL\TLInputDocument.cs TL\TLInputEncryptedChat.cs TL\TLInputEncryptedFile.cs TL\TLInputEncryptedFileBigUploaded.cs TL\TLInputEncryptedFileLocation.cs TL\TLInputFile.cs TL\TLInputFileBig.cs TL\TLInputFileLocation.cs TL\TLInputGeoPoint.cs TL\TLInputMedia.cs TL\TLInputMessagesFilter.cs TL\TLInputNotifyPeer.cs TL\TLInputPeerBase.cs TL\TLInputPeerNotifyEvents.cs TL\TLInputPeerNotifySettings.cs TL\TLInputPhoto.cs TL\TLInputPhotoCrop.cs TL\TLInputUser.cs TL\TLInputVideo.cs TL\TLInt.cs TL\TLInt128.cs TL\TLInt256.cs TL\TLInviteText.cs TL\TLInvokeAfterMsg.cs TL\TLLink.cs TL\TLLong.cs TL\TLMessage.cs TL\TLMessage.Encrypted.cs TL\TLMessageAction.cs TL\TLMessageContainer.cs TL\TLMessageInfo.cs TL\TLMessageMedia.cs TL\TLMessages.cs TL\TLMessagesAcknowledgment.cs TL\TLMessagesChatFull.cs TL\TLMyLink.cs TL\TLNearestDC.cs TL\TLNewSessionCreated.cs TL\TLNonEncryptedMessage.cs TL\TLNotifyPeer.cs TL\TLNull.cs TL\TLObject.cs TL\TLObjectGenerator.cs TL\TLPeer.cs TL\TLPeerNotifyEvents.cs TL\TLPeerNotifySettings.cs TL\TLPhoto.cs TL\TLPhotos.cs TL\TLPhotoSize.cs TL\TLPhotosPhoto.cs TL\TLPong.cs TL\TLPQInnerData.cs TL\TLResponse.cs TL\TLResPQ.cs TL\TLRPCDropAnswer.cs TL\TLRPCError.cs TL\TLRPCResult.cs TL\TLSendMessageAction.cs TL\TLSentCode.cs TL\TLSentEncryptedFile.cs TL\TLSentEncryptedMessage.cs TL\TLSentMessage.cs TL\TLServerDHInnerData.cs TL\TLServerDHParams.cs TL\TLServerFile.cs TL\TLSignatures.cs TL\TLState.cs TL\TLStatedMessage.cs TL\TLStatedMessages.cs TL\TLString.cs TL\TLSupport.cs TL\TLUpdate.cs TL\TLUpdates.cs TL\TLUserBase.cs TL\TLUserFull.cs TL\TLUserStatus.cs TL\TLUtils.cs TL\TLUtils.Log.cs TL\TLVector.cs TL\TLVideo.cs TL\TLWallpaperSolid.cs Transport\DataEventArgs.cs Transport\ITransport.cs Transport\ITransportService.cs Transport\TCPTransportBase.cs Transport\TCPTransportResult.cs Transport\TransportService.cs Services\FileManager\IWebFileManager.cs Services\FileManager\WebFileManager.cs TL\Functions\Account\TLAcceptAuthorization.cs TL\Functions\Account\TLDeleteSecureValue.cs TL\Functions\Account\TLGetAllSecureValues.cs TL\Functions\Account\TLGetAuthorizationForm.cs TL\Functions\Account\TLGetSecureValue.cs TL\Functions\Account\TLGetWebAuthorizations.cs TL\Functions\Account\TLInitTakeoutSession.cs TL\Functions\Account\TLResetWebAuthorization.cs TL\Functions\Account\TLResetWebAuthorizations.cs TL\Functions\Account\TLSaveSecureValue.cs TL\Functions\Account\TLSendVerifyEmailCode.cs TL\Functions\Account\TLSendVerifyPhoneCode.cs TL\Functions\Account\TLVerifyEmail.cs TL\Functions\Account\TLVerifyEmailCode.cs TL\Functions\Account\TLVerifyPhone.cs TL\Functions\Auth\TLBindTempAuthKey.cs TL\Functions\Channels\TLChangeFeedBroadcast.cs TL\Functions\Channels\TLGetFeed.cs TL\Functions\Channels\TLReadFeed.cs TL\Functions\Channels\TLSetFeedBroadcasts.cs TL\Functions\Contacts\TLGetSaved.cs TL\Functions\Help\TLGetDeepLinkInfo.cs TL\Functions\Help\TLGetPassportConfig.cs TL\Functions\Help\TLGetProxyData.cs TL\Functions\Messages\TLClearAllDrafts.cs TL\Functions\Messages\TLGetDialogUnreadMarks.cs TL\Functions\Messages\TLMarkDialogUnread.cs TL\Functions\Messages\TLReport.cs TL\Functions\Messages\TLSearchStickerSets.cs TL\Functions\Messages\TLToggleTopPeers.cs TL\Functions\Upload\TLGetWebFile.cs TL\Functions\Users\TLSetSecureValueErrors.cs TL\TLAppUpdate.cs TL\TLAuthorizationForm.cs TL\TLContactsSettings.cs TL\TLDeepLinkInfo.cs TL\TLDialogPeer.cs TL\TLFeedBroadcasts.cs TL\TLFeedPosition.cs TL\TLFeedSources.cs TL\TLFoundStickerSets.cs TL\TLInputCheckPasswordSRP.cs TL\TLInputClientProxy.cs TL\TLInputDialogPeer.cs TL\TLInputMessage.cs TL\TLInputSecureFile.cs TL\TLInputSecureValue.cs TL\TLInvokeWithMessageRange.cs TL\TLPassportConfig.cs TL\TLPasswordKdfAlgo.cs TL\TLProxyData.cs TL\TLSavedPhoneContact.cs TL\TLSecureCredentialsEncrypted.cs TL\TLSecureData.cs TL\TLSecureFile.cs TL\TLSecurePasswordKdfAlgo.cs TL\TLSecureRequiredType.cs TL\TLSecureSecretSettings.cs TL\TLSecureValue.cs TL\TLSecureValueError.cs TL\TLSecureValueHash.cs TL\TLSecureValuePlainData.cs TL\TLSecureValueType.cs TL\TLSentEmailCode.cs TL\TLTakeout.cs TL\TLTermsOfServiceUpdate.cs TL\TLWebAuthorization.cs TL\TLWebAuthorizations.cs Transport\TCPTransportWinRT.cs Aggregator\EventAggregator.cs Aggregator\ExtensionMethods.cs Helpers\Notifications.cs Logs\Log.cs Services\Connection\PublicConfigService.cs Services\DeviceInfo\EmptyDeviceInfoService.cs Services\DeviceInfo\IDeviceInfo.cs Services\FileManager\FileManagerBase.cs Services\MTProtoService.Channel.cs Services\MTProtoService.Langpack.cs Services\MTProtoService.Payments.cs Services\MTProtoService.Phone.cs TL\Functions\Account\TLChangePhone.cs TL\Functions\Account\TLCheckPassword.cs TL\Functions\Account\TLConfirmPhone.cs TL\Functions\Account\TLGetAuthorizations.cs TL\Functions\Account\TLGetPassword.cs TL\Functions\Account\TLGetPasswordSettings.cs TL\Functions\Account\TLGetTmpPassword.cs TL\Functions\Account\TLGetWallPapers.cs TL\Functions\Account\TLRecoverPassword.cs TL\Functions\Account\TLReportPeer.cs TL\Functions\Account\TLRequestPasswordRecovery.cs TL\Functions\Account\TLResetAuthorization.cs TL\Functions\Account\TLResetPassword.cs TL\Functions\Account\TLSendChangePhoneCode.cs TL\Functions\Account\TLSendConfirmPhoneCode.cs TL\Functions\Account\TLSetPassword.cs TL\Functions\Account\TLUpdateDeviceLocked.cs TL\Functions\Account\TLUpdatePasswordSettings.cs TL\Functions\Auth\TLCancelCode.cs TL\Functions\Auth\TLResendCode.cs TL\Functions\Channels\TLCheckUsername.cs TL\Functions\Channels\TLCreateChannel.cs TL\Functions\Channels\TLDeleteChannel.cs TL\Functions\Channels\TLDeleteChannelMessages.cs TL\Functions\Channels\TLDeleteHistory.cs TL\Functions\Channels\TLDeleteUserHistory.cs TL\Functions\Channels\TLEditAbout.cs TL\Functions\Channels\TLEditAdmin.cs TL\Functions\Channels\TLEditMessage.cs TL\Functions\Channels\TLEditPhoto.cs TL\Functions\Channels\TLEditTitle.cs TL\Functions\Channels\TLExportInvite.cs TL\Functions\Channels\TLExportMessageLink.cs TL\Functions\Channels\TLGetAdminedPublicChannels.cs TL\Functions\Channels\TLGetChannels.cs TL\Functions\Channels\TLGetDialogs.cs TL\Functions\Channels\TLGetFullChannel.cs TL\Functions\Channels\TLGetImportantHistory.cs TL\Functions\Channels\TLGetMessageEditData.cs TL\Functions\Channels\TLGetMessages.cs TL\Functions\Channels\TLGetParticipant.cs TL\Functions\Channels\TLGetParticipants.cs TL\Functions\Channels\TLInviteToChannel.cs TL\Functions\Channels\TLJoinChannel.cs TL\Functions\Channels\TLKickFromChannel.cs TL\Functions\Channels\TLLeaveChannel.cs TL\Functions\Channels\TLReadHistory.cs TL\Functions\Channels\TLReadMessageContents.cs TL\Functions\Channels\TLReportSpam.cs TL\Functions\Channels\TLSetStickers.cs TL\Functions\Channels\TLToggleComments.cs TL\Functions\Channels\TLToggleInvites.cs TL\Functions\Channels\TLTogglePreHistoryHidden.cs TL\Functions\Channels\TLToggleSignatures.cs TL\Functions\Channels\TLUpdateChannelUsername.cs TL\Functions\Channels\TLUpdatePinnedMessage.cs TL\Functions\Contacts\TLGetTopPeers.cs TL\Functions\Contacts\TLResetSaved.cs TL\Functions\Contacts\TLResetTopPeerRating.cs TL\Functions\Contacts\TLResolveUsername.cs TL\Functions\Help\TLGetAppChangelog.cs TL\Functions\Help\TLGetCdnConfig.cs TL\Functions\Help\TLGetRecentMeUrls.cs TL\Functions\Help\TLGetTermsOfService.cs TL\Functions\Help\TLInvokeWithoutUpdates.cs TL\Functions\Langpack\TLGetDifference.cs TL\Functions\Langpack\TLGetLangPack.cs TL\Functions\Langpack\TLGetLanguages.cs TL\Functions\Langpack\TLGetStrings.cs TL\Functions\Messages\TLBotGetCallbackAnswer.cs TL\Functions\Messages\TLCheckChatInvite.cs TL\Functions\Messages\TLClearRecentStickers.cs TL\Functions\Messages\TLDeactivateChat.cs TL\Functions\Messages\TLEditChatAdmin.cs TL\Functions\Messages\TLExportChatInvite.cs TL\Functions\Messages\TLFaveSticker.cs TL\Functions\Messages\TLGetAllDrafts.cs TL\Functions\Messages\TLGetAllStickers.cs TL\Functions\Messages\TLGetArchivedStickers.cs TL\Functions\Messages\TLGetAttachedStickers.cs TL\Functions\Messages\TLGetCommonChats.cs TL\Functions\Messages\TLGetDocumentByHash.cs TL\Functions\Messages\TLGetFavedStickers.cs TL\Functions\Messages\TLGetFeaturedStickers.cs TL\Functions\Messages\TLGetInlineBotResults.cs TL\Functions\Messages\TLGetMaskStickers.cs TL\Functions\Messages\TLGetPeerDialogs.cs TL\Functions\Messages\TLGetPeerSettings.cs TL\Functions\Messages\TLGetPinnedDialogs.cs TL\Functions\Messages\TLGetRecentLocations.cs TL\Functions\Messages\TLGetRecentStickers.cs TL\Functions\Messages\TLGetSavedGifs.cs TL\Functions\Messages\TLGetStickers.cs TL\Functions\Messages\TLGetStickerSet.cs TL\Functions\Messages\TLGetUnreadMentions.cs TL\Functions\Messages\TLGetUnusedStickers.cs TL\Functions\Messages\TLGetWebPage.cs TL\Functions\Messages\TLGetWebPagePreview.cs TL\Functions\Messages\TLHideReportSpam.cs TL\Functions\Messages\TLImportChatInvite.cs TL\Functions\Messages\TLInstallStickerSet.cs TL\Functions\Messages\TLMigrateChat.cs TL\Functions\Messages\TLReadFeaturedStickers.cs TL\Functions\Messages\TLReadMentions.cs TL\Functions\Messages\TLReorderPinnedDialogs.cs TL\Functions\Messages\TLReorderStickerSets.cs TL\Functions\Messages\TLReportSpam.cs TL\Functions\Messages\TLSaveDraft.cs TL\Functions\Messages\TLSaveGif.cs TL\Functions\Messages\TLSearchGifs.cs TL\Functions\Messages\TLSendInlineBotResult.cs TL\Functions\Messages\TLSendMultiMedia.cs TL\Functions\Messages\TLSetBotCallbackAnswer.cs TL\Functions\Messages\TLSetInlineBotResults.cs TL\Functions\Messages\TLStartBot.cs TL\Functions\Messages\TLToggleChatAdmins.cs TL\Functions\Messages\TLToggleDialogPin.cs TL\Functions\Messages\TLUninstallStickerSet.cs TL\Functions\Messages\TLUploadMedia.cs TL\Functions\Payments\TLClearSavedInfo.cs TL\Functions\Payments\TLGetPaymentForm.cs TL\Functions\Payments\TLGetPaymentReceipt.cs TL\Functions\Payments\TLGetSavedInfo.cs TL\Functions\Payments\TLSendPaymentForm.cs TL\Functions\Payments\TLValidateRequestedInfo.cs TL\Functions\Phone\TLAcceptCall.cs TL\Functions\Phone\TLConfirmCall.cs TL\Functions\Phone\TLDiscardCall.cs TL\Functions\Phone\TLGetCallConfig.cs TL\Functions\Phone\TLReceivedCall.cs TL\Functions\Phone\TLRequestCall.cs TL\Functions\Phone\TLSaveCallDebug.cs TL\Functions\Phone\TLSetCallRating.cs TL\Functions\Updates\TLGetChannelDifference.cs TL\Functions\Upload\TLGetCdnFile.cs TL\Functions\Upload\TLReuploadCdnFile.cs TL\TLAccountAuthorization.cs TL\TLAccountAuthorizations.cs TL\TLAccountDaysTTL.cs TL\TLActionInfo.cs TL\TLAdminLogResults.cs TL\TLAffectedMessages.cs TL\TLAllStrickers.cs TL\TLAppChangelogBase.cs TL\TLArchivedStickers.cs TL\TLBotCallbackAnswer.cs TL\TLBotCommand.cs TL\TLBotInfo.cs TL\TLBotInlineMessage.cs TL\TLBotInlineResult.cs TL\TLBotResults.cs TL\TLCallsSecurity.cs TL\TLCameraSettings.cs TL\TLCdnConfig.cs TL\TLCdnFile.cs TL\TLCdnPublicKey.cs TL\TLChannelAdminLogEvent.cs TL\TLChannelAdminLogEventAction.cs TL\TLChannelAdminLogEventsFilter.cs TL\TLChannelAdminRights.cs TL\TLChannelBannedRights.cs TL\TLChannelDifference.cs TL\TLChannelMessagesFiler.cs TL\TLChannelParticipant.cs TL\TLChannelParticipantRole.cs TL\TLChannelParticipantsFilter.cs TL\TLChatInvite.cs TL\TLChatSettings.cs TL\TLCodeType.cs TL\TLConfigSimple.cs TL\TLContactLink.cs TL\TLDataJSON.cs TL\TLDisabledFeature.cs TL\TLDocumentAttribute.cs TL\TLDraftMessage.cs TL\TLExportedMessageLink.cs TL\TLFavedStickers.cs TL\TLFeaturedStickers.cs TL\TLFoundGif.cs TL\TLFoundGifs.cs TL\TLGame.cs TL\TLHashtagItem.cs TL\TLHighScore.cs TL\TLHighScores.cs TL\TLInlineBotSwitchPM.cs TL\TLInputBotInlineMessage.cs TL\TLInputBotInlineMessageId.cs TL\TLInputBotInlineResult.cs TL\TLInputChatBase.cs TL\TLInputGame.cs TL\TLInputMessageEntityMentionName.cs TL\TLInputPaymentCredentials.cs TL\TLInputPhoneCall.cs TL\TLInputPrivacyKey.cs TL\TLInputPrivacyRule.cs TL\TLInputReportReason.cs TL\TLInputSingleMedia.cs TL\TLInputStickeredMedia.cs TL\TLInputStickerSet.cs TL\TLInputWebDocument.cs TL\TLInvoice.cs TL\TLIpPort.cs TL\TLKeyboardButton.cs TL\TLKeyboardButtonRow.cs TL\TLLabeledPrice.cs TL\TLLangPackDifference.cs TL\TLLangPackLanguage.cs TL\TLLangPackString.cs TL\TLMaskCoords.cs TL\TLMessageEditData.cs TL\TLMessageEntity.cs TL\TLMessageFwdHeader.cs TL\TLMessageGroup.cs TL\TLMessageRange.cs TL\TLMessagesChannelParticipants.cs TL\TLMessagesStickerSet.cs TL\TLPage.cs TL\TLPageBlock.cs TL\TLPasscodeParams.cs TL\TLPassword.cs TL\TLPasswordInputSettings.cs TL\TLPasswordRecovery.cs TL\TLPasswordSettings.cs TL\TLPaymentCharge.cs TL\TLPaymentForm.cs TL\TLPaymentReceipt.cs TL\TLPaymentRequestedInfo.cs TL\TLPaymentResult.cs TL\TLPaymentSavedCredentialsCard.cs TL\TLPeerDialogs.cs TL\TLPeerSettings.cs TL\TLPhoneCall.cs TL\TLPhoneCallDiscardReason.cs TL\TLPhoneCallProtocol.cs TL\TLPhoneConnection.cs TL\TLPhonePhoneCall.cs TL\TLPhotoPickerSettings.cs TL\TLPopularContact.cs TL\TLPostAddress.cs TL\TLPrivacyKey.cs TL\TLPrivacyRule.cs TL\TLPrivacyRules.cs TL\TLProxyConfig.cs TL\TLReceivedNotifyMessage.cs TL\TLRecentlyUsedSticker.cs TL\TLRecentMeUrl.cs TL\TLRecentMeUrls.cs TL\TLRecentStickers.cs TL\TLReplyKeyboardMarkup.cs TL\TLResolvedPeer.cs TL\TLResultInfo.cs TL\TLRichText.cs TL\TLSavedGifs.cs TL\TLSavedInfo.cs TL\TLSentChangePhoneCode.cs TL\TLSentCodeType.cs TL\TLShippingOption.cs TL\TLStickerPack.cs TL\TLStickers.cs TL\TLStickerSet.cs TL\TLStickerSetCovered.cs TL\TLStickerSetInstallResult.cs TL\TLTermsOfService.cs TL\TLTmpPassword.cs TL\TLTopPeer.cs TL\TLTopPeerCategory.cs TL\TLTopPeerCategoryPeers.cs TL\TLTopPeers.cs TL\TLValidatedRequestedInfo.cs TL\TLWebDocument.cs TL\TLWebFile.cs TL\TLWebPage.cs Transport\SocksProxy.cs WindowsPhone\BigInteger.cs WindowsPhone\Tuple.cs ..\packages\Portable.BouncyCastle.1.7.0.2\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll ..\packages\Rx-Core.2.2.5\lib\portable-win81+wpa81\System.Reactive.Core.dll ..\packages\Rx-Interfaces.2.2.5\lib\portable-win81+wpa81\System.Reactive.Interfaces.dll ..\packages\Rx-Linq.2.2.5\lib\portable-win81+wpa81\System.Reactive.Linq.dll This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. ================================================ FILE: Telegram.Api.PCL/packages.config ================================================  ================================================ FILE: Telegram.Api.WP8/Properties/AssemblyInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Api.WP8")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Api.WP8")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e79d5093-8038-4a5f-8a98-ca38c0d0886f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.Designer.cs ================================================ //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Telegram.Api.Resources { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class AppResources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal AppResources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Telegram.Api.Resources.AppResources", typeof(AppResources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized string similar to Deleted account. /// internal static string DeletedUser { get { return ResourceManager.GetString("DeletedUser", resourceCulture); } } /// /// Looks up a localized string similar to Deleted account. /// internal static string EmptyUser { get { return ResourceManager.GetString("EmptyUser", resourceCulture); } } /// /// Looks up a localized string similar to Saved messages. /// internal static string SavedMessages { get { return ResourceManager.GetString("SavedMessages", resourceCulture); } } } } ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.de.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.de.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Gelöschtes Konto Gelöschtes Konto Gespeichertes ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.es.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.es.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Cuenta eliminada Cuenta eliminada Mensajes guardados ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.it.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.it.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Account eliminato Account eliminato Messaggi salvati ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.nl.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.nl.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Verwijderd account Verwijderd account Bewaarde berichten ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.pt.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.pt.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Conta excluída Conta excluída Saved messages ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Deleted account Deleted account Saved messages ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.ru.Designer.cs ================================================ ================================================ FILE: Telegram.Api.WP8/Resources/AppResources.ru.resx ================================================  text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Удаленный аккаунт Удаленный аккаунт Избранное ================================================ FILE: Telegram.Api.WP8/Services/FileManager/IWebFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public interface IWebFileManager { void DownloadFile(TLInt dcId, TLInputWebFileGeoPointLocation file, string fileName, TLObject owner); void DownloadFile(TLInt dcId, TLInputWebFileGeoPointLocation file, string fileName, TLObject owner, System.Action callback); void CancelDownloadFile(TLObject owner); } } ================================================ FILE: Telegram.Api.WP8/Services/FileManager/WebFileManager.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.FileManager { public class WebFileManager : FileManagerBase, IWebFileManager { public WebFileManager(ITelegramEventAggregator eventAggregator, IMTProtoService mtProtoService) : base(eventAggregator, mtProtoService) { for (var i = 0; i < Constants.WorkersNumber; i++) { var worker = new Worker(OnDownloading, "webDownloader"+i); _workers.Add(worker); } } private void OnDownloading(object state) { DownloadablePart part = null; lock (_itemsSyncRoot) { for (var i = 0; i < _items.Count; i++) { var item = _items[i]; if (item.Canceled) { _items.RemoveAt(i--); try { _eventAggregator.Publish(new DownloadingCanceledEventArgs(item)); } catch (Exception e) { TLUtils.WriteException(e); } } } foreach (var item in _items) { part = item.Parts.FirstOrDefault(x => x.Status == PartStatus.Ready); if (part != null) { part.Status = PartStatus.Processing; break; } } } if (part == null) { var currentWorker = (Worker)state; currentWorker.Stop(); return; } bool canceled; ProcessFilePart(part, part.ParentItem.DCId, part.ParentItem.InputLocation, out canceled); if (canceled) { lock (_itemsSyncRoot) { part.ParentItem.Canceled = true; part.Status = PartStatus.Processed; _items.Remove(part.ParentItem); } return; } // indicate progress // indicate complete bool isComplete; bool isCanceled; var progress = 0.0; lock (_itemsSyncRoot) { part.Status = PartStatus.Processed; var data = part.File.Bytes.Data; if (data.Length < part.Limit.Value && (part.Number + 1) != part.ParentItem.Parts.Count) { var complete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!complete) { var emptyBufferSize = part.Limit.Value - data.Length; var position = data.Length; var missingPart = new DownloadablePart(part.ParentItem, new TLInt(position), new TLInt(emptyBufferSize), -part.Number); var currentItemIndex = part.ParentItem.Parts.IndexOf(part); part.ParentItem.Parts.Insert(currentItemIndex + 1, missingPart); } } isCanceled = part.ParentItem.Canceled; isComplete = part.ParentItem.Parts.All(x => x.Status == PartStatus.Processed); if (!isComplete) { var downloadedCount = part.ParentItem.Parts.Count(x => x.Status == PartStatus.Processed); var count = part.ParentItem.Parts.Count; progress = (double)downloadedCount / count; } else { _items.Remove(part.ParentItem); } } if (!isCanceled) { if (isComplete) { byte[] bytes = { }; foreach (var p in part.ParentItem.Parts) { bytes = TLUtils.Combine(bytes, p.File.Bytes.Data); } //part.ParentItem.Location.Buffer = bytes; var fileName = part.ParentItem.FileName.ToString(); StringLocker.Lock(fileName, () => FileUtils.WriteBytes(fileName, bytes)); if (part.ParentItem.Callback != null) { Execute.BeginOnThreadPool(() => { part.ParentItem.Callback.SafeInvoke(part.ParentItem); if (part.ParentItem.Callbacks != null) { foreach (var callback in part.ParentItem.Callbacks) { callback.SafeInvoke(part.ParentItem); } } }); } else { Execute.BeginOnThreadPool(() => _eventAggregator.Publish(part.ParentItem)); } } else { //Execute.BeginOnThreadPool(() => _eventAggregator.Publish(new ProgressChangedEventArgs(part.ParentItem, progress))); } } } protected DownloadableItem GetDownloadableItem(TLInt dcId, TLInputWebFileGeoPointLocation location, string fileName, TLObject owner, TLInt fileSize, Action callback) { var item = new DownloadableItem { Owner = owner, DCId = dcId, Callback = callback, InputLocation = location }; item.Parts = GetItemParts(fileSize, item); return item; } public void DownloadFile(TLInt dcId, TLInputWebFileGeoPointLocation file, string fileName, TLObject owner) { DownloadFile(dcId, file, fileName, owner, null); } public void DownloadFile(TLInt dcId, TLInputWebFileGeoPointLocation file, string fileName, TLObject owner, Action callback) { var downloadableItem = GetDownloadableItem(dcId, file, fileName, owner, new TLInt(0), callback); downloadableItem.FileName = new TLString(fileName); lock (_itemsSyncRoot) { bool addFile = true; foreach (var item in _items) { if (item.InputLocation.LocationEquals(file) && item.Owner == owner) { addFile = false; break; } } if (addFile) { _items.Add(downloadableItem); } } StartAwaitingWorkers(); } } } ================================================ FILE: Telegram.Api.WP8/Services/Location/ILiveLocationService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using Telegram.Api.TL; namespace Telegram.Api.Services.Location { public interface ILiveLocationService { void Load(); void UpdateAll(); void LoadAndUpdateAllAsync(); void Add(TLMessage70 messageBase); void UpdateAsync(TLMessage70 message, TLGeoPointBase geoPoint, Action callback, Action faultCallback = null); TLMessage Get(TLPeerBase peer, TLInt fromId); IList Get(); void Clear(); void StopAllAsync(); } } ================================================ FILE: Telegram.Api.WP8/Services/Location/LiveLocationService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Device.Location; using System.Linq; using System.Threading; using Telegram.Api.Aggregator; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Services.Location { public class LiveLocationService : ILiveLocationService, IHandle, IHandle { private readonly TLVector _messages; private readonly IMTProtoService _mtProtoService; private readonly ITelegramEventAggregator _eventAggregator; private readonly object _liveLocationsSyncRoot = new object(); private readonly Timer _timer; public LiveLocationService(IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator) { _timer = new Timer(OnTick); _timer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); _mtProtoService = mtProtoService; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); _messages = new TLVector(); } private void OnTick(object state) { UpdateAll(); SetNextTimer(); } public void LoadAndUpdateAllAsync() { Execute.BeginOnThreadPool(() => { Load(); UpdateAll(); SetNextTimer(); }); } public void StopAllAsync() { Execute.BeginOnThreadPool(() => { lock (_liveLocationsSyncRoot) { for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage70; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.Date = message.Date; mediaGeoLive.EditDate = message.EditDate; if (!mediaGeoLive.Active) { _messages.RemoveAt(i--); } } } } } TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); var messages = new List(); lock (_liveLocationsSyncRoot) { for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage70; if (message != null) { messages.Add(message); } } } if (messages.Count > 0) { var handles = new List(); foreach (var message in messages) { var m = message; var waitHandle = new ManualResetEvent(false); handles.Add(waitHandle); UpdateAsync(m, new TLGeoPointEmpty(), result => { waitHandle.Set(); }, error => { waitHandle.Set(); }); } #if DEBUG var timeout = Timeout.InfiniteTimeSpan; #else var timeout = TimeSpan.FromSeconds(30.0); #endif var noTimeout = WaitHandle.WaitAll(handles.ToArray(), timeout); if (noTimeout) { lock (_liveLocationsSyncRoot) { _messages.Clear(); } TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); _eventAggregator.Publish(new LiveLocationClearedEventArgs()); } } else { lock (_liveLocationsSyncRoot) { _messages.Clear(); } TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); _eventAggregator.Publish(new LiveLocationClearedEventArgs()); } }); } public void UpdateAll() { var removedMessages = new List(); lock (_liveLocationsSyncRoot) { for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage70; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.Date = message.Date; mediaGeoLive.EditDate = message.EditDate; if (!mediaGeoLive.Active) { removedMessages.Add(message); _messages.RemoveAt(i--); } } } } } if (removedMessages.Count > 0) { _eventAggregator.Publish(new LiveLocationRemovedEventArgs { Messages = removedMessages }); } TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); var messages = new List(); lock (_liveLocationsSyncRoot) { for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage70; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null && mediaGeoLive.Active) { var period = mediaGeoLive.Period.Value > 3600 ? 180 : 90; var clientDelta = _mtProtoService.ClientTicksDelta; //var utc0SecsLong = message.EditDate.Value * 4294967296 - clientDelta; var utc0SecsInt = message.EditDate.Value - clientDelta / 4294967296.0; var nextTime = Utils.UnixTimestampToDateTime(utc0SecsInt + period); if (nextTime <= DateTime.Now.AddSeconds(30.0)) { messages.Add(message); } } } } } if (messages.Count > 0) { GeoCoordinate location; using (var coordinateWatcher = new GeoCoordinateWatcher()) { coordinateWatcher.TryStart(false, TimeSpan.FromMilliseconds(1000)); location = coordinateWatcher.Position.Location; coordinateWatcher.Stop(); } if (!location.IsUnknown) { var handles = new List(); foreach (var message in messages) { var m = message; var waitHandle = new ManualResetEvent(false); handles.Add(waitHandle); UpdateAsync(m, new TLGeoPoint { Lat = new TLDouble(location.Latitude), Long = new TLDouble(location.Longitude) }, result => { waitHandle.Set(); }, error => { waitHandle.Set(); }); } #if DEBUG var timeout = Timeout.InfiniteTimeSpan; #else var timeout = TimeSpan.FromSeconds(30.0); #endif var noTimeout = WaitHandle.WaitAll(handles.ToArray(), timeout); } } } private void SetNextTimer() { var timeSpan = GetTimeSpan(); _timer.Change(timeSpan, Timeout.InfiniteTimeSpan); } public IList Get() { var list = new List(); lock (_liveLocationsSyncRoot) { for (var index = _messages.Count - 1; index >= 0; index--) { var messageBase = _messages[index]; var message = messageBase as TLMessage48; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.EditDate = message.EditDate; mediaGeoLive.Date = message.Date; if (mediaGeoLive.Active) { list.Add(message); } } } } } return list; } public TLMessage Get(TLPeerBase peer, TLInt fromId) { try { lock (_liveLocationsSyncRoot) { for (var index = _messages.Count - 1; index >= 0; index--) { var messageBase = _messages[index]; var message = messageBase as TLMessage48; if (message != null && message.FromId.Value == fromId.Value) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.EditDate = message.EditDate; mediaGeoLive.Date = message.Date; if (mediaGeoLive.Active) { if (peer is TLPeerUser && message.ToId is TLPeerUser && !message.Out.Value && peer.Id.Value == message.FromId.Value) { return message; } if (peer is TLPeerUser && message.ToId is TLPeerUser && message.Out.Value && peer.Id.Value == message.ToId.Id.Value) { return message; } if (peer is TLPeerChat && message.ToId is TLPeerChat && peer.Id.Value == message.ToId.Id.Value) { return message; } if (peer is TLPeerChannel && message.ToId is TLPeerChannel && peer.Id.Value == message.ToId.Id.Value) { return message; } } } } } } } catch (Exception ex) { } return null; } public void Load() { if (_messages == null) return; var messages = TLUtils.OpenObjectFromMTProtoFile>(_liveLocationsSyncRoot, Constants.LiveLocationsFileName) ?? new TLVector(); var m = new List(); lock (_liveLocationsSyncRoot) { _messages.Clear(); foreach (var messageBase in messages) { var message = messageBase as TLMessage70; if (message != null) { if (message.InputPeer == null) { return; } var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.EditDate = message.EditDate; mediaGeoLive.Date = message.Date; if (!mediaGeoLive.Active) { continue; } } _messages.Add(messageBase); m.Add(message); } } } _eventAggregator.Publish(new LiveLocationLoadedEventArgs { Messages = m }); } public void Clear() { lock (_liveLocationsSyncRoot) { _messages.Clear(); } FileUtils.Delete(_liveLocationsSyncRoot, Constants.LiveLocationsFileName); _eventAggregator.Publish(new LiveLocationClearedEventArgs()); } private TimeSpan GetTimeSpan() { var timeSpan = Timeout.InfiniteTimeSpan; lock (_liveLocationsSyncRoot) { for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage70; if (message != null) { var mediaGeoLive = message.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null && mediaGeoLive.Active) { var period = mediaGeoLive.Period.Value > 3600 ? 180 : 90; var editDate = message.EditDate != null && message.EditDate.Value > message.Date.Value ? message.EditDate.Value : message.Date.Value; // edit date + update interval var clientDelta = _mtProtoService.ClientTicksDelta; //var utc0SecsLong = editDate * 4294967296 - clientDelta; var utc0SecsInt = editDate - clientDelta / 4294967296.0; var nextEditDate1 = Utils.UnixTimestampToDateTime(utc0SecsInt + period); var timeSpan1 = nextEditDate1 - DateTime.Now; if (timeSpan1.Ticks < 0) timeSpan1 = new TimeSpan(0); // date + period //utc0SecsLong = message.Date.Value * 4294967296 - clientDelta; utc0SecsInt = message.Date.Value - clientDelta / 4294967296.0; var nextEditDate2 = Utils.UnixTimestampToDateTime(utc0SecsInt + mediaGeoLive.Period.Value); var timeSpan2 = nextEditDate2 - DateTime.Now; if (timeSpan2.Ticks < 0) timeSpan2 = new TimeSpan(0); var currentTimeSpan = timeSpan1.Ticks < timeSpan2.Ticks ? timeSpan1 : timeSpan2; if (currentTimeSpan < timeSpan || timeSpan == Timeout.InfiniteTimeSpan) { timeSpan = currentTimeSpan; } } } } } return timeSpan; } public void Add(TLMessage70 message) { message.InputPeer = _mtProtoService.PeerToInputPeer(message.ToId); lock (_liveLocationsSyncRoot) { _messages.Add(message); } SetNextTimer(); TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); _eventAggregator.Publish(new LiveLocationAddedEventArgs { Message = message }); } public void Remove(TLMessage message) { lock (_liveLocationsSyncRoot) { _messages.Remove(message); } TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); SetNextTimer(); _eventAggregator.Publish(new LiveLocationRemovedEventArgs { Messages = new List { message } }); } public void UpdateAsync(TLMessage70 message, TLGeoPointBase geoPointBase, Action callback, Action faultCallback = null) { TLMessage70 m; lock (_liveLocationsSyncRoot) { m = _messages.FirstOrDefault( x => x.Index == message.Index && ((TLMessage)x).ToId.GetType() == message.ToId.GetType() && ((TLMessage)x).ToId.Id.Value == message.ToId.Id.Value) as TLMessage70; } if (m == null || m.InputPeer == null) { faultCallback.SafeInvoke(null); return; }; var stopGeoLive = false; TLInputGeoPoint inputGeoPoint = null; var geoPoint = geoPointBase as TLGeoPoint; if (geoPoint != null) { inputGeoPoint = new TLInputGeoPoint { Lat = geoPoint.Lat, Long = geoPoint.Long }; } else { stopGeoLive = true; } _mtProtoService.EditMessageAsync(m.InputPeer, message.Id, null, null, null, null, false, stopGeoLive, inputGeoPoint, result => { m.EditDate = TLUtils.DateToUniversalTimeTLInt(_mtProtoService.ClientTicksDelta, DateTime.Now); var mediaGeoLive = m.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.EditDate = m.EditDate; } if (stopGeoLive) { Remove(m); } callback.SafeInvoke(result); }, error => { // handle 400 MESSAGE_EDIT_TIME_EXPIRED, MESSAGE_ID_INVALID, ... if (error.CodeEquals(ErrorCode.BAD_REQUEST)) { if (error.TypeEquals(ErrorType.MESSAGE_NOT_MODIFIED)) { m.EditDate = TLUtils.DateToUniversalTimeTLInt(_mtProtoService.ClientTicksDelta, DateTime.Now); var mediaGeoLive = m.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { mediaGeoLive.EditDate = m.EditDate; } } else { Remove(m); } } faultCallback.SafeInvoke(error); Execute.ShowDebugMessage("messages.editMessage error " + error); }); } private void UpdateAndRemoveAt(int i, TLMessage message, TLMessage updatedMessage) { message.Update(updatedMessage); var messageMediaGeoLive = message.Media as TLMessageMediaGeoLive; if (messageMediaGeoLive != null && !messageMediaGeoLive.Active) { _messages.RemoveAt(i); TLUtils.SaveObjectToMTProtoFile(_liveLocationsSyncRoot, Constants.LiveLocationsFileName, _messages); SetNextTimer(); _eventAggregator.Publish(new LiveLocationRemovedEventArgs { Messages = new List { message } }); } } public void Handle(TLUpdateEditMessage update) { var updatedMessage = update.Message as TLMessage; if (updatedMessage != null) { lock (_liveLocationsSyncRoot) { if (_messages == null) { Load(); } if (_messages == null) return; for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage; if (message != null && message.Index == updatedMessage.Index) { var peer = updatedMessage.ToId; if (peer is TLPeerUser && message.ToId is TLPeerUser && !message.Out.Value && peer.Id.Value == message.FromId.Value) { UpdateAndRemoveAt(i, message, updatedMessage); return; } if (peer is TLPeerUser && message.ToId is TLPeerUser && message.Out.Value && peer.Id.Value == message.ToId.Id.Value) { UpdateAndRemoveAt(i, message, updatedMessage); return; } if (peer is TLPeerChat && message.ToId is TLPeerChat && peer.Id.Value == message.ToId.Id.Value) { UpdateAndRemoveAt(i, message, updatedMessage); return; } } } } } } public void Handle(TLUpdateEditChannelMessage update) { var updatedMessage = update.Message as TLMessage; if (updatedMessage != null) { lock (_liveLocationsSyncRoot) { if (_messages == null) { Load(); } if (_messages == null) return; for (var i = 0; i < _messages.Count; i++) { var message = _messages[i] as TLMessage; if (message != null && message.Index == updatedMessage.Index) { var peer = updatedMessage.ToId; if (peer is TLPeerChannel && message.ToId is TLPeerChannel && peer.Id.Value == message.ToId.Id.Value) { UpdateAndRemoveAt(i, message, updatedMessage); return; } } } } } } } public class LiveLocationAddedEventArgs { public TLMessage Message { get; set; } } public class LiveLocationRemovedEventArgs { public IList Messages { get; set; } } public class LiveLocationClearedEventArgs { } public class LiveLocationLoadedEventArgs { public IList Messages { get; set; } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLAcceptAuthorization.cs ================================================ namespace Telegram.Api.TL.Functions.Account { class TLAcceptAuthorization : TLObject { public const uint Signature = 0xe7027c94; public TLInt BotId { get; set; } public TLString Scope { get; set; } public TLString PublicKey { get; set; } public TLVector ValueHashes { get; set; } public TLSecureCredentialsEncrypted Credentials { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), BotId.ToBytes(), Scope.ToBytes(), PublicKey.ToBytes(), ValueHashes.ToBytes(), Credentials.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLDeleteSecureValue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLDeleteSecureValue : TLObject { public const uint Signature = 0xb880bc4b; public TLVector Types { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Types.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLGetAllSecureValues.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLGetAllSecureValues : TLObject { public const uint Signature = 0xb288bc7d; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLGetAuthorizationForm.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLGetAuthorizationForm : TLObject { public const uint Signature = 0xb86ba8e1; public TLInt BotId { get; set; } public TLString Scope { get; set; } public TLString PublicKey { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), BotId.ToBytes(), Scope.ToBytes(), PublicKey.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLGetSecureValue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { public class TLGetSecureValue : TLObject { public const uint Signature = 0x73665bc2; public TLVector Types { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Types.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLGetWebAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLGetWebAuthorizations : TLObject { public const uint Signature = 0x182e6d6f; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLInitTakeoutSession.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Account { [Flags] public enum InitTakeoutSessionFlags { Contacts = 0x1, // 0 MessageUsers = 0x2, // 1 MessageChats = 0x4, // 2 MessageMegagroups = 0x8, // 3 MessageChannels = 0x10, // 4 Files = 0x20, // 5 } class TLInitTakeoutSession : TLObject { public const uint Signature = 0x768a4999; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Contacts { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.Contacts); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.Contacts); } } public bool MessageUsers { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.MessageUsers); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.MessageUsers); } } public bool MessageChats { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.MessageChats); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.MessageChats); } } public bool MessageMegagroups { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.MessageMegagroups); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.MessageMegagroups); } } public bool MessageChannels { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.MessageChannels); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.MessageChannels); } } public bool Files { get { return IsSet(_flags, (int)InitTakeoutSessionFlags.Files); } set { SetUnset(ref _flags, value, (int)InitTakeoutSessionFlags.Files); } } private TLInt _fileMaxSize; public TLInt FileMaxSize { get { return _fileMaxSize; } set { SetField(out _fileMaxSize, value, ref _flags, (int)InitTakeoutSessionFlags.Files); } } public TLLong TakeoutId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), ToBytes(_fileMaxSize, Flags, (int)InitTakeoutSessionFlags.Files), TakeoutId.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLResetWebAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLResetWebAuthorization : TLObject { public const uint Signature = 0x2d01b9ef; public TLLong Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLResetWebAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLResetWebAuthorizations : TLObject { public const uint Signature = 0x682d2594; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLSaveSecureValue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLSaveSecureValue : TLObject { public const uint Signature = 0x899fe31d; public TLInputSecureValue Value { get; set; } public TLLong SecureSecretId { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Value.ToBytes(), SecureSecretId.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLSendVerifyEmailCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLSendVerifyEmailCode : TLObject { public const uint Signature = 0x7011509f; public TLString Email { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Email.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLSendVerifyPhoneCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Account { [Flags] public enum SendVerifyPhoneCodeFlags { AllowFlashcall = 0x1, // 0 } class TLSendVerifyPhoneCode : TLObject { public const uint Signature = 0x823380b4; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLString PhoneNumber { get; set; } private TLBool _currentNumber; public TLBool CurrentNumber { get { return _currentNumber; } set { SetField(out _currentNumber, value, ref _flags, (int)SendVerifyPhoneCodeFlags.AllowFlashcall); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), PhoneNumber.ToBytes(), ToBytes(CurrentNumber, Flags, (int)SendVerifyPhoneCodeFlags.AllowFlashcall)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLVerifyEmail.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLVerifyEmail : TLObject { public const uint Signature = 0xecba39db; public TLString Email { get; set; } public TLString Code { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Email.ToBytes(), Code.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLVerifyEmailCode.cs ================================================ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Telegram.Api.TL.Functions.Account { class TLVerifyEmailCode { } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Account/TLVerifyPhone.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Account { class TLVerifyPhone : TLObject { public const uint Signature = 0x4dd3a7f6; public TLString PhoneNumber { get; set; } public TLString PhoneCodeHash { get; set; } public TLString PhoneCode { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PhoneNumber.ToBytes(), PhoneCodeHash.ToBytes(), PhoneCode.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Auth/TLBindTempAuthKey.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Auth { class TLBindTempAuthKey : TLObject { public const uint Signature = 0xcdd42a05; public TLLong PermAuthKeyId { get; set; } public TLLong Nonce { get; set; } public TLInt ExpiresAt { get; set; } public TLString EncryptedMessage { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PermAuthKeyId.ToBytes(), Nonce.ToBytes(), ExpiresAt.ToBytes(), EncryptedMessage.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Channels/TLChangeFeedBroadcast.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Channels { [Flags] public enum ChangeFeedBroadcastFlags { FeedId = 0x1 } class TLChangeFeedBroadcast : TLObject { public const uint Signature = 0xffb37511; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLInputChannelBase Channel { get; set; } private TLInt _feedId; public TLInt FeedId { get { return _feedId; } set { SetField(out _feedId, value, ref _flags, (int)ChangeFeedBroadcastFlags.FeedId); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Channel.ToBytes(), ToBytes(FeedId, Flags, (int)ChangeFeedBroadcastFlags.FeedId)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Channels/TLGetFeed.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Channels { [Flags] public enum GetFeedFlags { OffsetPosition = 0x1, MaxPosition = 0x2, MinPosition = 0x4, OffsetToMaxRead = 0x8, } class TLGetFeed : TLObject { public const uint Signature = 0xb90f450; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool OffsetToMaxRead { get { return IsSet(Flags, (int) GetFeedFlags.OffsetToMaxRead); } set { SetUnset(ref _flags, value, (int) GetFeedFlags.OffsetToMaxRead); } } public TLInt FeedId { get; set; } private TLFeedPosition _offsetPosition; public TLFeedPosition OffsetPosition { get { return _offsetPosition; } set { SetField(out _offsetPosition, value, ref _flags, (int)GetFeedFlags.OffsetPosition); } } public TLInt AddOffset { get; set; } public TLInt Limit { get; set; } private TLFeedPosition _maxPosition; public TLFeedPosition MaxPosition { get { return _maxPosition; } set { SetField(out _maxPosition, value, ref _flags, (int)GetFeedFlags.MaxPosition); } } private TLFeedPosition _minPosition; public TLFeedPosition MinPosition { get { return _minPosition; } set { SetField(out _minPosition, value, ref _flags, (int)GetFeedFlags.MinPosition); } } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), FeedId.ToBytes(), ToBytes(OffsetPosition, Flags, (int)GetFeedFlags.OffsetPosition), AddOffset.ToBytes(), Limit.ToBytes(), ToBytes(MaxPosition, Flags, (int)GetFeedFlags.MaxPosition), ToBytes(MinPosition, Flags, (int)GetFeedFlags.MinPosition), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Channels/TLReadFeed.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLReadFeed : TLObject { public const uint Signature = 0x9c3011d; public TLInt FeedId { get; set; } public TLFeedPosition MaxPosition { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FeedId.ToBytes(), MaxPosition.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Channels/TLSetFeedBroadcasts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Channels { class TLSetFeedBroadcasts : TLObject { public const uint Signature = 0xb5287d9a; public TLInt FeedId { get; set; } public TLVector Channels { get; set; } public TLBool AlsoNewlyJoined { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FeedId.ToBytes(), Channels.ToBytes(), AlsoNewlyJoined.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Contacts/TLGetSaved.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Contacts { class TLGetSaved : TLObject { public const uint Signature = 0x82f1e39f; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Help/TLGetDeepLinkInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { public class TLGetDeepLinkInfo : TLObject { public const uint Signature = 0x3fedc75f; public TLString Path { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Path.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Help/TLGetPassportConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { class TLGetPassportConfig : TLObject { public const uint Signature = 0xc661ad08; public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Help/TLGetProxyData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Help { class TLGetProxyData : TLObject { public const uint Signature = 0x3d7758e1; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLClearAllDrafts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLClearAllDrafts : TLObject { public const uint Signature = 0x7e58ee9c; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLGetDialogUnreadMarks.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLGetDialogUnreadMarks : TLObject { public const uint Signature = 0x22e24e22; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLMarkDialogUnread.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum MarkDialogUnreadFlags { Unread = 0x1 } class TLMarkDialogUnread : TLObject { public const uint Signature = 0xc286d98f; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Unread { get { return IsSet(Flags, (int)MarkDialogUnreadFlags.Unread); } set { SetUnset(ref _flags, value, (int)MarkDialogUnreadFlags.Unread); } } public TLInputDialogPeerBase Peer { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Peer.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLReport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { public class TLReport : TLObject { public const uint Signature = 0xbd82b658; public TLInputPeerBase Peer { get; set; } public TLVector Id { get; set; } public TLInputReportReasonBase Reason { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes(), Id.ToBytes(), Reason.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLSearchStickerSets.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL.Functions.Messages { [Flags] public enum SearchStickerSetsFlags { ExcludeFeatured = 0x1, } class TLSearchStickerSets : TLObject { public const uint Signature = 0xc2b7d08b; private TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool ExcludeFeatured { get { return IsSet(Flags, (int)SearchStickerSetsFlags.ExcludeFeatured); } set { SetUnset(ref _flags, value, (int)SearchStickerSetsFlags.ExcludeFeatured); } } public TLString Q { get; set; } public TLInt Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Q.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Messages/TLToggleTopPeers.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Messages { class TLToggleTopPeers : TLObject { public const uint Signature = 0x8514bdda; public TLBool Enabled { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Enabled.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Upload/TLGetWebFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Upload { public class TLGetWebFile : TLObject { public const uint Signature = 0x24e6818d; public TLInputFileLocationBase Location { get; set; } public TLInt Offset { get; set; } public TLInt Limit { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Location.ToBytes(), Offset.ToBytes(), Limit.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/Functions/Users/TLSetSecureValueErrors.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL.Functions.Users { class TLSetSecureValueErrors : TLObject { public const uint Signature = 0x90c894b5; public TLInputUserBase Id { get; set; } public TLVector Errors { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Errors.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLAppUpdate.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum AppUpdateFlags { Popup = 0x1, // 0 Document = 0x2, // 1 Url = 0x4, // 2 } public abstract class TLAppUpdateBase : TLObject { } public class TLNoAppUpdate : TLAppUpdateBase { public const uint Signature = TLConstructors.TLNoAppUpdate; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLAppUpdate : TLAppUpdateBase { public const uint Signature = TLConstructors.TLAppUpdate; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool Popup { get { return IsSet(_flags, (int)AppUpdateFlags.Popup); } set { SetUnset(ref _flags, value, (int)AppUpdateFlags.Popup); } } public TLInt Id { get; set; } public TLString Version { get; set; } public TLString Text { get; set; } public TLVector Entities { get; set; } protected TLDocumentBase _document; public TLDocumentBase Document { get { return _document; } set { SetField(out _document, value, ref _flags, (int)AppUpdateFlags.Document); } } protected TLString _url; public TLString Url { get { return _url; } set { SetField(out _url, value, ref _flags, (int)AppUpdateFlags.Url); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); Version = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); Entities = GetObject>(bytes, ref position); _document = GetObject(Flags, (int)AppUpdateFlags.Document, null, bytes, ref position); _url = GetObject(Flags, (int)AppUpdateFlags.Url, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLAuthorizationForm.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum AuthorizationFormFlags { PrivacyPolicyUrl = 0x1, // 0 SelfieRequired = 0x2, // 1 } public class TLAuthorizationForm : TLObject { public const uint Signature = TLConstructors.TLAuthorizationForm; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool SelfieRequired { get { return IsSet(Flags, (int) AuthorizationFormFlags.SelfieRequired); } } public TLVector RequiredTypes { get; set; } public TLVector Values { get; set; } public TLVector Errors { get; set; } public TLVector Users { get; set; } protected TLString _privacyPolicyUrl; public TLString PrivacyPolicyUrl { get { return _privacyPolicyUrl; } set { SetField(out _privacyPolicyUrl, value, ref _flags, (int)AuthorizationFormFlags.PrivacyPolicyUrl); } } #region Additional public TLInt BotId { get; set; } public TLString Scope { get; set; } public TLString PublicKey { get; set; } public TLString CallbackUrl { get; set; } public TLString Payload { get; set; } public TLPassportConfig Config { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); RequiredTypes = GetObject>(bytes, ref position); Values = GetObject>(bytes, ref position); Errors = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); _privacyPolicyUrl = GetObject(Flags, (int)AuthorizationFormFlags.PrivacyPolicyUrl, null, bytes, ref position); return this; } } public class TLAuthorizationForm85 : TLAuthorizationForm { public new const uint Signature = TLConstructors.TLAuthorizationForm85; public TLVector NewRequiredTypes { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); NewRequiredTypes = GetObject>(bytes, ref position); Values = GetObject>(bytes, ref position); Errors = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); _privacyPolicyUrl = GetObject(Flags, (int)AuthorizationFormFlags.PrivacyPolicyUrl, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLContactsSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ContactsSettingsFlags { SuggestFrequentContacts = 0x1, // 0 obsolete } public class TLContactsSettings : TLObject { public const uint Signature = TLConstructors.TLContactsSettings; private TLLong _flags; public TLLong Flags { get { return _flags; } set { _flags = value; } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine(TLUtils.SignatureToBytes(Signature), Flags.ToBytes()); } public override TLObject FromStream(Stream input) { Flags = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLDeepLinkInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum DeepLinkInfoFlags { UpdateApp = 0x1, // 0 Entities = 0x2, // 1 } public abstract class TLDeepLinkInfoBase : TLObject { } public class TLDeepLinkInfoEmpty : TLDeepLinkInfoBase { public const uint Signature = TLConstructors.TLDeepLinkInfoEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLDeepLinkInfo : TLDeepLinkInfoBase { public const uint Signature = TLConstructors.TLDeepLinkInfo; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool UpdateApp { get { return IsSet(Flags, (int)DeepLinkInfoFlags.UpdateApp); } } public TLString Message { get; set; } protected TLVector _entities; public TLVector Entities { get { return _entities; } set { SetField(out _entities, value, ref _flags, (int)DeepLinkInfoFlags.Entities); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); Message = GetObject(bytes, ref position); _entities = GetObject>(Flags, (int)DeepLinkInfoFlags.Entities, null, bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLDialogPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLDialogPeerBase : TLObject { } public class TLDialogPeerFeed : TLDialogPeerBase { public const uint Signature = TLConstructors.TLDialogPeerFeed; public TLInt FeedId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FeedId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), FeedId.ToBytes()); } public override TLObject FromStream(Stream input) { FeedId = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(FeedId.ToBytes()); } public override string ToString() { return "TLDialogPeer feed_id=" + FeedId; } } public class TLDialogPeer : TLDialogPeerBase { public const uint Signature = TLConstructors.TLDialogPeer; public TLPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); output.Write(Peer.ToBytes()); } public override string ToString() { return "TLDialogPeer peer=" + Peer; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLFeedBroadcasts.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLFeedBroadcastsBase : TLObject { public TLVector Channels { get; set; } } public class TLFeedBroadcastsUngrouped : TLFeedBroadcastsBase { public const uint Signature = TLConstructors.TLFeedBroadcastsUngrouped; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Channels = GetObject>(bytes, ref position); return this; } } public class TLFeedBroadcasts : TLFeedBroadcastsBase { public const uint Signature = TLConstructors.TLFeedBroadcasts; public TLInt FeedId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FeedId = GetObject(bytes, ref position); Channels = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLFeedPosition.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLFeedPosition : TLObject { public const uint Signature = TLConstructors.TLFeedPosition; public TLInt Date { get; set; } public TLPeerBase Peer { get; set; } public TLInt Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Date = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); Id = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Date.ToBytes(), Peer.ToBytes(), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Date = GetObject(input); Peer = GetObject(input); Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Date.ToStream(output); Peer.ToStream(output); Id.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLFeedSources.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum FeedSourcesFlags { NewlyJoinedFeed = 0x1 } public abstract class TLFeedSourcesBase : TLObject { } public class TLFeedSourcesNotModified : TLFeedSourcesBase { public const uint Signature = TLConstructors.TLFeedSourcesNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } } public class TLFeedSources : TLFeedSourcesBase { public const uint Signature = TLConstructors.TLFeedSources; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } protected TLInt _newlyJoinedFeed; public TLInt NewlyJoinedFeed { get { return _newlyJoinedFeed; } set { SetField(out _newlyJoinedFeed, value, ref _flags, (int)FeedSourcesFlags.NewlyJoinedFeed); } } public TLVector Feeds { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); _newlyJoinedFeed = GetObject(Flags, (int)FeedSourcesFlags.NewlyJoinedFeed, null, bytes, ref position); Feeds = GetObject>(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLFoundStickerSets.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; using Telegram.Api.Helpers; namespace Telegram.Api.TL { public abstract class TLFoundStickerSetsBase : TLObject { } public class TLFoundStickerSetsNotModified : TLFoundStickerSetsBase { public const uint Signature = TLConstructors.TLFoundStickerSetsNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLFoundStickerSets : TLFoundStickerSetsBase, IStickers { public const uint Signature = TLConstructors.TLFoundStickerSets; public TLInt HashValue { get; set; } public TLVector SetsCovered { get; set; } public TLVector Sets { get { var sets = new TLVector(); foreach (var setCovered in SetsCovered) { sets.Add(setCovered.StickerSet); } return sets; } set { Execute.ShowDebugMessage("TLFoundStickerSets.Sets set"); } } public TLVector Packs { get; set; } public TLVector Documents { get; set; } public TLVector MessagesStickerSets { get; set; } public TLString Hash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); HashValue = GetObject(bytes, ref position); SetsCovered = GetObject>(bytes, ref position); Packs = new TLVector(); Documents = new TLVector(); MessagesStickerSets = new TLVector(); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), HashValue.ToBytes(), Sets.ToBytes()); } public override TLObject FromStream(Stream input) { HashValue = GetObject(input); Sets = GetObject>(input); Packs = GetObject>(input); Documents = GetObject>(input); MessagesStickerSets = GetObject>(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); HashValue.ToStream(output); Sets.ToStream(output); Packs.ToStream(output); Documents.ToStream(output); MessagesStickerSets.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputCheckPasswordSRP.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputCheckPasswordBase : TLObject { } public class TLInputCheckPasswordEmpty : TLInputCheckPasswordBase { public const uint Signature = TLConstructors.TLInputCheckPasswordEmpty; public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLInputCheckPasswordSRP : TLInputCheckPasswordBase { public const uint Signature = TLConstructors.TLInputCheckPasswordSRP; public TLLong SRPId { get; set; } public TLString A { get; set; } public TLString M1 { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), SRPId.ToBytes(), A.ToBytes(), M1.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputClientProxy.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLInputClientProxy : TLObject { public const uint Signature = TLConstructors.TLInputClientProxy; public TLString Address { get; set; } public TLInt Port { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Address.ToBytes(), Port.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Address.ToStream(output); Port.ToStream(output); } public override TLObject FromStream(Stream input) { Address = GetObject(input); Port = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputClientProxy address={0} port={1}", Address, Port); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputDialogPeer.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputDialogPeerBase : TLObject { } public class TLInputDialogPeerFeed : TLInputDialogPeerBase { public const uint Signature = TLConstructors.TLInputDialogPeerFeed; public TLInt FeedId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); FeedId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(TLInputPeerUser.Signature), FeedId.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); FeedId.ToStream(output); } public override TLObject FromStream(Stream input) { FeedId = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputDialogPeerFeed feed_id={0}", FeedId); } } public class TLInputDialogPeer : TLInputDialogPeerBase { public const uint Signature = TLConstructors.TLInputDialogPeer; public TLInputPeerBase Peer { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Peer = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Peer.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Peer.ToStream(output); } public override TLObject FromStream(Stream input) { Peer = GetObject(input); return this; } public override string ToString() { return string.Format("TLInputDialogPeer peer={0}", Peer); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputMessage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLInputMessageBase : TLObject { } public class TLInputMessageId : TLInputMessageBase { public const uint Signature = TLConstructors.TLInputMessageId; public TLInt Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override string ToString() { return string.Format("TLInputMessageId id={0}", Id); } } public class TLInputMessageReplyTo : TLInputMessageBase { public const uint Signature = TLConstructors.TLInputMessageReplyTo; public TLInt Id { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes()); } public override TLObject FromStream(Stream input) { Id = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); } public override string ToString() { return string.Format("TLInputMessageId id={0}", Id); } } public class TLInputMessagePinned : TLInputMessageBase { public const uint Signature = TLConstructors.TLInputMessagePinned; public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature)); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override string ToString() { return "TLInputMessagePinned"; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputSecureFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLInputSecureFileBase : TLObject { } public class TLInputSecureFileUploaded : TLInputSecureFileBase { public const uint Signature = TLConstructors.TLInputSecureFileUploaded; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLString MD5Checksum { get; set; } public TLString FileHash { get; set; } public TLString Secret { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), Parts.ToBytes(), MD5Checksum.ToBytes(), FileHash.ToBytes(), Secret.ToBytes()); } } public class TLInputSecureFile : TLInputSecureFileBase { public const uint Signature = TLConstructors.TLInputSecureFile; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Id.ToBytes(), AccessHash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInputSecureValue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLInputSecureValue : TLObject { public const uint Signature = TLConstructors.TLInputSecureValue; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLSecureValueTypeBase Type { get; set; } protected TLSecureData _data; public TLSecureData Data { get { return _data; } set { SetField(out _data, value, ref _flags, (int)SecureValueFlags.Data); } } protected TLInputSecureFileBase _frontSide; public TLInputSecureFileBase FrontSide { get { return _frontSide; } set { SetField(out _frontSide, value, ref _flags, (int)SecureValueFlags.FrontSide); } } protected TLInputSecureFileBase _reverseSide; public TLInputSecureFileBase ReverseSide { get { return _reverseSide; } set { SetField(out _reverseSide, value, ref _flags, (int)SecureValueFlags.ReverseSide); } } protected TLInputSecureFileBase _selfie; public TLInputSecureFileBase Selfie { get { return _selfie; } set { SetField(out _selfie, value, ref _flags, (int)SecureValueFlags.Selfie); } } protected TLVector _files; public TLVector Files { get { return _files; } set { SetField(out _files, value, ref _flags, (int)SecureValueFlags.Files); } } protected TLSecurePlainDataBase _plainData; public TLSecurePlainDataBase PlainData { get { return _plainData; } set { SetField(out _plainData, value, ref _flags, (int)SecureValueFlags.PlainData); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Type.ToBytes(), ToBytes(Data, Flags, (int)SecureValueFlags.Data), ToBytes(_frontSide, Flags, (int)SecureValueFlags.FrontSide), ToBytes(_reverseSide, Flags, (int)SecureValueFlags.ReverseSide), ToBytes(_selfie, Flags, (int)SecureValueFlags.Selfie), ToBytes(_files, Flags, (int)SecureValueFlags.Files), ToBytes(_plainData, Flags, (int)SecureValueFlags.PlainData)); } } public class TLInputSecureValue85 : TLInputSecureValue { public new const uint Signature = TLConstructors.TLInputSecureValue85; protected TLVector _translation; public TLVector Translation { get { return _translation; } set { SetField(out _translation, value, ref _flags, (int)SecureValueFlags.Translation); } } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Flags.ToBytes(), Type.ToBytes(), ToBytes(Data, Flags, (int)SecureValueFlags.Data), ToBytes(_frontSide, Flags, (int)SecureValueFlags.FrontSide), ToBytes(_reverseSide, Flags, (int)SecureValueFlags.ReverseSide), ToBytes(_selfie, Flags, (int)SecureValueFlags.Selfie), ToBytes(_translation, Flags, (int)SecureValueFlags.Translation), ToBytes(_files, Flags, (int)SecureValueFlags.Files), ToBytes(_plainData, Flags, (int)SecureValueFlags.PlainData)); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInvokeWithMessageRange.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { class TLInvokeWithMessageRange : TLObject { public const uint Signature = 0x365275f2; public TLMessageRange Range { get; set; } public TLObject Object { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Range.ToBytes(), Object.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLInvokeWithTakeout.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLInvokeWithTakeout : TLObject { public const uint Signature = 0xaca9fd2e; public TLLong TakeoutId { get; set; } public TLObject Object { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), TakeoutId.ToBytes(), Object.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLPassportConfig.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Windows.Data.Json; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLPassportConfigBase : TLObject { } public class TLPassportConfigNotModified : TLPassportConfigBase { public const uint Signature = TLConstructors.TLPassportConfigNotModified; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLPassportConfig : TLPassportConfigBase { public const uint Signature = TLConstructors.TLPassportConfig; public TLInt Hash { get; set; } public TLDataJSON CountriesLangs { get; set; } public JsonObject CountriesLangsObject { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); CountriesLangs = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Hash = GetObject(input); CountriesLangs = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Hash.ToStream(output); CountriesLangs.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLPasswordKdfAlgo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLPasswordKdfAlgoBase : TLObject { } public class TLPasswordKdfAlgoUnknown : TLPasswordKdfAlgoBase { public const uint Signature = TLConstructors.TLPasswordKdfAlgoUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : TLPasswordKdfAlgoBase { public const uint Signature = TLConstructors.TLPasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow; public TLString Salt1 { get; set; } public TLString Salt2 { get; set; } public TLInt G { get; set; } public TLString P { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Salt1 = GetObject(bytes, ref position); Salt2 = GetObject(bytes, ref position); G = GetObject(bytes, ref position); P = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Salt1.ToBytes(), Salt2.ToBytes(), G.ToBytes(), P.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLProxyData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum ProxyDataPromoCustomFlags { //Channel = 0x1, Notified = 0x2, } public abstract class TLProxyDataBase : TLObject { public TLInt Expires { get; set; } public abstract TLProxyDataBase GetEmptyObject(); } public class TLProxyDataEmpty : TLProxyDataBase { public const uint Signature = TLConstructors.TLProxyDataEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Expires.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Expires.ToStream(output); } public override TLObject FromStream(Stream input) { Expires = GetObject(input); return this; } public override TLProxyDataBase GetEmptyObject() { return new TLProxyDataEmpty { Expires = Expires }; } } public class TLProxyDataPromo : TLProxyDataBase { public const uint Signature = TLConstructors.TLProxyDataPromo; protected TLLong _customFlags; public TLLong CustomFlags { get { return _customFlags; } set { _customFlags = value; } } public bool Notified { get { return IsSet(_customFlags, (int) ProxyDataPromoCustomFlags.Notified); } set { SetUnset(ref _customFlags, value, (int) ProxyDataPromoCustomFlags.Notified); } } public TLPeerBase Peer { get; set; } public TLVector Chats { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); Peer = GetObject(bytes, ref position); Chats = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); CustomFlags = new TLLong(0); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Expires.ToBytes(), Peer.ToBytes(), Chats.ToBytes(), Users.ToBytes()); } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Expires.ToStream(output); Peer.ToStream(output); Chats.ToStream(output); Users.ToStream(output); CustomFlags.NullableToStream(output); } public override TLObject FromStream(Stream input) { Expires = GetObject(input); Peer = GetObject(input); Chats = GetObject>(input); Users = GetObject>(input); CustomFlags = GetNullableObject(input); return this; } public override TLProxyDataBase GetEmptyObject() { return new TLProxyDataPromo { Expires = Expires, Peer = Peer, Chats = new TLVector(), Users = new TLVector(), CustomFlags = new TLLong(0) }; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSavedPhoneContact.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSavedPhoneContact : TLObject { public const uint Signature = TLConstructors.TLSavedPhoneContact; public TLString Phone { get; set; } public TLString FirstName { get; set; } public TLString LastName { get; set; } public TLInt Date { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Phone = GetObject(bytes, ref position); FirstName = GetObject(bytes, ref position); LastName = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureCredentialsEncrypted.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSecureCredentialsEncrypted : TLObject { public const uint Signature = TLConstructors.TLSecureCredentialsEncrypted; public TLString Data { get; set; } public TLString Secret { get; set; } public TLString Hash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Data = GetObject(bytes, ref position); Hash = GetObject(bytes, ref position); Secret = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Data.ToBytes(), Hash.ToBytes(), Secret.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public class TLSecureData : TLObject { public const uint Signature = TLConstructors.TLSecureData; public TLString Data { get; set; } public TLString DataHash { get; set; } public TLString Secret { get; set; } #region Additional public object DecryptedData { get; set; } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Data = GetObject(bytes, ref position); DataHash = GetObject(bytes, ref position); Secret = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Data.ToBytes(), DataHash.ToBytes(), Secret.ToBytes()); } public override TLObject FromStream(Stream input) { Data = GetObject(input); DataHash = GetObject(input); Secret = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Data.ToStream(output); DataHash.ToStream(output); Secret.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureFile.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public interface ISecureFileError { TLString FileHash { get; set; } string Error { get; set; } } public abstract class TLSecureFileBase : TLObject { private double _uploadingProgress; public double UploadingProgress { get { return _uploadingProgress; } set { SetField(ref _uploadingProgress, value, () => UploadingProgress); } } private int _uploadingSize; public int UploadingSize { get { return _uploadingSize; } set { SetField(ref _uploadingSize, value, () => UploadingSize); } } private double _downloadingProgress; public double DownloadingProgress { get { return _downloadingProgress; } set { SetField(ref _downloadingProgress, value, () => DownloadingProgress); } } public TLSecureFileBase Self { get { return this; } } public abstract TLInputSecureFileBase ToInputSecureFile(); } public class TLSecureFileEmpty : TLSecureFileBase { public const uint Signature = TLConstructors.TLSecureFileEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } public override TLInputSecureFileBase ToInputSecureFile() { return null; } } public class TLSecureFile : TLSecureFileBase, ISecureFileError { public const uint Signature = TLConstructors.TLSecureFile; public TLLong Id { get; set; } public TLLong AccessHash { get; set; } public TLInt Size { get; set; } public TLInt DCId { get; set; } public TLInt Date { get; set; } public TLString FileHash { get; set; } public TLString Secret { get; set; } public string Error { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); AccessHash = GetObject(bytes, ref position); Size = GetObject(bytes, ref position); DCId = GetObject(bytes, ref position); Date = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Secret = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Id = GetObject(input); AccessHash = GetObject(input); Size = GetObject(input); DCId = GetObject(input); Date = GetObject(input); FileHash = GetObject(input); Secret = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); AccessHash.ToStream(output); Size.ToStream(output); DCId.ToStream(output); Date.ToStream(output); FileHash.ToStream(output); Secret.ToStream(output); } public override TLInputSecureFileBase ToInputSecureFile() { return new TLInputSecureFile { Id = Id, AccessHash = AccessHash }; } } public class TLSecureFileUploaded : TLSecureFileBase, ISecureFileError { public const uint Signature = TLConstructors.TLSecureFileUploaded; public TLLong Id { get; set; } public TLInt Parts { get; set; } public TLString MD5Checksum { get; set; } public TLInt Size { get; set; } public TLInt Date { get; set; } public TLString FileHash { get; set; } public TLString Secret { get; set; } public string Error { get; set; } public override TLObject FromStream(Stream input) { Id = GetObject(input); Parts = GetObject(input); MD5Checksum = GetObject(input); Size = GetObject(input); Date = GetObject(input); FileHash = GetObject(input); Secret = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Id.ToStream(output); Parts.ToStream(output); MD5Checksum.ToStream(output); Size.ToStream(output); Date.ToStream(output); FileHash.ToStream(output); Secret.ToStream(output); } public override TLInputSecureFileBase ToInputSecureFile() { return new TLInputSecureFileUploaded { Id = Id, Parts = Parts, MD5Checksum = MD5Checksum, FileHash = FileHash, Secret = Secret }; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecurePasswordKdfAlgo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLSecurePasswordKdfAlgoBase : TLObject { } public class TLSecurePasswordKdfAlgoUnknown : TLSecurePasswordKdfAlgoBase { public const uint Signature = TLConstructors.TLSecurePasswordKdfAlgoUnknown; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } } public class TLSecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : TLSecurePasswordKdfAlgoBase { public const uint Signature = TLConstructors.TLSecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000; public TLString Salt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Salt = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Salt.ToBytes()); } } public class TLSecurePasswordKdfAlgoSHA512 : TLSecurePasswordKdfAlgoBase { public const uint Signature = TLConstructors.TLSecurePasswordKdfAlgoSHA512; public TLString Salt { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Salt = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Salt.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureRequiredType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Api.TL { [Flags] public enum SecureRequiredTypeFlags { NativeNames = 0x1, // 0 SelfieRequired = 0x2, // 1 TranslationRequired = 0x4, // 2 } public abstract class TLSecureRequiredTypeBase : TLObject { } public class TLSecureRequiredType : TLSecureRequiredTypeBase { public const uint Signature = TLConstructors.TLSecureRequiredType; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public bool NativeNames { get { return IsSet(Flags, (int)SecureRequiredTypeFlags.NativeNames); } } public bool SelfieRequired { get { return IsSet(Flags, (int)SecureRequiredTypeFlags.SelfieRequired); } } public bool TranslationRequired { get { return IsSet(Flags, (int)SecureRequiredTypeFlags.TranslationRequired); } } public TLSecureValueTypeBase Type { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); _flags = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); return this; } public override string ToString() { return string.Format("TLSecureRequiredType type={0} native_names={1} selfie={2} translation={3}", Type, NativeNames, SelfieRequired, TranslationRequired); } } public class TLSecureRequiredTypeOneOf : TLSecureRequiredTypeBase { public const uint Signature = TLConstructors.TLSecureRequiredTypeOneOf; public TLVector Types { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Types = GetObject>(bytes, ref position); return this; } public override string ToString() { return string.Format("TLSecureRequiredTypeOneOf types=[{0}]", string.Join(",", Types)); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureSecretSettings.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSecureSecretSettings : TLObject { public const uint Signature = TLConstructors.TLSecureSecretSettings; public TLSecurePasswordKdfAlgoBase SecureAlgo { get; set; } public TLString SecureSecret { get; set; } public TLLong SecureSecretId { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); SecureAlgo = GetObject(bytes, ref position); SecureSecret = GetObject(bytes, ref position); SecureSecretId = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), SecureAlgo.ToBytes(), SecureSecret.ToBytes(), SecureSecretId.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureValue.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { [Flags] public enum SecureValueFlags { Data = 0x1, // 0 FrontSide = 0x2, // 1 ReverseSide = 0x4, // 2 Selfie = 0x8, // 3 Files = 0x10, // 4 PlainData = 0x20, // 5 Translation = 0x40, // 6 } public class TLSecureValue : TLObject { public const uint Signature = TLConstructors.TLSecureValue; protected TLInt _flags; public TLInt Flags { get { return _flags; } set { _flags = value; } } public TLSecureValueTypeBase Type { get; set; } protected TLSecureData _data; public TLSecureData Data { get { return _data; } set { SetField(out _data, value, ref _flags, (int)SecureValueFlags.Data); } } protected TLSecureFileBase _frontSide; public TLSecureFileBase FrontSide { get { return _frontSide; } set { SetField(out _frontSide, value, ref _flags, (int)SecureValueFlags.FrontSide); } } protected TLSecureFileBase _reverseSide; public TLSecureFileBase ReverseSide { get { return _reverseSide; } set { SetField(out _reverseSide, value, ref _flags, (int)SecureValueFlags.ReverseSide); } } protected TLSecureFileBase _selfie; public TLSecureFileBase Selfie { get { return _selfie; } set { SetField(out _selfie, value, ref _flags, (int)SecureValueFlags.Selfie); } } protected TLVector _files; public TLVector Files { get { return _files; } set { SetField(out _files, value, ref _flags, (int)SecureValueFlags.Files); } } protected TLSecurePlainDataBase _plainData; public TLSecurePlainDataBase PlainData { get { return _plainData; } set { SetField(out _plainData, value, ref _flags, (int)SecureValueFlags.PlainData); } } public TLString Hash { get; set; } #region Additional public TLSecureValue Self { get { return this; } } #endregion public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); _data = GetObject(Flags, (int)SecureValueFlags.Data, null, bytes, ref position); _frontSide = GetObject(Flags, (int)SecureValueFlags.FrontSide, null, bytes, ref position); _reverseSide = GetObject(Flags, (int)SecureValueFlags.ReverseSide, null, bytes, ref position); _selfie = GetObject(Flags, (int)SecureValueFlags.Selfie, null, bytes, ref position); _files = GetObject>(Flags, (int)SecureValueFlags.Files, null, bytes, ref position); _plainData = GetObject(Flags, (int)SecureValueFlags.PlainData, null, bytes, ref position); Hash = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Type = GetObject(input); _data = GetObject(Flags, (int)SecureValueFlags.Data, null, input); _frontSide = GetObject(Flags, (int)SecureValueFlags.FrontSide, null, input); _reverseSide = GetObject(Flags, (int)SecureValueFlags.ReverseSide, null, input); _selfie = GetObject(Flags, (int)SecureValueFlags.Selfie, null, input); _files = GetObject>(Flags, (int)SecureValueFlags.Files, null, input); _plainData = GetObject(Flags, (int)SecureValueFlags.PlainData, null, input); Hash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Type.ToStream(output); ToStream(output, _data, Flags, (int)SecureValueFlags.Data); ToStream(output, _frontSide, Flags, (int)SecureValueFlags.FrontSide); ToStream(output, _reverseSide, Flags, (int)SecureValueFlags.ReverseSide); ToStream(output, _selfie, Flags, (int)SecureValueFlags.Selfie); ToStream(output, _files, Flags, (int)SecureValueFlags.Files); ToStream(output, _plainData, Flags, (int)SecureValueFlags.PlainData); Hash.ToStream(output); } public override string ToString() { return string.Format("TLSecureValue type={0} data={1} front_side={2} reverse_side={3} selfie={4} files={5} plain_data={6} hash={7}", Type, _data != null ? "[data]" : "null", _frontSide != null ? "[front_side]" : "null", _reverseSide != null ? "[reverse_side]" : "null", _selfie != null ? "[selfie]" : "null", _files != null ? _files.Count.ToString() : "null", _plainData != null ? "[plain_data]" : "null", Hash); } public virtual TLInputSecureValue ToInputSecureValue() { TLVector files = null; if (_files != null && _files.Count > 0) { files = new TLVector(); foreach (var file in _files) { files.Add(file.ToInputSecureFile()); } } return new TLInputSecureValue { Flags = new TLInt(0), Type = Type, Data = _data, FrontSide = _frontSide != null ? _frontSide.ToInputSecureFile() : null, ReverseSide = _reverseSide != null ? _reverseSide.ToInputSecureFile() : null, Selfie = _selfie != null ? _selfie.ToInputSecureFile() : null, Files = files, PlainData = _plainData }; } public virtual void Update(TLSecureValue result) { Flags = new TLInt(0); Type = result.Type; Data = result.Data; FrontSide = result.FrontSide; ReverseSide = result.ReverseSide; Selfie = result.Selfie; Files = result.Files; PlainData = result.PlainData; Hash = result.Hash; } } public class TLSecureValue85 : TLSecureValue { public new const uint Signature = TLConstructors.TLSecureValue85; protected TLVector _translation; public TLVector Translation { get { return _translation; } set { SetField(out _translation, value, ref _flags, (int)SecureValueFlags.Translation); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Flags = GetObject(bytes, ref position); Type = GetObject(bytes, ref position); _data = GetObject(Flags, (int)SecureValueFlags.Data, null, bytes, ref position); _frontSide = GetObject(Flags, (int)SecureValueFlags.FrontSide, null, bytes, ref position); _reverseSide = GetObject(Flags, (int)SecureValueFlags.ReverseSide, null, bytes, ref position); _selfie = GetObject(Flags, (int)SecureValueFlags.Selfie, null, bytes, ref position); _translation = GetObject>(Flags, (int)SecureValueFlags.Translation, null, bytes, ref position); _files = GetObject>(Flags, (int)SecureValueFlags.Files, null, bytes, ref position); _plainData = GetObject(Flags, (int)SecureValueFlags.PlainData, null, bytes, ref position); Hash = GetObject(bytes, ref position); return this; } public override TLObject FromStream(Stream input) { Flags = GetObject(input); Type = GetObject(input); _data = GetObject(Flags, (int)SecureValueFlags.Data, null, input); _frontSide = GetObject(Flags, (int)SecureValueFlags.FrontSide, null, input); _reverseSide = GetObject(Flags, (int)SecureValueFlags.ReverseSide, null, input); _selfie = GetObject(Flags, (int)SecureValueFlags.Selfie, null, input); _translation = GetObject>(Flags, (int)SecureValueFlags.Translation, null, input); _files = GetObject>(Flags, (int)SecureValueFlags.Files, null, input); _plainData = GetObject(Flags, (int)SecureValueFlags.PlainData, null, input); Hash = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Flags.ToStream(output); Type.ToStream(output); ToStream(output, _data, Flags, (int)SecureValueFlags.Data); ToStream(output, _frontSide, Flags, (int)SecureValueFlags.FrontSide); ToStream(output, _reverseSide, Flags, (int)SecureValueFlags.ReverseSide); ToStream(output, _selfie, Flags, (int)SecureValueFlags.Selfie); ToStream(output, _translation, Flags, (int)SecureValueFlags.Translation); ToStream(output, _files, Flags, (int)SecureValueFlags.Files); ToStream(output, _plainData, Flags, (int)SecureValueFlags.PlainData); Hash.ToStream(output); } public override string ToString() { return string.Format("TLSecureValue85 type={0} data={1} front_side={2} reverse_side={3} selfie={4} translation{5} files={6} plain_data={7} hash={8}", Type, _data != null ? "[data]" : "null", _frontSide != null ? "[front_side]" : "null", _reverseSide != null ? "[reverse_side]" : "null", _selfie != null ? "[selfie]" : "null", _translation != null ? _translation.Count.ToString() : "null", _files != null ? _files.Count.ToString() : "null", _plainData != null ? "[plain_data]" : "null", Hash); } public override TLInputSecureValue ToInputSecureValue() { TLVector files = null; if (_files != null && _files.Count > 0) { files = new TLVector(); foreach (var file in _files) { files.Add(file.ToInputSecureFile()); } } TLVector translation = null; if (_translation != null && _translation.Count > 0) { translation = new TLVector(); foreach (var file in _translation) { translation.Add(file.ToInputSecureFile()); } } return new TLInputSecureValue85 { Flags = new TLInt(0), Type = Type, Data = _data, FrontSide = _frontSide != null ? _frontSide.ToInputSecureFile() : null, ReverseSide = _reverseSide != null ? _reverseSide.ToInputSecureFile() : null, Selfie = _selfie != null ? _selfie.ToInputSecureFile() : null, Translation = translation, Files = files, PlainData = _plainData }; } public override void Update(TLSecureValue result) { base.Update(result); var result85 = result as TLSecureValue85; if (result85 != null) { Translation = result85.Translation; } } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureValueError.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLSecureValueErrorBase : TLObject { public TLSecureValueTypeBase Type { get; set; } public TLString Text { get; set; } public abstract int Priority { get; } } public class TLSecureValueError : TLSecureValueErrorBase { public const uint Signature = TLConstructors.TLSecureValueError; public TLString Hash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); Hash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 1; } } } public class TLSecureValueErrorData : TLSecureValueErrorBase { public const uint Signature = TLConstructors.TLSecureValueErrorData; public TLString DataHash { get; set; } public TLString Field { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); DataHash = GetObject(bytes, ref position); Field = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { switch (Field.ToString()) { case "first_name": return 801; case "middle_name": return 802; case "last_name": return 803; case "birth_date": return 804; case "gender": return 805; //case "country_code": // return 806; case "residence_country_code": return 807; case "document_no": return 808; case "expiry_date": return 809; case "street_line1": return 851; case "street_line2": return 852; case "post_code": return 853; case "state": return 854; case "city": return 855; case "country_code": return 856; } return 800; } } } public abstract class TLSecureValueErrorFileBase : TLSecureValueErrorBase { public TLString FileHash { get; set; } } public class TLSecureValueErrorFrontSide : TLSecureValueErrorFileBase { public const uint Signature = TLConstructors.TLSecureValueErrorFrontSide; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 100; } } } public class TLSecureValueErrorReverseSide : TLSecureValueErrorFileBase { public const uint Signature = TLConstructors.TLSecureValueErrorReverseSide; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 200; } } } public class TLSecureValueErrorSelfie : TLSecureValueErrorFileBase { public const uint Signature = TLConstructors.TLSecureValueErrorSelfie; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 300; } } } public class TLSecureValueErrorFile : TLSecureValueErrorFileBase { public const uint Signature = TLConstructors.TLSecureValueErrorFile; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 400; } } } public class TLSecureValueErrorFiles : TLSecureValueErrorBase { public const uint Signature = TLConstructors.TLSecureValueErrorFiles; public TLVector FileHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject>(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 500; } } } public class TLSecureValueErrorTranslationFile : TLSecureValueErrorFileBase { public const uint Signature = TLConstructors.TLSecureValueErrorTranslationFile; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 600; } } } public class TLSecureValueErrorTranslationFiles : TLSecureValueErrorBase { public const uint Signature = TLConstructors.TLSecureValueErrorTranslationFiles; public TLVector FileHash { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Type = GetObject(bytes, ref position); FileHash = GetObject>(bytes, ref position); Text = GetObject(bytes, ref position); return this; } public override int Priority { get { return 700; } } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureValueHash.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSecureValueHash : TLObject { public const uint Signature = TLConstructors.TLSecureValueHash; public TLSecureValueTypeBase Type { get; set; } public TLString Hash { get; set; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Type.ToBytes(), Hash.ToBytes()); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureValuePlainData.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLSecurePlainDataBase : TLObject { } public class TLSecurePlainPhone : TLSecurePlainDataBase { public const uint Signature = TLConstructors.TLSecurePlainPhone; public TLString Phone { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Phone = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Phone.ToBytes()); } public override TLObject FromStream(Stream input) { Phone = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Phone.ToStream(output); } } public class TLSecurePlainEmail : TLSecurePlainDataBase { public const uint Signature = TLConstructors.TLSecurePlainEmail; public TLString Email { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Email = GetObject(bytes, ref position); return this; } public override byte[] ToBytes() { return TLUtils.Combine( TLUtils.SignatureToBytes(Signature), Email.ToBytes()); } public override TLObject FromStream(Stream input) { Email = GetObject(input); return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); Email.ToStream(output); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSecureValueType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO; using Telegram.Api.Extensions; namespace Telegram.Api.TL { public abstract class TLSecureValueTypeBase : TLObject { } public class TLSecureValueTypePersonalDetails : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypePersonalDetails; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypePassport : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypePassport; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeDriverLicense : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeDriverLicense; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeIdentityCard : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeIdentityCard; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeInternalPassport : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeInternalPassport; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeAddress : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeAddress; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeUtilityBill : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeUtilityBill; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeBankStatement : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeBankStatement; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeRentalAgreement : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeRentalAgreement; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypePassportRegistration : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypePassportRegistration; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeTemporaryRegistration : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeTemporaryRegistration; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypePhone : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypePhone; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } public class TLSecureValueTypeEmail : TLSecureValueTypeBase { public const uint Signature = TLConstructors.TLSecureValueTypeEmail; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); return this; } public override byte[] ToBytes() { return TLUtils.SignatureToBytes(Signature); } public override TLObject FromStream(Stream input) { return this; } public override void ToStream(Stream output) { output.Write(TLUtils.SignatureToBytes(Signature)); } } } ================================================ FILE: Telegram.Api.WP8/TL/TLSentEmailCode.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLSentEmailCode : TLObject, ILength { public const uint Signature = TLConstructors.TLSentEmailCode; public TLString EmailPattern { get; set; } public TLInt Length { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); EmailPattern = GetObject(bytes, ref position); Length = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLTakeout.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLTakeout : TLObject { public const uint Signature = TLConstructors.TLTakeout; public TLLong Id { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Id = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLTermsOfServiceUpdate.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public abstract class TLTermsOfServiceUpdateBase : TLObject { public TLInt Expires { get; set; } } public class TLTermsOfServiceUpdate : TLTermsOfServiceUpdateBase { public const uint Signature = TLConstructors.TLTermsOfServiceUpdate; public TLTermsOfServiceBase TermsOfService { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); TermsOfService = GetObject(bytes, ref position); return this; } } public class TLTermsOfServiceUpdateEmpty : TLTermsOfServiceUpdateBase { public const uint Signature = TLConstructors.TLTermsOfServiceUpdateEmpty; public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Expires = GetObject(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLWebAuthorization.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.Text; using System.Threading; using Telegram.Api.Services.Cache; namespace Telegram.Api.TL { public class TLWebAuthorization : TLObject { public const uint Signature = TLConstructors.TLWebAuthorization; public TLLong Hash { get; set; } public TLInt BotId { get; set; } public TLString Domain { get; set; } public TLString Browser { get; set; } public TLString Platform { get; set; } public TLInt DateCreated { get; set; } public TLInt DateActive { get; set; } public TLString Ip { get; set; } public TLString Region { get; set; } public string Caption { get { var domain = Domain.ToString() .Replace("https://", string.Empty) .Replace("http://", string.Empty) .Replace("www.", string.Empty); var index = domain.IndexOf('.'); if (index > 0) { var result = domain.Substring(0, index); if (!string.IsNullOrEmpty(result)) { return char.ToUpper(result[0]) + result.Substring(1); } } return Domain.ToString(); } } public string Location { get { return string.Format("{0} – {1}", Ip, Region); } } public TLUserBase Bot { get { var cacheService = InMemoryCacheService.Instance; return cacheService.GetUser(BotId); } } public string ParamsString { get { return string.Join(", ", Params); } } public IEnumerable Params { get { if (Bot != null) yield return Bot.FullName; if (!TLString.IsNullOrEmpty(Browser)) yield return Browser.ToString(); if (!TLString.IsNullOrEmpty(Platform)) yield return Platform.ToString(); } } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Hash = GetObject(bytes, ref position); BotId = GetObject(bytes, ref position); Domain = GetObject(bytes, ref position); Browser = GetObject(bytes, ref position); Platform = GetObject(bytes, ref position); DateCreated = GetObject(bytes, ref position); DateActive = GetObject(bytes, ref position); Ip = GetObject(bytes, ref position); Region = GetObject(bytes, ref position); return this; } public void Update(TLWebAuthorization authorization) { Hash = authorization.Hash; BotId = authorization.BotId; Domain = authorization.Domain; Browser = authorization.Browser; Platform = authorization.Platform; DateCreated = authorization.DateCreated; DateActive = authorization.DateActive; Ip = authorization.Ip; Region = authorization.Region; } } } ================================================ FILE: Telegram.Api.WP8/TL/TLWebAuthorizations.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Api.TL { public class TLWebAuthorizations : TLObject { public const uint Signature = TLConstructors.TLWebAuthorizations; public TLVector Authorizations { get; set; } public TLVector Users { get; set; } public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); Authorizations = GetObject>(bytes, ref position); Users = GetObject>(bytes, ref position); return this; } } } ================================================ FILE: Telegram.Api.WP8/Telegram.Api.WP8.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {E79D5093-8038-4A5F-8A98-CA38C0D0886F} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.Api Telegram.Api WindowsPhone v8.1 false true 12.0 true ..\ true en-US true full false Bin\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 true full false Bin\x86\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 pdbonly true Bin\x86\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 true full false Bin\ARM\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 pdbonly true Bin\ARM\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;LOG_REGISTRATION;WP8 true true prompt 4 Compression\GZipDeflateStream.cs Constants.cs Hash\CRC32\CRC.cs Extensions\ActionExtensions.cs Extensions\HttpWebRequestExtensions.cs Extensions\StreamExtensions.cs Extensions\TLObjectExtensions.cs Helpers\Execute.cs Helpers\FileUtils.cs Helpers\SettingsHelper.cs Helpers\Utils.cs Hash\MD5\MD5.cs Hash\MD5\MD5CryptoServiceProvider.cs Hash\MD5\MD5Managed.cs Services\Cache\Context.cs Services\Cache\EventArgs\DialogAddedEventArgs.cs Services\Cache\EventArgs\TopMessageUpdatedEventArgs.cs Services\Cache\ICacheService.cs Services\Cache\InMemoryCacheService.cs Services\Cache\InMemoryDatabase.cs Services\Connection\ConnectionService.cs Services\DCOptionItem.cs Services\DelayedItem.cs Services\FileManager\AudioFileManager.cs Services\FileManager\DocumentFileManager.cs Services\FileManager\DownloadableItem.cs Services\FileManager\DownloadablePart.cs Services\FileManager\DownloadingCanceledEventArgs.cs Services\FileManager\EncryptedFileManager.cs Services\FileManager\FileManager.cs Services\FileManager\IAudioFileManager.cs Services\FileManager\IDocumentFileManager.cs Services\FileManager\IEncryptedFileManager.cs Services\FileManager\IFileManager.cs Services\FileManager\IUploadAudioFileManager.cs Services\FileManager\IUploadFileManager.cs Services\FileManager\IUploadVideoFileManager.cs Services\FileManager\IVideoFileManager.cs Services\FileManager\ProgressChangedEventArgs.cs Services\FileManager\UploadAudioFileManager.cs Services\FileManager\UploadFileManager.cs Services\FileManager\UploadVideoFileManager.cs Services\FileManager\VideoFileManager.cs Services\FileManager\Worker.cs Services\HistoryItem.cs Services\IMTProtoService.cs Services\MTProtoService.Account.cs Services\MTProtoService.Auth.cs Services\MTProtoService.ByTransport.cs Services\MTProtoService.Config.cs Services\MTProtoService.Contacts.cs Services\MTProtoService.cs Services\MTProtoService.DHKeyExchange.cs Services\MTProtoService.Help.cs Services\MTProtoService.Helpers.cs Services\MTProtoService.HttpLongPoll.cs Services\MTProtoService.Messages.cs Services\MTProtoService.Photos.cs Services\MTProtoService.SecretChats.cs Services\MTProtoService.SendingQueue.cs Services\MTProtoService.Stuff.cs Services\MTProtoService.Updates.cs Services\MTProtoService.Upload.cs Services\MTProtoService.Users.cs Services\ServiceBase.cs Services\Updates\IUpdatesService.cs Services\Updates\ReceiveUpdatesEventArgs.cs Services\Updates\UpdatesBySeqComparer.cs Services\Updates\UpdatesService.cs TL\Functions\Account\TLCheckUsername.cs TL\Functions\Account\TLDeleteAccount.cs TL\Functions\Account\TLGetAccountTTL.cs TL\Functions\Account\TLGetNotifySettings.cs TL\Functions\Account\TLGetPrivacy.cs TL\Functions\Account\TLRegisterDevice.cs TL\Functions\Account\TLResetNotifySettings.cs TL\Functions\Account\TLSetPrivacy.cs TL\Functions\Account\TLUnregisterDevice.cs TL\Functions\Account\TLUpdateNotifySettings.cs TL\Functions\Account\TLUpdateProfile.cs TL\Functions\Account\TLUpdateStatus.cs TL\Functions\Account\TLUpdateUserName.cs TL\Functions\Auth\TLCheckPhone.cs TL\Functions\Auth\TLExportAuthorization.cs TL\Functions\Auth\TLImportAuthorization.cs TL\Functions\Auth\TLLogOut.cs TL\Functions\Auth\TLResetAuthorizations.cs TL\Functions\Auth\TLSendCall.cs TL\Functions\Auth\TLSendCode.cs TL\Functions\Auth\TLSendInvites.cs TL\Functions\Auth\TLSendSms.cs TL\Functions\Auth\TLSignIn.cs TL\Functions\Auth\TLSignUp.cs TL\Functions\Contacts\TLBlock.cs TL\Functions\Contacts\TLDeleteContact.cs TL\Functions\Contacts\TLDeleteContacts.cs TL\Functions\Contacts\TLGetBlocked.cs TL\Functions\Contacts\TLGetContacts.cs TL\Functions\Contacts\TLGetStatuses.cs TL\Functions\Contacts\TLImportContacts.cs TL\Functions\Contacts\TLSearch.cs TL\Functions\Contacts\TLUnblock.cs TL\Functions\DHKeyExchange\TLReqDHParams.cs TL\Functions\DHKeyExchange\TLReqPQ.cs TL\Functions\DHKeyExchange\TLSetClientDHParams.cs TL\Functions\Help\TLGetConfig.cs TL\Functions\Help\TLGetInviteText.cs TL\Functions\Help\TLGetNearestDC.cs TL\Functions\Help\TLGetSupport.cs TL\Functions\Help\TLInvokeWithLayerN.cs TL\Functions\Messages\TLAcceptEncryption.cs TL\Functions\Messages\TLAddChatUser.cs TL\Functions\Messages\TLCreateChat.cs TL\Functions\Messages\TLDeleteChatUser.cs TL\Functions\Messages\TLDeleteHistory.cs TL\Functions\Messages\TLDeleteMessages.cs TL\Functions\Messages\TLDiscardEncryption.cs TL\Functions\Messages\TLEditChatPhoto.cs TL\Functions\Messages\TLEditChatTitle.cs TL\Functions\Messages\TLForwardMessage.cs TL\Functions\Messages\TLForwardMessages.cs TL\Functions\Messages\TLGetChats.cs TL\Functions\Messages\TLGetDHConfig.cs TL\Functions\Messages\TLGetDialogs.cs TL\Functions\Messages\TLGetFullChat.cs TL\Functions\Messages\TLGetHistory.cs TL\Functions\Messages\TLGetMessages.cs TL\Functions\Messages\TLReadEncryptedHistory.cs TL\Functions\Messages\TLReadHistory.cs TL\Functions\Messages\TLReadMessageContents.cs TL\Functions\Messages\TLReceivedMessages.cs TL\Functions\Messages\TLReceivedQueue.cs TL\Functions\Messages\TLRequestEncryption.cs TL\Functions\Messages\TLRestoreMessages.cs TL\Functions\Messages\TLSearch.cs TL\Functions\Messages\TLSendBroadcast.cs TL\Functions\Messages\TLSendEncrypted.cs TL\Functions\Messages\TLSendEncryptedFile.cs TL\Functions\Messages\TLSendEncryptedService.cs TL\Functions\Messages\TLSendMedia.cs TL\Functions\Messages\TLSendMessage.cs TL\Functions\Messages\TLSetEncryptedTyping.cs TL\Functions\Messages\TLSetTyping.cs TL\Functions\Photos\TLGetUserPhotos.cs TL\Functions\Photos\TLUpdateProfilePhoto.cs TL\Functions\Photos\TLUploadProfilePhoto.cs TL\Functions\Stuff\TLGetFutureSalts.cs TL\Functions\Stuff\TLHttpWait.cs TL\Functions\Stuff\TLMessageAcknowledgments.cs TL\Functions\Stuff\TLRPCDropAnswer.cs TL\Functions\Updates\TLGetDifference.cs TL\Functions\Updates\TLGetState.cs TL\Functions\Upload\TLGetFile.cs TL\Functions\Upload\TLSaveFilePart.cs TL\Functions\Users\TLGetFullUser.cs TL\Functions\Users\TLGetUsers.cs TL\Interfaces\IBytes.cs TL\Interfaces\IFullName.cs TL\Interfaces\IInputPeer.cs TL\Interfaces\ISelectable.cs TL\Interfaces\IVIsibility.cs TL\TLAffectedHistory.cs TL\TLAudio.cs TL\TLAuthorization.cs TL\TLBadMessageNotification.cs TL\TLBadServerSalt.cs TL\TLBool.cs TL\TLChat.cs TL\TLChatFull.cs TL\TLChatParticipant.cs TL\TLChatParticipants.cs TL\TLChats.cs TL\TLCheckedPhone.cs TL\TLClientDHInnerData.cs TL\TLConfig.cs TL\TLContact.cs TL\TLContactBlocked.cs TL\TLContactFound.cs TL\TLContacts.cs TL\TLContactsBlocked.cs TL\TLContactsFound.cs TL\TLContactStatus.cs TL\TLContainerTransportMessage.cs TL\TLDCOption.cs TL\TLDecryptedMessage.cs TL\TLDecryptedMessageAction.cs TL\TLDecryptedMessageLayer.cs TL\TLDecryptedMessageMedia.cs TL\TLDHConfig.cs TL\TLDHGen.cs TL\TLDialog.cs TL\TLDialogs.cs TL\TLDifference.cs TL\TLDocument.cs TL\TLDouble.cs TL\TLEncryptedChat.cs TL\TLEncryptedFile.cs TL\TLEncryptedMessage.cs TL\TLExportedAuthorization.cs TL\TLFile.cs TL\TLFileLocation.cs TL\TLFileType.cs TL\TLForeignLink.cs TL\TLFutureSalt.cs TL\TLGeoPoint.cs TL\TLGzipPacked.cs TL\TLImportedContact.cs TL\TLImportedContacts.cs TL\TLInitConnection.cs TL\TLInputAudio.cs TL\TLInputChatPhoto.cs TL\TLInputContact.cs TL\TLInputDocument.cs TL\TLInputEncryptedChat.cs TL\TLInputEncryptedFile.cs TL\TLInputEncryptedFileLocation.cs TL\TLInputFile.cs TL\TLInputFileLocation.cs TL\TLInputGeoPoint.cs TL\TLInputMedia.cs TL\TLInputMessagesFilter.cs TL\TLInputNotifyPeer.cs TL\TLInputPeerBase.cs TL\TLInputPeerNotifyEvents.cs TL\TLInputPeerNotifySettings.cs TL\TLInputPhoto.cs TL\TLInputPhotoCrop.cs TL\TLInputUser.cs TL\TLInputVideo.cs TL\TLInt.cs TL\TLInt128.cs TL\TLInt256.cs TL\TLInviteText.cs TL\TLInvokeAfterMsg.cs TL\TLLink.cs TL\TLLong.cs TL\TLMessage.cs TL\TLMessage.Encrypted.cs TL\TLMessageAction.cs TL\TLMessageContainer.cs TL\TLMessageInfo.cs TL\TLMessageMedia.cs TL\TLMessages.cs TL\TLMessagesAcknowledgment.cs TL\TLMessagesChatFull.cs TL\TLMyLink.cs TL\TLNearestDC.cs TL\TLNewSessionCreated.cs TL\TLNonEncryptedMessage.cs TL\TLNotifyPeer.cs TL\TLNull.cs TL\TLObject.cs TL\TLObjectGenerator.cs TL\TLPeer.cs TL\TLPeerNotifyEvents.cs TL\TLPeerNotifySettings.cs TL\TLPhoto.cs TL\TLPhotos.cs TL\TLPhotoSize.cs TL\TLPhotosPhoto.cs TL\TLPong.cs TL\TLPQInnerData.cs TL\TLResponse.cs TL\TLResPQ.cs TL\TLRPCDropAnswer.cs TL\TLRPCError.cs TL\TLRPCResult.cs TL\TLSendMessageAction.cs TL\TLSentCode.cs TL\TLSentEncryptedFile.cs TL\TLSentEncryptedMessage.cs TL\TLSentMessage.cs TL\TLServerDHInnerData.cs TL\TLServerDHParams.cs TL\TLServerFile.cs TL\TLSignatures.cs TL\TLState.cs TL\TLStatedMessage.cs TL\TLStatedMessages.cs TL\TLString.cs TL\TLSupport.cs TL\TLUpdate.cs TL\TLUpdates.cs TL\TLUserBase.cs TL\TLUserFull.cs TL\TLUserStatus.cs TL\TLUtils.cs TL\TLUtils.Log.cs TL\TLVector.cs TL\TLVideo.cs TL\TLWallpaperSolid.cs Transport\DataEventArgs.cs Transport\HttpTransport.cs Transport\ITransport.cs Transport\ITransportService.cs Transport\TCPTransport.cs Transport\TCPTransportBase.cs Transport\TCPTransportResult.cs Transport\TransportService.cs Aggregator\EventAggregator.cs Aggregator\ExtensionMethods.cs Helpers\Notifications.cs Logs\Log.cs Services\Connection\PublicConfigService.cs Services\DeviceInfo\EmptyDeviceInfoService.cs Services\DeviceInfo\IDeviceInfo.cs Services\FileManager\FileManagerBase.cs Services\MTProtoService.Channel.cs Services\MTProtoService.Langpack.cs Services\MTProtoService.Payments.cs Services\MTProtoService.Phone.cs TL\Functions\Account\TLChangePhone.cs TL\Functions\Account\TLCheckPassword.cs TL\Functions\Account\TLConfirmPhone.cs TL\Functions\Account\TLGetAuthorizations.cs TL\Functions\Account\TLGetPassword.cs TL\Functions\Account\TLGetPasswordSettings.cs TL\Functions\Account\TLGetTmpPassword.cs TL\Functions\Account\TLGetWallPapers.cs TL\Functions\Account\TLRecoverPassword.cs TL\Functions\Account\TLReportPeer.cs TL\Functions\Account\TLRequestPasswordRecovery.cs TL\Functions\Account\TLResetAuthorization.cs TL\Functions\Account\TLResetPassword.cs TL\Functions\Account\TLSendChangePhoneCode.cs TL\Functions\Account\TLSendConfirmPhoneCode.cs TL\Functions\Account\TLSetPassword.cs TL\Functions\Account\TLUpdateDeviceLocked.cs TL\Functions\Account\TLUpdatePasswordSettings.cs TL\Functions\Auth\TLCancelCode.cs TL\Functions\Auth\TLResendCode.cs TL\Functions\Channels\TLCheckUsername.cs TL\Functions\Channels\TLCreateChannel.cs TL\Functions\Channels\TLDeleteChannel.cs TL\Functions\Channels\TLDeleteChannelMessages.cs TL\Functions\Channels\TLDeleteHistory.cs TL\Functions\Channels\TLDeleteUserHistory.cs TL\Functions\Channels\TLEditAbout.cs TL\Functions\Channels\TLEditAdmin.cs TL\Functions\Channels\TLEditMessage.cs TL\Functions\Channels\TLEditPhoto.cs TL\Functions\Channels\TLEditTitle.cs TL\Functions\Channels\TLExportInvite.cs TL\Functions\Channels\TLExportMessageLink.cs TL\Functions\Channels\TLGetAdminedPublicChannels.cs TL\Functions\Channels\TLGetChannels.cs TL\Functions\Channels\TLGetDialogs.cs TL\Functions\Channels\TLGetFullChannel.cs TL\Functions\Channels\TLGetImportantHistory.cs TL\Functions\Channels\TLGetMessageEditData.cs TL\Functions\Channels\TLGetMessages.cs TL\Functions\Channels\TLGetParticipant.cs TL\Functions\Channels\TLGetParticipants.cs TL\Functions\Channels\TLInviteToChannel.cs TL\Functions\Channels\TLJoinChannel.cs TL\Functions\Channels\TLKickFromChannel.cs TL\Functions\Channels\TLLeaveChannel.cs TL\Functions\Channels\TLReadHistory.cs TL\Functions\Channels\TLReadMessageContents.cs TL\Functions\Channels\TLReportSpam.cs TL\Functions\Channels\TLSetStickers.cs TL\Functions\Channels\TLToggleComments.cs TL\Functions\Channels\TLToggleInvites.cs TL\Functions\Channels\TLTogglePreHistoryHidden.cs TL\Functions\Channels\TLToggleSignatures.cs TL\Functions\Channels\TLUpdateChannelUsername.cs TL\Functions\Channels\TLUpdatePinnedMessage.cs TL\Functions\Contacts\TLGetTopPeers.cs TL\Functions\Contacts\TLResetSaved.cs TL\Functions\Contacts\TLResetTopPeerRating.cs TL\Functions\Contacts\TLResolveUsername.cs TL\Functions\Help\TLGetAppChangelog.cs TL\Functions\Help\TLGetCdnConfig.cs TL\Functions\Help\TLGetRecentMeUrls.cs TL\Functions\Help\TLGetTermsOfService.cs TL\Functions\Help\TLInvokeWithoutUpdates.cs TL\Functions\Langpack\TLGetDifference.cs TL\Functions\Langpack\TLGetLangPack.cs TL\Functions\Langpack\TLGetLanguages.cs TL\Functions\Langpack\TLGetStrings.cs TL\Functions\Messages\TLBotGetCallbackAnswer.cs TL\Functions\Messages\TLCheckChatInvite.cs TL\Functions\Messages\TLClearRecentStickers.cs TL\Functions\Messages\TLDeactivateChat.cs TL\Functions\Messages\TLEditChatAdmin.cs TL\Functions\Messages\TLExportChatInvite.cs TL\Functions\Messages\TLFaveSticker.cs TL\Functions\Messages\TLGetAllDrafts.cs TL\Functions\Messages\TLGetAllStickers.cs TL\Functions\Messages\TLGetArchivedStickers.cs TL\Functions\Messages\TLGetAttachedStickers.cs TL\Functions\Messages\TLGetCommonChats.cs TL\Functions\Messages\TLGetDocumentByHash.cs TL\Functions\Messages\TLGetFavedStickers.cs TL\Functions\Messages\TLGetFeaturedStickers.cs TL\Functions\Messages\TLGetInlineBotResults.cs TL\Functions\Messages\TLGetMaskStickers.cs TL\Functions\Messages\TLGetPeerDialogs.cs TL\Functions\Messages\TLGetPeerSettings.cs TL\Functions\Messages\TLGetPinnedDialogs.cs TL\Functions\Messages\TLGetRecentLocations.cs TL\Functions\Messages\TLGetRecentStickers.cs TL\Functions\Messages\TLGetSavedGifs.cs TL\Functions\Messages\TLGetStickers.cs TL\Functions\Messages\TLGetStickerSet.cs TL\Functions\Messages\TLGetUnreadMentions.cs TL\Functions\Messages\TLGetUnusedStickers.cs TL\TLGetWebPage.cs TL\Functions\Messages\TLGetWebPagePreview.cs TL\Functions\Messages\TLHideReportSpam.cs TL\Functions\Messages\TLImportChatInvite.cs TL\Functions\Messages\TLInstallStickerSet.cs TL\Functions\Messages\TLMigrateChat.cs TL\Functions\Messages\TLReadFeaturedStickers.cs TL\Functions\Messages\TLReadMentions.cs TL\Functions\Messages\TLReorderPinnedDialogs.cs TL\Functions\Messages\TLReorderStickerSets.cs TL\Functions\Messages\TLReportSpam.cs TL\Functions\Messages\TLSaveDraft.cs TL\Functions\Messages\TLSaveGif.cs TL\Functions\Messages\TLSearchGifs.cs TL\Functions\Messages\TLSendInlineBotResult.cs TL\Functions\Messages\TLSendMultiMedia.cs TL\Functions\Messages\TLSetBotCallbackAnswer.cs TL\Functions\Messages\TLSetInlineBotResults.cs TL\Functions\Messages\TLStartBot.cs TL\Functions\Messages\TLToggleChatAdmins.cs TL\Functions\Messages\TLToggleDialogPin.cs TL\Functions\Messages\TLUninstallStickerSet.cs TL\Functions\Messages\TLUploadMedia.cs TL\Functions\Payments\TLClearSavedInfo.cs TL\Functions\Payments\TLGetPaymentForm.cs TL\Functions\Payments\TLGetPaymentReceipt.cs TL\Functions\Payments\TLGetSavedInfo.cs TL\Functions\Payments\TLSendPaymentForm.cs TL\Functions\Payments\TLValidateRequestedInfo.cs TL\Functions\Phone\TLAcceptCall.cs TL\Functions\Phone\TLConfirmCall.cs TL\Functions\Phone\TLDiscardCall.cs TL\Functions\Phone\TLGetCallConfig.cs TL\Functions\Phone\TLReceivedCall.cs TL\Functions\Phone\TLRequestCall.cs TL\Functions\Phone\TLSaveCallDebug.cs TL\Functions\Phone\TLSetCallRating.cs TL\Functions\Updates\TLGetChannelDifference.cs TL\Functions\Upload\TLGetCdnFile.cs TL\Functions\Upload\TLReuploadCdnFile.cs TL\TLAccountAuthorization.cs TL\TLAccountAuthorizations.cs TL\TLAccountDaysTTL.cs TL\TLActionInfo.cs TL\TLAdminLogResults.cs TL\TLAffectedMessages.cs TL\TLAllStrickers.cs TL\TLAppChangelogBase.cs TL\TLArchivedStickers.cs TL\TLBotCallbackAnswer.cs TL\TLBotCommand.cs TL\TLBotInfo.cs TL\TLBotInlineMessage.cs TL\TLBotInlineResult.cs TL\TLBotResults.cs TL\TLCallsSecurity.cs TL\TLCameraSettings.cs TL\TLCdnConfig.cs TL\TLCdnFile.cs TL\TLCdnPublicKey.cs TL\TLChannelAdminLogEvent.cs TL\TLChannelAdminLogEventAction.cs TL\TLChannelAdminLogEventsFilter.cs TL\TLChannelAdminRights.cs TL\TLChannelBannedRights.cs TL\TLChannelDifference.cs TL\TLChannelMessagesFiler.cs TL\TLChannelParticipant.cs TL\TLChannelParticipantRole.cs TL\TLChannelParticipantsFilter.cs TL\TLChatInvite.cs TL\TLChatSettings.cs TL\TLCodeType.cs TL\TLConfigSimple.cs TL\TLContactLink.cs TL\TLDataJSON.cs TL\TLDisabledFeature.cs TL\TLDocumentAttribute.cs TL\TLDraftMessage.cs TL\TLExportedMessageLink.cs TL\TLFavedStickers.cs TL\TLFeaturedStickers.cs TL\TLFoundGif.cs TL\TLFoundGifs.cs TL\TLGame.cs TL\TLHashtagItem.cs TL\TLHighScore.cs TL\TLHighScores.cs TL\TLInlineBotSwitchPM.cs TL\TLInputBotInlineMessage.cs TL\TLInputBotInlineMessageId.cs TL\TLInputBotInlineResult.cs TL\TLInputChatBase.cs TL\TLInputGame.cs TL\TLInputMessageEntityMentionName.cs TL\TLInputPaymentCredentials.cs TL\TLInputPhoneCall.cs TL\TLInputPrivacyKey.cs TL\TLInputPrivacyRule.cs TL\TLInputReportReason.cs TL\TLInputSingleMedia.cs TL\TLInputStickeredMedia.cs TL\TLInputStickerSet.cs TL\TLInputWebDocument.cs TL\TLInvoice.cs TL\TLIpPort.cs TL\TLKeyboardButton.cs TL\TLKeyboardButtonRow.cs TL\TLLabeledPrice.cs TL\TLLangPackDifference.cs TL\TLLangPackLanguage.cs TL\TLLangPackString.cs TL\TLMaskCoords.cs TL\TLMessageEditData.cs TL\TLMessageEntity.cs TL\TLMessageFwdHeader.cs TL\TLMessageGroup.cs TL\TLMessageRange.cs TL\TLMessagesChannelParticipants.cs TL\TLMessagesStickerSet.cs TL\TLPage.cs TL\TLPageBlock.cs TL\TLPasscodeParams.cs TL\TLPassword.cs TL\TLPasswordInputSettings.cs TL\TLPasswordRecovery.cs TL\TLPasswordSettings.cs TL\TLPaymentCharge.cs TL\TLPaymentForm.cs TL\TLPaymentReceipt.cs TL\TLPaymentRequestedInfo.cs TL\TLPaymentResult.cs TL\TLPaymentSavedCredentialsCard.cs TL\TLPeerDialogs.cs TL\TLPeerSettings.cs TL\TLPhoneCall.cs TL\TLPhoneCallDiscardReason.cs TL\TLPhoneCallProtocol.cs TL\TLPhoneConnection.cs TL\TLPhonePhoneCall.cs TL\TLPhotoPickerSettings.cs TL\TLPopularContact.cs TL\TLPostAddress.cs TL\TLPrivacyKey.cs TL\TLPrivacyRule.cs TL\TLPrivacyRules.cs TL\TLProxyConfig.cs TL\TLReceivedNotifyMessage.cs TL\TLRecentlyUsedSticker.cs TL\TLRecentMeUrl.cs TL\TLRecentMeUrls.cs TL\TLRecentStickers.cs TL\TLReplyKeyboardMarkup.cs TL\TLResolvedPeer.cs TL\TLResultInfo.cs TL\TLRichText.cs TL\TLSavedGifs.cs TL\TLSavedInfo.cs TL\TLSentChangePhoneCode.cs TL\TLSentCodeType.cs TL\TLShippingOption.cs TL\TLStickerPack.cs TL\TLStickers.cs TL\TLStickerSet.cs TL\TLStickerSetCovered.cs TL\TLStickerSetInstallResult.cs TL\TLTermsOfService.cs TL\TLTmpPassword.cs TL\TLTopPeer.cs TL\TLTopPeerCategory.cs TL\TLTopPeerCategoryPeers.cs TL\TLTopPeers.cs TL\TLValidatedRequestedInfo.cs TL\TLWebDocument.cs TL\TLWebFile.cs TL\TLWebPage.cs Transport\SocksProxy.cs WindowsPhone\BigInteger.cs WindowsPhone\Tuple.cs AppResources.ru.resx True True AppResources.pt.resx True True AppResources.nl.resx True True AppResources.it.resx True True AppResources.es.resx True True AppResources.de.resx True True True True AppResources.resx ..\packages\Portable.BouncyCastle.1.7.0.2\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10\crypto.dll ..\packages\Rx-Core.2.2.2\lib\windowsphone71\System.Reactive.Core.dll ..\packages\Rx-Linq.2.2.2\lib\windowsphone71\System.Reactive.Linq.dll ..\packages\Rx-Interfaces.2.2.2\lib\windowsphone71\System.Reactive.Interfaces.dll ResXFileCodeGenerator AppResources.ru.Designer.cs ResXFileCodeGenerator AppResources.pt.Designer.cs ResXFileCodeGenerator AppResources.nl.Designer.cs ResXFileCodeGenerator AppResources.it.Designer.cs ResXFileCodeGenerator AppResources.es.Designer.cs ResXFileCodeGenerator AppResources.de.Designer.cs ResXFileCodeGenerator AppResources.Designer.cs {cc7a35bf-aabc-411d-b911-ac037a781266} libtgnet This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. ================================================ FILE: Telegram.Api.WP8/Transport/NativeTcpTransport.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using Windows.Networking; using libtgnet; using Telegram.Api.Extensions; using Telegram.Api.TL; namespace Telegram.Api.Transport { public class NativeTcpTransport : TcpTransportBase { private readonly ConnectionSocketWrapper _wrapper; private bool _isConnected; private readonly List, Action>> _requests = new List, Action>>(); public override ulong Ping { get { ulong ping; lock (SyncRoot) { ping = _wrapper != null ? _wrapper.GetPing() : 0; } return ping; } } private ProxySettings _proxySettings; public NativeTcpTransport(string host, int port, string staticHost, int staticPort, MTProtoTransportType mtProtoType, short protocolDCId, byte[] protocolSecret, TLProxyConfigBase proxyConfig) : base(host, port, staticHost, staticPort, mtProtoType, proxyConfig) { // System.Diagnostics.Debug.WriteLine( // " [NativeTcpTransport] .ctor begin host={0} port={1} static_host={2} static_port={3} type={4} protocol_dcid={5} protocol_secret={6} proxy={7}", // host, port, staticHost, staticPort, mtProtoType, protocolDCId, protocolSecret, proxyConfig); ActualHost = host; ActualPort = port; var ipv4 = true; ProxySettings proxySettings = null; if (proxyConfig != null && proxyConfig.IsEnabled.Value && !proxyConfig.IsEmpty) { var socks5Proxy = proxyConfig.GetProxy() as TLSocks5Proxy; if (socks5Proxy != null) { try { ipv4 = new HostName(socks5Proxy.Server.ToString()).Type == HostNameType.Ipv4; } catch (Exception ex) { } proxySettings = new ProxySettings { Type = ProxyType.Socks5, Host = socks5Proxy.Server.ToString(), Port = socks5Proxy.Port.Value, Username = socks5Proxy.Username.ToString(), Password = socks5Proxy.Password.ToString(), IPv4 = ipv4 }; ActualHost = staticHost; ActualPort = staticPort; protocolSecret = null; protocolDCId = protocolDCId; } var mtProtoProxy = proxyConfig.GetProxy() as TLMTProtoProxy; if (mtProtoProxy != null) { try { ipv4 = new HostName(mtProtoProxy.Server.ToString()).Type == HostNameType.Ipv4; } catch (Exception ex) { } proxySettings = new ProxySettings { Type = ProxyType.MTProto, Host = mtProtoProxy.Server.ToString(), Port = mtProtoProxy.Port.Value, Secret = TLUtils.ParseSecret(mtProtoProxy.Secret), IPv4 = ipv4 }; ActualHost = staticHost; ActualPort = staticPort; } } try { ipv4 = new HostName(ActualHost).Type == HostNameType.Ipv4; } catch (Exception ex) { } var connectionSettings = new ConnectionSettings { Host = ActualHost, Port = ActualPort, IPv4 = ipv4, ProtocolDCId = protocolDCId, ProtocolSecret = protocolSecret }; _proxySettings = proxySettings; // var proxyString = proxySettings == null // ? "null" // : string.Format("[host={0} port={1} ipv4={2} type={3} secret={4} username={5} password={6}]", // proxySettings.Host, // proxySettings.Port, // proxySettings.IPv4, // proxySettings.Type, // proxySettings.Secret, // proxySettings.Username, // proxySettings.Password); // System.Diagnostics.Debug.WriteLine( // " [NativeTcpTransport] .ctor end host={0} port={1} ipv4={2} protocol_dcid={3} protocol_secret={4} proxy={5}", // connectionSettings.Host, connectionSettings.Port, connectionSettings.IPv4, connectionSettings.ProtocolDCId, connectionSettings.ProtocolSecret, proxyString); _wrapper = new ConnectionSocketWrapper(connectionSettings, proxySettings); _wrapper.Closed += Wrapper_OnClosed; _wrapper.PacketReceived += Wrapper_OnPacketReceived; } private void Wrapper_OnPacketReceived(ConnectionSocketWrapper sender, byte[] data) { LastReceiveTime = DateTime.Now; StopCheckConfigTimer(); RaiseConnectedAsync(); lock (SyncRoot) { _isConnected = true; } Helpers.Execute.BeginOnThreadPool(() => { RaisePacketReceived(new DataEventArgs(data)); }); } private void Wrapper_OnClosed(ConnectionSocketWrapper sender) { RaiseConnectionLost(); } ~NativeTcpTransport() { } private void LOG(string message) { System.Diagnostics.Debug.WriteLine("NativeTcpTransport " + Host + " " + message); } public override void SendPacketAsync(string caption, byte[] data, Action callback, Action faultCallback = null) { var now = DateTime.Now; if (!FirstSendTime.HasValue) { FirstSendTime = now; } Helpers.Execute.BeginOnThreadPool(() => { var isConnected = false; var isConnecting = false; var result = -1; lock (SyncRoot) { isConnected = _isConnected; if (!isConnected) { _requests.Add(new Tuple, Action>(data, callback, faultCallback)); isConnecting = _requests.Count == 1; } } if (isConnected) { lock (SyncRoot) { try { result = _wrapper.SendPacket(data); } catch (Exception ex) { } } if (result > 0 && result < data.Length) { Helpers.Execute.ShowDebugMessage(string.Format("NativeTransport Send req={0} sent={1}", data.Length, result)); callback.SafeInvoke(true); } else if (result > 0) { callback.SafeInvoke(true); } else { faultCallback.SafeInvoke(new TcpTransportResult(new Exception("NativeTCPTransport error=" + result))); } return; } if (isConnecting) { RaiseConnectingAsync(); result = -1; try { //LOG("Connect start"); result = _wrapper.Connect(); //LOG("Connect end"); } catch (Exception ex) { } isConnected = result > 0; if (!isConnected) { List, Action>> requests; lock (SyncRoot) { _isConnected = false; requests = new List, Action>>(_requests); _requests.Clear(); } if (requests.Count > 0) { for (var i = 0; i < requests.Count; i++) { requests[i].Item3.SafeInvoke(new TcpTransportResult(new Exception("NativeTCPTransport connect error=" + result))); } } } else { Helpers.Execute.BeginOnThreadPool(() => { try { _wrapper.StartReceive(); } catch (Exception ex) { } }); List, Action>> requests; lock (SyncRoot) { _isConnected = true; requests = new List, Action>>(_requests); _requests.Clear(); } if (requests.Count > 0) { for (var i = 0; i < requests.Count; i++) { lock (SyncRoot) { try { result = _wrapper.SendPacket(requests[i].Item1); } catch (Exception ex) { } } if (result > 0 && result < requests[i].Item1.Length) { Helpers.Execute.ShowDebugMessage(string.Format("NativeTransport Send req={0} sent={1}", requests[i].Item1.Length, result)); requests[i].Item2.SafeInvoke(true); } else if (result > 0) { requests[i].Item2.SafeInvoke(true); } else { requests[i].Item3.SafeInvoke(new TcpTransportResult(new Exception("NativeTCPTransport error=" + result))); } } } } } }); } public override void Close() { WRITE_LOG(string.Format("Close socket {2} {0}:{1}", Host, Port, Id)); List, Action>> requests; lock (SyncRoot) { if (Closed) { return; } try { _wrapper.Closed -= Wrapper_OnClosed; _wrapper.PacketReceived -= Wrapper_OnPacketReceived; _wrapper.Close(); } catch (Exception ex) { Helpers.Execute.ShowDebugMessage("NativeTCPTransport.Close ex " + ex); } Closed = true; requests = new List, Action>>(_requests); _requests.Clear(); StopCheckConfigTimer(); } if (requests.Count > 0) { for (var i = 0; i < requests.Count; i++) { requests[i].Item3.SafeInvoke(new TcpTransportResult(new Exception("NativeTCPTransport closed"))); } } } public override string GetTransportInfo() { return string.Empty; } } } ================================================ FILE: Telegram.Api.WP8/Transport/TCPTransportWinRT.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // #define TCP_OBFUSCATED_2 using System; using System.Collections.Generic; using System.Globalization; using System.Text; using System.Threading; using System.Threading.Tasks; using Windows.Foundation; using Windows.Networking; using Windows.Networking.Sockets; using Windows.Storage.Streams; using Telegram.Api.Extensions; using Telegram.Api.Helpers; using Telegram.Api.TL; namespace Telegram.Api.Transport { public class TcpTransportWinRT : TcpTransportBase { private readonly StreamSocket _socket; private readonly object _isConnectedSyncRoot = new object(); private bool _isConnected; private readonly object _dataWriterSyncRoot = new object(); private readonly DataReader _dataReader; private readonly DataWriter _dataWriter; private readonly double _timeout; public TcpTransportWinRT(string host, int port, string staticHost, int staticPort, MTProtoTransportType mtProtoType, TLProxyConfigBase proxyConfig) : base(host, port, staticHost, staticPort, mtProtoType, proxyConfig) { _timeout = 25.0; _socket = new StreamSocket(); var control = _socket.Control; control.QualityOfService = SocketQualityOfService.LowLatency; _dataReader = new DataReader(_socket.InputStream) { InputStreamOptions = InputStreamOptions.Partial }; _dataWriter = new DataWriter(_socket.OutputStream); } #if TCP_OBFUSCATED_2 private byte[] GetInitBufferInternal() { var buffer = new byte[64]; var random = new Random(); while (true) { random.NextBytes(buffer); var val = (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | (buffer[0]); var val2 = (buffer[7] << 24) | (buffer[6] << 16) | (buffer[5] << 8) | (buffer[4]); if (buffer[0] != 0xef && val != 0x44414548 && val != 0x54534f50 && val != 0x20544547 && val != 0x4954504f && val != 0xeeeeeeee && val2 != 0x00000000) { buffer[56] = buffer[57] = buffer[58] = buffer[59] = 0xef; break; } } var keyIvEncrypt = buffer.SubArray(8, 48); EncryptKey = keyIvEncrypt.SubArray(0, 32); EncryptIV = keyIvEncrypt.SubArray(32, 16); //Array.Reverse(EncryptIV); Array.Reverse(keyIvEncrypt); DecryptKey = keyIvEncrypt.SubArray(0, 32); DecryptIV = keyIvEncrypt.SubArray(32, 16); //Array.Reverse(DecryptIV); //var shortStamp = BitConverter.GetBytes(0xefefefef); //for (var i = 0; i < shortStamp.Length; i++) //{ // buffer[56 + i] = shortStamp[i]; //} var encryptedBuffer = Encrypt(buffer); for (var i = 56; i < encryptedBuffer.Length; i++) { buffer[i] = encryptedBuffer[i]; } return buffer; } protected override byte[] GetInitBuffer() { return GetInitBufferInternal(); } #endif private async Task ConnectAsync(double timeout, Action faultCallback) { TLSocks5Proxy socks5Proxy = ProxyConfig != null && ProxyConfig.IsEnabled.Value && !ProxyConfig.IsEmpty ? ProxyConfig.GetProxy() as TLSocks5Proxy : null; if (socks5Proxy != null) { try { ActualHost = StaticHost; ActualPort = StaticPort; RaiseConnectingAsync(); await SocksProxy.ConnectToSocks5Proxy(timeout, _socket, _dataWriter, _dataReader, socks5Proxy.Server.ToString(), (ushort)socks5Proxy.Port.Value, StaticHost, (ushort)StaticPort, socks5Proxy.Username.ToString(), socks5Proxy.Password.ToString()); lock (_dataWriterSyncRoot) { var buffer = GetInitBufferInternal(); _dataWriter.WriteBytes(buffer); var result = _dataWriter.StoreAsync().AsTask().Result; } lock (_isConnectedSyncRoot) { _isConnecting = false; _isConnected = true; } } catch (Exception ex) { var status = SocketError.GetStatus(ex.HResult); WRITE_LOG("TCPTransportWinRT.ConnectAsync " + status, ex); var error = SocketError.GetStatus(ex.HResult); faultCallback.SafeInvoke(new TcpTransportResult(ex)); return false; } } else { try { ActualHost = Host; ActualPort = Port; RaiseConnectingAsync(); //var address = IPAddress.IsValidIPv6(Host); await _socket.ConnectAsync(new HostName(Host), Port.ToString(CultureInfo.InvariantCulture)).WithTimeout(timeout); lock (_dataWriterSyncRoot) { var buffer = GetInitBufferInternal(); _dataWriter.WriteBytes(buffer); } lock (_isConnectedSyncRoot) { _isConnecting = false; _isConnected = true; } } catch (Exception ex) { var status = SocketError.GetStatus(ex.HResult); WRITE_LOG("TCPTransportWinRT.ConnectAsync " + status, ex); var error = SocketError.GetStatus(ex.HResult); faultCallback.SafeInvoke(new TcpTransportResult(ex)); return false; } } return true; } private async Task SendAsync(double timeout, byte[] data, Action faultCallback) { try { #if TCP_OBFUSCATED_2 lock (_dataWriterSyncRoot) { data = Encrypt(data); _dataWriter.WriteBytes(data); } var storeResult = await _dataWriter.StoreAsync(); #else lock (_dataWriterSyncRoot) { _dataWriter.WriteBytes(data); } var storeResult = await _dataWriter.StoreAsync();//.WithTimeout(timeout); #endif } catch (Exception ex) { var status = SocketError.GetStatus(ex.HResult); WRITE_LOG("TCPTransportWinRT.SendAsync " + status, ex); faultCallback.SafeInvoke(new TcpTransportResult(ex)); return false; } return true; } private async void ReceiveAsync(double timeout) { while (true) { if (Closed) { return; } int bytesTransferred = 0; try { bytesTransferred = (int)await _dataReader.LoadAsync(64); //WithTimeout(timeout); } catch (Exception ex) { //Log.Write(string.Format(" TCPTransport.ReceiveAsync transport={0} LoadAsync exception={1}", Id, ex)); var status = SocketError.GetStatus(ex.HResult); WRITE_LOG("ReceiveAsync DataReader.LoadAsync " + status, ex); if (ex is ObjectDisposedException) { return; } } if (bytesTransferred > 0) { //Log.Write(string.Format(" TCPTransport.ReceiveAsync transport={0} bytes_transferred={1}", Id, bytesTransferred)); var now = DateTime.Now; if (!FirstReceiveTime.HasValue) { FirstReceiveTime = now; RaiseConnectedAsync(); } LastReceiveTime = now; var buffer = new byte[_dataReader.UnconsumedBufferLength]; _dataReader.ReadBytes(buffer); #if TCP_OBFUSCATED_2 buffer = Decrypt(buffer); #endif OnBufferReceived(buffer, 0, bytesTransferred); } else { //Log.Write(string.Format(" TCPTransport.ReceiveAsync transport={0} bytes_transferred={1} closed={2}", Id, bytesTransferred, Closed)); if (!Closed) { Closed = true; RaiseConnectionLost(); Execute.ShowDebugMessage("TCPTransportWinRT ReceiveAsync connection lost bytesTransferred=0; close transport"); } } } } private bool _isConnecting; private readonly List>> _queue = new List>>(); public override void SendPacketAsync(string caption, byte[] data, Action callback, Action faultCallback = null) { var now = DateTime.Now; if (!FirstSendTime.HasValue) { FirstSendTime = now; } Execute.BeginOnThreadPool(async () => { bool connect = false; bool isConnected; lock (_isConnectedSyncRoot) { isConnected = _isConnected; if (!_isConnected && !_isConnecting) { _isConnecting = true; connect = true; } if (connect && caption.StartsWith("msgs_ack")) { Execute.ShowDebugMessage("TCPTransportWinRT connect on msgs_ack"); connect = false; } } if (!isConnected) { if (connect) { var connectResult = await ConnectAsync(_timeout, faultCallback); if (!connectResult) return; //var buffer = GetInitBuffer(); //var sendResult = await SendAsync(_timeout, buffer, faultCallback); //if (!sendResult) return; ReceiveAsync(_timeout); SendQueue(_timeout); } else { Enqueue(caption, data, faultCallback); return; } } var sendPacketResult = await SendAsync(_timeout, CreatePacket(data), faultCallback); if (!sendPacketResult) return; callback.SafeInvoke(true); }); } private void Enqueue(string caption, byte[] data, Action faultCallback) { lock (_isConnectedSyncRoot) { _queue.Add(new Tuple>(caption, data, faultCallback)); } } private void SendQueue(double timeout) { var queue = new List>>(); var info = new StringBuilder(); info.Append("SendQueue"); lock (_isConnectedSyncRoot) { foreach (var tuple in _queue) { queue.Add(tuple); info.AppendLine(tuple.Item1); } _queue.Clear(); } //Execute.ShowDebugMessage(info.ToString()); foreach (var tuple in queue) { SendAsync(timeout, CreatePacket(tuple.Item2), tuple.Item3); } } public override void Close() { Closed = true; if (_socket != null) { _socket.Dispose(); } StopCheckConfigTimer(); } public override string GetTransportInfo() { var info = new StringBuilder(); info.AppendLine("TCP_WinRT transport"); info.AppendLine(string.Format("Socket {0}:{1}, Connected={2}, HashCode={3}", Host, Port, _isConnected, _socket.GetHashCode())); info.AppendLine(string.Format("LastReceiveTime={0}", LastReceiveTime.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); info.AppendLine(string.Format("FirstSendTime={0}", FirstSendTime.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture))); return info.ToString(); } } public static class AsyncExtensions { public static async Task WithTimeout(this IAsyncAction task, double timeout) { var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeout)); await task.AsTask(cts.Token); } public static async Task WithTimeout(this IAsyncOperation task, double timeout) { var cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeout)); return await task.AsTask(cts.Token); } } } ================================================ FILE: Telegram.Api.WP8/packages.config ================================================  ================================================ FILE: Telegram.Client.TileUpdated/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Client.TileUpdated")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Client.TileUpdated")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8c9a6178-3edd-4995-92e5-194220a0ece6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.Client.TileUpdated/ScheduledAgent.cs ================================================ using System; using System.Collections.Generic; using System.IO.IsolatedStorage; using System.Linq; using System.Threading; using System.Windows; using System.Windows.Threading; //using Caliburn.Micro; using Mangopollo.Tiles; using Microsoft.Phone.Scheduler; using Microsoft.Phone.Shell; using Telegram.Api; using Telegram.Api.Helpers; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Updates; using Telegram.Api.Transport; namespace Telegram.Client.TileUpdated { public class ScheduledAgent : ScheduledTaskAgent { private static volatile bool _classInitialized; /// /// ScheduledAgent constructor, initializes the UnhandledException handler /// public ScheduledAgent() { if (!_classInitialized) { _classInitialized = true; // Subscribe to the managed exception handler Deployment.Current.Dispatcher.BeginInvoke(delegate { Application.Current.UnhandledException += ScheduledAgent_UnhandledException; }); } } /// Code to execute on Unhandled Exceptions private void ScheduledAgent_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (System.Diagnostics.Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger System.Diagnostics.Debugger.Break(); } } /// /// Agent that runs a scheduled task /// /// /// The invoked task /// /// /// This method is called when a periodic or resource intensive task is invoked /// protected override void OnInvoke(ScheduledTask task) { /*var manualResetEvent = new ManualResetEvent(false); var eventAggregator = new EventAggregator(); var cacheService = new InMemoryCacheService(eventAggregator); var updatesService = new UpdatesService(cacheService, eventAggregator); //TODO: Add code to perform your task in background var mtProtoService = new MTProtoService(updatesService, cacheService, new TransportService()); mtProtoService.GetStateAsync( state => { var unreadCount = state.UnreadCount.Value; Deployment.Current.Dispatcher.BeginInvoke(() => { //var shellTileData = Mangopollo.Utils.CanUseLiveTiles // ? (ShellTileData)new IconicTileData { Count = unreadCount } // : new StandardTileData {Count = unreadCount}; var shellTileData = new StandardTileData { Count = unreadCount }; var tile = ShellTile.ActiveTiles.FirstOrDefault(); if (tile != null) { tile.Update(shellTileData); } //if (previousUnreadCount < unreadCount) //{ // //_previousUnreadCount = unreadCount; // var toast = new ShellToast // { // Content = string.Format("Previous - {0}, current - {1}", previousUnreadCount, unreadCount), // Title = "Telegram", // NavigationUri = new System.Uri("/Views/ShellView.xaml", System.UriKind.Relative) // }; // settings["UnreadCountKey"] = unreadCount; // toast.Show(); //} manualResetEvent.Set(); }); }, error => { manualResetEvent.Set(); }); manualResetEvent.WaitOne(20000);*/ NotifyComplete(); } } } ================================================ FILE: Telegram.Client.TileUpdated/Telegram.Client.TileUpdated.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {8C9A6178-3EDD-4995-92E5-194220A0ECE6} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.Client.TileUpdated Telegram.Client.TileUpdated v4.0 $(TargetFrameworkVersion) WindowsPhone71 Silverlight false true true ScheduledTaskAgent ..\ true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true bin\Debug Private Beta\ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true full AnyCPU prompt MinimumRecommendedRules.ruleset bin\Release Private Beta\ TRACE;SILVERLIGHT;WINDOWS_PHONE true true pdbonly AnyCPU prompt MinimumRecommendedRules.ruleset ..\..\..\Vkontakte\Libraries\Caliburn.Micro.dll ..\packages\Mangopollo.Light.1.3\lib\sl4-windowsphone71\Mangopollo.Light.dll {0C2F1B61-A8FE-45FB-8538-AA6925A415B6} Telegram.Api ================================================ FILE: Telegram.Client.TileUpdated/packages.config ================================================  ================================================ FILE: Telegram.Controls/AnimationMediator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Globalization; using System.Windows; using System.Windows.Controls; namespace Telegram.Controls { /// /// Class that acts as a Mediator between a Storyboard animation and a /// Transform used by the Silverlight Toolkit's LayoutTransformer. /// /// /// Works around an issue with the Silverlight platform where changes to /// properties of child Transforms assigned to a Transform property do not /// trigger the top-level property changed handler (as on WPF). /// public class AnimationMediator : FrameworkElement { /// /// Gets or sets a reference to the LayoutTransformer to update. /// //public LayoutTransformer LayoutTransformer { get; set; } public static readonly DependencyProperty LayoutTransformerProperty = DependencyProperty.Register("LayoutTransformer", typeof (LayoutTransformer), typeof (AnimationMediator), new PropertyMetadata(default(LayoutTransformer))); public LayoutTransformer LayoutTransformer { get { return (LayoutTransformer) GetValue(LayoutTransformerProperty); } set { SetValue(LayoutTransformerProperty, value); } } /// /// Gets or sets the name of the LayoutTransformer to update. /// /// /// This property is used iff the LayoutTransformer property is null. /// public string LayoutTransformerName { get { return _layoutTransformerName; } set { _layoutTransformerName = value; // Force a new name lookup LayoutTransformer = null; } } private string _layoutTransformerName; /// /// Gets or sets the value being animated. /// public double AnimationValue { get { return (double)GetValue(AnimationValueProperty); } set { SetValue(AnimationValueProperty, value); } } public static readonly DependencyProperty AnimationValueProperty = DependencyProperty.Register( "AnimationValue", typeof(double), typeof(AnimationMediator), new PropertyMetadata(AnimationValuePropertyChanged)); private static void AnimationValuePropertyChanged( DependencyObject o, DependencyPropertyChangedEventArgs e) { //Debug.WriteLine(e.NewValue); ((AnimationMediator)o).AnimationValuePropertyChanged(); } private void AnimationValuePropertyChanged() { if (null == LayoutTransformer) { // No LayoutTransformer set; try to find it by LayoutTransformerName LayoutTransformer = FindName(LayoutTransformerName) as LayoutTransformer; if (null == LayoutTransformer) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "AnimationMediator was unable to find a LayoutTransformer named \"{0}\".", LayoutTransformerName)); } } // The Transform hasn't been updated yet; schedule an update to run after it has Dispatcher.BeginInvoke(() => LayoutTransformer.ApplyLayoutTransform()); } } } ================================================ FILE: Telegram.Controls/BindingListener.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Windows; using System.Windows.Data; namespace DanielVaughan.WindowsPhone7Unleashed { public class BindingListener { public delegate void ChangedHandler(object sender, BindingChangedEventArgs e); static readonly List freeListeners = new List(); readonly ChangedHandler changedHandler; Binding binding; DependencyPropertyListener listener; FrameworkElement target; object value; public BindingListener(ChangedHandler changedHandler) { this.changedHandler = changedHandler; } public Binding Binding { get { return binding; } set { binding = value; Attach(); } } public FrameworkElement Element { get { return target; } set { target = value; Attach(); } } public object Value { get { return value; } } void Attach() { Detach(); if (target != null && binding != null) { listener = GetListener(); listener.Attach(target, binding); } } void Detach() { if (listener != null) { this.listener.Detach(); // This is not called in the original samples ReturnListener(); } } DependencyPropertyListener GetListener() { DependencyPropertyListener listener; if (freeListeners.Count != 0) { listener = freeListeners[freeListeners.Count - 1]; freeListeners.RemoveAt(freeListeners.Count - 1); //return listener; //Memory leak here } listener = new DependencyPropertyListener(); listener.Changed += HandleValueChanged; return listener; } void ReturnListener() { listener.Changed -= HandleValueChanged; freeListeners.Add(listener); listener = null; } void HandleValueChanged(object sender, BindingChangedEventArgs e) { value = e.EventArgs.NewValue; changedHandler(this, e); } } public class DependencyPropertyListener { static int index; readonly DependencyProperty property; FrameworkElement target; public DependencyPropertyListener() { property = DependencyProperty.RegisterAttached( "DependencyPropertyListener" + index++, typeof(object), typeof(DependencyPropertyListener), new PropertyMetadata(null, HandleValueChanged)); } public event EventHandler Changed; void HandleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { OnChanged(new BindingChangedEventArgs(e)); } protected void OnChanged(BindingChangedEventArgs e) { var temp = Changed; if (temp != null) { temp(target, e); } } public void Attach(FrameworkElement element, Binding binding) { if (target != null) { throw new Exception( "Cannot attach an already attached listener"); } target = element; target.SetBinding(property, binding); } public void Detach() { if (target == null) return; target.ClearValue(property); target = null; } } public class BindingChangedEventArgs : EventArgs { public BindingChangedEventArgs(DependencyPropertyChangedEventArgs e) { EventArgs = e; } public DependencyPropertyChangedEventArgs EventArgs { get; private set; } } } ================================================ FILE: Telegram.Controls/Extensions/ScrollViewerExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media.Animation; namespace Telegram.Controls.Extensions { /// /// Provides useful extensions to ScrollViewer instances. /// /// /// Experimental public static class ScrollViewerExtensions { /// /// The amount to scroll a ScrollViewer for a line change. /// /// private const double LineChange = 16.0; /// /// Identifies the IsMouseWheelScrollingEnabled dependency property. /// /// public static readonly DependencyProperty IsMouseWheelScrollingEnabledProperty; /// /// Identifies the VerticalOffset dependency property. /// /// private static readonly DependencyProperty VerticalOffsetProperty; /// /// Identifies the HorizontalOffset dependency property. /// /// private static readonly DependencyProperty HorizontalOffsetProperty; static ScrollViewerExtensions() { // ISSUE: method pointer ScrollViewerExtensions.IsMouseWheelScrollingEnabledProperty = DependencyProperty.RegisterAttached("IsMouseWheelScrollingEnabled", typeof(bool), typeof(ScrollViewerExtensions), new PropertyMetadata((object)false, new PropertyChangedCallback(OnIsMouseWheelScrollingEnabledPropertyChanged))); // ISSUE: method pointer ScrollViewerExtensions.VerticalOffsetProperty = DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollViewerExtensions), new PropertyMetadata(new PropertyChangedCallback(OnVerticalOffsetPropertyChanged))); // ISSUE: method pointer ScrollViewerExtensions.HorizontalOffsetProperty = DependencyProperty.RegisterAttached("HorizontalOffset", typeof(double), typeof(ScrollViewerExtensions), new PropertyMetadata(new PropertyChangedCallback(OnHorizontalOffsetPropertyChanged))); } /// /// Gets a value indicating whether the ScrollViewer has enabled /// scrolling via the mouse wheel. /// /// /// The ScrollViewer. /// /// A value indicating whether the ScrollViewer has enabled scrolling /// via the mouse wheel. /// /// public static bool GetIsMouseWheelScrollingEnabled(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); else return (bool)viewer.GetValue(ScrollViewerExtensions.IsMouseWheelScrollingEnabledProperty); } /// /// Sets a value indicating whether the ScrollViewer will enable /// scrolling via the mouse wheel. /// /// /// The ScrollViewer.A value indicating whether the ScrollViewer will enable scrolling /// via the mouse wheel. /// public static void SetIsMouseWheelScrollingEnabled(this ScrollViewer viewer, bool value) { if (viewer == null) throw new ArgumentNullException("viewer"); viewer.SetValue(ScrollViewerExtensions.IsMouseWheelScrollingEnabledProperty, (value ? 1 : 0)); } /// /// IsMouseWheelScrollingEnabledProperty property changed handler. /// /// /// ScrollViewerExtensions that changed its IsMouseWheelScrollingEnabled.Event arguments. private static void OnIsMouseWheelScrollingEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ScrollViewer scrollViewer = d as ScrollViewer; if ((bool)e.NewValue) { // ISSUE: method pointer scrollViewer.MouseWheel += new MouseWheelEventHandler(OnMouseWheel); } else { // ISSUE: method pointer scrollViewer.MouseWheel -= new MouseWheelEventHandler(OnMouseWheel); } } /// /// Handles the mouse wheel event. /// /// /// The ScrollViewer.Event arguments. private static void OnMouseWheel(object sender, MouseWheelEventArgs e) { ScrollViewer viewer = sender as ScrollViewer; Debug.Assert(viewer != null, "sender should be a non-null ScrollViewer!"); Debug.Assert(e != null, "e should not be null!"); if (e.Handled) return; double offset = ScrollViewerExtensions.CoerceVerticalOffset(viewer, viewer.VerticalOffset - (double)e.Delta); viewer.ScrollToVerticalOffset(offset); e.Handled = true; } /// /// Gets the value of the VerticalOffset attached property for a specified ScrollViewer. /// /// /// The ScrollViewer from which the property value is read. /// /// The VerticalOffset property value for the ScrollViewer. /// private static double GetVerticalOffset(ScrollViewer element) { if (element == null) throw new ArgumentNullException("element"); else return (double)element.GetValue(ScrollViewerExtensions.VerticalOffsetProperty); } /// /// Sets the value of the VerticalOffset attached property to a specified ScrollViewer. /// /// /// The ScrollViewer to which the attached property is written.The needed VerticalOffset value. private static void SetVerticalOffset(ScrollViewer element, double value) { if (element == null) throw new ArgumentNullException("element"); element.SetValue(ScrollViewerExtensions.VerticalOffsetProperty, (object)value); } /// /// VerticalOffsetProperty property changed handler. /// /// /// ScrollViewer that changed its VerticalOffset.Event arguments. private static void OnVerticalOffsetPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { ScrollViewer scrollViewer = dependencyObject as ScrollViewer; if (scrollViewer == null) throw new ArgumentNullException("dependencyObject"); scrollViewer.ScrollToVerticalOffset((double)eventArgs.NewValue); } /// /// Gets the value of the HorizontalOffset attached property for a specified ScrollViewer. /// /// /// The ScrollViewer from which the property value is read. /// /// The HorizontalOffset property value for the ScrollViewer. /// private static double GetHorizontalOffset(ScrollViewer element) { if (element == null) throw new ArgumentNullException("element"); else return (double)element.GetValue(ScrollViewerExtensions.HorizontalOffsetProperty); } /// /// Sets the value of the HorizontalOffset attached property to a specified ScrollViewer. /// /// /// The ScrollViewer to which the attached property is written.The needed HorizontalOffset value. private static void SetHorizontalOffset(ScrollViewer element, double value) { if (element == null) throw new ArgumentNullException("element"); element.SetValue(ScrollViewerExtensions.HorizontalOffsetProperty, (object)value); } /// /// HorizontalOffsetProperty property changed handler. /// /// /// ScrollViewer that changed its HorizontalOffset.Event arguments. private static void OnHorizontalOffsetPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { ScrollViewer scrollViewer = dependencyObject as ScrollViewer; if (scrollViewer == null) throw new ArgumentNullException("dependencyObject"); scrollViewer.ScrollToHorizontalOffset((double)eventArgs.NewValue); } /// /// Coerce a vertical offset to fall within the vertical bounds of a /// ScrollViewer. /// /// /// The ScrollViewer.The vertical offset to coerce. /// /// The coerced vertical offset that falls within the ScrollViewer's /// vertical bounds. /// /// private static double CoerceVerticalOffset(ScrollViewer viewer, double offset) { Debug.Assert(viewer != null, "viewer should not be null!"); return Math.Max(Math.Min(offset, viewer.ExtentHeight), 0.0); } /// /// Coerce a horizontal offset to fall within the horizontal bounds of a /// ScrollViewer. /// /// /// The ScrollViewer.The horizontal offset to coerce. /// /// The coerced horizontal offset that falls within the ScrollViewer's /// horizontal bounds. /// /// private static double CoerceHorizontalOffset(ScrollViewer viewer, double offset) { Debug.Assert(viewer != null, "viewer should not be null!"); return Math.Max(Math.Min(offset, viewer.ExtentWidth), 0.0); } /// /// Scroll a ScrollViewer vertically by a given offset. /// /// /// The ScrollViewer.The vertical offset to scroll. private static void ScrollByVerticalOffset(ScrollViewer viewer, double offset) { Debug.Assert(viewer != null, "viewer should not be null!"); offset += viewer.VerticalOffset; offset = ScrollViewerExtensions.CoerceVerticalOffset(viewer, offset); viewer.ScrollToVerticalOffset(offset); } /// /// Scroll a ScrollViewer horizontally by a given offset. /// /// /// The ScrollViewer.The horizontal offset to scroll. private static void ScrollByHorizontalOffset(ScrollViewer viewer, double offset) { Debug.Assert(viewer != null, "viewer should not be null!"); offset += viewer.HorizontalOffset; offset = ScrollViewerExtensions.CoerceHorizontalOffset(viewer, offset); viewer.ScrollToHorizontalOffset(offset); } /// /// Scroll the ScrollViewer up by a line. /// /// /// The ScrollViewer. is null. /// public static void LineUp(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByVerticalOffset(viewer, -16.0); } /// /// Scroll the ScrollViewer down by a line. /// /// /// The ScrollViewer. is null. /// public static void LineDown(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByVerticalOffset(viewer, 16.0); } /// /// Scroll the ScrollViewer left by a line. /// /// /// The ScrollViewer. is null. /// public static void LineLeft(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByHorizontalOffset(viewer, -16.0); } /// /// Scroll the ScrollViewer right by a line. /// /// /// The ScrollViewer. is null. /// public static void LineRight(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByHorizontalOffset(viewer, 16.0); } /// /// Scroll the ScrollViewer up by a page. /// /// /// The ScrollViewer. is null. /// public static void PageUp(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByVerticalOffset(viewer, -viewer.ViewportHeight); } /// /// Scroll the ScrollViewer down by a page. /// /// /// The ScrollViewer. is null. /// public static void PageDown(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByVerticalOffset(viewer, viewer.ViewportHeight); } /// /// Scroll the ScrollViewer left by a page. /// /// /// The ScrollViewer. is null. /// public static void PageLeft(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByHorizontalOffset(viewer, -viewer.ViewportWidth); } /// /// Scroll the ScrollViewer right by a page. /// /// /// The ScrollViewer. is null. /// public static void PageRight(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); ScrollViewerExtensions.ScrollByHorizontalOffset(viewer, viewer.ViewportWidth); } /// /// Scroll the ScrollViewer to the top. /// /// /// The ScrollViewer. is null. /// public static void ScrollToTop(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); viewer.ScrollToVerticalOffset(0.0); } /// /// Scroll the ScrollViewer to the bottom. /// /// /// The ScrollViewer. is null. /// public static void ScrollToBottom(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); viewer.ScrollToVerticalOffset(viewer.ExtentHeight); } /// /// Scroll the ScrollViewer to the left. /// /// /// The ScrollViewer. is null. /// public static void ScrollToLeft(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); viewer.ScrollToHorizontalOffset(0.0); } /// /// Scroll the ScrollViewer to the right. /// /// /// The ScrollViewer. is null. /// public static void ScrollToRight(this ScrollViewer viewer) { if (viewer == null) throw new ArgumentNullException("viewer"); viewer.ScrollToHorizontalOffset(viewer.ExtentWidth); } /// /// Scroll the desired element into the ScrollViewer's viewport. /// /// /// The ScrollViewer.The element to scroll into view. is null. /// is null. /// public static void ScrollIntoView(this ScrollViewer viewer, FrameworkElement element) { if (viewer == null) throw new ArgumentNullException("viewer"); if (element == null) throw new ArgumentNullException("element"); ScrollViewerExtensions.ScrollIntoView(viewer, element, 0.0, 112.0, TimeSpan.FromSeconds(0.25)); } public static void ScrollToBeginnig(this ScrollViewer viewer, Duration duration) { if (viewer == null) throw new ArgumentNullException("viewer"); Storyboard storyboard = new Storyboard(); ScrollViewerExtensions.SetVerticalOffset(viewer, viewer.VerticalOffset); ScrollViewerExtensions.SetHorizontalOffset(viewer, viewer.HorizontalOffset); DoubleAnimation doubleAnimation1 = new DoubleAnimation(); doubleAnimation1.To = new double?(0.0); doubleAnimation1.Duration = duration; DoubleAnimation doubleAnimation2 = doubleAnimation1; DoubleAnimation doubleAnimation3 = new DoubleAnimation(); doubleAnimation3.To = new double?(0.0); doubleAnimation3.Duration = duration; DoubleAnimation doubleAnimation4 = doubleAnimation3; Storyboard.SetTarget((Timeline)doubleAnimation2, (DependencyObject)viewer); Storyboard.SetTarget((Timeline)doubleAnimation4, (DependencyObject)viewer); Storyboard.SetTargetProperty((Timeline)doubleAnimation4, new PropertyPath((object)ScrollViewerExtensions.HorizontalOffsetProperty)); Storyboard.SetTargetProperty((Timeline)doubleAnimation2, new PropertyPath((object)ScrollViewerExtensions.VerticalOffsetProperty)); storyboard.Children.Add((Timeline)doubleAnimation2); storyboard.Children.Add((Timeline)doubleAnimation4); storyboard.Begin(); } /// /// Scroll the desired element into the ScrollViewer's viewport. /// /// /// The ScrollViewer.The element to scroll into view.The margin to add on the left or right. /// The margin to add on the top or bottom. /// The duration of the animation. is null. /// is null. /// public static void ScrollIntoView(this ScrollViewer viewer, FrameworkElement element, double horizontalMargin, double verticalMargin, Duration duration) { if (viewer == null) throw new ArgumentNullException("viewer"); if (element == null) throw new ArgumentNullException("element"); Rect? boundsRelativeTo = VisualTreeExtensions.GetBoundsRelativeTo(element, (UIElement)viewer); if (!boundsRelativeTo.HasValue) return; double verticalOffset = viewer.VerticalOffset; double num1 = 0.0; double viewportHeight = viewer.ViewportHeight; double num2 = boundsRelativeTo.Value.Bottom + verticalMargin; if (viewportHeight < num2) { num1 = num2 - viewportHeight; verticalOffset += num1; } double num3 = boundsRelativeTo.Value.Top - verticalMargin; if (num3 - num1 < 0.0) verticalOffset -= num1 - num3; double horizontalOffset = viewer.HorizontalOffset; double num4 = 0.0; double viewportWidth = viewer.ViewportWidth; double num5 = boundsRelativeTo.Value.Right + horizontalMargin; if (viewportWidth < num5) { num4 = num5 - viewportWidth; horizontalOffset += num4; } double num6 = boundsRelativeTo.Value.Left - horizontalMargin; if (num6 - num4 < 0.0) horizontalOffset -= num4 - num6; if (duration == (Duration)TimeSpan.Zero) { viewer.ScrollToVerticalOffset(verticalOffset); viewer.ScrollToHorizontalOffset(horizontalOffset); } else { Storyboard storyboard = new Storyboard(); ScrollViewerExtensions.SetVerticalOffset(viewer, viewer.VerticalOffset); ScrollViewerExtensions.SetHorizontalOffset(viewer, viewer.HorizontalOffset); DoubleAnimation doubleAnimation1 = new DoubleAnimation(); doubleAnimation1.To = new double?(verticalOffset); doubleAnimation1.Duration = duration; DoubleAnimation doubleAnimation2 = doubleAnimation1; DoubleAnimation doubleAnimation3 = new DoubleAnimation(); doubleAnimation3.To = new double?(verticalOffset); doubleAnimation3.Duration = duration; DoubleAnimation doubleAnimation4 = doubleAnimation3; Storyboard.SetTarget((Timeline)doubleAnimation2, (DependencyObject)viewer); Storyboard.SetTarget((Timeline)doubleAnimation4, (DependencyObject)viewer); Storyboard.SetTargetProperty((Timeline)doubleAnimation4, new PropertyPath((object)ScrollViewerExtensions.HorizontalOffsetProperty)); Storyboard.SetTargetProperty((Timeline)doubleAnimation2, new PropertyPath((object)ScrollViewerExtensions.VerticalOffsetProperty)); storyboard.Children.Add((Timeline)doubleAnimation2); storyboard.Children.Add((Timeline)doubleAnimation4); storyboard.Begin(); } } } } ================================================ FILE: Telegram.Controls/Extensions/VisualTreeExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; namespace Telegram.Controls.Extensions { /// /// Provides useful extensions for working with the visual tree. /// /// /// Since many of these extension methods are declared on types like /// DependencyObject high up in the class hierarchy, we've placed them in /// the Primitives namespace which is less likely to be imported for normal /// scenarios. /// /// Experimental public static class VisualTreeExtensions { /// /// Retrieves all the logical children of a specified type using a /// breadth-first search. A visual element is assumed to be a logical /// child of another visual element if they are in the same namescope. /// For performance reasons this method manually manages the queue /// instead of using recursion. /// /// The parent framework element. /// Specifies whether to apply templates on the traversed framework elements /// The logical children of the framework element of the specified type. internal static IEnumerable GetLogicalChildrenByType(this FrameworkElement parent, bool applyTemplates) where T : FrameworkElement { Debug.Assert(parent != null, "The parent cannot be null."); if (applyTemplates && parent is Control) { ((Control)parent).ApplyTemplate(); } Queue queue = new Queue(parent.GetVisualChildren().OfType()); while (queue.Count > 0) { FrameworkElement element = queue.Dequeue(); if (applyTemplates && element is Control) { ((Control)element).ApplyTemplate(); } if (element is T) { yield return (T)element; } foreach (FrameworkElement visualChild in element.GetVisualChildren().OfType()) { queue.Enqueue(visualChild); } } } public static T FindParentOfType(this DependencyObject root) where T : class { var parent = VisualTreeHelper.GetParent(root); while (parent != null) { var typedParent = parent as T; if (typedParent != null) return typedParent; parent = VisualTreeHelper.GetParent(parent); } return null; } public static T FindChildOfType(this DependencyObject root) where T : class { var queue = new Queue(); queue.Enqueue(root); while (queue.Count > 0) { var current = queue.Dequeue(); for (var i = VisualTreeHelper.GetChildrenCount(current) - 1; 0 <= i; i--) { var child = VisualTreeHelper.GetChild(current, i); var typedChild = child as T; if (typedChild != null) { return typedChild; } queue.Enqueue(child); } } return null; } public static T FindByName(this DependencyObject parentElement, string name) where T : FrameworkElement { var count = VisualTreeHelper.GetChildrenCount(parentElement); if (count == 0) return null; for (int i = 0; i < count; i++) { var child = VisualTreeHelper.GetChild(parentElement, i); if (child != null && child is T && (string.IsNullOrEmpty(name) || ((T)child).Name == name)) { return (T)child; } var result = FindByName(child, name); if (result != null) return result; } return null; } /// /// Get the visual tree ancestors of an element. /// /// The element. /// The visual tree ancestors of the element. /// /// is null. /// public static IEnumerable GetVisualAncestors(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualAncestorsAndSelfIterator(element).Skip(1); } /// /// Get the visual tree ancestors of an element and the element itself. /// /// The element. /// /// The visual tree ancestors of an element and the element itself. /// /// /// is null. /// public static IEnumerable GetVisualAncestorsAndSelf(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualAncestorsAndSelfIterator(element); } /// /// Get the visual tree ancestors of an element and the element itself. /// /// The element. /// /// The visual tree ancestors of an element and the element itself. /// private static IEnumerable GetVisualAncestorsAndSelfIterator(DependencyObject element) { Debug.Assert(element != null, "element should not be null!"); for (DependencyObject obj = element; obj != null; obj = VisualTreeHelper.GetParent(obj)) { yield return obj; } } /// /// Gets the visual children of type T. /// /// /// /// public static IEnumerable GetVisualChildren(this DependencyObject target) where T : DependencyObject { return GetVisualChildren(target).Where(child => child is T).Cast(); } /// /// Gets the visual children of type T. /// /// /// /// public static IEnumerable GetVisualChildren(this DependencyObject target, bool strict) where T : DependencyObject { return GetVisualChildren(target, strict).Where(child => child is T).Cast(); } /// /// Gets the visual children. /// /// /// Prevents the search from navigating the logical tree; eg. ContentControl.Content /// public static IEnumerable GetVisualChildren(this DependencyObject target, bool strict) { int count = VisualTreeHelper.GetChildrenCount(target); if (count == 0) { if (!strict && target is ContentControl) { var child = ((ContentControl)target).Content as DependencyObject; if (child != null) { yield return child; } else { yield break; } } } else { for (int i = 0; i < count; i++) { yield return VisualTreeHelper.GetChild(target, i); } } yield break; } /// /// Get the visual tree children of an element. /// /// The element. /// The visual tree children of an element. /// /// is null. /// public static IEnumerable GetVisualChildren(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualChildrenAndSelfIterator(element).Skip(1); } /// /// Get the visual tree children of an element and the element itself. /// /// The element. /// /// The visual tree children of an element and the element itself. /// /// /// is null. /// public static IEnumerable GetVisualChildrenAndSelf(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualChildrenAndSelfIterator(element); } /// /// Get the visual tree children of an element and the element itself. /// /// The element. /// /// The visual tree children of an element and the element itself. /// private static IEnumerable GetVisualChildrenAndSelfIterator(this DependencyObject element) { Debug.Assert(element != null, "element should not be null!"); yield return element; int count = VisualTreeHelper.GetChildrenCount(element); for (int i = 0; i < count; i++) { yield return VisualTreeHelper.GetChild(element, i); } } /// /// A helper method used to get visual decnedants using a breadth-first strategy. /// /// /// Prevents the search from navigating the logical tree; eg. ContentControl.Content /// /// private static IEnumerable GetVisualDecendants(DependencyObject target, bool strict, Queue queue) { foreach (var child in GetVisualChildren(target, strict)) { queue.Enqueue(child); } if (queue.Count == 0) { yield break; } else { DependencyObject node = queue.Dequeue(); yield return node; foreach (var decendant in GetVisualDecendants(node, strict, queue)) { yield return decendant; } } } /// /// A helper method used to get visual decnedants using a depth-first strategy. /// /// /// Prevents the search from navigating the logical tree; eg. ContentControl.Content /// /// private static IEnumerable GetVisualDecendants(DependencyObject target, bool strict, Stack stack) { foreach (var child in GetVisualChildren(target, strict)) { stack.Push(child); } if (stack.Count == 0) { yield break; } else { DependencyObject node = stack.Pop(); yield return node; foreach (var decendant in GetVisualDecendants(node, strict, stack)) { yield return decendant; } } } /// /// Get the visual tree descendants of an element. /// /// The element. /// The visual tree descendants of an element. /// /// is null. /// public static IEnumerable GetVisualDescendants(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualDescendantsAndSelfIterator(element).Skip(1); } /// /// Get the visual tree descendants of an element and the element /// itself. /// /// The element. /// /// The visual tree descendants of an element and the element itself. /// /// /// is null. /// public static IEnumerable GetVisualDescendantsAndSelf(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } return GetVisualDescendantsAndSelfIterator(element); } /// /// Get the visual tree descendants of an element and the element /// itself. /// /// The element. /// /// The visual tree descendants of an element and the element itself. /// private static IEnumerable GetVisualDescendantsAndSelfIterator(DependencyObject element) { Debug.Assert(element != null, "element should not be null!"); Queue remaining = new Queue(); remaining.Enqueue(element); while (remaining.Count > 0) { DependencyObject obj = remaining.Dequeue(); yield return obj; foreach (DependencyObject child in obj.GetVisualChildren()) { remaining.Enqueue(child); } } } /// /// Get the visual tree siblings of an element. /// /// The element. /// The visual tree siblings of an element. /// /// is null. /// public static IEnumerable GetVisualSiblings(this DependencyObject element) { return element .GetVisualSiblingsAndSelf() .Where(p => p != element); } /// /// Get the visual tree siblings of an element and the element itself. /// /// The element. /// /// The visual tree siblings of an element and the element itself. /// /// /// is null. /// public static IEnumerable GetVisualSiblingsAndSelf(this DependencyObject element) { if (element == null) { throw new ArgumentNullException("element"); } DependencyObject parent = VisualTreeHelper.GetParent(element); return parent == null ? Enumerable.Empty() : parent.GetVisualChildren(); } /// /// Get the bounds of an element relative to another element. /// /// The element. /// /// The element relative to the other element. /// /// /// The bounds of the element relative to another element, or null if /// the elements are not related. /// /// /// is null. /// /// /// is null. /// public static Rect? GetBoundsRelativeTo(this FrameworkElement element, UIElement otherElement) { if (element == null) { throw new ArgumentNullException("element"); } else if (otherElement == null) { throw new ArgumentNullException("otherElement"); } try { Point origin, bottom; GeneralTransform transform = element.TransformToVisual(otherElement); if (transform != null && transform.TryTransform(new Point(), out origin) && transform.TryTransform(new Point(element.ActualWidth, element.ActualHeight), out bottom)) { return new Rect(origin, bottom); } } catch (ArgumentException) { // Ignore any exceptions thrown while trying to transform } return null; } public static childItem FindVisualChild(DependencyObject obj) where childItem : DependencyObject { for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { var child = VisualTreeHelper.GetChild(obj, i); if (child != null && child is childItem) { return (childItem)child; } else { var childOfChild = FindVisualChild(child); if (childOfChild != null) { return childOfChild; } } } return null; } public static TItem FindVisualChildWithPredicate(DependencyObject obj, Predicate predicate) where TItem : DependencyObject { for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { var child = VisualTreeHelper.GetChild(obj, i); if (child is TItem && predicate((TItem)child)) { return (TItem)child; } var childOfChild = FindVisualChild(child); if (childOfChild != null) { return childOfChild; } } return null; } /// /// Equivalent of FindName, but works on the visual tree to go through templates, etc. /// /// The node to search from /// The name to look for /// The found node, or null if not found public static FrameworkElement FindVisualChild(this FrameworkElement root, string name) { FrameworkElement temp = root.FindName(name) as FrameworkElement; if (temp != null) return temp; foreach (FrameworkElement element in root.GetVisualChildren()) { temp = element.FindName(name) as FrameworkElement; if (temp != null) return temp; } return null; } public static IEnumerable GetVisuals(this DependencyObject root) { int count = VisualTreeHelper.GetChildrenCount(root); for (int i = 0; i < count; i++) { var child = VisualTreeHelper.GetChild(root, i); yield return child; foreach (var descendants in child.GetVisuals()) { yield return descendants; } } } /// /// Gets a visual child of the element /// /// The element to check /// The index of the child /// The found child public static FrameworkElement GetVisualChild(this FrameworkElement node, int index) { return VisualTreeHelper.GetChild(node, index) as FrameworkElement; } /// /// Gets the visual parent of the element /// /// The element to check /// The visual parent public static FrameworkElement GetVisualParent(this FrameworkElement node) { return VisualTreeHelper.GetParent(node) as FrameworkElement; } public static T GetParent(DependencyObject child) where T : DependencyObject { //get parent item DependencyObject parentObject = VisualTreeHelper.GetParent(child); //we've reached the end of the tree if (parentObject == null) return null; //check if the parent matches the type we're looking for T parent = parentObject as T; if (parent != null) return parent; else return GetParent(parentObject); } /// /// Gets the VisualStateGroup with the given name, looking up the visual tree /// /// Element to start from /// Name of the group to look for /// Whether or not to look up the tree /// The group, if found public static VisualStateGroup GetVisualStateGroup(this FrameworkElement root, string groupName, bool searchAncestors) { IList groups = VisualStateManager.GetVisualStateGroups(root); foreach (object o in groups) { VisualStateGroup group = o as VisualStateGroup; if (group != null && group.Name == groupName) return group; } if (searchAncestors) { FrameworkElement parent = root.GetVisualParent(); if (parent != null) return parent.GetVisualStateGroup(groupName, true); } return null; } /// /// Provides a debug string that represents the visual child tree /// /// The root node /// StringBuilder into which the text is appended /// This method only works in DEBUG mode [Conditional("DEBUG")] public static void GetVisualChildTreeDebugText(this FrameworkElement root, StringBuilder result) { List results = new List(); root.GetChildTree("", " ", results); foreach (string s in results) result.AppendLine(s); } private static void GetChildTree(this FrameworkElement root, string prefix, string addPrefix, List results) { string thisElement = ""; if (String.IsNullOrEmpty(root.Name)) thisElement = "[Anonymous]"; else thisElement = "[" + root.Name + "]"; thisElement += " : " + root.GetType().Name; results.Add(prefix + thisElement); foreach (FrameworkElement directChild in root.GetVisualChildren()) { directChild.GetChildTree(prefix + addPrefix, addPrefix, results); } } /// /// Provides a debug string that represents the visual child tree /// /// The root node /// StringBuilder into which the text is appended /// This method only works in DEBUG mode [Conditional("DEBUG")] public static void GetAncestorVisualTreeDebugText(this FrameworkElement node, StringBuilder result) { List tree = new List(); node.GetAncestorVisualTree(tree); string prefix = ""; foreach (string s in tree) { result.AppendLine(prefix + s); prefix = prefix + " "; } } private static void GetAncestorVisualTree(this FrameworkElement node, List children) { string name = String.IsNullOrEmpty(node.Name) ? "[Anon]" : node.Name; string thisNode = name + ": " + node.GetType().Name; // Ensure list is in reverse order going up the tree children.Insert(0, thisNode); FrameworkElement parent = node.GetVisualParent(); if (parent != null) GetAncestorVisualTree(parent, children); } /// /// Returns a render transform of the specified type from the element, creating it if necessary /// /// The type of transform (Rotate, Translate, etc) /// The element to check /// The mode to use for creating transforms, if not found /// The specified transform, or null if not found and not created public static RequestedTransform GetTransform(this UIElement element, TransformCreationMode mode) where RequestedTransform : Transform, new() { //if (element == null) // return null; Transform originalTransform = element.RenderTransform; RequestedTransform requestedTransform = null; MatrixTransform matrixTransform = null; TransformGroup transformGroup = null; // Current transform is null -- create if necessary and return if (originalTransform == null) { if ((mode & TransformCreationMode.Create) == TransformCreationMode.Create) { requestedTransform = new RequestedTransform(); element.RenderTransform = requestedTransform; return requestedTransform; } return null; } // Transform is exactly what we want -- return it requestedTransform = originalTransform as RequestedTransform; if (requestedTransform != null) return requestedTransform; // The existing transform is matrix transform - overwrite if necessary and return matrixTransform = originalTransform as MatrixTransform; if (matrixTransform != null) { if (matrixTransform.Matrix.IsIdentity && (mode & TransformCreationMode.Create) == TransformCreationMode.Create && (mode & TransformCreationMode.IgnoreIdentityMatrix) == TransformCreationMode.IgnoreIdentityMatrix) { requestedTransform = new RequestedTransform(); element.RenderTransform = requestedTransform; return requestedTransform; } return null; } // Transform is actually a group -- check for the requested type transformGroup = originalTransform as TransformGroup; if (transformGroup != null) { foreach (Transform child in transformGroup.Children) { // Child is the right type -- return it if (child is RequestedTransform) return child as RequestedTransform; } // Right type was not found, but we are OK to add it if ((mode & TransformCreationMode.AddToGroup) == TransformCreationMode.AddToGroup) { requestedTransform = new RequestedTransform(); transformGroup.Children.Add(requestedTransform); return requestedTransform; } return null; } // Current ransform is not a group and is not what we want; // create a new group containing the existing transform and the new one if ((mode & TransformCreationMode.CombineIntoGroup) == TransformCreationMode.CombineIntoGroup) { transformGroup = new TransformGroup(); transformGroup.Children.Add(originalTransform); transformGroup.Children.Add(requestedTransform); element.RenderTransform = transformGroup; return requestedTransform; } Debug.Assert(false, "Shouldn't get here"); return null; } /// /// Returns a string representation of a property path needed to update a Storyboard /// /// The element to get the path for /// The property of the transform /// The type of transform to look fo /// A property path public static string GetTransformPropertyPath(this FrameworkElement element, string subProperty) where RequestedType : Transform { Transform t = element.RenderTransform; if (t is RequestedType) return String.Format("(RenderTransform).({0}.{1})", typeof(RequestedType).Name, subProperty); else if (t is TransformGroup) { TransformGroup g = t as TransformGroup; for (int i = 0; i < g.Children.Count; i++) { if (g.Children[i] is RequestedType) return String.Format("(RenderTransform).(TransformGroup.Children)[" + i + "].({0}.{1})", typeof(RequestedType).Name, subProperty); } } return ""; } /// /// Returns a plane projection, creating it if necessary /// /// The element /// Whether or not to create the projection if it doesn't already exist /// The plane project, or null if not found / created public static PlaneProjection GetPlaneProjection(this UIElement element, bool create) { Projection originalProjection = element.Projection; PlaneProjection projection = null; // Projection is already a plane projection; return it if (originalProjection is PlaneProjection) return originalProjection as PlaneProjection; // Projection is null; create it if necessary if (originalProjection == null) { if (create) { projection = new PlaneProjection(); element.Projection = projection; } } // Note that if the project is a Matrix projection, it will not be // changed and null will be returned. return projection; } /// /// Perform an action when the element's LayoutUpdated event fires. /// /// The element. /// The action to perform. /// /// is null. /// /// /// is null. /// public static void InvokeOnLayoutUpdated(this FrameworkElement element, Action action) { if (element == null) { throw new ArgumentNullException("element"); } else if (action == null) { throw new ArgumentNullException("action"); } // Create an event handler that unhooks itself before calling the // action and then attach it to the LayoutUpdated event. EventHandler handler = null; handler = (s, e) => { //TODO: is this the right thing to do? //Deployment.Current.Dispatcher.BeginInvoke(() => { element.LayoutUpdated -= handler; }); element.LayoutUpdated -= handler; action(); }; element.LayoutUpdated += handler; } /// /// Retrieves all the logical children of a framework element using a /// breadth-first search. For performance reasons this method manually /// manages the stack instead of using recursion. /// /// The parent framework element. /// The logical children of the framework element. internal static IEnumerable GetLogicalChildren(this FrameworkElement parent) { Debug.Assert(parent != null, "The parent cannot be null."); Popup popup = parent as Popup; if (popup != null) { FrameworkElement popupChild = popup.Child as FrameworkElement; if (popupChild != null) { yield return popupChild; } } // If control is an items control return all children using the // Item container generator. ItemsControl itemsControl = parent as ItemsControl; if (itemsControl != null) { foreach (FrameworkElement logicalChild in Enumerable .Range(0, itemsControl.Items.Count) .Select(index => itemsControl.ItemContainerGenerator.ContainerFromIndex(index)) .OfType()) { yield return logicalChild; } } string parentName = parent.Name; Queue queue = new Queue(parent.GetVisualChildren().OfType()); while (queue.Count > 0) { FrameworkElement element = queue.Dequeue(); if (element.Parent == parent || element is UserControl) { yield return element; } else { foreach (FrameworkElement visualChild in element.GetVisualChildren().OfType()) { queue.Enqueue(visualChild); } } } } /// /// Retrieves all the logical descendents of a framework element using a /// breadth-first search. For performance reasons this method manually /// manages the stack instead of using recursion. /// /// The parent framework element. /// The logical children of the framework element. internal static IEnumerable GetLogicalDescendents(this FrameworkElement parent) { Debug.Assert(parent != null, "The parent cannot be null."); //return // FunctionalProgramming.TraverseBreadthFirst( // parent, // node => node.GetLogicalChildren(), // node => true); return null; } } /// /// Possible modes for creating a transform /// [Flags] public enum TransformCreationMode { /// /// Don't try and create a transform if it doesn't already exist /// None = 0, /// /// Create a transform if none exists /// Create = 1, /// /// Create and add to an existing group /// AddToGroup = 2, /// /// Create a group and combine with existing transform; may break existing animations /// CombineIntoGroup = 4, /// /// Treat identity matrix as if it wasn't there; may break existing animations /// IgnoreIdentityMatrix = 8, /// /// Create a new transform or add to group /// CreateOrAddAndIgnoreMatrix = Create | AddToGroup | IgnoreIdentityMatrix, /// /// Default behaviour, equivalent to CreateOrAddAndIgnoreMatrix /// Default = CreateOrAddAndIgnoreMatrix, } } ================================================ FILE: Telegram.Controls/FlipCounter.xaml ================================================  Visible ================================================ FILE: Telegram.Controls/FlipCounter.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; namespace Telegram.Controls { public partial class FlipCounter { public FlipCounter() { // Required to initialize variables InitializeComponent(); BackTile.Width = 2*6.0 + 1*8.66; FrontTile.Width = 2 * 6.0 + 1 * 8.66; } private int _previousCounter; public static readonly DependencyProperty CounterProperty = DependencyProperty.Register("Counter", typeof (int), typeof (FlipCounter), new PropertyMetadata(default(int), OnCounterChanged)); private bool _initialized; private static void OnCounterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var flipCounter = (FlipCounter) d; if (flipCounter != null) { var oldCounter = (int)e.OldValue; var oldCounterLength = e.OldValue.ToString().Length; var newCounter = (int)e.NewValue; var newCounterLength = e.NewValue.ToString().Length; if (!flipCounter._initialized) { flipCounter._initialized = true; flipCounter.BackTile.Width = 2 * 6.0 + newCounterLength * 8.66; flipCounter.FrontTile.Width = 2 * 6.0 + newCounterLength * 8.66; } if (oldCounter != newCounter) { if (oldCounterLength != newCounterLength) { flipCounter.BackTile.Width = 2 * 6.0 + newCounterLength * 8.66; flipCounter.FrontTile.Width = 2 * 6.0 + newCounterLength * 8.66; } flipCounter.FrontText.Text = flipCounter.BackText.Text; var check1 = VisualStateManager.GoToState(flipCounter, "Normal", false); flipCounter.BackText.Text = Convert.ToString(newCounter); var check = VisualStateManager.GoToState(flipCounter, "Flipped", true); } } } public int Counter { get { return (int) GetValue(CounterProperty); } set { SetValue(CounterProperty, value); } } private void Flip_Completed(object sender, EventArgs e) { //FrontText.Text = BackText.Text; //var check = VisualStateManager.GoToState(this, "Normal", false); } } } ================================================ FILE: Telegram.Controls/FlipPanel.xaml ================================================  Visible ================================================ FILE: Telegram.Controls/FlipPanel.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; namespace Telegram.Controls { public partial class FlipPanel { public FlipPanel() { InitializeComponent(); } public static readonly DependencyProperty TextBlockStyleProperty = DependencyProperty.Register("TextBlockStyle", typeof (Style), typeof (FlipPanel), new PropertyMetadata(default(Style), OnTextBlockStyleChanged)); private static void OnTextBlockStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var panel = (FlipPanel)d; if (panel != null) { panel.FrontText.Style = (Style)e.NewValue; panel.BackText.Style = (Style)e.NewValue; } } public Style TextBlockStyle { get { return (Style) GetValue(TextBlockStyleProperty); } set { SetValue(TextBlockStyleProperty, value); } } public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(FlipPanel), new PropertyMetadata(default(string), OnTextChanged)); private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var panel = (FlipPanel)d; if (panel != null) { var oldText = (string)e.OldValue; var newText = (string)e.NewValue; if (oldText != newText) { panel.FrontText.Text = panel.BackText.Text; var check1 = VisualStateManager.GoToState(panel, "Normal", false); panel.BackText.Text = Convert.ToString(newText); var check = VisualStateManager.GoToState(panel, "Flipped", true); } } } public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } } } ================================================ FILE: Telegram.Controls/Helpers/DependencyPropertyChangedListener.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Data; namespace Telegram.Controls.Helpers { /// /// This class implements a listener to receive notifications for dependency property changes. /// public class DependencyPropertyChangedListener { #region Inner types // Helper element to make it possible to use the binding engine to get notified when the source element property changes. private sealed class RelayObject : DependencyObject { private DependencyPropertyChangedListener _listener; internal RelayObject(DependencyPropertyChangedListener listener) { _listener = listener; } #region Value (DependencyProperty) public object Value { get { return (object)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(object), typeof(RelayObject), new PropertyMetadata(default(object), new PropertyChangedCallback(OnValueChanged))); private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { object oldValue = (object)e.OldValue; object newValue = (object)e.NewValue; RelayObject source = (RelayObject)d; source.OnValueChanged(oldValue, newValue); } private void OnValueChanged(object oldValue, object newValue) { _listener.OnValueChanged(oldValue, newValue); } #endregion } #endregion #region Events /// /// Raises when the dependency property changes. /// public event EventHandler ValueChanged; #endregion #region Ctor private DependencyPropertyChangedListener() { // just to make it private } #endregion // holds a reference to the relay object in order that the GC does not collect it private RelayObject RelayInstance { get; set; } public static DependencyPropertyChangedListener Create(DependencyObject sourceElement, string propertyPath) //public static DependencyPropertyChangedListener Create(DependencyObject sourceElement, DependencyProperty property) { // check input if (sourceElement == null) throw new ArgumentNullException("sourceElement"); if (string.IsNullOrWhiteSpace(propertyPath)) throw new ArgumentException("propertyPath is empty"); // create listener DependencyPropertyChangedListener listener = new DependencyPropertyChangedListener(); // setup binding Binding binding = new Binding(); binding.Source = sourceElement; binding.Mode = BindingMode.OneWay; //binding.Path = new PropertyPath(property); // throws exception binding.Path = new PropertyPath(propertyPath); // create relay object RelayObject relay = new RelayObject(listener); // ...the listener holds a reference to the relay object in order that the GC does not collect it listener.RelayInstance = relay; // set binding BindingOperations.SetBinding(relay, RelayObject.ValueProperty, binding); return listener; } public void Detach() { if (this.RelayInstance != null) { // first: reset member to prevent further eventing of ValueChanged event. RelayObject temp = this.RelayInstance; this.RelayInstance = null; // second: clear the binding -> raises property changed event... temp.ClearValue(RelayObject.ValueProperty); } } private void OnValueChanged(object oldValue, object newValue) { // raise event, but only if the listener is not detached. if (ValueChanged != null && this.RelayInstance != null) ValueChanged(this, new DependencyPropertyValueChangedEventArgs(oldValue, newValue)); } } } ================================================ FILE: Telegram.Controls/Helpers/DependencyPropertyValueChangedEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; namespace Telegram.Controls.Helpers { /// /// Provides data for a DependencyPropertyChangedListener ValueChanged implementation. /// public class DependencyPropertyValueChangedEventArgs : EventArgs { internal DependencyPropertyValueChangedEventArgs(object oldValue, object newValue) { OldValue = oldValue; NewValue = newValue; } /// /// Gets the value of the property before the change. /// public object OldValue { get; private set; } /// /// Gets the value of the property after the change. /// public object NewValue { get; private set; } } } ================================================ FILE: Telegram.Controls/HighlightingTextBlock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; namespace Telegram.Controls { /// /// A specialized highlighting text block control. /// public class HighlightingTextBlock : ContentControl { /// /// Gets or sets the text block reference. /// private TextBlock _textBlock { get; set; } #region public string Text /// /// Gets or sets the contents of the TextBox. /// public string Text { get { return GetValue(TextProperty) as string; } set { SetValue(TextProperty, value); } } /// /// Identifies the Text dependency property. /// public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(HighlightingTextBlock), new PropertyMetadata(OnTextPropertyChanged)); /// /// TextProperty property changed handler. /// /// AutoCompleteBox that changed its Text. /// Event arguments. private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var source = d as HighlightingTextBlock; if (source != null && source._textBlock != null) { source._textBlock.Inlines.Clear(); var value = e.NewValue as string; if (value != null) { var highlight = source.HighlightText ?? string.Empty; if (string.IsNullOrEmpty(highlight)) { var run = new Run { Text = value, Foreground = source._textBlock.Foreground, FontWeight = source._textBlock.FontWeight }; source._textBlock.Inlines.Add(run); } else { var index = 0; var previousIndex = -1; while ((index = value.IndexOf(highlight, index, StringComparison.OrdinalIgnoreCase)) != -1) { if (previousIndex == -1 || index > previousIndex + highlight.Length) { var startIndex = previousIndex == -1 ? 0 : previousIndex + highlight.Length; var run = new Run { Text = value.Substring(startIndex, index - startIndex), Foreground = source._textBlock.Foreground, FontWeight = source._textBlock.FontWeight }; source._textBlock.Inlines.Add(run); } var highlightedRun = new Run { Text = value.Substring(index, highlight.Length), Foreground = source.HighlightBrush, FontWeight = source.HighlightFontWeight }; source._textBlock.Inlines.Add(highlightedRun); previousIndex = index; index = index + highlight.Length; } if (previousIndex == -1) { var run = new Run { Text = value, Foreground = source._textBlock.Foreground, FontWeight = source._textBlock.FontWeight }; source._textBlock.Inlines.Add(run); } else if (value.Length > previousIndex + highlight.Length) { var run = new Run { Text = value.Substring(previousIndex + highlight.Length, value.Length - (previousIndex + highlight.Length)), Foreground = source._textBlock.Foreground, FontWeight = source._textBlock.FontWeight }; source._textBlock.Inlines.Add(run); } } } } } #endregion public string Text public static readonly DependencyProperty UseTransliterationProperty = DependencyProperty.Register( "UseTransliteration", typeof (bool), typeof (HighlightingTextBlock), new PropertyMetadata(default(bool))); public bool UseTransliteration { get { return (bool) GetValue(UseTransliterationProperty); } set { SetValue(UseTransliterationProperty, value); } } #region public string HighlightText /// /// Gets or sets the highlighted text. /// public string HighlightText { get { return GetValue(HighlightTextProperty) as string; } set { SetValue(HighlightTextProperty, value); } } /// /// Identifies the HighlightText dependency property. /// public static readonly DependencyProperty HighlightTextProperty = DependencyProperty.Register( "HighlightText", typeof(string), typeof(HighlightingTextBlock), new PropertyMetadata(OnHighlightTextPropertyChanged)); /// /// HighlightText property changed handler. /// /// AutoCompleteBox that changed its HighlightText. /// Event arguments. private static void OnHighlightTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { } #endregion public string HighlightText #region public Style TextBlockStyle public static readonly DependencyProperty TextBlockStyleProperty = DependencyProperty.Register("TextBlockStyle", typeof (Style), typeof (HighlightingTextBlock), new PropertyMetadata(default(Style), OnTextBlockStyleChanged)); private static void OnTextBlockStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var highlightingTextBlock = (HighlightingTextBlock) d; if (highlightingTextBlock != null && highlightingTextBlock._textBlock != null) { highlightingTextBlock._textBlock.Style = (Style) e.NewValue; } } public Style TextBlockStyle { get { return (Style)GetValue(TextBlockStyleProperty); } set { SetValue(TextBlockStyleProperty, value); } } #endregion #region public Brush HighlightBrush /// /// Gets or sets the highlight brush. /// public Brush HighlightBrush { get { return GetValue(HighlightBrushProperty) as Brush; } set { SetValue(HighlightBrushProperty, value); } } /// /// Identifies the HighlightBrush dependency property. /// public static readonly DependencyProperty HighlightBrushProperty = DependencyProperty.Register( "HighlightBrush", typeof(Brush), typeof(HighlightingTextBlock), new PropertyMetadata(null, OnHighlightBrushPropertyChanged)); /// /// HighlightBrushProperty property changed handler. /// /// HighlightingTextBlock that changed its HighlightBrush. /// Event arguments. private static void OnHighlightBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //HighlightingTextBlock source = d as HighlightingTextBlock; //source.ApplyHighlighting(); } #endregion public Brush HighlightBrush #region public FontWeight HighlightFontWeight /// /// Gets or sets the font weight used on highlighted text. /// public FontWeight HighlightFontWeight { get { return (FontWeight)GetValue(HighlightFontWeightProperty); } set { SetValue(HighlightFontWeightProperty, value); } } /// /// Identifies the HighlightFontWeight dependency property. /// public static readonly DependencyProperty HighlightFontWeightProperty = DependencyProperty.Register( "HighlightFontWeight", typeof(FontWeight), typeof(HighlightingTextBlock), new PropertyMetadata(FontWeights.Normal, OnHighlightFontWeightPropertyChanged)); /// /// HighlightFontWeightProperty property changed handler. /// /// HighlightingTextBlock that changed its HighlightFontWeight. /// Event arguments. private static void OnHighlightFontWeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { HighlightingTextBlock source = d as HighlightingTextBlock; FontWeight value = (FontWeight)e.NewValue; } #endregion public FontWeight HighlightFontWeight /// /// Initializes a new HighlightingTextBlock class. /// public HighlightingTextBlock() { _textBlock = new TextBlock(); if (TextBlockStyle != null) { _textBlock.Style = TextBlockStyle; } Content = _textBlock; } } public static class Emoji { /** * Emoji codes combined into the groups corresponding to the categories in the interface * **/ public static ulong[][] Data = { new ulong[]{ 0x00000000D83DDE04L, 0x00000000D83DDE03L, 0x00000000D83DDE00L, 0x00000000D83DDE0AL, 0x000000000000263AL, 0x00000000D83DDE09L, 0x00000000D83DDE0DL, 0x00000000D83DDE18L, 0x00000000D83DDE1AL, 0x00000000D83DDE17L, 0x00000000D83DDE19L, 0x00000000D83DDE1CL, 0x00000000D83DDE1DL, 0x00000000D83DDE1BL, 0x00000000D83DDE33L, 0x00000000D83DDE01L, 0x00000000D83DDE14L, 0x00000000D83DDE0CL, 0x00000000D83DDE12L, 0x00000000D83DDE1EL, 0x00000000D83DDE23L, 0x00000000D83DDE22L, 0x00000000D83DDE02L, 0x00000000D83DDE2DL, 0x00000000D83DDE2AL, 0x00000000D83DDE25L, 0x00000000D83DDE30L, 0x00000000D83DDE05L, 0x00000000D83DDE13L, 0x00000000D83DDE29L, 0x00000000D83DDE2BL, 0x00000000D83DDE28L, 0x00000000D83DDE31L, 0x00000000D83DDE20L, 0x00000000D83DDE21L, 0x00000000D83DDE24L, 0x00000000D83DDE16L, 0x00000000D83DDE06L, 0x00000000D83DDE0BL, 0x00000000D83DDE37L, 0x00000000D83DDE0EL, 0x00000000D83DDE34L, 0x00000000D83DDE35L, 0x00000000D83DDE32L, 0x00000000D83DDE1FL, 0x00000000D83DDE26L, 0x00000000D83DDE27L, 0x00000000D83DDE08L, 0x00000000D83DDC7FL, 0x00000000D83DDE2EL, 0x00000000D83DDE2CL, 0x00000000D83DDE10L, 0x00000000D83DDE15L, 0x00000000D83DDE2FL, 0x00000000D83DDE36L, 0x00000000D83DDE07L, 0x00000000D83DDE0FL, 0x00000000D83DDE11L, 0x00000000D83DDC72L, 0x00000000D83DDC73L, 0x00000000D83DDC6EL, 0x00000000D83DDC77L, 0x00000000D83DDC82L, 0x00000000D83DDC76L, 0x00000000D83DDC66L, 0x00000000D83DDC67L, 0x00000000D83DDC68L, 0x00000000D83DDC69L, 0x00000000D83DDC74L, 0x00000000D83DDC75L, 0x00000000D83DDC71L, 0x00000000D83DDC7CL, 0x00000000D83DDC78L, 0x00000000D83DDE3AL, 0x00000000D83DDE38L, 0x00000000D83DDE3BL, 0x00000000D83DDE3DL, 0x00000000D83DDE3CL, 0x00000000D83DDE40L, 0x00000000D83DDE3FL, 0x00000000D83DDE39L, 0x00000000D83DDE3EL, 0x00000000D83DDC79L, 0x00000000D83DDC7AL, 0x00000000D83DDE48L, 0x00000000D83DDE49L, 0x00000000D83DDE4AL, 0x00000000D83DDC80L, 0x00000000D83DDC7DL, 0x00000000D83DDCA9L, 0x00000000D83DDD25L, 0x0000000000002728L, 0x00000000D83CDF1FL, 0x00000000D83DDCABL, 0x00000000D83DDCA5L, 0x00000000D83DDCA2L, 0x00000000D83DDCA6L, 0x00000000D83DDCA7L, 0x00000000D83DDCA4L, 0x00000000D83DDCA8L, 0x00000000D83DDC42L, 0x00000000D83DDC40L, 0x00000000D83DDC43L, 0x00000000D83DDC45L, 0x00000000D83DDC44L, 0x00000000D83DDC4DL, 0x00000000D83DDC4EL, 0x00000000D83DDC4CL, 0x00000000D83DDC4AL, 0x000000000000270AL, 0x000000000000270CL, 0x00000000D83DDC4BL, 0x000000000000270BL, 0x00000000D83DDC50L, 0x00000000D83DDC46L, 0x00000000D83DDC47L, 0x00000000D83DDC49L, 0x00000000D83DDC48L, 0x00000000D83DDE4CL, 0x00000000D83DDE4FL, 0x000000000000261DL, 0x00000000D83DDC4FL, 0x00000000D83DDCAAL, 0x00000000D83DDEB6L, 0x00000000D83CDFC3L, 0x00000000D83DDC83L, 0x00000000D83DDC6BL, 0x00000000D83DDC6AL, 0x00000000D83DDC6CL, 0x00000000D83DDC6DL, 0x00000000D83DDC8FL, 0x00000000D83DDC91L, 0x00000000D83DDC6FL, 0x00000000D83DDE46L, 0x00000000D83DDE45L, 0x00000000D83DDC81L, 0x00000000D83DDE4BL, 0x00000000D83DDC86L, 0x00000000D83DDC87L, 0x00000000D83DDC85L, 0x00000000D83DDC70L, 0x00000000D83DDE4EL, 0x00000000D83DDE4DL, 0x00000000D83DDE47L, 0x00000000D83CDFA9L, 0x00000000D83DDC51L, 0x00000000D83DDC52L, 0x00000000D83DDC5FL, 0x00000000D83DDC5EL, 0x00000000D83DDC61L, 0x00000000D83DDC60L, 0x00000000D83DDC62L, 0x00000000D83DDC55L, 0x00000000D83DDC54L, 0x00000000D83DDC5AL, 0x00000000D83DDC57L, 0x00000000D83CDFBDL, 0x00000000D83DDC56L, 0x00000000D83DDC58L, 0x00000000D83DDC59L, 0x00000000D83DDCBCL, 0x00000000D83DDC5CL, 0x00000000D83DDC5DL, 0x00000000D83DDC5BL, 0x00000000D83DDC53L, 0x00000000D83CDF80L, 0x00000000D83CDF02L, 0x00000000D83DDC84L, 0x00000000D83DDC9BL, 0x00000000D83DDC99L, 0x00000000D83DDC9CL, 0x00000000D83DDC9AL, 0x0000000000002764L, 0x00000000D83DDC94L, 0x00000000D83DDC97L, 0x00000000D83DDC93L, 0x00000000D83DDC95L, 0x00000000D83DDC96L, 0x00000000D83DDC9EL, 0x00000000D83DDC98L, 0x00000000D83DDC8CL, 0x00000000D83DDC8BL, 0x00000000D83DDC8DL, 0x00000000D83DDC8EL, 0x00000000D83DDC64L, 0x00000000D83DDC65L, 0x00000000D83DDCACL, 0x00000000D83DDC63L, 0x00000000D83DDCADL}, new ulong[]{ 0x00000000D83DDC36L, 0x00000000D83DDC3AL, 0x00000000D83DDC31L, 0x00000000D83DDC2DL, 0x00000000D83DDC39L, 0x00000000D83DDC30L, 0x00000000D83DDC38L, 0x00000000D83DDC2FL, 0x00000000D83DDC28L, 0x00000000D83DDC3BL, 0x00000000D83DDC37L, 0x00000000D83DDC3DL, 0x00000000D83DDC2EL, 0x00000000D83DDC17L, 0x00000000D83DDC35L, 0x00000000D83DDC12L, 0x00000000D83DDC34L, 0x00000000D83DDC11L, 0x00000000D83DDC18L, 0x00000000D83DDC3CL, 0x00000000D83DDC27L, 0x00000000D83DDC26L, 0x00000000D83DDC24L, 0x00000000D83DDC25L, 0x00000000D83DDC23L, 0x00000000D83DDC14L, 0x00000000D83DDC0DL, 0x00000000D83DDC22L, 0x00000000D83DDC1BL, 0x00000000D83DDC1DL, 0x00000000D83DDC1CL, 0x00000000D83DDC1EL, 0x00000000D83DDC0CL, 0x00000000D83DDC19L, 0x00000000D83DDC1AL, 0x00000000D83DDC20L, 0x00000000D83DDC1FL, 0x00000000D83DDC2CL, 0x00000000D83DDC33L, 0x00000000D83DDC0BL, 0x00000000D83DDC04L, 0x00000000D83DDC0FL, 0x00000000D83DDC00L, 0x00000000D83DDC03L, 0x00000000D83DDC05L, 0x00000000D83DDC07L, 0x00000000D83DDC09L, 0x00000000D83DDC0EL, 0x00000000D83DDC10L, 0x00000000D83DDC13L, 0x00000000D83DDC15L, 0x00000000D83DDC16L, 0x00000000D83DDC01L, 0x00000000D83DDC02L, 0x00000000D83DDC32L, 0x00000000D83DDC21L, 0x00000000D83DDC0AL, 0x00000000D83DDC2BL, 0x00000000D83DDC2AL, 0x00000000D83DDC06L, 0x00000000D83DDC08L, 0x00000000D83DDC29L, 0x00000000D83DDC3EL, 0x00000000D83DDC90L, 0x00000000D83CDF38L, 0x00000000D83CDF37L, 0x00000000D83CDF40L, 0x00000000D83CDF39L, 0x00000000D83CDF3BL, 0x00000000D83CDF3AL, 0x00000000D83CDF41L, 0x00000000D83CDF43L, 0x00000000D83CDF42L, 0x00000000D83CDF3FL, 0x00000000D83CDF3EL, 0x00000000D83CDF44L, 0x00000000D83CDF35L, 0x00000000D83CDF34L, 0x00000000D83CDF32L, 0x00000000D83CDF33L, 0x00000000D83CDF30L, 0x00000000D83CDF31L, 0x00000000D83CDF3CL, 0x00000000D83CDF10L, 0x00000000D83CDF1EL, 0x00000000D83CDF1DL, 0x00000000D83CDF1AL, 0x00000000D83CDF11L, 0x00000000D83CDF12L, 0x00000000D83CDF13L, 0x00000000D83CDF14L, 0x00000000D83CDF15L, 0x00000000D83CDF16L, 0x00000000D83CDF17L, 0x00000000D83CDF18L, 0x00000000D83CDF1CL, 0x00000000D83CDF1BL, 0x00000000D83CDF19L, 0x00000000D83CDF0DL, 0x00000000D83CDF0EL, 0x00000000D83CDF0FL, 0x00000000D83CDF0BL, 0x00000000D83CDF0CL, 0x00000000D83CDF20L, 0x0000000000002B50L, 0x0000000000002600L, 0x00000000000026C5L, 0x0000000000002601L, 0x00000000000026A1L, 0x0000000000002614L, 0x0000000000002744L, 0x00000000000026C4L, 0x00000000D83CDF00L, 0x00000000D83CDF01L, 0x00000000D83CDF08L, 0x00000000D83CDF0AL}, new ulong[]{ 0x00000000D83CDF8DL, 0x00000000D83DDC9DL, 0x00000000D83CDF8EL, 0x00000000D83CDF92L, 0x00000000D83CDF93L, 0x00000000D83CDF8FL, 0x00000000D83CDF86L, 0x00000000D83CDF87L, 0x00000000D83CDF90L, 0x00000000D83CDF91L, 0x00000000D83CDF83L, 0x00000000D83DDC7BL, 0x00000000D83CDF85L, 0x00000000D83CDF84L, 0x00000000D83CDF81L, 0x00000000D83CDF8BL, 0x00000000D83CDF89L, 0x00000000D83CDF8AL, 0x00000000D83CDF88L, 0x00000000D83CDF8CL, 0x00000000D83DDD2EL, 0x00000000D83CDFA5L, 0x00000000D83DDCF7L, 0x00000000D83DDCF9L, 0x00000000D83DDCFCL, 0x00000000D83DDCBFL, 0x00000000D83DDCC0L, 0x00000000D83DDCBDL, 0x00000000D83DDCBEL, 0x00000000D83DDCBBL, 0x00000000D83DDCF1L, 0x000000000000260EL, 0x00000000D83DDCDEL, 0x00000000D83DDCDFL, 0x00000000D83DDCE0L, 0x00000000D83DDCE1L, 0x00000000D83DDCFAL, 0x00000000D83DDCFBL, 0x00000000D83DDD0AL, 0x00000000D83DDD09L, 0x00000000D83DDD08L, 0x00000000D83DDD07L, 0x00000000D83DDD14L, 0x00000000D83DDD14L, 0x00000000D83DDCE2L, 0x00000000D83DDCE3L, 0x00000000000023F3L, 0x000000000000231BL, 0x00000000000023F0L, 0x000000000000231AL, 0x00000000D83DDD13L, 0x00000000D83DDD12L, 0x00000000D83DDD0FL, 0x00000000D83DDD10L, 0x00000000D83DDD11L, 0x00000000D83DDD0EL, 0x00000000D83DDCA1L, 0x00000000D83DDD26L, 0x00000000D83DDD06L, 0x00000000D83DDD05L, 0x00000000D83DDD0CL, 0x00000000D83DDD0BL, 0x00000000D83DDD0DL, 0x00000000D83DDEC0L, 0x00000000D83DDEBFL, 0x00000000D83DDEBDL, 0x00000000D83DDD27L, 0x00000000D83DDD29L, 0x00000000D83DDD28L, 0x00000000D83DDEAAL, 0x00000000D83DDEACL, 0x00000000D83DDCA3L, 0x00000000D83DDD2BL, 0x00000000D83DDD2AL, 0x00000000D83DDC8AL, 0x00000000D83DDC89L, 0x00000000D83DDCB0L, 0x00000000D83DDCB4L, 0x00000000D83DDCB5L, 0x00000000D83DDCB7L, 0x00000000D83DDCB6L, 0x00000000D83DDCB3L, 0x00000000D83DDCB8L, 0x00000000D83DDCF2L, 0x00000000D83DDCE7L, 0x00000000D83DDCE5L, 0x00000000D83DDCE4L, 0x0000000000002709L, 0x00000000D83DDCE9L, 0x00000000D83DDCE8L, 0x00000000D83DDCEFL, 0x00000000D83DDCEBL, 0x00000000D83DDCEAL, 0x00000000D83DDCECL, 0x00000000D83DDCEDL, 0x00000000D83DDCEEL, 0x00000000D83DDCE6L, 0x00000000D83DDCDDL, 0x00000000D83DDCC4L, 0x00000000D83DDCC3L, 0x00000000D83DDCD1L, 0x00000000D83DDCCAL, 0x00000000D83DDCC8L, 0x00000000D83DDCC9L, 0x00000000D83DDCDCL, 0x00000000D83DDCCBL, 0x00000000D83DDCC5L, 0x00000000D83DDCC6L, 0x00000000D83DDCC7L, 0x00000000D83DDCC1L, 0x00000000D83DDCC2L, 0x0000000000002702L, 0x00000000D83DDCCCL, 0x00000000D83DDCCEL, 0x0000000000002712L, 0x000000000000270FL, 0x00000000D83DDCCFL, 0x00000000D83DDCD0L, 0x00000000D83DDCD5L, 0x00000000D83DDCD7L, 0x00000000D83DDCD8L, 0x00000000D83DDCD9L, 0x00000000D83DDCD3L, 0x00000000D83DDCD4L, 0x00000000D83DDCD2L, 0x00000000D83DDCDAL, 0x00000000D83DDCD6L, 0x00000000D83DDD16L, 0x00000000D83DDCDBL, 0x00000000D83DDD2CL, 0x00000000D83DDD2DL, 0x00000000D83DDCF0L, 0x00000000D83CDFA8L, 0x00000000D83CDFACL, 0x00000000D83CDFA4L, 0x00000000D83CDFA7L, 0x00000000D83CDFBCL, 0x00000000D83CDFB5L, 0x00000000D83CDFB6L, 0x00000000D83CDFB9L, 0x00000000D83CDFBBL, 0x00000000D83CDFBAL, 0x00000000D83CDFB7L, 0x00000000D83CDFB8L, 0x00000000D83DDC7EL, 0x00000000D83CDFAEL, 0x00000000D83CDCCFL, 0x00000000D83CDFB4L, 0x00000000D83CDC04L, 0x00000000D83CDFB2L, 0x00000000D83CDFAFL, 0x00000000D83CDFC8L, 0x00000000D83CDFC0L, 0x00000000000026BDL, 0x00000000000026BEL, 0x00000000D83CDFBEL, 0x00000000D83CDFB1L, 0x00000000D83CDFC9L, 0x00000000D83CDFB3L, 0x00000000000026F3L, 0x00000000D83DDEB5L, 0x00000000D83DDEB4L, 0x00000000D83CDFC1L, 0x00000000D83CDFC7L, 0x00000000D83CDFC6L, 0x00000000D83CDFBFL, 0x00000000D83CDFC2L, 0x00000000D83CDFCAL, 0x00000000D83CDFC4L, 0x00000000D83CDFA3L, 0x0000000000002615L, 0x00000000D83CDF75L, 0x00000000D83CDF76L, 0x00000000D83CDF7CL, 0x00000000D83CDF7AL, 0x00000000D83CDF7BL, 0x00000000D83CDF78L, 0x00000000D83CDF79L, 0x00000000D83CDF77L, 0x00000000D83CDF74L, 0x00000000D83CDF55L, 0x00000000D83CDF54L, 0x00000000D83CDF5FL, 0x00000000D83CDF57L, 0x00000000D83CDF56L, 0x00000000D83CDF5DL, 0x00000000D83CDF5BL, 0x00000000D83CDF64L, 0x00000000D83CDF71L, 0x00000000D83CDF63L, 0x00000000D83CDF65L, 0x00000000D83CDF59L, 0x00000000D83CDF58L, 0x00000000D83CDF5AL, 0x00000000D83CDF5CL, 0x00000000D83CDF72L, 0x00000000D83CDF62L, 0x00000000D83CDF61L, 0x00000000D83CDF73L, 0x00000000D83CDF5EL, 0x00000000D83CDF69L, 0x00000000D83CDF6EL, 0x00000000D83CDF66L, 0x00000000D83CDF68L, 0x00000000D83CDF67L, 0x00000000D83CDF82L, 0x00000000D83CDF70L, 0x00000000D83CDF6AL, 0x00000000D83CDF6BL, 0x00000000D83CDF6CL, 0x00000000D83CDF6DL, 0x00000000D83CDF6FL, 0x00000000D83CDF4EL, 0x00000000D83CDF4FL, 0x00000000D83CDF4AL, 0x00000000D83CDF4BL, 0x00000000D83CDF52L, 0x00000000D83CDF47L, 0x00000000D83CDF49L, 0x00000000D83CDF53L, 0x00000000D83CDF51L, 0x00000000D83CDF48L, 0x00000000D83CDF4CL, 0x00000000D83CDF50L, 0x00000000D83CDF4DL, 0x00000000D83CDF60L, 0x00000000D83CDF46L, 0x00000000D83CDF45L, 0x00000000D83CDF3DL}, new ulong[]{ 0x00000000D83CDFE0L, 0x00000000D83CDFE1L, 0x00000000D83CDFEBL, 0x00000000D83CDFE2L, 0x00000000D83CDFE3L, 0x00000000D83CDFE5L, 0x00000000D83CDFE6L, 0x00000000D83CDFEAL, 0x00000000D83CDFE9L, 0x00000000D83CDFE8L, 0x00000000D83DDC92L, 0x00000000000026EAL, 0x00000000D83CDFECL, 0x00000000D83CDFE4L, 0x00000000D83CDF07L, 0x00000000D83CDF06L, 0x00000000D83CDFEFL, 0x00000000D83CDFF0L, 0x00000000000026FAL, 0x00000000D83CDFEDL, 0x00000000D83DDDFCL, 0x00000000D83DDDFEL, 0x00000000D83DDDFBL, 0x00000000D83CDF04L, 0x00000000D83CDF05L, 0x00000000D83CDF03L, 0x00000000D83DDDFDL, 0x00000000D83CDF09L, 0x00000000D83CDFA0L, 0x00000000D83CDFA1L, 0x00000000000026F2L, 0x00000000D83CDFA2L, 0x00000000D83DDEA2L, 0x00000000000026F5L, 0x00000000D83DDEA4L, 0x00000000D83DDEA3L, 0x0000000000002693L, 0x00000000D83DDE80L, 0x0000000000002708L, 0x00000000D83DDCBAL, 0x00000000D83DDE81L, 0x00000000D83DDE82L, 0x00000000D83DDE8AL, 0x00000000D83DDE89L, 0x00000000D83DDE9EL, 0x00000000D83DDE86L, 0x00000000D83DDE84L, 0x00000000D83DDE85L, 0x00000000D83DDE88L, 0x00000000D83DDE87L, 0x00000000D83DDE9DL, 0x00000000D83DDE8BL, 0x00000000D83DDE83L, 0x00000000D83DDE8EL, 0x00000000D83DDE8CL, 0x00000000D83DDE8DL, 0x00000000D83DDE99L, 0x00000000D83DDE98L, 0x00000000D83DDE97L, 0x00000000D83DDE95L, 0x00000000D83DDE96L, 0x00000000D83DDE9BL, 0x00000000D83DDE9AL, 0x00000000D83DDEA8L, 0x00000000D83DDE93L, 0x00000000D83DDE94L, 0x00000000D83DDE92L, 0x00000000D83DDE91L, 0x00000000D83DDE90L, 0x00000000D83DDEB2L, 0x00000000D83DDEA1L, 0x00000000D83DDE9FL, 0x00000000D83DDEA0L, 0x00000000D83DDE9CL, 0x00000000D83DDC88L, 0x00000000D83DDE8FL, 0x00000000D83CDFABL, 0x00000000D83DDEA6L, 0x00000000D83DDEA5L, 0x00000000000026A0L, 0x00000000D83DDEA7L, 0x00000000D83DDD30L, 0x00000000000026FDL, 0x00000000D83CDFEEL, 0x00000000D83CDFB0L, 0x0000000000002668L, 0x00000000D83DDDFFL, 0x00000000D83CDFAAL, 0x00000000D83CDFADL, 0x00000000D83DDCCDL, 0x00000000D83DDEA9L, 0xD83CDDEFD83CDDF5L, 0xD83CDDF0D83CDDF7L, 0xD83CDDE9D83CDDEAL, 0xD83CDDE8D83CDDF3L, 0xD83CDDFAD83CDDF8L, 0xD83CDDEBD83CDDF7L, 0xD83CDDEAD83CDDF8L, 0xD83CDDEED83CDDF9L, 0xD83CDDF7D83CDDFAL, 0xD83CDDECD83CDDE7L}, new ulong[]{ 0x00000000003120E3L, 0x00000000003220E3L, 0x00000000003320E3L, 0x00000000003420E3L, 0x00000000003520E3L, 0x00000000003620E3L, 0x00000000003720E3L, 0x00000000003820E3L, 0x00000000003920E3L, 0x00000000003020E3L, 0x00000000D83DDD1FL, 0x00000000D83DDD22L, 0x00000000002320E3L, 0x00000000D83DDD23L, 0x0000000000002B06L, 0x0000000000002B07L, 0x0000000000002B05L, 0x00000000000027A1L, 0x00000000D83DDD20L, 0x00000000D83DDD21L, 0x00000000D83DDD24L, 0x0000000000002197L, 0x0000000000002196L, 0x0000000000002198L, 0x0000000000002199L, 0x0000000000002194L, 0x0000000000002195L, 0x00000000D83DDD04L, 0x00000000000025C0L, 0x00000000000025B6L, 0x00000000D83DDD3CL, 0x00000000D83DDD3DL, 0x00000000000021A9L, 0x00000000000021AAL, 0x0000000000002139L, 0x00000000000023EAL, 0x00000000000023E9L, 0x00000000000023EBL, 0x00000000000023ECL, 0x0000000000002935L, 0x0000000000002934L, 0x00000000D83CDD97L, 0x00000000D83DDD00L, 0x00000000D83DDD01L, 0x00000000D83DDD02L, 0x00000000D83CDD95L, 0x00000000D83CDD99L, 0x00000000D83CDD92L, 0x00000000D83CDD93L, 0x00000000D83CDD96L, 0x00000000D83DDCF6L, 0x00000000D83CDFA6L, 0x00000000D83CDE01L, 0x00000000D83CDE2FL, 0x00000000D83CDE33L, 0x00000000D83CDE35L, 0x00000000D83CDE32L, 0x00000000D83CDE34L, 0x00000000D83CDE32L, 0x00000000D83CDE50L, 0x00000000D83CDE39L, 0x00000000D83CDE3AL, 0x00000000D83CDE36L, 0x00000000D83CDE1AL, 0x00000000D83DDEBBL, 0x00000000D83DDEB9L, 0x00000000D83DDEBAL, 0x00000000D83DDEBCL, 0x00000000D83DDEBEL, 0x00000000D83DDEB0L, 0x00000000D83DDEAEL, 0x00000000D83CDD7FL, 0x000000000000267FL, 0x00000000D83DDEADL, 0x00000000D83CDE37L, 0x00000000D83CDE38L, 0x00000000D83CDE02L, 0x00000000000024C2L, 0x00000000D83CDE51L, 0x0000000000003299L, 0x0000000000003297L, 0x00000000D83CDD91L, 0x00000000D83CDD98L, 0x00000000D83CDD94L, 0x00000000D83DDEABL, 0x00000000D83DDD1EL, 0x00000000D83DDCF5L, 0x00000000D83DDEAFL, 0x00000000D83DDEB1L, 0x00000000D83DDEB3L, 0x00000000D83DDEB7L, 0x00000000D83DDEB8L, 0x00000000000026D4L, 0x0000000000002733L, 0x0000000000002747L, 0x000000000000274EL, 0x0000000000002705L, 0x0000000000002734L, 0x00000000D83DDC9FL, 0x00000000D83CDD9AL, 0x00000000D83DDCF3L, 0x00000000D83DDCF4L, 0x00000000D83CDD70L, 0x00000000D83CDD71L, 0x00000000D83CDD8EL, 0x00000000D83CDD7EL, 0x00000000D83DDCA0L, 0x00000000000027BFL, 0x000000000000267BL, 0x0000000000002648L, 0x0000000000002649L, 0x000000000000264AL, 0x000000000000264BL, 0x000000000000264CL, 0x000000000000264DL, 0x000000000000264EL, 0x000000000000264FL, 0x0000000000002650L, 0x0000000000002651L, 0x0000000000002652L, 0x0000000000002653L, 0x00000000000026CEL, 0x00000000D83DDD2FL, 0x00000000D83CDFE7L, 0x00000000D83DDCB9L, 0x00000000D83DDCB2L, 0x00000000D83DDCB1L, 0x00000000000000A9L, 0x00000000000000AEL, 0x0000000000002122L, 0x000000000000303DL, 0x0000000000003030L, 0x00000000D83DDD1DL, 0x00000000D83DDD1AL, 0x00000000D83DDD19L, 0x00000000D83DDD1BL, 0x00000000D83DDD1CL, 0x000000000000274CL, 0x0000000000002B55L, 0x0000000000002757L, 0x0000000000002753L, 0x0000000000002755L, 0x0000000000002754L, 0x00000000D83DDD03L, 0x00000000D83DDD5BL, 0x00000000D83DDD67L, 0x00000000D83DDD50L, 0x00000000D83DDD5CL, 0x00000000D83DDD51L, 0x00000000D83DDD5DL, 0x00000000D83DDD52L, 0x00000000D83DDD5EL, 0x00000000D83DDD53L, 0x00000000D83DDD5FL, 0x00000000D83DDD54L, 0x00000000D83DDD60L, 0x00000000D83DDD55L, 0x00000000D83DDD56L, 0x00000000D83DDD57L, 0x00000000D83DDD58L, 0x00000000D83DDD59L, 0x00000000D83DDD5AL, 0x00000000D83DDD61L, 0x00000000D83DDD62L, 0x00000000D83DDD63L, 0x00000000D83DDD64L, 0x00000000D83DDD65L, 0x00000000D83DDD66L, 0x0000000000002716L, 0x0000000000002795L, 0x0000000000002796L, 0x0000000000002797L, 0x0000000000002660L, 0x0000000000002665L, 0x0000000000002663L, 0x0000000000002666L, 0x00000000D83DDCAEL, 0x00000000D83DDCAFL, 0x0000000000002714L, 0x0000000000002611L, 0x00000000D83DDD18L, 0x00000000D83DDD17L, 0x00000000000027B0L, 0x00000000D83DDD31L, 0x00000000D83DDD32L, 0x00000000D83DDD33L, 0x00000000000025FCL, 0x00000000000025FBL, 0x00000000000025FEL, 0x00000000000025FDL, 0x00000000000025AAL, 0x00000000000025ABL, 0x00000000D83DDD3AL, 0x0000000000002B1CL, 0x0000000000002B1BL, 0x00000000000026ABL, 0x00000000000026AAL, 0x00000000D83DDD34L, 0x00000000D83DDD35L, 0x00000000D83DDD3BL, 0x00000000D83DDD36L, 0x00000000D83DDD37L, 0x00000000D83DDD38L, 0x00000000D83DDD39L}}; } } ================================================ FILE: Telegram.Controls/IHighlightable.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Controls { public interface IHighlightable { bool HighlightItem { get; set; } } } ================================================ FILE: Telegram.Controls/LazyItemsControl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using Telegram.Controls.Extensions; namespace Telegram.Controls { public class LazyItemsControl : ItemsControl, ICompression { private const string VerticalCompressionGroup = "VerticalCompression"; private const string ScrollStatesGroup = "ScrollStates"; private const string CompressionTopState = "CompressionTop"; private const string CompressionBottomState = "CompressionBottom"; private const string ScrollingState = "Scrolling"; private ScrollViewer _scrollViewer; public LazyItemsControl() { Loaded += LazyItemsControl_Loaded; } private void LazyItemsControl_Loaded(object sender, RoutedEventArgs e) { Loaded -= LazyItemsControl_Loaded; _scrollViewer = this.FindChildOfType(); if (_scrollViewer != null) { var element = VisualTreeHelper.GetChild(_scrollViewer, 0) as FrameworkElement; if (element != null) { var verticalGroup = FindVisualState(element, VerticalCompressionGroup); var scrollStatesGroup = FindVisualState(element, ScrollStatesGroup); if (verticalGroup != null) verticalGroup.CurrentStateChanging += VerticalGroup_CurrentStateChanging; if (scrollStatesGroup != null) scrollStatesGroup.CurrentStateChanging += ScrollStateGroup_CurrentStateChanging; } var binding = new Binding("VerticalOffset") { Source = _scrollViewer }; SetBinding(VerticalOffsetProperty, binding); } } public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.Register( "VerticalOffset", typeof (double), typeof (LazyItemsControl), new PropertyMetadata(default(double), OnVerticalOffsetChanged)); public double VerticalOffset { get { return (double) GetValue(VerticalOffsetProperty); } set { SetValue(VerticalOffsetProperty, value); } } private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var lazyItemsControl = (LazyItemsControl)d; lazyItemsControl.OnListenerChanged(d, e); } private double _closeToEndPercent = 0.7; public double CloseToEndPercent { get { return _closeToEndPercent; } set { _closeToEndPercent = value; } } private double _prevVerticalOffset; public event EventHandler CloseToEnd; protected virtual void RaiseCloseToEnd() { var handler = CloseToEnd; if (handler != null) handler(this, EventArgs.Empty); } private void OnListenerChanged(object sender, DependencyPropertyChangedEventArgs e) { if (_prevVerticalOffset >= _scrollViewer.VerticalOffset) return; if (_scrollViewer.VerticalOffset == 0.0 && _scrollViewer.ScrollableHeight == 0.0) return; _prevVerticalOffset = _scrollViewer.VerticalOffset; var atBottom = _scrollViewer.VerticalOffset >= _scrollViewer.ScrollableHeight * CloseToEndPercent; if (atBottom) { RaiseCloseToEnd(); } } private static VisualStateGroup FindVisualState(FrameworkElement element, string stateName) { if (element == null) return null; var groups = VisualStateManager.GetVisualStateGroups(element); return groups.Cast().FirstOrDefault(group => group.Name == stateName); } public event EventHandler Compression; protected virtual void RaiseCompression(CompressionEventArgs e) { var handler = Compression; if (handler != null) handler(this, e); } private void VerticalGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == CompressionTopState) { RaiseCompression(new CompressionEventArgs(CompressionType.Top)); } if (e.NewState.Name == CompressionBottomState) { RaiseCompression(new CompressionEventArgs(CompressionType.Bottom)); } } private void ScrollStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = (e.NewState.Name == ScrollingState); } public static readonly DependencyProperty IsScrollingProperty = DependencyProperty.Register( "IsScrolling", typeof(bool), typeof(LazyItemsControl), new PropertyMetadata(false)); public bool IsScrolling { get { return (bool)GetValue(IsScrollingProperty); } set { SetValue(IsScrollingProperty, value); } } } } ================================================ FILE: Telegram.Controls/LazyListBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; using DanielVaughan.WindowsPhone7Unleashed; using Telegram.Controls.Extensions; namespace Telegram.Controls { public enum CompressionType { Top, Bottom, Left, Right }; public interface ICompression { event EventHandler Compression; } public class LazyListBox : ListBox, ICompression { public static readonly DependencyProperty KeepScrollingPositionProperty = DependencyProperty.Register( "KeepScrollingPosition", typeof (bool), typeof (LazyListBox), new PropertyMetadata(default(bool))); public bool KeepScrollingPosition { get { return (bool) GetValue(KeepScrollingPositionProperty); } set { SetValue(KeepScrollingPositionProperty, value); } } public bool SuppressVerticalOffsetListener { get; set; } public static readonly DependencyProperty IsHorizontalProperty = DependencyProperty.Register( "IsHorizontal", typeof (bool), typeof (LazyListBox), new PropertyMetadata(default(bool), OnIsHorizontalChanged)); private static void OnIsHorizontalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var listBox = d as LazyListBox; if (listBox != null) { var isHorizontal = (bool) e.NewValue; if (isHorizontal) { listBox.ToHorizontalOrientation(); } else { listBox.ToVerticalOrientation(); } } } public bool IsHorizontal { get { return (bool) GetValue(IsHorizontalProperty); } set { SetValue(IsHorizontalProperty, value); } } public void ToHorizontalOrientation() { if (_stackPanel != null) { _stackPanel.Orientation = Orientation.Horizontal; } if (_scrollViewer != null) { _scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; _scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; } } public void ToVerticalOrientation() { if (_stackPanel != null) { _stackPanel.Orientation = Orientation.Vertical; } if (_scrollViewer != null) { _scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; _scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; } } private const string VerticalCompressionGroup = "VerticalCompression"; private const string HorizontalCompressionGroup = "HorizontalCompression"; private const string ScrollStatesGroup = "ScrollStates"; private const string NoHorizontalCompressionState = "NoHorizontalCompression"; private const string CompressionRightState = "CompressionRight"; private const string CompressionLeftState = "CompressionLeft"; private const string NoVerticalCompressionState = "NoVerticalCompression"; private const string CompressionTopState = "CompressionTop"; private const string CompressionBottomState = "CompressionBottom"; private const string ScrollingState = "Scrolling"; public double PanelVerticalOffset { get; set; } public double PanelViewPortHeight { get; set; } private VirtualizingStackPanel _stackPanel; private ScrollViewer _scrollViewer; public ScrollViewer Scroll { get { return _scrollViewer; } } protected bool IsBouncy; private bool _isInitialized; public LazyListBox() { Loaded += ListBox_Loaded; //Unloaded += ListBox_Unloaded; } //~LazyListBox() //{ //} public override void OnApplyTemplate() { base.OnApplyTemplate(); } public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.Register( "VerticalOffset", typeof(double), typeof(LazyListBox), new PropertyMetadata(default(double), OnVerticalOffsetChanged)); private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var lazyListBox = d as LazyListBox; if (lazyListBox != null) { lazyListBox.OnListenerChanged(lazyListBox, new BindingChangedEventArgs(e)); } } public double VerticalOffset { get { return (double) GetValue(VerticalOffsetProperty); } set { SetValue(VerticalOffsetProperty, value); } } private void OnListenerChanged(object sender, BindingChangedEventArgs e) { if (_prevVerticalOffset >= _scrollViewer.VerticalOffset) return; if (_scrollViewer.VerticalOffset == 0.0 && _scrollViewer.ScrollableHeight == 0.0) return; _prevVerticalOffset = _scrollViewer.VerticalOffset; var atBottom = _scrollViewer.VerticalOffset >= _scrollViewer.ScrollableHeight * CloseToEndPercent; if (atBottom) { RaiseCloseToEnd(); } } public void StopScrolling() { //stop scrolling var offset = _stackPanel.VerticalOffset; if (_scrollViewer != null) { _scrollViewer.InvalidateScrollInfo(); _scrollViewer.ScrollToVerticalOffset(offset); VisualStateManager.GoToState(_scrollViewer, "NotScrolling", true); } } public void ScrollToBeginning() { _scrollViewer.ScrollToBeginnig(new Duration(TimeSpan.FromSeconds(0.3))); } private void ListBox_Loaded(object sender, RoutedEventArgs e) { if (_isInitialized) return; _isInitialized = true; AddHandler(ManipulationCompletedEvent, new EventHandler(ListBox_ManipulationCompleted), true); _scrollViewer = this.FindChildOfType(); if (_scrollViewer != null) { _stackPanel = _scrollViewer.FindChildOfType(); if (IsHorizontal) { ToHorizontalOrientation(); } else { ToVerticalOrientation(); } // Visual States are always on the first child of the control template var element = VisualTreeHelper.GetChild(_scrollViewer, 0) as FrameworkElement; if (element != null) { var verticalGroup = FindVisualState(element, VerticalCompressionGroup); var horizontalGroup = FindVisualState(element, HorizontalCompressionGroup); var scrollStatesGroup = FindVisualState(element, ScrollStatesGroup); if (verticalGroup != null) verticalGroup.CurrentStateChanging += VerticalGroup_CurrentStateChanging; if (horizontalGroup != null) horizontalGroup.CurrentStateChanging += HorizontalGroup_CurrentStateChanging; if (scrollStatesGroup != null) scrollStatesGroup.CurrentStateChanging += ScrollStateGroup_CurrentStateChanging; } if (!SuppressVerticalOffsetListener) { var binding = new Binding("VerticalOffset") { Source = _scrollViewer }; SetBinding(VerticalOffsetProperty, binding); } } } private double _closeToEndPercent = 0.7; public double CloseToEndPercent { get { return _closeToEndPercent; } set { _closeToEndPercent = value; } } private double _prevVerticalOffset; public event EventHandler CloseToEnd; protected virtual void RaiseCloseToEnd() { var handler = CloseToEnd; if (handler != null) handler(this, EventArgs.Empty); } private void ScrollStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = (e.NewState.Name == ScrollingState); } public event EventHandler ScrollingStateChanged; protected virtual void RaiseScrollingStateChanged(ScrollingStateChangedEventArgs e) { var handler = ScrollingStateChanged; if (handler != null) handler(this, e); } public static readonly DependencyProperty IsScrollingProperty = DependencyProperty.Register( "IsScrolling", typeof(bool), typeof(LazyListBox), new PropertyMetadata(false, IsScrollingPropertyChanged)); public bool IsScrolling { get { return (bool)GetValue(IsScrollingProperty); } set { SetValue(IsScrollingProperty, value); } } static void IsScrollingPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { var listbox = source as LazyListBox; if (listbox == null) return; listbox.RaiseScrollingStateChanged(new ScrollingStateChangedEventArgs((bool) e.OldValue, (bool) e.NewValue)); } #region Compression public event EventHandler Compression; protected virtual void RaiseCompression(CompressionEventArgs e) { var handler = Compression; if (handler != null) handler(this, e); } private void HorizontalGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == CompressionLeftState) { IsBouncy = true; RaiseCompression(new CompressionEventArgs(CompressionType.Left)); } if (e.NewState.Name == CompressionRightState) { IsBouncy = true; RaiseCompression(new CompressionEventArgs(CompressionType.Right)); } if (e.NewState.Name == NoHorizontalCompressionState) { IsBouncy = false; } } private void VerticalGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == CompressionTopState) { IsBouncy = true; RaiseCompression(new CompressionEventArgs(CompressionType.Top)); } if (e.NewState.Name == CompressionBottomState) { IsBouncy = true; RaiseCompression(new CompressionEventArgs(CompressionType.Bottom)); } if (e.NewState.Name == NoVerticalCompressionState) IsBouncy = false; } private void ListBox_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { if (IsBouncy) IsBouncy = false; } private static VisualStateGroup FindVisualState(FrameworkElement element, string stateName) { if (element == null) return null; var groups = VisualStateManager.GetVisualStateGroups(element); return groups.Cast().FirstOrDefault(group => group.Name == stateName); } #endregion public List GetVisibleItems() { var items = new List(); //if (_stackPanel == null) return items; //var firstVisibleItem = IsHorizontal ? (int)_stackPanel.HorizontalOffset : (int)_stackPanel.VerticalOffset; //var visibleItemCount = IsHorizontal ? (int)_stackPanel.ViewportWidth : (int)_stackPanel.ViewportHeight; //for (int index = firstVisibleItem; index < firstVisibleItem + visibleItemCount + 1; index++) //{ // var item = ItemContainerGenerator.ContainerFromIndex(index) as ListBoxItem; // if (item == null) // continue; // items.Add(item); //} //return items; foreach (var item in Items) { var listBoxItem = ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem; if (IsInView(listBoxItem, this)) { items.Add(listBoxItem); } else if (items.Any()) { break; } } return items; } private static bool IsInView(FrameworkElement element, FrameworkElement container) { if (element == null) return false; var elementBounds = element.TransformToVisual(container).TransformBounds(new Rect(0.0, 0.0, element.ActualWidth, element.ActualHeight)); var containerBounds = new Rect(0.0, 0.0, container.ActualWidth, container.ActualHeight); return containerBounds.Contains(new Point(elementBounds.X, elementBounds.Y)) // topLeft point || containerBounds.Contains(new Point(elementBounds.X + elementBounds.Width, elementBounds.Y + elementBounds.Height)); // bottomRight point } public event EventHandler Clear; protected virtual void RaiseClear() { var handler = Clear; if (handler != null) handler(this, EventArgs.Empty); } public event EventHandler FirstSliceLoaded; protected virtual void RaiseFirstSliceLoaded() { var handler = FirstSliceLoaded; if (handler != null) handler(this, EventArgs.Empty); } public event EventHandler VerticalOffsetChanged; protected virtual void RaiseVerticalOffsetChanged(VerticalOffsetChangedEventArgs e) { EventHandler handler = VerticalOffsetChanged; if (handler != null) handler(this, e); } private object _lastRemovedItem; protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) { if (KeepScrollingPosition) { if (_scrollViewer != null && _scrollViewer.VerticalOffset > 0.0001) { if (e.Action == NotifyCollectionChangedAction.Add) { if (e.NewItems != null && e.NewItems.Count == 1 && e.NewStartingIndex == 0) { if (_lastRemovedItem != e.NewItems[0]) { var nextOffset = Math.Min(_scrollViewer.VerticalOffset + 1.0, _scrollViewer.ScrollableHeight + 1.0); Debug.WriteLine("VerticalOffset={0} ExtentHeight={1} ViewportHeight={2} ScrollableHeight={3}", _scrollViewer.VerticalOffset, _scrollViewer.ExtentHeight, _scrollViewer.ViewportHeight, _scrollViewer.ScrollableHeight); RaiseVerticalOffsetChanged(new VerticalOffsetChangedEventArgs { Viewer = _scrollViewer }); _scrollViewer.ScrollToVerticalOffset(nextOffset); } } } else if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldItems != null && e.OldItems.Count == 1 && (e.OldStartingIndex) <= _scrollViewer.VerticalOffset) { _lastRemovedItem = e.OldItems[0]; } else { _lastRemovedItem = null; } } } //if (_scrollViewer != null && _scrollViewer.VerticalOffset > 0.0001) //{ // if (e.Action == NotifyCollectionChangedAction.Add) // { // if (e.NewItems != null && e.NewStartingIndex == 0) // { // foreach (var newItem in e.NewItems) // { // _scrollViewer.ScrollToVerticalOffset(Math.Min(_scrollViewer.VerticalOffset + 1.0, _scrollViewer.ScrollableHeight)); // } // } // } // else if (e.Action == NotifyCollectionChangedAction.Remove) // { // if (e.OldItems != null && e.OldStartingIndex == 0) // { // foreach (var oldItem in e.OldItems) // { // _scrollViewer.ScrollToVerticalOffset(Math.Max(_scrollViewer.VerticalOffset - 1.0, 0.0)); // } // } // } //} } if (e.Action == NotifyCollectionChangedAction.Reset) { RaiseClear(); } else if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems != null && Items != null && Items.Count == e.NewItems.Count) { RaiseFirstSliceLoaded(); } base.OnItemsChanged(e); } } public class VerticalOffsetChangedEventArgs : EventArgs { public ScrollViewer Viewer { get; set; } } public class ScrollingStateChangedEventArgs : EventArgs { public bool OldValue { get; private set; } public bool NewValue { get; private set; } public ScrollingStateChangedEventArgs(bool oldValue, bool newValue) { OldValue = oldValue; NewValue = newValue; } } public class CompressionEventArgs : EventArgs { public CompressionType Type { get; protected set; } public CompressionEventArgs(CompressionType type) { Type = type; } } } ================================================ FILE: Telegram.Controls/LongListSelector/Common/MotionParameters.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Controls.LongListSelector.Common { internal static class MotionParameters { public static double MaximumSpeed { get { return 4000.0; } } public static double ParkingSpeed { get { return 80.0; } } public static double Friction { get { return 0.2; } } } } ================================================ FILE: Telegram.Controls/LongListSelector/Common/SafeRaise.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics.CodeAnalysis; namespace Telegram.Controls.LongListSelector.Common { /// /// A helper class for raising events safely. /// internal static class SafeRaise { /// /// Raises an event in a thread-safe manner, also does the null check. /// /// The event to raise. /// The event sender. [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Keeping existing implementation.")] public static void Raise(EventHandler eventToRaise, object sender) { if (eventToRaise != null) { eventToRaise(sender, EventArgs.Empty); } } /// /// Raises an event in a thread-safe manner, also does the null check. /// /// The event to raise. /// The event sender. public static void Raise(EventHandler eventToRaise, object sender) { Raise(eventToRaise, sender, EventArgs.Empty); } /// /// Raises an event in a thread-safe manner, also does the null check. /// /// The event args type. /// The event to raise. /// The event sender. /// The event args. public static void Raise(EventHandler eventToRaise, object sender, T args) where T : EventArgs { if (eventToRaise != null) { eventToRaise(sender, args); } } // Lazy event args creation example: // // public class MyEventArgs : EventArgs // { // public MyEventArgs(int x) { X = x; } // public int X { get; set; } // } // // event EventHandler Foo; // // public void Bar() // { // int y = 2; // Raise(Foo, null, () => { return new MyEventArgs(y); }); // } /// /// This is a method that returns event args, used for lazy creation. /// /// The event type. /// public delegate T GetEventArgs() where T : EventArgs; /// /// Raise an event in a thread-safe manner, with the required null check. Lazily creates event args. /// /// The event args type. /// The event to raise. /// The event sender. /// The delegate to return the event args if needed. public static void Raise(EventHandler eventToRaise, object sender, GetEventArgs getEventArgs) where T : EventArgs { if (eventToRaise != null) { eventToRaise(sender, getEventArgs()); } } } } ================================================ FILE: Telegram.Controls/LongListSelector/Common/TempaltedVisualTreeExtensions.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using Telegram.Controls.Extensions; namespace Telegram.Controls.LongListSelector.Common { /// /// A static class providing methods for working with the visual tree using generics. /// public static class TemplatedVisualTreeExtensions { #region GetFirstLogicalChildByType(...) /// /// Retrieves the first logical child of a specified type using a /// breadth-first search. A visual element is assumed to be a logical /// child of another visual element if they are in the same namescope. /// For performance reasons this method manually manages the queue /// instead of using recursion. /// /// The parent framework element. /// Specifies whether to apply templates on the traversed framework elements /// The first logical child of the framework element of the specified type. internal static T GetFirstLogicalChildByType(this FrameworkElement parent, bool applyTemplates) where T : FrameworkElement { Debug.Assert(parent != null, "The parent cannot be null."); Queue queue = new Queue(); queue.Enqueue(parent); while (queue.Count > 0) { FrameworkElement element = queue.Dequeue(); var elementAsControl = element as Control; if (applyTemplates && elementAsControl != null) { elementAsControl.ApplyTemplate(); } if (element is T && element != parent) { return (T)element; } foreach (FrameworkElement visualChild in element.GetVisualChildren().OfType()) { queue.Enqueue(visualChild); } } return null; } #endregion #region GetLogicalChildrenByType(...) /// /// Retrieves all the logical children of a specified type using a /// breadth-first search. A visual element is assumed to be a logical /// child of another visual element if they are in the same namescope. /// For performance reasons this method manually manages the queue /// instead of using recursion. /// /// The parent framework element. /// Specifies whether to apply templates on the traversed framework elements /// The logical children of the framework element of the specified type. internal static IEnumerable GetLogicalChildrenByType(this FrameworkElement parent, bool applyTemplates) where T : FrameworkElement { Debug.Assert(parent != null, "The parent cannot be null."); if (applyTemplates && parent is Control) { ((Control)parent).ApplyTemplate(); } Queue queue = new Queue(parent.GetVisualChildren().OfType()); while (queue.Count > 0) { FrameworkElement element = queue.Dequeue(); if (applyTemplates && element is Control) { ((Control)element).ApplyTemplate(); } if (element is T) { yield return (T)element; } foreach (FrameworkElement visualChild in element.GetVisualChildren().OfType()) { queue.Enqueue(visualChild); } } } #endregion } } ================================================ FILE: Telegram.Controls/LongListSelector/Common/VisualStates.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace Telegram.Controls.LongListSelector.Common { /// /// Names and helpers for visual states in the controls. /// internal static class VisualStates { #region GroupCommon /// /// Common state group. /// public const string GroupCommon = "CommonStates"; /// /// Normal state of the Common state group. /// public const string StateNormal = "Normal"; /// /// Normal state of the Common state group. /// public const string StateReadOnly = "ReadOnly"; /// /// MouseOver state of the Common state group. /// public const string StateMouseOver = "MouseOver"; /// /// Pressed state of the Common state group. /// public const string StatePressed = "Pressed"; /// /// Disabled state of the Common state group. /// public const string StateDisabled = "Disabled"; #endregion GroupCommon #region GroupFocus /// /// Focus state group. /// public const string GroupFocus = "FocusStates"; /// /// Unfocused state of the Focus state group. /// public const string StateUnfocused = "Unfocused"; /// /// Focused state of the Focus state group. /// public const string StateFocused = "Focused"; #endregion GroupFocus #region GroupSelection /// /// Selection state group. /// public const string GroupSelection = "SelectionStates"; /// /// Selected state of the Selection state group. /// public const string StateSelected = "Selected"; /// /// Unselected state of the Selection state group. /// public const string StateUnselected = "Unselected"; /// /// Selected inactive state of the Selection state group. /// public const string StateSelectedInactive = "SelectedInactive"; #endregion GroupSelection #region GroupExpansion /// /// Expansion state group. /// public const string GroupExpansion = "ExpansionStates"; /// /// Expanded state of the Expansion state group. /// public const string StateExpanded = "Expanded"; /// /// Collapsed state of the Expansion state group. /// public const string StateCollapsed = "Collapsed"; #endregion GroupExpansion #region GroupPopup /// /// Popup state group. /// public const string GroupPopup = "PopupStates"; /// /// Opened state of the Popup state group. /// public const string StatePopupOpened = "PopupOpened"; /// /// Closed state of the Popup state group. /// public const string StatePopupClosed = "PopupClosed"; #endregion #region GroupValidation /// /// ValidationStates state group. /// public const string GroupValidation = "ValidationStates"; /// /// The valid state for the ValidationStates group. /// public const string StateValid = "Valid"; /// /// Invalid, focused state for the ValidationStates group. /// public const string StateInvalidFocused = "InvalidFocused"; /// /// Invalid, unfocused state for the ValidationStates group. /// public const string StateInvalidUnfocused = "InvalidUnfocused"; #endregion #region GroupExpandDirection /// /// ExpandDirection state group. /// public const string GroupExpandDirection = "ExpandDirectionStates"; /// /// Down expand direction state of ExpandDirection state group. /// public const string StateExpandDown = "ExpandDown"; /// /// Up expand direction state of ExpandDirection state group. /// public const string StateExpandUp = "ExpandUp"; /// /// Left expand direction state of ExpandDirection state group. /// public const string StateExpandLeft = "ExpandLeft"; /// /// Right expand direction state of ExpandDirection state group. /// public const string StateExpandRight = "ExpandRight"; #endregion #region GroupHasItems /// /// HasItems state group. /// public const string GroupHasItems = "HasItemsStates"; /// /// HasItems state of the HasItems state group. /// public const string StateHasItems = "HasItems"; /// /// NoItems state of the HasItems state group. /// public const string StateNoItems = "NoItems"; #endregion GroupHasItems #region GroupIncrease /// /// Increment state group. /// public const string GroupIncrease = "IncreaseStates"; /// /// State enabled for increment group. /// public const string StateIncreaseEnabled = "IncreaseEnabled"; /// /// State disabled for increment group. /// public const string StateIncreaseDisabled = "IncreaseDisabled"; #endregion GroupIncrease #region GroupDecrease /// /// Decrement state group. /// public const string GroupDecrease = "DecreaseStates"; /// /// State enabled for decrement group. /// public const string StateDecreaseEnabled = "DecreaseEnabled"; /// /// State disabled for decrement group. /// public const string StateDecreaseDisabled = "DecreaseDisabled"; #endregion GroupDecrease #region GroupIteractionMode /// /// InteractionMode state group. /// public const string GroupInteractionMode = "InteractionModeStates"; /// /// Edit of the DisplayMode state group. /// public const string StateEdit = "Edit"; /// /// Display of the DisplayMode state group. /// public const string StateDisplay = "Display"; #endregion GroupIteractionMode #region GroupLocked /// /// DisplayMode state group. /// public const string GroupLocked = "LockedStates"; /// /// Edit of the DisplayMode state group. /// public const string StateLocked = "Locked"; /// /// Display of the DisplayMode state group. /// public const string StateUnlocked = "Unlocked"; #endregion GroupLocked #region GroupActive /// /// Active state. /// public const string StateActive = "Active"; /// /// Inactive state. /// public const string StateInactive = "Inactive"; /// /// Active state group. /// public const string GroupActive = "ActiveStates"; #endregion GroupActive #region GroupWatermark /// /// Non-watermarked state. /// public const string StateUnwatermarked = "Unwatermarked"; /// /// Watermarked state. /// public const string StateWatermarked = "Watermarked"; /// /// Watermark state group. /// public const string GroupWatermark = "WatermarkStates"; #endregion GroupWatermark #region GroupCalendarButtonFocus /// /// Unfocused state for Calendar Buttons. /// public const string StateCalendarButtonUnfocused = "CalendarButtonUnfocused"; /// /// Focused state for Calendar Buttons. /// public const string StateCalendarButtonFocused = "CalendarButtonFocused"; /// /// CalendarButtons Focus state group. /// public const string GroupCalendarButtonFocus = "CalendarButtonFocusStates"; #endregion GroupCalendarButtonFocus #region GroupBusyStatus /// /// Busy state for BusyIndicator. /// public const string StateBusy = "Busy"; /// /// Idle state for BusyIndicator. /// public const string StateIdle = "Idle"; /// /// Busyness group name. /// public const string GroupBusyStatus = "BusyStatusStates"; #endregion #region GroupVisibility /// /// Visible state name for BusyIndicator. /// public const string StateVisible = "Visible"; /// /// Hidden state name for BusyIndicator. /// public const string StateHidden = "Hidden"; /// /// BusyDisplay group. /// public const string GroupVisibility = "VisibilityStates"; #endregion /// /// Use VisualStateManager to change the visual state of the control. /// /// /// Control whose visual state is being changed. /// /// /// A value indicating whether to use transitions when updating the /// visual state, or to snap directly to the new visual state. /// /// /// Ordered list of state names and fallback states to transition into. /// Only the first state to be found will be used. /// public static void GoToState(Control control, bool useTransitions, params string[] stateNames) { Debug.Assert(control != null, "control should not be null!"); Debug.Assert(stateNames != null, "stateNames should not be null!"); Debug.Assert(stateNames.Length > 0, "stateNames should not be empty!"); foreach (string name in stateNames) { if (VisualStateManager.GoToState(control, name, useTransitions)) { break; } } } /// /// Gets the implementation root of the Control. /// /// The DependencyObject. /// /// Implements Silverlight's corresponding internal property on Control. /// /// Returns the implementation root or null. public static FrameworkElement GetImplementationRoot(DependencyObject dependencyObject) { Debug.Assert(dependencyObject != null, "DependencyObject should not be null."); return (1 == VisualTreeHelper.GetChildrenCount(dependencyObject)) ? VisualTreeHelper.GetChild(dependencyObject, 0) as FrameworkElement : null; } /// /// This method tries to get the named VisualStateGroup for the /// dependency object. The provided object's ImplementationRoot will be /// looked up in this call. /// /// The dependency object. /// The visual state group's name. /// Returns null or the VisualStateGroup object. public static VisualStateGroup TryGetVisualStateGroup(DependencyObject dependencyObject, string groupName) { FrameworkElement root = GetImplementationRoot(dependencyObject); if (root == null) { return null; } return VisualStateManager.GetVisualStateGroups(root) .OfType() .Where(group => string.CompareOrdinal(groupName, group.Name) == 0) .FirstOrDefault(); } } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelector.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Markup; using System.Windows.Media; using DanielVaughan.WindowsPhone7Unleashed; using Telegram.Controls.LongListSelector.Common; namespace Telegram.Controls.LongListSelector { /// /// Represents a virtualizing list designed for grouped lists. Can also be /// used with flat lists. /// /// Preview [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "LongListSelector is a complicated control.")] [TemplatePart(Name = TemplatedListBoxName, Type = typeof(TemplatedListBox))] public partial class LongListSelector : Control { #region Constants /// /// The templated list box name. /// private const string TemplatedListBoxName = "TemplatedListBox"; /// /// This constant is not actively used in the new version, however, the /// value is exposed through a deprecated property. For backward- /// compatibility only. /// private const double BufferSizeDefault = 1.0; /// /// The Scrolling state name. /// private const string ScrollingState = "Scrolling"; /// /// The NotScrolling state name. /// private const string NotScrollingState = "NotScrolling"; /// /// The vertical compression top state name. /// private const string CompressionTop = "CompressionTop"; /// /// The vertical compression bottom state name. /// private const string CompressionBottom = "CompressionBottom"; /// /// The absense of vertical compression state name. /// private const string NoVerticalCompression = "NoVerticalCompression"; /// /// The vertical compression state name. /// private const string VerticalCompressionStateName = "VerticalCompression"; /// /// The name of the scroll states visual state group. /// private const string ScrollStatesGroupName = "ScrollStates"; #endregion /// /// Reference to the ListBox hosted in this control. /// private TemplatedListBox _listBox; private ScrollViewer _scrollViewer; /// /// Reference to the visual state group for scrolling. /// private VisualStateGroup _scrollGroup; /// /// Reference to the visual state group for vertical compression. /// private VisualStateGroup _verticalCompressionGroup; /// /// // Used to listen for changes in the ItemsSource /// (_rootCollection = ItemsSource as INotifyCollectionChanged). /// private INotifyCollectionChanged _rootCollection; /// /// Used to listen for changes in the groups within ItemsSource. /// private List _groupCollections = new List(); #region Properties /// /// Gets or sets whether the list is flat instead of a group hierarchy. /// public bool IsFlatList { get; set; } /// /// Gets or sets the selected item. /// public object SelectedItem { get { if (_listBox != null && _listBox.SelectedItem != null) { LongListSelectorItem tuple = (LongListSelectorItem)_listBox.SelectedItem; if (tuple.ItemType == LongListSelectorItemType.Item) return tuple.Item; } return null; } set { if (_listBox != null) { if (value == null) { _listBox.SelectedItem = null; } else { foreach (LongListSelectorItem tuple in _listBox.ItemsSource) { if (tuple.Item == value) { _listBox.SelectedItem = tuple; break; } } } } } } /// /// Gets or sets whether the list can be (temporarily) scrolled off of the ends. /// [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Backward compatible public setter.")] [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value", Justification = "Backward compatible public setter.")] [Obsolete("IsBouncy is always set to true.")] public bool IsBouncy { get { return true; } set { } } /// /// Gets whether a list header is shown. /// private bool HasListHeader { get { return ListHeaderTemplate != null || ListHeader is UIElement; } } /// /// Gets whether a list footer is shown. /// private bool HasListFooter { get { return ListFooterTemplate != null || ListFooter is UIElement; } } /// /// Gets whether or not the user is manipulating the list, or if an inertial animation is taking place. /// public bool IsScrolling { get; private set; } /// /// Gets whether or not stretching is taking place. /// public bool IsStretching { get; private set; } #endregion #region Dependency Properties #region HorizontalScrollBar DependencyProperty public static readonly DependencyProperty HorizontalScrollBarVisibilityProperty = DependencyProperty.Register( "HorizontalScrollBarVisibility", typeof(ScrollBarVisibility), typeof(LongListSelector), new PropertyMetadata(ScrollBarVisibility.Disabled)); public ScrollBarVisibility HorizontalScrollBarVisibility { get { return (ScrollBarVisibility) GetValue(HorizontalScrollBarVisibilityProperty); } set { SetValue(HorizontalScrollBarVisibilityProperty, value); } } #endregion #region VerticalScrollBar DependencyProperty public static readonly DependencyProperty VerticalScrollBarVisibilityProperty = DependencyProperty.Register( "VerticalScrollBarVisibility", typeof(ScrollBarVisibility), typeof(LongListSelector), new PropertyMetadata(ScrollBarVisibility.Auto)); public ScrollBarVisibility VerticalScrollBarVisibility { get { return (ScrollBarVisibility) GetValue(VerticalScrollBarVisibilityProperty); } set { SetValue(VerticalScrollBarVisibilityProperty, value); } } #endregion #region ItemsSource DependencyProperty /// /// The DataSource property. Where all of the items come from. /// public IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } set { SetValue(ItemsSourceProperty, value); } } /// /// The DataSource DependencyProperty. /// public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(LongListSelector), new PropertyMetadata(null, OnItemsSourceChanged)); private static void OnItemsSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { ((LongListSelector)obj).OnItemsSourceChanged(); } #endregion #region ListHeader DependencyProperty /// /// The ListHeader property. Will be used as the first scrollItem in the list. /// public object ListHeader { get { return (object)GetValue(ListHeaderProperty); } set { SetValue(ListHeaderProperty, value); } } /// /// The ListHeader DependencyProperty. /// public static readonly DependencyProperty ListHeaderProperty = DependencyProperty.Register("ListHeader", typeof(object), typeof(LongListSelector), new PropertyMetadata(null)); #endregion #region ItemsPanel DependencyProperty /// /// The ItemsPanel provides the template for the ListHeader. /// public ItemsPanelTemplate ItemsPanel { get { return (ItemsPanelTemplate)GetValue(ItemsPanelProperty); } set { SetValue(ItemsPanelProperty, value); } } /// /// The ItemsPanel DependencyProperty. /// public static readonly DependencyProperty ItemsPanelProperty = DependencyProperty.Register("ItemsPanel", typeof(ItemsPanelTemplate), typeof(LongListSelector), new PropertyMetadata(OnItemsPanelChanged)); private static void OnItemsPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = d as LongListSelector; if (control != null) { if (control._listBox != null) { control._listBox.ItemsPanel = e.NewValue as ItemsPanelTemplate; } } } #endregion #region ListHeaderTemplate DependencyProperty /// /// The ListHeaderTemplate provides the template for the ListHeader. /// public DataTemplate ListHeaderTemplate { get { return (DataTemplate)GetValue(ListHeaderTemplateProperty); } set { SetValue(ListHeaderTemplateProperty, value); } } /// /// The ListHeaderTemplate DependencyProperty. /// public static readonly DependencyProperty ListHeaderTemplateProperty = DependencyProperty.Register("ListHeaderTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null, OnDataTemplateChanged)); #endregion #region ListFooter DependencyProperty /// /// The ListFooter property. Will be used as the first scrollItem in the list. /// public object ListFooter { get { return (object)GetValue(ListFooterProperty); } set { SetValue(ListFooterProperty, value); } } /// /// The ListFooter DependencyProperty. /// public static readonly DependencyProperty ListFooterProperty = DependencyProperty.Register("ListFooter", typeof(object), typeof(LongListSelector), new PropertyMetadata(null)); #endregion #region ListFooterTemplate DependencyProperty /// /// The ListFooterTemplate provides the template for the ListFooter. /// public DataTemplate ListFooterTemplate { get { return (DataTemplate)GetValue(ListFooterTemplateProperty); } set { SetValue(ListFooterTemplateProperty, value); } } /// /// The ListFooterTemplate DependencyProperty. /// public static readonly DependencyProperty ListFooterTemplateProperty = DependencyProperty.Register("ListFooterTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null, OnDataTemplateChanged)); #endregion #region GroupHeaderTemplate DependencyProperty /// /// The GroupHeaderTemplate provides the template for the groups in the items view. /// public DataTemplate GroupHeaderTemplate { get { return (DataTemplate)GetValue(GroupHeaderProperty); } set { SetValue(GroupHeaderProperty, value); } } /// /// The GroupHeaderTemplate DependencyProperty. /// public static readonly DependencyProperty GroupHeaderProperty = DependencyProperty.Register("GroupHeaderTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null, OnDataTemplateChanged)); #endregion #region GroupFooterTemplate DependencyProperty /// /// The GroupFooterTemplate provides the template for the groups in the items view. /// public DataTemplate GroupFooterTemplate { get { return (DataTemplate)GetValue(GroupFooterProperty); } set { SetValue(GroupFooterProperty, value); } } /// /// The GroupFooterTemplate DependencyProperty. /// public static readonly DependencyProperty GroupFooterProperty = DependencyProperty.Register("GroupFooterTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null, OnDataTemplateChanged)); #endregion #region ItemTemplate DependencyProperty /// /// The ItemTemplate provides the template for the items in the items view. /// public DataTemplate ItemTemplate { get { return (DataTemplate)GetValue(ItemsTemplateProperty); } set { SetValue(ItemsTemplateProperty, value); } } /// /// The ItemTemplate DependencyProperty. /// public static readonly DependencyProperty ItemsTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null, OnDataTemplateChanged)); #endregion #region DisplayAllGroups DependencyProperty /// /// Display all groups whether or not they have items. /// public bool DisplayAllGroups { get { return (bool)GetValue(DisplayAllGroupsProperty); } set { SetValue(DisplayAllGroupsProperty, value); } } /// /// DisplayAllGroups DependencyProperty /// public static readonly DependencyProperty DisplayAllGroupsProperty = DependencyProperty.Register("DisplayAllGroups", typeof(bool), typeof(LongListSelector), new PropertyMetadata(false, OnDisplayAllGroupsChanged)); #endregion #region GroupItemTemplate DependencyProperty /// /// The GroupItemTemplate specifies the template that will be used in group view mode. /// public DataTemplate GroupItemTemplate { get { return (DataTemplate)GetValue(GroupItemTemplateProperty); } set { SetValue(GroupItemTemplateProperty, value); } } /// /// The GroupItemTemplate DependencyProperty. /// public static readonly DependencyProperty GroupItemTemplateProperty = DependencyProperty.Register("GroupItemTemplate", typeof(DataTemplate), typeof(LongListSelector), new PropertyMetadata(null)); #endregion #region GroupItemsPanel DependencyProperty /// /// The GroupItemsPanel specifies the panel that will be used in group view mode. /// public ItemsPanelTemplate GroupItemsPanel { get { return (ItemsPanelTemplate)GetValue(GroupItemsPanelProperty); } set { SetValue(GroupItemsPanelProperty, value); } } /// /// The GroupItemsPanel DependencyProperty. /// public static readonly DependencyProperty GroupItemsPanelProperty = DependencyProperty.Register("GroupItemsPanel", typeof(ItemsPanelTemplate), typeof(LongListSelector), new PropertyMetadata(null)); #endregion #region BufferSize DependencyProperty /// /// The number of "screens" (as defined by the ActualHeight of the LongListSelector) above and below the visible /// items of the list that will be filled with items. /// [Obsolete("BufferSize no longer affect items virtualization")] public double BufferSize { get { return (double)GetValue(BufferSizeProperty); } set { SetValue(BufferSizeProperty, value); } } /// /// The BufferSize DependencyProperty /// [Obsolete("BufferSizeProperty no longer affect items virtualization")] public static readonly DependencyProperty BufferSizeProperty = DependencyProperty.Register("BufferSize", typeof(double), typeof(LongListSelector), new PropertyMetadata(BufferSizeDefault, OnBufferSizeChanged)); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")] private static void OnBufferSizeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { double newValue = (double)e.NewValue; if (newValue < 0) { throw new ArgumentOutOfRangeException("BufferSize"); } } #endregion #region MaximumFlickVelocity DependencyProperty /// /// The maximum velocity for flicks, in pixels per second. /// [Obsolete("MaximumFlickVelocity is not used anymore.")] public double MaximumFlickVelocity { get { return (double)GetValue(MaximumFlickVelocityProperty); } set { SetValue(MaximumFlickVelocityProperty, value); } } /// /// The MaximumFlickVelocity DependencyProperty. /// [Obsolete("MaximumFlickVelocityProperty is not used anymore.")] public static readonly DependencyProperty MaximumFlickVelocityProperty = DependencyProperty.Register("MaximumFlickVelocity", typeof(double), typeof(LongListSelector), new PropertyMetadata(MotionParameters.MaximumSpeed)); #endregion #region ShowListHeader DependencyProperty /// /// Controls whether or not the ListHeader is shown. /// public bool ShowListHeader { get { return (bool)GetValue(ShowListHeaderProperty); } set { SetValue(ShowListHeaderProperty, value); } } /// /// The ShowListHeader DependencyProperty. /// public static readonly DependencyProperty ShowListHeaderProperty = DependencyProperty.Register("ShowListHeader", typeof(bool), typeof(LongListSelector), new PropertyMetadata(true, OnShowListHeaderChanged)); private static void OnShowListHeaderChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { LongListSelector control = (LongListSelector)obj; if (control._listBox != null) { Collection tuples = (Collection)control._listBox.ItemsSource; if (control.ShowListHeader) { control.AddListHeader(tuples); } else { RemoveListHeader(tuples); } } } #endregion #region ShowListFooter DependencyProperty /// /// Controls whether or not the ListFooter is shown. /// public bool ShowListFooter { get { return (bool)GetValue(ShowListFooterProperty); } set { SetValue(ShowListFooterProperty, value); } } /// /// The ShowListFooter DependencyProperty. /// public static readonly DependencyProperty ShowListFooterProperty = DependencyProperty.Register("ShowListFooter", typeof(bool), typeof(LongListSelector), new PropertyMetadata(true, OnShowListFooterChanged)); private static void OnShowListFooterChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { LongListSelector control = (LongListSelector)obj; if (control._listBox != null) { Collection tuples = (Collection)control._listBox.ItemsSource; if (control.ShowListFooter) { control.AddListFooter(tuples); } else { RemoveListFooter(tuples); } } } #endregion #endregion #region Events /// /// Occurs when the currently selected item changes. /// public event SelectionChangedEventHandler SelectionChanged; /// /// Occurs when this control starts scrolling. /// public event EventHandler ScrollingStarted; /// /// Occurs when this control stops scrolling. /// public event EventHandler ScrollingCompleted; /// /// Occurs when the group Popup's IsOpen has been set to true. /// public event EventHandler GroupViewOpened; /// /// Occurs when the group popup is about to close. /// public event EventHandler GroupViewClosing; /// /// Occurs when an item is about to be "realized". /// public event EventHandler Link; /// /// Occurs when an item is about to be "un-realized". /// public event EventHandler Unlink; /// /// Occurs when the user has dragged the items up from the bottom as far as they can go. /// public event EventHandler StretchingBottom; /// /// Occurs when the user is no longer stretching. /// public event EventHandler StretchingCompleted; /// /// Occurs when the user has dragged the items down from the top as far as they can go. /// public event EventHandler StretchingTop; #endregion #region Constructor /// /// Initializes a new instance of . /// public LongListSelector() { DefaultStyleKey = typeof(LongListSelector); } //~LongListSelector() //{ //} #endregion // // Public methods // public void ScrollToTop() { if (_scrollViewer != null) { _scrollViewer.ScrollToVerticalOffset(0.0); } } #region ScrollTo(...) /// /// Instantly jump to the specified item. /// /// Item to jump to. public void ScrollTo(object item) { if (_listBox != null && item != null) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; LongListSelectorItem lastTuple = tuples[tuples.Count - 1]; _listBox.ScrollIntoView(lastTuple); UpdateLayout(); foreach (LongListSelectorItem tuple in _listBox.ItemsSource) { if (tuple.Item != null && tuple.Item.Equals(item)) { _listBox.ScrollIntoView(tuple); break; } } } } #endregion #region ScrollToGroup(...) /// /// Instantly jump to the specified group. /// /// Group to jump to. public void ScrollToGroup(object group) { ScrollTo(group); } #endregion #region DisplayGroupView() /// /// Invokes the group view if a GroupItemTemplate has been defined. /// public void DisplayGroupView() { if (GroupItemTemplate != null && !IsFlatList) { OpenPopup(); } } #endregion #region CloseGroupView() /// /// Closes the group view unconditionally. /// /// Does not raise the GroupViewClosingEventArgs event. public void CloseGroupView() { ClosePopup(null, false); } #endregion // Obsolete: #region AnimateTo(...) /// /// Animate the scrolling of the list to the specified item. /// /// Item to scroll to. [Obsolete("AnimateTo(...) call ScrollTo(...) to jump without animation to the given item.")] public void AnimateTo(object item) { ScrollTo(item); } #endregion /// /// Returns either containers or items for either all items with /// containers or just the visible ones, as specified by the /// parameters. /// /// When true, will return values for /// only items that are in view. /// When true, will return the containers /// rather than the items. /// Returns either containers or items for either all items /// with containers or just the visible ones, as specified by the /// parameters. [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "getContainers", Justification = "This is an obsolete old method that cannot change now.")] [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "onlyItemsInView", Justification = "This is an obsolete old method that cannot change now.")] [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This is an obsolete old method that cannot change now.")] [Obsolete("GetItemsWithContainers(...) always returns an empty collection of items. Rely on Link/Unlink to know an item get realized or unrealized.")] public ICollection GetItemsWithContainers(bool onlyItemsInView, bool getContainers) { return new Collection(); } #region GetItemsInView() /// /// Returns all of the items that are currently in view. /// This is not the same as the items that have associated visual elements: there are usually some visuals offscreen. /// This might be an empty list if scrolling is happening too quickly. /// /// Returns all of the items that are currently in view. [Obsolete("GetItemsInView() always returns an empty collection of items. Rely on Link/Unlink to know an item get realized or unrealized.")] public ICollection GetItemsInView() { return GetItemsWithContainers(true, false); } #endregion #region OnItemsSourceChanged() /// /// Called when the ItemsSource dependency property changes. /// private void OnItemsSourceChanged() { // Reload the whole list. LoadDataIntoListBox(); } #endregion #region OnApplyTemplate() /// /// Called whenever a template gets applied on this control. /// public override void OnApplyTemplate() { base.OnApplyTemplate(); // Unsubscribe from events we registered for in the past. if (_listBox != null) { _listBox.SelectionChanged -= OnSelectionChanged; _listBox.Link -= OnLink; _listBox.Unlink -= OnUnlink; } if (_scrollGroup != null) { _scrollGroup.CurrentStateChanging -= OnScrollStateChanging; } // Locates and setup the TemplatedListBox in the template. If no TemplatedListBox is found, we // initialize one. _listBox = GetTemplateChild(TemplatedListBoxName) as TemplatedListBox ?? new TemplatedListBox(); _listBox.ItemsPanel = ItemsPanel; _listBox.ListHeaderTemplate = ListHeaderTemplate; _listBox.ListFooterTemplate = ListFooterTemplate; _listBox.GroupHeaderTemplate = GroupHeaderTemplate; _listBox.GroupFooterTemplate = GroupFooterTemplate; _listBox.ItemTemplate = ItemTemplate; _listBox.SelectionChanged += OnSelectionChanged; _listBox.Link += OnLink; _listBox.Unlink += OnUnlink; // Retrieves the ScrollViewer of the list box. ScrollViewer sv = _listBox.GetFirstLogicalChildByType(true); if (sv != null) { _scrollViewer = sv; _scrollViewer.HorizontalScrollBarVisibility = HorizontalScrollBarVisibility; _scrollViewer.VerticalScrollBarVisibility = VerticalScrollBarVisibility; // Visual States are always on the first child of the control template FrameworkElement element = VisualTreeHelper.GetChild(sv, 0) as FrameworkElement; if (element != null) { _scrollGroup = VisualStates.TryGetVisualStateGroup(sv, ScrollStatesGroupName); if (_scrollGroup != null) { _scrollGroup.CurrentStateChanging += OnScrollStateChanging; } _verticalCompressionGroup = VisualStates.TryGetVisualStateGroup(sv, VerticalCompressionStateName); if(_verticalCompressionGroup != null) { _verticalCompressionGroup.CurrentStateChanging += OnStretchStateChanging; } } var binding = new Binding("VerticalOffset") { Source = _scrollViewer }; SetBinding(VerticalOffsetProperty, binding); } LoadDataIntoListBox(); } #endregion #region LoadDataIntoListBox() /// /// Loads ItemsSource into the hosted list box. /// private void LoadDataIntoListBox() { if (_listBox != null) { ObservableCollection tuples = new ObservableCollection(); AddListHeader(tuples); UnsubscribeFromAllCollections(); // if it's a flat list, add the items without grouping. if (IsFlatList) { if (ItemsSource != null) { foreach (object item in ItemsSource) { tuples.Add(new LongListSelectorItem() { Item = item, ItemType = LongListSelectorItemType.Item }); } } } // Otherwise, apply the grouping logic. else { IEnumerable groups = ItemsSource; if (groups != null) { foreach (object group in groups) { AddGroup(group, tuples); } } } AddListFooter(tuples); _rootCollection = ItemsSource as INotifyCollectionChanged; if (_rootCollection != null) { _rootCollection.CollectionChanged += OnCollectionChanged; } _listBox.ItemsSource = tuples; } } #endregion #region List/Footer Headers /// /// Adds a list header to the given list. /// private void AddListHeader(IList tuples) { if (HasListHeader && ShowListHeader && // Adds the list header if it got a template or if it's a UI element itself. (tuples.Count == 0 || tuples[0].ItemType != LongListSelectorItemType.ListHeader)) // Also, make sure its not already there { tuples.Insert(0, new LongListSelectorItem() { Item = ListHeader, ItemType = LongListSelectorItemType.ListHeader }); } } /// /// Adds a list header to the listbox. /// private void AddListHeader() { AddListHeader((ObservableCollection)_listBox.ItemsSource); } /// /// Removes the list header from the given list. /// private static void RemoveListHeader(IList tuples) { if (tuples.Count > 0 && tuples[0].ItemType == LongListSelectorItemType.ListHeader) { tuples.RemoveAt(0); } } /// /// Removes the list header from the listbox. /// private void RemoveListHeader() { RemoveListHeader((ObservableCollection)_listBox.ItemsSource); } /// /// Adds a list footer to the given list. /// private void AddListFooter(IList tuples) { if (HasListFooter && ShowListFooter && // Adds the list footer if it got a template or if it's a UI element itself. (tuples.Count == 0 || tuples[tuples.Count - 1].ItemType != LongListSelectorItemType.ListFooter)) // Also, make sure its not already there { tuples.Add(new LongListSelectorItem() { Item = ListFooter, ItemType = LongListSelectorItemType.ListFooter }); } } /// /// Adds a list footer to the listbox. /// private void AddListFooter() { AddListFooter((ObservableCollection)_listBox.ItemsSource); } /// /// Removes the list footer from the given list. /// private static void RemoveListFooter(IList tuples) { LongListSelectorItem lastTuple = tuples[tuples.Count - 1]; if (lastTuple != null && lastTuple.ItemType == LongListSelectorItemType.ListFooter) { tuples.RemoveAt(tuples.Count - 1); } } /// /// Removes the list footer from the listbox. /// private void RemoveListFooter() { RemoveListFooter((ObservableCollection)_listBox.ItemsSource); } #endregion #region AddGroup(...) /// /// Adds a group to a list of tuples. /// /// Group to add. /// List to which the method will add the group. private void AddGroup(object groupToAdd, IList tuples) { IEnumerable group = groupToAdd as IEnumerable; if (group != null) { bool groupHasItems = false; // Adds the group header if (GroupHeaderTemplate != null) { tuples.Add(new LongListSelectorItem() { Item = group, ItemType = LongListSelectorItemType.GroupHeader }); } // For each group header, add its items foreach (object item in group) { tuples.Add(new LongListSelectorItem() { Item = item, ItemType = LongListSelectorItemType.Item, Group = group }); groupHasItems = true; } // Add the group footer if the group has items or if we must display all groups whether or not they have items. if (groupHasItems || DisplayAllGroups) { if (GroupFooterTemplate != null) { tuples.Add(new LongListSelectorItem() { Item = group, ItemType = LongListSelectorItemType.GroupFooter }); } } // Otherwise, remove the group header else if (GroupHeaderTemplate != null) { tuples.RemoveAt(tuples.Count - 1); } // Subscribe to collection change event INotifyCollectionChanged groupCollection = group as INotifyCollectionChanged; if (groupCollection != null && !_groupCollections.Contains(groupCollection)) { groupCollection.CollectionChanged += OnCollectionChanged; _groupCollections.Add(groupCollection); } } } #endregion #region AddGroupHeadersAndFooters(...) /// /// Adds group headers or footers after their template switch from being null /// to an actual value. /// /// Specifies whether or not to add group headers. /// Specifies whether or not to add group footers. /// Used only when templates for group headers/footers switch from being null. /// In this case, they must be added to the lisbox if a group is not empty or DisplayAllGroups is true. /// For performance reasons, this method makes an assumption that headers/footers are not already present. /// Which is the case when its called from OnDataTemplateChanged. private void AddGroupHeadersAndFooters(bool addHeaders, bool addFooters) { int indexInListBox = 0; if (HasListHeader && ShowListHeader) { ++indexInListBox; } IEnumerable groups = ItemsSource; ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; if (groups != null) { foreach (object group in groups) { var groupAsEnumerable = group as IEnumerable; if (groupAsEnumerable != null) { int itemsCount = GetHeadersAndItemsCountFromGroup(groupAsEnumerable); // Adds the group header if (addHeaders && GroupHeaderTemplate != null && itemsCount > 0) { tuples.Insert(indexInListBox, new LongListSelectorItem { Item = group, ItemType = LongListSelectorItemType.GroupHeader }); } indexInListBox += itemsCount; // Adds the group footer if (addFooters && GroupFooterTemplate != null && itemsCount > 0) { tuples.Insert(indexInListBox - 1, new LongListSelectorItem { Item = group, ItemType = LongListSelectorItemType.GroupFooter }); } } } } } /// /// Adds group headers after the GroupHeaderTeamplate switch from being null /// to an actual value. /// private void AddGroupHeaders() { AddGroupHeadersAndFooters(true, false); } /// /// Adds group headers after the GroupFooterTeamplate switch from being null /// to an actual value. /// private void AddGroupFooters() { AddGroupHeadersAndFooters(false, true); } #endregion #region RemoveAllGroupHeadersAndFooters(...) /// /// Removes group headers or footers after their template becomes null. /// /// Specifies whether or not to remove group headers. /// Specifies whether or not to remove group footers. private void RemoveAllGroupHeadersAndFooters(bool removeHeaders, bool removeFooters) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; for (int i = 0; i < tuples.Count; ++i) { if ((removeHeaders && tuples[i].ItemType == LongListSelectorItemType.GroupHeader) || (removeFooters && tuples[i].ItemType == LongListSelectorItemType.GroupFooter)) { tuples.RemoveAt(i--); // the -- is there so we don't skip tuples } } } private void RemoveAllGroupHeaders() { RemoveAllGroupHeadersAndFooters(true, false); } private void RemoveAllGroupFooters() { RemoveAllGroupHeadersAndFooters(false, true); } #endregion #region UnsubscribeFromAllCollections() /// /// Unsubscrives from every collection in ItemsSource. /// private void UnsubscribeFromAllCollections() { if (_rootCollection != null) { _rootCollection.CollectionChanged -= OnCollectionChanged; } foreach (INotifyCollectionChanged collection in _groupCollections) { collection.CollectionChanged -= OnCollectionChanged; } _rootCollection = null; _groupCollections.Clear(); } #endregion #region InsertNewGroups(...) /// /// Inserts new groups in the list box. /// /// List of the new groups to insert. /// Insertion index relative to the collection. private void InsertNewGroups(IList newGroups, int newGroupsIndex) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; // 1 - Builds items tuples for the new groups List newGroupsTuples = new List(); foreach (object group in newGroups) { AddGroup(group, newGroupsTuples); } if (newGroupsTuples.Count > 0) { // 2 - Finds insertion index in the list box int insertIndex = GetGroupIndexInListBox(newGroupsIndex); // 3 - Inserts the new items into the list box foreach (LongListSelectorItem tuple in newGroupsTuples) { tuples.Insert(insertIndex++, tuple); } } } #endregion #region InsertNewItems(...) /// /// Inserts new items in the list box. /// /// List of new items to insert. /// Insertion index relative to the collection /// Group into which the items are inserted. Can be null if IsFlatList == true private void InsertNewItems(IList newItems, int newItemsIndex, IEnumerable group) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; // 1 - Builds items tuples for the new items List newItemsTuples = new List(); foreach (object item in newItems) { newItemsTuples.Add(new LongListSelectorItem { Group = group, Item = item, ItemType = LongListSelectorItemType.Item }); } // 2 - Finds the insertion index in the listbox // Since a single group might be referenced by more than one, we might need to update more than one spot in the listbox if (group != null) { int i = 0; bool groupWasNotDisplayed = ((IList)group).Count == newItems.Count && !DisplayAllGroups; foreach (object g in ItemsSource) { if (g == group) { int insertIndex = GetGroupIndexInListBox(i); if (GroupHeaderTemplate != null) { if (groupWasNotDisplayed) { tuples.Insert(insertIndex, new LongListSelectorItem() { ItemType = LongListSelectorItemType.GroupHeader, Item = group }); } ++insertIndex; } insertIndex += newItemsIndex; // 3 - Inserts the new items into the list box foreach (LongListSelectorItem tuple in newItemsTuples) { tuples.Insert(insertIndex++, tuple); } if (groupWasNotDisplayed && GroupFooterTemplate != null) { tuples.Insert(insertIndex++, new LongListSelectorItem() { ItemType = LongListSelectorItemType.GroupFooter, Item = group }); } } ++i; } } else { int insertIndex = newItemsIndex; if (HasListHeader && ShowListHeader) { ++insertIndex; } // 3 - Inserts the new items into the list box foreach (LongListSelectorItem tuple in newItemsTuples) { tuples.Insert(insertIndex++, tuple); } } } #endregion #region RemoveOldGroups(...) /// /// Removes groups from the list box. /// /// List of groups to remove. /// Start index relative to the root collection. private void RemoveOldGroups(IList oldGroups, int oldGroupsIndex) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; // 1 - Find the index at which we start removing groups int removeStartIndex = 0; if (oldGroupsIndex > 0) { removeStartIndex = GetGroupIndexInListBox(oldGroupsIndex - 1); IEnumerable group = ((IList)ItemsSource)[oldGroupsIndex - 1] as IEnumerable; if (group != null) { removeStartIndex += GetHeadersAndItemsCountFromGroup(group); } } else { if (HasListHeader && ShowListHeader) { ++removeStartIndex; } } // 2 - Calculates how many items to delete from the ListBox int itemsToRemoveCount = GetItemsCountFromGroups(oldGroups); // 3 - Removes the old items from the ListBox for (int i = 0; i < itemsToRemoveCount; ++i) { tuples.RemoveAt(removeStartIndex); } // 4 - Unsubscribe from the old groups foreach (INotifyCollectionChanged collection in oldGroups) { collection.CollectionChanged -= OnCollectionChanged; } } #endregion #region RemoveOldItems(...) /// /// Removes old items from a group or from the root collection. /// /// List of items to remove. /// Start index relative to the group or root collection. /// Group from which items are removed. Can be null if IsFlatList == true. private void RemoveOldItems(IList oldItems, int oldItemsIndex, IEnumerable group) { ObservableCollection tuples = (ObservableCollection)_listBox.ItemsSource; // 1 - Finds the remove index in the listbox // Since a single group might be referenced by more than one, we might need to update more than one group if (group != null) { int i = 0; foreach (object g in ItemsSource) { if (g == group) { int removeIndex = GetGroupIndexInListBox(i); removeIndex += oldItemsIndex; if (GroupHeaderTemplate != null) { ++removeIndex; } // 2 - Removes the old items for (int j = 0; j < oldItems.Count; ++j) { tuples.RemoveAt(removeIndex); } // 3 - Hides the group header and footer if it's empty and DisplayAllGroups is false if (((IList)group).Count == 0 && !DisplayAllGroups) { if (GroupFooterTemplate != null) { tuples.RemoveAt(removeIndex); // Removes the group footer } if (GroupHeaderTemplate != null) { tuples.RemoveAt(removeIndex - 1); // Removes the group header } } } ++i; } } else { int removeIndex = oldItemsIndex; if (HasListHeader && ShowListHeader) { ++removeIndex; } for(int i = 0; i < oldItems.Count; ++i) tuples.RemoveAt(removeIndex); } } #endregion #region GetGroupIndexInListBox(...) /// /// Returns, for a group, an index relative to the templated list box from an index relative to the root collection. /// /// Index relative to the root collection. /// Returns, for a group, an index relative to the templated list box from an index relative to the root collection. private int GetGroupIndexInListBox(int indexInLLS) { int indexInListBox = 0, index = 0; if (HasListHeader && ShowListHeader) { ++indexInListBox; } IEnumerable groups = ItemsSource; if (groups != null) { foreach (object group in groups) { if (indexInLLS == index) { break; } ++index; var groupAsEnumerable = group as IEnumerable; if (groupAsEnumerable != null) { indexInListBox += GetHeadersAndItemsCountFromGroup(groupAsEnumerable); } } } return indexInListBox; } #endregion #region GetItemsCountFromGroups(...) /// /// Returns the number of items in a list of groups. /// /// List of groups from which to retrieve the items count. /// Returns the number of items in a list of groups. private int GetItemsCountFromGroups(IEnumerable groups) { int count = 0; foreach (object g in groups) { IEnumerable group = g as IEnumerable; if (group != null) { count += GetHeadersAndItemsCountFromGroup(group); } } return count; } #endregion #region GetItemsCountFromGroup(...) /// /// Returns the number of items in a group including the group header. /// /// Group from which to retrieve the items count. /// Returns the number of items in a group including the group header. private int GetHeadersAndItemsCountFromGroup(IEnumerable group) { int count = 0; IList groupAsList = group as IList; if (groupAsList != null) { count += groupAsList.Count; } else { count += group.Cast().Count(); } bool groupHasItems = count > 0; if ((groupHasItems || DisplayAllGroups) && GroupHeaderTemplate != null) { ++count; } if ((groupHasItems || DisplayAllGroups) && GroupFooterTemplate != null) { ++count; } return count; } #endregion #region UpdateListBoxItemsTemplate(...) /// /// Updates the templates for a given item type in the list box. /// /// Item type for which to update the template. /// New template that will replace the old one. private void UpdateItemsTemplate(LongListSelectorItemType itemType, DataTemplate newTemplate) { if (_listBox != null) { // Update template for items that have been linked (realized) IEnumerable items = _listBox.GetLogicalChildrenByType(false); foreach (TemplatedListBoxItem item in items) { LongListSelectorItem tuple = (LongListSelectorItem)item.Tuple; if (tuple.ItemType == itemType) { item.ContentTemplate = newTemplate; } } // Save the new template so they can be applied in the future when new items // are linked (realized) switch (itemType) { case LongListSelectorItemType.ListHeader: _listBox.ListHeaderTemplate = newTemplate; break; case LongListSelectorItemType.ListFooter: _listBox.ListFooterTemplate = newTemplate; break; case LongListSelectorItemType.GroupHeader: _listBox.GroupHeaderTemplate = newTemplate; break; case LongListSelectorItemType.GroupFooter: _listBox.GroupFooterTemplate = newTemplate; break; case LongListSelectorItemType.Item: _listBox.ItemTemplate = newTemplate; break; } } } #endregion #region OnDataTemplateChanged(...) /// /// Called when a data template has changed. /// private static void OnDataTemplateChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { LongListSelector lls = (LongListSelector)o; if (lls._listBox == null) return; DataTemplate newTemplate = (DataTemplate)e.NewValue; if (e.Property == ListHeaderTemplateProperty) { lls.UpdateItemsTemplate(LongListSelectorItemType.ListHeader, newTemplate); // If the old value was null, we might need to add the list header. if (e.OldValue == null) { lls.AddListHeader(); // Will add a list header if it's not already there. } // If we don't have a list header anymore, then remove it from the listbox else if (e.NewValue == null && !lls.HasListHeader) { lls.RemoveListHeader(); } } else if (e.Property == ListFooterTemplateProperty) { lls.UpdateItemsTemplate(LongListSelectorItemType.ListFooter, newTemplate); // If the old value was null, we might need to add the list footer. if (e.OldValue == null) { lls.AddListFooter(); // Will add a list footer if it's not already there. } // If we don't have a list footer anymore, then remove it from the listbox else if (e.NewValue == null && !lls.HasListHeader) { lls.RemoveListFooter(); } } else if (e.Property == GroupHeaderProperty) { lls.UpdateItemsTemplate(LongListSelectorItemType.GroupHeader, newTemplate); // If the old value was null, this means we might need to add group headers to the listbox if (e.OldValue == null) { lls.AddGroupHeaders(); } // If the new value is null, this means we might need to remove group headers from the listbox else if (e.NewValue == null) { lls.RemoveAllGroupHeaders(); } } else if(e.Property == GroupFooterProperty) { lls.UpdateItemsTemplate(LongListSelectorItemType.GroupFooter, newTemplate); // If the old value was null, this means we might need to add group footers to the listbox if (e.OldValue == null) { lls.AddGroupFooters(); } // If the new value is null, this means we might need to remove group footers from the listbox else if (e.NewValue == null) { lls.RemoveAllGroupFooters(); } } else if (e.Property == ItemsTemplateProperty) { lls.UpdateItemsTemplate(LongListSelectorItemType.Item, newTemplate); } } #endregion #region OnDisplayAllGroupsChanged(...) /// /// Called when the DisplayAllGroups dependency property changes /// private static void OnDisplayAllGroupsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { ((LongListSelector)obj).LoadDataIntoListBox(); } #endregion #region OnSelectionChanged(...) /// /// Called when there is a change in the selected item(s) in the listbox. /// private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { // Group navigation //var group = (from t in (IEnumerable)e.AddedItems where ((ItemTuple)t).ItemType == ItemType.GroupHeader select (ItemTuple)t).FirstOrDefault(); LongListSelectorItem group = null; foreach (LongListSelectorItem tuple in e.AddedItems) { if (tuple.ItemType == LongListSelectorItemType.GroupHeader) { group = tuple; break; } } if (group != null) { SelectedItem = null; DisplayGroupView(); } else { var handler = SelectionChanged; if (handler != null) { List addedItems = new List(); List removedItems = new List(); foreach (LongListSelectorItem tuple in e.AddedItems) { if (tuple.ItemType == LongListSelectorItemType.Item) { addedItems.Add(tuple); } } foreach (LongListSelectorItem tuple in e.RemovedItems) { if (tuple.ItemType == LongListSelectorItemType.Item) { removedItems.Add(tuple); } } handler(this, new SelectionChangedEventArgs(removedItems, addedItems)); } } } #endregion #region OnCollectionChanged(...) /// /// Called when there is a change in the root or a group collection. /// private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { var senderAsEnumerable = sender as IEnumerable; switch (e.Action) { case NotifyCollectionChangedAction.Add: if (sender == _rootCollection) { if (IsFlatList) { InsertNewItems(e.NewItems, e.NewStartingIndex, null); } else { InsertNewGroups(e.NewItems, e.NewStartingIndex); } } else { InsertNewItems(e.NewItems, e.NewStartingIndex, senderAsEnumerable); } break; case NotifyCollectionChangedAction.Remove: if (sender == _rootCollection) { if (IsFlatList) { RemoveOldItems(e.OldItems, e.OldStartingIndex, null); } else { RemoveOldGroups(e.OldItems, e.OldStartingIndex); } } else { RemoveOldItems(e.OldItems, e.OldStartingIndex, senderAsEnumerable); } break; case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Reset: LoadDataIntoListBox(); break; } } #endregion #region OnScrollStateChanging(...) /// /// Called when the scrolling state of the list box changes. /// private void OnScrollStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = e.NewState.Name == ScrollingState; if (e.NewState.Name == ScrollingState && ScrollingStarted != null) { ScrollingStarted(this, null); } else if (e.NewState.Name == NotScrollingState && ScrollingCompleted != null) { ScrollingCompleted(this, null); } } #endregion #region OnScrollStateChanging(...) /// /// Called when the scrolling state of the list box changes. /// private void OnStretchStateChanging(object sender, VisualStateChangedEventArgs e) { IsStretching = e.NewState.Name == CompressionBottom || e.NewState.Name == CompressionTop; if (e.NewState.Name == CompressionTop && StretchingTop != null) { StretchingTop(this, null); } else if (e.NewState.Name == CompressionBottom && StretchingBottom != null) { StretchingBottom(this, null); } else if (e.NewState.Name == NoVerticalCompression && StretchingCompleted != null) { StretchingCompleted(this, null); } } #endregion #region OnLink(...) /// /// Called when an item gets realized. /// void OnLink(object sender, LinkUnlinkEventArgs e) { if (Link != null) { Link(this, e); } } #endregion #region OnUnlink(...) /// /// Called when an item gets unrealized. /// void OnUnlink(object sender, LinkUnlinkEventArgs e) { if (Unlink != null) { Unlink(this, e); } } #endregion public int SelectedIndex { get { return _listBox.SelectedIndex; } } public DependencyObject ContainerFromSelectedItem() { if (_listBox == null || _listBox.ItemContainerGenerator == null) { return null; } return _listBox.ItemContainerGenerator.ContainerFromItem(_listBox.SelectedItem); } public DependencyObject ContainerFromItem(object item) { if (_listBox == null || _listBox.ItemContainerGenerator == null) { return null; } var tuples = (ObservableCollection)_listBox.ItemsSource; if (tuples != null && tuples.Count > 0) { foreach (var tuple in tuples) { if (tuple.Item == item) { return _listBox.ItemContainerGenerator.ContainerFromItem(tuple); } } } return null; } #region Additional private double _closeToEndPercent = 0.7; public double CloseToEndPercent { get { return _closeToEndPercent; } set { _closeToEndPercent = value; } } private double _prevVerticalOffset; public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.Register( "VerticalOffset", typeof(double), typeof(LongListSelector), new PropertyMetadata(default(double), OnVerticalOffsetChanged)); private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var longListSelector = d as LongListSelector; if (longListSelector != null) { longListSelector.OnListenerChanged(longListSelector, new BindingChangedEventArgs(e)); } } public double VerticalOffset { get { return (double) GetValue(VerticalOffsetProperty); } set { SetValue(VerticalOffsetProperty, value); } } private void OnListenerChanged(object sender, BindingChangedEventArgs e) { if (_prevVerticalOffset >= _scrollViewer.VerticalOffset) return; if (_scrollViewer.VerticalOffset == 0.0 && _scrollViewer.ScrollableHeight == 0.0) return; _prevVerticalOffset = _scrollViewer.VerticalOffset; var atBottom = _scrollViewer.VerticalOffset >= _scrollViewer.ScrollableHeight * CloseToEndPercent; if (atBottom) { RaiseCloseToEnd(); } } public event EventHandler CloseToEnd; protected virtual void RaiseCloseToEnd() { var handler = CloseToEnd; if (handler != null) handler(this, EventArgs.Empty); } #endregion } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelectorEventArgs.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows.Controls; namespace Telegram.Controls.LongListSelector { /// /// The event args for the Link/Unlink events. /// public class LinkUnlinkEventArgs : EventArgs { /// /// Create new LinkUnlinkEventArgs. /// /// The ContentPresenter. public LinkUnlinkEventArgs(ContentPresenter cp) { ContentPresenter = cp; } /// /// The ContentPresenter which is displaying the item. /// public ContentPresenter ContentPresenter { get; private set; } } /// /// The GroupPopupOpened event args. /// public class GroupViewOpenedEventArgs : EventArgs { internal GroupViewOpenedEventArgs(ItemsControl itemsControl) { ItemsControl = itemsControl; } /// /// The ItemsControl containing the groups. /// public ItemsControl ItemsControl { get; private set; } } /// /// The GroupPopupClosing event args. /// public class GroupViewClosingEventArgs : EventArgs { internal GroupViewClosingEventArgs(ItemsControl itemsControl, object selectedGroup) { ItemsControl = itemsControl; SelectedGroup = selectedGroup; } /// /// The ItemsControl containing the groups. /// public ItemsControl ItemsControl { get; private set; } /// /// The selected group. Will be null if the back button was pressed. /// public object SelectedGroup { get; private set; } /// /// Set this to true if the application will handle the popup closing and scrolling to the group. /// public bool Cancel { get; set; } } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelectorGroup.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using Telegram.Controls.LongListSelector.Common; namespace Telegram.Controls.LongListSelector { /// /// Partial definition of LongListSelector. Includes group view code. /// public partial class LongListSelector : Control { private PhoneApplicationPage _page; private bool _systemTrayVisible; private bool _applicationBarVisible; private Border _border; private LongListSelectorItemsControl _itemsControl; private Popup _groupSelectorPopup; private static double _screenWidth = Application.Current.Host.Content.ActualWidth; private static double _screenHeight = Application.Current.Host.Content.ActualHeight; private void OpenPopup() { SaveSystemState(true, false); BuildPopup(); AttachToPageEvents(); _groupSelectorPopup.IsOpen = true; // This has to happen eventually anyway, and this forces the ItemsControl to // expand it's template, populate it's items etc. UpdateLayout(); } private void popup_Opened(object sender, EventArgs e) { SafeRaise.Raise(GroupViewOpened, this, () => { return new GroupViewOpenedEventArgs(_itemsControl); }); } /// /// Closes the group popup. /// /// The selected group. /// Should the GroupPopupClosing event be raised. /// True if the event was not raised or if it was raised and e.Handled is false. private bool ClosePopup(object selectedGroup, bool raiseEvent) { if (raiseEvent) { GroupViewClosingEventArgs args = null; SafeRaise.Raise(GroupViewClosing, this, () => { return args = new GroupViewClosingEventArgs(_itemsControl, selectedGroup); }); if (args != null && args.Cancel) { return false; } } if (_groupSelectorPopup != null) { RestoreSystemState(); _groupSelectorPopup.IsOpen = false; DetachFromPageEvents(); _groupSelectorPopup.Child = null; _border = null; _itemsControl = null; _groupSelectorPopup = null; } return true; } private Thickness _borderPadding; private void BuildPopup() { _groupSelectorPopup = new Popup(); _groupSelectorPopup.Opened += popup_Opened; // Support the background color jumping through. Note that the // alpha channel will be ignored, unless it is a purely transparent // value (such as when a user uses Transparent as the background // on the control). SolidColorBrush background = Background as SolidColorBrush; Color bg = (Color)Resources["PhoneBackgroundColor"]; if (background != null && background.Color != null && background.Color.A > 0) { bg = background.Color; } _border = new Border { Background = new SolidColorBrush( Color.FromArgb(0xa0, bg.R, bg.G, bg.B)) }; // Prevents touch events from bubbling up for most handlers. _border.ManipulationStarted += ((o, e) => e.Handled = true); _border.ManipulationCompleted += ((o, e) => e.Handled = true); _border.ManipulationDelta += ((o, e) => e.Handled = true); var gestureHandler = new EventHandler((o, e) => e.Handled = true); _border.Tap += gestureHandler; _border.DoubleTap += gestureHandler; _border.Hold += gestureHandler; _borderPadding = _border.Padding; _itemsControl = new LongListSelectorItemsControl(); _itemsControl.ItemTemplate = GroupItemTemplate; _itemsControl.ItemsPanel = GroupItemsPanel; _itemsControl.ItemsSource = ItemsSource; _itemsControl.GroupSelected += itemsControl_GroupSelected; _groupSelectorPopup.Child = _border; ScrollViewer sv = new ScrollViewer() { HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled }; _itemsControl.HorizontalAlignment = HorizontalAlignment.Center; _itemsControl.Margin = new Thickness(0, 12, 0, 0); _border.Child = sv; sv.Content = _itemsControl; SetItemsControlSize(); } private void SetItemsControlSize() { Rect client = GetTransformedRect(); if (_border != null) { _border.RenderTransform = GetTransform(); _border.Width = client.Width; _border.Height = client.Height; } } private void itemsControl_GroupSelected(object sender, LongListSelector.GroupSelectedEventArgs e) { if (ClosePopup(e.Group, true)) { ScrollToGroup(e.Group); } } private void AttachToPageEvents() { PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { _page = frame.Content as PhoneApplicationPage; if (_page != null) { _page.BackKeyPress += page_BackKeyPress; _page.OrientationChanged += page_OrientationChanged; } } } private void DetachFromPageEvents() { if (_page != null) { _page.BackKeyPress -= page_BackKeyPress; _page.OrientationChanged -= page_OrientationChanged; _page = null; } } private void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = false; e.Cancel = true; ClosePopup(null, true); } void page_OrientationChanged(object sender, OrientationChangedEventArgs e) { SetItemsControlSize(); } private static Rect GetTransformedRect() { bool isLandscape = IsLandscape(GetPageOrientation()); var frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { var page = frame.Content as PhoneApplicationPage; //if (page != null) //{ // _screenHeight = page.ActualHeight; // _screenWidth = page.ActualWidth; // //return new Rect(0, 0, _screenWidth, _screenHeight); //} //else { _screenWidth = Application.Current.Host.Content.ActualWidth; _screenHeight = Application.Current.Host.Content.ActualHeight; } } else { _screenWidth = Application.Current.Host.Content.ActualWidth; _screenHeight = Application.Current.Host.Content.ActualHeight; } return new Rect(0, 0, isLandscape ? _screenHeight : _screenWidth, isLandscape ? _screenWidth : _screenHeight); } private Transform GetTransform() { PageOrientation orientation = GetPageOrientation(); switch (orientation) { case PageOrientation.LandscapeLeft: case PageOrientation.Landscape: _border.Padding = new Thickness(_borderPadding.Left + 68.0, _borderPadding.Top, _borderPadding.Right, _borderPadding.Bottom); return new CompositeTransform { Rotation = 90, TranslateX = _screenWidth }; case PageOrientation.LandscapeRight: _border.Padding = new Thickness(_borderPadding.Left, _borderPadding.Top, _borderPadding.Right + 68.0, _borderPadding.Bottom); return new CompositeTransform { Rotation = -90, TranslateY = _screenHeight }; default: _border.Padding = _borderPadding; return null; } } private static bool IsLandscape(PageOrientation orientation) { return orientation == PageOrientation.Landscape || orientation == PageOrientation.LandscapeLeft || orientation == PageOrientation.LandscapeRight; } private static PageOrientation GetPageOrientation() { PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { PhoneApplicationPage page = frame.Content as PhoneApplicationPage; if (page != null) { return page.Orientation; } } return PageOrientation.None; } private void SaveSystemState(bool newSystemTrayVisible, bool newApplicationBarVisible) { _systemTrayVisible = SystemTray.IsVisible; SystemTray.IsVisible = newSystemTrayVisible; PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { PhoneApplicationPage page = frame.Content as PhoneApplicationPage; if (page != null && page.ApplicationBar != null) { _applicationBarVisible = page.ApplicationBar.IsVisible; page.ApplicationBar.IsVisible = newApplicationBarVisible; } } } private void RestoreSystemState() { SystemTray.IsVisible = _systemTrayVisible; PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { PhoneApplicationPage page = frame.Content as PhoneApplicationPage; if (page != null && page.ApplicationBar != null) { page.ApplicationBar.IsVisible = _applicationBarVisible; } } } } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelectorItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Diagnostics.CodeAnalysis; namespace Telegram.Controls.LongListSelector { /// /// Holds information about an item for use in the LongListSelector. /// public class LongListSelectorItem { /// /// Gets or sets the item type. /// public LongListSelectorItemType ItemType { get; set; } /// /// Gets or sets the associated group for the item. /// [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Assists in debugging.")] public object Group { get; set; } /// /// Gets or sets the underlying item instance. /// public object Item { get; set; } } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelectorItemType.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Controls.LongListSelector { /// /// Describes different items. /// public enum LongListSelectorItemType { /// /// Indicates an unknown item type. /// Unknown, /// /// Represents a standard list item. /// Item, /// /// Represents a group header. /// GroupHeader, /// /// Represents a group footer. /// GroupFooter, /// /// Represents a list header. /// ListHeader, /// /// Represents a list footer. /// ListFooter, } } ================================================ FILE: Telegram.Controls/LongListSelector/LongListSelectorItemsControl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; namespace Telegram.Controls.LongListSelector { /// /// Partial definition of LongListSelector. Includes ItemsControl subclass. /// public partial class LongListSelector : Control { private class GroupSelectedEventArgs : EventArgs { public GroupSelectedEventArgs(object group) { Group = group; } public object Group { get; private set; } } private delegate void GroupSelectedEventHandler(object sender, GroupSelectedEventArgs e); private class LongListSelectorItemsControl : ItemsControl { public event GroupSelectedEventHandler GroupSelected; protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); ((UIElement)element).Tap += LongListSelectorItemsControl_Tap; } protected override void ClearContainerForItemOverride(DependencyObject element, object item) { base.ClearContainerForItemOverride(element, item); ((UIElement)element).Tap -= LongListSelectorItemsControl_Tap; } private void LongListSelectorItemsControl_Tap(object sender, System.Windows.Input.GestureEventArgs e) { ContentPresenter cc = sender as ContentPresenter; if (cc != null) { var handler = GroupSelected; if (handler != null) { GroupSelectedEventArgs args = new GroupSelectedEventArgs(cc.Content); handler(this, args); } } } } } } ================================================ FILE: Telegram.Controls/LongListSelector/TemplatedListBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using Telegram.Controls.LongListSelector.Common; namespace Telegram.Controls.LongListSelector { /// /// Represents a ListBox with item-specific templates. /// /// Preview public class TemplatedListBox : ListBox { /// /// Gets or sets the list header template. /// public DataTemplate ListHeaderTemplate { get; set; } /// /// Gets or sets the list footer template. /// public DataTemplate ListFooterTemplate { get; set; } /// /// Gets or sets the group header template. /// public DataTemplate GroupHeaderTemplate { get; set; } /// /// Gets or sets the footer template. /// public DataTemplate GroupFooterTemplate { get; set; } /// /// Occurs when an item is about to be "realized". /// public event EventHandler Link; /// /// Occurs when an item is about to be "un-realized". /// public event EventHandler Unlink; /// /// Creates or identifies the element used to display a specified item. /// /// Returns the new container. protected override DependencyObject GetContainerForItemOverride() { return new TemplatedListBoxItem(); } /// /// Prepares the specified element to display the specified item. /// /// Element used to display the specified item. /// Specified item. protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); DataTemplate template = null; LongListSelectorItem itemTuple = item as LongListSelectorItem; if (itemTuple != null) { switch (itemTuple.ItemType) { case LongListSelectorItemType.ListHeader: template = this.ListHeaderTemplate; break; case LongListSelectorItemType.ListFooter: template = this.ListFooterTemplate; break; case LongListSelectorItemType.GroupHeader: template = this.GroupHeaderTemplate; break; case LongListSelectorItemType.GroupFooter: template = this.GroupFooterTemplate; break; case LongListSelectorItemType.Item: template = this.ItemTemplate; break; } TemplatedListBoxItem listBoxItem = (TemplatedListBoxItem)element; listBoxItem.Content = itemTuple.Item; listBoxItem.Tuple = itemTuple; listBoxItem.ContentTemplate = template; var result = listBoxItem.GetFirstLogicalChildByType(true); var handler = Link; if (result != null && handler != null) { handler(this, new LinkUnlinkEventArgs(result)); } } } /// /// When overridden in a derived class, undoes the effects of the /// PrepareContainerForItemOverride method. /// /// The container element. /// The item. protected override void ClearContainerForItemOverride(DependencyObject element, object item) { LongListSelectorItem itemTuple = item as LongListSelectorItem; if (itemTuple != null) { var result = ((FrameworkElement)element).GetFirstLogicalChildByType(true); var handler = Unlink; if (result != null && handler != null) { handler(this, new LinkUnlinkEventArgs(result)); } } base.ClearContainerForItemOverride(element, item); } } } ================================================ FILE: Telegram.Controls/LongListSelector/TemplatedListBoxItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows.Controls; namespace Telegram.Controls.LongListSelector { /// /// Represents an item within a /// /// Preview internal class TemplatedListBoxItem : ListBoxItem { public LongListSelectorItem Tuple { get; set; } } } ================================================ FILE: Telegram.Controls/MultiTemplateItemsControl.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Controls; namespace Telegram.Controls { public interface ITemplateSelector { DataTemplate SelectTemplate(object item, DependencyObject container); } public class MultiTemplateItemsControl : ItemsControl { public static readonly DependencyProperty TemplateSelectorProperty = DependencyProperty.Register("TemplateSelector", typeof(ITemplateSelector), typeof(MultiTemplateItemsControl), new PropertyMetadata(OnTemplateChanged)); public ITemplateSelector TemplateSelector { get { return (ITemplateSelector)GetValue(TemplateSelectorProperty); } set { SetValue(TemplateSelectorProperty, value); } } private static void OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { } protected override void PrepareContainerForItemOverride( DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); var content = element as ContentPresenter; if (content != null) { content.ContentTemplate = TemplateSelector.SelectTemplate(item, this); } } } } ================================================ FILE: Telegram.Controls/MultiTemplateLazyListBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Controls; namespace Telegram.Controls { public class MultiTemplateLazyListBox : LazyListBox { public static readonly DependencyProperty TemplateSelectorProperty = DependencyProperty.Register("TemplateSelector", typeof(ITemplateSelector), typeof(MultiTemplateLazyListBox), new PropertyMetadata(OnTemplateChanged)); public ITemplateSelector TemplateSelector { get { return (ITemplateSelector)GetValue(TemplateSelectorProperty); } set { SetValue(TemplateSelectorProperty, value); } } private static void OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { } protected override void PrepareContainerForItemOverride( DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); var listBoxItem = element as ListBoxItem; if (listBoxItem != null) { listBoxItem.ContentTemplate = TemplateSelector.SelectTemplate(item, this); } } } } ================================================ FILE: Telegram.Controls/Notifications/DialogService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using Coding4Fun.Toolkit.Controls; using Coding4Fun.Toolkit.Controls.Binding; using Coding4Fun.Toolkit.Controls.Common; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; namespace Telegram.Controls.Notifications { // this code has been modified from the orginal code // from Kevin Marshall's post // http://blogs.claritycon.com/kevinmarshall/2010/10/13/wp7-page-transitions-sample/ public class DialogService { public enum AnimationTypes { Slide, SlideHorizontal, Swivel, SwivelHorizontal, Fade } private const string SlideUpStoryboard = @" "; private const string SlideHorizontalInStoryboard = @" "; private const string SlideHorizontalOutStoryboard = @" "; private const string SlideDownStoryboard = @" "; private const string SwivelInStoryboard = @" "; private const string SwivelOutStoryboard = @" "; private const string FadeInStoryboard = @" "; private const string FadeOutStoryboard = @" "; private Panel _popupContainer; private Frame _rootFrame; private PhoneApplicationPage _page; private Grid _childPanel; private Grid _overlay; public bool IsOverlayApplied { get { return _isOverlayApplied; } set { _isOverlayApplied = value; } } private bool _isOverlayApplied = true; public FrameworkElement Child { get; set; } public AnimationTypes AnimationType { get; set; } public TimeSpan MainBodyDelay { get; set; } public double VerticalOffset { get; set; } internal double ControlVerticalOffset { get; set; } public bool BackButtonPressed { get; set; } public Brush BackgroundBrush { get; set; } internal bool IsOpen { get; set; } protected internal bool IsBackKeyOverride { get; set; } public event EventHandler Closed; public event EventHandler Opened; // set this to prevent the dialog service from closing on back click public bool HasPopup { get; set; } internal PhoneApplicationPage Page { get { return _page ?? (_page = RootFrame.GetFirstLogicalChildByType(false)); } } internal Frame RootFrame { get { return _rootFrame ?? (_rootFrame = ApplicationSpace.RootFrame); } } internal Panel PopupContainer { get { if (_popupContainer == null) { //var popups = RootFrame.GetLogicalChildrenByType(false).Where(x => x.IsOpen); //if (popups.Any()) //{ // for (var i = 0; i < popups.Count(); i++) // { // var child = popups.ElementAt(i).Child as Panel; // if (child == null) // continue; // _popupContainer = child; // break; // } //} //else { var presenters = RootFrame.GetLogicalChildrenByType(false); for (var i = 0; i < presenters.Count(); i++) { var panels = presenters.ElementAt(i).GetLogicalChildrenByType(false); if (!panels.Any()) continue; _popupContainer = panels.First(); break; } } } return _popupContainer; } } public DialogService() { AnimationType = AnimationTypes.Slide; BackButtonPressed = false; } bool _deferredShowToLoaded; private void InitializePopup() { // Add overlay which is the size of RootFrame _childPanel = CreateGrid(); if (IsOverlayApplied) { _overlay = CreateGrid(); PreventScrollBinding.SetIsEnabled(_overlay, true); } ApplyOverlayBackground(); // Initialize popup to draw the context menu over all controls if (PopupContainer != null) { if (_overlay != null) PopupContainer.Children.Add(_overlay); PopupContainer.Children.Add(_childPanel); _childPanel.Children.Add(Child); } else { _deferredShowToLoaded = true; RootFrame.Loaded += RootFrameDeferredShowLoaded; } } internal void ApplyOverlayBackground() { if (IsOverlayApplied && BackgroundBrush != null) _overlay.Background = BackgroundBrush; } private Grid CreateGrid() { var grid = new Grid { Name = Guid.NewGuid().ToString() }; Grid.SetColumnSpan(grid, int.MaxValue); Grid.SetRowSpan(grid, int.MaxValue); grid.Opacity = 0; CalculateVerticalOffset(grid); return grid; } internal void CalculateVerticalOffset() { CalculateVerticalOffset(_childPanel); } internal void CalculateVerticalOffset(Panel panel) { if (panel == null) return; var sysTrayVerticalOffset = 0; if (SystemTray.IsVisible && SystemTray.Opacity < 1 && SystemTray.Opacity > 0) { sysTrayVerticalOffset += 32; } panel.Margin = new Thickness(0, VerticalOffset + sysTrayVerticalOffset + ControlVerticalOffset, 0, 0); } void RootFrameDeferredShowLoaded(object sender, RoutedEventArgs e) { RootFrame.Loaded -= RootFrameDeferredShowLoaded; _deferredShowToLoaded = false; Show(); } protected internal void SetAlignmentsOnOverlay(HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) { if (_childPanel != null) { _childPanel.HorizontalAlignment = horizontalAlignment; _childPanel.VerticalAlignment = verticalAlignment; } } private static readonly object Lockobj = new object(); /// /// Shows the context menu. /// public void Show() { lock (Lockobj) { Page.BackKeyPress -= OnBackKeyPress; IsOpen = true; InitializePopup(); if (_deferredShowToLoaded) return; if (!IsBackKeyOverride) Page.BackKeyPress += OnBackKeyPress; Page.NavigationService.Navigated += OnNavigated; RunShowStoryboard(_overlay, AnimationTypes.Fade); RunShowStoryboard(_childPanel, AnimationType, MainBodyDelay); if (Opened != null) Opened.Invoke(this, null); } } private void RunShowStoryboard(UIElement grid, AnimationTypes animation) { RunShowStoryboard(grid, animation, TimeSpan.MinValue); } private void RunShowStoryboard(UIElement grid, AnimationTypes animation, TimeSpan delay) { if (grid == null) return; Storyboard storyboard; switch (animation) { case AnimationTypes.SlideHorizontal: storyboard = XamlReader.Load(SlideHorizontalInStoryboard) as Storyboard; grid.RenderTransform = new TranslateTransform(); break; case AnimationTypes.Slide: storyboard = XamlReader.Load(SlideUpStoryboard) as Storyboard; grid.RenderTransform = new TranslateTransform(); break; case AnimationTypes.Fade: storyboard = XamlReader.Load(FadeInStoryboard) as Storyboard; break; case AnimationTypes.Swivel: case AnimationTypes.SwivelHorizontal: default: storyboard = XamlReader.Load(SwivelInStoryboard) as Storyboard; grid.Projection = new PlaneProjection(); break; } if (storyboard != null) { foreach (var storyboardAnimation in storyboard.Children) { if (!(storyboardAnimation is DoubleAnimationUsingKeyFrames)) continue; var doubleKey = storyboardAnimation as DoubleAnimationUsingKeyFrames; foreach (var frame in doubleKey.KeyFrames) { frame.KeyTime = KeyTime.FromTimeSpan(frame.KeyTime.TimeSpan.Add(delay)); } } Page.Dispatcher.BeginInvoke(() => { foreach (var t in storyboard.Children) Storyboard.SetTarget(t, grid); storyboard.Begin(); }); } } void OnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { if (e.IsNavigationInitiator) //current app initialized navigation? Hide(); } public void Hide() { if (!IsOpen) return; if (Page != null) { Page.BackKeyPress -= OnBackKeyPress; Page.NavigationService.Navigated -= OnNavigated; _page = null; } RunHideStoryboard(_overlay, AnimationTypes.Fade); RunHideStoryboard(_childPanel, AnimationType); } void RunHideStoryboard(Grid grid, AnimationTypes animation) { if (grid == null) return; Storyboard storyboard; switch (animation) { case AnimationTypes.SlideHorizontal: storyboard = XamlReader.Load(SlideHorizontalOutStoryboard) as Storyboard; break; case AnimationTypes.Slide: storyboard = XamlReader.Load(SlideDownStoryboard) as Storyboard; break; case AnimationTypes.Fade: storyboard = XamlReader.Load(FadeOutStoryboard) as Storyboard; break; case AnimationTypes.Swivel: case AnimationTypes.SwivelHorizontal: default: storyboard = XamlReader.Load(SwivelOutStoryboard) as Storyboard; break; } try { if (storyboard != null) { storyboard.Completed += HideStoryboardCompleted; foreach (var t in storyboard.Children) Storyboard.SetTarget(t, grid); storyboard.Begin(); } } catch (Exception) { // chances are user nav'ed away // attempting to be extremely robust here // if this fails, go straight to complete // and attempt to remove it from the visual tree HideStoryboardCompleted(null, null); } } void HideStoryboardCompleted(object sender, EventArgs e) { IsOpen = false; try { if (PopupContainer != null && PopupContainer.Children != null) { if (_overlay != null) PopupContainer.Children.Remove(_overlay); PopupContainer.Children.Remove(_childPanel); } _childPanel.Children.Clear(); } catch { // chances are user nav'ed away // attempting to be extremely robust here // if this fails, go straight to complete // and attempt to remove it from the visual tree } try { if (Closed != null) Closed(this, null); } catch { // chances are user nav'ed away // attempting to be extremely robust here // if this fails, go straight to complete // and attempt to remove it from the visual tree } } public void OnBackKeyPress(object sender, CancelEventArgs e) { if (HasPopup) { e.Cancel = true; return; } if (IsOpen) { e.Cancel = true; BackButtonPressed = true; Hide(); } } } } ================================================ FILE: Telegram.Controls/Notifications/PopUp.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using Clarity.Phone.Extensions; using Coding4Fun.Toolkit.Controls; using Coding4Fun.Toolkit.Controls.Common; using Microsoft.Phone.Controls; namespace Telegram.Controls.Notifications { public abstract class PopUp : Control { internal DialogService PopUpService; private PhoneApplicationPage _startingPage; private bool _alreadyFired; public event EventHandler> Completed; public event EventHandler Opened; public override void OnApplyTemplate() { base.OnApplyTemplate(); if (PopUpService != null) { // template hasn't been applied yet // overlay is null until now PopUpService.BackgroundBrush = Overlay; PopUpService.ApplyOverlayBackground(); PopUpService.SetAlignmentsOnOverlay(HorizontalAlignment, VerticalAlignment); } } public virtual void Show() { if (IsOpen) return; if (_alreadyFired) throw new InvalidOperationException("Invalid control state, do not reuse object after calling Show()"); if (PopUpService == null) { PopUpService = new DialogService { AnimationType = AnimationType, Child = this, IsBackKeyOverride = IsBackKeyOverride, IsOverlayApplied = IsOverlayApplied, MainBodyDelay = MainBodyDelay, }; } // this will happen if the user comes in OnNavigate or // something where the DOM hasn't been created yet. if (PopUpService.Page == null) { Dispatcher.BeginInvoke(Show); return; } if (IsCalculateFrameVerticalOffset) { PopUpService.ControlVerticalOffset = -FrameTransform; } PopUpService.Closed -= PopUpClosed; PopUpService.Opened -= PopUpOpened; PopUpService.Closed += PopUpClosed; PopUpService.Opened += PopUpOpened; if (!IsAppBarVisible && PopUpService.Page.ApplicationBar != null && PopUpService.Page.ApplicationBar.IsVisible) { PopUpService.Page.ApplicationBar.IsVisible = false; IsSetAppBarVisibiilty = true; } _startingPage = PopUpService.Page; PopUpService.Show(); } protected virtual TPopUpResult GetOnClosedValue() { return default(TPopUpResult); } public void Hide() { PopUpClosed(this, null); } #region Control Events void PopUpOpened(object sender, EventArgs e) { if (Opened != null) Opened(sender, e); } void PopUpClosed(object sender, EventArgs e) { if (!_alreadyFired) { OnCompleted(new PopUpEventArgs { PopUpResult = GetOnClosedValue() }); return; } ResetWorldAndDestroyPopUp(); } public virtual void OnCompleted(PopUpEventArgs result) { _alreadyFired = true; if (Completed != null) Completed(this, result); if (PopUpService != null) PopUpService.Hide(); if (PopUpService != null && PopUpService.BackButtonPressed) ResetWorldAndDestroyPopUp(); } #endregion #region helper methods private void ResetWorldAndDestroyPopUp() { if (PopUpService != null) { if (!IsAppBarVisible && IsSetAppBarVisibiilty) { _startingPage.ApplicationBar.IsVisible = IsSetAppBarVisibiilty; } _startingPage = null; PopUpService.Child = null; PopUpService = null; } } #endregion #region Dependency Property Callbacks static void OnFrameTransformPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { var sender = source as PopUp; if (sender == null || sender.PopUpService == null) return; if (!sender.IsCalculateFrameVerticalOffset) return; sender.PopUpService.ControlVerticalOffset = -sender.FrameTransform; sender.PopUpService.CalculateVerticalOffset(); } #endregion #region Dependency Properties / Properties public bool IsOpen { get { return PopUpService != null && PopUpService.IsOpen; } } public bool IsAppBarVisible { get; set; } // adjust for SIP private bool _isCalculateFrameVerticalOffset; protected bool IsCalculateFrameVerticalOffset { get { return _isCalculateFrameVerticalOffset; } set { _isCalculateFrameVerticalOffset = value; if (_isCalculateFrameVerticalOffset) { var bind = new System.Windows.Data.Binding("Y"); var rootFrame = ApplicationSpace.RootFrame; if (rootFrame != null) { var transGroup = rootFrame.RenderTransform as TransformGroup; if (transGroup != null) { bind.Source = transGroup.Children.FirstOrDefault(t => t is TranslateTransform); SetBinding(FrameTransformProperty, bind); } } } } } public bool IsOverlayApplied { get { return _isOverlayApplied; } set { _isOverlayApplied = value; } } private bool _isOverlayApplied = true; internal bool IsSetAppBarVisibiilty { get; set; } internal TimeSpan MainBodyDelay { get; set; } protected internal bool IsBackKeyOverride { get; set; } protected DialogService.AnimationTypes AnimationType { get; set; } double FrameTransform { get { return (double)GetValue(FrameTransformProperty); } set { SetValue(FrameTransformProperty, value); } } static readonly DependencyProperty FrameTransformProperty = DependencyProperty.Register( "FrameTransform", typeof(double), typeof(PopUp), new PropertyMetadata(0.0, OnFrameTransformPropertyChanged)); public Brush Overlay { get { return (Brush)GetValue(OverlayProperty); } set { SetValue(OverlayProperty, value); } } // Using a DependencyProperty as the backing store for Overlay. This enables animation, styling, binding, etc... public static readonly DependencyProperty OverlayProperty = DependencyProperty.Register("Overlay", typeof(Brush), typeof(PopUp), new PropertyMetadata(default(SolidColorBrush))); #endregion } } ================================================ FILE: Telegram.Controls/Notifications/ToastPrompt.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using Clarity.Phone.Extensions; using Coding4Fun.Toolkit.Controls; using Coding4Fun.Toolkit.Controls.Binding; using Coding4Fun.Toolkit.Controls.Common; namespace Telegram.Controls.Notifications { public class ToastPrompt : PopUp, IDisposable, IImageSourceFull { protected Image ToastImage; private const string ToastImageName = "ToastImage"; private Timer _timer; private TranslateTransform _translate; public ToastPrompt() { DefaultStyleKey = typeof(ToastPrompt); IsAppBarVisible = true; IsBackKeyOverride = true; IsCalculateFrameVerticalOffset = true; IsOverlayApplied = false; AnimationType = DialogService.AnimationTypes.Swivel; //AnimationType = DialogService.AnimationTypes.SlideHorizontal; ManipulationStarted += ToastPromptManipulationStarted; ManipulationDelta += ToastPromptManipulationDelta; ManipulationCompleted += ToastPromptManipulationCompleted; Opened += ToastPromptOpened; } public override void OnApplyTemplate() { base.OnApplyTemplate(); SetRenderTransform(); ToastImage = GetTemplateChild(ToastImageName) as Image; if (ToastImage != null && ImageSource != null) { ToastImage.Source = ImageSource; SetImageVisibility(ImageSource); } SetTextOrientation(TextWrapping); } public override void Show() { if (!IsTimerEnabled) return; base.Show(); SetRenderTransform(); PreventScrollBinding.SetIsEnabled(this, true); } public void Dispose() { if (_timer != null) { _timer.Dispose(); _timer = null; } } #region Control Events void ToastPromptManipulationStarted(object sender, ManipulationStartedEventArgs e) { PauseTimer(); } void ToastPromptManipulationDelta(object sender, ManipulationDeltaEventArgs e) { _translate.X += e.DeltaManipulation.Translation.X; if (_translate.X < 0) _translate.X = 0; } void ToastPromptManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { if (e.TotalManipulation.Translation.X > 200 || e.FinalVelocities.LinearVelocity.X > 1000) { OnCompleted(new PopUpEventArgs { PopUpResult = PopUpResult.UserDismissed }); } else if (e.TotalManipulation.Translation.X < 20) { OnCompleted(new PopUpEventArgs { PopUpResult = PopUpResult.Ok }); } else { _translate.X = 0; StartTimer(); } } void ToastPromptOpened(object sender, EventArgs e) { StartTimer(); } void TimerTick(object state) { Dispatcher.BeginInvoke(() => OnCompleted(new PopUpEventArgs { PopUpResult = PopUpResult.NoResponse })); } public override void OnCompleted(PopUpEventArgs result) { if (PopUpService != null && result.PopUpResult == PopUpResult.UserDismissed) { PopUpService.AnimationType = DialogService.AnimationTypes.SlideHorizontal; } PreventScrollBinding.SetIsEnabled(this, false); PauseTimer(); Dispose(); base.OnCompleted(result); } #endregion #region helper methods private void SetImageVisibility(ImageSource source) { ToastImage.Visibility = (source == null) ? Visibility.Collapsed : Visibility.Visible; } private void SetTextOrientation(TextWrapping value) { if (value == TextWrapping.Wrap) { TextOrientation = Orientation.Vertical; } } private void StartTimer() { if (_timer == null) _timer = new Timer(TimerTick); _timer.Change(TimeSpan.FromMilliseconds(MillisecondsUntilHidden), TimeSpan.FromMilliseconds(-1)); } private void PauseTimer() { if (_timer != null) _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); } private void SetRenderTransform() { _translate = new TranslateTransform(); RenderTransform = _translate; } #endregion #region Dependency Property Callbacks private static void OnTextWrapping(DependencyObject o, DependencyPropertyChangedEventArgs e) { var sender = o as ToastPrompt; if (sender == null || sender.ToastImage == null) return; sender.SetTextOrientation((TextWrapping)e.NewValue); } private static void OnImageSource(DependencyObject o, DependencyPropertyChangedEventArgs e) { var sender = o as ToastPrompt; if (sender == null || sender.ToastImage == null) return; sender.SetImageVisibility(e.NewValue as ImageSource); } #endregion #region Dependency Properties / Properties public int MillisecondsUntilHidden { get { return (int)GetValue(MillisecondsUntilHiddenProperty); } set { SetValue(MillisecondsUntilHiddenProperty, value); } } // Using a DependencyProperty as the backing store for MillisecondsUntilHidden. This enables animation, styling, binding, etc... public static readonly DependencyProperty MillisecondsUntilHiddenProperty = DependencyProperty.Register("MillisecondsUntilHidden", typeof(int), typeof(ToastPrompt), new PropertyMetadata(4000)); public bool IsTimerEnabled { get { return (bool)GetValue(IsTimerEnabledProperty); } set { SetValue(IsTimerEnabledProperty, value); } } // Using a DependencyProperty as the backing store for IsTimerEnabled. This enables animation, styling, binding, etc... public static readonly DependencyProperty IsTimerEnabledProperty = DependencyProperty.Register("IsTimerEnabled", typeof(bool), typeof(ToastPrompt), new PropertyMetadata(true)); public string Title { get { return (string)GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } // Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc... public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(ToastPrompt), new PropertyMetadata("")); public string Message { get { return (string)GetValue(MessageProperty); } set { SetValue(MessageProperty, value); } } // Using a DependencyProperty as the backing store for Message. This enables animation, styling, binding, etc... public static readonly DependencyProperty MessageProperty = DependencyProperty.Register("Message", typeof(string), typeof(ToastPrompt), new PropertyMetadata("")); public ImageSource ImageSource { get { return (ImageSource)GetValue(ImageSourceProperty); } set { SetValue(ImageSourceProperty, value); } } // Using a DependencyProperty as the backing store for ImageSource. This enables animation, styling, binding, etc... public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ToastPrompt), new PropertyMetadata(OnImageSource)); public Stretch Stretch { get { return (Stretch)GetValue(StretchProperty); } set { SetValue(StretchProperty, value); } } // Using a DependencyProperty as the backing store for Stretch. This enables animation, styling, binding, etc... public static readonly DependencyProperty StretchProperty = DependencyProperty.Register("Stretch", typeof(Stretch), typeof(ToastPrompt), new PropertyMetadata(Stretch.None)); public double ImageWidth { get { return (double)GetValue(ImageWidthProperty); } set { SetValue(ImageWidthProperty, value); } } // Using a DependencyProperty as the backing store for ImageWidth. This enables animation, styling, binding, etc... public static readonly DependencyProperty ImageWidthProperty = DependencyProperty.Register("ImageWidth", typeof(double), typeof(ToastPrompt), new PropertyMetadata(double.NaN)); public double ImageHeight { get { return (double)GetValue(ImageHeightProperty); } set { SetValue(ImageHeightProperty, value); } } // Using a DependencyProperty as the backing store for ImageWidth. This enables animation, styling, binding, etc... public static readonly DependencyProperty ImageHeightProperty = DependencyProperty.Register("ImageHeight", typeof(double), typeof(ToastPrompt), new PropertyMetadata(double.NaN)); public Orientation TextOrientation { get { return (Orientation)GetValue(TextOrientationProperty); } set { SetValue(TextOrientationProperty, value); } } // Using a DependencyProperty as the backing store for TextOrientation. This enables animation, styling, binding, etc... public static readonly DependencyProperty TextOrientationProperty = DependencyProperty.Register("TextOrientation", typeof(Orientation), typeof(ToastPrompt), new PropertyMetadata(Orientation.Horizontal)); public TextWrapping TextWrapping { get { return (TextWrapping)GetValue(TextWrappingProperty); } set { SetValue(TextWrappingProperty, value); } } // Using a DependencyProperty as the backing store for TextWrapping. This enables animation, styling, binding, etc... public static readonly DependencyProperty TextWrappingProperty = DependencyProperty.Register("TextWrapping", typeof(TextWrapping), typeof(ToastPrompt), new PropertyMetadata(TextWrapping.NoWrap, OnTextWrapping)); #endregion } } ================================================ FILE: Telegram.Controls/Profiling/ApplicationSpace.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Threading; namespace Telegram.Controls.Profiling { public static class ApplicationSpace { public static Frame RootFrame { get { return Application.Current.RootVisual as Frame; } } public static bool IsDesignMode { get { return DesignerProperties.IsInDesignTool; } } public static Dispatcher CurrentDispatcher { get { return Deployment.Current.Dispatcher; } } public static int ScaleFactor() { return 100; } } } ================================================ FILE: Telegram.Controls/Profiling/MemoryCounter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using System.Windows.Threading; using Microsoft.Phone.Info; namespace Telegram.Controls.Profiling { public class MemoryCounter : Control, IDisposable { private const float ByteToMega = 1024 * 1024; private DispatcherTimer _timer; private bool _threwException; public MemoryCounter() { DefaultStyleKey = typeof(MemoryCounter); DataContext = this; Loaded += ControlLoaded; Unloaded += ControlUnloaded; } public int UpdateInterval { get { return (int)GetValue(UpdateIntervalProperty); } set { SetValue(UpdateIntervalProperty, value); } } public static readonly DependencyProperty UpdateIntervalProperty = DependencyProperty.Register("UpdateInterval", typeof(int), typeof(MemoryCounter), new PropertyMetadata(1000, OnUpdateIntervalChanged)); private static void OnUpdateIntervalChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { var sender = ((MemoryCounter)o); if (sender != null && sender._timer != null) sender._timer.Interval = TimeSpan.FromMilliseconds((int)e.NewValue); } public string CurrentMemory { get { return (string)GetValue(CurrentMemoryProperty); } set { SetValue(CurrentMemoryProperty, value); } } public static readonly DependencyProperty CurrentMemoryProperty = DependencyProperty.Register("CurrentMemory", typeof(string), typeof(MemoryCounter), new PropertyMetadata("0")); public string PeakMemory { get { return (string)GetValue(PeakMemoryProperty); } set { SetValue(PeakMemoryProperty, value); } } public static readonly DependencyProperty PeakMemoryProperty = DependencyProperty.Register("PeakMemory", typeof(string), typeof(MemoryCounter), new PropertyMetadata("0")); void TimerTick(object sender, EventArgs e) { if ( _threwException) { StopAndHide(); } try { CurrentMemory = ((DeviceStatus.ApplicationCurrentMemoryUsage) / ByteToMega).ToString("#.00"); PeakMemory = ((DeviceStatus.ApplicationPeakMemoryUsage) / ByteToMega).ToString("#.00"); Debug.WriteLine("CALLING MEM: " + DateTime.Now); } catch (Exception) { _threwException = true; _timer.Stop(); } } private void StopAndHide() { if (_timer != null) _timer.Stop(); Visibility = Visibility.Collapsed; } void ControlLoaded(object sender, RoutedEventArgs e) { if (ApplicationSpace.IsDesignMode) return; _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(UpdateInterval) }; _timer.Tick += TimerTick; _timer.Start(); var rootFrame = ApplicationSpace.RootFrame; if (rootFrame == null) return; rootFrame.Navigated -= FrameNavigated; rootFrame.Navigated += FrameNavigated; } #region control unloaded void ControlUnloaded(object sender, RoutedEventArgs e) { Dispose(); } void FrameNavigated(object sender, NavigationEventArgs e) { #if WINDOWS_PHONE if (e.IsNavigationInitiator) #endif { Dispose(); } } public void Dispose() { var rootFrame = ApplicationSpace.RootFrame; if (rootFrame != null) rootFrame.Navigated -= FrameNavigated; if (_timer != null) { _timer.Stop(); _timer.Tick -= TimerTick; _timer = null; } } #endregion } } ================================================ FILE: Telegram.Controls/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Controls")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Controls")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("c1e19589-bd32-4dcf-af58-393ad4d40b4e")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.Controls/README_FIRST.txt ================================================ For the Windows Phone toolkit make sure that you have marked the icons in the "Toolkit.Content" folder as content. That way they can be used as the icons for the ApplicationBar control. ================================================ FILE: Telegram.Controls/RangeSlider.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace Telegram.Controls { using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; /// /// A double headed slider for selecting a range. /// public class RangeSlider : Control { /// /// The minimum value dependency protperty. /// public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register("Minimum", typeof(double), typeof(RangeSlider), new PropertyMetadata(0.0, new PropertyChangedCallback(RangeBounds_Changed))); /// /// The maximum value dependency protperty. /// public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(double), typeof(RangeSlider), new PropertyMetadata(1.0, new PropertyChangedCallback(RangeBounds_Changed))); /// /// The minimum range span dependency protperty. /// public static readonly DependencyProperty MinimumRangeSpanProperty = DependencyProperty.Register("MinimumRangeSpan", typeof(double), typeof(RangeSlider), new PropertyMetadata(0.0)); /// /// The range start dependency property. /// public static readonly DependencyProperty RangeStartProperty = DependencyProperty.Register("RangeStart", typeof(double), typeof(RangeSlider), new PropertyMetadata(0.0, new PropertyChangedCallback(Range_Changed))); /// /// The range end dependency property. /// public static readonly DependencyProperty RangeEndProperty = DependencyProperty.Register("RangeEnd", typeof(double), typeof(RangeSlider), new PropertyMetadata(1.0, new PropertyChangedCallback(Range_Changed))); /// /// The element name for the range start thumb. /// private const string ElementRangeStartThumb = "RangeStartThumb"; /// /// The element name for the range center thumb. /// private const string ElementRangeCenterThumb = "RangeCenterThumb"; /// /// The element name for the range end thumb. /// private const string ElementRangeEndThumb = "RangeEndThumb"; /// /// The element name for the selected range borer. /// private const string ElementSelectedRangeBorder = "SelectedRangeBorder"; /// /// The range start thumb. /// private Thumb rangeStartThumb; /// /// The range center thumb. /// private Thumb rangeCenterThumb; /// /// The range end thumb. /// private Thumb rangeEndThumb; /// /// The selected range border. /// private Border selectedRangeBorder; /// /// RangeSlider constructor. /// public RangeSlider() { this.DefaultStyleKey = typeof(RangeSlider); this.SizeChanged += new SizeChangedEventHandler(this.RangeSlider_SizeChanged); } /// /// RangeChanged event. /// public event EventHandler RangeChanged; /// /// Gets or sets the slider minimum value. /// public double Minimum { get { return (double)GetValue(MinimumProperty); } set { SetValue(MinimumProperty, Math.Min(this.Maximum, Math.Max(0, value))); if (this.Maximum - this.Minimum < this.MinimumRangeSpan) { this.MinimumRangeSpan = this.Maximum - this.Minimum; } } } /// /// Gets or sets the slider maximum value. /// public double Maximum { get { return (double)GetValue(MaximumProperty); } set { SetValue(MaximumProperty, Math.Max(this.Minimum, value)); if (this.Maximum - this.Minimum < this.MinimumRangeSpan) { this.MinimumRangeSpan = this.Maximum - this.Minimum; } } } /// /// Gets or sets the slider minimum range span. /// public double MinimumRangeSpan { get { return (double)GetValue(MinimumRangeSpanProperty); } set { SetValue(MinimumRangeSpanProperty, Math.Min(this.Maximum - this.Minimum, value)); this.UpdateSelectedRangeMinimumWidth(); this.UpdateRange(false); } } /// /// Gets or sets the range start. /// public double RangeStart { get { return (double)GetValue(RangeStartProperty); } set { double rangeStart = Math.Max(this.Minimum, value); SetValue(RangeStartProperty, rangeStart); } } /// /// Gets or sets the range end. /// public double RangeEnd { get { return (double)GetValue(RangeEndProperty); } set { double rangeEnd = Math.Min(this.Maximum, value); SetValue(RangeEndProperty, rangeEnd); } } /// /// Gets the template parts from the template. /// public override void OnApplyTemplate() { base.OnApplyTemplate(); this.selectedRangeBorder = this.GetTemplateChild(RangeSlider.ElementSelectedRangeBorder) as Border; this.rangeStartThumb = this.GetTemplateChild(RangeSlider.ElementRangeStartThumb) as Thumb; if (this.rangeStartThumb != null) { this.rangeStartThumb.DragDelta += new DragDeltaEventHandler(this.RangeStartThumb_DragDelta); this.rangeStartThumb.SizeChanged += new SizeChangedEventHandler(this.RangeThumb_SizeChanged); } this.rangeCenterThumb = this.GetTemplateChild(RangeSlider.ElementRangeCenterThumb) as Thumb; if (this.rangeCenterThumb != null) { this.rangeCenterThumb.DragDelta += new DragDeltaEventHandler(this.RangeCenterThumb_DragDelta); } this.rangeEndThumb = this.GetTemplateChild(RangeSlider.ElementRangeEndThumb) as Thumb; if (this.rangeEndThumb != null) { this.rangeEndThumb.DragDelta += new DragDeltaEventHandler(this.RangeEndThumb_DragDelta); this.rangeEndThumb.SizeChanged += new SizeChangedEventHandler(this.RangeThumb_SizeChanged); } } #region Dependency property events. /// /// Updates the slider when the selected range changes. /// /// The range slider. /// Dependency Property Changed Event Args. private static void Range_Changed(DependencyObject d, DependencyPropertyChangedEventArgs args) { RangeSlider rangeSlider = d as RangeSlider; rangeSlider.UpdateSlider(); if (rangeSlider.RangeChanged != null) { rangeSlider.RangeChanged(rangeSlider, EventArgs.Empty); } } /// /// Updates the range start and end values. /// /// The range slider. /// Dependency Property Changed Event Args. private static void RangeBounds_Changed(DependencyObject d, DependencyPropertyChangedEventArgs args) { (d as RangeSlider).UpdateRange(true); } #endregion #region Range Slider events /// /// Updates the slider UI. /// /// The range slider. /// Size Changed Event Args. private void RangeSlider_SizeChanged(object sender, SizeChangedEventArgs e) { this.UpdateSelectedRangeMinimumWidth(); this.UpdateSlider(); } #endregion #region Thumb events /// /// Updates the slider's minimum width. /// /// The range thumb. /// Size changed event args. private void RangeThumb_SizeChanged(object sender, SizeChangedEventArgs e) { this.UpdateSelectedRangeMinimumWidth(); } /// /// Moves the whole range slider. /// /// The range cetner thumb. /// Drag Delta Event Args. private void RangeCenterThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (this.selectedRangeBorder != null) { double startMargin = this.selectedRangeBorder.Margin.Left + e.HorizontalChange; double endMargin = this.selectedRangeBorder.Margin.Right - e.HorizontalChange; if (startMargin + e.HorizontalChange <= 0) { startMargin = 0; endMargin = Math.Round(this.ActualWidth - (((this.RangeEnd - this.RangeStart) / (this.Maximum - this.Minimum)) * this.ActualWidth), 0); } else if (endMargin - e.HorizontalChange <= 0) { endMargin = 0; startMargin = Math.Round(this.ActualWidth - (((this.RangeEnd - this.RangeStart) / (this.Maximum - this.Minimum)) * this.ActualWidth), 0); } if (!double.IsNaN(startMargin) && !double.IsNaN(endMargin)) { this.selectedRangeBorder.Margin = new Thickness( startMargin, this.selectedRangeBorder.Margin.Top, endMargin, this.selectedRangeBorder.Margin.Bottom); } this.UpdateRange(true); } } /// /// Moves the range end thumb. /// /// The range end thumb. /// Drag Delta Event Args. private void RangeEndThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (this.selectedRangeBorder != null) { double endMargin = Math.Round(Math.Min(this.ActualWidth - this.selectedRangeBorder.MinWidth, Math.Max(0, this.selectedRangeBorder.Margin.Right - e.HorizontalChange)), 0); double startMargin = Math.Round(this.selectedRangeBorder.Margin.Left, 0); if (this.ActualWidth - startMargin - endMargin < this.selectedRangeBorder.MinWidth) { startMargin = Math.Round(this.ActualWidth - endMargin - this.selectedRangeBorder.MinWidth, 0); } this.selectedRangeBorder.Margin = new Thickness( startMargin, this.selectedRangeBorder.Margin.Top, endMargin, this.selectedRangeBorder.Margin.Bottom); this.UpdateRange(true); } } /// /// Moves the range start thumb. /// /// The range start thumb. /// Drag Delta Event Args. private void RangeStartThumb_DragDelta(object sender, DragDeltaEventArgs e) { if (this.selectedRangeBorder != null) { double startMargin = Math.Round(Math.Min(this.ActualWidth - this.selectedRangeBorder.MinWidth, Math.Max(0, this.selectedRangeBorder.Margin.Left + e.HorizontalChange)), 0); double endMargin = Math.Round(this.selectedRangeBorder.Margin.Right, 0); if (this.ActualWidth - startMargin - endMargin < this.selectedRangeBorder.MinWidth) { endMargin = Math.Round(this.ActualWidth - startMargin - this.selectedRangeBorder.MinWidth, 0); } this.selectedRangeBorder.Margin = new Thickness( startMargin, this.selectedRangeBorder.Margin.Top, endMargin, this.selectedRangeBorder.Margin.Bottom); this.UpdateRange(true); } } public void Log(string str) { System.Diagnostics.Debug.WriteLine(str); } #endregion /// /// Updates the thumb mimimum width. /// private void UpdateSelectedRangeMinimumWidth() { if (this.selectedRangeBorder != null && this.rangeStartThumb != null && this.rangeEndThumb != null) { this.selectedRangeBorder.MinWidth = Math.Max( this.rangeStartThumb.ActualWidth + this.rangeEndThumb.ActualWidth, (this.MinimumRangeSpan / ((this.Maximum - this.Minimum) == 0 ? 1 : (this.Maximum - this.Minimum))) * this.ActualWidth); } } /// /// Updates the slider UI. /// private void UpdateSlider() { if (this.selectedRangeBorder != null) { double startMargin = (this.RangeStart / (this.Maximum - this.Minimum)) * this.ActualWidth; double endMargin = ((this.Maximum - this.RangeEnd) / (this.Maximum - this.Minimum)) * this.ActualWidth; if (!double.IsNaN(startMargin) && !double.IsNaN(endMargin)) { this.selectedRangeBorder.Margin = new Thickness( startMargin, this.selectedRangeBorder.Margin.Top, endMargin, this.selectedRangeBorder.Margin.Bottom); } } } /// /// Updates the selected range. /// /// Whether the range changed event should fire. private void UpdateRange(bool raiseEvent) { if (this.selectedRangeBorder != null) { bool rangeChanged = false; double rangeStart = Math.Round(((this.Maximum - this.Minimum) * (this.selectedRangeBorder.Margin.Left / this.ActualWidth)) + this.Minimum, 0); double rangeEnd = Math.Round(this.Maximum - ((this.Maximum - this.Minimum) * (this.selectedRangeBorder.Margin.Right / this.ActualWidth)), 0); if (rangeEnd - rangeStart < this.MinimumRangeSpan) { if (rangeStart + this.MinimumRangeSpan > this.Maximum) { rangeStart = this.Maximum - this.MinimumRangeSpan; } rangeEnd = Math.Min(this.Maximum, rangeStart + this.MinimumRangeSpan); } if (rangeStart != this.RangeStart || rangeEnd != this.RangeEnd) { rangeChanged = true; } this.RangeStart = rangeStart; this.RangeEnd = rangeEnd; if (raiseEvent && rangeChanged && this.RangeChanged != null) { this.RangeChanged(this, EventArgs.Empty); } } } } } ================================================ FILE: Telegram.Controls/ReorderListBox/ReorderListBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Telegram.Controls; namespace ReorderListBox { /// /// Extends ListBox to enable drag-and-drop reorder within the list. /// [TemplatePart(Name = ReorderListBox.ScrollViewerPart, Type = typeof(ScrollViewer))] [TemplatePart(Name = ReorderListBox.DragIndicatorPart, Type = typeof(Image))] [TemplatePart(Name = ReorderListBox.DragInterceptorPart, Type = typeof(Canvas))] [TemplatePart(Name = ReorderListBox.RearrangeCanvasPart, Type = typeof(Canvas))] public class ReorderListBox : ListBox { #region Template part name constants public const string ScrollViewerPart = "ScrollViewer"; public const string DragIndicatorPart = "DragIndicator"; public const string DragInterceptorPart = "DragInterceptor"; public const string RearrangeCanvasPart = "RearrangeCanvas"; #endregion private const string VerticalCompressionGroup = "VerticalCompression"; private const string HorizontalCompressionGroup = "HorizontalCompression"; private const string ScrollStatesGroup = "ScrollStates"; private const string ScrollViewerScrollingVisualState = "Scrolling"; private const string ScrollViewerNotScrollingVisualState = "NotScrolling"; private const string IsReorderEnabledPropertyName = "IsReorderEnabled"; #region Private fields private double dragScrollDelta; private Panel itemsPanel; private ScrollViewer scrollViewer; private Canvas dragInterceptor; private Image dragIndicator; private object dragItem; private ReorderListBoxItem dragItemContainer; private bool isDragItemSelected; private Rect dragInterceptorRect; private int dropTargetIndex; private Canvas rearrangeCanvas; private Queue> rearrangeQueue; #endregion /// /// Creates a new ReorderListBox and sets the default style key. /// The style key is used to locate the control template in Generic.xaml. /// public ReorderListBox() { this.DefaultStyleKey = typeof(ReorderListBox); ItemContainerGenerator.ItemsChanged += (sender, args) => { }; } public static readonly DependencyProperty HeaderTemplateProperty = DependencyProperty.Register( "HeaderTemplate", typeof (DataTemplate), typeof (ReorderListBox), new PropertyMetadata(default(DataTemplate))); public DataTemplate HeaderTemplate { get { return (DataTemplate) GetValue(HeaderTemplateProperty); } set { SetValue(HeaderTemplateProperty, value); } } public static readonly DependencyProperty FooterTemplateProperty = DependencyProperty.Register( "FooterTemplate", typeof (DataTemplate), typeof (ReorderListBox), new PropertyMetadata(default(DataTemplate))); public DataTemplate FooterTemplate { get { return (DataTemplate) GetValue(FooterTemplateProperty); } set { SetValue(FooterTemplateProperty, value); } } #region IsReorderEnabled DependencyProperty public static readonly DependencyProperty IsReorderEnabledProperty = DependencyProperty.Register( ReorderListBox.IsReorderEnabledPropertyName, typeof(bool), typeof(ReorderListBox), new PropertyMetadata(false, (d, e) => ((ReorderListBox)d).OnIsReorderEnabledChanged(e))); /// /// Gets or sets a value indicating whether reordering is enabled in the listbox. /// This also controls the visibility of the reorder drag-handle of each listbox item. /// public bool IsReorderEnabled { get { return (bool)this.GetValue(ReorderListBox.IsReorderEnabledProperty); } set { this.SetValue(ReorderListBox.IsReorderEnabledProperty, value); } } protected void OnIsReorderEnabledChanged(DependencyPropertyChangedEventArgs e) { if (this.dragInterceptor != null) { this.dragInterceptor.Visibility = (bool)e.NewValue ? Visibility.Visible : Visibility.Collapsed; } this.InvalidateArrange(); } #endregion #region AutoScrollMargin DependencyProperty public static readonly DependencyProperty AutoScrollMarginProperty = DependencyProperty.Register( "AutoScrollMargin", typeof(int), typeof(ReorderListBox), new PropertyMetadata(32)); private PhoneApplicationPage _page; /// /// Gets or sets the size of the region at the top and bottom of the list where dragging will /// cause the list to automatically scroll. /// public double AutoScrollMargin { get { return (int)this.GetValue(ReorderListBox.AutoScrollMarginProperty); } set { this.SetValue(ReorderListBox.AutoScrollMarginProperty, value); } } #endregion #region ItemsControl overrides /// /// Applies the control template, gets required template parts, and hooks up the drag events. /// public override void OnApplyTemplate() { base.OnApplyTemplate(); this.scrollViewer = (ScrollViewer)this.GetTemplateChild(ReorderListBox.ScrollViewerPart); if (scrollViewer != null) { //var verticalGroup = FindVisualState(scrollViewer, VerticalCompressionGroup); //var horizontalGroup = FindVisualState(scrollViewer, HorizontalCompressionGroup); var scrollStatesGroup = FindVisualState(scrollViewer, ScrollStatesGroup); //if (verticalGroup != null) // verticalGroup.CurrentStateChanging += VerticalGroup_CurrentStateChanging; //if (horizontalGroup != null) // horizontalGroup.CurrentStateChanging += HorizontalGroup_CurrentStateChanging; if (scrollStatesGroup != null) scrollStatesGroup.CurrentStateChanging += ScrollStateGroup_CurrentStateChanging; } this.dragInterceptor = this.GetTemplateChild(ReorderListBox.DragInterceptorPart) as Canvas; this.dragIndicator = this.GetTemplateChild(ReorderListBox.DragIndicatorPart) as Image; this.rearrangeCanvas = this.GetTemplateChild(ReorderListBox.RearrangeCanvasPart) as Canvas; if (this.scrollViewer != null && this.dragInterceptor != null && this.dragIndicator != null) { this.dragInterceptor.Visibility = this.IsReorderEnabled ? Visibility.Visible : Visibility.Collapsed; //AddHandler(ManipulationStartedEvent, new EventHandler(OnReorderListBoxManipulationStarted), true); //AddHandler(ManipulationDeltaEvent, new EventHandler(dragInterceptor_ManipulationDelta), true); //AddHandler(ManipulationCompletedEvent, new EventHandler(dragInterceptor_ManipulationCompleted), true); this.dragInterceptor.ManipulationStarted += this.dragInterceptor_ManipulationStarted; this.dragInterceptor.ManipulationDelta += this.dragInterceptor_ManipulationDelta; this.dragInterceptor.ManipulationCompleted += this.dragInterceptor_ManipulationCompleted; } } private void ScrollStateGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { IsScrolling = (e.NewState.Name == ScrollViewerScrollingVisualState); } /// /// The event people can subscribe to /// public event EventHandler ScrollingStateChanged; /// /// DependencyProperty that backs the property /// public static readonly DependencyProperty IsScrollingProperty = DependencyProperty.Register( "IsScrolling", typeof(bool), typeof(ReorderListBox), new PropertyMetadata(false, IsScrollingPropertyChanged)); /// /// Whether the list is currently scrolling or not /// public bool IsScrolling { get { return (bool)GetValue(IsScrollingProperty); } set { SetValue(IsScrollingProperty, value); } } /// /// Handler for when the IsScrolling dependency property changes /// /// The object that has the property /// Args static void IsScrollingPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { var listbox = source as ReorderListBox; if (listbox == null) return; // Call the virtual notification method for anyone who derives from this class var scrollingArgs = new ScrollingStateChangedEventArgs((bool)e.OldValue, (bool)e.NewValue); // Raise the event, if anyone is listening to it var handler = listbox.ScrollingStateChanged; if (handler != null) handler(listbox, scrollingArgs); } private static VisualStateGroup FindVisualState(FrameworkElement element, string stateName) { if (element == null) return null; var groups = VisualStateManager.GetVisualStateGroups(element); return groups.Cast().FirstOrDefault(group => group.Name == stateName); } //private void OnReorderListBoxManipulationStarted(object sender, ManipulationStartedEventArgs e) //{ // scrollViewer.IsHitTestVisible = false; // dragInterceptor_ManipulationStarted(sender, e); //} protected override DependencyObject GetContainerForItemOverride() { return new ReorderListBoxItem(); } protected override bool IsItemItsOwnContainerOverride(object item) { return item is ReorderListBoxItem; } /// /// Ensures that a possibly-recycled item container (ReorderListBoxItem) is ready to display a list item. /// protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); ReorderListBoxItem itemContainer = (ReorderListBoxItem)element; itemContainer.ApplyTemplate(); // Loads visual states. // Set this state before binding to avoid showing the visual transition in this case. string reorderState = this.IsReorderEnabled ? ReorderListBoxItem.ReorderEnabledState : ReorderListBoxItem.ReorderDisabledState; VisualStateManager.GoToState(itemContainer, reorderState, false); itemContainer.SetBinding(ReorderListBoxItem.IsReorderEnabledProperty, new Binding(ReorderListBox.IsReorderEnabledPropertyName) { Source = this }); if (item == this.dragItem) { itemContainer.IsSelected = this.isDragItemSelected; VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.DraggingState, false); if (this.dropTargetIndex >= 0) { // The item's dragIndicator is currently being moved, so the item itself is hidden. itemContainer.Visibility = Visibility.Collapsed; this.dragItemContainer = itemContainer; } else { itemContainer.Opacity = 0; this.Dispatcher.BeginInvoke(() => this.AnimateDrop(itemContainer, "prepareContainer")); } } else { VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.NotDraggingState, false); } } /// /// Called when an item container (ReorderListBoxItem) is being removed from the list panel. /// This may be because the item was removed from the list or because the item is now outside /// the virtualization region (because ListBox uses a VirtualizingStackPanel as its items panel). /// protected override void ClearContainerForItemOverride(DependencyObject element, object item) { base.ClearContainerForItemOverride(element, item); ReorderListBoxItem itemContainer = (ReorderListBoxItem)element; if (itemContainer == this.dragItemContainer) { this.dragItemContainer.Visibility = Visibility.Visible; this.dragItemContainer = null; Debug.WriteLine("ClearContainerForItemOverride dragItemContainer=null"); } } #endregion #region Drag & drop reorder internal static T GetFirstLogicalChildByType(FrameworkElement parent, bool applyTemplates) where T : FrameworkElement { Debug.Assert(parent != null, "The parent cannot be null."); Queue queue = new Queue(); queue.Enqueue(parent); while (queue.Count > 0) { FrameworkElement element = queue.Dequeue(); var elementAsControl = element as Control; if (applyTemplates && elementAsControl != null) { elementAsControl.ApplyTemplate(); } if (element is T && element != parent) { return (T)element; } foreach (FrameworkElement visualChild in GetVisualChildren(element).OfType()) { queue.Enqueue(visualChild); } } return null; } public static IEnumerable GetVisualChildren(DependencyObject target) { int count = VisualTreeHelper.GetChildrenCount(target); if (count == 0) { } else { for (int i = 0; i < count; i++) { yield return VisualTreeHelper.GetChild(target, i); } } yield break; } private bool _isManipulating; private DateTime? _manipulationTimestamp; /// /// Called when the user presses down on the transparent drag-interceptor. Identifies the targed /// drag handle and list item and prepares for a drag operation. /// private void dragInterceptor_ManipulationStarted(object sender, ManipulationStartedEventArgs e) { Debug.WriteLine("ManipulationDelta dropTargetIndex=" + dropTargetIndex + " dragItemContainer=" + (dragItemContainer != null ? dragItemContainer.Content : "null") + " dragItem=" + dragItem); _isManipulating = true; _manipulationTimestamp = DateTime.Now; var timestamp = _manipulationTimestamp; GeneralTransform interceptorTransform; List targetElements; var targetItemContainer = InterceptorTransform(e, out targetElements, out interceptorTransform); ThreadPool.QueueUserWorkItem(state => { Thread.Sleep(TimeSpan.FromSeconds(0.5)); Deployment.Current.Dispatcher.BeginInvoke(() => { if (!_isManipulating) return; if (timestamp != _manipulationTimestamp) return; _page = _page ?? GetFirstLogicalChildByType(Application.Current.RootVisual as FrameworkElement, false); _page.NavigationService.Navigated += OnPageNavigated; if (this.dragItem != null) { return; } if (this.itemsPanel == null) { ItemsPresenter scrollItemsPresenter = (ItemsPresenter) GetFirstLogicalChildByType(this.scrollViewer, false); this.itemsPanel = (Panel)VisualTreeHelper.GetChild(scrollItemsPresenter, 0); } var newTargetItemContainer = InterceptorTransform(e, out targetElements, out interceptorTransform); if (newTargetItemContainer != targetItemContainer) { return; } targetItemContainer = newTargetItemContainer; if (targetItemContainer != null && targetElements.Contains(targetItemContainer.DragHandle)) { VisualStateManager.GoToState(targetItemContainer, ReorderListBoxItem.DraggingState, true); GeneralTransform targetItemTransform = targetItemContainer.TransformToVisual(this.dragInterceptor); Point targetItemOrigin = targetItemTransform.Transform(new Point(0, 0)); Canvas.SetLeft(this.dragIndicator, targetItemOrigin.X); Canvas.SetTop(this.dragIndicator, targetItemOrigin.Y); this.dragIndicator.Width = targetItemContainer.RenderSize.Width; this.dragIndicator.Height = targetItemContainer.RenderSize.Height; this.dragItemContainer = targetItemContainer; this.dragItem = this.dragItemContainer.Content; this.isDragItemSelected = this.dragItemContainer.IsSelected; dragInterceptorRect = interceptorTransform.TransformBounds(new Rect(new Point(0, 0), this.dragInterceptor.RenderSize)); this.dropTargetIndex = -1; Debug.WriteLine("ManipulationStarted dropTargetIndex=" + dropTargetIndex); } }); }); } private ReorderListBoxItem InterceptorTransform(ManipulationStartedEventArgs e, out List targetElements, out GeneralTransform interceptorTransform) { interceptorTransform = dragInterceptor.TransformToVisual(Application.Current.RootVisual); var targetPoint = interceptorTransform.Transform(e.ManipulationOrigin); targetPoint = GetHostCoordinates(targetPoint); targetElements = VisualTreeHelper.FindElementsInHostCoordinates(targetPoint, itemsPanel).ToList(); return targetElements.OfType().FirstOrDefault(); } private void OnPageNavigated(object sender, NavigationEventArgs e) { _isManipulating = false; _manipulationTimestamp = null; Debug.WriteLine("PageNavigated initiator=" + e.IsNavigationInitiator); dragInterceptor_ManipulationCompleted(sender, null); _page.NavigationService.Navigated -= OnPageNavigated; } /// /// Called when the user drags on (or from) the transparent drag-interceptor. /// Moves the item (actually a rendered snapshot of the item) according to the drag delta. /// private void dragInterceptor_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { Debug.WriteLine("ManipulationDelta dropTargetIndex=" + dropTargetIndex + " dragItemContainer=" + (dragItemContainer != null ? dragItemContainer.Content : "null") + " dragItem=" + dragItem); if (e.PinchManipulation != null) { dragInterceptor_ManipulationCompleted(sender, null); return; } if (this.Items.Count <= 1 || this.dragItem == null) { if (_manipulationTimestamp != null) { _isManipulating = false; _manipulationTimestamp = null; } return; } if (this.dropTargetIndex == -1) { if (this.dragItemContainer == null) { dragItem = null; return; } // When the drag actually starts, swap out the item for the drag-indicator image of the item. // This is necessary because the item itself may be removed from the virtualizing panel // if the drag causes a scroll of considerable distance. Size dragItemSize = this.dragItemContainer.RenderSize; WriteableBitmap writeableBitmap = new WriteableBitmap( (int)dragItemSize.Width, (int)dragItemSize.Height); // Swap states to force the transition to complete. VisualStateManager.GoToState(this.dragItemContainer, ReorderListBoxItem.NotDraggingState, false); VisualStateManager.GoToState(this.dragItemContainer, ReorderListBoxItem.DraggingState, false); writeableBitmap.Render(this.dragItemContainer, null); writeableBitmap.Invalidate(); this.dragIndicator.Source = writeableBitmap; this.dragIndicator.Visibility = Visibility.Visible; this.dragItemContainer.Visibility = Visibility.Collapsed; if (this.itemsPanel.Children.IndexOf(this.dragItemContainer) < this.itemsPanel.Children.Count - 1) { this.UpdateDropTarget(Canvas.GetTop(this.dragIndicator) + this.dragIndicator.Height + 1, false); } else { this.UpdateDropTarget(Canvas.GetTop(this.dragIndicator) - 1, false); } } double dragItemHeight = this.dragIndicator.Height; TranslateTransform translation = (TranslateTransform)this.dragIndicator.RenderTransform; double top = Canvas.GetTop(this.dragIndicator); // Limit the translation to keep the item within the list area. // Use different targeting for the top and bottom edges to allow taller items to // move before or after shorter items at the edges. double y = top + e.CumulativeManipulation.Translation.Y; if (y < 0) { y = 0; this.UpdateDropTarget(0, true); } else if (y >= this.dragInterceptorRect.Height - dragItemHeight) { y = this.dragInterceptorRect.Height - dragItemHeight; this.UpdateDropTarget(this.dragInterceptorRect.Height - 1, true); } else { this.UpdateDropTarget(y + dragItemHeight / 2, true); } translation.Y = y - top; // Check if we're within the margin where auto-scroll needs to happen. bool scrolling = (this.dragScrollDelta != 0); double autoScrollMargin = this.AutoScrollMargin; if (autoScrollMargin > 0 && y < autoScrollMargin) { this.dragScrollDelta = y - autoScrollMargin; if (!scrolling) { VisualStateManager.GoToState(this.scrollViewer, ReorderListBox.ScrollViewerScrollingVisualState, true); this.Dispatcher.BeginInvoke(() => this.DragScroll()); return; } } else if (autoScrollMargin > 0 && y + dragItemHeight > this.dragInterceptorRect.Height - autoScrollMargin) { this.dragScrollDelta = (y + dragItemHeight - (this.dragInterceptorRect.Height - autoScrollMargin)); if (!scrolling) { VisualStateManager.GoToState(this.scrollViewer, ReorderListBox.ScrollViewerScrollingVisualState, true); this.Dispatcher.BeginInvoke(() => this.DragScroll()); return; } } else { // We're not within the auto-scroll margin. This ensures any current scrolling is stopped. this.dragScrollDelta = 0; } } /// /// Called when the user releases a drag. Moves the item within the source list and then resets everything. /// private void dragInterceptor_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { _isManipulating = false; _manipulationTimestamp = null; Debug.WriteLine("ManipulationCompleted dropTargetIndex=" + dropTargetIndex + " dragItemContainer=" + (dragItemContainer != null ? dragItemContainer.Content : "null") + " dragItem=" + dragItem); if (_page != null) { _page.NavigationService.Navigated -= OnPageNavigated; } if (this.dragItem == null) { return; } if (this.dropTargetIndex >= 0) { this.MoveItem(this.dragItem, this.dropTargetIndex); } else { } if (this.dragItemContainer != null) { this.dragItemContainer.Visibility = Visibility.Visible; this.dragItemContainer.Opacity = 0; this.AnimateDrop(this.dragItemContainer, "manipulationCompleted"); this.dragItemContainer = null; } else { } this.dragScrollDelta = 0; this.dropTargetIndex = -1; //Debug.WriteLine("ManipulationCompleted dropTargetIndex=" + dropTargetIndex); this.ClearDropTarget(); } /// /// Slides the drag indicator (item snapshot) to the location of the dropped item, /// then performs the visibility swap and removes the dragging visual state. /// private void AnimateDrop(ReorderListBoxItem itemContainer, string from) { GeneralTransform itemTransform = itemContainer.TransformToVisual(this.dragInterceptor); Rect itemRect = itemTransform.TransformBounds(new Rect(new Point(0, 0), itemContainer.RenderSize)); double delta = Math.Abs(itemRect.Y - Canvas.GetTop(this.dragIndicator) - ((TranslateTransform)this.dragIndicator.RenderTransform).Y); if (itemRect.Height == 0.0 || (itemContainer.RenderSize.Width == 0.0 && itemContainer.RenderSize.Height == 0.0)) { delta = 0.0; } if (delta > 0.0) { // Adjust the duration based on the distance, so the speed will be constant. TimeSpan duration = TimeSpan.FromSeconds(0.25 * delta / itemRect.Height); Debug.WriteLine("Duration=" + duration + " from=" + from + " delta=" + delta + " itemRect.Height=" + itemRect.Height + " dragIndicator.Y=" + ((TranslateTransform)this.dragIndicator.RenderTransform).Y + " itemRect.Y=" + itemRect.Y + " Canvas.GetTop=" + Canvas.GetTop(this.dragIndicator)); if (duration.TotalSeconds > 1.0) { // There was no need for an animation, so do the visibility swap right now. this.dragItem = null; itemContainer.Opacity = 1; this.dragIndicator.Visibility = Visibility.Collapsed; this.dragIndicator.Source = null; VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.NotDraggingState, true); } else { Storyboard dropStoryboard = new Storyboard(); DoubleAnimation moveToDropAnimation = new DoubleAnimation(); Storyboard.SetTarget(moveToDropAnimation, this.dragIndicator.RenderTransform); Storyboard.SetTargetProperty(moveToDropAnimation, new PropertyPath(TranslateTransform.YProperty)); moveToDropAnimation.To = itemRect.Y - Canvas.GetTop(this.dragIndicator); moveToDropAnimation.Duration = duration; dropStoryboard.Children.Add(moveToDropAnimation); dropStoryboard.Completed += delegate { this.dragItem = null; itemContainer.Opacity = 1; this.dragIndicator.Visibility = Visibility.Collapsed; this.dragIndicator.Source = null; ((TranslateTransform)this.dragIndicator.RenderTransform).Y = 0; VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.NotDraggingState, true); }; dropStoryboard.Begin(); } } else { // There was no need for an animation, so do the visibility swap right now. this.dragItem = null; itemContainer.Opacity = 1; this.dragIndicator.Visibility = Visibility.Collapsed; this.dragIndicator.Source = null; VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.NotDraggingState, true); } } /// /// Automatically scrolls for as long as the drag is held within the margin. /// The speed of the scroll is adjusted based on the depth into the margin. /// private void DragScroll() { if (this.dragScrollDelta != 0) { double scrollRatio = this.scrollViewer.ViewportHeight / this.scrollViewer.RenderSize.Height; double adjustedDelta = this.dragScrollDelta * scrollRatio; double newOffset = this.scrollViewer.VerticalOffset + adjustedDelta; this.scrollViewer.ScrollToVerticalOffset(newOffset); this.Dispatcher.BeginInvoke(() => this.DragScroll()); double dragItemOffset = Canvas.GetTop(this.dragIndicator) + ((TranslateTransform)this.dragIndicator.RenderTransform).Y + this.dragIndicator.Height / 2; this.UpdateDropTarget(dragItemOffset, true); } else { VisualStateManager.GoToState(this.scrollViewer, ReorderListBox.ScrollViewerNotScrollingVisualState, true); } } /// /// Updates spacing (drop target indicators) surrounding the targeted region. /// /// Vertical offset into the items panel where the drag is currently targeting. /// True if the drop-indicator transitions should be shown. private void UpdateDropTarget(double dragItemOffset, bool showTransition) { Point dragPoint = ReorderListBox.GetHostCoordinates( new Point(this.dragInterceptorRect.Left, this.dragInterceptorRect.Top + dragItemOffset)); IEnumerable targetElements = VisualTreeHelper.FindElementsInHostCoordinates(dragPoint, this.itemsPanel); ReorderListBoxItem targetItem = targetElements.OfType().FirstOrDefault(); if (targetItem != null) { GeneralTransform targetTransform = targetItem.DragHandle.TransformToVisual(this.dragInterceptor); Rect targetRect = targetTransform.TransformBounds(new Rect(new Point(0, 0), targetItem.DragHandle.RenderSize)); double targetCenter = (targetRect.Top + targetRect.Bottom) / 2; int targetIndex = this.itemsPanel.Children.IndexOf(targetItem); int childrenCount = this.itemsPanel.Children.Count; bool after = dragItemOffset > targetCenter; ReorderListBoxItem indicatorItem = null; if (!after && targetIndex > 0) { ReorderListBoxItem previousItem = (ReorderListBoxItem)this.itemsPanel.Children[targetIndex - 1]; if (previousItem.Tag as string == ReorderListBoxItem.DropAfterIndicatorState) { indicatorItem = previousItem; } } else if (after && targetIndex < childrenCount - 1) { ReorderListBoxItem nextItem = (ReorderListBoxItem)this.itemsPanel.Children[targetIndex + 1]; if (nextItem.Tag as string == ReorderListBoxItem.DropBeforeIndicatorState) { indicatorItem = nextItem; } } if (indicatorItem == null) { targetItem.DropIndicatorHeight = this.dragIndicator.Height; string dropIndicatorState = after ? ReorderListBoxItem.DropAfterIndicatorState : ReorderListBoxItem.DropBeforeIndicatorState; VisualStateManager.GoToState(targetItem, dropIndicatorState, showTransition); targetItem.Tag = dropIndicatorState; indicatorItem = targetItem; } for (int i = targetIndex - 5; i <= targetIndex + 5; i++) { if (i >= 0 && i < childrenCount) { ReorderListBoxItem nearbyItem = (ReorderListBoxItem)this.itemsPanel.Children[i]; if (nearbyItem != indicatorItem) { VisualStateManager.GoToState(nearbyItem, ReorderListBoxItem.NoDropIndicatorState, showTransition); nearbyItem.Tag = ReorderListBoxItem.NoDropIndicatorState; } } } this.UpdateDropTargetIndex(targetItem, after); } } /// /// Updates the targeted index -- that is the index where the item will be moved to if dropped at this point. /// private void UpdateDropTargetIndex(ReorderListBoxItem targetItemContainer, bool after) { int dragItemIndex = this.Items.IndexOf(this.dragItem); int targetItemIndex = this.Items.IndexOf(targetItemContainer.Content); int newDropTargetIndex; if (targetItemIndex == dragItemIndex) { newDropTargetIndex = dragItemIndex; } else { if (dragItemIndex == -1) { newDropTargetIndex = targetItemIndex + (after ? 1 : 0); Debug.WriteLine(" Catched UpdateDropTargetIndex dropTargetIndex=-1 targetItemIndex=" + targetItemIndex + " dragItemIndex=" + dragItemIndex + " after=" + after); } else { newDropTargetIndex = targetItemIndex + (after ? 1 : 0) - (targetItemIndex >= dragItemIndex ? 1 : 0); } } if (newDropTargetIndex != this.dropTargetIndex) { this.dropTargetIndex = newDropTargetIndex; if (dropTargetIndex == -1) { Debug.WriteLine("UpdateDropTargetIndex dropTargetIndex=-1 targetItemIndex=" + targetItemIndex + " dragItemIndex=" + dragItemIndex + " after=" + after); } else { Debug.WriteLine("UpdateDropTargetIndex dropTargetIndex=" + dropTargetIndex); } } } /// /// Hides any drop-indicators that are currently visible. /// private void ClearDropTarget() { foreach (ReorderListBoxItem itemContainer in this.itemsPanel.Children) { VisualStateManager.GoToState(itemContainer, ReorderListBoxItem.NoDropIndicatorState, false); itemContainer.Tag = null; } } /// /// Moves an item to a specified index in the source list. /// private bool MoveItem(object item, int toIndex) { object itemsSource = this.ItemsSource; System.Collections.IList sourceList = itemsSource as System.Collections.IList; if (!(sourceList is System.Collections.Specialized.INotifyCollectionChanged)) { // If the source does not implement INotifyCollectionChanged, then there's no point in // changing the source because changes to it will not be synchronized with the list items. // So, just change the ListBox's view of the items. sourceList = this.Items; } int fromIndex = sourceList.IndexOf(item); if (fromIndex != toIndex) { double scrollOffset = this.scrollViewer.VerticalOffset; Debug.WriteLine("Move item " + item + " toIndex=" + toIndex + " fromIndex=" + fromIndex); sourceList.RemoveAt(fromIndex); sourceList.Insert(toIndex, item); if (fromIndex <= scrollOffset && toIndex > scrollOffset) { // Correct the scroll offset for the removed item so that the list doesn't appear to jump. this.scrollViewer.ScrollToVerticalOffset(scrollOffset - 1); } return true; } else { return false; } } #endregion #region View range detection /// /// Gets the indices of the first and last items in the view based on the current scroll position. /// /// True to include items that are partially obscured at the top and bottom, /// false to include only items that are completely in view. /// Returns the index of the first item in view (or -1 if there are no items). /// Returns the index of the last item in view (or -1 if there are no items). public void GetViewIndexRange(bool includePartial, out int firstIndex, out int lastIndex) { if (this.Items.Count > 0) { firstIndex = 0; lastIndex = this.Items.Count - 1; if (this.scrollViewer != null && this.Items.Count > 1) { Thickness scrollViewerPadding = new Thickness( this.scrollViewer.BorderThickness.Left + this.scrollViewer.Padding.Left, this.scrollViewer.BorderThickness.Top + this.scrollViewer.Padding.Top, this.scrollViewer.BorderThickness.Right + this.scrollViewer.Padding.Right, this.scrollViewer.BorderThickness.Bottom + this.scrollViewer.Padding.Bottom); GeneralTransform scrollViewerTransform = this.scrollViewer.TransformToVisual( Application.Current.RootVisual); Rect scrollViewerRect = scrollViewerTransform.TransformBounds( new Rect(new Point(0, 0), this.scrollViewer.RenderSize)); Point topPoint = ReorderListBox.GetHostCoordinates(new Point( scrollViewerRect.Left + scrollViewerPadding.Left, scrollViewerRect.Top + scrollViewerPadding.Top)); IEnumerable topElements = VisualTreeHelper.FindElementsInHostCoordinates( topPoint, this.scrollViewer); ReorderListBoxItem topItem = topElements.OfType().FirstOrDefault(); if (topItem != null) { GeneralTransform itemTransform = topItem.TransformToVisual(Application.Current.RootVisual); Rect itemRect = itemTransform.TransformBounds(new Rect(new Point(0, 0), topItem.RenderSize)); firstIndex = this.ItemContainerGenerator.IndexFromContainer(topItem); if (!includePartial && firstIndex < this.Items.Count - 1 && itemRect.Top < scrollViewerRect.Top && itemRect.Bottom < scrollViewerRect.Bottom) { firstIndex++; } } Point bottomPoint = ReorderListBox.GetHostCoordinates(new Point( scrollViewerRect.Left + scrollViewerPadding.Left, scrollViewerRect.Bottom - scrollViewerPadding.Bottom - 1)); IEnumerable bottomElements = VisualTreeHelper.FindElementsInHostCoordinates( bottomPoint, this.scrollViewer); ReorderListBoxItem bottomItem = bottomElements.OfType().FirstOrDefault(); if (bottomItem != null) { GeneralTransform itemTransform = bottomItem.TransformToVisual(Application.Current.RootVisual); Rect itemRect = itemTransform.TransformBounds( new Rect(new Point(0, 0), bottomItem.RenderSize)); lastIndex = this.ItemContainerGenerator.IndexFromContainer(bottomItem); if (!includePartial && lastIndex > firstIndex && itemRect.Bottom > scrollViewerRect.Bottom && itemRect.Top > scrollViewerRect.Top) { lastIndex--; } } } } else { firstIndex = -1; lastIndex = -1; } } #endregion #region Rearrange /// /// Private helper class for keeping track of each item involved in a rearrange. /// private class RearrangeItemInfo { public object Item = null; public int FromIndex = -1; public int ToIndex = -1; public double FromY = Double.NaN; public double ToY = Double.NaN; public double Height = Double.NaN; } /// /// Animates movements, insertions, or deletions in the list. /// /// Duration of the animation. /// Performs the actual rearrange on the list source. /// /// The animations are as follows: /// - Inserted items fade in while later items slide down to make space. /// - Removed items fade out while later items slide up to close the gap. /// - Moved items slide from their previous location to their new location. /// - Moved items which move out of or in to the visible area also fade out / fade in while sliding. /// /// The rearrange action callback is called in the middle of the rearrange process. That /// callback may make any number of changes to the list source, in any order. After the rearrange /// action callback returns, the net result of all changes will be detected and included in a dynamically /// generated rearrange animation. /// /// Multiple calls to this method in quick succession will be automatically queued up and executed in turn /// to avoid any possibility of conflicts. (If simultaneous rearrange animations are desired, use a single /// call to AnimateRearrange with a rearrange action callback that does both operations.) /// /// public void AnimateRearrange(Duration animationDuration, Action rearrangeAction) { if (rearrangeAction == null) { throw new ArgumentNullException("rearrangeAction"); } if (this.rearrangeCanvas == null) { throw new InvalidOperationException("ReorderListBox control template is missing " + "a part required for rearrange: " + ReorderListBox.RearrangeCanvasPart); } if (this.rearrangeQueue == null) { this.rearrangeQueue = new Queue>(); this.scrollViewer.ScrollToVerticalOffset(this.scrollViewer.VerticalOffset); // Stop scrolling. this.Dispatcher.BeginInvoke(() => this.AnimateRearrangeInternal(rearrangeAction, animationDuration)); } else { this.rearrangeQueue.Enqueue(new KeyValuePair(rearrangeAction, animationDuration)); } } /// /// Orchestrates the rearrange animation process. /// private void AnimateRearrangeInternal(Action rearrangeAction, Duration animationDuration) { // Find the indices of items in the view. Animations are optimzed to only include what is visible. int viewFirstIndex, viewLastIndex; this.GetViewIndexRange(true, out viewFirstIndex, out viewLastIndex); // Collect information about items and their positions before any changes are made. RearrangeItemInfo[] rearrangeMap = this.BuildRearrangeMap(viewFirstIndex, viewLastIndex); // Call the rearrange action callback which actually makes the changes to the source list. // Assuming the source list is properly bound, the base class will pick up the changes. rearrangeAction(); this.rearrangeCanvas.Visibility = Visibility.Visible; // Update the layout (positions of all items) based on the changes that were just made. this.UpdateLayout(); // Find the NEW last-index in view, which may have changed if the items are not constant heights // or if the view includes the end of the list. viewLastIndex = this.FindViewLastIndex(viewFirstIndex); // Collect information about the NEW items and their NEW positions, linking up to information // about items which existed before. RearrangeItemInfo[] rearrangeMap2 = this.BuildRearrangeMap2(rearrangeMap, viewFirstIndex, viewLastIndex); // Find all the movements that need to be animated. IEnumerable movesWithinView = rearrangeMap .Where(rii => !Double.IsNaN(rii.FromY) && !Double.IsNaN(rii.ToY)); IEnumerable movesOutOfView = rearrangeMap .Where(rii => !Double.IsNaN(rii.FromY) && Double.IsNaN(rii.ToY)); IEnumerable movesInToView = rearrangeMap2 .Where(rii => Double.IsNaN(rii.FromY) && !Double.IsNaN(rii.ToY)); IEnumerable visibleMoves = movesWithinView.Concat(movesOutOfView).Concat(movesInToView); // Set a clip rect so the animations don't go outside the listbox. this.rearrangeCanvas.Clip = new RectangleGeometry() { Rect = new Rect(new Point(0, 0), this.rearrangeCanvas.RenderSize) }; // Create the animation storyboard. Storyboard rearrangeStoryboard = this.CreateRearrangeStoryboard(visibleMoves, animationDuration); if (rearrangeStoryboard.Children.Count > 0) { // The storyboard uses an overlay canvas with item snapshots. // While that is playing, hide the real items. this.scrollViewer.Visibility = Visibility.Collapsed; rearrangeStoryboard.Completed += delegate { rearrangeStoryboard.Stop(); this.rearrangeCanvas.Children.Clear(); this.rearrangeCanvas.Visibility = Visibility.Collapsed; this.scrollViewer.Visibility = Visibility.Visible; this.AnimateNextRearrange(); }; this.Dispatcher.BeginInvoke(() => rearrangeStoryboard.Begin()); } else { this.rearrangeCanvas.Visibility = Visibility.Collapsed; this.AnimateNextRearrange(); } } /// /// Checks if there's another rearrange action waiting in the queue, and if so executes it next. /// private void AnimateNextRearrange() { if (this.rearrangeQueue.Count > 0) { KeyValuePair nextRearrange = this.rearrangeQueue.Dequeue(); this.Dispatcher.BeginInvoke(() => this.AnimateRearrangeInternal(nextRearrange.Key, nextRearrange.Value)); } else { this.rearrangeQueue = null; } } /// /// Collects information about items and their positions before any changes are made. /// private RearrangeItemInfo[] BuildRearrangeMap(int viewFirstIndex, int viewLastIndex) { RearrangeItemInfo[] map = new RearrangeItemInfo[this.Items.Count]; for (int i = 0; i < map.Length; i++) { object item = this.Items[i]; RearrangeItemInfo info = new RearrangeItemInfo() { Item = item, FromIndex = i, }; // The precise item location is only important if it's within the view. if (viewFirstIndex <= i && i <= viewLastIndex) { ReorderListBoxItem itemContainer = (ReorderListBoxItem) this.ItemContainerGenerator.ContainerFromIndex(i); if (itemContainer != null) { GeneralTransform itemTransform = itemContainer.TransformToVisual(this.rearrangeCanvas); Point itemPoint = itemTransform.Transform(new Point(0, 0)); info.FromY = itemPoint.Y; info.Height = itemContainer.RenderSize.Height; } } map[i] = info; } return map; } /// /// Collects information about the NEW items and their NEW positions after changes were made. /// private RearrangeItemInfo[] BuildRearrangeMap2(RearrangeItemInfo[] map, int viewFirstIndex, int viewLastIndex) { RearrangeItemInfo[] map2 = new RearrangeItemInfo[this.Items.Count]; for (int i = 0; i < map2.Length; i++) { object item = this.Items[i]; // Try to find the same item in the pre-rearrange info. RearrangeItemInfo info = map.FirstOrDefault(rii => rii.ToIndex < 0 && rii.Item == item); if (info == null) { info = new RearrangeItemInfo() { Item = item, }; } info.ToIndex = i; // The precise item location is only important if it's within the view. if (viewFirstIndex <= i && i <= viewLastIndex) { ReorderListBoxItem itemContainer = (ReorderListBoxItem) this.ItemContainerGenerator.ContainerFromIndex(i); if (itemContainer != null) { GeneralTransform itemTransform = itemContainer.TransformToVisual(this.rearrangeCanvas); Point itemPoint = itemTransform.Transform(new Point(0, 0)); info.ToY = itemPoint.Y; info.Height = itemContainer.RenderSize.Height; } } map2[i] = info; } return map2; } /// /// Finds the index of the last visible item by starting at the first index and /// comparing the bounds of each following item to the ScrollViewer bounds. /// /// /// This method is less efficient than the hit-test method used by GetViewIndexRange() above, /// but it works when the controls haven't actually been rendered yet, while the other doesn't. /// private int FindViewLastIndex(int firstIndex) { int lastIndex = firstIndex; GeneralTransform scrollViewerTransform = this.scrollViewer.TransformToVisual( Application.Current.RootVisual); Rect scrollViewerRect = scrollViewerTransform.TransformBounds( new Rect(new Point(0, 0), this.scrollViewer.RenderSize)); while (lastIndex < this.Items.Count - 1) { ReorderListBoxItem itemContainer = (ReorderListBoxItem) this.ItemContainerGenerator.ContainerFromIndex(lastIndex + 1); if (itemContainer == null) { break; } GeneralTransform itemTransform = itemContainer.TransformToVisual( Application.Current.RootVisual); Rect itemRect = itemTransform.TransformBounds(new Rect(new Point(0, 0), itemContainer.RenderSize)); itemRect.Intersect(scrollViewerRect); if (itemRect == Rect.Empty) { break; } lastIndex++; } return lastIndex; } /// /// Creates a storyboard to animate the visible moves of a rearrange. /// private Storyboard CreateRearrangeStoryboard(IEnumerable visibleMoves, Duration animationDuration) { Storyboard storyboard = new Storyboard(); ReorderListBoxItem temporaryItemContainer = null; foreach (RearrangeItemInfo move in visibleMoves) { Size itemSize = new Size(this.rearrangeCanvas.RenderSize.Width, move.Height); ReorderListBoxItem itemContainer = null; if (move.ToIndex >= 0) { itemContainer = (ReorderListBoxItem)this.ItemContainerGenerator.ContainerFromIndex(move.ToIndex); } if (itemContainer == null) { if (temporaryItemContainer == null) { temporaryItemContainer = new ReorderListBoxItem(); } itemContainer = temporaryItemContainer; itemContainer.Width = itemSize.Width; itemContainer.Height = itemSize.Height; this.rearrangeCanvas.Children.Add(itemContainer); this.PrepareContainerForItemOverride(itemContainer, move.Item); itemContainer.UpdateLayout(); } WriteableBitmap itemSnapshot = new WriteableBitmap((int)itemSize.Width, (int)itemSize.Height); itemSnapshot.Render(itemContainer, null); itemSnapshot.Invalidate(); Image itemImage = new Image(); itemImage.Width = itemSize.Width; itemImage.Height = itemSize.Height; itemImage.Source = itemSnapshot; itemImage.RenderTransform = new TranslateTransform(); this.rearrangeCanvas.Children.Add(itemImage); if (itemContainer == temporaryItemContainer) { this.rearrangeCanvas.Children.Remove(itemContainer); } if (!Double.IsNaN(move.FromY) && !Double.IsNaN(move.ToY)) { Canvas.SetTop(itemImage, move.FromY); if (move.FromY != move.ToY) { DoubleAnimation moveAnimation = new DoubleAnimation(); moveAnimation.Duration = animationDuration; Storyboard.SetTarget(moveAnimation, itemImage.RenderTransform); Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(TranslateTransform.YProperty)); moveAnimation.To = move.ToY - move.FromY; storyboard.Children.Add(moveAnimation); } } else if (Double.IsNaN(move.FromY) != Double.IsNaN(move.ToY)) { if (move.FromIndex >= 0 && move.ToIndex >= 0) { DoubleAnimation moveAnimation = new DoubleAnimation(); moveAnimation.Duration = animationDuration; Storyboard.SetTarget(moveAnimation, itemImage.RenderTransform); Storyboard.SetTargetProperty(moveAnimation, new PropertyPath(TranslateTransform.YProperty)); const double animationDistance = 200; if (!Double.IsNaN(move.FromY)) { Canvas.SetTop(itemImage, move.FromY); if (move.FromIndex < move.ToIndex) { moveAnimation.To = animationDistance; } else if (move.FromIndex > move.ToIndex) { moveAnimation.To = -animationDistance; } } else { Canvas.SetTop(itemImage, move.ToY); if (move.FromIndex < move.ToIndex) { moveAnimation.From = -animationDistance; } else if (move.FromIndex > move.ToIndex) { moveAnimation.From = animationDistance; } } storyboard.Children.Add(moveAnimation); } DoubleAnimation fadeAnimation = new DoubleAnimation(); fadeAnimation.Duration = animationDuration; Storyboard.SetTarget(fadeAnimation, itemImage); Storyboard.SetTargetProperty(fadeAnimation, new PropertyPath(UIElement.OpacityProperty)); if (Double.IsNaN(move.FromY)) { itemImage.Opacity = 0.0; fadeAnimation.To = 1.0; Canvas.SetTop(itemImage, move.ToY); } else { itemImage.Opacity = 1.0; fadeAnimation.To = 0.0; Canvas.SetTop(itemImage, move.FromY); } storyboard.Children.Add(fadeAnimation); } } return storyboard; } #endregion #region Private utility methods /// /// Gets host coordinates, adjusting for orientation. This is helpful when identifying what /// controls are under a point. /// private static Point GetHostCoordinates(Point point) { PhoneApplicationFrame frame = (PhoneApplicationFrame)Application.Current.RootVisual; switch (frame.Orientation) { case PageOrientation.LandscapeLeft: return new Point(frame.RenderSize.Width - point.Y, point.X); case PageOrientation.LandscapeRight: return new Point(point.Y, frame.RenderSize.Height - point.X); default: return point; } } #endregion } } ================================================ FILE: Telegram.Controls/ReorderListBox/ReorderListBoxItem.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media.Animation; using System.Windows.Media; namespace ReorderListBox { /// /// Extends ListBoxItem to support a styleable drag handle, drop-indicator spacing, /// and visual states and transitions for dragging/dropping and enabling/disabling the reorder capability. /// [TemplatePart(Name = ReorderListBoxItem.DragHandlePart, Type = typeof(ContentPresenter))] [TemplatePart(Name = ReorderListBoxItem.DropBeforeSpacePart, Type = typeof(UIElement))] [TemplatePart(Name = ReorderListBoxItem.DropAfterSpacePart, Type = typeof(UIElement))] [TemplateVisualState(Name = ReorderListBoxItem.ReorderDisabledState, GroupName = ReorderListBoxItem.ReorderEnabledStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.ReorderEnabledState, GroupName = ReorderListBoxItem.ReorderEnabledStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.NotDraggingState, GroupName = ReorderListBoxItem.DraggingStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.DraggingState, GroupName = ReorderListBoxItem.DraggingStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.NoDropIndicatorState, GroupName = ReorderListBoxItem.DropIndicatorStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.DropBeforeIndicatorState, GroupName = ReorderListBoxItem.DropIndicatorStateGroup)] [TemplateVisualState(Name = ReorderListBoxItem.DropAfterIndicatorState, GroupName = ReorderListBoxItem.DropIndicatorStateGroup)] public class ReorderListBoxItem : ListBoxItem { #region Template part name constants public const string DragHandlePart = "DragHandle"; public const string DropBeforeSpacePart = "DropBeforeSpace"; public const string DropAfterSpacePart = "DropAfterSpace"; #endregion #region Visual state name constants public const string ReorderEnabledStateGroup = "ReorderEnabledStates"; public const string ReorderDisabledState = "ReorderDisabled"; public const string ReorderEnabledState = "ReorderEnabled"; public const string DraggingStateGroup = "DraggingStates"; public const string NotDraggingState = "NotDragging"; public const string DraggingState = "Dragging"; public const string DropIndicatorStateGroup = "DropIndicatorStates"; public const string NoDropIndicatorState = "NoDropIndicator"; public const string DropBeforeIndicatorState = "DropBeforeIndicator"; public const string DropAfterIndicatorState = "DropAfterIndicator"; #endregion /// /// Creates a new ReorderListBoxItem and sets the default style key. /// The style key is used to locate the control template in Generic.xaml. /// public ReorderListBoxItem() { this.DefaultStyleKey = typeof(ReorderListBoxItem); } #region DropIndicatorHeight DependencyProperty public static readonly DependencyProperty DropIndicatorHeightProperty = DependencyProperty.Register( "DropIndicatorHeight", typeof(double), typeof(ReorderListBoxItem), new PropertyMetadata(0.0, (d, e) => ((ReorderListBoxItem)d).OnDropIndicatorHeightChanged(e))); /// /// Gets or sets the height of the drop-before and drop-after indicators. /// The drop-indicator visual states and transitions are automatically updated to use this height. /// public double DropIndicatorHeight { get { return (double)this.GetValue(ReorderListBoxItem.DropIndicatorHeightProperty); } set { this.SetValue(ReorderListBoxItem.DropIndicatorHeightProperty, value); } } /// /// Updates the drop-indicator height value for visual state and transition animations. /// /// /// This is a workaround for the inability of visual states and transitions to do template binding /// in Silverlight 3. In SL4, they could bind directly to the DropIndicatorHeight property instead. /// protected void OnDropIndicatorHeightChanged(DependencyPropertyChangedEventArgs e) { Panel rootPanel = (Panel)VisualTreeHelper.GetChild(this, 0); VisualStateGroup vsg = ReorderListBoxItem.GetVisualStateGroup( rootPanel, ReorderListBoxItem.DropIndicatorStateGroup); if (vsg != null) { foreach (VisualState vs in vsg.States) { foreach (Timeline animation in vs.Storyboard.Children) { this.UpdateDropIndicatorAnimationHeight((double)e.NewValue, animation); } } foreach (VisualTransition vt in vsg.Transitions) { foreach (Timeline animation in vt.Storyboard.Children) { this.UpdateDropIndicatorAnimationHeight((double)e.NewValue, animation); } } } } /// /// Helper for the UpdateDropIndicatorAnimationHeight method. /// private void UpdateDropIndicatorAnimationHeight(double height, Timeline animation) { DoubleAnimation da = animation as DoubleAnimation; if (da != null) { string targetName = Storyboard.GetTargetName(da); PropertyPath targetPath = Storyboard.GetTargetProperty(da); if ((targetName == ReorderListBoxItem.DropBeforeSpacePart || targetName == ReorderListBoxItem.DropAfterSpacePart) && targetPath != null && targetPath.Path == "Height") { if (da.From > 0 && da.From != height) { da.From = height; } if (da.To > 0 && da.To != height) { da.To = height; } } } } /// /// Gets a named VisualStateGroup for a framework element. /// private static VisualStateGroup GetVisualStateGroup(FrameworkElement element, string groupName) { VisualStateGroup result = null; System.Collections.IList groups = VisualStateManager.GetVisualStateGroups(element); if (groups != null) { foreach (VisualStateGroup group in groups) { if (group.Name == groupName) { result = group; break; } } } return result; } #endregion #region IsReorderEnabled DependencyProperty public static readonly DependencyProperty IsReorderEnabledProperty = DependencyProperty.Register( "IsReorderEnabled", typeof(bool), typeof(ReorderListBoxItem), new PropertyMetadata(false, (d, e) => ((ReorderListBoxItem)d).OnIsReorderEnabledChanged(e))); /// /// Gets or sets a value indicating whether the drag handle should be shown. /// public bool IsReorderEnabled { get { return (bool)this.GetValue(ReorderListBoxItem.IsReorderEnabledProperty); } set { this.SetValue(ReorderListBoxItem.IsReorderEnabledProperty, value); } } protected void OnIsReorderEnabledChanged(DependencyPropertyChangedEventArgs e) { string visualState = (bool)e.NewValue ? ReorderListBoxItem.ReorderEnabledState : ReorderListBoxItem.ReorderDisabledState; VisualStateManager.GoToState(this, visualState, true); } #endregion #region DragHandleTemplate DependencyProperty public static readonly DependencyProperty DragHandleTemplateProperty = DependencyProperty.Register( "DragHandleTemplate", typeof(DataTemplate), typeof(ReorderListBoxItem), null); /// /// Gets or sets the template for the drag handle. /// public DataTemplate DragHandleTemplate { get { return (DataTemplate)this.GetValue(ReorderListBoxItem.DragHandleTemplateProperty); } set { this.SetValue(ReorderListBoxItem.DragHandleTemplateProperty, value); } } #endregion /// /// Gets the element (control template part) that serves as a handle for dragging the item. /// public ContentPresenter DragHandle { get; private set; } /// /// Applies the control template, checks for required template parts, and initializes visual states. /// public override void OnApplyTemplate() { base.OnApplyTemplate(); this.DragHandle = this.GetTemplateChild(ReorderListBoxItem.DragHandlePart) as ContentPresenter; if (this.DragHandle == null) { throw new InvalidOperationException("ReorderListBoxItem must have a DragHandle ContentPresenter part."); } VisualStateManager.GoToState(this, ReorderListBoxItem.ReorderDisabledState, false); VisualStateManager.GoToState(this, ReorderListBoxItem.NotDraggingState, false); VisualStateManager.GoToState(this, ReorderListBoxItem.NoDropIndicatorState, false); } } } ================================================ FILE: Telegram.Controls/ScrollableTextBlock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Net; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using Microsoft.Phone.Tasks; namespace Telegram.Controls { public class ScrollableTextBlock : Control { private const int MaxSymbolsChunk = 1024; public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof (string), typeof (ScrollableTextBlock), new PropertyMetadata(OnTextPropertyChanged)); private TextBlock _measureText; private StackPanel _stackPanel; public ScrollableTextBlock() { DefaultStyleKey = typeof (ScrollableTextBlock); } public string Text { get { return (string) GetValue(TextProperty); } set { SetValue(TextProperty, value); } } private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((ScrollableTextBlock) d).ParseText((string) e.NewValue); } public override void OnApplyTemplate() { base.OnApplyTemplate(); _stackPanel = GetTemplateChild("StackPanel") as StackPanel; ParseText(Text); } private void ParseText(string value) { if (string.IsNullOrEmpty(value) || _stackPanel == null) return; _stackPanel.Children.Clear(); var maxTextSize = GetMaxTextSize(); if (value.Length < maxTextSize) { AddTextChunk(value); } else SplitText(value); } private static readonly Regex HyperlinkRegex = new Regex("(?i)\\b(((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))|([a-z0-9.\\-]+(\\.ru|\\.com|\\.net|\\.org|\\.us|\\.it|\\.co\\.uk)(?![a-z0-9]))|([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]*[a-zA-Z0-9-]+))"); private void AddTextChunk(string value) { var index = 0; foreach (Match match in HyperlinkRegex.Matches(value)) { string text; if (match.Index != index) { text = value.Substring(index, match.Index - index); _stackPanel.Children.Add(GetTextElement(text)); } var link = match.Value; var flag = link.EndsWith(","); if (flag && link.Length > 1) link = link.Substring(0, link.Length - 1); if (!link.StartsWith("http", StringComparison.OrdinalIgnoreCase)) link = "http://" + link; text = match.Value; _stackPanel.Children.Add(GeHyperlinkElement(text, link)); index = match.Index + match.Length; } if (index < value.Length) { var textElement = GetTextElement(value.Substring(index)); _stackPanel.Children.Add(textElement); } } private FrameworkElement GeHyperlinkElement(string text, string uri) { var textBlock = GetTextBlock(); textBlock.Text = text; textBlock.Tap += (sender, args) => { if (textBlock.Text.Contains("@")) { var task = new EmailComposeTask(); task.To = uri.ToLowerInvariant().Replace("http://", string.Empty); task.Show(); } else { var task = new WebBrowserTask(); task.URL = HttpUtility.UrlEncode(uri); task.Show(); } }; textBlock.TextDecorations = TextDecorations.Underline; var border = GetBackgroundBorder(); border.Child = textBlock; return border; //var hyperlink = GetHyperlinkButton(); //var content = GetTextBlock(); //content.Text = text; //hyperlink.Content = content; //hyperlink.NavigateUri = new Uri(uri, UriKind.Absolute); //var border = GetBackgroundBorder(); //border.Child = hyperlink; //return border; } private FrameworkElement GetTextElement(string text) { var textBlock = GetTextBlock(); textBlock.Text = text; var border = GetBackgroundBorder(); border.Child = textBlock; return border; } private static readonly Dictionary Delimiters = new Dictionary { {' ', ' '}, {'.', ' '}, {',', ' '}, {'!', ' '}, {'?', ' '}, {':', ' '}, {';', ' '}, {']', ' '}, {')', ' '}, {'}', ' '}, }; private void SplitText(string text) { while (true) { var symbolsCount = Math.Min(MaxSymbolsChunk, text.Length); var stepsBack = 0; if (symbolsCount != text.Length) { if (!Delimiters.ContainsKey(text[symbolsCount - 1])) { for (var i = 1; i < 24 && (symbolsCount - 1 - i) >= 0; i++) { if (Delimiters.ContainsKey(text[symbolsCount - 1 - i])) { stepsBack += i; break; } } } } symbolsCount -= stepsBack; var currentChunk = text.Substring(0, symbolsCount); AddTextChunk(currentChunk); var nextChunk = text.Substring(symbolsCount, text.Length - symbolsCount); if (nextChunk.Length > 0) { text = nextChunk; continue; } break; } } private Size MeasureString(string text) { if (_measureText == null) _measureText = GetTextBlock(); _measureText.Text = text; return new Size(_measureText.ActualWidth, _measureText.ActualHeight); } private int GetMaxTextSize() { var size = MeasureString("W"); return (int) (Width/size.Width)*(int) (2048.0/size.Height)/2; } private TextBlock GetTextBlock() { return new TextBlock { TextWrapping = TextWrapping.Wrap, FontSize = FontSize, FontFamily = FontFamily, FontWeight = FontWeight, Foreground = Foreground, }; } private HyperlinkButton GetHyperlinkButton() { //var resources = new generic(); //Uri resourceLocater = new Uri("/Telegram.Controls;component/Themes/generic.xaml", UriKind.Relative); //ResourceDictionary resourceDictionary = (ResourceDictionary)Application.LoadComponent(resourceLocater); //groupStyle.ContainerStyle = resourceDictionary["GroupHeaderStyle"] as Style; return new HyperlinkButton { //Style = (Style) resources["HyperlinkButtonWrappingStyle"], ClickMode = ClickMode.Release, TargetName = "_blank", HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0.0), FontSize = FontSize, FontFamily = FontFamily, FontWeight = FontWeight, Foreground = Foreground, }; } private Border GetBackgroundBorder() { return new Border { Background = Background, Margin = new Thickness(0.0, -2.0, 0.0, 0.0), Padding = new Thickness(Padding.Left, 0.0, Padding.Right, 0.0), //BorderBrush = new SolidColorBrush(Colors.Blue), //BorderThickness = new Thickness(1.0) }; } } } ================================================ FILE: Telegram.Controls/SmoothProgressBar.xaml ================================================  ================================================ FILE: Telegram.Controls/SmoothProgressBar.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Media.Animation; namespace Telegram.Controls { public partial class SmoothProgressBar { private bool _useAnimations = true; public bool UseAnimations { get { return _useAnimations; } set { _useAnimations = value; } } public static readonly DependencyProperty CommandTextProperty = DependencyProperty.Register( "CommandText", typeof (string), typeof (SmoothProgressBar), new PropertyMetadata(default(string))); public string CommandText { get { return (string) GetValue(CommandTextProperty); } set { SetValue(CommandTextProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( "Value", typeof (double), typeof (SmoothProgressBar), new PropertyMetadata(default(double), OnValueChanged)); private Storyboard _previousStoryboard; private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var smoothProgressBar = (SmoothProgressBar) d; if ((double) e.NewValue > 0.0) { smoothProgressBar.Visibility = Visibility.Visible; } //smoothProgressBar.Progress.Value = (double)e.NewValue; //if ((double)e.NewValue <= 0.0 || (double)e.NewValue >= 1.0) //{ // smoothProgressBar.Visibility = Visibility.Collapsed; //} //return; var newValue = (double)e.NewValue; if ((double) e.OldValue > 0.0 && newValue == 0.0) { newValue = 1.0; } var animation = new DoubleAnimation { To = newValue, Duration = new Duration(TimeSpan.FromSeconds(0.2)), }; if (smoothProgressBar.UseAnimations) { Storyboard.SetTarget(animation, smoothProgressBar.Progress); Storyboard.SetTargetProperty(animation, new PropertyPath(RangeBase.ValueProperty)); var sb = new Storyboard(); sb.Children.Add(animation); if ((double)e.NewValue <= 0.0 || (double)e.NewValue >= 1.0) { sb.Completed += (sender, args) => { smoothProgressBar.Visibility = Visibility.Collapsed; }; } if (smoothProgressBar._previousStoryboard != null) { smoothProgressBar._previousStoryboard.Stop(); } smoothProgressBar._previousStoryboard = sb; sb.Begin(); } else { smoothProgressBar.Value = newValue; if ((double)e.NewValue <= 0.0 || (double)e.NewValue >= 1.0) { smoothProgressBar.Visibility = Visibility.Collapsed; } } } public double Value { get { return (double) GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public SmoothProgressBar() { InitializeComponent(); Visibility = Visibility.Collapsed; } } } ================================================ FILE: Telegram.Controls/Telegram.Controls.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {C1E19589-BD32-4DCF-AF58-393AD4D40B4E} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.Controls Telegram.Controls v4.0 $(TargetFrameworkVersion) WindowsPhone71 Silverlight false true true ..\ true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true bin\Debug Private Beta\ DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true full AnyCPU prompt MinimumRecommendedRules.ruleset bin\Release Private Beta\ TRACE;SILVERLIGHT;WINDOWS_PHONE true true pdbonly AnyCPU prompt MinimumRecommendedRules.ruleset ..\packages\Coding4Fun.Toolkit.Controls.2.0.7\lib\wp71\Coding4Fun.Toolkit.Controls.dll ..\Libraries\LayoutTransformer.dll ..\packages\WPtoolkit.4.2013.08.16\lib\sl4-windowsphone71\Microsoft.Phone.Controls.Toolkit.dll FlipCounter.xaml FlipPanel.xaml SmoothProgressBar.xaml MSBuild:Compile Designer MSBuild:Compile Designer Designer MSBuild:Compile MSBuild:Compile Designer ================================================ FILE: Telegram.Controls/Themes/generic.xaml ================================================  ================================================ FILE: Telegram.Controls/Triggers/CompressionTrigger.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Interactivity; namespace Telegram.Controls.Triggers { public class CompressionTrigger : TriggerBase { public static DependencyProperty IsDisabledProperty = DependencyProperty.Register("IsDisabled", typeof(bool), typeof(CompressionTrigger), null); public bool IsDisabled { get { return (bool)GetValue(IsDisabledProperty); } set { SetValue(IsDisabledProperty, value); } } public static DependencyProperty CompressionTypeProperty = DependencyProperty.Register("CompressionType", typeof(CompressionType), typeof(CompressionTrigger), null); public CompressionType CompressionType { get { return (CompressionType)GetValue(CompressionTypeProperty); } set { SetValue(CompressionTypeProperty, value); } } protected override void OnAttached() { base.OnAttached(); AssociatedObject.Compression += AssociatedObject_Compression; } protected override void OnDetaching() { AssociatedObject.Compression -= AssociatedObject_Compression; base.OnDetaching(); } private void AssociatedObject_Compression(object sender, CompressionEventArgs args) { if (!IsDisabled && args.Type == CompressionType) { InvokeActions(null); } } } public class CompressionTrigger2 : TriggerBase { public static DependencyProperty IsDisabledProperty = DependencyProperty.Register("IsDisabled", typeof(bool), typeof(CompressionTrigger2), null); public bool IsDisabled { get { return (bool)GetValue(IsDisabledProperty); } set { SetValue(IsDisabledProperty, value); } } public static DependencyProperty CompressionTypeProperty = DependencyProperty.Register("CompressionType", typeof(CompressionType), typeof(CompressionTrigger2), null); public CompressionType CompressionType { get { return (CompressionType)GetValue(CompressionTypeProperty); } set { SetValue(CompressionTypeProperty, value); } } protected override void OnAttached() { base.OnAttached(); AssociatedObject.Compression += AssociatedObject_Compression; } protected override void OnDetaching() { AssociatedObject.Compression -= AssociatedObject_Compression; base.OnDetaching(); } private void AssociatedObject_Compression(object sender, CompressionEventArgs args) { if (!IsDisabled && args.Type == CompressionType) { InvokeActions(null); } } } } ================================================ FILE: Telegram.Controls/UnreadCounter.xaml ================================================  ================================================ FILE: Telegram.Controls/UnreadCounter.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Globalization; using System.Windows; using System.Windows.Media; namespace Telegram.Controls { public partial class UnreadCounter { public static readonly DependencyProperty BorderBackgroundProperty = DependencyProperty.Register( "BorderBackground", typeof (Brush), typeof (UnreadCounter), new PropertyMetadata(default(Brush), OnBorderBackgroundChanged)); private static void OnBorderBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var unreadCounter = d as UnreadCounter; if (unreadCounter != null) { unreadCounter.Border.Background = (Brush) e.NewValue; } } public Brush BorderBackground { get { return (Brush) GetValue(BorderBackgroundProperty); } set { SetValue(BorderBackgroundProperty, value); } } public static readonly DependencyProperty CounterProperty = DependencyProperty.Register( "Counter", typeof(int), typeof(UnreadCounter), new PropertyMetadata(OnCounterChanged)); private static void OnCounterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var unreadCounter = d as UnreadCounter; if (unreadCounter != null) { var counter = (int)e.NewValue; unreadCounter.Visibility = counter <= 0 ? Visibility.Collapsed : Visibility.Visible; if (counter < 1000) { unreadCounter.CounterText.Text = counter.ToString(CultureInfo.InvariantCulture); } else { unreadCounter.CounterText.Text = counter / 1000 + "K"; } } } public int Counter { get { return (int)GetValue(CounterProperty); } set { SetValue(CounterProperty, value); } } public UnreadCounter() { InitializeComponent(); Background = (Brush) Resources["PhoneAccentBrush"]; Visibility = Visibility.Collapsed; CounterText.Text = null; } } } ================================================ FILE: Telegram.Controls/Utils/Language.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Collections.Generic; using System.Text; namespace Telegram.Controls.Utils { public static class Language { private static readonly Dictionary _ruEnTable = new Dictionary { {'а', "a"}, {'б', "b"}, {'в', "v"}, {'г', "g"}, {'д', "d"}, {'е', "e"}, {'ё', "e"}, {'ж', "zh"}, {'з', "z"}, {'и', "i"}, {'й', "j"}, {'к', "k"}, {'л', "l"}, {'м', "m"}, {'н', "n"}, {'о', "o"}, {'п', "p"}, {'р', "r"}, {'с', "s"}, {'т', "t"}, {'у', "u"}, {'ф', "f"}, {'х', "kh"}, {'ц', "tc"}, {'ч', "ch"}, {'ш', "sh"}, {'щ', "shch"}, {'ъ', ""}, {'ы', "y"}, {'ь', ""}, {'э', "e"}, {'ю', "iu"}, {'я', "ia"} }; private static readonly Dictionary _enRuTable = new Dictionary { {'a', "а"}, {'b', "б"}, {'c', "ц"}, {'d', "д"}, {'e', "е"}, {'f', "ф"}, {'g', "г"}, {'h', "х"}, {'i', "и"}, {'j', "й"}, {'k', "к"}, {'l', "л"}, {'m', "м"}, {'n', "н"}, {'o', "о"}, {'p', "п"}, {'q', "к"}, {'r', "р"}, {'s', "с"}, {'t', "т"}, {'u', "ю"}, {'v', "в"}, {'w', "в"}, {'x', "х"}, {'y', "й"}, {'z', "з"} }; public static string Transliterate(string str) { var enCount = 0; var ruCount = 0; var count = 0; const int maxCount = 7; foreach (var alpha in str) { if (count > maxCount) break; if (_enRuTable.ContainsKey(alpha)) { enCount++; } else if (_ruEnTable.ContainsKey(alpha)) { ruCount++; } count++; } if (enCount > ruCount) { return TransliterateToRussian(str); } return TransliterateToEnglish(str); } public static string TransliterateToRussian(string str) { var enStr = new StringBuilder(); foreach (var alpha in str) { if (_enRuTable.ContainsKey(alpha)) { enStr.Append(_enRuTable[alpha]); } } return enStr.ToString(); } public static string TransliterateToEnglish(string str) { var enStr = new StringBuilder(); foreach (var alpha in str) { if (_ruEnTable.ContainsKey(alpha)) { enStr.Append(_ruEnTable[alpha]); } } return enStr.ToString(); } } } ================================================ FILE: Telegram.Controls/ValidationTextBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeniy Nadymov, 2013-2018. // using System.Windows; using System.Windows.Controls; namespace Telegram.Controls { public class ValidationTextBox : TextBox { public ValidationTextBox() { DefaultStyleKey = typeof(ValidationTextBox); } public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register( "HasError", typeof (bool), typeof (ValidationTextBox), new PropertyMetadata(default(bool), OnHasErrorChanged)); private static void OnHasErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var validationTextBox = (ValidationTextBox)d; if ((bool)e.NewValue) { VisualStateManager.GoToState(validationTextBox, "Invalid", true); } else { VisualStateManager.GoToState(validationTextBox, "Valid", true); } } public bool HasError { get { return (bool) GetValue(HasErrorProperty); } set { SetValue(HasErrorProperty, value); } } } } ================================================ FILE: Telegram.Controls/WatermarkTextBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using Telegram.Controls.Helpers; namespace Telegram.Controls { public class WatermarkedTextBox : TextBox { public static readonly DependencyProperty InlineWatermarkProperty = DependencyProperty.Register( "InlineWatermark", typeof (string), typeof (WatermarkedTextBox), new PropertyMetadata(default(string), OnInlineWatermarkPropertyChanged)); private static void OnInlineWatermarkPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = d as WatermarkedTextBox; if (textBox != null) { SetInlineWatermarkPosition(textBox); } } private static void SetInlineWatermarkPosition(WatermarkedTextBox textBox) { var text = textBox.Text ?? string.Empty; if (textBox._watermarkInlineContentBorder != null) { var measuredText = text; var rect = textBox.GetRectFromCharacterIndex(measuredText.Length); #if DEBUG //Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show("'" + text + "' " + text.Length + " " + rect)); #endif //textBox._watermarkInlineContentBorder.Margin = new Thickness(textBox.Margin.Left, textBox.Margin.Top, textBox.ActualWidth - rect.X - 15.0, textBox.Margin.Bottom); //textBox.GetRectFromCharacterIndex(0, ) var delta = !measuredText.EndsWith(" ") && measuredText.Length > 0 ? rect.X - textBox.GetRectFromCharacterIndex(measuredText.Length - 1).X : 0.0; textBox._watermarkInlineContentBorder.RenderTransform = new TranslateTransform { X = rect.X + delta, Y = 0.0 }; } } public string InlineWatermark { get { return (string) GetValue(InlineWatermarkProperty); } set { SetValue(InlineWatermarkProperty, value); } } public static readonly DependencyProperty TextScaleFactorProperty = DependencyProperty.Register( "TextScaleFactor", typeof(double), typeof(WatermarkedTextBox), new PropertyMetadata(1.0, OnTextScaleFactorChanged)); private static void OnTextScaleFactorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = (WatermarkedTextBox)d; if (textBox != null && textBox._contentElement != null) { var opacity = textBox._watermarkInlineContent.Opacity; textBox._watermarkInlineContent.Opacity = 0.0; textBox.FontSize = textBox._defaultFontSize * (double)e.NewValue; Deployment.Current.Dispatcher.BeginInvoke(() => { textBox._watermarkInlineContent.Opacity = opacity; SetInlineWatermarkPosition(textBox); }); } } private double _defaultFontSize; public double TextScaleFactor { get { return (double)GetValue(TextScaleFactorProperty); } set { SetValue(TextScaleFactorProperty, value); } } private ContentControl _watermarkContent; private ContentControl _watermarkInlineContent; private ContentControl _contentElement; public static readonly DependencyProperty WatermarkForegroundProperty = DependencyProperty.Register( "WatermarkForeground", typeof (Brush), typeof (WatermarkedTextBox), new PropertyMetadata(default(Brush))); public Brush WatermarkForeground { get { return (Brush) GetValue(WatermarkForegroundProperty); } set { SetValue(WatermarkForegroundProperty, value); } } public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(object), typeof(WatermarkedTextBox), new PropertyMetadata(OnWatermarkPropertyChanged)); public static readonly DependencyProperty WatermarkStyleProperty = DependencyProperty.Register("WatermarkStyle", typeof(Style), typeof(WatermarkedTextBox), null); public Style WatermarkStyle { get { return GetValue(WatermarkStyleProperty) as Style; } set { SetValue(WatermarkStyleProperty, value); } } public object Watermark { get { return GetValue(WatermarkProperty); } set { SetValue(WatermarkProperty, value); } } private readonly DependencyPropertyChangedListener _listener; private Border _watermarkInlineContentBorder; public WatermarkedTextBox() { DefaultStyleKey = typeof(WatermarkedTextBox); _listener = DependencyPropertyChangedListener.Create(this, "Text"); _listener.ValueChanged += OnTextChanged; } private void OnTextChanged(object sender, DependencyPropertyValueChangedEventArgs args) { if (_watermarkContent != null) { _watermarkContent.Opacity = !string.IsNullOrEmpty(Text) ? 0.0 : 0.5; } if (_watermarkInlineContent != null) { _watermarkInlineContent.Opacity = !string.IsNullOrEmpty(Text) ? 0.5 : 0.0; } //var text = Text ?? string.Empty; //if (_watermarkInlineContentBorder != null) //{ // var rect = GetRectFromCharacterIndex(text.Length); // _watermarkInlineContentBorder.RenderTransform = new TranslateTransform { X = rect.X - 12.0, Y = rect.Y - rect.Height / 2.0 - 8.0 }; //} } public override void OnApplyTemplate() { base.OnApplyTemplate(); _defaultFontSize = FontSize; if (TextScaleFactor > 1.0) { FontSize = _defaultFontSize*TextScaleFactor; } _watermarkContent = GetTemplateChild("WatermarkContent") as ContentControl; _watermarkInlineContent = GetTemplateChild("WatermarkInlineContent") as ContentControl; _watermarkInlineContentBorder = GetTemplateChild("WatermarkInlineContentBorder") as Border; _contentElement = GetTemplateChild("ContentElement") as ContentControl; if (_watermarkContent != null) { DetermineWatermarkContentVisibility(); } } protected override void OnGotFocus(RoutedEventArgs e) { DetermineWatermarkContentVisibility(); base.OnGotFocus(e); } protected override void OnLostFocus(RoutedEventArgs e) { DetermineWatermarkContentVisibility(); base.OnLostFocus(e); } private static void OnWatermarkPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { var watermarkTextBox = sender as WatermarkedTextBox; if (watermarkTextBox != null && watermarkTextBox._watermarkContent != null) { watermarkTextBox.DetermineWatermarkContentVisibility(); } } private void DetermineWatermarkContentVisibility() { _watermarkContent.Opacity = string.IsNullOrEmpty(Text) ? 0.5 : 0.0; } } } ================================================ FILE: Telegram.Controls/packages.config ================================================  ================================================ FILE: Telegram.Controls.WP8/Properties/AssemblyInfo.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.Controls.WP8")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.Controls.WP8")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("f04be5a2-70df-4e82-bfb5-cd03985c9746")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.Controls.WP8/Telegram.Controls.WP8.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {F04BE5A2-70DF-4E82-BFB5-CD03985C9746} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.Controls Telegram.Controls WindowsPhone v8.0 $(TargetFrameworkVersion) false true 11.0 true ..\ true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\x86\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\x86\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\ARM\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;WP8 true true prompt 4 pdbonly true Bin\ARM\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;WP8 true true prompt 4 AnimationMediator.cs BindingListener.cs Extensions\ScrollViewerExtensions.cs Extensions\VisualTreeExtensions.cs FlipCounter.xaml.cs FlipCounter.xaml FlipPanel.xaml.cs FlipPanel.xaml Helpers\DependencyPropertyChangedListener.cs Helpers\DependencyPropertyValueChangedEventArgs.cs HighlightingTextBlock.cs IHighlightable.cs LazyItemsControl.cs LazyListBox.cs LongListSelector\Common\MotionParameters.cs LongListSelector\Common\SafeRaise.cs LongListSelector\Common\TempaltedVisualTreeExtensions.cs LongListSelector\Common\VisualStates.cs LongListSelector\LongListSelector.cs LongListSelector\LongListSelectorEventArgs.cs LongListSelector\LongListSelectorGroup.cs LongListSelector\LongListSelectorItem.cs LongListSelector\LongListSelectorItemsControl.cs LongListSelector\LongListSelectorItemType.cs LongListSelector\TemplatedListBox.cs LongListSelector\TemplatedListBoxItem.cs MultiTemplateItemsControl.cs MultiTemplateLazyListBox.cs Notifications\DialogService.cs Notifications\PopUp.cs Notifications\ToastPrompt.cs Profiling\ApplicationSpace.cs Profiling\MemoryCounter.cs RangeSlider.cs ReorderListBox\ReorderListBox.cs ReorderListBox\ReorderListBoxItem.cs ScrollableTextBlock.cs SmoothProgressBar.xaml.cs SmoothProgressBar.xaml Triggers\CompressionTrigger.cs UnreadCounter.xaml.cs UnreadCounter.xaml Utils\Language.cs WatermarkTextBox.cs FlipCounter.xaml MSBuild:Compile Designer FlipPanel.xaml MSBuild:Compile Designer SmoothProgressBar.xaml MSBuild:Compile Designer Themes\generic.xaml MSBuild:Compile Designer UnreadCounter.xaml MSBuild:Compile Designer ..\packages\Coding4Fun.Toolkit.Controls.2.0.7\lib\windowsphone8\Coding4Fun.Toolkit.Controls.dll ..\Libraries\LayoutTransformer.dll This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. ================================================ FILE: Telegram.Controls.WP8/Utils/Currency.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; namespace Telegram.Controls.Utils { public static class Currency { public static int GetPow(string currency) { if (currency == "CLF") { return 4; } string[] cur3 = { "BHD", "IQD", "JOD", "KWD", "LYD", "OMR", "TND" }; if (cur3.Contains(currency)) { return 3; } string[] cur0 = { "BIF", "BYR", "CLP", "CVE", "DJF", "GNF", "ISK", "JPY", "KMF", "KRW", "MGA", "PYG", "RWF", "UGX", "UYI", "VND", "VUV", "XAF", "XOF", "XPF" }; if (cur0.Contains(currency)) { return 0; } if (currency == "MRO") { return 1; } return 2; } private static Dictionary _dict = new Dictionary { {"AED", "د.إ"}, {"AFN", "؋"}, {"ARS", "$"}, {"AUD", "$"}, {"AZN", "₼"}, {"BND", "B$"}, {"BRL", "R$"}, {"CAD", "$"}, {"CHF", "Fr"}, {"CLP", "$"}, {"CNY", "¥"}, {"COP", "$"}, {"EGP", "E£"}, {"EUR", "€"}, {"GBP", "£"}, {"HKD", "$"}, {"IDR", "Rp"}, {"ILS", "₪"}, {"INR", "₹"}, {"ISK", "kr"}, {"JPY", "¥"}, {"KRW", "₩"}, {"KZT", "₸"}, {"MXN", "$"}, {"MYR", "RM"}, {"NOK", "kr"}, {"NZD", "$"}, {"PHP", "₱"}, {"RUB", "₽"}, {"SAR", "SR"}, {"SEK", "kr"}, {"SGD", "$"}, {"TRY", "₺"}, {"TTD", "$"}, {"TWD", "$"}, {"TZS", "TSh"}, {"UAH", "₴"}, {"UGX", "USh"}, {"USD", "$"}, {"UYU", "$"}, {"VND", "₫"}, {"YER", "﷼"}, {"ZAR", "R"}, {"IRR", "﷼"}, {"IQD", "ع.د"}, {"VEF", "Bs.F."} }; public static string GetSymbol(string currency) { string symbol; if (_dict.TryGetValue(currency, out symbol)) { return symbol; } return currency; } public static string GetString(long totalAmount, string currency) { return string.Format("{0:0.00} {1}", totalAmount / Math.Pow(10.0, GetPow(currency)), GetSymbol(currency)); } } } ================================================ FILE: Telegram.Controls.WP8/packages.config ================================================  ================================================ FILE: Telegram.EmojiPanel/BrowserNavigationService.cs ================================================ using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using Microsoft.Phone.Tasks; using Telegram.EmojiPanel.Controls.Emoji; namespace Telegram.EmojiPanel { public static class Emoji { private static Dictionary _dict; public static Dictionary Dict { get { if (_dict == null) { _dict = new Dictionary(); InitializeDict(); } return _dict; } } private static void InitializeDict() { _dict["002320E3"] = "002320E3"; _dict["003020E3"] = "003020E3"; _dict["003120E3"] = "003120E3"; _dict["003220E3"] = "003220E3"; _dict["003320E3"] = "003320E3"; _dict["003420E3"] = "003420E3"; _dict["003520E3"] = "003520E3"; _dict["003620E3"] = "003620E3"; _dict["003720E3"] = "003720E3"; _dict["003820E3"] = "003820E3"; _dict["003920E3"] = "003920E3"; _dict["00A9"] = "00A9"; _dict["00AE"] = "00AE"; _dict["203C"] = "203C"; _dict["2049"] = "2049"; _dict["2122"] = "2122"; _dict["2139"] = "2139"; _dict["2194"] = "2194"; _dict["2195"] = "2195"; _dict["2196"] = "2196"; _dict["2197"] = "2197"; _dict["2198"] = "2198"; _dict["2199"] = "2199"; _dict["21A9"] = "21A9"; _dict["21AA"] = "21AA"; _dict["231A"] = "231A"; _dict["231B"] = "231B"; _dict["23E9"] = "23E9"; _dict["23EA"] = "23EA"; _dict["23EB"] = "23EB"; _dict["23EC"] = "23EC"; _dict["23F0"] = "23F0"; _dict["23F3"] = "23F3"; _dict["24C2"] = "24C2"; _dict["25AA"] = "25AA"; _dict["25AB"] = "25AB"; _dict["25B6"] = "25B6"; _dict["25C0"] = "25C0"; _dict["25FB"] = "25FB"; _dict["25FC"] = "25FC"; _dict["25FD"] = "25FD"; _dict["25FE"] = "25FE"; _dict["2600"] = "2600"; _dict["2601"] = "2601"; _dict["260E"] = "260E"; _dict["2611"] = "2611"; _dict["2614"] = "2614"; _dict["2615"] = "2615"; _dict["261D"] = "261D"; _dict["263A"] = "263A"; _dict["2648"] = "2648"; _dict["2649"] = "2649"; _dict["264A"] = "264A"; _dict["264B"] = "264B"; _dict["264C"] = "264C"; _dict["264D"] = "264D"; _dict["264E"] = "264E"; _dict["264F"] = "264F"; _dict["2650"] = "2650"; _dict["2651"] = "2651"; _dict["2652"] = "2652"; _dict["2653"] = "2653"; _dict["2660"] = "2660"; _dict["2663"] = "2663"; _dict["2665"] = "2665"; _dict["2666"] = "2666"; _dict["2668"] = "2668"; _dict["267B"] = "267B"; _dict["267F"] = "267F"; _dict["2693"] = "2693"; _dict["26A0"] = "26A0"; _dict["26A1"] = "26A1"; _dict["26AA"] = "26AA"; _dict["26AB"] = "26AB"; _dict["26BD"] = "26BD"; _dict["26BE"] = "26BE"; _dict["26C4"] = "26C4"; _dict["26C5"] = "26C5"; _dict["26CE"] = "26CE"; _dict["26D4"] = "26D4"; _dict["26EA"] = "26EA"; _dict["26F2"] = "26F2"; _dict["26F3"] = "26F3"; _dict["26F5"] = "26F5"; _dict["26FA"] = "26FA"; _dict["26FD"] = "26FD"; _dict["2702"] = "2702"; _dict["2705"] = "2705"; _dict["2708"] = "2708"; _dict["2709"] = "2709"; _dict["270A"] = "270A"; _dict["270B"] = "270B"; _dict["270C"] = "270C"; _dict["270F"] = "270F"; _dict["2712"] = "2712"; _dict["2714"] = "2714"; _dict["2716"] = "2716"; _dict["2728"] = "2728"; _dict["2733"] = "2733"; _dict["2734"] = "2734"; _dict["2744"] = "2744"; _dict["2747"] = "2747"; _dict["274C"] = "274C"; _dict["274E"] = "274E"; _dict["2753"] = "2753"; _dict["2754"] = "2754"; _dict["2755"] = "2755"; _dict["2757"] = "2757"; _dict["2764"] = "2764"; _dict["2795"] = "2795"; _dict["2796"] = "2796"; _dict["2797"] = "2797"; _dict["27A1"] = "27A1"; _dict["27B0"] = "27B0"; _dict["27BF"] = "27BF"; _dict["2934"] = "2934"; _dict["2935"] = "2935"; _dict["2B05"] = "2B05"; _dict["2B06"] = "2B06"; _dict["2B07"] = "2B07"; _dict["2B1B"] = "2B1B"; _dict["2B1C"] = "2B1C"; _dict["2B50"] = "2B50"; _dict["2B55"] = "2B55"; _dict["3030"] = "3030"; _dict["303D"] = "303D"; _dict["3297"] = "3297"; _dict["3299"] = "3299"; _dict["D83CDC04"] = "D83CDC04"; _dict["D83CDCCF"] = "D83CDCCF"; _dict["D83CDD70"] = "D83CDD70"; _dict["D83CDD71"] = "D83CDD71"; _dict["D83CDD7E"] = "D83CDD7E"; _dict["D83CDD7F"] = "D83CDD7F"; _dict["D83CDD8E"] = "D83CDD8E"; _dict["D83CDD91"] = "D83CDD91"; _dict["D83CDD92"] = "D83CDD92"; _dict["D83CDD93"] = "D83CDD93"; _dict["D83CDD94"] = "D83CDD94"; _dict["D83CDD95"] = "D83CDD95"; _dict["D83CDD96"] = "D83CDD96"; _dict["D83CDD97"] = "D83CDD97"; _dict["D83CDD98"] = "D83CDD98"; _dict["D83CDD99"] = "D83CDD99"; _dict["D83CDD9A"] = "D83CDD9A"; _dict["D83CDDE8D83CDDF3"] = "D83CDDE8D83CDDF3"; _dict["D83CDDE9D83CDDEA"] = "D83CDDE9D83CDDEA"; _dict["D83CDDEAD83CDDF8"] = "D83CDDEAD83CDDF8"; _dict["D83CDDEBD83CDDF7"] = "D83CDDEBD83CDDF7"; _dict["D83CDDECD83CDDE7"] = "D83CDDECD83CDDE7"; _dict["D83CDDEED83CDDF9"] = "D83CDDEED83CDDF9"; _dict["D83CDDEFD83CDDF5"] = "D83CDDEFD83CDDF5"; _dict["D83CDDF0D83CDDF7"] = "D83CDDF0D83CDDF7"; _dict["D83CDDF7D83CDDFA"] = "D83CDDF7D83CDDFA"; _dict["D83CDDFAD83CDDF8"] = "D83CDDFAD83CDDF8"; _dict["D83CDE01"] = "D83CDE01"; _dict["D83CDE02"] = "D83CDE02"; _dict["D83CDE1A"] = "D83CDE1A"; _dict["D83CDE2F"] = "D83CDE2F"; _dict["D83CDE32"] = "D83CDE32"; _dict["D83CDE33"] = "D83CDE33"; _dict["D83CDE34"] = "D83CDE34"; _dict["D83CDE35"] = "D83CDE35"; _dict["D83CDE36"] = "D83CDE36"; _dict["D83CDE37"] = "D83CDE37"; _dict["D83CDE38"] = "D83CDE38"; _dict["D83CDE39"] = "D83CDE39"; _dict["D83CDE3A"] = "D83CDE3A"; _dict["D83CDE50"] = "D83CDE50"; _dict["D83CDE51"] = "D83CDE51"; _dict["D83CDF00"] = "D83CDF00"; _dict["D83CDF01"] = "D83CDF01"; _dict["D83CDF02"] = "D83CDF02"; _dict["D83CDF03"] = "D83CDF03"; _dict["D83CDF04"] = "D83CDF04"; _dict["D83CDF05"] = "D83CDF05"; _dict["D83CDF06"] = "D83CDF06"; _dict["D83CDF07"] = "D83CDF07"; _dict["D83CDF08"] = "D83CDF08"; _dict["D83CDF09"] = "D83CDF09"; _dict["D83CDF0A"] = "D83CDF0A"; _dict["D83CDF0B"] = "D83CDF0B"; _dict["D83CDF0C"] = "D83CDF0C"; _dict["D83CDF0D"] = "D83CDF0D"; _dict["D83CDF0E"] = "D83CDF0E"; _dict["D83CDF0F"] = "D83CDF0F"; _dict["D83CDF10"] = "D83CDF10"; _dict["D83CDF11"] = "D83CDF11"; _dict["D83CDF12"] = "D83CDF12"; _dict["D83CDF13"] = "D83CDF13"; _dict["D83CDF14"] = "D83CDF14"; _dict["D83CDF15"] = "D83CDF15"; _dict["D83CDF16"] = "D83CDF16"; _dict["D83CDF17"] = "D83CDF17"; _dict["D83CDF18"] = "D83CDF18"; _dict["D83CDF19"] = "D83CDF19"; _dict["D83CDF1A"] = "D83CDF1A"; _dict["D83CDF1B"] = "D83CDF1B"; _dict["D83CDF1C"] = "D83CDF1C"; _dict["D83CDF1D"] = "D83CDF1D"; _dict["D83CDF1E"] = "D83CDF1E"; _dict["D83CDF1F"] = "D83CDF1F"; _dict["D83CDF20"] = "D83CDF20"; _dict["D83CDF30"] = "D83CDF30"; _dict["D83CDF31"] = "D83CDF31"; _dict["D83CDF32"] = "D83CDF32"; _dict["D83CDF33"] = "D83CDF33"; _dict["D83CDF34"] = "D83CDF34"; _dict["D83CDF35"] = "D83CDF35"; _dict["D83CDF37"] = "D83CDF37"; _dict["D83CDF38"] = "D83CDF38"; _dict["D83CDF39"] = "D83CDF39"; _dict["D83CDF3A"] = "D83CDF3A"; _dict["D83CDF3B"] = "D83CDF3B"; _dict["D83CDF3C"] = "D83CDF3C"; _dict["D83CDF3D"] = "D83CDF3D"; _dict["D83CDF3E"] = "D83CDF3E"; _dict["D83CDF3F"] = "D83CDF3F"; _dict["D83CDF40"] = "D83CDF40"; _dict["D83CDF41"] = "D83CDF41"; _dict["D83CDF42"] = "D83CDF42"; _dict["D83CDF43"] = "D83CDF43"; _dict["D83CDF44"] = "D83CDF44"; _dict["D83CDF45"] = "D83CDF45"; _dict["D83CDF46"] = "D83CDF46"; _dict["D83CDF47"] = "D83CDF47"; _dict["D83CDF48"] = "D83CDF48"; _dict["D83CDF49"] = "D83CDF49"; _dict["D83CDF4A"] = "D83CDF4A"; _dict["D83CDF4B"] = "D83CDF4B"; _dict["D83CDF4C"] = "D83CDF4C"; _dict["D83CDF4D"] = "D83CDF4D"; _dict["D83CDF4E"] = "D83CDF4E"; _dict["D83CDF4F"] = "D83CDF4F"; _dict["D83CDF50"] = "D83CDF50"; _dict["D83CDF51"] = "D83CDF51"; _dict["D83CDF52"] = "D83CDF52"; _dict["D83CDF53"] = "D83CDF53"; _dict["D83CDF54"] = "D83CDF54"; _dict["D83CDF55"] = "D83CDF55"; _dict["D83CDF56"] = "D83CDF56"; _dict["D83CDF57"] = "D83CDF57"; _dict["D83CDF58"] = "D83CDF58"; _dict["D83CDF59"] = "D83CDF59"; _dict["D83CDF5A"] = "D83CDF5A"; _dict["D83CDF5B"] = "D83CDF5B"; _dict["D83CDF5C"] = "D83CDF5C"; _dict["D83CDF5D"] = "D83CDF5D"; _dict["D83CDF5E"] = "D83CDF5E"; _dict["D83CDF5F"] = "D83CDF5F"; _dict["D83CDF60"] = "D83CDF60"; _dict["D83CDF61"] = "D83CDF61"; _dict["D83CDF62"] = "D83CDF62"; _dict["D83CDF63"] = "D83CDF63"; _dict["D83CDF64"] = "D83CDF64"; _dict["D83CDF65"] = "D83CDF65"; _dict["D83CDF66"] = "D83CDF66"; _dict["D83CDF67"] = "D83CDF67"; _dict["D83CDF68"] = "D83CDF68"; _dict["D83CDF69"] = "D83CDF69"; _dict["D83CDF6A"] = "D83CDF6A"; _dict["D83CDF6B"] = "D83CDF6B"; _dict["D83CDF6C"] = "D83CDF6C"; _dict["D83CDF6D"] = "D83CDF6D"; _dict["D83CDF6E"] = "D83CDF6E"; _dict["D83CDF6F"] = "D83CDF6F"; _dict["D83CDF70"] = "D83CDF70"; _dict["D83CDF71"] = "D83CDF71"; _dict["D83CDF72"] = "D83CDF72"; _dict["D83CDF73"] = "D83CDF73"; _dict["D83CDF74"] = "D83CDF74"; _dict["D83CDF75"] = "D83CDF75"; _dict["D83CDF76"] = "D83CDF76"; _dict["D83CDF77"] = "D83CDF77"; _dict["D83CDF78"] = "D83CDF78"; _dict["D83CDF79"] = "D83CDF79"; _dict["D83CDF7A"] = "D83CDF7A"; _dict["D83CDF7B"] = "D83CDF7B"; _dict["D83CDF7C"] = "D83CDF7C"; _dict["D83CDF80"] = "D83CDF80"; _dict["D83CDF81"] = "D83CDF81"; _dict["D83CDF82"] = "D83CDF82"; _dict["D83CDF83"] = "D83CDF83"; _dict["D83CDF84"] = "D83CDF84"; _dict["D83CDF85"] = "D83CDF85"; _dict["D83CDF86"] = "D83CDF86"; _dict["D83CDF87"] = "D83CDF87"; _dict["D83CDF88"] = "D83CDF88"; _dict["D83CDF89"] = "D83CDF89"; _dict["D83CDF8A"] = "D83CDF8A"; _dict["D83CDF8B"] = "D83CDF8B"; _dict["D83CDF8C"] = "D83CDF8C"; _dict["D83CDF8D"] = "D83CDF8D"; _dict["D83CDF8E"] = "D83CDF8E"; _dict["D83CDF8F"] = "D83CDF8F"; _dict["D83CDF90"] = "D83CDF90"; _dict["D83CDF91"] = "D83CDF91"; _dict["D83CDF92"] = "D83CDF92"; _dict["D83CDF93"] = "D83CDF93"; _dict["D83CDFA0"] = "D83CDFA0"; _dict["D83CDFA1"] = "D83CDFA1"; _dict["D83CDFA2"] = "D83CDFA2"; _dict["D83CDFA3"] = "D83CDFA3"; _dict["D83CDFA4"] = "D83CDFA4"; _dict["D83CDFA5"] = "D83CDFA5"; _dict["D83CDFA6"] = "D83CDFA6"; _dict["D83CDFA7"] = "D83CDFA7"; _dict["D83CDFA8"] = "D83CDFA8"; _dict["D83CDFA9"] = "D83CDFA9"; _dict["D83CDFAA"] = "D83CDFAA"; _dict["D83CDFAB"] = "D83CDFAB"; _dict["D83CDFAC"] = "D83CDFAC"; _dict["D83CDFAD"] = "D83CDFAD"; _dict["D83CDFAE"] = "D83CDFAE"; _dict["D83CDFAF"] = "D83CDFAF"; _dict["D83CDFB0"] = "D83CDFB0"; _dict["D83CDFB1"] = "D83CDFB1"; _dict["D83CDFB2"] = "D83CDFB2"; _dict["D83CDFB3"] = "D83CDFB3"; _dict["D83CDFB4"] = "D83CDFB4"; _dict["D83CDFB5"] = "D83CDFB5"; _dict["D83CDFB6"] = "D83CDFB6"; _dict["D83CDFB7"] = "D83CDFB7"; _dict["D83CDFB8"] = "D83CDFB8"; _dict["D83CDFB9"] = "D83CDFB9"; _dict["D83CDFBA"] = "D83CDFBA"; _dict["D83CDFBB"] = "D83CDFBB"; _dict["D83CDFBC"] = "D83CDFBC"; _dict["D83CDFBD"] = "D83CDFBD"; _dict["D83CDFBE"] = "D83CDFBE"; _dict["D83CDFBF"] = "D83CDFBF"; _dict["D83CDFC0"] = "D83CDFC0"; _dict["D83CDFC1"] = "D83CDFC1"; _dict["D83CDFC2"] = "D83CDFC2"; _dict["D83CDFC3"] = "D83CDFC3"; _dict["D83CDFC4"] = "D83CDFC4"; _dict["D83CDFC6"] = "D83CDFC6"; _dict["D83CDFC7"] = "D83CDFC7"; _dict["D83CDFC8"] = "D83CDFC8"; _dict["D83CDFC9"] = "D83CDFC9"; _dict["D83CDFCA"] = "D83CDFCA"; _dict["D83CDFE0"] = "D83CDFE0"; _dict["D83CDFE1"] = "D83CDFE1"; _dict["D83CDFE2"] = "D83CDFE2"; _dict["D83CDFE3"] = "D83CDFE3"; _dict["D83CDFE4"] = "D83CDFE4"; _dict["D83CDFE5"] = "D83CDFE5"; _dict["D83CDFE6"] = "D83CDFE6"; _dict["D83CDFE7"] = "D83CDFE7"; _dict["D83CDFE8"] = "D83CDFE8"; _dict["D83CDFE9"] = "D83CDFE9"; _dict["D83CDFEA"] = "D83CDFEA"; _dict["D83CDFEB"] = "D83CDFEB"; _dict["D83CDFEC"] = "D83CDFEC"; _dict["D83CDFED"] = "D83CDFED"; _dict["D83CDFEE"] = "D83CDFEE"; _dict["D83CDFEF"] = "D83CDFEF"; _dict["D83CDFF0"] = "D83CDFF0"; _dict["D83DDC00"] = "D83DDC00"; _dict["D83DDC01"] = "D83DDC01"; _dict["D83DDC02"] = "D83DDC02"; _dict["D83DDC03"] = "D83DDC03"; _dict["D83DDC04"] = "D83DDC04"; _dict["D83DDC05"] = "D83DDC05"; _dict["D83DDC06"] = "D83DDC06"; _dict["D83DDC07"] = "D83DDC07"; _dict["D83DDC08"] = "D83DDC08"; _dict["D83DDC09"] = "D83DDC09"; _dict["D83DDC0A"] = "D83DDC0A"; _dict["D83DDC0B"] = "D83DDC0B"; _dict["D83DDC0C"] = "D83DDC0C"; _dict["D83DDC0D"] = "D83DDC0D"; _dict["D83DDC0E"] = "D83DDC0E"; _dict["D83DDC0F"] = "D83DDC0F"; _dict["D83DDC10"] = "D83DDC10"; _dict["D83DDC11"] = "D83DDC11"; _dict["D83DDC12"] = "D83DDC12"; _dict["D83DDC13"] = "D83DDC13"; _dict["D83DDC14"] = "D83DDC14"; _dict["D83DDC15"] = "D83DDC15"; _dict["D83DDC16"] = "D83DDC16"; _dict["D83DDC17"] = "D83DDC17"; _dict["D83DDC18"] = "D83DDC18"; _dict["D83DDC19"] = "D83DDC19"; _dict["D83DDC1A"] = "D83DDC1A"; _dict["D83DDC1B"] = "D83DDC1B"; _dict["D83DDC1C"] = "D83DDC1C"; _dict["D83DDC1D"] = "D83DDC1D"; _dict["D83DDC1E"] = "D83DDC1E"; _dict["D83DDC1F"] = "D83DDC1F"; _dict["D83DDC20"] = "D83DDC20"; _dict["D83DDC21"] = "D83DDC21"; _dict["D83DDC22"] = "D83DDC22"; _dict["D83DDC23"] = "D83DDC23"; _dict["D83DDC24"] = "D83DDC24"; _dict["D83DDC25"] = "D83DDC25"; _dict["D83DDC26"] = "D83DDC26"; _dict["D83DDC27"] = "D83DDC27"; _dict["D83DDC28"] = "D83DDC28"; _dict["D83DDC29"] = "D83DDC29"; _dict["D83DDC2A"] = "D83DDC2A"; _dict["D83DDC2B"] = "D83DDC2B"; _dict["D83DDC2C"] = "D83DDC2C"; _dict["D83DDC2D"] = "D83DDC2D"; _dict["D83DDC2E"] = "D83DDC2E"; _dict["D83DDC2F"] = "D83DDC2F"; _dict["D83DDC30"] = "D83DDC30"; _dict["D83DDC31"] = "D83DDC31"; _dict["D83DDC32"] = "D83DDC32"; _dict["D83DDC33"] = "D83DDC33"; _dict["D83DDC34"] = "D83DDC34"; _dict["D83DDC35"] = "D83DDC35"; _dict["D83DDC36"] = "D83DDC36"; _dict["D83DDC37"] = "D83DDC37"; _dict["D83DDC38"] = "D83DDC38"; _dict["D83DDC39"] = "D83DDC39"; _dict["D83DDC3A"] = "D83DDC3A"; _dict["D83DDC3B"] = "D83DDC3B"; _dict["D83DDC3C"] = "D83DDC3C"; _dict["D83DDC3D"] = "D83DDC3D"; _dict["D83DDC3E"] = "D83DDC3E"; _dict["D83DDC40"] = "D83DDC40"; _dict["D83DDC42"] = "D83DDC42"; _dict["D83DDC43"] = "D83DDC43"; _dict["D83DDC44"] = "D83DDC44"; _dict["D83DDC45"] = "D83DDC45"; _dict["D83DDC46"] = "D83DDC46"; _dict["D83DDC47"] = "D83DDC47"; _dict["D83DDC48"] = "D83DDC48"; _dict["D83DDC49"] = "D83DDC49"; _dict["D83DDC4A"] = "D83DDC4A"; _dict["D83DDC4B"] = "D83DDC4B"; _dict["D83DDC4C"] = "D83DDC4C"; _dict["D83DDC4D"] = "D83DDC4D"; _dict["D83DDC4E"] = "D83DDC4E"; _dict["D83DDC4F"] = "D83DDC4F"; _dict["D83DDC50"] = "D83DDC50"; _dict["D83DDC51"] = "D83DDC51"; _dict["D83DDC52"] = "D83DDC52"; _dict["D83DDC53"] = "D83DDC53"; _dict["D83DDC54"] = "D83DDC54"; _dict["D83DDC55"] = "D83DDC55"; _dict["D83DDC56"] = "D83DDC56"; _dict["D83DDC57"] = "D83DDC57"; _dict["D83DDC58"] = "D83DDC58"; _dict["D83DDC59"] = "D83DDC59"; _dict["D83DDC5A"] = "D83DDC5A"; _dict["D83DDC5B"] = "D83DDC5B"; _dict["D83DDC5C"] = "D83DDC5C"; _dict["D83DDC5D"] = "D83DDC5D"; _dict["D83DDC5E"] = "D83DDC5E"; _dict["D83DDC5F"] = "D83DDC5F"; _dict["D83DDC60"] = "D83DDC60"; _dict["D83DDC61"] = "D83DDC61"; _dict["D83DDC62"] = "D83DDC62"; _dict["D83DDC63"] = "D83DDC63"; _dict["D83DDC64"] = "D83DDC64"; _dict["D83DDC65"] = "D83DDC65"; _dict["D83DDC66"] = "D83DDC66"; _dict["D83DDC67"] = "D83DDC67"; _dict["D83DDC68"] = "D83DDC68"; _dict["D83DDC69"] = "D83DDC69"; _dict["D83DDC6A"] = "D83DDC6A"; _dict["D83DDC6B"] = "D83DDC6B"; _dict["D83DDC6C"] = "D83DDC6C"; _dict["D83DDC6D"] = "D83DDC6D"; _dict["D83DDC6E"] = "D83DDC6E"; _dict["D83DDC6F"] = "D83DDC6F"; _dict["D83DDC70"] = "D83DDC70"; _dict["D83DDC71"] = "D83DDC71"; _dict["D83DDC72"] = "D83DDC72"; _dict["D83DDC73"] = "D83DDC73"; _dict["D83DDC74"] = "D83DDC74"; _dict["D83DDC75"] = "D83DDC75"; _dict["D83DDC76"] = "D83DDC76"; _dict["D83DDC77"] = "D83DDC77"; _dict["D83DDC78"] = "D83DDC78"; _dict["D83DDC79"] = "D83DDC79"; _dict["D83DDC7A"] = "D83DDC7A"; _dict["D83DDC7B"] = "D83DDC7B"; _dict["D83DDC7C"] = "D83DDC7C"; _dict["D83DDC7D"] = "D83DDC7D"; _dict["D83DDC7E"] = "D83DDC7E"; _dict["D83DDC7F"] = "D83DDC7F"; _dict["D83DDC80"] = "D83DDC80"; _dict["D83DDC81"] = "D83DDC81"; _dict["D83DDC82"] = "D83DDC82"; _dict["D83DDC83"] = "D83DDC83"; _dict["D83DDC84"] = "D83DDC84"; _dict["D83DDC85"] = "D83DDC85"; _dict["D83DDC86"] = "D83DDC86"; _dict["D83DDC87"] = "D83DDC87"; _dict["D83DDC88"] = "D83DDC88"; _dict["D83DDC89"] = "D83DDC89"; _dict["D83DDC8A"] = "D83DDC8A"; _dict["D83DDC8B"] = "D83DDC8B"; _dict["D83DDC8C"] = "D83DDC8C"; _dict["D83DDC8D"] = "D83DDC8D"; _dict["D83DDC8E"] = "D83DDC8E"; _dict["D83DDC8F"] = "D83DDC8F"; _dict["D83DDC90"] = "D83DDC90"; _dict["D83DDC91"] = "D83DDC91"; _dict["D83DDC92"] = "D83DDC92"; _dict["D83DDC93"] = "D83DDC93"; _dict["D83DDC94"] = "D83DDC94"; _dict["D83DDC95"] = "D83DDC95"; _dict["D83DDC96"] = "D83DDC96"; _dict["D83DDC97"] = "D83DDC97"; _dict["D83DDC98"] = "D83DDC98"; _dict["D83DDC99"] = "D83DDC99"; _dict["D83DDC9A"] = "D83DDC9A"; _dict["D83DDC9B"] = "D83DDC9B"; _dict["D83DDC9C"] = "D83DDC9C"; _dict["D83DDC9D"] = "D83DDC9D"; _dict["D83DDC9E"] = "D83DDC9E"; _dict["D83DDC9F"] = "D83DDC9F"; _dict["D83DDCA0"] = "D83DDCA0"; _dict["D83DDCA1"] = "D83DDCA1"; _dict["D83DDCA2"] = "D83DDCA2"; _dict["D83DDCA3"] = "D83DDCA3"; _dict["D83DDCA4"] = "D83DDCA4"; _dict["D83DDCA5"] = "D83DDCA5"; _dict["D83DDCA6"] = "D83DDCA6"; _dict["D83DDCA7"] = "D83DDCA7"; _dict["D83DDCA8"] = "D83DDCA8"; _dict["D83DDCA9"] = "D83DDCA9"; _dict["D83DDCAA"] = "D83DDCAA"; _dict["D83DDCAB"] = "D83DDCAB"; _dict["D83DDCAC"] = "D83DDCAC"; _dict["D83DDCAD"] = "D83DDCAD"; _dict["D83DDCAE"] = "D83DDCAE"; _dict["D83DDCAF"] = "D83DDCAF"; _dict["D83DDCB0"] = "D83DDCB0"; _dict["D83DDCB1"] = "D83DDCB1"; _dict["D83DDCB2"] = "D83DDCB2"; _dict["D83DDCB3"] = "D83DDCB3"; _dict["D83DDCB4"] = "D83DDCB4"; _dict["D83DDCB5"] = "D83DDCB5"; _dict["D83DDCB6"] = "D83DDCB6"; _dict["D83DDCB7"] = "D83DDCB7"; _dict["D83DDCB8"] = "D83DDCB8"; _dict["D83DDCB9"] = "D83DDCB9"; _dict["D83DDCBA"] = "D83DDCBA"; _dict["D83DDCBB"] = "D83DDCBB"; _dict["D83DDCBC"] = "D83DDCBC"; _dict["D83DDCBD"] = "D83DDCBD"; _dict["D83DDCBE"] = "D83DDCBE"; _dict["D83DDCBF"] = "D83DDCBF"; _dict["D83DDCC0"] = "D83DDCC0"; _dict["D83DDCC1"] = "D83DDCC1"; _dict["D83DDCC2"] = "D83DDCC2"; _dict["D83DDCC3"] = "D83DDCC3"; _dict["D83DDCC4"] = "D83DDCC4"; _dict["D83DDCC5"] = "D83DDCC5"; _dict["D83DDCC6"] = "D83DDCC6"; _dict["D83DDCC7"] = "D83DDCC7"; _dict["D83DDCC8"] = "D83DDCC8"; _dict["D83DDCC9"] = "D83DDCC9"; _dict["D83DDCCA"] = "D83DDCCA"; _dict["D83DDCCB"] = "D83DDCCB"; _dict["D83DDCCC"] = "D83DDCCC"; _dict["D83DDCCD"] = "D83DDCCD"; _dict["D83DDCCE"] = "D83DDCCE"; _dict["D83DDCCF"] = "D83DDCCF"; _dict["D83DDCD0"] = "D83DDCD0"; _dict["D83DDCD1"] = "D83DDCD1"; _dict["D83DDCD2"] = "D83DDCD2"; _dict["D83DDCD3"] = "D83DDCD3"; _dict["D83DDCD4"] = "D83DDCD4"; _dict["D83DDCD5"] = "D83DDCD5"; _dict["D83DDCD6"] = "D83DDCD6"; _dict["D83DDCD7"] = "D83DDCD7"; _dict["D83DDCD8"] = "D83DDCD8"; _dict["D83DDCD9"] = "D83DDCD9"; _dict["D83DDCDA"] = "D83DDCDA"; _dict["D83DDCDB"] = "D83DDCDB"; _dict["D83DDCDC"] = "D83DDCDC"; _dict["D83DDCDD"] = "D83DDCDD"; _dict["D83DDCDE"] = "D83DDCDE"; _dict["D83DDCDF"] = "D83DDCDF"; _dict["D83DDCE0"] = "D83DDCE0"; _dict["D83DDCE1"] = "D83DDCE1"; _dict["D83DDCE2"] = "D83DDCE2"; _dict["D83DDCE3"] = "D83DDCE3"; _dict["D83DDCE4"] = "D83DDCE4"; _dict["D83DDCE5"] = "D83DDCE5"; _dict["D83DDCE6"] = "D83DDCE6"; _dict["D83DDCE7"] = "D83DDCE7"; _dict["D83DDCE8"] = "D83DDCE8"; _dict["D83DDCE9"] = "D83DDCE9"; _dict["D83DDCEA"] = "D83DDCEA"; _dict["D83DDCEB"] = "D83DDCEB"; _dict["D83DDCEC"] = "D83DDCEC"; _dict["D83DDCED"] = "D83DDCED"; _dict["D83DDCEE"] = "D83DDCEE"; _dict["D83DDCEF"] = "D83DDCEF"; _dict["D83DDCF0"] = "D83DDCF0"; _dict["D83DDCF1"] = "D83DDCF1"; _dict["D83DDCF2"] = "D83DDCF2"; _dict["D83DDCF3"] = "D83DDCF3"; _dict["D83DDCF4"] = "D83DDCF4"; _dict["D83DDCF5"] = "D83DDCF5"; _dict["D83DDCF6"] = "D83DDCF6"; _dict["D83DDCF7"] = "D83DDCF7"; _dict["D83DDCF9"] = "D83DDCF9"; _dict["D83DDCFA"] = "D83DDCFA"; _dict["D83DDCFB"] = "D83DDCFB"; _dict["D83DDCFC"] = "D83DDCFC"; _dict["D83DDD00"] = "D83DDD00"; _dict["D83DDD01"] = "D83DDD01"; _dict["D83DDD02"] = "D83DDD02"; _dict["D83DDD03"] = "D83DDD03"; _dict["D83DDD04"] = "D83DDD04"; _dict["D83DDD05"] = "D83DDD05"; _dict["D83DDD06"] = "D83DDD06"; _dict["D83DDD07"] = "D83DDD07"; _dict["D83DDD08"] = "D83DDD08"; _dict["D83DDD09"] = "D83DDD09"; _dict["D83DDD0A"] = "D83DDD0A"; _dict["D83DDD0B"] = "D83DDD0B"; _dict["D83DDD0C"] = "D83DDD0C"; _dict["D83DDD0D"] = "D83DDD0D"; _dict["D83DDD0E"] = "D83DDD0E"; _dict["D83DDD0F"] = "D83DDD0F"; _dict["D83DDD10"] = "D83DDD10"; _dict["D83DDD11"] = "D83DDD11"; _dict["D83DDD12"] = "D83DDD12"; _dict["D83DDD13"] = "D83DDD13"; _dict["D83DDD14"] = "D83DDD14"; _dict["D83DDD15"] = "D83DDD15"; _dict["D83DDD16"] = "D83DDD16"; _dict["D83DDD17"] = "D83DDD17"; _dict["D83DDD18"] = "D83DDD18"; _dict["D83DDD19"] = "D83DDD19"; _dict["D83DDD1A"] = "D83DDD1A"; _dict["D83DDD1B"] = "D83DDD1B"; _dict["D83DDD1C"] = "D83DDD1C"; _dict["D83DDD1D"] = "D83DDD1D"; _dict["D83DDD1E"] = "D83DDD1E"; _dict["D83DDD1F"] = "D83DDD1F"; _dict["D83DDD20"] = "D83DDD20"; _dict["D83DDD21"] = "D83DDD21"; _dict["D83DDD22"] = "D83DDD22"; _dict["D83DDD23"] = "D83DDD23"; _dict["D83DDD24"] = "D83DDD24"; _dict["D83DDD25"] = "D83DDD25"; _dict["D83DDD26"] = "D83DDD26"; _dict["D83DDD27"] = "D83DDD27"; _dict["D83DDD28"] = "D83DDD28"; _dict["D83DDD29"] = "D83DDD29"; _dict["D83DDD2A"] = "D83DDD2A"; _dict["D83DDD2B"] = "D83DDD2B"; _dict["D83DDD2C"] = "D83DDD2C"; _dict["D83DDD2D"] = "D83DDD2D"; _dict["D83DDD2E"] = "D83DDD2E"; _dict["D83DDD2F"] = "D83DDD2F"; _dict["D83DDD30"] = "D83DDD30"; _dict["D83DDD31"] = "D83DDD31"; _dict["D83DDD32"] = "D83DDD32"; _dict["D83DDD33"] = "D83DDD33"; _dict["D83DDD34"] = "D83DDD34"; _dict["D83DDD35"] = "D83DDD35"; _dict["D83DDD36"] = "D83DDD36"; _dict["D83DDD37"] = "D83DDD37"; _dict["D83DDD38"] = "D83DDD38"; _dict["D83DDD39"] = "D83DDD39"; _dict["D83DDD3A"] = "D83DDD3A"; _dict["D83DDD3B"] = "D83DDD3B"; _dict["D83DDD3C"] = "D83DDD3C"; _dict["D83DDD3D"] = "D83DDD3D"; _dict["D83DDD50"] = "D83DDD50"; _dict["D83DDD51"] = "D83DDD51"; _dict["D83DDD52"] = "D83DDD52"; _dict["D83DDD53"] = "D83DDD53"; _dict["D83DDD54"] = "D83DDD54"; _dict["D83DDD55"] = "D83DDD55"; _dict["D83DDD56"] = "D83DDD56"; _dict["D83DDD57"] = "D83DDD57"; _dict["D83DDD58"] = "D83DDD58"; _dict["D83DDD59"] = "D83DDD59"; _dict["D83DDD5A"] = "D83DDD5A"; _dict["D83DDD5B"] = "D83DDD5B"; _dict["D83DDD5C"] = "D83DDD5C"; _dict["D83DDD5D"] = "D83DDD5D"; _dict["D83DDD5E"] = "D83DDD5E"; _dict["D83DDD5F"] = "D83DDD5F"; _dict["D83DDD60"] = "D83DDD60"; _dict["D83DDD61"] = "D83DDD61"; _dict["D83DDD62"] = "D83DDD62"; _dict["D83DDD63"] = "D83DDD63"; _dict["D83DDD64"] = "D83DDD64"; _dict["D83DDD65"] = "D83DDD65"; _dict["D83DDD66"] = "D83DDD66"; _dict["D83DDD67"] = "D83DDD67"; _dict["D83DDDFB"] = "D83DDDFB"; _dict["D83DDDFC"] = "D83DDDFC"; _dict["D83DDDFD"] = "D83DDDFD"; _dict["D83DDDFE"] = "D83DDDFE"; _dict["D83DDDFF"] = "D83DDDFF"; _dict["D83DDE00"] = "D83DDE00"; _dict["D83DDE01"] = "D83DDE01"; _dict["D83DDE02"] = "D83DDE02"; _dict["D83DDE03"] = "D83DDE03"; _dict["D83DDE04"] = "D83DDE04"; _dict["D83DDE05"] = "D83DDE05"; _dict["D83DDE06"] = "D83DDE06"; _dict["D83DDE07"] = "D83DDE07"; _dict["D83DDE08"] = "D83DDE08"; _dict["D83DDE09"] = "D83DDE09"; _dict["D83DDE0A"] = "D83DDE0A"; _dict["D83DDE0B"] = "D83DDE0B"; _dict["D83DDE0C"] = "D83DDE0C"; _dict["D83DDE0D"] = "D83DDE0D"; _dict["D83DDE0E"] = "D83DDE0E"; _dict["D83DDE0F"] = "D83DDE0F"; _dict["D83DDE10"] = "D83DDE10"; _dict["D83DDE11"] = "D83DDE11"; _dict["D83DDE12"] = "D83DDE12"; _dict["D83DDE13"] = "D83DDE13"; _dict["D83DDE14"] = "D83DDE14"; _dict["D83DDE15"] = "D83DDE15"; _dict["D83DDE16"] = "D83DDE16"; _dict["D83DDE17"] = "D83DDE17"; _dict["D83DDE18"] = "D83DDE18"; _dict["D83DDE19"] = "D83DDE19"; _dict["D83DDE1A"] = "D83DDE1A"; _dict["D83DDE1B"] = "D83DDE1B"; _dict["D83DDE1C"] = "D83DDE1C"; _dict["D83DDE1D"] = "D83DDE1D"; _dict["D83DDE1E"] = "D83DDE1E"; _dict["D83DDE1F"] = "D83DDE1F"; _dict["D83DDE20"] = "D83DDE20"; _dict["D83DDE21"] = "D83DDE21"; _dict["D83DDE22"] = "D83DDE22"; _dict["D83DDE23"] = "D83DDE23"; _dict["D83DDE24"] = "D83DDE24"; _dict["D83DDE25"] = "D83DDE25"; _dict["D83DDE26"] = "D83DDE26"; _dict["D83DDE27"] = "D83DDE27"; _dict["D83DDE28"] = "D83DDE28"; _dict["D83DDE29"] = "D83DDE29"; _dict["D83DDE2A"] = "D83DDE2A"; _dict["D83DDE2B"] = "D83DDE2B"; _dict["D83DDE2C"] = "D83DDE2C"; _dict["D83DDE2D"] = "D83DDE2D"; _dict["D83DDE2E"] = "D83DDE2E"; _dict["D83DDE2F"] = "D83DDE2F"; _dict["D83DDE30"] = "D83DDE30"; _dict["D83DDE31"] = "D83DDE31"; _dict["D83DDE32"] = "D83DDE32"; _dict["D83DDE33"] = "D83DDE33"; _dict["D83DDE34"] = "D83DDE34"; _dict["D83DDE35"] = "D83DDE35"; _dict["D83DDE36"] = "D83DDE36"; _dict["D83DDE37"] = "D83DDE37"; _dict["D83DDE38"] = "D83DDE38"; _dict["D83DDE39"] = "D83DDE39"; _dict["D83DDE3A"] = "D83DDE3A"; _dict["D83DDE3B"] = "D83DDE3B"; _dict["D83DDE3C"] = "D83DDE3C"; _dict["D83DDE3D"] = "D83DDE3D"; _dict["D83DDE3E"] = "D83DDE3E"; _dict["D83DDE3F"] = "D83DDE3F"; _dict["D83DDE40"] = "D83DDE40"; _dict["D83DDE45"] = "D83DDE45"; _dict["D83DDE46"] = "D83DDE46"; _dict["D83DDE47"] = "D83DDE47"; _dict["D83DDE48"] = "D83DDE48"; _dict["D83DDE49"] = "D83DDE49"; _dict["D83DDE4A"] = "D83DDE4A"; _dict["D83DDE4B"] = "D83DDE4B"; _dict["D83DDE4C"] = "D83DDE4C"; _dict["D83DDE4D"] = "D83DDE4D"; _dict["D83DDE4E"] = "D83DDE4E"; _dict["D83DDE4F"] = "D83DDE4F"; _dict["D83DDE80"] = "D83DDE80"; _dict["D83DDE81"] = "D83DDE81"; _dict["D83DDE82"] = "D83DDE82"; _dict["D83DDE83"] = "D83DDE83"; _dict["D83DDE84"] = "D83DDE84"; _dict["D83DDE85"] = "D83DDE85"; _dict["D83DDE86"] = "D83DDE86"; _dict["D83DDE87"] = "D83DDE87"; _dict["D83DDE88"] = "D83DDE88"; _dict["D83DDE89"] = "D83DDE89"; _dict["D83DDE8A"] = "D83DDE8A"; _dict["D83DDE8B"] = "D83DDE8B"; _dict["D83DDE8C"] = "D83DDE8C"; _dict["D83DDE8D"] = "D83DDE8D"; _dict["D83DDE8E"] = "D83DDE8E"; _dict["D83DDE8F"] = "D83DDE8F"; _dict["D83DDE90"] = "D83DDE90"; _dict["D83DDE91"] = "D83DDE91"; _dict["D83DDE92"] = "D83DDE92"; _dict["D83DDE93"] = "D83DDE93"; _dict["D83DDE94"] = "D83DDE94"; _dict["D83DDE95"] = "D83DDE95"; _dict["D83DDE96"] = "D83DDE96"; _dict["D83DDE97"] = "D83DDE97"; _dict["D83DDE98"] = "D83DDE98"; _dict["D83DDE99"] = "D83DDE99"; _dict["D83DDE9A"] = "D83DDE9A"; _dict["D83DDE9B"] = "D83DDE9B"; _dict["D83DDE9C"] = "D83DDE9C"; _dict["D83DDE9D"] = "D83DDE9D"; _dict["D83DDE9E"] = "D83DDE9E"; _dict["D83DDE9F"] = "D83DDE9F"; _dict["D83DDEA0"] = "D83DDEA0"; _dict["D83DDEA1"] = "D83DDEA1"; _dict["D83DDEA2"] = "D83DDEA2"; _dict["D83DDEA3"] = "D83DDEA3"; _dict["D83DDEA4"] = "D83DDEA4"; _dict["D83DDEA5"] = "D83DDEA5"; _dict["D83DDEA6"] = "D83DDEA6"; _dict["D83DDEA7"] = "D83DDEA7"; _dict["D83DDEA8"] = "D83DDEA8"; _dict["D83DDEA9"] = "D83DDEA9"; _dict["D83DDEAA"] = "D83DDEAA"; _dict["D83DDEAB"] = "D83DDEAB"; _dict["D83DDEAC"] = "D83DDEAC"; _dict["D83DDEAD"] = "D83DDEAD"; _dict["D83DDEAE"] = "D83DDEAE"; _dict["D83DDEAF"] = "D83DDEAF"; _dict["D83DDEB0"] = "D83DDEB0"; _dict["D83DDEB1"] = "D83DDEB1"; _dict["D83DDEB2"] = "D83DDEB2"; _dict["D83DDEB3"] = "D83DDEB3"; _dict["D83DDEB4"] = "D83DDEB4"; _dict["D83DDEB5"] = "D83DDEB5"; _dict["D83DDEB6"] = "D83DDEB6"; _dict["D83DDEB7"] = "D83DDEB7"; _dict["D83DDEB8"] = "D83DDEB8"; _dict["D83DDEB9"] = "D83DDEB9"; _dict["D83DDEBA"] = "D83DDEBA"; _dict["D83DDEBB"] = "D83DDEBB"; _dict["D83DDEBC"] = "D83DDEBC"; _dict["D83DDEBD"] = "D83DDEBD"; _dict["D83DDEBE"] = "D83DDEBE"; _dict["D83DDEBF"] = "D83DDEBF"; _dict["D83DDEC0"] = "D83DDEC0"; _dict["D83DDEC1"] = "D83DDEC1"; _dict["D83DDEC2"] = "D83DDEC2"; _dict["D83DDEC3"] = "D83DDEC3"; _dict["D83DDEC4"] = "D83DDEC4"; _dict["D83DDEC5"] = "D83DDEC5"; } } public static class BrowserNavigationService { private static double _fontScaleFactor = 1.0; public static double FontScaleFactor { get { return _fontScaleFactor; } set { _fontScaleFactor = value; } } // http://daringfireball.net/2010/07/improved_regex_for_matching_urls private static readonly Regex RE_URL = new Regex(@"(?i)\b(((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»“”‘’]))|([a-z0-9.\-]+(\.ru|\.com|\.net|\.org|\.us|\.it|\.co\.uk)(?![a-z0-9]))|([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]*[a-zA-Z0-9-]+))"); public static readonly Regex UserMentionRegex = new Regex(@"\[id\d+.*?\|.*?\]"); public static readonly Regex GroupMentionRegex = new Regex(@"\[club\d+.*?\|.*?\]"); public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached( "Text", typeof(string), typeof(BrowserNavigationService), new PropertyMetadata(null, OnTextChanged) ); public static string GetText(DependencyObject d) { return d.GetValue(TextProperty) as string; } public static void SetText(DependencyObject d, string value) { d.SetValue(TextProperty, value); } // Fetch run with PhoneTextNormalStyle public static Run GetRunWithStyle(string text, RichTextBox richTextBox) { var run = new Run(); run.FontFamily = richTextBox.FontFamily; //run.FontSize = richTextBox.FontSize * TextScaleFactor; run.Foreground = richTextBox.Foreground;// (Brush)Application.Current.Resources["PhoneForegroundBrush"]; run.Text = text; return run; } public static event EventHandler ResolveUsername; private static void RaiseTelegramNavigated(TelegramEventArgs e) { var handler = ResolveUsername; if (handler != null) handler(null, e); } public static event EventHandler SearchHashtag; private static void RaiseSearchHashtag(TelegramHashtagEventArgs e) { var handler = SearchHashtag; if (handler != null) handler(null, e); } public static event EventHandler MentionNavigated; private static void RaiseMentionNavigated(TelegramMentionEventArgs e) { var handler = MentionNavigated; if (handler != null) handler(null, e); } public static Hyperlink GetHyperlink(string text, string link, Action action, Brush foreground) { var hyperlink = new Hyperlink(); hyperlink.Inlines.Add(new Run { Text = text, Foreground = foreground }); hyperlink.NavigateUri = new Uri(link, UriKind.RelativeOrAbsolute); hyperlink.Click += (sender, args) => action(hyperlink, link); return hyperlink; } private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var text_block = d as RichTextBox; if (text_block == null) return; text_block.Blocks.Clear(); Paragraph par = new Paragraph(); var new_text = (string)e.NewValue; if (string.IsNullOrEmpty(new_text)) return; //new_text = PreprocessTextForGroupBoardMentions(new_text); var splitData = ParseText(new_text); foreach (var splStr in splitData) { var innerSplit = splStr.Split('\b'); if (innerSplit.Length == 1) { AddRawText(text_block, par, innerSplit[0]); } else if (innerSplit.Length > 1) { var hyp = GetHyperlink( innerSplit[1], innerSplit[0], (h, navstr) => { NavigateOnHyperlink(navstr); }, text_block.Foreground); par.Inlines.Add(hyp); } } //var dateRun = new Run {Text = "1:23 1.07.2014"}; //dateRun. //par.Inlines.Add(dateRun); text_block.Blocks.Add(par); } private static void AddRawText(RichTextBox text_block, Paragraph par, string raw_text) { var textEnumerator = StringInfo.GetTextElementEnumerator(raw_text); bool cont = false; // DebugWriteUnicode(raw_text); StringBuilder sb = new StringBuilder(); // Note: Begins at element -1 (none). cont = textEnumerator.MoveNext(); while (cont) { var text = textEnumerator.GetTextElement(); var bytes = Encoding.BigEndianUnicode.GetBytes(text); var bytesStr = ConvertToHexString(bytes); if (_flagsPrefixes.Contains(bytesStr) && textEnumerator.MoveNext()) { var text2 = textEnumerator.GetTextElement(); var bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); var bytesStr2 = ConvertToHexString(bytes2); bytesStr += bytesStr2; text += text2; } if (Emoji.Dict.ContainsKey(bytesStr)) { var sbStr = sb.ToString(); sb = sb.Clear(); if (sbStr != string.Empty) { par.Inlines.Add(GetRunWithStyle(sbStr, text_block)); } par.Inlines.Add(GetImage(bytesStr)); } else { sb = sb.Append(text); } cont = textEnumerator.MoveNext(); } var sbStrLast = sb.ToString(); if (sbStrLast != string.Empty) { par.Inlines.Add(GetRunWithStyle(sbStrLast, text_block)); } } private static List _flagsPrefixes = new List{"D83CDDE8", "D83CDDE9", "D83CDDEA", "D83CDDEB", "D83CDDEC", "D83CDDEE", "D83CDDEF", "D83CDDF0", "D83CDDF7", "D83CDDFA"}; //public static void DebugWriteUnicode(string input) //{ // var res = ""; // for (var i = 0; i < input.Length; i += char.IsSurrogatePair(input, i) ? 2 : 1) // { // var codepoint = char.ConvertToUtf32(input, i); // res += string.Format("U+{0:X4}", codepoint); // } // Debug.WriteLine(res); //} private static string ConvertToHexString(byte[] bytes) { var sb = new StringBuilder(); for (int i = 0; i < bytes.Length; i++) { sb = sb.Append(Convert.ToString(bytes[i], 16).PadLeft(2, '0')); } return sb.ToString().ToUpperInvariant(); } private static InlineUIContainer GetImage(string name) { var image = new Image(); image.Source = new BitmapImage(new Uri(string.Format("/Assets/Emoji/Separated/{0}.png", name), UriKind.RelativeOrAbsolute)); image.Height = 27 * FontScaleFactor; image.Width = 27 * FontScaleFactor; image.Margin = new Thickness(0, 5, 0, -5); var container = new InlineUIContainer(); container.Child = image; return container; } private static void NavigateOnHyperlink(string navstr) { if (string.IsNullOrEmpty(navstr)) return; if (navstr.StartsWith("tlg://?action=mention")) { var mentionIndex = navstr.IndexOf('@'); if (mentionIndex != -1) { var mention = navstr.Substring(mentionIndex); RaiseMentionNavigated(new TelegramMentionEventArgs { Mention = mention }); } } else if (navstr.StartsWith("tlg://?action=search")) { var hashtagIndex = navstr.IndexOf('#'); if (hashtagIndex != -1) { var hashtag = navstr.Substring(hashtagIndex); RaiseSearchHashtag(new TelegramHashtagEventArgs{ Hashtag = hashtag }); } } else if (!navstr.Contains("@")) { if (navstr.ToLowerInvariant().Contains("telegram.me")) { RaiseTelegramNavigated(new TelegramEventArgs{Uri = navstr}); } else { var task = new WebBrowserTask(); task.URL = navstr; task.Show(); } } else { EmailComposeTask emailComposeTask = new EmailComposeTask(); if (navstr.StartsWith("http://")) { navstr = navstr.Remove(0, 7); } emailComposeTask.To = navstr; emailComposeTask.Show(); } } public static string PreprocessTextForGroupBoardMentions(string s) { s = Regex.Replace(s, @"\[(id|club)(\d+):bp\-(\d+)_(\d+)\|([^\]]+)\]", "[$1$2|$5]"); return s; } private static bool IsValidUsernameSymbol(char symbol) { if ((symbol >= 'a' && symbol <= 'z') || (symbol >= 'A' && symbol <= 'Z') || (symbol >= '0' && symbol <= '9') || symbol == '_') { return true; } return false; } private static bool IsValidUsername(string username) { if (username.Length <= 5) { return false; } if (username.Length > 32) { return false; } if (username[0] != '@') { return false; } for (var i = 1; i < username.Length; i++) { if (!IsValidUsernameSymbol(username[i])) { return false; } } return true; } public static List ParseText(string html) { html = html.Replace("\n", " \n "); var rx = new Regex("(https?:\\/\\/)?(([A-Za-zА-Яа-яЁё0-9@][A-Za-zА-Яа-яЁё0-9@\\-_\\.]*[A-Za-zА-Яа-яЁё0-9@])(\\/([A-Za-zА-Яа-я0-9@\\-_#%&?+\\/\\.=;:~]*[^\\.\\,;\\(\\)\\?<\\&\\s:])?)?)", RegexOptions.IgnoreCase); html = rx.Replace(html, delegate(Match m) { var full = m.Value; if (full.IndexOf('@') == 0 && IsValidUsername(full)) return string.Format("\atlg://?action=mention&q={0}\b{1}\a", full, full); var protocol = (m.Groups.Count > 1) ? m.Groups[1].Value : "http://"; if (protocol == string.Empty) protocol = "http://"; var url = (m.Groups.Count > 2) ? m.Groups[2].Value : string.Empty; var domain = (m.Groups.Count > 3) ? m.Groups[3].Value : string.Empty; if (domain.IndexOf(".") == -1 || domain.IndexOf("..") != -1) return full; var topDomain = domain.Split('.').LastOrDefault(); if (topDomain.Length > 5 || !("guru,info,name,aero,arpa,coop,museum,mobi,travel,xxx,asia,biz,com,net,org,gov,mil,edu,int,tel,ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,az,ba,bb,bd,be,bf,bg,bh,bi,bj,bm,bn,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,ck,cl,cm,cn,co,cr,cu,cv,cx,cy,cz,de,dj,dk,dm,do,dz,ec,ee,eg,eh,er,es,et,eu,fi,fj,fk,fm,fo,fr,ga,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gu,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,il,im,in,io,iq,ir,is,it,je,jm,jo,jp,ke,kg,kh,ki,km,kn,kp,kr,kw,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mm,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,mz,na,nc,ne,nf,ng,ni,nl,no,np,nr,nu,nz,om,pa,pe,pf,pg,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,um,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,ye,yt,yu,za,zm,zw,рф,cat,pro" .Split(',').Contains(topDomain))) return full; if (full.IndexOf('@') != -1) return "\amailto:" + full + "\b" + full + "\a"; full = HttpUtility.UrlDecode(full); if (full.Length > 55) full = full.Substring(0, 53) + ".."; return string.Format("\a{0}\b{1}\a", (protocol + url), full); }).ReplaceByRegex("(^|\\s)#[\\w@\\.]+", " \atlg://?action=search&q=$0\b$0\a"); ; html = html.Replace("\n ", "\n").Replace(" \n", "\n"); if (html.StartsWith(" ")) html = html.Remove(0, 1); var blocks = html.Split('\a'); return blocks.ToList(); } } public static class StringExtensions { public static string ReplaceByRegex(this string str, string regexStr, string replace) { var regex = new Regex(regexStr); var result = regex.Replace(str, replace); return result; } } public class TelegramEventArgs : EventArgs { public string Uri { get; set; } } public class TelegramHashtagEventArgs : EventArgs { public string Hashtag { get; set; } } public class TelegramMentionEventArgs : EventArgs { public string Mention { get; set; } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Emoji/EmojiControl.xaml ================================================  ================================================ FILE: Telegram.EmojiPanel/Controls/Emoji/EmojiControl.xaml.cs ================================================ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Net; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using Microsoft.Phone.Info; using Microsoft.Phone.Shell; using Telegram.Controls.VirtualizedView; using Telegram.EmojiPanel.Controls.Utilites; using GestureEventArgs = System.Windows.Input.GestureEventArgs; namespace Telegram.EmojiPanel.Controls.Emoji { public class IsOpenedEventArgs : EventArgs { public bool IsOpened { get; set; } } public partial class EmojiControl { private List _category1Sprites; private List _category2Sprites; private List _category3Sprites; private List _category4Sprites; private List _category5Sprites; public event EventHandler IsOpenedChanged; private void RaiseIsOpenedChanged(bool isOpened) { var eventHandler = IsOpenedChanged; if (eventHandler != null) { eventHandler(this, new IsOpenedEventArgs { IsOpened = isOpened }); } } public TextBox TextBoxTarget { get; set; } private const int AlbumOrientationHeight = 328; public const int PortraitOrientationHeight100 = 408; public const int PortraitOrientationHeight112 = 408; public const int PortraitOrientationHeight112Software = 400; public const int PortraitOrientationHeight150 = 408; public const int PortraitOrientationHeight150Software = 400; public const int PortraitOrientationHeight160 = 408; public const int PortraitOrientationHeight225 = 332; public static int PortraitOrientationHeight { get { #if WP8 var appBar = new ApplicationBar(); switch (Application.Current.Host.Content.ScaleFactor) { case 100: //Lumia 820 WVGA 480x800 return PortraitOrientationHeight100; break; case 112: //Lumia 535 qHD 540x960 // Software buttons //Lumia 535 if (appBar.DefaultSize == 67.0) { return PortraitOrientationHeight112Software; } return PortraitOrientationHeight112; break; case 150: //HTC 8X, 730, 830 720p 720x1280 //Software buttons //Lumia 730 if (appBar.DefaultSize == 67.0) { return PortraitOrientationHeight150Software; } return PortraitOrientationHeight150; break; case 160: //Lumia 925, 1020 WXGA 768x1280 return PortraitOrientationHeight160; break; case 225: // Lumia 1520, 930 1020p 1080x1920 var deviceName = DeviceStatus.DeviceName; if (!string.IsNullOrEmpty(deviceName)) { deviceName = deviceName.Replace("-", string.Empty).ToLowerInvariant(); //Lumia 1520 6 inch 1020p if (deviceName.StartsWith("rm937") || deviceName.StartsWith("rm938") || deviceName.StartsWith("rm939") || deviceName.StartsWith("rm940")) { return PortraitOrientationHeight225; } } //Lumia 930 other 1020p return PortraitOrientationHeight100; break; } #endif return PortraitOrientationHeight100; } } private bool _isOpen; private bool _isPortrait = true; private bool _isTextBoxTargetFocused; private bool _isBlocked; // Block IsOpen during animation private int _currentCategory; private bool _wasRendered; private readonly TranslateTransform _frameTransform; private static EmojiControl _instance; public static EmojiControl GetInstance() { return _instance ?? (_instance = new EmojiControl()); } public static readonly DependencyProperty RootFrameTransformProperty = DependencyProperty.Register( "RootFrameTransform", typeof(double), typeof(EmojiControl), new PropertyMetadata(OnRootFrameTransformChanged)); public EmojiControl() { InitializeComponent(); //var frame = (Frame)Application.Current.RootVisual; //_frameTransform = ((TranslateTransform)((TransformGroup)frame.RenderTransform).Children[0]); //var binding = new Binding("Y") //{ // Source = _frameTransform //}; //SetBinding(RootFrameTransformProperty, binding); VirtPanel.InitializeWithScrollViewer(CSV); VirtPanel.ScrollPositionChanged += VirtPanelOnScrollPositionChanged; //SizeChanged += OnSizeChanged; OnSizeChanged(null, null); LoadButtons(); CurrentCategory = 0; } public void BindTextBox(TextBox textBox) { TextBoxTarget = textBox; textBox.GotFocus += TextBoxOnGotFocus; textBox.LostFocus += TextBoxOnLostFocus; } public void UnbindTextBox() { TextBoxTarget.GotFocus -= TextBoxOnGotFocus; TextBoxTarget.LostFocus -= TextBoxOnLostFocus; TextBoxTarget = null; } public bool IsOpen { get { return !_isTextBoxTargetFocused && _isOpen; } set { // Dont hide EmojiControl when keyboard is shown (or to be shown) if (!_isTextBoxTargetFocused && _isOpen == value || _isBlocked) return; if (value) { Open(); } else { Hide(); } RaiseIsOpenedChanged(value); } } private void Open() { _isOpen = true; TextBoxTarget.Dispatcher.BeginInvoke(() => VisualStateManager.GoToState(TextBoxTarget, "Focused", false)); //var frame = (PhoneApplicationFrame)Application.Current.RootVisual; EmojiContainer.Visibility = Visibility.Visible; Deployment.Current.Dispatcher.BeginInvoke(() => LoadCategory(0)); //frame.BackKeyPress += OnBackKeyPress; //if (!(EmojiContainer.RenderTransform is TranslateTransform)) // EmojiContainer.RenderTransform = new TranslateTransform(); //var transform = (TranslateTransform)EmojiContainer.RenderTransform; var offset = _isPortrait ? PortraitOrientationHeight : AlbumOrientationHeight; EmojiContainer.Height = offset; //var from = 0; //if (_frameTransform.Y < 0) // Keyboard is in view //{ // from = (int)_frameTransform.Y; // //_frameTransform.Y = -offset; // //transform.Y = offset;// -72; //} //transform.Y = offset;// -72 //if (from == offset) return; //frame.IsHitTestVisible = false; //_isBlocked = true; //var storyboard = new Storyboard(); //var doubleTransformFrame = new DoubleAnimation //{ // From = from, // To = -offset, // Duration = TimeSpan.FromMilliseconds(440), // EasingFunction = new ExponentialEase // { // EasingMode = EasingMode.EaseOut, // Exponent = 6 // } //}; //storyboard.Children.Add(doubleTransformFrame); //Storyboard.SetTarget(doubleTransformFrame, _frameTransform); //Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); //EmojiContainer.Dispatcher.BeginInvoke(async () => //{ // storyboard.Begin(); // if (_frameTransform.Y < 0) // Keyboard is in view // { // Focus(); // TextBoxTarget.Dispatcher.BeginInvoke(() // no effect without dispatcher // => VisualStateManager.GoToState(TextBoxTarget, "Focused", false)); // } // if (_wasRendered) return; // await Task.Delay(50); // LoadCategory(0); //}); //storyboard.Completed += (sender, args) => //{ // frame.IsHitTestVisible = true; // _isBlocked = false; //}; } private void Hide() { _isOpen = false; VisualStateManager.GoToState(TextBoxTarget, "Unfocused", false); EmojiContainer.Visibility = Visibility.Collapsed; //var frame = (PhoneApplicationFrame)Application.Current.RootVisual; //frame.BackKeyPress -= OnBackKeyPress; //if (_isTextBoxTargetFocused) //{ // _frameTransform.Y = 0; // EmojiContainer.Visibility = Visibility.Collapsed; // return; //} //VisualStateManager.GoToState(TextBoxTarget, "Unfocused", false); //frame.IsHitTestVisible = false; //_isBlocked = true; //var transform = (TranslateTransform)EmojiContainer.RenderTransform; //var storyboard = new Storyboard(); //var doubleTransformFrame = new DoubleAnimation //{ // From = -transform.Y, // To = 0, // Duration = TimeSpan.FromMilliseconds(440), // EasingFunction = new ExponentialEase // { // EasingMode = EasingMode.EaseOut, // Exponent = 6 // } //}; //storyboard.Children.Add(doubleTransformFrame); //Storyboard.SetTarget(doubleTransformFrame, _frameTransform); //Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); //storyboard.Begin(); //storyboard.Completed += (sender, args) => //{ // EmojiContainer.Visibility = Visibility.Collapsed; // frame.IsHitTestVisible = true; // _isBlocked = false; // transform.Y = 0; //}; } #region _isTextBoxTargetFocused listeners private void TextBoxOnGotFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = true; } private void TextBoxOnLostFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = false; } #endregion /// /// Hide instance on pressing hardware Back button. Fires only when instance is opened. /// private void OnBackKeyPress(object sender, CancelEventArgs cancelEventArgs) { IsOpen = false; cancelEventArgs.Cancel = true; } /// /// Clear current highlight on scroll /// private static void VirtPanelOnScrollPositionChanged(object sender, MyVirtualizingPanel.ScrollPositionChangedEventAgrs scrollPositionChangedEventAgrs) { EmojiSpriteItem.ClearCurrentHighlight(); } /// /// Changes tabs in UI and _currentCategory property /// public int CurrentCategory { get { return _currentCategory; } set { var previousCategory = GetCategoryButtonByIndex(_currentCategory); var nextCategory = GetCategoryButtonByIndex(value); if (previousCategory != null) previousCategory.Background = ButtonBackground; nextCategory.Background = (Brush)Application.Current.Resources["PhoneAccentBrush"]; _currentCategory = value; } } public void LoadCategory(int index) { VirtPanel.ClearItems(); if (_currentCategory == RecentsCategoryIndex) UnloadRecents(); if (index == RecentsCategoryIndex) { LoadRecents(); return; } List sprites = null; switch (index) { case 0: sprites = _category1Sprites; break; case 1: sprites = _category2Sprites; break; case 2: sprites = _category3Sprites; break; case 3: sprites = _category4Sprites; break; case 4: sprites = _category5Sprites; break; } if (sprites == null) { sprites = new List(); for (var i = 0; i < EmojiData.SpritesByCategory[index].Length; i++) { //var item = new EmojiSpriteItem(index, i); var item = new EmojiSpriteItem(EmojiData.SpritesByCategory[index][i], index, i); item.EmojiSelected += OnEmojiSelected; sprites.Add(item); } switch (index) { case 0: _category1Sprites = sprites; break; case 1: _category2Sprites = sprites; break; case 2: _category3Sprites = sprites; break; case 3: _category4Sprites = sprites; break; case 4: _category5Sprites = sprites; break; } } CurrentCategory = index; VirtPanel.AddItems(new List { sprites[0] }); CreateButtonsBackgrounds(index); if (!_wasRendered) { // Display LoadingProgressBar only once LoadingProgressBar.Visibility = Visibility.Collapsed; _wasRendered = true; } // Delayed rendering of the rest parts - speeds up initial load ThreadPool.QueueUserWorkItem(state => { Thread.Sleep(100); Deployment.Current.Dispatcher.BeginInvoke(() => { if (_currentCategory != index) return; var listList = sprites.ToList(); listList.RemoveAt(0); VirtPanel.AddItems(listList); }); }); } public static void OnRootFrameTransformChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { ((EmojiControl)source).OnRootFrameTransformChanged(); } public void OnRootFrameTransformChanged() { if (!_isOpen) return; var offset = _isPortrait ? -PortraitOrientationHeight : -AlbumOrientationHeight; _frameTransform.Y = offset; } #region Recents public static readonly DependencyProperty RecentItemsProperty = DependencyProperty.Register( "RecentItems", typeof (IList), typeof (EmojiControl), new PropertyMetadata(default(IList))); public IList RecentItems { get { return (IList) GetValue(RecentItemsProperty); } set { SetValue(RecentItemsProperty, value); } } public void LoadRecents() { CurrentCategory = RecentsCategoryIndex; if (EmojiData.Recents == null) { EmojiData.LoadRecents(); } RecentItems = new ObservableCollection(EmojiData.Recents ?? new List()); CSV.IsHitTestVisible = false; Recents.Visibility = Visibility.Visible; } public void UnloadRecents() { CSV.IsHitTestVisible = true; Recents.Visibility = Visibility.Collapsed; } #endregion Recents private void OnEmojiSelected(object sender, EmojiSelectedEventArgs args) { TextBoxTarget.Dispatcher.BeginInvoke(() => { var selectionStart = TextBoxTarget.SelectionStart; TextBoxTarget.Text = TextBoxTarget.Text.Insert(selectionStart, args.DataItem.String); TextBoxTarget.Select(selectionStart + args.DataItem.String.Length, 0); }); if (_currentCategory == RecentsCategoryIndex) return; var that = args.DataItem; ThreadPool.QueueUserWorkItem(state => EmojiData.AddToRecents(that)); } /// /// Emoji control backspace button logic /// private void BackspaceButtonOnClick(object sender, RoutedEventArgs routedEventArgs) { var text = TextBoxTarget.Text; var selectionStart = TextBoxTarget.SelectionStart; if (text.Length <= 0) return; if (selectionStart == 0) return; int toSubstring; if (text.Length > 1) { var prevSymbol = text[selectionStart - 2]; var prevBytes = BitConverter.GetBytes(prevSymbol); var curSymbol = text[selectionStart - 1]; var curBytes = BitConverter.GetBytes(curSymbol); if (prevBytes[1] == 0xD8 && (prevBytes[0] == 0x3D || prevBytes[0] == 0x3C)) toSubstring = 2; else if (curBytes[1] == 0x20 && curBytes[0] == 0xE3) toSubstring = 2; else toSubstring = 1; } else { toSubstring = 1; } TextBoxTarget.Text = text.Remove(selectionStart - toSubstring, toSubstring); TextBoxTarget.SelectionStart = selectionStart - toSubstring; } #region User Interface private readonly Button _abcButton = new Button { ClickMode = ClickMode.Release }; private readonly Button _recentsButton = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat0Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat1Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat2Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat3Button = new Button { ClickMode = ClickMode.Press }; private readonly Button _cat4Button = new Button { ClickMode = ClickMode.Press }; private readonly RepeatButton _backspaceButton = new RepeatButton { ClickMode = ClickMode.Release, Interval = 100 }; public const int RecentsCategoryIndex = 5; private Button GetCategoryButtonByIndex(int index) { switch (index) { case 0: return _cat0Button; case 1: return _cat1Button; case 2: return _cat2Button; case 3: return _cat3Button; case 4: return _cat4Button; case RecentsCategoryIndex: return _recentsButton; default: return null; } } public Brush ButtonBackground { get { var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; return isLightTheme ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Color.FromArgb(255, 71, 71, 71)); } } public void LoadButtons() { var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; var buttonStyleResourceKey = isLightTheme ? "CategoryButtonLightThemeStyle" : "CategoryButtonDarkThemeStyle"; var buttonStyle = (Style)Resources[buttonStyleResourceKey]; _abcButton.Style = buttonStyle; _recentsButton.Style = buttonStyle; _cat0Button.Style = buttonStyle; _cat1Button.Style = buttonStyle; _cat2Button.Style = buttonStyle; _cat3Button.Style = buttonStyle; _cat4Button.Style = buttonStyle; var repeatButtonStyleResourceKey = isLightTheme ? "RepeatButtonLightThemeStyle" : "RepeatButtonDarkThemeStyle"; _backspaceButton.Style = (Style)Resources[repeatButtonStyleResourceKey]; var prefix = isLightTheme ? "light." : string.Empty; _abcButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.abc")), Width = 34, Height = 32 }; _recentsButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.recent")), Width = 34, Height = 32 }; _cat0Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.category.1")), Width = 34, Height = 32 }; _cat1Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.category.2")), Width = 34, Height = 32 }; _cat2Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.category.3")), Width = 34, Height = 32 }; _cat3Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.category.4")), Width = 34, Height = 32 }; _cat4Button.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.category.5")), Width = 34, Height = 32 }; _backspaceButton.Content = new Image { Source = new BitmapImage(Helpers.GetAssetUri(prefix + "emoji.backspace")), Width = 34, Height = 32 }; Grid.SetColumn(_abcButton, 0); Grid.SetColumn(_recentsButton, 1); Grid.SetColumn(_cat0Button, 2); Grid.SetColumn(_cat1Button, 3); Grid.SetColumn(_cat2Button, 4); Grid.SetColumn(_cat3Button, 5); Grid.SetColumn(_cat4Button, 6); Grid.SetColumn(_backspaceButton, 7); ButtonsGrid.Children.Add(_abcButton); ButtonsGrid.Children.Add(_recentsButton); ButtonsGrid.Children.Add(_cat0Button); ButtonsGrid.Children.Add(_cat1Button); ButtonsGrid.Children.Add(_cat2Button); ButtonsGrid.Children.Add(_cat3Button); ButtonsGrid.Children.Add(_cat4Button); ButtonsGrid.Children.Add(_backspaceButton); _abcButton.Click += AbcButtonOnClick; _cat0Button.Click += CategoryButtonClick; _cat1Button.Click += CategoryButtonClick; _cat2Button.Click += CategoryButtonClick; _cat3Button.Click += CategoryButtonClick; _cat4Button.Click += CategoryButtonClick; _recentsButton.Click += CategoryButtonClick; _backspaceButton.Click += BackspaceButtonOnClick; } private void AbcButtonOnClick(object sender, RoutedEventArgs routedEventArgs) { TextBoxTarget.Focus(); } private void CategoryButtonClick(object sender, RoutedEventArgs routedEventArgs) { if (sender == _cat0Button) LoadCategory(0); else if (sender == _cat1Button) LoadCategory(1); else if (sender == _cat2Button) LoadCategory(2); else if (sender == _cat3Button) LoadCategory(3); else if (sender == _cat4Button) LoadCategory(4); else if (sender == _recentsButton) LoadCategory(RecentsCategoryIndex); } private void CreateButtonsBackgrounds(int categoryIndex) { var sprites = EmojiData.SpriteRowsCountByCategory[categoryIndex]; var buttonBackgroundColor = ButtonBackground; for (var i = 0; i < sprites.Length; i++) { var rowsCount = sprites[i]; var block = new Rectangle { Width = EmojiSpriteItem.SpriteWidth, Height = EmojiSpriteItem.RowHeight * rowsCount, Fill = buttonBackgroundColor, Margin = new Thickness(4, 0, 4, 0) }; Canvas.SetTop(block, (EmojiSpriteItem.SpriteHeight) * i); VirtPanel.Children.Insert(0, block); } } private void InitializeOrientation(Orientation orientation) { switch (orientation) { case Orientation.Vertical: ButtonsGrid.Height = 78; ButtonsGrid.Margin = new Thickness(0, 6, 0, 0); EmojiContainer.Height = PortraitOrientationHeight; //_frameTransform.Y = -PortraitOrientationHeight; break; case Orientation.Horizontal: ButtonsGrid.Height = 58; ButtonsGrid.Margin = new Thickness(0, 6, 0, 3); EmojiContainer.Height = AlbumOrientationHeight; //_frameTransform.Y = -AlbumOrientationHeight; break; } } #endregion User Interface /// /// Orientation change handler /// private void OnSizeChanged(object sender, SizeChangedEventArgs sizeChangedEventArgs) { var currentOrientation = ((PhoneApplicationFrame)Application.Current.RootVisual).Orientation; var isPortrait = currentOrientation == PageOrientation.PortraitUp || currentOrientation == PageOrientation.PortraitDown || currentOrientation == PageOrientation.Portrait; if (_isPortrait == isPortrait && _wasRendered) return; _isPortrait = isPortrait; InitializeOrientation(isPortrait ? Orientation.Vertical : Orientation.Horizontal); } private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ((Border)sender).Background = (Brush)Application.Current.Resources["PhoneAccentBrush"]; } private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ((Border) sender).Background = ButtonBackground; } private void UIElement_OnMouseLeave(object sender, MouseEventArgs e) { ((Border) sender).Background = ButtonBackground; } private void EmojiButton_OnTap(object sender, GestureEventArgs e) { var button = (FrameworkElement)sender; var emojiItem = (EmojiDataItem)button.DataContext; OnEmojiSelected(sender, new EmojiSelectedEventArgs{DataItem = emojiItem}); ////RaiseEmojiAdded(new EmojiAddedEventArgs { Emoji = emojiItem.String }); //if (_currentCategory != RecentsCategoryIndex) //{ // var prevItem = RecentItems.FirstOrDefault(x => x.Code == emojiItem.Code); // if (prevItem != null) // { // RecentItems.Remove(prevItem); // RecentItems.Insert(0, prevItem); // } // else // { // RecentItems.Insert(0, emojiItem); // RecentItems = RecentItems.Take(30).ToList(); // } //} } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Emoji/EmojiData.cs ================================================ using System; using System.Collections.Generic; using System.IO; using System.IO.IsolatedStorage; using System.Linq; namespace Telegram.EmojiPanel.Controls.Emoji { public class EmojiDataItem { public EmojiDataItem() { } public EmojiDataItem(string string2, ulong code) { String = string2; Code = code; } public string String { get; set; } public ulong Code { get; set; } public Uri Uri { get; set; } public static string BuildString(ulong code) { var bytes = BitConverter.GetBytes(code); var char1 = BitConverter.ToChar(bytes, 6); var char2 = BitConverter.ToChar(bytes, 4); var char3 = BitConverter.ToChar(bytes, 2); var char4 = BitConverter.ToChar(bytes, 0); string text; if (char1 != 0) { text = new string(new [] { char1, char2, char3, char4 }); } else if (char3 != 0) { text = new string(new [] { char3, char4 }); } else { text = char4.ToString(); } return text; } public static Uri BuildUri(string string2) { //var string3 = BitConverter.ToString(bytes.Take(4).Reverse().ToArray()) var string3 = string.Format("{0:X}", (Int16) string2[0]); switch (string2.Length) { case 2: { uint emoji = 0; emoji |= (uint) string2[0] << 16; emoji |= (uint) string2[1]; return new Uri(string.Format("/Assets/Emoji/Separated/{0:X8}.png", emoji), UriKind.Relative); } case 4: { uint emoji1 = 0; emoji1 |= (uint) string2[0] << 16; emoji1 |= (uint) string2[1]; ulong emoji2 = 0; emoji2 |= (uint) string2[2] << 16; emoji2 |= (uint) string2[3]; return new Uri(string.Format("/Assets/Emoji/Separated/{0:X}{1:X}.png", emoji1, emoji2), UriKind.Relative); } default: return new Uri(string.Format("/Assets/Emoji/Separated/{0:X}.png", (Int16) string2[0]), UriKind.Relative); } } public static EmojiDataItem GetByIndex(int categoryIndex, int spriteIndex, int itemIndex) { var category = EmojiData.CodesByCategory[categoryIndex]; var emojiIndex = spriteIndex * EmojiData.ItemsInSprite + itemIndex; if (category.Length <= emojiIndex) return null; // out of bounds ulong code = category[emojiIndex]; var result = new EmojiDataItem { Code = code, String = BuildString(code) }; result.Uri = BuildUri(result.String); return result; } } public static class EmojiData { public static List Recents; public static void AddToRecents(EmojiDataItem emojiDataItem) { if (Recents == null) { LoadRecents(); if (Recents == null) { Recents = new List(); } } var prevItem = Recents.FirstOrDefault(x => x.Code == emojiDataItem.Code); if (prevItem != null) { Recents.Remove(prevItem); Recents.Insert(0, prevItem); } else { Recents.Insert(0, emojiDataItem); Recents = Recents.Take(42).ToList(); } SaveRecents(); } public static void LoadRecents() { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists("EmojiRecents")) return; using (var stream = new IsolatedStorageFileStream("EmojiRecents", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite, store)) { if (stream.Length <= 0) return; using (var br = new BinaryReader(stream)) { var count = br.ReadInt32(); Recents = new List(); for (var i = 0; i < count; i++) { var emoji = new EmojiDataItem(br.ReadString(), br.ReadUInt64()); emoji.Uri = EmojiDataItem.BuildUri(emoji.String); Recents.Add(emoji); } } } } } public static IList LoadDefaultRecents() { return new List { new EmojiDataItem{Code = 1, String = "😂"}, new EmojiDataItem{Code = 1, String = "😘"}, new EmojiDataItem{Code = 1, String = "❤"}, new EmojiDataItem{Code = 1, String = "😍"}, new EmojiDataItem{Code = 1, String = "😊"}, new EmojiDataItem{Code = 1, String = "😁"}, new EmojiDataItem{Code = 1, String = "👍"}, new EmojiDataItem{Code = 1, String = "☺"}, new EmojiDataItem{Code = 1, String = "😔"}, //new EmojiDataItem{Code = 1, String = "😂 😘 ❤ 😍 😊 😁 👍 ☺ 😔 😄 😭 💋 😒 😳 😜 🙈 😉 😃 😢 😝 😱 😡 😏 😞 😅 😚 🙊 😌 😀 😋 😆 👌 😐 😕"}, }; } public static void SaveRecents() { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = new IsolatedStorageFileStream("EmojiRecents", FileMode.Create, FileAccess.Write, FileShare.ReadWrite, store)) { using (var bw = new BinaryWriter(stream)) { var emojies = Recents.ToList(); bw.Write(emojies.Count); foreach (var item in emojies) { bw.Write(item.String); bw.Write(item.Code); } } } } } public const int ItemsInRow = 6; public const int ItemsInSprite = 36; /// /// Custom spaced sprites by category /// public static Uri[][] SpritesByCategory = { new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat0_part5.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat1_part3.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part5.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat2_part6.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat3_part2.png", UriKind.Relative), }, new[] { new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part0.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part1.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part2.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part3.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part4.png", UriKind.Relative), new Uri("/Assets/Emoji/SpacedSprites/sprite64_cat4_part5.png", UriKind.Relative), }, }; /// /// Config of rows count for sprites in categories /// public static int[][] SpriteRowsCountByCategory = { new [] { 6, 6, 6, 6, 6, 2 }, new [] { 6, 6, 6, 2 }, new [] { 6, 6, 6, 6, 6, 6, 3 }, new [] { 6, 6, 5 }, new [] { 6, 6, 6, 6, 6, 5 } }; /// /// Config of missing cells in last row for each last category's sprite /// public static int[] SpriteMissingCellsByCategory = { 3, 4, 4, 1, 1 }; /// /// Emoji codes combined into the groups corresponding to the categories in the interface /// public static ulong[][] CodesByCategory = { new ulong[]{ 0x00000000D83DDE04L, 0x00000000D83DDE03L, 0x00000000D83DDE00L, 0x00000000D83DDE0AL, 0x000000000000263AL, 0x00000000D83DDE09L, 0x00000000D83DDE0DL, 0x00000000D83DDE18L, 0x00000000D83DDE1AL, 0x00000000D83DDE17L, 0x00000000D83DDE19L, 0x00000000D83DDE1CL, 0x00000000D83DDE1DL, 0x00000000D83DDE1BL, 0x00000000D83DDE33L, 0x00000000D83DDE01L, 0x00000000D83DDE14L, 0x00000000D83DDE0CL, 0x00000000D83DDE12L, 0x00000000D83DDE1EL, 0x00000000D83DDE23L, 0x00000000D83DDE22L, 0x00000000D83DDE02L, 0x00000000D83DDE2DL, 0x00000000D83DDE2AL, 0x00000000D83DDE25L, 0x00000000D83DDE30L, 0x00000000D83DDE05L, 0x00000000D83DDE13L, 0x00000000D83DDE29L, 0x00000000D83DDE2BL, 0x00000000D83DDE28L, 0x00000000D83DDE31L, 0x00000000D83DDE20L, 0x00000000D83DDE21L, 0x00000000D83DDE24L, 0x00000000D83DDE16L, 0x00000000D83DDE06L, 0x00000000D83DDE0BL, 0x00000000D83DDE37L, 0x00000000D83DDE0EL, 0x00000000D83DDE34L, 0x00000000D83DDE35L, 0x00000000D83DDE32L, 0x00000000D83DDE1FL, 0x00000000D83DDE26L, 0x00000000D83DDE27L, 0x00000000D83DDE08L, 0x00000000D83DDC7FL, 0x00000000D83DDE2EL, 0x00000000D83DDE2CL, 0x00000000D83DDE10L, 0x00000000D83DDE15L, 0x00000000D83DDE2FL, 0x00000000D83DDE36L, 0x00000000D83DDE07L, 0x00000000D83DDE0FL, 0x00000000D83DDE11L, 0x00000000D83DDC72L, 0x00000000D83DDC73L, 0x00000000D83DDC6EL, 0x00000000D83DDC77L, 0x00000000D83DDC82L, 0x00000000D83DDC76L, 0x00000000D83DDC66L, 0x00000000D83DDC67L, 0x00000000D83DDC68L, 0x00000000D83DDC69L, 0x00000000D83DDC74L, 0x00000000D83DDC75L, 0x00000000D83DDC71L, 0x00000000D83DDC7CL, 0x00000000D83DDC78L, 0x00000000D83DDE3AL, 0x00000000D83DDE38L, 0x00000000D83DDE3BL, 0x00000000D83DDE3DL, 0x00000000D83DDE3CL, 0x00000000D83DDE40L, 0x00000000D83DDE3FL, 0x00000000D83DDE39L, 0x00000000D83DDE3EL, 0x00000000D83DDC79L, 0x00000000D83DDC7AL, 0x00000000D83DDE48L, 0x00000000D83DDE49L, 0x00000000D83DDE4AL, 0x00000000D83DDC80L, 0x00000000D83DDC7DL, 0x00000000D83DDCA9L, 0x00000000D83DDD25L, 0x0000000000002728L, 0x00000000D83CDF1FL, 0x00000000D83DDCABL, 0x00000000D83DDCA5L, 0x00000000D83DDCA2L, 0x00000000D83DDCA6L, 0x00000000D83DDCA7L, 0x00000000D83DDCA4L, 0x00000000D83DDCA8L, 0x00000000D83DDC42L, 0x00000000D83DDC40L, 0x00000000D83DDC43L, 0x00000000D83DDC45L, 0x00000000D83DDC44L, 0x00000000D83DDC4DL, 0x00000000D83DDC4EL, 0x00000000D83DDC4CL, 0x00000000D83DDC4AL, 0x000000000000270AL, 0x000000000000270CL, 0x00000000D83DDC4BL, 0x000000000000270BL, 0x00000000D83DDC50L, 0x00000000D83DDC46L, 0x00000000D83DDC47L, 0x00000000D83DDC49L, 0x00000000D83DDC48L, 0x00000000D83DDE4CL, 0x00000000D83DDE4FL, 0x000000000000261DL, 0x00000000D83DDC4FL, 0x00000000D83DDCAAL, 0x00000000D83DDEB6L, 0x00000000D83CDFC3L, 0x00000000D83DDC83L, 0x00000000D83DDC6BL, 0x00000000D83DDC6AL, 0x00000000D83DDC6CL, 0x00000000D83DDC6DL, 0x00000000D83DDC8FL, 0x00000000D83DDC91L, 0x00000000D83DDC6FL, 0x00000000D83DDE46L, 0x00000000D83DDE45L, 0x00000000D83DDC81L, 0x00000000D83DDE4BL, 0x00000000D83DDC86L, 0x00000000D83DDC87L, 0x00000000D83DDC85L, 0x00000000D83DDC70L, 0x00000000D83DDE4EL, 0x00000000D83DDE4DL, 0x00000000D83DDE47L, 0x00000000D83CDFA9L, 0x00000000D83DDC51L, 0x00000000D83DDC52L, 0x00000000D83DDC5FL, 0x00000000D83DDC5EL, 0x00000000D83DDC61L, 0x00000000D83DDC60L, 0x00000000D83DDC62L, 0x00000000D83DDC55L, 0x00000000D83DDC54L, 0x00000000D83DDC5AL, 0x00000000D83DDC57L, 0x00000000D83CDFBDL, 0x00000000D83DDC56L, 0x00000000D83DDC58L, 0x00000000D83DDC59L, 0x00000000D83DDCBCL, 0x00000000D83DDC5CL, 0x00000000D83DDC5DL, 0x00000000D83DDC5BL, 0x00000000D83DDC53L, 0x00000000D83CDF80L, 0x00000000D83CDF02L, 0x00000000D83DDC84L, 0x00000000D83DDC9BL, 0x00000000D83DDC99L, 0x00000000D83DDC9CL, 0x00000000D83DDC9AL, 0x0000000000002764L, 0x00000000D83DDC94L, 0x00000000D83DDC97L, 0x00000000D83DDC93L, 0x00000000D83DDC95L, 0x00000000D83DDC96L, 0x00000000D83DDC9EL, 0x00000000D83DDC98L, 0x00000000D83DDC8CL, 0x00000000D83DDC8BL, 0x00000000D83DDC8DL, 0x00000000D83DDC8EL, 0x00000000D83DDC64L, 0x00000000D83DDC65L, 0x00000000D83DDCACL, 0x00000000D83DDC63L, 0x00000000D83DDCADL}, new ulong[]{ 0x00000000D83DDC36L, 0x00000000D83DDC3AL, 0x00000000D83DDC31L, 0x00000000D83DDC2DL, 0x00000000D83DDC39L, 0x00000000D83DDC30L, 0x00000000D83DDC38L, 0x00000000D83DDC2FL, 0x00000000D83DDC28L, 0x00000000D83DDC3BL, 0x00000000D83DDC37L, 0x00000000D83DDC3DL, 0x00000000D83DDC2EL, 0x00000000D83DDC17L, 0x00000000D83DDC35L, 0x00000000D83DDC12L, 0x00000000D83DDC34L, 0x00000000D83DDC11L, 0x00000000D83DDC18L, 0x00000000D83DDC3CL, 0x00000000D83DDC27L, 0x00000000D83DDC26L, 0x00000000D83DDC24L, 0x00000000D83DDC25L, 0x00000000D83DDC23L, 0x00000000D83DDC14L, 0x00000000D83DDC0DL, 0x00000000D83DDC22L, 0x00000000D83DDC1BL, 0x00000000D83DDC1DL, 0x00000000D83DDC1CL, 0x00000000D83DDC1EL, 0x00000000D83DDC0CL, 0x00000000D83DDC19L, 0x00000000D83DDC1AL, 0x00000000D83DDC20L, 0x00000000D83DDC1FL, 0x00000000D83DDC2CL, 0x00000000D83DDC33L, 0x00000000D83DDC0BL, 0x00000000D83DDC04L, 0x00000000D83DDC0FL, 0x00000000D83DDC00L, 0x00000000D83DDC03L, 0x00000000D83DDC05L, 0x00000000D83DDC07L, 0x00000000D83DDC09L, 0x00000000D83DDC0EL, 0x00000000D83DDC10L, 0x00000000D83DDC13L, 0x00000000D83DDC15L, 0x00000000D83DDC16L, 0x00000000D83DDC01L, 0x00000000D83DDC02L, 0x00000000D83DDC32L, 0x00000000D83DDC21L, 0x00000000D83DDC0AL, 0x00000000D83DDC2BL, 0x00000000D83DDC2AL, 0x00000000D83DDC06L, 0x00000000D83DDC08L, 0x00000000D83DDC29L, 0x00000000D83DDC3EL, 0x00000000D83DDC90L, 0x00000000D83CDF38L, 0x00000000D83CDF37L, 0x00000000D83CDF40L, 0x00000000D83CDF39L, 0x00000000D83CDF3BL, 0x00000000D83CDF3AL, 0x00000000D83CDF41L, 0x00000000D83CDF43L, 0x00000000D83CDF42L, 0x00000000D83CDF3FL, 0x00000000D83CDF3EL, 0x00000000D83CDF44L, 0x00000000D83CDF35L, 0x00000000D83CDF34L, 0x00000000D83CDF32L, 0x00000000D83CDF33L, 0x00000000D83CDF30L, 0x00000000D83CDF31L, 0x00000000D83CDF3CL, 0x00000000D83CDF10L, 0x00000000D83CDF1EL, 0x00000000D83CDF1DL, 0x00000000D83CDF1AL, 0x00000000D83CDF11L, 0x00000000D83CDF12L, 0x00000000D83CDF13L, 0x00000000D83CDF14L, 0x00000000D83CDF15L, 0x00000000D83CDF16L, 0x00000000D83CDF17L, 0x00000000D83CDF18L, 0x00000000D83CDF1CL, 0x00000000D83CDF1BL, 0x00000000D83CDF19L, 0x00000000D83CDF0DL, 0x00000000D83CDF0EL, 0x00000000D83CDF0FL, 0x00000000D83CDF0BL, 0x00000000D83CDF0CL, 0x00000000D83CDF20L, 0x0000000000002B50L, 0x0000000000002600L, 0x00000000000026C5L, 0x0000000000002601L, 0x00000000000026A1L, 0x0000000000002614L, 0x0000000000002744L, 0x00000000000026C4L, 0x00000000D83CDF00L, 0x00000000D83CDF01L, 0x00000000D83CDF08L, 0x00000000D83CDF0AL}, new ulong[]{ 0x00000000D83CDF8DL, 0x00000000D83DDC9DL, 0x00000000D83CDF8EL, 0x00000000D83CDF92L, 0x00000000D83CDF93L, 0x00000000D83CDF8FL, 0x00000000D83CDF86L, 0x00000000D83CDF87L, 0x00000000D83CDF90L, 0x00000000D83CDF91L, 0x00000000D83CDF83L, 0x00000000D83DDC7BL, 0x00000000D83CDF85L, 0x00000000D83CDF84L, 0x00000000D83CDF81L, 0x00000000D83CDF8BL, 0x00000000D83CDF89L, 0x00000000D83CDF8AL, 0x00000000D83CDF88L, 0x00000000D83CDF8CL, 0x00000000D83DDD2EL, 0x00000000D83CDFA5L, 0x00000000D83DDCF7L, 0x00000000D83DDCF9L, 0x00000000D83DDCFCL, 0x00000000D83DDCBFL, 0x00000000D83DDCC0L, 0x00000000D83DDCBDL, 0x00000000D83DDCBEL, 0x00000000D83DDCBBL, 0x00000000D83DDCF1L, 0x000000000000260EL, 0x00000000D83DDCDEL, 0x00000000D83DDCDFL, 0x00000000D83DDCE0L, 0x00000000D83DDCE1L, 0x00000000D83DDCFAL, 0x00000000D83DDCFBL, 0x00000000D83DDD0AL, 0x00000000D83DDD09L, 0x00000000D83DDD08L, 0x00000000D83DDD07L, 0x00000000D83DDD14L, 0x00000000D83DDD14L, 0x00000000D83DDCE2L, 0x00000000D83DDCE3L, 0x00000000000023F3L, 0x000000000000231BL, 0x00000000000023F0L, 0x000000000000231AL, 0x00000000D83DDD13L, 0x00000000D83DDD12L, 0x00000000D83DDD0FL, 0x00000000D83DDD10L, 0x00000000D83DDD11L, 0x00000000D83DDD0EL, 0x00000000D83DDCA1L, 0x00000000D83DDD26L, 0x00000000D83DDD06L, 0x00000000D83DDD05L, 0x00000000D83DDD0CL, 0x00000000D83DDD0BL, 0x00000000D83DDD0DL, 0x00000000D83DDEC1L /* was missing */, 0x00000000D83DDEC0L, 0x00000000D83DDEBFL, 0x00000000D83DDEBDL, 0x00000000D83DDD27L, 0x00000000D83DDD29L, 0x00000000D83DDD28L, 0x00000000D83DDEAAL, 0x00000000D83DDEACL, 0x00000000D83DDCA3L, 0x00000000D83DDD2BL, 0x00000000D83DDD2AL, 0x00000000D83DDC8AL, 0x00000000D83DDC89L, 0x00000000D83DDCB0L, 0x00000000D83DDCB4L, 0x00000000D83DDCB5L, 0x00000000D83DDCB7L, 0x00000000D83DDCB6L, 0x00000000D83DDCB3L, 0x00000000D83DDCB8L, 0x00000000D83DDCF2L, 0x00000000D83DDCE7L, 0x00000000D83DDCE5L, 0x00000000D83DDCE4L, 0x0000000000002709L, 0x00000000D83DDCE9L, 0x00000000D83DDCE8L, 0x00000000D83DDCEFL, 0x00000000D83DDCEBL, 0x00000000D83DDCEAL, 0x00000000D83DDCECL, 0x00000000D83DDCEDL, 0x00000000D83DDCEEL, 0x00000000D83DDCE6L, 0x00000000D83DDCDDL, 0x00000000D83DDCC4L, 0x00000000D83DDCC3L, 0x00000000D83DDCD1L, 0x00000000D83DDCCAL, 0x00000000D83DDCC8L, 0x00000000D83DDCC9L, 0x00000000D83DDCDCL, 0x00000000D83DDCCBL, 0x00000000D83DDCC5L, 0x00000000D83DDCC6L, 0x00000000D83DDCC7L, 0x00000000D83DDCC1L, 0x00000000D83DDCC2L, 0x0000000000002702L, 0x00000000D83DDCCCL, 0x00000000D83DDCCEL, 0x0000000000002712L, 0x000000000000270FL, 0x00000000D83DDCCFL, 0x00000000D83DDCD0L, 0x00000000D83DDCD5L, 0x00000000D83DDCD7L, 0x00000000D83DDCD8L, 0x00000000D83DDCD9L, 0x00000000D83DDCD3L, 0x00000000D83DDCD4L, 0x00000000D83DDCD2L, 0x00000000D83DDCDAL, 0x00000000D83DDCD6L, 0x00000000D83DDD16L, 0x00000000D83DDCDBL, 0x00000000D83DDD2CL, 0x00000000D83DDD2DL, 0x00000000D83DDCF0L, 0x00000000D83CDFA8L, 0x00000000D83CDFACL, 0x00000000D83CDFA4L, 0x00000000D83CDFA7L, 0x00000000D83CDFBCL, 0x00000000D83CDFB5L, 0x00000000D83CDFB6L, 0x00000000D83CDFB9L, 0x00000000D83CDFBBL, 0x00000000D83CDFBAL, 0x00000000D83CDFB7L, 0x00000000D83CDFB8L, 0x00000000D83DDC7EL, 0x00000000D83CDFAEL, 0x00000000D83CDCCFL, 0x00000000D83CDFB4L, 0x00000000D83CDC04L, 0x00000000D83CDFB2L, 0x00000000D83CDFAFL, 0x00000000D83CDFC8L, 0x00000000D83CDFC0L, 0x00000000000026BDL, 0x00000000000026BEL, 0x00000000D83CDFBEL, 0x00000000D83CDFB1L, 0x00000000D83CDFC9L, 0x00000000D83CDFB3L, 0x00000000000026F3L, 0x00000000D83DDEB5L, 0x00000000D83DDEB4L, 0x00000000D83CDFC1L, 0x00000000D83CDFC7L, 0x00000000D83CDFC6L, 0x00000000D83CDFBFL, 0x00000000D83CDFC2L, 0x00000000D83CDFCAL, 0x00000000D83CDFC4L, 0x00000000D83CDFA3L, 0x0000000000002615L, 0x00000000D83CDF75L, 0x00000000D83CDF76L, 0x00000000D83CDF7CL, 0x00000000D83CDF7AL, 0x00000000D83CDF7BL, 0x00000000D83CDF78L, 0x00000000D83CDF79L, 0x00000000D83CDF77L, 0x00000000D83CDF74L, 0x00000000D83CDF55L, 0x00000000D83CDF54L, 0x00000000D83CDF5FL, 0x00000000D83CDF57L, 0x00000000D83CDF56L, 0x00000000D83CDF5DL, 0x00000000D83CDF5BL, 0x00000000D83CDF64L, 0x00000000D83CDF71L, 0x00000000D83CDF63L, 0x00000000D83CDF65L, 0x00000000D83CDF59L, 0x00000000D83CDF58L, 0x00000000D83CDF5AL, 0x00000000D83CDF5CL, 0x00000000D83CDF72L, 0x00000000D83CDF62L, 0x00000000D83CDF61L, 0x00000000D83CDF73L, 0x00000000D83CDF5EL, 0x00000000D83CDF69L, 0x00000000D83CDF6EL, 0x00000000D83CDF66L, 0x00000000D83CDF68L, 0x00000000D83CDF67L, 0x00000000D83CDF82L, 0x00000000D83CDF70L, 0x00000000D83CDF6AL, 0x00000000D83CDF6BL, 0x00000000D83CDF6CL, 0x00000000D83CDF6DL, 0x00000000D83CDF6FL, 0x00000000D83CDF4EL, 0x00000000D83CDF4FL, 0x00000000D83CDF4AL, 0x00000000D83CDF4BL, 0x00000000D83CDF52L, 0x00000000D83CDF47L, 0x00000000D83CDF49L, 0x00000000D83CDF53L, 0x00000000D83CDF51L, 0x00000000D83CDF48L, 0x00000000D83CDF4CL, 0x00000000D83CDF50L, 0x00000000D83CDF4DL, 0x00000000D83CDF60L, 0x00000000D83CDF46L, 0x00000000D83CDF45L, 0x00000000D83CDF3DL}, new ulong[]{ 0x00000000D83CDFE0L, 0x00000000D83CDFE1L, 0x00000000D83CDFEBL, 0x00000000D83CDFE2L, 0x00000000D83CDFE3L, 0x00000000D83CDFE5L, 0x00000000D83CDFE6L, 0x00000000D83CDFEAL, 0x00000000D83CDFE9L, 0x00000000D83CDFE8L, 0x00000000D83DDC92L, 0x00000000000026EAL, 0x00000000D83CDFECL, 0x00000000D83CDFE4L, 0x00000000D83CDF07L, 0x00000000D83CDF06L, 0x00000000D83CDFEFL, 0x00000000D83CDFF0L, 0x00000000000026FAL, 0x00000000D83CDFEDL, 0x00000000D83DDDFCL, 0x00000000D83DDDFEL, 0x00000000D83DDDFBL, 0x00000000D83CDF04L, 0x00000000D83CDF05L, 0x00000000D83CDF03L, 0x00000000D83DDDFDL, 0x00000000D83CDF09L, 0x00000000D83CDFA0L, 0x00000000D83CDFA1L, 0x00000000000026F2L, 0x00000000D83CDFA2L, 0x00000000D83DDEA2L, 0x00000000000026F5L, 0x00000000D83DDEA4L, 0x00000000D83DDEA3L, 0x0000000000002693L, 0x00000000D83DDE80L, 0x0000000000002708L, 0x00000000D83DDCBAL, 0x00000000D83DDE81L, 0x00000000D83DDE82L, 0x00000000D83DDE8AL, 0x00000000D83DDE89L, 0x00000000D83DDE9EL, 0x00000000D83DDE86L, 0x00000000D83DDE84L, 0x00000000D83DDE85L, 0x00000000D83DDE88L, 0x00000000D83DDE87L, 0x00000000D83DDE9DL, 0x00000000D83DDE8BL, 0x00000000D83DDE83L, 0x00000000D83DDE8EL, 0x00000000D83DDE8CL, 0x00000000D83DDE8DL, 0x00000000D83DDE99L, 0x00000000D83DDE98L, 0x00000000D83DDE97L, 0x00000000D83DDE95L, 0x00000000D83DDE96L, 0x00000000D83DDE9BL, 0x00000000D83DDE9AL, 0x00000000D83DDEA8L, 0x00000000D83DDE93L, 0x00000000D83DDE94L, 0x00000000D83DDE92L, 0x00000000D83DDE91L, 0x00000000D83DDE90L, 0x00000000D83DDEB2L, 0x00000000D83DDEA1L, 0x00000000D83DDE9FL, 0x00000000D83DDEA0L, 0x00000000D83DDE9CL, 0x00000000D83DDC88L, 0x00000000D83DDE8FL, 0x00000000D83CDFABL, 0x00000000D83DDEA6L, 0x00000000D83DDEA5L, 0x00000000000026A0L, 0x00000000D83DDEA7L, 0x00000000D83DDD30L, 0x00000000000026FDL, 0x00000000D83CDFEEL, 0x00000000D83CDFB0L, 0x0000000000002668L, 0x00000000D83DDDFFL, 0x00000000D83CDFAAL, 0x00000000D83CDFADL, 0x00000000D83DDCCDL, 0x00000000D83DDEA9L, 0xD83CDDEFD83CDDF5L, 0xD83CDDF0D83CDDF7L, 0xD83CDDE9D83CDDEAL, 0xD83CDDE8D83CDDF3L, 0xD83CDDFAD83CDDF8L, 0xD83CDDEBD83CDDF7L, 0xD83CDDEAD83CDDF8L, 0xD83CDDEED83CDDF9L, 0xD83CDDF7D83CDDFAL, 0xD83CDDECD83CDDE7L}, new ulong[]{ 0x00000000003120E3L, 0x00000000003220E3L, 0x00000000003320E3L, 0x00000000003420E3L, 0x00000000003520E3L, 0x00000000003620E3L, 0x00000000003720E3L, 0x00000000003820E3L, 0x00000000003920E3L, 0x00000000003020E3L, 0x00000000D83DDD1FL, 0x00000000D83DDD22L, 0x00000000002320E3L, 0x00000000D83DDD23L, 0x0000000000002B06L, 0x0000000000002B07L, 0x0000000000002B05L, 0x00000000000027A1L, 0x00000000D83DDD20L, 0x00000000D83DDD21L, 0x00000000D83DDD24L, 0x0000000000002197L, 0x0000000000002196L, 0x0000000000002198L, 0x0000000000002199L, 0x0000000000002194L, 0x0000000000002195L, 0x00000000D83DDD04L, 0x00000000000025C0L, 0x00000000000025B6L, 0x00000000D83DDD3CL, 0x00000000D83DDD3DL, 0x00000000000021A9L, 0x00000000000021AAL, 0x0000000000002139L, 0x00000000000023EAL, 0x00000000000023E9L, 0x00000000000023EBL, 0x00000000000023ECL, 0x0000000000002935L, 0x0000000000002934L, 0x00000000D83CDD97L, 0x00000000D83DDD00L, 0x00000000D83DDD01L, 0x00000000D83DDD02L, 0x00000000D83CDD95L, 0x00000000D83CDD99L, 0x00000000D83CDD92L, 0x00000000D83CDD93L, 0x00000000D83CDD96L, 0x00000000D83DDCF6L, 0x00000000D83CDFA6L, 0x00000000D83CDE01L, 0x00000000D83CDE2FL, 0x00000000D83CDE33L, 0x00000000D83CDE35L, 0x00000000D83CDE34L /* was missing */, 0x00000000D83CDE32L, 0x00000000D83CDE50L /* //34 was wrong */, 0x00000000D83CDE39L /* //32 was duplicate */, /* removed 3 */ 0x00000000D83CDE3AL, 0x00000000D83CDE36L, 0x00000000D83CDE1AL, 0x00000000D83DDEBBL, 0x00000000D83DDEB9L, 0x00000000D83DDEBAL, 0x00000000D83DDEBCL, 0x00000000D83DDEBEL, 0x00000000D83DDEB0L, 0x00000000D83DDEAEL, 0x00000000D83CDD7FL, 0x000000000000267FL, 0x00000000D83DDEADL, 0x00000000D83CDE37L, 0x00000000D83CDE38L, 0x00000000D83CDE02L, 0x00000000000024C2L, /* missing 4 unicodes */ 0x00000000D83DDEC2L, 0x00000000D83DDEC4L, 0x00000000D83DDEC5L, 0x00000000D83DDEC3L, 0x00000000D83CDE51L, 0x0000000000003299L, 0x0000000000003297L, 0x00000000D83CDD91L, 0x00000000D83CDD98L, 0x00000000D83CDD94L, 0x00000000D83DDEABL, 0x00000000D83DDD1EL, 0x00000000D83DDCF5L, 0x00000000D83DDEAFL, 0x00000000D83DDEB1L, 0x00000000D83DDEB3L, 0x00000000D83DDEB7L, 0x00000000D83DDEB8L, 0x00000000000026D4L, 0x0000000000002733L, 0x0000000000002747L, 0x000000000000274EL, 0x0000000000002705L, 0x0000000000002734L, 0x00000000D83DDC9FL, 0x00000000D83CDD9AL, 0x00000000D83DDCF3L, 0x00000000D83DDCF4L, 0x00000000D83CDD70L, 0x00000000D83CDD71L, 0x00000000D83CDD8EL, 0x00000000D83CDD7EL, 0x00000000D83DDCA0L, 0x00000000000027BFL, 0x000000000000267BL, 0x0000000000002648L, 0x0000000000002649L, 0x000000000000264AL, 0x000000000000264BL, 0x000000000000264CL, 0x000000000000264DL, 0x000000000000264EL, 0x000000000000264FL, 0x0000000000002650L, 0x0000000000002651L, 0x0000000000002652L, 0x0000000000002653L, 0x00000000000026CEL, 0x00000000D83DDD2FL, 0x00000000D83CDFE7L, 0x00000000D83DDCB9L, 0x00000000D83DDCB2L, 0x00000000D83DDCB1L, 0x00000000000000A9L, 0x00000000000000AEL, 0x0000000000002122L /* TM */, /* was mixed, missing 2-3 */ 0x000000000000274CL, 0x000000000000203CL, 0x0000000000002049L, 0x0000000000002757L, 0x0000000000002753L, 0x0000000000002755L, 0x0000000000002754L, 0x0000000000002B55L, 0x00000000D83DDD1DL, 0x00000000D83DDD1AL, 0x00000000D83DDD19L, 0x00000000D83DDD1BL, 0x00000000D83DDD1CL, 0x00000000D83DDD03L, 0x00000000D83DDD5BL, 0x00000000D83DDD67L, 0x00000000D83DDD50L, 0x00000000D83DDD5CL, 0x00000000D83DDD51L, 0x00000000D83DDD5DL, 0x00000000D83DDD52L, 0x00000000D83DDD5EL, 0x00000000D83DDD53L, 0x00000000D83DDD5FL, 0x00000000D83DDD54L, 0x00000000D83DDD60L, 0x00000000D83DDD55L, 0x00000000D83DDD56L, 0x00000000D83DDD57L, 0x00000000D83DDD58L, 0x00000000D83DDD59L, 0x00000000D83DDD5AL, 0x00000000D83DDD61L, 0x00000000D83DDD62L, 0x00000000D83DDD63L, 0x00000000D83DDD64L, 0x00000000D83DDD65L, 0x00000000D83DDD66L, 0x0000000000002716L, 0x0000000000002795L, 0x0000000000002796L, 0x0000000000002797L, 0x0000000000002660L, 0x0000000000002665L, 0x0000000000002663L, 0x0000000000002666L, 0x00000000D83DDCAEL, 0x00000000D83DDCAFL, 0x0000000000002714L, 0x0000000000002611L, 0x00000000D83DDD18L, 0x00000000D83DDD17L, 0x00000000000027B0L, 0x0000000000003030L, 0x000000000000303DL, 0x00000000D83DDD31L, 0x00000000000025FCL, 0x00000000000025FBL, 0x00000000000025FEL, 0x00000000000025FDL, 0x00000000000025AAL, 0x00000000000025ABL, 0x00000000D83DDD3AL, 0x00000000D83DDD32L, 0x00000000D83DDD33L, 0x00000000000026ABL, 0x00000000000026AAL, 0x00000000D83DDD34L, 0x00000000D83DDD35L, 0x00000000D83DDD3BL, 0x0000000000002B1CL, 0x0000000000002B1BL, 0x00000000D83DDD36L, 0x00000000D83DDD37L, 0x00000000D83DDD38L, 0x00000000D83DDD39L}}; } } ================================================ FILE: Telegram.EmojiPanel/Controls/Emoji/EmojiSpriteItem.cs ================================================ using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using Telegram.Controls.VirtualizedView; namespace Telegram.EmojiPanel.Controls.Emoji { public class EmojiSelectedEventArgs : EventArgs { public EmojiDataItem DataItem { get; set; } } public class EmojiSpriteItem : VListItemBase { public int CategoryIndex; public int SpriteOffset; public int Rows; public EventHandler EmojiSelected = delegate { }; public EmojiSpriteItem(int categoryIndex, int spriteOffset) { CategoryIndex = categoryIndex; SpriteOffset = spriteOffset; Rows = EmojiData.SpriteRowsCountByCategory[categoryIndex][spriteOffset]; var emojiInCategory = EmojiData.CodesByCategory[categoryIndex]; ulong[] emojis = null; emojis = spriteOffset != 0 ? emojiInCategory.Skip(spriteOffset*EmojiData.ItemsInSprite).Take(EmojiData.ItemsInSprite).ToArray() : emojiInCategory.Take(EmojiData.ItemsInSprite).ToArray(); View.Width = SpriteWidth + 8; var decodePixelWidth = SpriteWidth; //switch (Application.Current.Host.Content.ScaleFactor) //{ // case 100: // break; // case 150: // decodePixelWidth = 711; // break; // case 160: // decodePixelWidth = 758; // break; //} var image = new Image { Width = SpriteWidth, Source = new BitmapImage { //DecodePixelWidth = decodePixelWidth, //DecodePixelType = DecodePixelType.Physical //UriSource = spriteUri }, Margin = new Thickness(4, 1, 4, 1), VerticalAlignment = VerticalAlignment.Top }; Children.Add(image); View.MouseLeftButtonDown += ViewOnMouseLeftButtonDown; View.LostMouseCapture += ViewOnLostMouseCapture; View.MouseLeftButtonUp += ViewOnLostMouseCapture; View.MouseLeave += ViewOnLostMouseCapture; View.Tap += ViewOnTap; CreateBorders(); } public EmojiSpriteItem(Uri spriteUri, int categoryIndex, int spriteOffset) { CategoryIndex = categoryIndex; SpriteOffset = spriteOffset; Rows = EmojiData.SpriteRowsCountByCategory[categoryIndex][spriteOffset]; View.Width = SpriteWidth + 8; var decodePixelWidth = SpriteWidth; //switch (Application.Current.Host.Content.ScaleFactor) //{ // case 100: // break; // case 150: // decodePixelWidth = 711; // break; // case 160: // decodePixelWidth = 758; // break; //} var image = new Image { Width = SpriteWidth, Source = new BitmapImage { //DecodePixelWidth = decodePixelWidth, //DecodePixelType = DecodePixelType.Physical, UriSource = spriteUri }, Margin = new Thickness(4, 1, 4, 1), VerticalAlignment = VerticalAlignment.Top }; Children.Add(image); View.MouseLeftButtonDown += ViewOnMouseLeftButtonDown; View.LostMouseCapture += ViewOnLostMouseCapture; View.MouseLeftButtonUp += ViewOnLostMouseCapture; View.MouseLeave += ViewOnLostMouseCapture; View.Tap += ViewOnTap; CreateBorders(); } private static void ViewOnLostMouseCapture(object sender, MouseEventArgs mouseEventArgs) { ClearCurrentHighlight(); } public static void ClearCurrentHighlight() { if (_currentHighlight == null) return; var parent = _currentHighlight.Parent as Grid; if (parent != null) parent.Children.Remove(_currentHighlight); _currentHighlight = null; } private void ViewOnMouseLeftButtonDown(object sender, MouseButtonEventArgs args) { var point = args.GetPosition(View); var column = (int) Math.Ceiling(point.X / ColumnWidth); var row = (int) Math.Ceiling(point.Y / RowHeight); if (column <= 0 || row <= 0) return; if (Rows < MaxRowsInSprite && row == Rows) { if (EmojiData.ItemsInRow - EmojiData.SpriteMissingCellsByCategory[CategoryIndex] < column) return; } var emojiHoverBackground = new Rectangle { Width = ColumnWidth - 2, //width without 2px border Height = RowHeight, Fill = (Brush) Application.Current.Resources["PhoneAccentBrush"], Margin = new Thickness((column - 1) * 79 + 4, (row - 1) * 70 + 2, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; View.Children.Insert(0, emojiHoverBackground); ClearCurrentHighlight(); _currentHighlight = emojiHoverBackground; } private void ViewOnTap(object sender, GestureEventArgs args) { var point = args.GetPosition(View); var column = (int) Math.Ceiling(point.X / 79); var row = (int) Math.Ceiling(point.Y / 70); if (column <= 0 || row <= 0) return; //Debug.WriteLine("{0}-{1}", column, row); var itemIndex = (row - 1) * EmojiData.ItemsInRow + (column - 1); var emoji = EmojiDataItem.GetByIndex(CategoryIndex, SpriteOffset, itemIndex); if (emoji != null) EmojiSelected(this, new EmojiSelectedEventArgs{DataItem = emoji}); } private static Rectangle _currentHighlight; private void CreateBorders() { for (int i = 0; i < Rows + 1; i++) { var line = new Rectangle { Width = SpriteWidth + 4, Height = 2, Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Margin = new Thickness(0, i * RowHeight, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(line); } for (int i = 0; i < 5; i++) { var line = new Rectangle { Width = 2, Height = RowHeight * Rows, Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Margin = new Thickness((i + 1) * ColumnWidth + 2, 0, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(line); } if (Rows < MaxRowsInSprite) { var missingRows = EmojiData.SpriteMissingCellsByCategory[CategoryIndex]; var startIndex = EmojiData.ItemsInRow - missingRows; var width = missingRows * ColumnWidth; var horizontalOffset = startIndex * ColumnWidth + 4; var rect = new Rectangle { Fill = (Brush) Application.Current.Resources["PhoneChromeBrush"], Width = width, Height = RowHeight, Margin = new Thickness(horizontalOffset, (Rows - 1) * RowHeight, 0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; Children.Add(rect); } } public const int SpriteWidth = 472; public const int SpriteHeight = 420; public const int ColumnWidth = 79; public const int RowHeight = 70; // 105 in pixel logic public const int MaxRowsInSprite = 6; public override double FixedHeight { get { return RowHeight * Rows; } set { } } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Emoji/StickerSpriteItem.cs ================================================ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; using Telegram.Api.Services.FileManager; using Telegram.Api.TL; using Telegram.Controls.VirtualizedView; namespace Telegram.EmojiPanel.Controls.Emoji { //class StickerToImageSourceConverter : IValueConverter //{ // private static ImageSource ReturnOrEnqueueSticker(TLDocument22 document, TLStickerItem sticker) // { // if (document == null) return null; // var documentLocalFileName = document.GetFileName(); // using (var store = IsolatedStorageFile.GetUserStoreForApplication()) // { // if (!store.FileExists(documentLocalFileName)) // { // TLObject owner = document; // if (sticker != null) // { // owner = sticker; // } // // 1. download full size // IoC.Get().DownloadFileAsync(document.FileName, document.DCId, document.ToInputFileLocation(), owner, document.Size, progress => { }); // // 2. download preview // var thumbCachedSize = document.Thumb as TLPhotoCachedSize; // if (thumbCachedSize != null) // { // var fileName = "cached" + document.GetFileName(); // var buffer = thumbCachedSize.Bytes.Data; // if (buffer == null) return null; // return DecodeWebPImage(fileName, buffer, () => { }); // } // var thumbPhotoSize = document.Thumb as TLPhotoSize; // if (thumbPhotoSize != null) // { // var location = thumbPhotoSize.Location as TLFileLocation; // if (location != null) // { // return ReturnOrEnqueueStickerPreview(location, sticker, thumbPhotoSize.Size); // } // } // } // else // { // if (document.DocumentSize > 0 // && document.DocumentSize < Telegram.Api.Constants.StickerMaxSize) // { // byte[] buffer; // using (var file = store.OpenFile(documentLocalFileName, FileMode.Open)) // { // buffer = new byte[file.Length]; // file.Read(buffer, 0, buffer.Length); // } // return DecodeWebPImage(documentLocalFileName, buffer, // () => // { // using (var localStore = IsolatedStorageFile.GetUserStoreForApplication()) // { // localStore.DeleteFile(documentLocalFileName); // } // }); // } // } // } // return null; // } // public object Convert(object value, Type targetType, object parameter, CultureInfo culture) // { // var document = value as TLDocument22; // if (document == null) return null; // document. // } // public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) // { // throw new NotImplementedException(); // } //} //class StickerSpriteItem : VListItemBase //{ // public override double FixedHeight // { // get { return 180.0; } // set { } // } // public double StickerWidth // { // get { return 120.0; } // } // public double StickerHeight // { // get { return 180.0; } // } // public StickerSpriteItem(IList stickers) // { // var stackPanel = new StackPanel(); // for (var i = 0; i < stickers.Count; i++) // { // var binding = new Binding(); // binding.Source = stickers[i]; // //binding.Path = new PropertyPath(""); // binding.Mode = BindingMode.OneWay; // binding.Converter = new StickerToImageSourceConverter(); // var image = new Image // { // Width = StickerWidth, // Height = StickerHeight, // //Source = new BitmapImage // //{ // // //DecodePixelWidth = decodePixelWidth, // // //DecodePixelType = DecodePixelType.Physical // // //UriSource = spriteUri // //}, // Margin = new Thickness(0, 0, 0, 0), // VerticalAlignment = VerticalAlignment.Top // }; // image.SetBinding(Image.SourceProperty, binding); // image.Tap += Sticker_OnTap; // stackPanel.Children.Add(image); // } // Children.Add(stackPanel); // } // private void Sticker_OnTap(object sender, GestureEventArgs e) // { // } //} } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/DelayedExecutor.cs ================================================ using System; using System.Diagnostics; using System.Threading; namespace Telegram.EmojiPanel.Controls.Utilites { public class DelayedExecutor { class ExecutionInfo { public Action Action { get; set; } public DateTime Timestamp { get; set; } } ExecutionInfo m_executionInfo; Timer m_timer; int m_delay; bool m_timerIsActive; object m_lockObj = new object(); public DelayedExecutor(int delay) // TO DO : add IDateTimeProvider dependency to remove dependency on DateTime { m_delay = delay; m_timer = new Timer(TimerCallback); } public void AddToDelayedExecution(Action action) { lock (m_lockObj) { m_executionInfo = new ExecutionInfo() { Action = action, Timestamp = DateTime.Now }; } ChangeTimer(true); } private void TimerCallback(object state) { Action executeAction = null; lock (m_lockObj) { if (m_executionInfo != null) { if (DateTime.Now - m_executionInfo.Timestamp >= TimeSpan.FromMilliseconds(m_delay)) { Debug.WriteLine("Action is set to be executed."); executeAction = m_executionInfo.Action; m_executionInfo = null; ChangeTimer(false); } } } if (executeAction != null) { try { executeAction(); } catch (Exception exc) { //Logger.Instance.Error("Exeption during delayed execution", exc); } } } private void ChangeTimer(bool activate) { if (activate && !m_timerIsActive) { lock (m_timer) { m_timerIsActive = true; m_timer.Change(m_delay, m_delay); } } else if (!activate && m_timerIsActive) { lock (m_timer) { m_timerIsActive = false; m_timer.Change(Timeout.Infinite, 0); } } } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/Helpers.cs ================================================ using System; namespace Telegram.EmojiPanel.Controls.Utilites { public static class Helpers { public static Uri GetAssetUri(string assetName) { return new Uri(String.Format("/Assets/{0}-WXGA.png", assetName), UriKind.Relative); //switch (Application.Current.Host.Content.ScaleFactor) //{ // case 100: // return new Uri(String.Format("/Assets/{0}-WVGA.png", assetName), UriKind.Relative); // case 160: // return new Uri(String.Format("/Assets/{0}-WXGA.png", assetName), UriKind.Relative); // case 150: // return new Uri(String.Format("/Assets/{0}-720p.png", assetName), UriKind.Relative); // default: // return new Uri(String.Format("/Assets/{0}-WVGA.png", assetName), UriKind.Relative); //} } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/MyListItemBase.cs ================================================ using System.Windows.Controls; using Telegram.Controls.VirtualizedView; namespace Telegram.EmojiPanel.Controls.Utilites { public class MyListItemBase : Grid { //private Panel _contentPanel; //public Panel ContentPanel //{ // get // { // return _contentPanel; // } // set // { // _contentPanel = value; // Content = _contentPanel; // } //} public VListItemBase VirtSource { get; set; } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/MyVirtualizingPanel.cs ================================================ using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using Telegram.Controls.VirtualizedView; namespace Telegram.EmojiPanel.Controls.Utilites { public class MyVirtualizingPanel : Canvas { private const bool IsLogEnabled = false; private static void Log(string str) { if (IsLogEnabled) { Debug.WriteLine(str); } } private const double LoadUnloadThreshold = 500; private const double LoadedHeightUpwards = 300; private const double LoadedHeightDownwards = 900; private const double LoadedHeightDownwardsNotScrolling = 800; private bool _changingVerticalOffset = false; readonly DependencyProperty _listVerticalOffsetProperty = DependencyProperty.Register( "ListVerticalOffset", typeof(double), typeof(MyVirtualizingPanel), new PropertyMetadata(new PropertyChangedCallback(OnListVerticalOffsetChanged))); public double ListVerticalOffset { get { return (double) this.GetValue(_listVerticalOffsetProperty); } set { this.SetValue(_listVerticalOffsetProperty, value); } } private static void OnListVerticalOffsetChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var control = (MyVirtualizingPanel) obj; control.OnListVerticalOffsetChanged(); } private ScrollViewer _scrollViewer; bool _isScrolling = false; public ScrollViewer ScrollViewer { get { return _scrollViewer; } } public void InitializeWithScrollViewer(ScrollViewer scrollViewer) { _scrollViewer = scrollViewer; EnsureBoundToScrollViewer(); } protected void EnsureBoundToScrollViewer() { Binding binding = new Binding { Source = _scrollViewer, Path = new PropertyPath("VerticalOffset"), Mode = BindingMode.OneWay }; this.SetBinding(_listVerticalOffsetProperty, binding); } bool _notReactToScroll = false; private double _savedDelta; //private DelayedExecutor _de = new DelayedExecutor(300); //internal void PrepareForScrollToBottom() //{ // _notReactToScroll = true; // _savedDelta = DeltaOffset; // // load in the end // DeltaOffset = _scrollViewer.ExtentHeight - _scrollViewer.ViewportHeight - _scrollViewer.VerticalOffset; // Debug.WriteLine("PrepareForScrollToBottom"); // PerformLoadUnload2(VirtualizableState.LoadedPartially, false); // _de.AddToDelayedExecution(() => // { // Execute.ExecuteOnUIThread(() => ScrollToBottomCompleted()); // }); //} //internal void ScrollToBottomCompleted() //{ // _notReactToScroll = false; // DeltaOffset = _savedDelta; // PerformLoadUnload(VirtualizableState.LoadedFully); // Debug.WriteLine("ScrolltoBottomCompleted"); //} private void group_CurrentStateChanging(object sender, VisualStateChangedEventArgs e) { if (e.NewState.Name == "Scrolling") { _isScrolling = true; } else { _isScrolling = false; PerformLoadUnload(true); } } private static VisualStateGroup FindVisualState(FrameworkElement element, string name) { if (element == null) return null; IList groups = VisualStateManager.GetVisualStateGroups(element); foreach (VisualStateGroup group in groups) if (group.Name == name) return group; return null; } public class ScrollPositionChangedEventAgrs : EventArgs { public double CurrentPosition { get; private set; } public double ScrollHeight { get; private set; } public ScrollPositionChangedEventAgrs(double currentPosition, double scrollHeight) { CurrentPosition = currentPosition; ScrollHeight = scrollHeight; } } public event EventHandler ScrollPositionChanged; private double _previousScrollOffset = 0; private DateTime _previousScrollOffsetChangedTime = DateTime.MinValue; private const double PixelsPerSecondThreshold = 200; private void OnListVerticalOffsetChanged() { if (_notReactToScroll) return; if (!_changingVerticalOffset) { var w = new Stopwatch(); w.Start(); PerformLoadUnload(true); w.Stop(); Log("LOADUNLOAD performed in " + w.ElapsedMilliseconds); if (ScrollPositionChanged != null) { ScrollPositionChanged(this, new ScrollPositionChangedEventAgrs( _scrollViewer.VerticalOffset, Height)); } Log("Reported Offset: " + _scrollViewer.VerticalOffset); } } private bool DetermineIfScrollingIsFast() { var now = DateTime.Now; var result = false; if (_previousScrollOffsetChangedTime != DateTime.Now) { var scrolledPixels = Math.Abs(_scrollViewer.VerticalOffset - _previousScrollOffset); var timeInSeconds = (now - _previousScrollOffsetChangedTime).TotalSeconds; if (scrolledPixels != 0) { var speedPixelsPerSecond = scrolledPixels / timeInSeconds; Log(String.Format("Speed of scroll {0} ", speedPixelsPerSecond)); if (speedPixelsPerSecond > PixelsPerSecondThreshold) { result = true; } } } _previousScrollOffsetChangedTime = now; _previousScrollOffset = _scrollViewer.VerticalOffset; return result; } private readonly List _virtItems = new List(); // indexes of loaded items private Segment _loadedSegment = new Segment(); // maps a point to its index in _virtItems // covers only points 0, LoadUnloadThreshold, 2*LoadUnloadThreshold, etc private readonly Dictionary _thresholdPointIndexes = new Dictionary(); // do not change through this property public List VirtItems { get { return _virtItems; } } public MyVirtualizingPanel() { Loaded += MyVirtualizingPanel_Loaded; } void MyVirtualizingPanel_Loaded(object sender, RoutedEventArgs e) { if (!DesignerProperties.GetIsInDesignMode(this)) { // Visual States are always on the first child of the control template FrameworkElement element = VisualTreeHelper.GetChild(_scrollViewer, 0) as FrameworkElement; if (element != null) { VisualStateGroup group = FindVisualState(element, "ScrollStates"); if (group != null) { group.CurrentStateChanging += group_CurrentStateChanging; } } } } public void AddItems(IEnumerable _itemsToBeAdded) { var sw = new Stopwatch(); sw.Start(); double topMargin = 0; if (_virtItems.Count > 0) { topMargin = _virtItems.Sum(vi => vi.FixedHeight); } foreach (var itemToBeAdded in _itemsToBeAdded) { itemToBeAdded.View.Margin = new Thickness(itemToBeAdded.Margin.Left, itemToBeAdded.Margin.Top + topMargin, itemToBeAdded.Margin.Right, itemToBeAdded.Margin.Bottom); _virtItems.Add(itemToBeAdded); var itemHeightIncludingMargin = itemToBeAdded.FixedHeight; List coveredPoints = GetCoveredPoints(topMargin, topMargin + itemHeightIncludingMargin); foreach (var coveredPoint in coveredPoints) { _thresholdPointIndexes[coveredPoint] = _virtItems.Count - 1; // index of the last } topMargin += itemHeightIncludingMargin; } PerformLoadUnload(true); Height = topMargin; sw.Stop(); Log(String.Format("MyVirtualizingPanel.AddItems {0}", sw.ElapsedMilliseconds)); } public void InsertRemoveItems(int index, List itemsToInsert, bool keepItemsBelowIndexFixed = false, VListItemBase itemToRemove = null) { bool needToAdjustScrollPositionAfterInsertion = false; if (keepItemsBelowIndexFixed) { double totalHeightOfAllItemsBeforeIndex = 0; for (int i = 0; i < index; i++) { totalHeightOfAllItemsBeforeIndex += VirtItems[i].FixedHeight + VirtItems[i].Margin.Top + VirtItems[i].Margin.Bottom; } if (totalHeightOfAllItemsBeforeIndex < _scrollViewer.VerticalOffset + _scrollViewer.ViewportHeight) { needToAdjustScrollPositionAfterInsertion = true; } } // UnloadItemsInSegment(_loadedSegment); _loadedSegment = new Segment(); var totalHeight = itemsToInsert.Sum(i => i.FixedHeight + i.Margin.Top + i.Margin.Bottom); _virtItems.InsertRange(index, itemsToInsert); if (itemToRemove != null) { itemToRemove.IsVLoaded = false; totalHeight -= itemToRemove.FixedHeight + itemToRemove.Margin.Top + itemToRemove.Margin.Bottom; _virtItems.Remove(itemToRemove); } RearrangeAllItems(); if (needToAdjustScrollPositionAfterInsertion) { _changingVerticalOffset = true; //Debug.WriteLine("SCROLLING TO " + _scrollViewer.VerticalOffset + totalHeight + " scroll height : " + _scrollViewer.ExtentHeight); _scrollViewer.ScrollToVerticalOffset(_scrollViewer.VerticalOffset + totalHeight); _changingVerticalOffset = false; } PerformLoadUnload(false); } public void RemoveItem(VListItemBase itemToBeRemoved) { itemToBeRemoved.IsVLoaded = false; _virtItems.Remove(itemToBeRemoved); _loadedSegment = new Segment(); RearrangeAllItems(); PerformLoadUnload(true); } private void RearrangeAllItems() { double topMargin = 0; _thresholdPointIndexes.Clear(); int ind = 0; foreach (var item in _virtItems) { item.View.Margin = new Thickness(item.Margin.Left, item.Margin.Top + topMargin, item.Margin.Right, item.Margin.Bottom); var itemHeightIncludingMargin = item.FixedHeight + item.Margin.Top + item.Margin.Bottom; List coveredPoints = GetCoveredPoints(topMargin, topMargin + itemHeightIncludingMargin); foreach (var coveredPoint in coveredPoints) { _thresholdPointIndexes[coveredPoint] = ind; // index of the last } topMargin += itemHeightIncludingMargin; ind++; } Height = topMargin; _scrollViewer.UpdateLayout(); } private void PerformLoadUnload2(bool isToLoad, bool bypassUnload = false) { if (_virtItems.Count == 0) return; double currentOffset = GetRealOffset(); int lowestLoadedInd = 0; int upperInd = 0; bool triggerLoading = false; if (isToLoad || _loadedSegment.IsEmpty) { triggerLoading = true; } else { lowestLoadedInd = _loadedSegment.LowerBound; upperInd = _loadedSegment.UpperBound; double topPoint = _virtItems[lowestLoadedInd].View.Margin.Top; double bottomPoint = _virtItems[upperInd].View.Margin.Top + _virtItems[upperInd].FixedHeight; if (currentOffset - topPoint < 500 || bottomPoint - currentOffset < 1500) { triggerLoading = true; } } if (triggerLoading) { if (_scrollViewer.ExtentHeight < 3000 && _isScrolling) { //Debug.WriteLine("Detected short scroll; loading all items"); // otherwise there are glitches in scrolling lowestLoadedInd = 0; upperInd = VirtItems.Count - 1; isToLoad = true; } else { var threshold = (int) Math.Floor((currentOffset - (currentOffset % LoadUnloadThreshold))); int indexOfBaseItem = _thresholdPointIndexes.ContainsKey(threshold) ? _thresholdPointIndexes[threshold] : -1; lowestLoadedInd = upperInd = indexOfBaseItem < 0 ? 0 : indexOfBaseItem; double loadUpwards = LoadedHeightUpwards; double loadDownwards = _isScrolling ? LoadedHeightDownwards : LoadedHeightDownwardsNotScrolling; //if (_isScrolling) //{ // loadUpwards = LoadUpwardsWhenScrolling; // loadDownwards = LoadDownwardsWhenScrolling; //} // count up from the lower point on view while (lowestLoadedInd > 0 && currentOffset - _virtItems[lowestLoadedInd].View.Margin.Top < loadUpwards) { lowestLoadedInd--; } while (upperInd < _virtItems.Count - 1 && _virtItems[upperInd].View.Margin.Top - currentOffset < loadDownwards) { upperInd++; } } SetLoadedBounds(lowestLoadedInd, upperInd, isToLoad, bypassUnload); if (IsLogEnabled) { string loadedIndexes = "Loaded indexes : "; for (int i = 0; i < _virtItems.Count; i++) { if (_virtItems[i].IsVLoaded) { loadedIndexes += i + ","; } } Log(loadedIndexes); } } } public double DeltaOffset { get; set; } private double GetRealOffset() { //// it might throw exception //try //{ // GeneralTransform childTransform = this.TransformToVisual(_listScrollViewer); // var p = childTransform.Transform(new Point(0, 0)); // var delta = p.Y; // Debug.WriteLine("DELTA offset =" + delta + "; VerticalOffset=" + _listScrollViewer.VerticalOffset); // return -delta; //} //catch (Exception exc) //{ // return _listScrollViewer.VerticalOffset; //} return _scrollViewer.VerticalOffset + DeltaOffset; } private void PerformLoadUnload(bool isToLoad) { PerformLoadUnload2(isToLoad); } private void SetLoadedBounds(int lowerBoundInd, int upperBoundInd, bool isToLoad, bool bypassUnload = false) { var newLoadedSegment = new Segment(lowerBoundInd, upperBoundInd); Segment newMinusLoaded1; Segment newMinusLoaded2; Segment intersection; Segment loadedMinusNew1; Segment loadedMinusNew2; newLoadedSegment.CompareToSegment(_loadedSegment, out newMinusLoaded1, out newMinusLoaded2, out intersection, out loadedMinusNew1, out loadedMinusNew2); Log(String.Format("LoadedSegment:{0}, NewSegment:{1}, NewMinusLoaded1:{2}, NewMinusLoaded2:{3}, loadedMinusNew1:{4}, loadedMinusNew2:{5}", _loadedSegment, newLoadedSegment, newMinusLoaded1, newMinusLoaded2, loadedMinusNew1, loadedMinusNew2)); if (isToLoad) { // ensure items are loaded fully for the whole segment LoadItemsInSegment(newLoadedSegment); } if (!bypassUnload) { UnloadItemsInSegment(loadedMinusNew1); UnloadItemsInSegment(loadedMinusNew2); } _loadedSegment = newLoadedSegment; } private void UnloadItemsInSegment(Segment segment) { for (int i = segment.LowerBound; i <= segment.UpperBound; i++) { var item = _virtItems[i]; Children.Remove(item.View); item.IsVLoaded = false; } } private void LoadItemsInSegment(Segment segment) { for (int i = segment.LowerBound; i <= segment.UpperBound; i++) { var item = _virtItems[i]; item.IsVLoaded = true; if (!Children.Contains(item.View)) { Children.Add(item.View); } } } private List GetCoveredPoints(double from, double to) { var result = new List(); var candidate = from - (from % LoadUnloadThreshold); while (candidate <= to) { if (candidate >= from) { result.Add((int) Math.Floor(candidate)); } candidate += LoadUnloadThreshold; } return result; } public void ClearItems() { _virtItems.Clear(); Children.Clear(); _loadedSegment = new Segment(); _thresholdPointIndexes.Clear(); _scrollViewer.ScrollToVerticalOffset(0); Height = 0; } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/VListItemBase.cs ================================================ using System.Collections.Generic; using System.Windows; using Telegram.EmojiPanel.Controls.Utilites; using Rectangle = System.Windows.Shapes.Rectangle; namespace Telegram.Controls.VirtualizedView { public abstract class VListItemBase { private readonly List _children = new List(); public MyListItemBase View { get; private set; } public List Children { get { return _children; } } protected VListItemBase() { View = new MyListItemBase { VirtSource = this, Width = 440 }; } public abstract double FixedHeight { get; set; } public Thickness Margin = new Thickness(); public virtual object ItemSource { get; set; } private bool _isVLoaded; public bool IsVLoaded { get { return _isVLoaded; } set { if (value != IsVLoaded) { if (value) Load(); else Unload(); } _isVLoaded = value; } } public virtual void Load() { if (View.Children.Count == 0) foreach (var child in _children) View.Children.Add(child); } public virtual void Unload() { View.Children.Clear(); } } } ================================================ FILE: Telegram.EmojiPanel/Controls/Utilites/VirtSegment.cs ================================================ using System; namespace Telegram.EmojiPanel.Controls.Utilites { public class Segment { public int LowerBound { get; private set; } public int UpperBound { get; private set; } public bool IsEmpty { get { return UpperBound < LowerBound; } } public Segment(int lowerBound, int upperBound) { LowerBound = lowerBound; UpperBound = upperBound; } public Segment() : this(0, -1) { } public override string ToString() { if (IsEmpty) return "[]"; return String.Format("[{0},{1}]", LowerBound, UpperBound); } public void CompareToSegment( Segment otherSegment, out Segment thisMinusOther1, out Segment thisMinusOther2, out Segment intersection, out Segment otherMinusThis1, out Segment otherMinusThis2) { thisMinusOther1 = new Segment(); thisMinusOther2 = new Segment(); intersection = new Segment(); otherMinusThis1 = new Segment(); otherMinusThis2 = new Segment(); if (this.IsEmpty) { otherMinusThis1 = otherSegment; return; } if (otherSegment.IsEmpty) { thisMinusOther1 = this; return; } if (this.UpperBound < otherSegment.LowerBound) { // do not intersect thisMinusOther1 = this; otherMinusThis1 = otherSegment; return; } if (this.LowerBound < otherSegment.LowerBound && this.UpperBound >= otherSegment.LowerBound && this.UpperBound <= otherSegment.UpperBound) { thisMinusOther1 = new Segment(this.LowerBound, otherSegment.LowerBound - 1); intersection = new Segment(otherSegment.LowerBound, this.UpperBound); otherMinusThis1 = new Segment(this.UpperBound + 1, otherSegment.UpperBound); return; } if (this.LowerBound >= otherSegment.LowerBound && this.UpperBound <= otherSegment.UpperBound) { intersection = this; otherMinusThis1 = new Segment(otherSegment.LowerBound, this.LowerBound - 1); otherMinusThis2 = new Segment(this.UpperBound + 1, otherSegment.UpperBound); return; } otherSegment.CompareToSegment(this, out otherMinusThis1, out otherMinusThis2, out intersection, out thisMinusOther1, out thisMinusOther2); } } } ================================================ FILE: Telegram.EmojiPanel/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.EmojiPanel")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.EmojiPanel")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("755e1785-f75a-4a86-b0e1-ef202e134f1c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.EmojiPanel/Telegram.EmojiPanel.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {755E1785-F75A-4A86-B0E1-EF202E134F1C} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.EmojiPanel Telegram.EmojiPanel v4.0 $(TargetFrameworkVersion) WindowsPhone71 Silverlight false true true ..\ true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 ..\packages\WPtoolkit.4.2013.08.16\lib\sl4-windowsphone71\Microsoft.Phone.Controls.Toolkit.dll EmojiControl.xaml Designer MSBuild:Compile MSBuild:Compile Designer Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always Always {0C2F1B61-A8FE-45FB-8538-AA6925A415B6} Telegram.Api This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. ================================================ FILE: Telegram.EmojiPanel/TelegramRichTextBox.cs ================================================ using System; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; namespace Telegram.EmojiPanel { public class TelegramRichTextBox : Control { public static readonly DependencyProperty MoreElementProperty = DependencyProperty.Register( "MoreElement", typeof (FrameworkElement), typeof (TelegramRichTextBox), new PropertyMetadata(default(FrameworkElement), OnMoreElementChanged)); private static void OnMoreElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var telegramRichTextBox = (TelegramRichTextBox) d; telegramRichTextBox.OnSizeChanged(null, null); } public FrameworkElement MoreElement { get { return (FrameworkElement) GetValue(MoreElementProperty); } set { SetValue(MoreElementProperty, value); } } public static readonly DependencyProperty TextScaleFactorProperty = DependencyProperty.Register( "TextScaleFactor", typeof (double), typeof (TelegramRichTextBox), new PropertyMetadata(1.0, OnFontScaleFactorChanged)); private static void OnFontScaleFactorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = (TelegramRichTextBox)d; if (textBox != null && textBox._stackPanel != null) { foreach (var child in textBox._stackPanel.Children) { var richTextBox = child as RichTextBox; if (richTextBox != null) { richTextBox.FontSize = textBox._defaultFontSize*(double) e.NewValue; foreach (var block in richTextBox.Blocks) { var paragraph = block as Paragraph; if (paragraph != null) { foreach (var inline in paragraph.Inlines) { var uiContainer = inline as InlineUIContainer; if (uiContainer != null) { var image = uiContainer.Child as Image; if (image != null) { var size = 27.0 * (double)e.NewValue; image.Height = size; image.Width = size; } } } } } } } } } private double _defaultFontSize; public double TextScaleFactor { get { return (double) GetValue(TextScaleFactorProperty); } set { SetValue(TextScaleFactorProperty, value); } } private StackPanel _stackPanel; private TextBlock measureTxt; public TelegramRichTextBox() { DefaultStyleKey = typeof(TelegramRichTextBox); SizeChanged += OnSizeChanged; } private void OnSizeChanged(object sender, SizeChangedEventArgs e) { if (MoreElement != null) { if (ActualHeight > 0.0 && MaxHeight > 0.0 && ActualHeight >= MaxHeight) { MoreElement.Visibility = Visibility.Visible; } else { MoreElement.Visibility = Visibility.Collapsed; } } } public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(TelegramRichTextBox), new PropertyMetadata("", OnTextPropertyChanged)); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } public static readonly DependencyProperty DateTextProperty = DependencyProperty.Register( "DateText", typeof (string), typeof (TelegramRichTextBox), new PropertyMetadata(default(string))); public string DateText { get { return (string) GetValue(DateTextProperty); } set { SetValue(DateTextProperty, value); } } private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TelegramRichTextBox source = (TelegramRichTextBox)d; string value = (string)e.NewValue; source.ParseText(value); } public override void OnApplyTemplate() { _defaultFontSize = FontSize; _stackPanel = GetTemplateChild("StackPanel") as StackPanel; ParseText(Text); base.OnApplyTemplate(); } private void ParseText(string value) { if (value == null) { value = ""; } if (_stackPanel == null) { return; } // Clear previous TextBlocks _stackPanel.Children.Clear(); bool fitIn2000Pixels = CheckFitInMaxRenderHeight(value); if (fitIn2000Pixels) { var textBlock = GetTextBlock(); BrowserNavigationService.SetText(textBlock, value); _stackPanel.Children.Add(textBlock); } else { ParseLineExtended(value); } } private readonly int MAX_STR_LENGTH = 1100; private void ParseLineExtended(string allText) { if (string.IsNullOrEmpty(allText)) return; int cutIndex = MAX_STR_LENGTH; if (cutIndex >= allText.Length) cutIndex = allText.Length - 1; var endOfSentenceIndAfterCut = allText.IndexOf(".", cutIndex); if (endOfSentenceIndAfterCut >= 0 && endOfSentenceIndAfterCut - cutIndex < 200) { cutIndex = endOfSentenceIndAfterCut; } else { var whiteSpaceIndAfterCut = allText.IndexOf(' ', cutIndex); if (whiteSpaceIndAfterCut >= 0 && whiteSpaceIndAfterCut - cutIndex < 100) { cutIndex = whiteSpaceIndAfterCut; } } // add all whitespaces before cut while (cutIndex + 1 < allText.Length && allText[cutIndex + 1] == ' ') { cutIndex++; } string leftSide = allText.Substring(0, cutIndex + 1); RichTextBox textBlock = this.GetTextBlock(); BrowserNavigationService.SetText(textBlock, leftSide); this._stackPanel.Children.Add(textBlock); allText = allText.Substring(cutIndex + 1); if (allText.Length > 0) { ParseLineExtended(allText); } } private bool CheckFitInMaxRenderHeight(string value) { return value.Length <= MAX_STR_LENGTH; } private RichTextBox GetTextBlock() { var textBlock = new RichTextBox(); textBlock.TextWrapping = TextWrapping.Wrap; textBlock.IsReadOnly = true; textBlock.FontSize = FontSize * TextScaleFactor; textBlock.FontFamily = FontFamily; textBlock.HorizontalContentAlignment = HorizontalContentAlignment; textBlock.Foreground = Foreground; textBlock.Padding = new Thickness(0, 0, 0, 0); return textBlock; } } public class Utils { public static readonly Regex HyperlinkRegex = new Regex("(?i)\\b(((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))|([a-z0-9.\\-]+(\\.ru|\\.com|\\.net|\\.org|\\.us|\\.it|\\.co\\.uk)(?![a-z0-9]))|([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]*[a-zA-Z0-9-]+))"); public static string GetFormattedLink(string link) { var flag = link.EndsWith(","); if (flag && link.Length > 1) link = link.Substring(0, link.Length - 1); if (!link.StartsWith("http", StringComparison.OrdinalIgnoreCase)) link = "http://" + link; return link; } public static Inline GetTextBlock(string text) { return new Run { Text = text }; } public static Inline GetHyperlinkBlock(string text, string link) { var hyperlink = new Hyperlink(); hyperlink.Inlines.Add(text); hyperlink.NavigateUri = new Uri(link, UriKind.Absolute); return hyperlink; } public static Inline GetEmojiBlock(string emoji) { var uiContainer = new InlineUIContainer(); uiContainer.Child = new Image { Source = GetEmojiSource(emoji), Width = 30, Height = 30 }; return uiContainer; } public static ImageSource GetEmojiSource(string emoji) { return new BitmapImage(new Uri(emoji)); } public static Regex GetRegex(bool supportEmoji) { if (supportEmoji) { return HyperlinkRegex; } return HyperlinkRegex; } } } ================================================ FILE: Telegram.EmojiPanel/TestScrollableTextBlock.cs ================================================ using System.Windows; using System.Windows.Controls; namespace Telegram.EmojiPanel { public class TestScrollableTextBlock : Control { private StackPanel stackPanel; private TextBlock measureTxt; public TestScrollableTextBlock() { DefaultStyleKey = typeof(TestScrollableTextBlock); } public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(TestScrollableTextBlock), new PropertyMetadata("", OnTextPropertyChanged)); public static readonly DependencyProperty LineHeightProperty = DependencyProperty.Register( "LineHeight", typeof(double), typeof(TestScrollableTextBlock), null); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //TestScrollableTextBlock source = (TestScrollableTextBlock)d; //string value = (string)e.NewValue; //source.ParseText(value); } public override void OnApplyTemplate() { stackPanel = GetTemplateChild("StackPanel") as StackPanel; ParseText(Text); base.OnApplyTemplate(); } private void ParseText(string value) { if (value == null) { value = ""; } if (this.stackPanel == null) { return; } // Clear previous TextBlocks this.stackPanel.Children.Clear(); bool fitIn2000Pixels = CheckFitInMaxRenderHeight(value); if (fitIn2000Pixels) { RichTextBox textBlock = this.GetTextBlock(); BrowserNavigationService.SetText(textBlock, value); this.stackPanel.Children.Add(textBlock); } else { ParseLineExtended(value); } } private readonly int MAX_STR_LENGTH = 1100; private void ParseLineExtended(string allText) { if (string.IsNullOrEmpty(allText)) return; int cutIndex = MAX_STR_LENGTH; if (cutIndex >= allText.Length) cutIndex = allText.Length - 1; var endOfSentenceIndAfterCut = allText.IndexOf(".", cutIndex); if (endOfSentenceIndAfterCut >= 0 && endOfSentenceIndAfterCut - cutIndex < 200) { cutIndex = endOfSentenceIndAfterCut; } else { var whiteSpaceIndAfterCut = allText.IndexOf(' ', cutIndex); if (whiteSpaceIndAfterCut >= 0 && whiteSpaceIndAfterCut - cutIndex < 100) { cutIndex = whiteSpaceIndAfterCut; } } // add all whitespaces before cut while (cutIndex + 1 < allText.Length && allText[cutIndex + 1] == ' ') { cutIndex++; } string leftSide = allText.Substring(0, cutIndex + 1); RichTextBox textBlock = this.GetTextBlock(); BrowserNavigationService.SetText(textBlock, leftSide); this.stackPanel.Children.Add(textBlock); allText = allText.Substring(cutIndex + 1); if (allText.Length > 0) { ParseLineExtended(allText); } } private bool CheckFitInMaxRenderHeight(string value) { return value.Length <= MAX_STR_LENGTH; } private RichTextBox GetTextBlock() { RichTextBox textBlock = new RichTextBox(); textBlock.TextWrapping = TextWrapping.Wrap; textBlock.IsReadOnly = true; textBlock.FontSize = this.FontSize; textBlock.FontFamily = this.FontFamily; textBlock.HorizontalContentAlignment = this.HorizontalContentAlignment; textBlock.Foreground = Foreground; textBlock.Padding = new Thickness(-12, 0, 0, 0); return textBlock; } } } ================================================ FILE: Telegram.EmojiPanel/Themes/generic.xaml ================================================  ================================================ FILE: Telegram.EmojiPanel/packages.config ================================================  ================================================ FILE: Telegram.EmojiPanel.WP8/Properties/AssemblyInfo.cs ================================================ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Telegram.EmojiPanel.WP8")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Telegram.EmojiPanel.WP8")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8223db37-4a07-4e16-91a1-b28e822c9dc0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")] ================================================ FILE: Telegram.EmojiPanel.WP8/Telegram.EmojiPanel.WP8.csproj ================================================  Debug AnyCPU 10.0.20506 2.0 {8223DB37-4A07-4E16-91A1-B28E822C9DC0} {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties Telegram.EmojiPanel Telegram.EmojiPanel WindowsPhone v8.0 $(TargetFrameworkVersion) false true 11.0 true ..\ true true full false Bin\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\Release TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 true full false Bin\x86\Debug DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE true true prompt 4 pdbonly true Bin\x86\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;WP8 true true prompt 4 true full false Bin\ARM\Debug TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;WP8 true true prompt 4 pdbonly true Bin\ARM\Release TRACE;SILVERLIGHT;WINDOWS_PHONE;WP8 true true prompt 4 BrowserNavigationService.cs Controls\Emoji\EmojiControl.xaml.cs EmojiControl.xaml Controls\Emoji\EmojiData.cs Controls\Emoji\EmojiSpriteItem.cs Controls\Utilites\DelayedExecutor.cs Controls\Utilites\Helpers.cs Controls\Utilites\MyListItemBase.cs Controls\Utilites\MyVirtualizingPanel.cs Controls\Utilites\VirtSegment.cs Controls\Utilites\VListItemBase.cs TelegramRichTextBox.cs TestScrollableTextBlock.cs Controls\Emoji\EmojiControl.xaml MSBuild:Compile Designer Themes\generic.xaml MSBuild:Compile Designer Assets\emoji.abc-WXGA.png Assets\emoji.backspace-WXGA.png Assets\emoji.category.1-WXGA.png Assets\emoji.category.2-WXGA.png Assets\emoji.category.3-WXGA.png Assets\emoji.category.4-WXGA.png Assets\emoji.category.5-WXGA.png Assets\emoji.recent-WXGA.png Assets\Emoji\Separated\002320E3.png Assets\Emoji\Separated\003020E3.png Assets\Emoji\Separated\003120E3.png Assets\Emoji\Separated\003220E3.png Assets\Emoji\Separated\003320E3.png Assets\Emoji\Separated\003420E3.png Assets\Emoji\Separated\003520E3.png Assets\Emoji\Separated\003620E3.png Assets\Emoji\Separated\003720E3.png Assets\Emoji\Separated\003820E3.png Assets\Emoji\Separated\003920E3.png Assets\Emoji\Separated\00a9.png Assets\Emoji\Separated\00ae.png Assets\Emoji\Separated\203C.png Assets\Emoji\Separated\2049.png Assets\Emoji\Separated\2122.png Assets\Emoji\Separated\2139.png Assets\Emoji\Separated\2194.png Assets\Emoji\Separated\2195.png Assets\Emoji\Separated\2196.png Assets\Emoji\Separated\2197.png Assets\Emoji\Separated\2198.png Assets\Emoji\Separated\2199.png Assets\Emoji\Separated\21A9.png Assets\Emoji\Separated\21AA.png Assets\Emoji\Separated\231A.png Assets\Emoji\Separated\231B.png Assets\Emoji\Separated\23e9.png Assets\Emoji\Separated\23ea.png Assets\Emoji\Separated\23eb.png Assets\Emoji\Separated\23ec.png Assets\Emoji\Separated\23f0.png Assets\Emoji\Separated\23f3.png Assets\Emoji\Separated\24C2.png Assets\Emoji\Separated\25AA.png Assets\Emoji\Separated\25AB.png Assets\Emoji\Separated\25B6.png Assets\Emoji\Separated\25C0.png Assets\Emoji\Separated\25FB.png Assets\Emoji\Separated\25FC.png Assets\Emoji\Separated\25FD.png Assets\Emoji\Separated\25FE.png Assets\Emoji\Separated\2600.png Assets\Emoji\Separated\2601.png Assets\Emoji\Separated\260E.png Assets\Emoji\Separated\2611.png Assets\Emoji\Separated\2614.png Assets\Emoji\Separated\2615.png Assets\Emoji\Separated\261D.png Assets\Emoji\Separated\263A.png Assets\Emoji\Separated\2648.png Assets\Emoji\Separated\2649.png Assets\Emoji\Separated\264A.png Assets\Emoji\Separated\264B.png Assets\Emoji\Separated\264C.png Assets\Emoji\Separated\264D.png Assets\Emoji\Separated\264E.png Assets\Emoji\Separated\264F.png Assets\Emoji\Separated\2650.png Assets\Emoji\Separated\2651.png Assets\Emoji\Separated\2652.png Assets\Emoji\Separated\2653.png Assets\Emoji\Separated\2660.png Assets\Emoji\Separated\2663.png Assets\Emoji\Separated\2665.png Assets\Emoji\Separated\2666.png Assets\Emoji\Separated\2668.png Assets\Emoji\Separated\267B.png Assets\Emoji\Separated\267F.png Assets\Emoji\Separated\2693.png Assets\Emoji\Separated\26A0.png Assets\Emoji\Separated\26A1.png Assets\Emoji\Separated\26AA.png Assets\Emoji\Separated\26AB.png Assets\Emoji\Separated\26BD.png Assets\Emoji\Separated\26BE.png Assets\Emoji\Separated\26C4.png Assets\Emoji\Separated\26C5.png Assets\Emoji\Separated\26ce.png Assets\Emoji\Separated\26D4.png Assets\Emoji\Separated\26EA.png Assets\Emoji\Separated\26F2.png Assets\Emoji\Separated\26F3.png Assets\Emoji\Separated\26F5.png Assets\Emoji\Separated\26FA.png Assets\Emoji\Separated\26FD.png Assets\Emoji\Separated\2702.png Assets\Emoji\Separated\2705.png Assets\Emoji\Separated\2708.png Assets\Emoji\Separated\2709.png Assets\Emoji\Separated\270a.png Assets\Emoji\Separated\270b.png Assets\Emoji\Separated\270C.png Assets\Emoji\Separated\270F.png Assets\Emoji\Separated\2712.png Assets\Emoji\Separated\2714.png Assets\Emoji\Separated\2716.png Assets\Emoji\Separated\2728.png Assets\Emoji\Separated\2733.png Assets\Emoji\Separated\2734.png Assets\Emoji\Separated\2744.png Assets\Emoji\Separated\2747.png Assets\Emoji\Separated\274c.png Assets\Emoji\Separated\274e.png Assets\Emoji\Separated\2753.png Assets\Emoji\Separated\2754.png Assets\Emoji\Separated\2755.png Assets\Emoji\Separated\2757.png Assets\Emoji\Separated\2764.png Assets\Emoji\Separated\2795.png Assets\Emoji\Separated\2796.png Assets\Emoji\Separated\2797.png Assets\Emoji\Separated\27A1.png Assets\Emoji\Separated\27b0.png Assets\Emoji\Separated\27bf.png Assets\Emoji\Separated\2934.png Assets\Emoji\Separated\2935.png Assets\Emoji\Separated\2B05.png Assets\Emoji\Separated\2B06.png Assets\Emoji\Separated\2B07.png Assets\Emoji\Separated\2B1B.png Assets\Emoji\Separated\2B1C.png Assets\Emoji\Separated\2B50.png Assets\Emoji\Separated\2B55.png Assets\Emoji\Separated\3030.png Assets\Emoji\Separated\303D.png Assets\Emoji\Separated\3297.png Assets\Emoji\Separated\3299.png Assets\Emoji\Separated\D83CDC04.png Assets\Emoji\Separated\D83CDCCF.png Assets\Emoji\Separated\D83CDD70.png Assets\Emoji\Separated\D83CDD71.png Assets\Emoji\Separated\D83CDD7E.png Assets\Emoji\Separated\D83CDD7F.png Assets\Emoji\Separated\D83CDD8E.png Assets\Emoji\Separated\D83CDD91.png Assets\Emoji\Separated\D83CDD92.png Assets\Emoji\Separated\D83CDD93.png Assets\Emoji\Separated\D83CDD94.png Assets\Emoji\Separated\D83CDD95.png Assets\Emoji\Separated\D83CDD96.png Assets\Emoji\Separated\D83CDD97.png Assets\Emoji\Separated\D83CDD98.png Assets\Emoji\Separated\D83CDD99.png Assets\Emoji\Separated\D83CDD9A.png Assets\Emoji\Separated\D83CDDE8D83CDDF3.png Assets\Emoji\Separated\D83CDDE9D83CDDEA.png Assets\Emoji\Separated\D83CDDEAD83CDDF8.png Assets\Emoji\Separated\D83CDDEBD83CDDF7.png Assets\Emoji\Separated\D83CDDECD83CDDE7.png Assets\Emoji\Separated\D83CDDEED83CDDF9.png Assets\Emoji\Separated\D83CDDEFD83CDDF5.png Assets\Emoji\Separated\D83CDDF0D83CDDF7.png Assets\Emoji\Separated\D83CDDF7D83CDDFA.png Assets\Emoji\Separated\D83CDDFAD83CDDF8.png Assets\Emoji\Separated\D83CDE01.png Assets\Emoji\Separated\D83CDE02.png Assets\Emoji\Separated\D83CDE1A.png Assets\Emoji\Separated\D83CDE2F.png Assets\Emoji\Separated\D83CDE32.png Assets\Emoji\Separated\D83CDE33.png Assets\Emoji\Separated\D83CDE34.png Assets\Emoji\Separated\D83CDE35.png Assets\Emoji\Separated\D83CDE36.png Assets\Emoji\Separated\D83CDE37.png Assets\Emoji\Separated\D83CDE38.png Assets\Emoji\Separated\D83CDE39.png Assets\Emoji\Separated\D83CDE3A.png Assets\Emoji\Separated\D83CDE50.png Assets\Emoji\Separated\D83CDE51.png Assets\Emoji\Separated\D83CDF00.png Assets\Emoji\Separated\D83CDF01.png Assets\Emoji\Separated\D83CDF02.png Assets\Emoji\Separated\D83CDF03.png Assets\Emoji\Separated\D83CDF04.png Assets\Emoji\Separated\D83CDF05.png Assets\Emoji\Separated\D83CDF06.png Assets\Emoji\Separated\D83CDF07.png Assets\Emoji\Separated\D83CDF08.png Assets\Emoji\Separated\D83CDF09.png Assets\Emoji\Separated\D83CDF0A.png Assets\Emoji\Separated\D83CDF0B.png Assets\Emoji\Separated\D83CDF0C.png Assets\Emoji\Separated\D83CDF0D.png Assets\Emoji\Separated\D83CDF0E.png Assets\Emoji\Separated\D83CDF0F.png Assets\Emoji\Separated\D83CDF10.png Assets\Emoji\Separated\D83CDF11.png Assets\Emoji\Separated\D83CDF12.png Assets\Emoji\Separated\D83CDF13.png Assets\Emoji\Separated\D83CDF14.png Assets\Emoji\Separated\D83CDF15.png Assets\Emoji\Separated\D83CDF16.png Assets\Emoji\Separated\D83CDF17.png Assets\Emoji\Separated\D83CDF18.png Assets\Emoji\Separated\D83CDF19.png Assets\Emoji\Separated\D83CDF1A.png Assets\Emoji\Separated\D83CDF1B.png Assets\Emoji\Separated\D83CDF1C.png Assets\Emoji\Separated\D83CDF1D.png Assets\Emoji\Separated\D83CDF1E.png Assets\Emoji\Separated\D83CDF1F.png Assets\Emoji\Separated\D83CDF20.png Assets\Emoji\Separated\D83CDF30.png Assets\Emoji\Separated\D83CDF31.png Assets\Emoji\Separated\D83CDF32.png Assets\Emoji\Separated\D83CDF33.png Assets\Emoji\Separated\D83CDF34.png Assets\Emoji\Separated\D83CDF35.png Assets\Emoji\Separated\D83CDF37.png Assets\Emoji\Separated\D83CDF38.png Assets\Emoji\Separated\D83CDF39.png Assets\Emoji\Separated\D83CDF3A.png Assets\Emoji\Separated\D83CDF3B.png Assets\Emoji\Separated\D83CDF3C.png Assets\Emoji\Separated\D83CDF3D.png Assets\Emoji\Separated\D83CDF3E.png Assets\Emoji\Separated\D83CDF3F.png Assets\Emoji\Separated\D83CDF40.png Assets\Emoji\Separated\D83CDF41.png Assets\Emoji\Separated\D83CDF42.png Assets\Emoji\Separated\D83CDF43.png Assets\Emoji\Separated\D83CDF44.png Assets\Emoji\Separated\D83CDF45.png Assets\Emoji\Separated\D83CDF46.png Assets\Emoji\Separated\D83CDF47.png Assets\Emoji\Separated\D83CDF48.png Assets\Emoji\Separated\D83CDF49.png Assets\Emoji\Separated\D83CDF4A.png Assets\Emoji\Separated\D83CDF4B.png Assets\Emoji\Separated\D83CDF4C.png Assets\Emoji\Separated\D83CDF4D.png Assets\Emoji\Separated\D83CDF4E.png Assets\Emoji\Separated\D83CDF4F.png Assets\Emoji\Separated\D83CDF50.png Assets\Emoji\Separated\D83CDF51.png Assets\Emoji\Separated\D83CDF52.png Assets\Emoji\Separated\D83CDF53.png Assets\Emoji\Separated\D83CDF54.png Assets\Emoji\Separated\D83CDF55.png Assets\Emoji\Separated\D83CDF56.png Assets\Emoji\Separated\D83CDF57.png Assets\Emoji\Separated\D83CDF58.png Assets\Emoji\Separated\D83CDF59.png Assets\Emoji\Separated\D83CDF5A.png Assets\Emoji\Separated\D83CDF5B.png Assets\Emoji\Separated\D83CDF5C.png Assets\Emoji\Separated\D83CDF5D.png Assets\Emoji\Separated\D83CDF5E.png Assets\Emoji\Separated\D83CDF5F.png Assets\Emoji\Separated\D83CDF60.png Assets\Emoji\Separated\D83CDF61.png Assets\Emoji\Separated\D83CDF62.png Assets\Emoji\Separated\D83CDF63.png Assets\Emoji\Separated\D83CDF64.png Assets\Emoji\Separated\D83CDF65.png Assets\Emoji\Separated\D83CDF66.png Assets\Emoji\Separated\D83CDF67.png Assets\Emoji\Separated\D83CDF68.png Assets\Emoji\Separated\D83CDF69.png Assets\Emoji\Separated\D83CDF6A.png Assets\Emoji\Separated\D83CDF6B.png Assets\Emoji\Separated\D83CDF6C.png Assets\Emoji\Separated\D83CDF6D.png Assets\Emoji\Separated\D83CDF6E.png Assets\Emoji\Separated\D83CDF6F.png Assets\Emoji\Separated\D83CDF70.png Assets\Emoji\Separated\D83CDF71.png Assets\Emoji\Separated\D83CDF72.png Assets\Emoji\Separated\D83CDF73.png Assets\Emoji\Separated\D83CDF74.png Assets\Emoji\Separated\D83CDF75.png Assets\Emoji\Separated\D83CDF76.png Assets\Emoji\Separated\D83CDF77.png Assets\Emoji\Separated\D83CDF78.png Assets\Emoji\Separated\D83CDF79.png Assets\Emoji\Separated\D83CDF7A.png Assets\Emoji\Separated\D83CDF7B.png Assets\Emoji\Separated\D83CDF7C.png Assets\Emoji\Separated\D83CDF80.png Assets\Emoji\Separated\D83CDF81.png Assets\Emoji\Separated\D83CDF82.png Assets\Emoji\Separated\D83CDF83.png Assets\Emoji\Separated\D83CDF84.png Assets\Emoji\Separated\D83CDF85.png Assets\Emoji\Separated\D83CDF86.png Assets\Emoji\Separated\D83CDF87.png Assets\Emoji\Separated\D83CDF88.png Assets\Emoji\Separated\D83CDF89.png Assets\Emoji\Separated\D83CDF8A.png Assets\Emoji\Separated\D83CDF8B.png Assets\Emoji\Separated\D83CDF8C.png Assets\Emoji\Separated\D83CDF8D.png Assets\Emoji\Separated\D83CDF8E.png Assets\Emoji\Separated\D83CDF8F.png Assets\Emoji\Separated\D83CDF90.png Assets\Emoji\Separated\D83CDF91.png Assets\Emoji\Separated\D83CDF92.png Assets\Emoji\Separated\D83CDF93.png Assets\Emoji\Separated\D83CDFA0.png Assets\Emoji\Separated\D83CDFA1.png Assets\Emoji\Separated\D83CDFA2.png Assets\Emoji\Separated\D83CDFA3.png Assets\Emoji\Separated\D83CDFA4.png Assets\Emoji\Separated\D83CDFA5.png Assets\Emoji\Separated\D83CDFA6.png Assets\Emoji\Separated\D83CDFA7.png Assets\Emoji\Separated\D83CDFA8.png Assets\Emoji\Separated\D83CDFA9.png Assets\Emoji\Separated\D83CDFAA.png Assets\Emoji\Separated\D83CDFAB.png Assets\Emoji\Separated\D83CDFAC.png Assets\Emoji\Separated\D83CDFAD.png Assets\Emoji\Separated\D83CDFAE.png Assets\Emoji\Separated\D83CDFAF.png Assets\Emoji\Separated\D83CDFB0.png Assets\Emoji\Separated\D83CDFB1.png Assets\Emoji\Separated\D83CDFB2.png Assets\Emoji\Separated\D83CDFB3.png Assets\Emoji\Separated\D83CDFB4.png Assets\Emoji\Separated\D83CDFB5.png Assets\Emoji\Separated\D83CDFB6.png Assets\Emoji\Separated\D83CDFB7.png Assets\Emoji\Separated\D83CDFB8.png Assets\Emoji\Separated\D83CDFB9.png Assets\Emoji\Separated\D83CDFBA.png Assets\Emoji\Separated\D83CDFBB.png Assets\Emoji\Separated\D83CDFBC.png Assets\Emoji\Separated\D83CDFBD.png Assets\Emoji\Separated\D83CDFBE.png Assets\Emoji\Separated\D83CDFBF.png Assets\Emoji\Separated\D83CDFC0.png Assets\Emoji\Separated\D83CDFC1.png Assets\Emoji\Separated\D83CDFC2.png Assets\Emoji\Separated\D83CDFC3.png Assets\Emoji\Separated\D83CDFC4.png Assets\Emoji\Separated\D83CDFC6.png Assets\Emoji\Separated\D83CDFC7.png Assets\Emoji\Separated\D83CDFC8.png Assets\Emoji\Separated\D83CDFC9.png Assets\Emoji\Separated\D83CDFCA.png Assets\Emoji\Separated\D83CDFE0.png Assets\Emoji\Separated\D83CDFE1.png Assets\Emoji\Separated\D83CDFE2.png Assets\Emoji\Separated\D83CDFE3.png Assets\Emoji\Separated\D83CDFE4.png Assets\Emoji\Separated\D83CDFE5.png Assets\Emoji\Separated\D83CDFE6.png Assets\Emoji\Separated\D83CDFE7.png Assets\Emoji\Separated\D83CDFE8.png Assets\Emoji\Separated\D83CDFE9.png Assets\Emoji\Separated\D83CDFEA.png Assets\Emoji\Separated\D83CDFEB.png Assets\Emoji\Separated\D83CDFEC.png Assets\Emoji\Separated\D83CDFED.png Assets\Emoji\Separated\D83CDFEE.png Assets\Emoji\Separated\D83CDFEF.png Assets\Emoji\Separated\D83CDFF0.png Assets\Emoji\Separated\D83DDC00.png Assets\Emoji\Separated\D83DDC01.png Assets\Emoji\Separated\D83DDC02.png Assets\Emoji\Separated\D83DDC03.png Assets\Emoji\Separated\D83DDC04.png Assets\Emoji\Separated\D83DDC05.png Assets\Emoji\Separated\D83DDC06.png Assets\Emoji\Separated\D83DDC07.png Assets\Emoji\Separated\D83DDC08.png Assets\Emoji\Separated\D83DDC09.png Assets\Emoji\Separated\D83DDC0A.png Assets\Emoji\Separated\D83DDC0B.png Assets\Emoji\Separated\D83DDC0C.png Assets\Emoji\Separated\D83DDC0D.png Assets\Emoji\Separated\D83DDC0E.png Assets\Emoji\Separated\D83DDC0F.png Assets\Emoji\Separated\D83DDC10.png Assets\Emoji\Separated\D83DDC11.png Assets\Emoji\Separated\D83DDC12.png Assets\Emoji\Separated\D83DDC13.png Assets\Emoji\Separated\D83DDC14.png Assets\Emoji\Separated\D83DDC15.png Assets\Emoji\Separated\D83DDC16.png Assets\Emoji\Separated\D83DDC17.png Assets\Emoji\Separated\D83DDC18.png Assets\Emoji\Separated\D83DDC19.png Assets\Emoji\Separated\D83DDC1A.png Assets\Emoji\Separated\D83DDC1B.png Assets\Emoji\Separated\D83DDC1C.png Assets\Emoji\Separated\D83DDC1D.png Assets\Emoji\Separated\D83DDC1E.png Assets\Emoji\Separated\D83DDC1F.png Assets\Emoji\Separated\D83DDC20.png Assets\Emoji\Separated\D83DDC21.png Assets\Emoji\Separated\D83DDC22.png Assets\Emoji\Separated\D83DDC23.png Assets\Emoji\Separated\D83DDC24.png Assets\Emoji\Separated\D83DDC25.png Assets\Emoji\Separated\D83DDC26.png Assets\Emoji\Separated\D83DDC27.png Assets\Emoji\Separated\D83DDC28.png Assets\Emoji\Separated\D83DDC29.png Assets\Emoji\Separated\D83DDC2A.png Assets\Emoji\Separated\D83DDC2B.png Assets\Emoji\Separated\D83DDC2C.png Assets\Emoji\Separated\D83DDC2D.png Assets\Emoji\Separated\D83DDC2E.png Assets\Emoji\Separated\D83DDC2F.png Assets\Emoji\Separated\D83DDC30.png Assets\Emoji\Separated\D83DDC31.png Assets\Emoji\Separated\D83DDC32.png Assets\Emoji\Separated\D83DDC33.png Assets\Emoji\Separated\D83DDC34.png Assets\Emoji\Separated\D83DDC35.png Assets\Emoji\Separated\D83DDC36.png Assets\Emoji\Separated\D83DDC37.png Assets\Emoji\Separated\D83DDC38.png Assets\Emoji\Separated\D83DDC39.png Assets\Emoji\Separated\D83DDC3A.png Assets\Emoji\Separated\D83DDC3B.png Assets\Emoji\Separated\D83DDC3C.png Assets\Emoji\Separated\D83DDC3D.png Assets\Emoji\Separated\D83DDC3E.png Assets\Emoji\Separated\D83DDC40.png Assets\Emoji\Separated\D83DDC42.png Assets\Emoji\Separated\D83DDC43.png Assets\Emoji\Separated\D83DDC44.png Assets\Emoji\Separated\D83DDC45.png Assets\Emoji\Separated\D83DDC46.png Assets\Emoji\Separated\D83DDC47.png Assets\Emoji\Separated\D83DDC48.png Assets\Emoji\Separated\D83DDC49.png Assets\Emoji\Separated\D83DDC4A.png Assets\Emoji\Separated\D83DDC4B.png Assets\Emoji\Separated\D83DDC4C.png Assets\Emoji\Separated\D83DDC4D.png Assets\Emoji\Separated\D83DDC4E.png Assets\Emoji\Separated\D83DDC4F.png Assets\Emoji\Separated\D83DDC50.png Assets\Emoji\Separated\D83DDC51.png Assets\Emoji\Separated\D83DDC52.png Assets\Emoji\Separated\D83DDC53.png Assets\Emoji\Separated\D83DDC54.png Assets\Emoji\Separated\D83DDC55.png Assets\Emoji\Separated\D83DDC56.png Assets\Emoji\Separated\D83DDC57.png Assets\Emoji\Separated\D83DDC58.png Assets\Emoji\Separated\D83DDC59.png Assets\Emoji\Separated\D83DDC5A.png Assets\Emoji\Separated\D83DDC5B.png Assets\Emoji\Separated\D83DDC5C.png Assets\Emoji\Separated\D83DDC5D.png Assets\Emoji\Separated\D83DDC5E.png Assets\Emoji\Separated\D83DDC5F.png Assets\Emoji\Separated\D83DDC60.png Assets\Emoji\Separated\D83DDC61.png Assets\Emoji\Separated\D83DDC62.png Assets\Emoji\Separated\D83DDC63.png Assets\Emoji\Separated\D83DDC64.png Assets\Emoji\Separated\D83DDC65.png Assets\Emoji\Separated\D83DDC66.png Assets\Emoji\Separated\D83DDC67.png Assets\Emoji\Separated\D83DDC68.png Assets\Emoji\Separated\D83DDC69.png Assets\Emoji\Separated\D83DDC6A.png Assets\Emoji\Separated\D83DDC6B.png Assets\Emoji\Separated\D83DDC6C.png Assets\Emoji\Separated\D83DDC6D.png Assets\Emoji\Separated\D83DDC6E.png Assets\Emoji\Separated\D83DDC6F.png Assets\Emoji\Separated\D83DDC70.png Assets\Emoji\Separated\D83DDC71.png Assets\Emoji\Separated\D83DDC72.png Assets\Emoji\Separated\D83DDC73.png Assets\Emoji\Separated\D83DDC74.png Assets\Emoji\Separated\D83DDC75.png Assets\Emoji\Separated\D83DDC76.png Assets\Emoji\Separated\D83DDC77.png Assets\Emoji\Separated\D83DDC78.png Assets\Emoji\Separated\D83DDC79.png Assets\Emoji\Separated\D83DDC7A.png Assets\Emoji\Separated\D83DDC7B.png Assets\Emoji\Separated\D83DDC7C.png Assets\Emoji\Separated\D83DDC7D.png Assets\Emoji\Separated\D83DDC7E.png Assets\Emoji\Separated\D83DDC7F.png Assets\Emoji\Separated\D83DDC80.png Assets\Emoji\Separated\D83DDC81.png Assets\Emoji\Separated\D83DDC82.png Assets\Emoji\Separated\D83DDC83.png Assets\Emoji\Separated\D83DDC84.png Assets\Emoji\Separated\D83DDC85.png Assets\Emoji\Separated\D83DDC86.png Assets\Emoji\Separated\D83DDC87.png Assets\Emoji\Separated\D83DDC88.png Assets\Emoji\Separated\D83DDC89.png Assets\Emoji\Separated\D83DDC8A.png Assets\Emoji\Separated\D83DDC8B.png Assets\Emoji\Separated\D83DDC8C.png Assets\Emoji\Separated\D83DDC8D.png Assets\Emoji\Separated\D83DDC8E.png Assets\Emoji\Separated\D83DDC8F.png Assets\Emoji\Separated\D83DDC90.png Assets\Emoji\Separated\D83DDC91.png Assets\Emoji\Separated\D83DDC92.png Assets\Emoji\Separated\D83DDC93.png Assets\Emoji\Separated\D83DDC94.png Assets\Emoji\Separated\D83DDC95.png Assets\Emoji\Separated\D83DDC96.png Assets\Emoji\Separated\D83DDC97.png Assets\Emoji\Separated\D83DDC98.png Assets\Emoji\Separated\D83DDC99.png Assets\Emoji\Separated\D83DDC9A.png Assets\Emoji\Separated\D83DDC9B.png Assets\Emoji\Separated\D83DDC9C.png Assets\Emoji\Separated\D83DDC9D.png Assets\Emoji\Separated\D83DDC9E.png Assets\Emoji\Separated\D83DDC9F.png Assets\Emoji\Separated\D83DDCA0.png Assets\Emoji\Separated\D83DDCA1.png Assets\Emoji\Separated\D83DDCA2.png Assets\Emoji\Separated\D83DDCA3.png Assets\Emoji\Separated\D83DDCA4.png Assets\Emoji\Separated\D83DDCA5.png Assets\Emoji\Separated\D83DDCA6.png Assets\Emoji\Separated\D83DDCA7.png Assets\Emoji\Separated\D83DDCA8.png Assets\Emoji\Separated\D83DDCA9.png Assets\Emoji\Separated\D83DDCAA.png Assets\Emoji\Separated\D83DDCAB.png Assets\Emoji\Separated\D83DDCAC.png Assets\Emoji\Separated\D83DDCAD.png Assets\Emoji\Separated\D83DDCAE.png Assets\Emoji\Separated\D83DDCAF.png Assets\Emoji\Separated\D83DDCB0.png Assets\Emoji\Separated\D83DDCB1.png Assets\Emoji\Separated\D83DDCB2.png Assets\Emoji\Separated\D83DDCB3.png Assets\Emoji\Separated\D83DDCB4.png Assets\Emoji\Separated\D83DDCB5.png Assets\Emoji\Separated\D83DDCB6.png Assets\Emoji\Separated\D83DDCB7.png Assets\Emoji\Separated\D83DDCB8.png Assets\Emoji\Separated\D83DDCB9.png Assets\Emoji\Separated\D83DDCBA.png Assets\Emoji\Separated\D83DDCBB.png Assets\Emoji\Separated\D83DDCBC.png Assets\Emoji\Separated\D83DDCBD.png Assets\Emoji\Separated\D83DDCBE.png Assets\Emoji\Separated\D83DDCBF.png Assets\Emoji\Separated\D83DDCC0.png Assets\Emoji\Separated\D83DDCC1.png Assets\Emoji\Separated\D83DDCC2.png Assets\Emoji\Separated\D83DDCC3.png Assets\Emoji\Separated\D83DDCC4.png Assets\Emoji\Separated\D83DDCC5.png Assets\Emoji\Separated\D83DDCC6.png Assets\Emoji\Separated\D83DDCC7.png Assets\Emoji\Separated\D83DDCC8.png Assets\Emoji\Separated\D83DDCC9.png Assets\Emoji\Separated\D83DDCCA.png Assets\Emoji\Separated\D83DDCCB.png Assets\Emoji\Separated\D83DDCCC.png Assets\Emoji\Separated\D83DDCCD.png Assets\Emoji\Separated\D83DDCCE.png Assets\Emoji\Separated\D83DDCCF.png Assets\Emoji\Separated\D83DDCD0.png Assets\Emoji\Separated\D83DDCD1.png Assets\Emoji\Separated\D83DDCD2.png Assets\Emoji\Separated\D83DDCD3.png Assets\Emoji\Separated\D83DDCD4.png Assets\Emoji\Separated\D83DDCD5.png Assets\Emoji\Separated\D83DDCD6.png Assets\Emoji\Separated\D83DDCD7.png Assets\Emoji\Separated\D83DDCD8.png Assets\Emoji\Separated\D83DDCD9.png Assets\Emoji\Separated\D83DDCDA.png Assets\Emoji\Separated\D83DDCDB.png Assets\Emoji\Separated\D83DDCDC.png Assets\Emoji\Separated\D83DDCDD.png Assets\Emoji\Separated\D83DDCDE.png Assets\Emoji\Separated\D83DDCDF.png Assets\Emoji\Separated\D83DDCE0.png Assets\Emoji\Separated\D83DDCE1.png Assets\Emoji\Separated\D83DDCE2.png Assets\Emoji\Separated\D83DDCE3.png Assets\Emoji\Separated\D83DDCE4.png Assets\Emoji\Separated\D83DDCE5.png Assets\Emoji\Separated\D83DDCE6.png Assets\Emoji\Separated\D83DDCE7.png Assets\Emoji\Separated\D83DDCE8.png Assets\Emoji\Separated\D83DDCE9.png Assets\Emoji\Separated\D83DDCEA.png Assets\Emoji\Separated\D83DDCEB.png Assets\Emoji\Separated\D83DDCEC.png Assets\Emoji\Separated\D83DDCED.png Assets\Emoji\Separated\D83DDCEE.png Assets\Emoji\Separated\D83DDCEF.png Assets\Emoji\Separated\D83DDCF0.png Assets\Emoji\Separated\D83DDCF1.png Assets\Emoji\Separated\D83DDCF2.png Assets\Emoji\Separated\D83DDCF3.png Assets\Emoji\Separated\D83DDCF4.png Assets\Emoji\Separated\D83DDCF5.png Assets\Emoji\Separated\D83DDCF6.png Assets\Emoji\Separated\D83DDCF7.png Assets\Emoji\Separated\D83DDCF9.png Assets\Emoji\Separated\D83DDCFA.png Assets\Emoji\Separated\D83DDCFB.png Assets\Emoji\Separated\D83DDCFC.png Assets\Emoji\Separated\D83DDD00.png Assets\Emoji\Separated\D83DDD01.png Assets\Emoji\Separated\D83DDD02.png Assets\Emoji\Separated\D83DDD03.png Assets\Emoji\Separated\D83DDD04.png Assets\Emoji\Separated\D83DDD05.png Assets\Emoji\Separated\D83DDD06.png Assets\Emoji\Separated\D83DDD07.png Assets\Emoji\Separated\D83DDD08.png Assets\Emoji\Separated\D83DDD09.png Assets\Emoji\Separated\D83DDD0A.png Assets\Emoji\Separated\D83DDD0B.png Assets\Emoji\Separated\D83DDD0C.png Assets\Emoji\Separated\D83DDD0D.png Assets\Emoji\Separated\D83DDD0E.png Assets\Emoji\Separated\D83DDD0F.png Assets\Emoji\Separated\D83DDD10.png Assets\Emoji\Separated\D83DDD11.png Assets\Emoji\Separated\D83DDD12.png Assets\Emoji\Separated\D83DDD13.png Assets\Emoji\Separated\D83DDD14.png Assets\Emoji\Separated\D83DDD15.png Assets\Emoji\Separated\D83DDD16.png Assets\Emoji\Separated\D83DDD17.png Assets\Emoji\Separated\D83DDD18.png Assets\Emoji\Separated\D83DDD19.png Assets\Emoji\Separated\D83DDD1A.png Assets\Emoji\Separated\D83DDD1B.png Assets\Emoji\Separated\D83DDD1C.png Assets\Emoji\Separated\D83DDD1D.png Assets\Emoji\Separated\D83DDD1E.png Assets\Emoji\Separated\D83DDD1F.png Assets\Emoji\Separated\D83DDD20.png Assets\Emoji\Separated\D83DDD21.png Assets\Emoji\Separated\D83DDD22.png Assets\Emoji\Separated\D83DDD23.png Assets\Emoji\Separated\D83DDD24.png Assets\Emoji\Separated\D83DDD25.png Assets\Emoji\Separated\D83DDD26.png Assets\Emoji\Separated\D83DDD27.png Assets\Emoji\Separated\D83DDD28.png Assets\Emoji\Separated\D83DDD29.png Assets\Emoji\Separated\D83DDD2A.png Assets\Emoji\Separated\D83DDD2B.png Assets\Emoji\Separated\D83DDD2C.png Assets\Emoji\Separated\D83DDD2D.png Assets\Emoji\Separated\D83DDD2E.png Assets\Emoji\Separated\D83DDD2F.png Assets\Emoji\Separated\D83DDD30.png Assets\Emoji\Separated\D83DDD31.png Assets\Emoji\Separated\D83DDD32.png Assets\Emoji\Separated\D83DDD33.png Assets\Emoji\Separated\D83DDD34.png Assets\Emoji\Separated\D83DDD35.png Assets\Emoji\Separated\D83DDD36.png Assets\Emoji\Separated\D83DDD37.png Assets\Emoji\Separated\D83DDD38.png Assets\Emoji\Separated\D83DDD39.png Assets\Emoji\Separated\D83DDD3A.png Assets\Emoji\Separated\D83DDD3B.png Assets\Emoji\Separated\D83DDD3C.png Assets\Emoji\Separated\D83DDD3D.png Assets\Emoji\Separated\D83DDD50.png Assets\Emoji\Separated\D83DDD51.png Assets\Emoji\Separated\D83DDD52.png Assets\Emoji\Separated\D83DDD53.png Assets\Emoji\Separated\D83DDD54.png Assets\Emoji\Separated\D83DDD55.png Assets\Emoji\Separated\D83DDD56.png Assets\Emoji\Separated\D83DDD57.png Assets\Emoji\Separated\D83DDD58.png Assets\Emoji\Separated\D83DDD59.png Assets\Emoji\Separated\D83DDD5A.png Assets\Emoji\Separated\D83DDD5B.png Assets\Emoji\Separated\D83DDD5C.png Assets\Emoji\Separated\D83DDD5D.png Assets\Emoji\Separated\D83DDD5E.png Assets\Emoji\Separated\D83DDD5F.png Assets\Emoji\Separated\D83DDD60.png Assets\Emoji\Separated\D83DDD61.png Assets\Emoji\Separated\D83DDD62.png Assets\Emoji\Separated\D83DDD63.png Assets\Emoji\Separated\D83DDD64.png Assets\Emoji\Separated\D83DDD65.png Assets\Emoji\Separated\D83DDD66.png Assets\Emoji\Separated\D83DDD67.png Assets\Emoji\Separated\D83DDDFB.png Assets\Emoji\Separated\D83DDDFC.png Assets\Emoji\Separated\D83DDDFD.png Assets\Emoji\Separated\D83DDDFE.png Assets\Emoji\Separated\D83DDDFF.png Assets\Emoji\Separated\D83DDE00.png Assets\Emoji\Separated\D83DDE01.png Assets\Emoji\Separated\D83DDE02.png Assets\Emoji\Separated\D83DDE03.png Assets\Emoji\Separated\D83DDE04.png Assets\Emoji\Separated\D83DDE05.png Assets\Emoji\Separated\D83DDE06.png Assets\Emoji\Separated\D83DDE07.png Assets\Emoji\Separated\D83DDE08.png Assets\Emoji\Separated\D83DDE09.png Assets\Emoji\Separated\D83DDE0A.png Assets\Emoji\Separated\D83DDE0B.png Assets\Emoji\Separated\D83DDE0C.png Assets\Emoji\Separated\D83DDE0D.png Assets\Emoji\Separated\D83DDE0E.png Assets\Emoji\Separated\D83DDE0F.png Assets\Emoji\Separated\D83DDE10.png Assets\Emoji\Separated\D83DDE11.png Assets\Emoji\Separated\D83DDE12.png Assets\Emoji\Separated\D83DDE13.png Assets\Emoji\Separated\D83DDE14.png Assets\Emoji\Separated\D83DDE15.png Assets\Emoji\Separated\D83DDE16.png Assets\Emoji\Separated\D83DDE17.png Assets\Emoji\Separated\D83DDE18.png Assets\Emoji\Separated\D83DDE19.png Assets\Emoji\Separated\D83DDE1A.png Assets\Emoji\Separated\D83DDE1B.png Assets\Emoji\Separated\D83DDE1C.png Assets\Emoji\Separated\D83DDE1D.png Assets\Emoji\Separated\D83DDE1E.png Assets\Emoji\Separated\D83DDE1F.png Assets\Emoji\Separated\D83DDE20.png Assets\Emoji\Separated\D83DDE21.png Assets\Emoji\Separated\D83DDE22.png Assets\Emoji\Separated\D83DDE23.png Assets\Emoji\Separated\D83DDE24.png Assets\Emoji\Separated\D83DDE25.png Assets\Emoji\Separated\D83DDE26.png Assets\Emoji\Separated\D83DDE27.png Assets\Emoji\Separated\D83DDE28.png Assets\Emoji\Separated\D83DDE29.png Assets\Emoji\Separated\D83DDE2A.png Assets\Emoji\Separated\D83DDE2B.png Assets\Emoji\Separated\D83DDE2C.png Assets\Emoji\Separated\D83DDE2D.png Assets\Emoji\Separated\D83DDE2E.png Assets\Emoji\Separated\D83DDE2F.png Assets\Emoji\Separated\D83DDE30.png Assets\Emoji\Separated\D83DDE31.png Assets\Emoji\Separated\D83DDE32.png Assets\Emoji\Separated\D83DDE33.png Assets\Emoji\Separated\D83DDE34.png Assets\Emoji\Separated\D83DDE35.png Assets\Emoji\Separated\D83DDE36.png Assets\Emoji\Separated\D83DDE37.png Assets\Emoji\Separated\D83DDE38.png Assets\Emoji\Separated\D83DDE39.png Assets\Emoji\Separated\D83DDE3A.png Assets\Emoji\Separated\D83DDE3B.png Assets\Emoji\Separated\D83DDE3C.png Assets\Emoji\Separated\D83DDE3D.png Assets\Emoji\Separated\D83DDE3E.png Assets\Emoji\Separated\D83DDE3F.png Assets\Emoji\Separated\D83DDE40.png Assets\Emoji\Separated\D83DDE45.png Assets\Emoji\Separated\D83DDE46.png Assets\Emoji\Separated\D83DDE47.png Assets\Emoji\Separated\D83DDE48.png Assets\Emoji\Separated\D83DDE49.png Assets\Emoji\Separated\D83DDE4A.png Assets\Emoji\Separated\D83DDE4B.png Assets\Emoji\Separated\D83DDE4C.png Assets\Emoji\Separated\D83DDE4D.png Assets\Emoji\Separated\D83DDE4E.png Assets\Emoji\Separated\D83DDE4F.png Assets\Emoji\Separated\D83DDE80.png Assets\Emoji\Separated\D83DDE81.png Assets\Emoji\Separated\D83DDE82.png Assets\Emoji\Separated\D83DDE83.png Assets\Emoji\Separated\D83DDE84.png Assets\Emoji\Separated\D83DDE85.png Assets\Emoji\Separated\D83DDE86.png Assets\Emoji\Separated\D83DDE87.png Assets\Emoji\Separated\D83DDE88.png Assets\Emoji\Separated\D83DDE89.png Assets\Emoji\Separated\D83DDE8A.png Assets\Emoji\Separated\D83DDE8B.png Assets\Emoji\Separated\D83DDE8C.png Assets\Emoji\Separated\D83DDE8D.png Assets\Emoji\Separated\D83DDE8E.png Assets\Emoji\Separated\D83DDE8F.png Assets\Emoji\Separated\D83DDE90.png Assets\Emoji\Separated\D83DDE91.png Assets\Emoji\Separated\D83DDE92.png Assets\Emoji\Separated\D83DDE93.png Assets\Emoji\Separated\D83DDE94.png Assets\Emoji\Separated\D83DDE95.png Assets\Emoji\Separated\D83DDE96.png Assets\Emoji\Separated\D83DDE97.png Assets\Emoji\Separated\D83DDE98.png Assets\Emoji\Separated\D83DDE99.png Assets\Emoji\Separated\D83DDE9A.png Assets\Emoji\Separated\D83DDE9B.png Assets\Emoji\Separated\D83DDE9C.png Assets\Emoji\Separated\D83DDE9D.png Assets\Emoji\Separated\D83DDE9E.png Assets\Emoji\Separated\D83DDE9F.png Assets\Emoji\Separated\D83DDEA0.png Assets\Emoji\Separated\D83DDEA1.png Assets\Emoji\Separated\D83DDEA2.png Assets\Emoji\Separated\D83DDEA3.png Assets\Emoji\Separated\D83DDEA4.png Assets\Emoji\Separated\D83DDEA5.png Assets\Emoji\Separated\D83DDEA6.png Assets\Emoji\Separated\D83DDEA7.png Assets\Emoji\Separated\D83DDEA8.png Assets\Emoji\Separated\D83DDEA9.png Assets\Emoji\Separated\D83DDEAA.png Assets\Emoji\Separated\D83DDEAB.png Assets\Emoji\Separated\D83DDEAC.png Assets\Emoji\Separated\D83DDEAD.png Assets\Emoji\Separated\D83DDEAE.png Assets\Emoji\Separated\D83DDEAF.png Assets\Emoji\Separated\D83DDEB0.png Assets\Emoji\Separated\D83DDEB1.png Assets\Emoji\Separated\D83DDEB2.png Assets\Emoji\Separated\D83DDEB3.png Assets\Emoji\Separated\D83DDEB4.png Assets\Emoji\Separated\D83DDEB5.png Assets\Emoji\Separated\D83DDEB6.png Assets\Emoji\Separated\D83DDEB7.png Assets\Emoji\Separated\D83DDEB8.png Assets\Emoji\Separated\D83DDEB9.png Assets\Emoji\Separated\D83DDEBA.png Assets\Emoji\Separated\D83DDEBB.png Assets\Emoji\Separated\D83DDEBC.png Assets\Emoji\Separated\D83DDEBD.png Assets\Emoji\Separated\D83DDEBE.png Assets\Emoji\Separated\D83DDEBF.png Assets\Emoji\Separated\D83DDEC0.png Assets\Emoji\Separated\D83DDEC1.png Assets\Emoji\Separated\D83DDEC2.png Assets\Emoji\Separated\D83DDEC3.png Assets\Emoji\Separated\D83DDEC4.png Assets\Emoji\Separated\D83DDEC5.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat0_part0.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat0_part1.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat0_part2.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat0_part3.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat1_part0.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat1_part1.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat1_part2.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat2_part0.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat2_part1.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat2_part2.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat2_part3.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat2_part4.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat3_part0.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat3_part1.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat3_part2.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat4_part0.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat4_part1.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat4_part2.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat4_part3.png Assets\Emoji\SpacedSpritesLandscape\sprite64_landscape_cat4_part4.png Assets\Emoji\SpacedSprites\sprite64_cat0_part0.png Assets\Emoji\SpacedSprites\sprite64_cat0_part1.png Assets\Emoji\SpacedSprites\sprite64_cat0_part2.png Assets\Emoji\SpacedSprites\sprite64_cat0_part3.png Assets\Emoji\SpacedSprites\sprite64_cat0_part4.png Assets\Emoji\SpacedSprites\sprite64_cat0_part5.png Assets\Emoji\SpacedSprites\sprite64_cat1_part0.png Assets\Emoji\SpacedSprites\sprite64_cat1_part1.png Assets\Emoji\SpacedSprites\sprite64_cat1_part2.png Assets\Emoji\SpacedSprites\sprite64_cat1_part3.png Assets\Emoji\SpacedSprites\sprite64_cat2_part0.png Assets\Emoji\SpacedSprites\sprite64_cat2_part1.png Assets\Emoji\SpacedSprites\sprite64_cat2_part2.png Assets\Emoji\SpacedSprites\sprite64_cat2_part3.png Assets\Emoji\SpacedSprites\sprite64_cat2_part4.png Assets\Emoji\SpacedSprites\sprite64_cat2_part5.png Assets\Emoji\SpacedSprites\sprite64_cat2_part6.png Assets\Emoji\SpacedSprites\sprite64_cat3_part0.png Assets\Emoji\SpacedSprites\sprite64_cat3_part1.png Assets\Emoji\SpacedSprites\sprite64_cat3_part2.png Assets\Emoji\SpacedSprites\sprite64_cat4_part0.png Assets\Emoji\SpacedSprites\sprite64_cat4_part1.png Assets\Emoji\SpacedSprites\sprite64_cat4_part2.png Assets\Emoji\SpacedSprites\sprite64_cat4_part3.png Assets\Emoji\SpacedSprites\sprite64_cat4_part4.png Assets\Emoji\SpacedSprites\sprite64_cat4_part5.png Assets\light.emoji.abc-WXGA.png Assets\light.emoji.backspace-WXGA.png Assets\light.emoji.category.1-WXGA.png Assets\light.emoji.category.2-WXGA.png Assets\light.emoji.category.3-WXGA.png Assets\light.emoji.category.4-WXGA.png Assets\light.emoji.category.5-WXGA.png Assets\light.emoji.recent-WXGA.png ..\packages\WPtoolkit.4.2013.08.16\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. ================================================ FILE: Telegram.EmojiPanel.WP8/packages.config ================================================  ================================================ FILE: TelegramClient/Analytics/AnalyticsProperties.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO.IsolatedStorage; using Coding4Fun.Toolkit.Controls.Common; using Microsoft.Phone.Info; namespace TelegramClient.Analytics { public static class AnalyticsProperties { //public static string DeviceId //{ // get // { // var value = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId"); // return Convert.ToBase64String(value); // } //} public static string LaunchCount { get { var settings = IsolatedStorageSettings.ApplicationSettings; if (settings != null) { if (settings.Contains("LaunchCount")) { return ((int)settings["LaunchCount"] + 1).ToString(CultureInfo.InvariantCulture); } } return "1"; } } public static string DeviceManufacturer { get { return DeviceExtendedProperties.GetValue("DeviceManufacturer").ToString(); } } public static string DeviceType { get { return DeviceExtendedProperties.GetValue("DeviceName").ToString(); } } public static string Device { get { return string.Format("{0} - {1}", DeviceManufacturer, DeviceType); } } public static string OsVersion { get { return string.Format("WP {0}", Environment.OSVersion.Version); } } public static string ApplicationVersion { get { return PhoneHelper.GetAppAttribute("Version").Replace(".0.0", ""); } } } } ================================================ FILE: TelegramClient/Analytics/AnalyticsService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // ================================================ FILE: TelegramClient/Analytics/AnalyticsTracker.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // ================================================ FILE: TelegramClient/Analytics/ReviewRequester.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.IO.IsolatedStorage; using System.Windows; using Microsoft.Phone.Tasks; using TelegramClient.Resources; namespace TelegramClient.Analytics { public class ReviewRequester { public static void IncreaseLaunchCount() { var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains("LaunchCount")) { var launchCount = (int)settings["LaunchCount"]; settings["LaunchCount"] = ++launchCount; } else { settings["LaunchCount"] = 1; } } public static void Request() { var settings = IsolatedStorageSettings.ApplicationSettings; if (settings.Contains("LaunchCount")) { var launchCount = (int)settings["LaunchCount"]; var isReviewed = settings.Contains("IsReviewed"); if (!isReviewed) { if (launchCount == 3 || launchCount == 5) { //var tracker = new AnalyticsTracker(); //var result = MessageBox.Show(AppResources.ReviewRequestMessage, AppResources.ReviewRequestTitle, MessageBoxButton.OKCancel); //tracker.Track("Review", "Requested"); //if (result == MessageBoxResult.OK) //{ // settings.Add("IsReviewed", true); // tracker.Track("Review", "Accepted"); // var task = new MarketplaceReviewTask(); // task.Show(); //} } } } } } } ================================================ FILE: TelegramClient/Animation/LinqToVisualTree.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using System.Collections.Generic; using System.Windows; using System.Windows.Media; namespace TelegramClient.Animation.LinqToVisualTree { /// /// Adapts a DependencyObject to provide methods required for generate /// a Linq To Tree API /// public class VisualTreeAdapter : ILinqTree { private DependencyObject _item; public VisualTreeAdapter(DependencyObject item) { _item = item; } public IEnumerable Children() { int childrenCount = VisualTreeHelper.GetChildrenCount(_item); for (int i = 0; i < childrenCount; i++) { yield return VisualTreeHelper.GetChild(_item, i); } } public DependencyObject Parent { get { return VisualTreeHelper.GetParent(_item); } } } } namespace TelegramClient.Animation.LinqToVisualTree { /// /// Defines an interface that must be implemented to generate the LinqToTree methods /// /// public interface ILinqTree { IEnumerable Children(); T Parent { get; } } public static class TreeExtensions { /// /// Returns a collection of descendant elements. /// public static IEnumerable Descendants(this DependencyObject item) { ILinqTree adapter = new VisualTreeAdapter(item); foreach (var child in adapter.Children()) { yield return child; foreach (var grandChild in child.Descendants()) { yield return grandChild; } } } /// /// Returns a collection containing this element and all descendant elements. /// public static IEnumerable DescendantsAndSelf(this DependencyObject item) { yield return item; foreach (var child in item.Descendants()) { yield return child; } } /// /// Returns a collection of ancestor elements. /// public static IEnumerable Ancestors(this DependencyObject item) { ILinqTree adapter = new VisualTreeAdapter(item); var parent = adapter.Parent; while (parent != null) { yield return parent; adapter = new VisualTreeAdapter(parent); parent = adapter.Parent; } } /// /// Returns a collection containing this element and all ancestor elements. /// public static IEnumerable AncestorsAndSelf(this DependencyObject item) { yield return item; foreach (var ancestor in item.Ancestors()) { yield return ancestor; } } /// /// Returns a collection of child elements. /// public static IEnumerable Elements(this DependencyObject item) { ILinqTree adapter = new VisualTreeAdapter(item); foreach (var child in adapter.Children()) { yield return child; } } /// /// Returns a collection of the sibling elements before this node, in document order. /// public static IEnumerable ElementsBeforeSelf(this DependencyObject item) { if (item.Ancestors().FirstOrDefault() == null) yield break; foreach (var child in item.Ancestors().First().Elements()) { if (child.Equals(item)) break; yield return child; } } /// /// Returns a collection of the after elements after this node, in document order. /// public static IEnumerable ElementsAfterSelf(this DependencyObject item) { if (item.Ancestors().FirstOrDefault() == null) yield break; bool afterSelf = false; foreach (var child in item.Ancestors().First().Elements()) { if (afterSelf) yield return child; if (child.Equals(item)) afterSelf = true; } } /// /// Returns a collection containing this element and all child elements. /// public static IEnumerable ElementsAndSelf(this DependencyObject item) { yield return item; foreach (var child in item.Elements()) { yield return child; } } /// /// Returns a collection of descendant elements which match the given type. /// public static IEnumerable Descendants(this DependencyObject item) { return item.Descendants().Where(i => i is T).Cast(); } /// /// Returns a collection of the sibling elements before this node, in document order /// which match the given type. /// public static IEnumerable ElementsBeforeSelf(this DependencyObject item) { return item.ElementsBeforeSelf().Where(i => i is T).Cast(); } /// /// Returns a collection of the after elements after this node, in document order /// which match the given type. /// public static IEnumerable ElementsAfterSelf(this DependencyObject item) { return item.ElementsAfterSelf().Where(i => i is T).Cast(); } /// /// Returns a collection containing this element and all descendant elements /// which match the given type. /// public static IEnumerable DescendantsAndSelf(this DependencyObject item) { return item.DescendantsAndSelf().Where(i => i is T).Cast(); } /// /// Returns a collection of ancestor elements which match the given type. /// public static IEnumerable Ancestors(this DependencyObject item) { return item.Ancestors().Where(i => i is T).Cast(); } /// /// Returns a collection containing this element and all ancestor elements /// which match the given type. /// public static IEnumerable AncestorsAndSelf(this DependencyObject item) { return item.AncestorsAndSelf().Where(i => i is T).Cast(); } /// /// Returns a collection of child elements which match the given type. /// public static IEnumerable Elements(this DependencyObject item) { return item.Elements().Where(i => i is T).Cast(); } /// /// Returns a collection containing this element and all child elements. /// which match the given type. /// public static IEnumerable ElementsAndSelf(this DependencyObject item) { return item.ElementsAndSelf().Where(i => i is T).Cast(); } } public static class EnumerableTreeExtensions { /// /// Applies the given function to each of the items in the supplied /// IEnumerable. /// private static IEnumerable DrillDown(this IEnumerable items, Func> function) { foreach (var item in items) { foreach (var itemChild in function(item)) { yield return itemChild; } } } /// /// Applies the given function to each of the items in the supplied /// IEnumerable, which match the given type. /// public static IEnumerable DrillDown(this IEnumerable items, Func> function) where T : DependencyObject { foreach (var item in items) { foreach (var itemChild in function(item)) { if (itemChild is T) { yield return (T)itemChild; } } } } /// /// Returns a collection of descendant elements. /// public static IEnumerable Descendants(this IEnumerable items) { return items.DrillDown(i => i.Descendants()); } /// /// Returns a collection containing this element and all descendant elements. /// public static IEnumerable DescendantsAndSelf(this IEnumerable items) { return items.DrillDown(i => i.DescendantsAndSelf()); } /// /// Returns a collection of ancestor elements. /// public static IEnumerable Ancestors(this IEnumerable items) { return items.DrillDown(i => i.Ancestors()); } /// /// Returns a collection containing this element and all ancestor elements. /// public static IEnumerable AncestorsAndSelf(this IEnumerable items) { return items.DrillDown(i => i.AncestorsAndSelf()); } /// /// Returns a collection of child elements. /// public static IEnumerable Elements(this IEnumerable items) { return items.DrillDown(i => i.Elements()); } /// /// Returns a collection containing this element and all child elements. /// public static IEnumerable ElementsAndSelf(this IEnumerable items) { return items.DrillDown(i => i.ElementsAndSelf()); } /// /// Returns a collection of descendant elements which match the given type. /// public static IEnumerable Descendants(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.Descendants()); } /// /// Returns a collection containing this element and all descendant elements. /// which match the given type. /// public static IEnumerable DescendantsAndSelf(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.DescendantsAndSelf()); } /// /// Returns a collection of ancestor elements which match the given type. /// public static IEnumerable Ancestors(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.Ancestors()); } /// /// Returns a collection containing this element and all ancestor elements. /// which match the given type. /// public static IEnumerable AncestorsAndSelf(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.AncestorsAndSelf()); } /// /// Returns a collection of child elements which match the given type. /// public static IEnumerable Elements(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.Elements()); } /// /// Returns a collection containing this element and all child elements. /// which match the given type. /// public static IEnumerable ElementsAndSelf(this IEnumerable items) where T : DependencyObject { return items.DrillDown(i => i.ElementsAndSelf()); } } } ================================================ FILE: TelegramClient/Animation/MetroInMotion.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using Microsoft.Phone.Controls; using TelegramClient.Animation.LinqToVisualTree; namespace TelegramClient.Animation { public static class MetroInMotion { public static int GetPivotIndex(DependencyObject obj) { return (int)obj.GetValue(PivotIndexProperty); } public static void SetPivotIndex(DependencyObject obj, int value) { obj.SetValue(PivotIndexProperty, value); } public static readonly DependencyProperty PivotIndexProperty = DependencyProperty.RegisterAttached("PivotIndex", typeof(int), typeof(MetroInMotion), new PropertyMetadata(-1)); #region AnimationLevel public static int GetAnimationLevel(DependencyObject obj) { return (int)obj.GetValue(AnimationLevelProperty); } public static void SetAnimationLevel(DependencyObject obj, int value) { obj.SetValue(AnimationLevelProperty, value); } public static readonly DependencyProperty AnimationLevelProperty = DependencyProperty.RegisterAttached("AnimationLevel", typeof(int), typeof(MetroInMotion), new PropertyMetadata(-1)); #endregion #region IsPivotAnimated public static bool GetIsPivotAnimated(DependencyObject obj) { return (bool)obj.GetValue(IsPivotAnimatedProperty); } public static void SetIsPivotAnimated(DependencyObject obj, bool value) { obj.SetValue(IsPivotAnimatedProperty, value); } public static readonly DependencyProperty IsPivotAnimatedProperty = DependencyProperty.RegisterAttached("IsPivotAnimated", typeof(bool), typeof(MetroInMotion), new PropertyMetadata(false, OnIsPivotAnimatedChanged)); private static void OnIsPivotAnimatedChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) { ItemsControl list = d as ItemsControl; list.Loaded += (s2, e2) => { // locate the pivot control that this list is within Pivot pivot = list.Ancestors().Single() as Pivot; var pivotIndex = GetPivotIndex(list); if (pivotIndex == -1) { var pivotItem = list.Ancestors().Single(); // and its index within the pivot pivotIndex = pivot.Items.IndexOf(pivotItem); } bool selectionChanged = false; pivot.SelectionChanged += (s3, e3) => { selectionChanged = true; }; // handle manipulation events which occur when the user // moves between pivot items pivot.ManipulationCompleted += (s, e) => { if (!selectionChanged) return; selectionChanged = false; if (pivotIndex != pivot.SelectedIndex) return; // determine which direction this tab will be scrolling in from bool fromRight = e.TotalManipulation.Translation.X <= 0; // iterate over each of the items in view var items = list.GetItemsInView().ToList(); for (int index = 0; index < items.Count; index++ ) { var lbi = items[index]; list.Dispatcher.BeginInvoke(() => { var animationTargets = lbi.Descendants() .Where(p => MetroInMotion.GetAnimationLevel(p) > -1); foreach (FrameworkElement target in animationTargets) { // trigger the required animation GetSlideAnimation(target, fromRight).Begin(); } }); }; }; }; } #endregion /// /// Animates each element in order, creating a 'peel' effect. The supplied action /// is invoked when the animation ends. /// public static void Peel(this IEnumerable elements, Action endAction) { var elementList = elements.ToList(); var lastElement = elementList.Last(); // iterate over all the elements, animating each of them double delay = 0; foreach (FrameworkElement element in elementList) { var sb = GetPeelAnimation(element, delay); // add a Completed event handler to the last element if (element.Equals(lastElement)) { sb.Completed += (s, e) => { endAction(); }; } sb.Begin(); delay += 50; } } /// /// Enumerates all the items that are currently visible in am ItemsControl. This implementation assumes /// that a VirtualizingStackPanel is being used as the ItemsPanel. /// public static IEnumerable GetItemsInView(this ItemsControl itemsControl) { // locate the stack panel that hosts the items VirtualizingStackPanel vsp = itemsControl.Descendants().First() as VirtualizingStackPanel; // iterate over each of the items in view int firstVisibleItem = (int)vsp.VerticalOffset; int visibleItemCount = (int)vsp.ViewportHeight; for (int index = firstVisibleItem; index <= firstVisibleItem + visibleItemCount + 1; index++) { var item = itemsControl.ItemContainerGenerator.ContainerFromIndex(index) as FrameworkElement; if (item == null) continue; yield return item; } } /// /// Creates a PlaneProjection and associates it with the given element, returning /// a Storyboard which will animate the PlaneProjection to 'peel' the item /// from the screen. /// private static Storyboard GetPeelAnimation(FrameworkElement element, double delay) { Storyboard sb; var projection = new PlaneProjection() { CenterOfRotationX = -0.1 }; element.Projection = projection; // compute the angle of rotation required to make this element appear // at a 90 degree angle at the edge of the screen. var width = element.ActualWidth; var targetAngle = Math.Atan(1000 / (width / 2)); targetAngle = targetAngle * 180 / Math.PI; // animate the projection sb = new Storyboard(); sb.BeginTime = TimeSpan.FromMilliseconds(delay); sb.Children.Add(CreateAnimation(0, -(180 - targetAngle), 0.3, "RotationY", projection)); sb.Children.Add(CreateAnimation(0, 23, 0.3, "RotationZ", projection)); sb.Children.Add(CreateAnimation(0, -23, 0.3, "GlobalOffsetZ", projection)); return sb; } private static DoubleAnimation CreateAnimation(double from, double to, double duration, string targetProperty, DependencyObject target) { var db = new DoubleAnimation(); db.To = to; db.From = from; db.EasingFunction = new SineEase(); db.Duration = TimeSpan.FromSeconds(duration); Storyboard.SetTarget(db, target); Storyboard.SetTargetProperty(db, new PropertyPath(targetProperty)); return db; } /// /// Creates a TranslateTransform and associates it with the given element, returning /// a Storyboard which will animate the TranslateTransform with a SineEase function /// private static Storyboard GetSlideAnimation(FrameworkElement element, bool fromRight) { double from = fromRight ? 40 : -40; Storyboard sb; double delay = (GetAnimationLevel(element)) * 0.1 + 0.1; var trans = new TranslateTransform { X = from }; element.RenderTransform = trans; sb = new Storyboard(); sb.BeginTime = TimeSpan.FromSeconds(delay); sb.Children.Add(CreateAnimation(from, 0, 0.3, "X", trans)); return sb; } } } ================================================ FILE: TelegramClient/Animation/Navigation/AnimatedBasePage.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Telegram.Controls.Extensions; using TelegramClient.Extensions; using TelegramClient.Views; namespace TelegramClient.Animation.Navigation { public class AnimatedBasePage : TelegramViewBase { public static readonly DependencyProperty IsAnimationTargetProperty = DependencyProperty.RegisterAttached("IsAnimationTarget", typeof(bool), typeof(AnimatedBasePage), null); public static void SetIsAnimationTarget(UIElement element, bool value) { element.SetValue(IsAnimationTargetProperty, value); } public static bool GetIsAnimationTarget(UIElement element) { return (bool)element.GetValue(IsAnimationTargetProperty); } private static readonly Uri ExternalUri = new Uri(@"app://external/"); public static readonly DependencyProperty AnimationContextProperty = DependencyProperty.Register( "AnimationContext", typeof(FrameworkElement), typeof(AnimatedBasePage), new PropertyMetadata(null)); public FrameworkElement AnimationContext { get { return (FrameworkElement)GetValue(AnimationContextProperty); } set { SetValue(AnimationContextProperty, value); } } private static Uri _fromUri; private bool _isAnimating; private static bool _isNavigating; private bool _needsOutroAnimation; private Uri _nextUri; private Uri _arrivedFromUri; private AnimationType _currentAnimationType; private NavigationMode? _currentNavigationMode; private bool _isActive; private bool _isForwardNavigation; private bool _loadingAndAnimatingIn; private static PageOrientation _lastOrientation; public AnimatedBasePage() { _isActive = true; _isForwardNavigation = true; OrientationChanged += Page_OrientationChanged; } void Page_OrientationChanged(object sender, OrientationChangedEventArgs e) { var newOrientation = e.Orientation; if (newOrientation == _lastOrientation) return; // Orientations are (clockwise) 'PortraitUp', 'LandscapeRight', 'LandscapeLeft' var transitionElement = new RotateTransition(); switch (newOrientation) { case PageOrientation.Landscape: case PageOrientation.LandscapeRight: // Come here from PortraitUp (i.e. clockwise) or LandscapeLeft? if (_lastOrientation == PageOrientation.PortraitUp) transitionElement.Mode = RotateTransitionMode.In90Counterclockwise; else transitionElement.Mode = RotateTransitionMode.In180Counterclockwise; break; case PageOrientation.LandscapeLeft: // Come here from LandscapeRight or PortraitUp? if (_lastOrientation == PageOrientation.LandscapeRight) transitionElement.Mode = RotateTransitionMode.In180Clockwise; else transitionElement.Mode = RotateTransitionMode.In90Clockwise; break; case PageOrientation.Portrait: case PageOrientation.PortraitUp: // Come here from LandscapeLeft or LandscapeRight? if (_lastOrientation == PageOrientation.LandscapeLeft) transitionElement.Mode = RotateTransitionMode.In90Counterclockwise; else transitionElement.Mode = RotateTransitionMode.In90Clockwise; break; } // Execute the transition var phoneApplicationPage = (PhoneApplicationPage)(((PhoneApplicationFrame)Application.Current.RootVisual)).Content; var transition = transitionElement.GetTransition(phoneApplicationPage); transition.Completed += delegate { transition.Stop(); }; transition.Begin(); _lastOrientation = newOrientation; } protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) { base.OnBackKeyPress(e); //if (_isNavigating) //{ // e.Cancel = true; // return; //} if (!CanAnimate()) return; //if (_isAnimating) //{ // e.Cancel = true; // return; //} //if (_loadingAndAnimatingIn) //{ // e.Cancel = true; // return; //} if (!NavigationService.CanGoBack) return; if (!IsPopupOpen()) { _isNavigating = true; e.Cancel = true; _needsOutroAnimation = false; _currentAnimationType = AnimationType.NavigateBackwardOut; _currentNavigationMode = NavigationMode.Back; RunAnimation(); } } protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { base.OnNavigatingFrom(e); if (e.Cancel) { return; } _lastOrientation = Orientation; if (_isAnimating) { e.Cancel = true; return; } if (_loadingAndAnimatingIn) { e.Cancel = true; return; } _fromUri = NavigationService.CurrentSource; if (_needsOutroAnimation) { _needsOutroAnimation = false; if (!CanAnimate()) return; if (_isNavigating) { e.Cancel = true; return; } if (!NavigationService.CanGoBack && e.NavigationMode == NavigationMode.Back) return; if (IsPopupOpen() && e.Uri != ExternalUri) { return; } e.Cancel = true; _nextUri = e.Uri; switch (e.NavigationMode) { case NavigationMode.New: _currentAnimationType = AnimationType.NavigateForwardOut; break; case NavigationMode.Back: _currentAnimationType = AnimationType.NavigateBackwardOut; break; case NavigationMode.Forward: _currentAnimationType = AnimationType.NavigateForwardOut; break; } _currentNavigationMode = e.NavigationMode; if (e.Uri != ExternalUri) RunAnimation(); } } protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); Orientation = _lastOrientation; _currentNavigationMode = null; //Debug.WriteLine("OnNavigatedTo: {0}", this); if (_nextUri != ExternalUri) { //this.InvokeOnLayoutUpdated(() => OnLayoutUpdated(this, null)); _loadingAndAnimatingIn = true; Loaded += AnimatedBasePage_Loaded; if (AnimationContext != null) { AnimationContext.Opacity = 0; } } _needsOutroAnimation = true; } void AnimatedBasePage_Loaded(object sender, RoutedEventArgs e) { Loaded -= AnimatedBasePage_Loaded; OnLayoutUpdated(); } public void OnLayoutUpdated() { //Debug.WriteLine("OnLayoutUpdated: {0}", this); if (_isForwardNavigation) { _currentAnimationType = AnimationType.NavigateForwardIn; _arrivedFromUri = _fromUri != null ? new Uri(_fromUri.OriginalString, UriKind.Relative) : null; } else { _currentAnimationType = AnimationType.NavigateBackwardIn; } if (CanAnimate()) { RunAnimation(); } else { if (AnimationContext != null) AnimationContext.Opacity = 1; OnTransitionAnimationCompleted(); } //OnFirstLayoutUpdated(!_isForwardNavigation, _fromUri); if (_isForwardNavigation) _isForwardNavigation = false; } protected virtual void OnFirstLayoutUpdated(bool isBackNavigation, Uri from) { } private void RunAnimation() { _isAnimating = true; AnimatorHelperBase animation; switch (_currentAnimationType) { case AnimationType.NavigateForwardIn: animation = GetAnimation(_currentAnimationType, _fromUri); break; case AnimationType.NavigateBackwardOut: animation = GetAnimation(_currentAnimationType, _arrivedFromUri); break; default: animation = GetAnimation(_currentAnimationType, _nextUri); break; } Dispatcher.BeginInvoke(() => { if (animation == null) { AnimationContext.Opacity = 1; OnTransitionAnimationCompleted(); } else { AnimatorHelperBase transitionAnimation = animation; AnimationContext.Opacity = 1; transitionAnimation.Begin(OnTransitionAnimationCompleted); } //Debug.WriteLine("{0} - {1} - {2} - {3}", this, _currentAnimationType, _currentAnimationType == AnimationType.NavigateForwardOut || _currentAnimationType == AnimationType.NavigateBackwardIn ? _nextUri : _fromUri, transitionAnimation); }); } private bool CanAnimate() { return (_isActive && !_isNavigating && AnimationContext != null); } void OnTransitionAnimationCompleted() { _isAnimating = false; _loadingAndAnimatingIn = false; try { Dispatcher.BeginInvoke(() => { //Debug.WriteLine("{0} - Animation complete: {1}", this, _currentAnimationType); //Debug.WriteLine("nav mode : {0}", _currentNavigationMode); switch (_currentNavigationMode) { case NavigationMode.Forward: Application.Current.GoForward(); break; case NavigationMode.Back: Application.Current.GoBack(); break; case NavigationMode.New: Application.Current.Navigate(_nextUri); break; } _isNavigating = false; }); } catch (Exception ex) { Debug.WriteLine("OnTransitionAnimationCompleted Exception on {0}: {1}", this, ex); } AnimationsComplete(_currentAnimationType); } public AnimatorHelperBase GetContinuumAnimation(FrameworkElement element, AnimationType animationType) { var movedText = element; var isTarget = false; if (element != null) { isTarget = GetIsAnimationTarget(element); } if (!isTarget && element != null) { foreach (var descendant in element.GetVisualDescendants().OfType()) { if (GetIsAnimationTarget(descendant)) { movedText = descendant; break; } } } if (movedText != null) { if (animationType == AnimationType.NavigateForwardIn) { return new ContinuumForwardInAnimator() { RootElement = movedText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateForwardOut) { return new ContinuumForwardOutAnimator() { RootElement = movedText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardIn) { return new ContinuumBackwardInAnimator() { RootElement = movedText, LayoutRoot = AnimationContext }; } if (animationType == AnimationType.NavigateBackwardOut) { return new ContinuumBackwardOutAnimator() { RootElement = movedText, LayoutRoot = AnimationContext }; } } return null; } protected virtual void AnimationsComplete(AnimationType animationType) { } protected virtual AnimatorHelperBase GetAnimation(AnimationType animationType, Uri toOrFrom) { AnimatorHelperBase animation; switch (animationType) { case AnimationType.NavigateBackwardIn: animation = new TurnstileBackwardInAnimator(); break; case AnimationType.NavigateBackwardOut: animation = new TurnstileBackwardOutAnimator(); break; case AnimationType.NavigateForwardIn: animation = new TurnstileForwardInAnimator(); break; default: animation = new TurnstileForwardOutAnimator(); break; } animation.RootElement = AnimationContext; return animation; } protected virtual bool IsPopupOpen() { return false; } public void CancelAnimation() { _isActive = false; } public void ResumeAnimation() { _isActive = true; } } } ================================================ FILE: TelegramClient/Animation/Navigation/AnimatorHelperBase.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Media.Animation; namespace TelegramClient.Animation.Navigation { public enum AnimationType { PivotInLeft, PivotInRight, PivotOutLeft, PivotOutRight, NavigateBackwardIn, NavigateBackwardOut, NavigateForwardIn, NavigateForwardOut, Appear, Disappear } public abstract class AnimatorHelperBase { private Action _oneTimeAction; public Storyboard Storyboard { get; set; } // Methods protected AnimatorHelperBase() { } private void OnCompleted(object sender, System.EventArgs e) { Storyboard.Completed -= new EventHandler(OnCompleted); Action action = _oneTimeAction; if (action != null) { _oneTimeAction = null; action(); } } public virtual void Begin(Action completionAction) { Storyboard.Stop(); Storyboard.Begin(); Storyboard.SeekAlignedToLastTick(TimeSpan.Zero); Storyboard.Completed += new EventHandler(OnCompleted); _oneTimeAction = completionAction; } public void SetTargets(Dictionary targets, Storyboard sb) { foreach (var kvp in targets) { var timelines = sb.Children.Where(t => Storyboard.GetTargetName(t) == kvp.Key); foreach (Timeline t in timelines) Storyboard.SetTarget(t, kvp.Value); } } public void SetTargets(Dictionary targets) { SetTargets(targets, Storyboard); } public void SetTarget(FrameworkElement target) { foreach (Timeline t in Storyboard.Children) Storyboard.SetTarget(t, target); } public FrameworkElement RootElement { get; set; } } } ================================================ FILE: TelegramClient/Animation/Navigation/ContinuumAnimator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using Telegram.Controls.Extensions; namespace TelegramClient.Animation.Navigation { public class ContinuumAnimator : AnimatorHelperBase { public FrameworkElement LayoutRoot { get; set; } private Popup _popup; public override void Begin(Action completionAction) { Storyboard.Stop(); PrepareElement(LayoutRoot); //if (this is ContinuumForwardOutAnimator) //{ // WriteableBitmap bitmap = new WriteableBitmap(RootElement, null); // bitmap.Invalidate(); // var image = new Image() { Source = bitmap, Stretch = System.Windows.Media.Stretch.None }; // var rootVisual = Application.Current.RootVisual as PhoneApplicationFrame; // _popup = new Popup(); // var popupChild = new Canvas() // { // Width = rootVisual.ActualWidth, // Height = rootVisual.ActualHeight // }; // var transfrom = RootElement.TransformToVisual(rootVisual); // var origin = transfrom.Transform(new Point(0, 0)); // popupChild.Children.Add(image); // PrepareElement(image); // Canvas.SetLeft(image, origin.X); // Canvas.SetTop(image, origin.Y); // _popup.Child = popupChild; // RootElement.Opacity = 0; // _popup.IsOpen = true; // Storyboard.Completed += new EventHandler(OnContinuumBackwardOutStoryboardCompleted); // base.SetTargets(new Dictionary() // { // { "LayoutRoot", LayoutRoot }, // { "ContinuumElement", image } // }); //} //else { PrepareElement(LayoutRoot); PrepareElement(RootElement); SetTargets(new Dictionary { {"LayoutRoot", LayoutRoot}, {"ContinuumElement", RootElement} }); } base.Begin(completionAction); } void OnContinuumBackwardOutStoryboardCompleted(object sender, System.EventArgs e) { Storyboard.Completed -= new EventHandler(OnContinuumBackwardOutStoryboardCompleted); _popup.IsOpen = false; _popup.Child = null; _popup = null; } private bool PrepareElement(UIElement element) { element.GetTransform(TransformCreationMode.CreateOrAddAndIgnoreMatrix); return true; } } public class ContinuumForwardInAnimator : ContinuumAnimator { public ContinuumForwardInAnimator() : base() { Storyboard = XamlReader.Load(Storyboards.ContinuumForwardInStoryboard) as Storyboard; } } public class ContinuumBackwardOutAnimator : ContinuumAnimator { public ContinuumBackwardOutAnimator() : base() { Storyboard = XamlReader.Load(Storyboards.ContinuumBackwardOutStoryboard) as Storyboard; } } public class ContinuumBackwardInAnimator : ContinuumAnimator { public ContinuumBackwardInAnimator() : base() { Storyboard = XamlReader.Load(Storyboards.ContinuumBackwardInStoryboard) as Storyboard; } } public class ContinuumForwardOutAnimator : ContinuumAnimator { public ContinuumForwardOutAnimator() : base() { Storyboard = XamlReader.Load(Storyboards.ContinuumForwardOutStoryboard) as Storyboard; } } } ================================================ FILE: TelegramClient/Animation/Navigation/SlideAnimator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using Telegram.Controls.Extensions; namespace TelegramClient.Animation.Navigation { public class SlideAnimator : AnimatorHelperBase { public override void Begin(Action completionAction) { if (this.PrepareElement(RootElement)) { Storyboard.Stop(); base.SetTarget(RootElement); } base.Begin(completionAction); } private bool PrepareElement(UIElement element) { element.GetTransform(TransformCreationMode.CreateOrAddAndIgnoreMatrix); return true; } } public class SlideUpAnimator : SlideAnimator { private static Storyboard _storyboard; public SlideUpAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.SlideUpFadeInStoryboard) as Storyboard; Storyboard = _storyboard; } } public class SlideDownAnimator : SlideAnimator { private static Storyboard _storyboard; public SlideDownAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.SlideDownFadeOutStoryboard) as Storyboard; Storyboard = _storyboard; } } public class SlideDownSwivelShowAnimator : SlideAnimator { } } ================================================ FILE: TelegramClient/Animation/Navigation/Storyboards.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace TelegramClient.Animation.Navigation { public class Storyboards { internal static readonly string DefaultStoryboard = @" "; internal static readonly string TurnstileForwardInStoryboard = @" "; internal static readonly string TurnstileForwardOutStoryboard = @" "; internal static readonly string TurnstileBackwardInStoryboard = @" "; internal static readonly string TurnstileBackwardOutStoryboard = @" "; internal static readonly string SwivelShowStoryboard = @" "; internal static readonly string SwivelHideStoryboard = @" "; internal static readonly string SwivelFullScreenShowStoryboard = @" "; internal static readonly string SwivelFullScreenHideStoryboard = @" "; internal static readonly string ContinuumForwardOutStoryboard = @" "; internal static readonly string ContinuumForwardInStoryboard = @" "; internal static readonly string ContinuumBackwardOutStoryboard = @" "; internal static readonly string ContinuumBackwardInStoryboard = @""; internal static readonly string ContinuumBackwardInStoryboard2 = @" --> "; internal static readonly string RotateLeftStoryboard = @""; internal static readonly string RotateRightStoryboard = @""; internal static readonly string SlideUpFadeInStoryboard = @" "; internal static readonly string SlideDownFadeOutStoryboard = @" "; internal static readonly string SlideLeftFadeInStoryboard = @""; internal static readonly string SlideLeftFadeOutStoryboard = @""; internal static readonly string SlideRightFadeInStoryboard = @""; internal static readonly string SlideRightFadeOutStoryboard = @""; internal static readonly string SlideRightStoryboard = @""; internal static readonly string SlideLeftStoryboard = @""; } } ================================================ FILE: TelegramClient/Animation/Navigation/SwivelAnimator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using Telegram.Controls.Extensions; namespace TelegramClient.Animation.Navigation { public class SwivelAnimator : AnimatorHelperBase { public override void Begin(Action completionAction) { if (this.PrepareElement(RootElement)) { (RootElement.Projection as PlaneProjection).CenterOfRotationY = 0.5; Storyboard.Stop(); base.SetTarget(RootElement); } base.Begin(completionAction); base.Begin(completionAction); } private bool PrepareElement(UIElement element) { if (element.GetPlaneProjection(true) == null) { return false; } return true; } } public class SwivelShowAnimator : SwivelAnimator { private static Storyboard _storyboard; public SwivelShowAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.SwivelShowStoryboard) as Storyboard; Storyboard = _storyboard; } } public class SwivelHideAnimator : SwivelAnimator { private static Storyboard _storyboard; public SwivelHideAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.SwivelHideStoryboard) as Storyboard; Storyboard = _storyboard; } } } ================================================ FILE: TelegramClient/Animation/Navigation/TurnstileAnimator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using Telegram.Controls.Extensions; namespace TelegramClient.Animation.Navigation { public class TurnstileAnimator : AnimatorHelperBase { public override void Begin(Action completionAction) { if (this.PrepareElement(RootElement)) { (RootElement.Projection as PlaneProjection).CenterOfRotationX = 0; Storyboard.Stop(); base.SetTarget(RootElement); } base.Begin(completionAction); } private bool PrepareElement(UIElement element) { if (element.GetPlaneProjection(true) == null) { return false; } return true; } } public class TurnstileForwardInAnimator : TurnstileAnimator { private static Storyboard _storyboard; public TurnstileForwardInAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.TurnstileForwardInStoryboard) as Storyboard; Storyboard = _storyboard; } } public class TurnstileForwardOutAnimator : TurnstileAnimator { private static Storyboard _storyboard; public TurnstileForwardOutAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.TurnstileForwardOutStoryboard) as Storyboard; Storyboard = _storyboard; } } public class TurnstileBackwardInAnimator : TurnstileAnimator { private static Storyboard _storyboard; public TurnstileBackwardInAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.TurnstileBackwardInStoryboard) as Storyboard; Storyboard = _storyboard; } } public class TurnstileBackwardOutAnimator : TurnstileAnimator { private static Storyboard _storyboard; public TurnstileBackwardOutAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.TurnstileBackwardOutStoryboard) as Storyboard; Storyboard = _storyboard; } } public class DefaultPageAnimator : TurnstileAnimator { private static Storyboard _storyboard; public DefaultPageAnimator() : base() { if (_storyboard == null) _storyboard = XamlReader.Load(Storyboards.DefaultStoryboard) as Storyboard; Storyboard = XamlReader.Load(Storyboards.DefaultStoryboard) as Storyboard; } } } ================================================ FILE: TelegramClient/Animation/Navigation/TurnstileFeatherAnimator.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using Telegram.Controls.Extensions; using TelegramClient.Helpers; namespace TelegramClient.Animation.Navigation { public class TurnstileFeatherAnimator : AnimatorHelperBase { protected enum Directions { In, Out } public ListBox ListBox { get; set; } protected int Duration { get; set; } protected int Angle { get; set; } protected int FeatherDelay { get; set; } protected Directions Direction { get; set; } protected int InitialDelay { get; set; } protected bool HoldSelectedItem { get; set; } private FrameworkElement _visual; private bool? _isVerticalOrientation; internal bool IsOnCurrentPage(ListBoxItem item) { var itemsHostRect = Rect.Empty; var listBoxItemRect = Rect.Empty; if (_visual == null) { Helpers.ItemsControlHelper ich = new Helpers.ItemsControlHelper(ListBox); ScrollContentPresenter scp = ich.ScrollHost == null ? null : ich.ScrollHost.GetVisualDescendants().OfType().FirstOrDefault(); _visual = (ich.ScrollHost == null) ? null : ((scp == null) ? ((FrameworkElement)ich.ScrollHost) : ((FrameworkElement)scp)); } if (_visual == null) return true; itemsHostRect = new Rect(0.0, 0.0, _visual.ActualWidth, _visual.ActualHeight); //ListBoxItem item = ListBox.ItemContainerGenerator.ContainerFromIndex(index) as ListBoxItem; if (item == null) { listBoxItemRect = Rect.Empty; return false; } GeneralTransform transform = item.TransformToVisual(_visual); listBoxItemRect = new Rect(transform.Transform(new Point()), transform.Transform(new Point(item.ActualWidth, item.ActualHeight))); if (!this.IsVerticalOrientation()) { return ((itemsHostRect.Left <= listBoxItemRect.Left) && (listBoxItemRect.Right <= itemsHostRect.Right)); } return ((listBoxItemRect.Bottom + 100 >= itemsHostRect.Top) && (listBoxItemRect.Top - 100 <= itemsHostRect.Bottom)); //return ((itemsHostRect.Top <= listBoxItemRect.Bottom) && (listBoxItemRect.Top <= itemsHostRect.Bottom)); } internal bool IsVerticalOrientation() { if (_isVerticalOrientation.HasValue) return _isVerticalOrientation.Value; Helpers.ItemsControlHelper ich = new Helpers.ItemsControlHelper(ListBox); StackPanel itemsHost = ich.ItemsHost as StackPanel; if (itemsHost != null) { _isVerticalOrientation = (itemsHost.Orientation == System.Windows.Controls.Orientation.Vertical); return _isVerticalOrientation.Value; } VirtualizingStackPanel panel2 = ich.ItemsHost as VirtualizingStackPanel; _isVerticalOrientation = ((panel2 == null) || (panel2.Orientation == System.Windows.Controls.Orientation.Vertical)); return _isVerticalOrientation.Value; } public TurnstileFeatherAnimator() :base() { InitialDelay = 0; } public override void Begin(Action completionAction) { Storyboard = new Storyboard(); double liCounter = 0; var listBoxItems = ListBox.GetVisualDescendants().OfType().Where(lbi => IsOnCurrentPage(lbi) && lbi.IsEnabled).ToList(); if (HoldSelectedItem && Direction == Directions.Out && ListBox.SelectedItem != null) { //move selected container to end var selectedContainer = ListBox.ItemContainerGenerator.ContainerFromItem(ListBox.SelectedItem); listBoxItems.Remove(selectedContainer); listBoxItems.Add(selectedContainer); } foreach (ListBoxItem li in listBoxItems) { GeneralTransform gt = li.TransformToVisual(RootElement); Point globalCoords = gt.Transform(new Point(0, 0)); double heightAdjustment = li.Content is FrameworkElement ? ((li.Content as FrameworkElement).ActualHeight / 2) : (li.ActualHeight / 2); //double yCoord = globalCoords.Y + ((((System.Windows.FrameworkElement)(((System.Windows.Controls.ContentControl)(li)).Content)).ActualHeight) / 2); double yCoord = globalCoords.Y + heightAdjustment; double offsetAmount = (RootElement.ActualHeight / 2) - yCoord; PlaneProjection pp = new PlaneProjection(); pp.GlobalOffsetY = offsetAmount * -1; pp.CenterOfRotationX = 0; li.Projection = pp; CompositeTransform ct = new CompositeTransform(); ct.TranslateY = offsetAmount; li.RenderTransform = ct; var beginTime = TimeSpan.FromMilliseconds((FeatherDelay * liCounter) + InitialDelay); if (Direction == Directions.In) { li.Opacity = 0; DoubleAnimationUsingKeyFrames daukf = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame edkf1 = new EasingDoubleKeyFrame(); edkf1.KeyTime = beginTime; edkf1.Value = Angle; daukf.KeyFrames.Add(edkf1); EasingDoubleKeyFrame edkf2 = new EasingDoubleKeyFrame(); edkf2.KeyTime = TimeSpan.FromMilliseconds(Duration).Add(beginTime); edkf2.Value = 0; ExponentialEase ee = new ExponentialEase(); ee.EasingMode = EasingMode.EaseOut; ee.Exponent = 6; edkf2.EasingFunction = ee; daukf.KeyFrames.Add(edkf2); Storyboard.SetTarget(daukf, li); Storyboard.SetTargetProperty(daukf, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); Storyboard.Children.Add(daukf); DoubleAnimation da = new DoubleAnimation(); da.Duration = TimeSpan.FromMilliseconds(0); da.BeginTime = beginTime; da.To = 1; Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Opacity)")); Storyboard.Children.Add(da); } else { li.Opacity = 1; DoubleAnimation da = new DoubleAnimation(); da.BeginTime = beginTime; da.Duration = TimeSpan.FromMilliseconds(Duration); da.To = Angle; ExponentialEase ee = new ExponentialEase(); ee.EasingMode = EasingMode.EaseIn; ee.Exponent = 6; da.EasingFunction = ee; Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); Storyboard.Children.Add(da); da = new DoubleAnimation(); da.Duration = TimeSpan.FromMilliseconds(10); da.To = 0; da.BeginTime = TimeSpan.FromMilliseconds(Duration).Add(beginTime); Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Opacity)")); Storyboard.Children.Add(da); } liCounter++; } base.Begin(completionAction); } } public class TurnstileFeatherForwardInAnimator : TurnstileFeatherAnimator { public TurnstileFeatherForwardInAnimator() : base() { Duration = 350; Angle = -80; FeatherDelay = 50; Direction = Directions.In; } } public class TurnstileFeatherForwardOutAnimator : TurnstileFeatherAnimator { public TurnstileFeatherForwardOutAnimator() : base() { Duration = 250; Angle = 50; FeatherDelay = 50; Direction = Directions.Out; HoldSelectedItem = true; } } public class TurnstileFeatherBackwardInAnimator : TurnstileFeatherAnimator { public TurnstileFeatherBackwardInAnimator() : base() { Duration = 350; Angle = 50; FeatherDelay = 50; Direction = Directions.In; } } public class TurnstileFeatherBackwardOutAnimator : TurnstileFeatherAnimator { public TurnstileFeatherBackwardOutAnimator() : base() { Duration = 250; Angle = -80; FeatherDelay = 50; Direction = Directions.Out; } } } ================================================ FILE: TelegramClient/App.xaml ================================================  ================================================ FILE: TelegramClient/App.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; using TelegramClient.Services; using TelegramClient.ViewModels.Additional; #if WP81 using Windows.ApplicationModel.DataTransfer.ShareTarget; using Windows.ApplicationModel.Activation; #endif using Caliburn.Micro; using Microsoft.Phone.Shell; using TelegramClient.ViewModels.Dialogs; using TelegramClient.ViewModels.Passport; using TelegramClient.Views.Dialogs; using TelegramClient.Views.Passport; #if WP8 using Windows.Storage; #endif namespace TelegramClient { public partial class App : Application { /// /// Provides easy access to the root frame of the Phone Application. /// /// The root frame of the Phone Application. //public PhoneApplicationFrame RootFrame { get; private set; } public static Stopwatch Timer = Stopwatch.StartNew(); public static Stopwatch StartupStimer = Stopwatch.StartNew(); public static void Log(string str) { Debug.WriteLine("{0} {1}", StartupStimer.Elapsed, str); } /// /// Constructor for the Application object. /// public App() { Log("App start .ctor"); Telegram.Api.Helpers.Execute.IsForegroundApp = true; //var color = Colors.Magenta; //Resources.Remove("PhoneAccentColor"); //Resources.Add("PhoneAccentColor", color); //((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = color; // Standard Silverlight initialization InitializeComponent(); //RootVisual = new PhoneApplicationFrame(); Log("App start InitilizeComponent"); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Disable the application idle detection by setting the UserIdleDetectionMode property of the // application's PhoneApplicationService object to Disabled. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } //Current.Host.Settings.EnableRedrawRegions = true; //Current.Host.Settings.EnableFrameRateCounter = true; #if DEBUG Current.Host.Settings.EnableFrameRateCounter = true; //Current.Host.Settings.EnableRedrawRegions = true; #endif #if WP81 PhoneApplicationService.Current.Activated += OnActivated; PhoneApplicationService.Current.ContractActivated += OnContractActivated; #endif //#if WP8 // ApplicationLifetimeObjects.Add(new XnaAsyncDispatcher(TimeSpan.FromMilliseconds(50))); //#endif Windows.ApplicationModel.Core.CoreApplication.UnhandledErrorDetected += (sender, args) => { try { Telegram.Logs.Log.SyncWrite(args.UnhandledError.ToString()); #if DEBUG Caliburn.Micro.Execute.OnUIThread(() => MessageBox.Show("UnhandledErrorDetected\n" + args.UnhandledError)); #endif } catch (Exception ex) { } if (!args.UnhandledError.Handled) { try { args.UnhandledError.Propagate(); } catch (Exception ex) { try { Telegram.Logs.Log.SyncWrite(args.UnhandledError.ToString()); #if DEBUG Caliburn.Micro.Execute.OnUIThread(() => MessageBox.Show("UnhandledErrorDetected Propogate\n" + args.UnhandledError)); #endif } catch (Exception e) { } } } //args.UnhandledError.Handled = true; }; UnhandledException += (sender, args) => { try { Telegram.Logs.Log.SyncWrite(args.ExceptionObject.ToString()); #if DEBUG Caliburn.Micro.Execute.OnUIThread(() => MessageBox.Show(args.ExceptionObject.ToString())); #endif } catch (Exception ex) { } args.Handled = true; }; Log("App stop .ctor"); } public ChooseFileInfo ChooseFileInfo { get; set; } #if WP81 public ShareOperation ShareOperation { get; set; } #endif private void OnActivated(object sender, ActivatedEventArgs e) { } public bool Offline { get; set; } #if WP8 public static IReadOnlyCollection Photos { get; set; } public static StorageFile Video { get; set; } #endif #if WP81 private void OnContractActivated(object sender, IActivatedEventArgs e) { var saveArgs = e as FileSavePickerContinuationEventArgs; if (saveArgs != null) { object from; if (saveArgs.ContinuationData != null && saveArgs.ContinuationData.TryGetValue("From", out from)) { if (string.Equals(from, "DialogDetailsView")) { Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => DialogDetailsViewModel.SaveFile(saveArgs.File)); return; } } } var args = e as FileOpenPickerContinuationEventArgs; if (args != null) { object from; if (args.ContinuationData != null && args.ContinuationData.TryGetValue("From", out from)) { if (string.Equals(from, "DialogDetailsView")) { var contentControl = RootVisual as ContentControl; if (contentControl != null) { var dialogDetailsView = contentControl.Content as DialogDetailsView; if (dialogDetailsView != null) { var dialogDetailsViewModel = dialogDetailsView.DataContext as DialogDetailsViewModel; if (dialogDetailsViewModel != null) { object type; if (!args.ContinuationData.TryGetValue("Type", out type)) { type = "Document"; } if (string.Equals(type, "Video")) { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => dialogDetailsViewModel.SendVideo(file)); } else if (string.Equals(type, "Image")) { var file = args.Files.FirstOrDefault(); if (file != null) { #if MULTIPLE_PHOTOS Photos = args.Files; return; #endif #if WP81 Telegram.Api.Helpers.Execute.BeginOnThreadPool(async () => { var randomStream = await file.OpenReadAsync(); await ChooseAttachmentViewModel.Handle(IoC.Get(), randomStream, file.Name); //MessageBox.Show("OnContractActivated after handle"); dialogDetailsViewModel.BackwardInAnimationComplete(); }); #else Telegram.Api.Helpers.Execute.BeginOnThreadPool(async () => { var randomStream = await file.OpenReadAsync(); var chosenPhoto = randomStream.AsStreamForRead(); //MessageBox.Show("OnContractActivated stream"); Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { ChooseAttachmentViewModel.Handle(IoC.Get(), chosenPhoto, file.Name); //MessageBox.Show("OnContractActivated after handle"); dialogDetailsViewModel.BackwardInAnimationComplete(); }); }); #endif } } else { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => dialogDetailsViewModel.SendDocument(file)); } return; } } } } else if (string.Equals(from, "SecretDialogDetailsView")) { var contentControl = RootVisual as ContentControl; if (contentControl != null) { var dialogDetailsView = contentControl.Content as SecretDialogDetailsView; if (dialogDetailsView != null) { var secretDialogDetailsViewModel = dialogDetailsView.DataContext as SecretDialogDetailsViewModel; if (secretDialogDetailsViewModel != null) { object type; if (!args.ContinuationData.TryGetValue("Type", out type)) { type = "Document"; } if (string.Equals(type, "Video")) //{ // var file = args.Files.FirstOrDefault(); // Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => dialogDetailsViewModel.EditVideo(file)); //} //else { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => secretDialogDetailsViewModel.SendDocument(file)); } else if (string.Equals(type, "Image")) { var file = args.Files.FirstOrDefault(); if (file != null) { #if MULTIPLE_PHOTOS Photos = args.Files; return; #endif #if WP81 Telegram.Api.Helpers.Execute.BeginOnThreadPool(async () => { var randomStream = await file.OpenReadAsync(); await ChooseAttachmentViewModel.Handle(IoC.Get(), randomStream, file.Name); secretDialogDetailsViewModel.OnBackwardInAnimationComplete(); }); #else Telegram.Api.Helpers.Execute.BeginOnThreadPool(async () => { var randomStream = await file.OpenReadAsync(); var chosenPhoto = randomStream.AsStreamForRead(); Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { ChooseAttachmentViewModel.Handle(IoC.Get(), chosenPhoto, file.Name); }); }); #endif } } else { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => secretDialogDetailsViewModel.SendDocument(file)); } return; } } } } else if (string.Equals(from, "ResidentialAddressView")) { var contentControl = RootVisual as ContentControl; if (contentControl != null) { var view = contentControl.Content as ResidentialAddressView; if (view != null) { object type; if (!args.ContinuationData.TryGetValue("Type", out type)) { type = "Document"; } if (type is string) { var viewModel = view.DataContext as ResidentialAddressViewModel; if (viewModel != null) { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => viewModel.SendDocument(type.ToString(), file)); return; } } } } } else if (string.Equals(from, "PersonalDetailsView")) { var contentControl = RootVisual as ContentControl; if (contentControl != null) { object type; if (!args.ContinuationData.TryGetValue("Type", out type)) { type = "Document"; } if (type is string) { var view = contentControl.Content as PersonalDetailsView; if (view != null) { var viewModel = view.DataContext as PersonalDetailsViewModel; if (viewModel != null) { var file = args.Files.FirstOrDefault(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => viewModel.SendDocument(type.ToString(), file)); return; } } } } } } } } #endif #region Delayed Bugsense exceptions private readonly object _bugsenseSyncRoot = new object(); public bool IsBugsenseInitialized { get; set; } #endregion } public class ChooseFileInfo { public DateTime Time { get; set; } public ChooseFileInfo(DateTime time) { Time = time; } } } ================================================ FILE: TelegramClient/Behaviors/MarkTapAsHandledBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Input; using System.Windows.Interactivity; namespace TelegramClient.Behaviors { public class HandledEventTrigger : System.Windows.Interactivity.EventTrigger { protected override void OnEvent(System.EventArgs eventArgs) { var routedEventArgs = eventArgs as GestureEventArgs; if (routedEventArgs != null) routedEventArgs.Handled = true; base.OnEvent(eventArgs); } } public class MarkTapAsHandledBehavior : Behavior { protected override void OnAttached() { AssociatedObject.Tap += AssociatedObjectOnTap; base.OnAttached(); } protected override void OnDetaching() { base.OnDetaching(); AssociatedObject.Tap -= AssociatedObjectOnTap; } private void AssociatedObjectOnTap(object sender, GestureEventArgs gestureEventArgs) { gestureEventArgs.Handled = true; } } } ================================================ FILE: TelegramClient/Behaviors/PanAndZoomBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using System.Windows.Interactivity; using System.Windows.Media; using System.Windows.Media.Animation; using Microsoft.Phone.Controls; using DragCompletedGestureEventArgs = TelegramClient.Controls.GestureListener.DragCompletedGestureEventArgs; using DragDeltaGestureEventArgs = TelegramClient.Controls.GestureListener.DragDeltaGestureEventArgs; using DragStartedGestureEventArgs = TelegramClient.Controls.GestureListener.DragStartedGestureEventArgs; using FlickGestureEventArgs = TelegramClient.Controls.GestureListener.FlickGestureEventArgs; using GestureEventArgs = TelegramClient.Controls.GestureListener.GestureEventArgs; using GestureListener = TelegramClient.Controls.GestureListener.GestureListener; using GestureService = TelegramClient.Controls.GestureListener.GestureService; using PinchGestureEventArgs = TelegramClient.Controls.GestureListener.PinchGestureEventArgs; using PinchStartedGestureEventArgs = TelegramClient.Controls.GestureListener.PinchStartedGestureEventArgs; namespace TelegramClient.Behaviors { public class PanAndZoomBehavior : Behavior { private const double MinZoom = 1.0; private readonly CompositeTransform _old = new CompositeTransform(); private double _initialScale; private GestureListener _listener; private bool _isEnabled = true; public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; } } public bool SuppressDrag { get; set; } public PanAndZoomBehavior() { MaxZoom = 10.0; } /// /// This does not enforce zoom bounds on setting. /// public double MaxZoom { get; set; } public static readonly DependencyProperty CanZoomProperty = DependencyProperty.Register( "CanZoom", typeof (bool), typeof (PanAndZoomBehavior), new PropertyMetadata(default(bool))); public bool CanZoom { get { return (bool) GetValue(CanZoomProperty); } set { SetValue(CanZoomProperty, value); } } public static readonly DependencyProperty CurrentScaleXProperty = DependencyProperty.Register( "CurrentScaleX", typeof (double), typeof (PanAndZoomBehavior), new PropertyMetadata(1.0)); public double CurrentScaleX { get { return (double) GetValue(CurrentScaleXProperty); } set { SetValue(CurrentScaleXProperty, value); } } public static readonly DependencyProperty CurrentScaleYProperty = DependencyProperty.Register( "CurrentScaleY", typeof (double), typeof (PanAndZoomBehavior), new PropertyMetadata(1.0)); public double CurrentScaleY { get { return (double) GetValue(CurrentScaleYProperty); } set { SetValue(CurrentScaleYProperty, value); } } public static readonly DependencyProperty BackgroundPanelProperty = DependencyProperty.Register( "BackgroundPanel", typeof (Panel), typeof (PanAndZoomBehavior), new PropertyMetadata(default(Panel))); public Panel BackgroundPanel { get { return (Panel) GetValue(BackgroundPanelProperty); } set { SetValue(BackgroundPanelProperty, value); } } public static readonly DependencyProperty DebugTextProperty = DependencyProperty.Register( "DebugText", typeof (TextBlock), typeof (PanAndZoomBehavior), new PropertyMetadata(default(TextBlock))); private Orientation? _direction; public TextBlock DebugText { get { return (TextBlock) GetValue(DebugTextProperty); } set { SetValue(DebugTextProperty, value); } } public event EventHandler Flick; protected virtual void RaiseFlick(FlickGestureEventArgs e) { var handler = Flick; if (handler != null) handler(this, e); } public event EventHandler DragDelta; protected virtual void RaiseDragDelta(DragDeltaGestureEventArgs e) { var handler = DragDelta; if (handler != null) handler(this, e); } protected override void OnAttached() { base.OnAttached(); AssociatedObject.RenderTransform = new CompositeTransform(); _listener = GestureService.GetGestureListener(AssociatedObject); _listener.PinchDelta += OnPinchDelta; _listener.PinchStarted += OnPinchStarted; _listener.DragStarted += OnDragStarted; _listener.DragDelta += OnDragDelta; //_listener.DragCompleted += OnDragCompleted; _listener.GestureCompleted += OnGestureCompleted; _listener.Flick += OnFlick; _listener.Tap += OnTap; _listener.DoubleTap += OnDoubleTap; } protected override void OnDetaching() { _listener.PinchDelta -= OnPinchDelta; _listener.PinchStarted -= OnPinchStarted; _listener.DragStarted -= OnDragStarted; _listener.DragDelta -= OnDragDelta; //_listener.DragCompleted -= OnDragCompleted; _listener.GestureCompleted -= OnGestureCompleted; _listener.Flick -= OnFlick; _listener.Tap -= OnTap; _listener.DoubleTap -= OnDoubleTap; _listener = null; base.OnDetaching(); } public event EventHandler DoubleTap; protected virtual void RaiseDoubleTap(GestureEventArgs e) { var handler = DoubleTap; if (handler != null) handler(this, e); } private void OnDoubleTap(object sender, GestureEventArgs e) { if (!IsEnabled) return; if (!CanZoom) return; if (CurrentScaleX > 1.0 || CurrentScaleY > 1.0) { var frameworkElement = sender as FrameworkElement; var transform = frameworkElement.RenderTransform as CompositeTransform; AnimateTransform(transform, 0.0, 0.0, 1.0, 1.0); CurrentScaleX = 1.0; CurrentScaleY = 1.0; } else { var frameworkElement = sender as FrameworkElement; var transform = frameworkElement.RenderTransform as CompositeTransform; var a = transform.Transform(e.GetPosition(frameworkElement)); // we need the points to be relative to the current transform var b = transform.Transform(e.GetPosition(frameworkElement)); var scale = new CompositeTransform { CenterX = (a.X + b.X) / 2, CenterY = (a.Y + b.Y) / 2, ScaleX = 4.0, ScaleY = 4.0 }; ConstrainToParentBounds(frameworkElement, scale); var newTransform = ComposeScaleTranslate(transform, scale); AnimateTransform(transform, newTransform.TranslateX, newTransform.TranslateY, newTransform.ScaleX, newTransform.ScaleY); _old.CenterX = newTransform.CenterX; _old.CenterY = newTransform.CenterY; _old.TranslateX = newTransform.TranslateX; _old.TranslateY = newTransform.TranslateY; _old.ScaleX = newTransform.ScaleX; _old.ScaleY = newTransform.ScaleY; CurrentScaleX = _old.ScaleX; CurrentScaleY = _old.ScaleY; } RaiseDoubleTap(e); } private static void AnimateTransform(CompositeTransform transform, double translateX, double translateY, double scaleX, double scaleY) { var storyboard = new Storyboard(); var translateXAnimation = new DoubleAnimationUsingKeyFrames(); translateXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = translateX, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); Storyboard.SetTarget(translateXAnimation, transform); Storyboard.SetTargetProperty(translateXAnimation, new PropertyPath("TranslateX")); storyboard.Children.Add(translateXAnimation); var translateYAnimation = new DoubleAnimationUsingKeyFrames(); translateYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = translateY, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); Storyboard.SetTarget(translateYAnimation, transform); Storyboard.SetTargetProperty(translateYAnimation, new PropertyPath("TranslateY")); storyboard.Children.Add(translateYAnimation); var scaleXAnimation = new DoubleAnimationUsingKeyFrames(); scaleXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = scaleX, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); Storyboard.SetTarget(scaleXAnimation, transform); Storyboard.SetTargetProperty(scaleXAnimation, new PropertyPath("ScaleX")); storyboard.Children.Add(scaleXAnimation); var scaleYAnimation = new DoubleAnimationUsingKeyFrames(); scaleYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = scaleY, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); Storyboard.SetTarget(scaleYAnimation, transform); Storyboard.SetTargetProperty(scaleYAnimation, new PropertyPath("ScaleY")); storyboard.Children.Add(scaleYAnimation); storyboard.Begin(); } public event EventHandler Tap; protected virtual void RaiseTap(GestureEventArgs e) { var handler = Tap; if (handler != null) handler(this, e); } private void OnTap(object sender, GestureEventArgs e) { if (!IsEnabled) return; RaiseTap(e); } public event EventHandler Close; protected virtual void RaiseClose(PanAndZoomCloseEventArgs e) { var handler = Close; if (handler != null) handler(this, e); } private void OnGestureCompleted(object sender, GestureEventArgs e) { if (_isDragging) { var args = new DragCompletedGestureEventArgs( new Point(0.0, 0.0), new Point(0.0, 0.0), new Point(0.0, 0.0), Orientation.Vertical, new Point(0.0, 0.0)); if (_lastDragDeltaEventArgs != null) { args = new DragCompletedGestureEventArgs( new Point(0.0, 0.0), new Point(0.0, 0.0), new Point(_lastDragDeltaEventArgs.HorizontalChange, _lastDragDeltaEventArgs.VerticalChange), _lastDragDeltaEventArgs.Direction, new Point(0.0, 0.0)); } _isDragging = false; OnDragCompleted(sender, args); } } private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e) { //System.Diagnostics.Debug.WriteLine("OnDragCompleted IsEnabled=" + IsEnabled + " horizontal_change=" + e.HorizontalChange + " vertical_change=" + e.VerticalChange + " direction=" + e.Direction + " horizontal_velocity=" + e.HorizontalVelocity + " vertical_velocity=" + e.VerticalVelocity); _isDragging = false; if (!IsEnabled) return; if (CurrentScaleX != 1.0) { return; } var frameworkElement = sender as FrameworkElement; var transform = frameworkElement.RenderTransform as CompositeTransform; if (DebugText != null) { DebugText.Text = string.Format("DragCompleted TranslateX={0} TranslateY={1}", transform.TranslateX, transform.TranslateY); } if (_direction == Orientation.Vertical) { if (SuppressDrag) return; if (Math.Abs(transform.TranslateY) > 100) { RaiseClose(new PanAndZoomCloseEventArgs{ VerticalChange = e.VerticalChange }); return; } else { var storyboard = new Storyboard(); var translateAnimation = new DoubleAnimationUsingKeyFrames(); translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); Storyboard.SetTarget(translateAnimation, frameworkElement); Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); storyboard.Children.Add(translateAnimation); storyboard.Begin(); if (BackgroundPanel != null) { BackgroundPanel.Opacity = 1.0; //BackgroundPanel.Background = new SolidColorBrush(Colors.Black); } } } //else if (_direction == Orientation.Horizontal && Math.Abs(transform.TranslateX) < 150) //{ // var storyboard = new Storyboard(); // var translateAnimation = new DoubleAnimationUsingKeyFrames(); // translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.15), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); // Storyboard.SetTarget(translateAnimation, img); // Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); // storyboard.Children.Add(translateAnimation); // storyboard.Begin(); //} _direction = null; } private void OnFlick(object sender, FlickGestureEventArgs e) { //System.Diagnostics.Debug.WriteLine("OnFlick IsEnabled=" + IsEnabled + " angle=" + e.Angle + " direction=" + e.Direction + " horizontal_velocity=" + e.HorizontalVelocity + " vertical_velocity=" + e.VerticalVelocity); if (!IsEnabled) return; RaiseFlick(e); } private bool _isDragging; private void OnDragStarted(object sender, DragStartedGestureEventArgs e) { if (!IsEnabled) return; _direction = e.Direction; _isDragging = true; } private void OnPinchDelta(object sender, PinchGestureEventArgs e) { if (!IsEnabled) return; if (!CanZoom) return; var frameworkElement = sender as FrameworkElement; var transform = frameworkElement.RenderTransform as CompositeTransform; var a = transform.Transform(e.GetPosition(frameworkElement, 0)); // we need the points to be relative to the current transform var b = transform.Transform(e.GetPosition(frameworkElement, 1)); var scale = new CompositeTransform { CenterX = (a.X + b.X) / 2, CenterY = (a.Y + b.Y) / 2, ScaleX = Clamp(e.DistanceRatio * _initialScale / _old.ScaleX, MinZoom / _old.ScaleX, MaxZoom / _old.ScaleX), ScaleY = Clamp(e.DistanceRatio * _initialScale / _old.ScaleY, MinZoom / _old.ScaleY, MaxZoom / _old.ScaleY) }; ConstrainToParentBounds(frameworkElement, scale); transform = ComposeScaleTranslate(transform, scale); frameworkElement.RenderTransform = transform; _old.CenterX = transform.CenterX; _old.CenterY = transform.CenterY; _old.TranslateX = transform.TranslateX; _old.TranslateY = transform.TranslateY; _old.ScaleX = transform.ScaleX; _old.ScaleY = transform.ScaleY; CurrentScaleX = _old.ScaleX; CurrentScaleY = _old.ScaleY; } private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e) { if (!IsEnabled) return; if (!CanZoom) return; var img = sender as FrameworkElement; var transform = img.RenderTransform as CompositeTransform; _old.CenterX = transform.CenterX; _old.CenterY = transform.CenterY; _old.TranslateX = transform.TranslateX; _old.TranslateY = transform.TranslateY; _old.ScaleX = transform.ScaleX; _old.ScaleY = transform.ScaleY; _initialScale = transform.ScaleX; } private DragDeltaGestureEventArgs _lastDragDeltaEventArgs; private void OnDragDelta(object sender, DragDeltaGestureEventArgs e) { if (!IsEnabled) return; _lastDragDeltaEventArgs = e; RaiseDragDelta(e); //if (CurrentScaleX == 1.0) return; //DebugText.Text = string.Format("DragDelta X={0} Y={1} Direction={2}", e.HorizontalChange, e.VerticalChange, e.Direction); // Translation is done as the last operation, so no need to move the operation up in composition order var img = sender as FrameworkElement; if (img == null) return; var transform = img.RenderTransform as CompositeTransform; if (transform == null) return; CompositeTransform translate = null; if (CurrentScaleX == 1.0) { if (SuppressDrag) return; if (_direction == Orientation.Vertical) { translate = new CompositeTransform { TranslateX = 0, TranslateY = e.VerticalChange }; if (BackgroundPanel != null) { var rootFrameHeight = ((PhoneApplicationFrame)Application.Current.RootVisual).ActualHeight; var deltaY = Math.Abs(translate.TranslateY + translate.ScaleY * transform.TranslateY + (translate.ScaleY - 1) * (transform.CenterY - translate.CenterY)); var opacity = (rootFrameHeight - deltaY) / rootFrameHeight; var backgroundBrush = (SolidColorBrush)BackgroundPanel.Background; var backgroundColor = backgroundBrush.Color; backgroundColor.A = (byte)(opacity * byte.MaxValue); BackgroundPanel.Opacity = opacity; //BackgroundPanel.Background = new SolidColorBrush(backgroundColor); } img.RenderTransform = ComposeScaleTranslate(transform, translate); } else if (_direction == Orientation.Horizontal) { //translate = new CompositeTransform //{ // TranslateX = e.HorizontalChange, // TranslateY = 0 //}; //img.RenderTransform = ComposeScaleTranslate(transform, translate); } } else { if (!CanZoom) return; translate = new CompositeTransform { TranslateX = e.HorizontalChange, TranslateY = e.VerticalChange }; ConstrainToParentBounds(img, translate); img.RenderTransform = ComposeScaleTranslate(transform, translate); } } private static void ConstrainToParentBounds(FrameworkElement elm, CompositeTransform transform) { var p = (FrameworkElement)elm.Parent; var canvas = p.TransformToVisual(elm).TransformBounds(new Rect(0, 0, p.ActualWidth, p.ActualHeight)); // Now compute the new viewport relative to the previous var newViewport = transform.TransformBounds(new Rect(0, 0, elm.ActualWidth, elm.ActualHeight)); var top = newViewport.Top - canvas.Top; var bottom = canvas.Bottom - newViewport.Bottom; var left = newViewport.Left - canvas.Left; var right = canvas.Right - newViewport.Right; if (top > 0) if (top + bottom > 0) transform.TranslateY += (bottom - top) / 2; else transform.TranslateY -= top; else if (bottom > 0) if (top + bottom > 0) transform.TranslateY += (bottom - top) / 2; else transform.TranslateY += bottom; if (left > 0) if (left + right > 0) transform.TranslateX += (right - left) / 2; else transform.TranslateX -= left; else if (right > 0) if (left + right > 0) transform.TranslateX += (right - left) / 2; else transform.TranslateX += right; } public static CompositeTransform ComposeScaleTranslate(CompositeTransform fst, CompositeTransform snd) { // See http://stackoverflow.com/a/19439099/388010 on why this works var compositTransform = new CompositeTransform { ScaleX = fst.ScaleX * snd.ScaleX, ScaleY = fst.ScaleY * snd.ScaleY, CenterX = fst.CenterX, CenterY = fst.CenterY, TranslateX = snd.TranslateX + snd.ScaleX * fst.TranslateX + (snd.ScaleX - 1) * (fst.CenterX - snd.CenterX), TranslateY = snd.TranslateY + snd.ScaleY * fst.TranslateY + (snd.ScaleY - 1) * (fst.CenterY - snd.CenterY), }; return compositTransform; } public static double Clamp(double val, double min, double max) { return val > min ? val < max ? val : max : min; } private void OrientationChanged(object sender, OrientationChangedEventArgs e) { // Handling orientation change is a heck more involved than I initially thought AssociatedObject.RenderTransform = new CompositeTransform(); } } public class PanAndZoomCloseEventArgs : System.EventArgs { public double VerticalChange { get; set; } } public class PanAndZoom2Behavior : Behavior { private const double MinZoom = 1.0; private readonly CompositeTransform _old = new CompositeTransform(); private double _initialScale; private GestureListener _listener; private bool _isEnabled = true; public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; } } public PanAndZoom2Behavior() { MaxZoom = 10.0; } /// /// This does not enforce zoom bounds on setting. /// public double MaxZoom { get; set; } public static readonly DependencyProperty CanZoomProperty = DependencyProperty.Register( "CanZoom", typeof(bool), typeof(PanAndZoom2Behavior), new PropertyMetadata(default(bool))); public bool CanZoom { get { return (bool)GetValue(CanZoomProperty); } set { SetValue(CanZoomProperty, value); } } public static readonly DependencyProperty CurrentScaleXProperty = DependencyProperty.Register( "CurrentScaleX", typeof(double), typeof(PanAndZoom2Behavior), new PropertyMetadata(1.0)); public double CurrentScaleX { get { return (double)GetValue(CurrentScaleXProperty); } set { SetValue(CurrentScaleXProperty, value); } } public static readonly DependencyProperty CurrentScaleYProperty = DependencyProperty.Register( "CurrentScaleY", typeof(double), typeof(PanAndZoom2Behavior), new PropertyMetadata(1.0)); public double CurrentScaleY { get { return (double)GetValue(CurrentScaleYProperty); } set { SetValue(CurrentScaleYProperty, value); } } public static readonly DependencyProperty BackgroundPanelProperty = DependencyProperty.Register( "BackgroundPanel", typeof(Panel), typeof(PanAndZoom2Behavior), new PropertyMetadata(default(Panel))); public Panel BackgroundPanel { get { return (Panel)GetValue(BackgroundPanelProperty); } set { SetValue(BackgroundPanelProperty, value); } } public static readonly DependencyProperty DebugTextProperty = DependencyProperty.Register( "DebugText", typeof(TextBlock), typeof(PanAndZoom2Behavior), new PropertyMetadata(default(TextBlock))); private Orientation? _direction; public TextBlock DebugText { get { return (TextBlock)GetValue(DebugTextProperty); } set { SetValue(DebugTextProperty, value); } } public event EventHandler Flick; protected virtual void RaiseFlick(FlickGestureEventArgs e) { var handler = Flick; if (handler != null) handler(this, e); } public event EventHandler DragDelta; protected virtual void RaiseDragDelta(DragDeltaGestureEventArgs e) { var handler = DragDelta; if (handler != null) handler(this, e); } protected override void OnAttached() { base.OnAttached(); AssociatedObject.RenderTransform = new CompositeTransform(); _listener = GestureService.GetGestureListener(AssociatedObject); //Telegram.Api.Helpers.Execute.BeginOnUIThread(TimeSpan.FromSeconds(1.0), () => //{ _listener.PinchDelta += OnPinchDelta; _listener.PinchStarted += OnPinchStarted; _listener.DragStarted += OnDragStarted; _listener.DragDelta += OnDragDelta; _listener.DragCompleted += OnDragCompleted; _listener.Flick += OnFlick; _listener.Tap += OnTap; _listener.DoubleTap += OnDoubleTap; //}); // wait for the RootVisual to be initialized //Dispatcher.BeginInvoke(() => // ((PhoneApplicationFrame)Application.Current.RootVisual).OrientationChanged += OrientationChanged); } protected override void OnDetaching() { //((PhoneApplicationPage)Application.Current.RootVisual).OrientationChanged -= OrientationChanged; _listener.Flick -= OnFlick; _listener.PinchDelta -= OnPinchDelta; _listener.PinchStarted -= OnPinchStarted; _listener.DragStarted -= OnDragStarted; _listener.DragDelta -= OnDragDelta; _listener.DragCompleted -= OnDragCompleted; _listener.Tap -= OnTap; _listener.DoubleTap -= OnDoubleTap; _listener = null; base.OnDetaching(); } public event EventHandler DoubleTap; protected virtual void RaiseDoubleTap(GestureEventArgs e) { var handler = DoubleTap; if (handler != null) handler(this, e); } private void OnDoubleTap(object sender, GestureEventArgs e) { if (!IsEnabled) return; RaiseDoubleTap(e); } public event EventHandler Tap; protected virtual void RaiseTap(GestureEventArgs e) { var handler = Tap; if (handler != null) handler(this, e); } private void OnTap(object sender, GestureEventArgs e) { if (!IsEnabled) return; RaiseTap(e); } public event EventHandler Close; protected virtual void RaiseClose(DragCompletedGestureEventArgs e) { var handler = Close; if (handler != null) handler(this, e); } private void OnDragCompleted(object sender, DragCompletedGestureEventArgs e) { if (!IsEnabled) return; //if (CurrentScaleX != 1.0) //{ // return; //} //var frameworkElement = sender as FrameworkElement; //var transform = frameworkElement.RenderTransform as CompositeTransform; //if (DebugText != null) //{ // DebugText.Text = string.Format("DragCompleted TranslateX={0} TranslateY={1}", transform.TranslateX, transform.TranslateY); //} //if (_direction == Orientation.Vertical) //{ // if (Math.Abs(transform.TranslateY) > 100) // { // RaiseClose(e); // return; // } // else // { // var storyboard = new Storyboard(); // var translateAnimation = new DoubleAnimationUsingKeyFrames(); // translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); // Storyboard.SetTarget(translateAnimation, frameworkElement); // Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateY)")); // storyboard.Children.Add(translateAnimation); // storyboard.Begin(); // if (BackgroundPanel != null) // { // BackgroundPanel.Opacity = 1.0; // //BackgroundPanel.Background = new SolidColorBrush(Colors.Black); // } // } //} //else if (_direction == Orientation.Horizontal && Math.Abs(transform.TranslateX) < 150) //{ // var storyboard = new Storyboard(); // var translateAnimation = new DoubleAnimationUsingKeyFrames(); // translateAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.15), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }); // Storyboard.SetTarget(translateAnimation, img); // Storyboard.SetTargetProperty(translateAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); // storyboard.Children.Add(translateAnimation); // storyboard.Begin(); //} _direction = null; } private void OnFlick(object sender, FlickGestureEventArgs e) { if (!IsEnabled) return; RaiseFlick(e); } private void OnDragStarted(object sender, DragStartedGestureEventArgs e) { if (!IsEnabled) return; _direction = e.Direction; } private void OnPinchDelta(object sender, PinchGestureEventArgs e) { if (!IsEnabled) return; if (!CanZoom) return; var frameworkElement = sender as FrameworkElement; var transform = frameworkElement.RenderTransform as CompositeTransform; var a = transform.Transform(e.GetPosition(frameworkElement, 0)); // we need the points to be relative to the current transform var b = transform.Transform(e.GetPosition(frameworkElement, 1)); var scale = new CompositeTransform { CenterX = (a.X + b.X) / 2, CenterY = (a.Y + b.Y) / 2, ScaleX = Clamp(e.DistanceRatio * _initialScale / _old.ScaleX, MinZoom / _old.ScaleX, MaxZoom / _old.ScaleX), ScaleY = Clamp(e.DistanceRatio * _initialScale / _old.ScaleY, MinZoom / _old.ScaleY, MaxZoom / _old.ScaleY) }; ConstrainToParentBounds(frameworkElement, scale); transform = ComposeScaleTranslate(transform, scale); frameworkElement.RenderTransform = transform; _old.CenterX = transform.CenterX; _old.CenterY = transform.CenterY; _old.TranslateX = transform.TranslateX; _old.TranslateY = transform.TranslateY; _old.ScaleX = transform.ScaleX; _old.ScaleY = transform.ScaleY; CurrentScaleX = _old.ScaleX; CurrentScaleY = _old.ScaleY; if (DebugText != null) { DebugText.Text = string.Format("Scale={0}x{1}\nCenter={2}x{3}\nTranslate={4}x{5}", transform.ScaleX, transform.ScaleY, transform.CenterX, transform.CenterY, transform.TranslateX, transform.TranslateY); } } private void OnPinchStarted(object sender, PinchStartedGestureEventArgs e) { if (!IsEnabled) return; if (!CanZoom) return; var img = sender as FrameworkElement; var transform = img.RenderTransform as CompositeTransform; _old.CenterX = transform.CenterX; _old.CenterY = transform.CenterY; _old.TranslateX = transform.TranslateX; _old.TranslateY = transform.TranslateY; _old.ScaleX = transform.ScaleX; _old.ScaleY = transform.ScaleY; _initialScale = transform.ScaleX; } private void OnDragDelta(object sender, DragDeltaGestureEventArgs e) { if (!IsEnabled) return; RaiseDragDelta(e); //if (CurrentScaleX == 1.0) return; //DebugText.Text = string.Format("DragDelta X={0} Y={1} Direction={2}", e.HorizontalChange, e.VerticalChange, e.Direction); // Translation is done as the last operation, so no need to move the operation up in composition order var img = sender as FrameworkElement; if (img == null) return; var transform = img.RenderTransform as CompositeTransform; if (transform == null) return; if (!CanZoom) return; var translate = new CompositeTransform { TranslateX = e.HorizontalChange, TranslateY = e.VerticalChange }; ConstrainToParentBounds(img, translate); var t = ComposeScaleTranslate(transform, translate); img.RenderTransform = t; if (DebugText != null) { DebugText.Text = string.Format("Scale={0}x{1}\nCenter={2}x{3}\nTranslate={4}x{5}", t.ScaleX, t.ScaleY, t.CenterX, t.CenterY, t.TranslateX, t.TranslateY); } } private static void ConstrainToParentBounds(FrameworkElement elm, CompositeTransform transform) { var p = (FrameworkElement)elm.Parent; var canvas = p.TransformToVisual(elm).TransformBounds(new Rect(0, 0, p.ActualWidth, p.ActualHeight)); // Now compute the new viewport relative to the previous var newViewport = transform.TransformBounds(new Rect(0, 0, elm.ActualWidth, elm.ActualHeight)); var top = newViewport.Top - canvas.Top; var bottom = canvas.Bottom - newViewport.Bottom; var left = newViewport.Left - canvas.Left; var right = canvas.Right - newViewport.Right; if (top > 0) if (top + bottom > 0) transform.TranslateY += (bottom - top) / 2; else transform.TranslateY -= top; else if (bottom > 0) if (top + bottom > 0) transform.TranslateY += (bottom - top) / 2; else transform.TranslateY += bottom; if (left > 0) if (left + right > 0) transform.TranslateX += (right - left) / 2; else transform.TranslateX -= left; else if (right > 0) if (left + right > 0) transform.TranslateX += (right - left) / 2; else transform.TranslateX += right; } public static CompositeTransform ComposeScaleTranslate(CompositeTransform fst, CompositeTransform snd) { // See http://stackoverflow.com/a/19439099/388010 on why this works var compositTransform = new CompositeTransform { ScaleX = fst.ScaleX * snd.ScaleX, ScaleY = fst.ScaleY * snd.ScaleY, CenterX = fst.CenterX, CenterY = fst.CenterY, TranslateX = snd.TranslateX + snd.ScaleX * fst.TranslateX + (snd.ScaleX - 1) * (fst.CenterX - snd.CenterX), TranslateY = snd.TranslateY + snd.ScaleY * fst.TranslateY + (snd.ScaleY - 1) * (fst.CenterY - snd.CenterY), }; return compositTransform; } private static double Clamp(double val, double min, double max) { return val > min ? val < max ? val : max : min; } private void OrientationChanged(object sender, OrientationChangedEventArgs e) { // Handling orientation change is a heck more involved than I initially thought AssociatedObject.RenderTransform = new CompositeTransform(); } } } ================================================ FILE: TelegramClient/Behaviors/ProgressBarSmoother.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls.Primitives; using System.Windows.Media.Animation; namespace TelegramClient.Behaviors { public class ProgressBarSmoother { public static double GetSmoothValue(DependencyObject obj) { return (double)obj.GetValue(SmoothValueProperty); } public static void SetSmoothValue(DependencyObject obj, double value) { obj.SetValue(SmoothValueProperty, value); } public static readonly DependencyProperty SmoothValueProperty = DependencyProperty.RegisterAttached("SmoothValue", typeof(double), typeof(ProgressBarSmoother), new PropertyMetadata(0.0, OnSmoothValueChanged)); private static void OnSmoothValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //if ((double)e.NewValue > (double)e.OldValue) //{ //} var animation = new DoubleAnimation { To = (double) e.NewValue, Duration = new Duration(TimeSpan.FromSeconds(0.2)), //EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 5.0 } }; Storyboard.SetTarget(animation, d); Storyboard.SetTargetProperty(animation, new PropertyPath(RangeBase.ValueProperty)); var sb = new Storyboard(); sb.Children.Add(animation); sb.Begin(); } } } ================================================ FILE: TelegramClient/Behaviors/SelectionBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Controls; using System.Windows.Interactivity; using System.Windows.Media; using System.Windows.Media.Animation; using Caliburn.Micro; using Telegram.Api.TL; namespace TelegramClient.Behaviors { public class SelectionBehavior : Behavior { public static readonly DependencyProperty IsSelectionEnabledProperty = DependencyProperty.Register( "IsSelectionEnabled", typeof (bool), typeof (SelectionBehavior), new PropertyMetadata(default(bool), OnSelectionChanged)); private static void OnSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var behavior = d as SelectionBehavior; if (behavior != null && behavior.AssociatedObject != null) { if ((bool) e.NewValue) { var storyboard = new Storyboard(); if (!(behavior.AssociatedObject.RenderTransform is CompositeTransform)) { behavior.AssociatedObject.RenderTransform = new CompositeTransform(); } var continuumLayoutRootY = new DoubleAnimationUsingKeyFrames(); continuumLayoutRootY.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = -80.0 }); continuumLayoutRootY.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.2), Value = -80.0 }); continuumLayoutRootY.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.55), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 3.0 } }); Storyboard.SetTarget(continuumLayoutRootY, behavior.AssociatedObject); Storyboard.SetTargetProperty(continuumLayoutRootY, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); storyboard.Children.Add(continuumLayoutRootY); behavior.AssociatedObject.Visibility = Visibility.Visible; storyboard.Begin(); } else { behavior.AssociatedObject.Visibility = Visibility.Collapsed; //var storyboard = new Storyboard(); //if (!(behavior.AssociatedObject.RenderTransform is CompositeTransform)) //{ // behavior.AssociatedObject.RenderTransform = new CompositeTransform(); //} //var translateX = new DoubleAnimationUsingKeyFrames(); //translateX.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0.0 }); //translateX.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = -50.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 3.0 } }); //Storyboard.SetTarget(translateX, behavior.AssociatedObject); //Storyboard.SetTargetProperty(translateX, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); //storyboard.Children.Add(translateX); //var visibility = new ObjectAnimationUsingKeyFrames(); //visibility.KeyFrames.Add(new DiscreteObjectKeyFrame { KeyTime = TimeSpan.FromSeconds(0.25), Value = Visibility.Collapsed }); //Storyboard.SetTarget(visibility, behavior.AssociatedObject); //Storyboard.SetTargetProperty(visibility, new PropertyPath("Visibility")); //storyboard.Children.Add(visibility); //storyboard.Begin(); } } } public bool IsSelectionEnabled { get { return (bool) GetValue(IsSelectionEnabledProperty); } set { SetValue(IsSelectionEnabledProperty, value); } } protected override void OnAttached() { AssociatedObject.Loaded += AssociatedObject_OnLoaded; base.OnAttached(); } private void AssociatedObject_OnLoaded(object sender, RoutedEventArgs e) { if (!(AssociatedObject.RenderTransform is CompositeTransform)) { AssociatedObject.RenderTransform = new CompositeTransform(); } var transform = AssociatedObject.RenderTransform as CompositeTransform; transform.TranslateX = IsSelectionEnabled ? 0.0 : -68.0; //var message = AssociatedObject.DataContext as TLMessage; //if (message != null) //{ // TLUtils.WriteLine(string.Format("SelectionsBehavior.OnLoaded {0} {1}", message.Index, message.Message), LogSeverity.Error); //} //else //{ // TLUtils.WriteLine(string.Format("SelectionsBehavior.OnLoaded {0}", "null"), LogSeverity.Error); //} } protected override void OnDetaching() { AssociatedObject.Loaded -= AssociatedObject_OnLoaded; base.OnDetaching(); } } public class NewSelectionBehavior : Behavior { public static readonly DependencyProperty IsSelectionEnabledProperty = DependencyProperty.Register( "IsSelectionEnabled", typeof(bool), typeof(NewSelectionBehavior), new PropertyMetadata(default(bool), OnSelectionChanged)); private static void OnSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var behavior = d as NewSelectionBehavior; if (behavior != null && behavior.AssociatedObject != null) { if ((bool)e.NewValue) { //behavior.AssociatedObject.CacheMode = behavior.AssociatedObject.CacheMode ?? new BitmapCache(); var storyboard = new Storyboard(); if (!(behavior.AssociatedObject.RenderTransform is CompositeTransform)) { behavior.AssociatedObject.RenderTransform = new CompositeTransform(); } var translateXAnimation = new DoubleAnimationUsingKeyFrames(); translateXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = -68.0 }); translateXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.55), Value = 0.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 3.0 } }); Storyboard.SetTarget(translateXAnimation, behavior.AssociatedObject); Storyboard.SetTargetProperty(translateXAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); storyboard.Children.Add(translateXAnimation); //behavior.AssociatedObject.Visibility = Visibility.Visible; storyboard.Begin(); //Deployment.Current.Dispatcher.BeginInvoke(() => storyboard.Begin()); } else { var storyboard = new Storyboard(); if (!(behavior.AssociatedObject.RenderTransform is CompositeTransform)) { behavior.AssociatedObject.RenderTransform = new CompositeTransform(); } var translateXAnimation = new DoubleAnimationUsingKeyFrames(); translateXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0.0 }); translateXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.55), Value = -68.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 3.0 } }); Storyboard.SetTarget(translateXAnimation, behavior.AssociatedObject); Storyboard.SetTargetProperty(translateXAnimation, new PropertyPath("(UIElement.RenderTransform).(CompositeTransform.TranslateX)")); storyboard.Children.Add(translateXAnimation); //behavior.AssociatedObject.Visibility = Visibility.Visible; storyboard.Begin(); //Deployment.Current.Dispatcher.BeginInvoke(() => storyboard.Begin()); } } } public bool IsSelectionEnabled { get { return (bool)GetValue(IsSelectionEnabledProperty); } set { SetValue(IsSelectionEnabledProperty, value); } } protected override void OnAttached() { AssociatedObject.Loaded += AssociatedObject_OnLoaded; base.OnAttached(); } private void AssociatedObject_OnLoaded(object sender, RoutedEventArgs e) { var transform = AssociatedObject.RenderTransform as CompositeTransform; if (transform != null) { transform.TranslateX = IsSelectionEnabled ? 0.0 : -68.0; } } protected override void OnDetaching() { AssociatedObject.Loaded -= AssociatedObject_OnLoaded; base.OnDetaching(); } } } ================================================ FILE: TelegramClient/Behaviors/ThemeToStateBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Controls; using System.Windows.Interactivity; namespace TelegramClient.Behaviors { public class ThemeToStateBehavior : Behavior { protected override void OnAttached() { base.OnAttached(); var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; Dispatcher.BeginInvoke(() => VisualStateManager.GoToState(AssociatedObject, isLightTheme ? LightState : DarkState, true)); } [CustomPropertyValueEditor(CustomPropertyValueEditor.StateName)] public string LightState { get; set; } [CustomPropertyValueEditor(CustomPropertyValueEditor.StateName)] public string DarkState { get; set; } } } ================================================ FILE: TelegramClient/Behaviors/ToggleSwitchLocalizedContentBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Interactivity; using Microsoft.Phone.Controls; namespace TelegramClient.Behaviors { public class ToggleSwitchLocalizedContentBehavior : Behavior { public static readonly DependencyProperty OnContentProperty = DependencyProperty.Register("OnContent", typeof (string), typeof (ToggleSwitchLocalizedContentBehavior), new PropertyMetadata(default(string))); public string OnContent { get { return (string) GetValue(OnContentProperty); } set { SetValue(OnContentProperty, value); } } public static readonly DependencyProperty OffContentProperty = DependencyProperty.Register("OffContent", typeof (string), typeof (ToggleSwitchLocalizedContentBehavior), new PropertyMetadata(default(string))); public string OffContent { get { return (string) GetValue(OffContentProperty); } set { SetValue(OffContentProperty, value); } } protected override void OnAttached() { base.OnAttached(); AssociatedObject.Loaded += ToggleSwitch_Click; //AssociatedObject.Click += ToggleSwitch_Click; AssociatedObject.Checked += ToggleSwitch_Click; AssociatedObject.Unchecked += ToggleSwitch_Click; } private void ToggleSwitch_Click(object sender, RoutedEventArgs e) { AssociatedObject.Content = AssociatedObject.IsChecked == true ? OnContent : OffContent; } protected override void OnDetaching() { AssociatedObject.Unchecked -= ToggleSwitch_Click; AssociatedObject.Checked -= ToggleSwitch_Click; //AssociatedObject.Click -= ToggleSwitch_Click; AssociatedObject.Loaded -= ToggleSwitch_Click; base.OnDetaching(); } } } ================================================ FILE: TelegramClient/Behaviors/UpdateTextBindingBehavior.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Controls; using System.Windows.Interactivity; using TelegramClient.Views.Controls; namespace TelegramClient.Behaviors { public class UpdateTextBindingBehavior : Behavior { protected override void OnAttached() { base.OnAttached(); AssociatedObject.TextChanged += AssociatedObject_TextChanged; } private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs textChangedEventArgs) { var binding = AssociatedObject.GetBindingExpression(TextBox.TextProperty); if (binding != null) binding.UpdateSource(); } protected override void OnDetaching() { AssociatedObject.TextChanged -= AssociatedObject_TextChanged; base.OnDetaching(); } } public class UpdatePasswordBindingBehavior : Behavior { protected override void OnAttached() { base.OnAttached(); AssociatedObject.PasswordChanged += AssociatedObject_PasswordChanged; } private void AssociatedObject_PasswordChanged(object sender, RoutedEventArgs e) { var binding = AssociatedObject.GetBindingExpression(PasswordBox.PasswordProperty); if (binding != null) binding.UpdateSource(); } protected override void OnDetaching() { AssociatedObject.PasswordChanged -= AssociatedObject_PasswordChanged; base.OnDetaching(); } } public class UpdateLabeledTextBindingBehavior : Behavior { protected override void OnAttached() { base.OnAttached(); AssociatedObject.Input.TextChanged += AssociatedObject_TextChanged; } private void AssociatedObject_TextChanged(object sender, TextChangedEventArgs textChangedEventArgs) { AssociatedObject.Text = AssociatedObject.Input.Text; var binding = AssociatedObject.GetBindingExpression(LabeledTextBox.TextProperty); if (binding != null) binding.UpdateSource(); } protected override void OnDetaching() { AssociatedObject.Input.TextChanged -= AssociatedObject_TextChanged; base.OnDetaching(); } } } ================================================ FILE: TelegramClient/Bootstrapper.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Threading; using System.Windows; using Microsoft.Phone.Networking.Voip; using PhoneVoIPApp.UI; using Telegram.Api.Aggregator; using Telegram.Api.Services.DeviceInfo; using Telegram.EmojiPanel; using TelegramClient.Controls; using TelegramClient.Resources; using TelegramClient.ViewModels.Calls; using TelegramClient.ViewModels.Payments; #if WP8 using Windows.Phone.System.Power; #endif #if WP81 && WNS_PUSH_SERVICE using Windows.UI.Notifications; #endif using Caliburn.Micro; using Microsoft.Phone.Controls; using Microsoft.Phone.Scheduler; using Microsoft.Phone.Shell; using Telegram.Api.Helpers; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.Services.Connection; using Telegram.Api.Services.FileManager; using Telegram.Api.Services.Location; using Telegram.Api.Services.Updates; using Telegram.Api.TL; using Telegram.Api.TL.Interfaces; using Telegram.Api.Transport; using TelegramClient.Services; using TelegramClient.Utils; using TelegramClient.ViewModels; using TelegramClient.ViewModels.Additional; using TelegramClient.ViewModels.Auth; using TelegramClient.ViewModels.Chats; using TelegramClient.ViewModels.Contacts; using TelegramClient.ViewModels.Debug; using TelegramClient.ViewModels.Dialogs; using TelegramClient.ViewModels.Feed; using TelegramClient.ViewModels.Media; using TelegramClient.ViewModels.Passport; using TelegramClient.ViewModels.Search; using EnterPasswordViewModel = TelegramClient.ViewModels.Passport.EnterPasswordViewModel; using Execute = Telegram.Api.Helpers.Execute; using ExtensionMethods = Caliburn.Micro.ExtensionMethods; namespace TelegramClient { public class Bootstrapper : PhoneBootstrapperBase { public Bootstrapper() { //LogManager.GetLog = type => new DebugLog(type); Initialize(); //System.Diagnostics.Debug.WriteLine(System.Reflection.Assembly.GetCallingAssembly().FullName); //System.Diagnostics.Debug.WriteLine(Application.Current.GetType().Assembly); //System.Diagnostics.Debug.WriteLine(System.AppDomain.CurrentDomain.FriendlyName); //System.Diagnostics.Debug.WriteLine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)); } public static PhoneApplicationFrame PhoneFrame { get; protected set; } protected override PhoneApplicationFrame CreatePhoneApplicationFrame() { //return new PhoneApplicationFrame(); PhoneFrame = new TelegramTransitionFrame{ Title = AppResources.Loading }; //PhoneFrame.Loaded += InitializeMTProtoService; //PhoneFrame.FlowDirection = FlowDirection.RightToLeft; PhoneFrame.UriMapper = new TelegramUriMapper(); //var stateService = IoC.Get(); //var background = stateService.CurrentBackground; //var brush = new ImageBrush(); //PhoneFrame.Navigate(new Uri("/Views/ShellView.xaml", UriKind.Relative)); //brush.ImageSource = new BitmapImage(new Uri(background, UriKind.Relative)); //frame.Background = brush; return PhoneFrame; } private PhoneContainer _container; protected override void Configure() { App.Log("start Bootstrapper.Configure "); _container = new PhoneContainer(); // _container.Activated += instance => // { //#if DEBUG // Debug.WriteLine("Bootstrapper.Activated " + (instance != null ? instance.ToString() : "null")); //#endif // }; if (!DesignerProperties.IsInDesignTool) { _container.RegisterPhoneServices(RootFrame); } _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); #if DEBUG _container.Singleton(); _container.Singleton(); _container.Singleton(); #endif _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest>(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); //_container.PerRequest(); _container.PerRequest(); #if WP81 _container.PerRequest(); #endif _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); #if WP8 _container.PerRequest(); #endif _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.PerRequest(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); #if WP81 && WNS_PUSH_SERVICE _container.Singleton(); _container.Singleton(); #else _container.Singleton(); #endif _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); _container.Singleton(); SetupViewLocator(); // avoid xaml ui designer crashes if (Caliburn.Micro.Execute.InDesignMode) return; StartBugsenseAsync(); AddCustomConventions(); App.Log("end Bootstrapper.Configure"); } protected override void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { base.OnUnhandledException(sender, e); #if LOG_REGISTRATION TLUtils.WriteLog("Unhandled exception " + e); #endif e.Handled = true; } private static void AddCustomConventions() { // App Bar Conventions // ... the rest of your conventions } protected override object GetInstance(Type service, string key) { object instance = null; var stopwatch = Stopwatch.StartNew(); //App.Log(" Bootstrapper.GetInstance start " + (service != null ? service.ToString() : "null") + " " + stopwatch.Elapsed); instance = _container.GetInstance(service, key); //App.Log(" Bootstrapper.GetInstance stop " + (service != null ? service.ToString() : "null") + " " + stopwatch.Elapsed); return instance; } protected override IEnumerable GetAllInstances(Type service) { return _container.GetAllInstances(service); } protected override void BuildUp(object instance) { _container.BuildUp(instance); } protected override void OnStartup(object sender, StartupEventArgs e) { Telegram.Logs.Log.Write("Startup"); #if LOG_REGISTRATION TLUtils.WriteLog("App startup "); #endif base.OnStartup(sender, e); } protected override void OnLaunch(object sender, LaunchingEventArgs e) { App.Log("start Bootstrapper.OnLaunch "); Telegram.Logs.Log.Write("\nLaunch"); #if LOG_REGISTRATION TLUtils.WriteLog("App launch"); #endif EnterAppMutex(); App.Log("Bootstrapper.OnLaunch EnterAppMutex"); //var cacheService = IoC.Get(); //cacheService.Init(); App.Log("Bootstrapper.OnLaunch cacheService.Init"); var transportService = IoC.Get(); transportService.TransportConnecting += OnTransportConnecting; transportService.TransportConnected += OnTransportConnected; TLUtils.WritePerformance(">>OnLaunch"); App.Log("Bootstrapper.OnLaunch transportService"); LoadStateAndUpdateAsync(); App.Log("Bootstrapper.OnLaunch LoadStateAndUpdateAsync"); ShowBatterySaverAlertAsync(); App.Log("Bootstrapper.OnLaunch ShowBatterySaverAlertAsync"); StartAgent(); App.Log("Bootstrapper.OnLaunch StartAgent"); SetInitTextScaleFactor(); App.Log("Bootstrapper.OnLaunch SetInitTextScaleFactor"); #if WP81 var shareTargetLaunch = e as ShareLaunchingEventArgs; if (shareTargetLaunch != null) { (App.Current as App).ShareOperation = shareTargetLaunch.ShareTargetActivatedEventArgs.ShareOperation; } #endif base.OnLaunch(sender, e); App.Log("end Bootstrapper.OnLaunch"); } protected override void OnActivate(object sender, ActivatedEventArgs e) { Telegram.Logs.Log.Write("Activate"); #if LOG_REGISTRATION TLUtils.WriteLog("App activate IsAppInstancePreserved=" + e.IsApplicationInstancePreserved); #endif EnterAppMutex(); CheckPasscode(); if (!e.IsApplicationInstancePreserved) { var cacheService = IoC.Get(); cacheService.Init(); Execute.ShowDebugMessage("Init database"); } TLUtils.WritePerformance(">>OnActivate IsAppInstancePreserved " + e.IsApplicationInstancePreserved); LoadStateAndUpdateAsync(); ShowBatterySaverAlertAsync(); CheckTextScaleFactorAsync(); base.OnActivate(sender, e); } private void OnTransportConnected(object sender, TransportEventArgs e) { var mtProtoService = IoC.Get(); if (mtProtoService != null) { var transport = e.Transport; if (transport == null) { return; } if (transport.MTProtoType != MTProtoTransportType.Main) { return; } mtProtoService.SetMessageOnTime(0.0, string.Empty); } } private void OnTransportConnecting(object sender, TransportEventArgs e) { var mtProtoService = IoC.Get(); if (mtProtoService != null) { var transport = e.Transport; if (transport == null) { return; } if (transport.MTProtoType != MTProtoTransportType.Main) { return; } #if DEBUG var proxy = transport.ProxyConfig != null && transport.ProxyConfig.IsEnabled.Value && !transport.ProxyConfig.IsEmpty ? transport.ProxyConfig.GetProxy() : null; var transportIdString = string.Format("({0} {1}_{2}{3})", transport.Id, transport.DCId, transport.ActualHost, proxy != null ? "_" + proxy.Server : ""); #else var transportIdString = string.Empty; #endif var proxyConfig = transport.ProxyConfig; if (proxyConfig != null && proxyConfig.IsEnabled.Value && !proxyConfig.IsEmpty) { mtProtoService.SetMessageOnTime(25.0, string.Format("{0}{1}...", AppResources.ConnectingToProxy, transportIdString)); } else { mtProtoService.SetMessageOnTime(25.0, string.Format("{0}{1}...", AppResources.Connecting, transportIdString)); } } } protected override void OnClose(object sender, ClosingEventArgs e) { var updatesService = IoC.Get(); Telegram.Logs.Log.Write("Close state=" + updatesService.GetState()); #if LOG_REGISTRATION TLUtils.WriteLog("App close"); #endif ReleaseAppMutex(); //BackgroundProcessController.Instance.CallController.StartMTProtoUpdater(); try { if (BackgroundProcessController.Instance.CallController != null) { BackgroundProcessController.Instance.CallController.SetStatusCallback(null); } } catch (Exception ex) { TLUtils.WriteException("OnDeactivate", ex); } BackgroundProcessController.Instance.DisconnectUi(); UpdateMainTile(); if (PasscodeUtils.IsEnabled) { var frame = Application.Current.RootVisual as TelegramTransitionFrame; if (frame != null && !frame.IsLockScreenOpen()) { PasscodeUtils.CloseTime = DateTime.Now; } } var cacheService = IoC.Get(); cacheService.TryCommit(); updatesService.SaveState(); var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (isAuthorized) { var mtProtoService = IoC.Get(); mtProtoService.UpdateStatusAsync(new TLBool(true), result => CloseTransport()); } else { CloseTransport(); } base.OnClose(sender, e); } #if WP8 private static readonly Mutex _appOpenMutex = new Mutex(false, Telegram.Api.Constants.TelegramMessengerMutexName); #endif private static bool EnterAppMutex() { #if WP8 return _appOpenMutex.WaitOne(); #endif return true; } private static void ReleaseAppMutex() { #if WP8 _appOpenMutex.ReleaseMutex(); #endif } private void CheckPasscode() { if (PasscodeUtils.IsLockscreenRequired) { var chooseFileInfo = ((App) Application.Current).ChooseFileInfo; if (chooseFileInfo == null || DateTime.Now > chooseFileInfo.Time.AddSeconds(120.0)) { var frame = RootFrame as TelegramTransitionFrame; if (frame != null) { frame.OpenLockscreen(); } } } ((App) Application.Current).ChooseFileInfo = null; } private double _previousScaleFactor = 1.0; private void CheckTextScaleFactorAsync() { var scaledText = Application.Current.Resources["ScaledText"] as ScaledText; if (scaledText != null) { if (scaledText.TextScaleFactor != _previousScaleFactor) { _previousScaleFactor = scaledText.TextScaleFactor; BrowserNavigationService.FontScaleFactor = scaledText.TextScaleFactor; scaledText.NotifyOfPropertyChange(() => scaledText.TextScaleFactor); } } } private void SetInitTextScaleFactor() { var scaledText = Application.Current.Resources["ScaledText"] as ScaledText; if (scaledText != null) { BrowserNavigationService.FontScaleFactor = scaledText.TextScaleFactor; _previousScaleFactor = scaledText.TextScaleFactor; } } protected override void OnDeactivate(object sender, DeactivatedEventArgs args) { var updatesService = IoC.Get(); Telegram.Logs.Log.Write("Deactivate state=" + updatesService.GetState()); #if LOG_REGISTRATION TLUtils.WriteLog("App deactivate"); #endif ReleaseAppMutex(); //BackgroundProcessController.Instance.CallController.StartMTProtoUpdater(); try { if (BackgroundProcessController.Instance.CallController != null) { BackgroundProcessController.Instance.CallController.SetStatusCallback(null); } } catch (Exception ex) { TLUtils.WriteException("OnDeactivate", ex); } BackgroundProcessController.Instance.DisconnectUi(); UpdateMainTile(); var cacheService = IoC.Get(); cacheService.TryCommit(); updatesService.SaveState(); updatesService.CancelUpdating(); var mtProtoService = IoC.Get(); var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (isAuthorized) { var manualResetEvent2 = new ManualResetEvent(false); mtProtoService.UpdateStatusAsync(TLBool.True, result => { manualResetEvent2.Set(); }, error => { manualResetEvent2.Set(); }); manualResetEvent2.WaitOne(200); ((App) Application.Current).Offline = true; if (PasscodeUtils.IsEnabled) { var frame = Application.Current.RootVisual as TelegramTransitionFrame; if (frame != null && !frame.IsLockScreenOpen()) { PasscodeUtils.CloseTime = DateTime.Now; } } } //manualResetEvent2.WaitOne(20000); var manualResetEvent = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem(state => { try { #if LOG_REGISTRATION TLUtils.WriteLog("OnDeactivate MTProtoService.ClearHistory"); #endif mtProtoService.ClearHistory("OnDeactivate", true); } catch (Exception e) { TLUtils.WriteException(e); } finally { manualResetEvent.Set(); } }); manualResetEvent.WaitOne(5000); base.OnDeactivate(sender, args); } private void ShowBatterySaverAlertAsync() { Execute.BeginOnThreadPool(() => { if (!_showBatterySaverOnce) { _showBatterySaverOnce = CheckBatterySaverState(); } }); } private bool _showBatterySaverOnce; private bool CheckBatterySaverState() { #if WP8 // The minimum phone version that supports the PowerSavingModeEnabled property var targetVersion = new Version(8, 0, 10492); //if (Environment.OSVersion.Version >= targetVersion) { // Use reflection to get the PowerSavingModeEnabled value //var powerSaveEnabled = (bool) typeof(PowerManager).GetProperty("PowerSavingModeEnabled").GetValue(null, null); var powerSaveOn = PowerManager.PowerSavingMode == PowerSavingMode.On; if (powerSaveOn) { Execute.BeginOnUIThread(() => MessageBox.Show(AppResources.BatterySaverModeAlert, AppResources.Warning, MessageBoxButton.OK)); return true; } return false; } #endif return true; } private void LoadStateAndUpdateAsync() { Execute.BeginOnThreadPool(() => { try { BackgroundProcessController.Instance.ConnectUi(); } catch (Exception ex) { TLUtils.WriteException("LoadStateAndUpdateAsync 1", ex); } //BackgroundProcessController.Instance.CallController.StopMTProtoUpdater(); var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (!isAuthorized) return; Execute.BeginOnUIThread(() => { //MessageBox.Show("LoadStateAndUpdateAsync"); var mtProtoService = IoC.Get(); var stateService = IoC.Get(); var updatesService = IoC.Get(); var voipService = IoC.Get(); var liveLocationsService = IoC.Get(); mtProtoService.CurrentUserId = new TLInt(stateService.CurrentUserId); updatesService.GetCurrentUserId = () => mtProtoService.CurrentUserId; updatesService.GetStateAsync = mtProtoService.GetStateAsync; updatesService.GetDHConfigAsync = mtProtoService.GetDHConfigAsync; updatesService.GetDifferenceAsync = mtProtoService.GetDifferenceAsync; updatesService.AcceptEncryptionAsync = mtProtoService.AcceptEncryptionAsync; updatesService.SendEncryptedServiceAsync = mtProtoService.SendEncryptedServiceAsync; updatesService.SetMessageOnTimeAsync = mtProtoService.SetMessageOnTime; updatesService.RemoveFromQueue = mtProtoService.RemoveFromQueue; updatesService.UpdateChannelAsync = mtProtoService.UpdateChannelAsync; updatesService.GetFullChatAsync = mtProtoService.GetFullChatAsync; updatesService.GetFullUserAsync = mtProtoService.GetFullUserAsync; updatesService.GetChannelMessagesAsync = mtProtoService.GetMessagesAsync; updatesService.GetPinnedDialogsAsync = mtProtoService.GetPinnedDialogsAsync; updatesService.GetMessagesAsync = mtProtoService.GetMessagesAsync; updatesService.GetPeerDialogsAsync = mtProtoService.GetPeerDialogsAsync; updatesService.GetPromoDialogAsync = mtProtoService.GetPromoDialogAsync; stateService.SuppressNotifications = true; long acceptedCallId = -1; try { if (BackgroundProcessController.Instance.CallController != null) { BackgroundProcessController.Instance.CallController.SetStatusCallback((VoIPService)voipService); acceptedCallId = BackgroundProcessController.Instance.CallController.AcceptedCallId; BackgroundProcessController.Instance.CallController.AcceptedCallId = -1; voipService.AcceptedCallId = acceptedCallId; if (acceptedCallId != -1) { BackgroundProcessController.Instance.CallController.EndCall(); } } } catch (Exception ex) { TLUtils.WriteException("LoadStateAndUpdateAsync 2", ex); } liveLocationsService.LoadAndUpdateAllAsync(); var timer = Stopwatch.StartNew(); TLUtils.WritePerformance(">>UpdateService.LoadStateAndUpdate start"); //mtProtoService.SetMessageOnTime(60.0 * 5, AppResources.Updating + "..."); updatesService.LoadStateAndUpdate(acceptedCallId, () => { //mtProtoService.SetMessageOnTime(0.0, string.Empty); TLUtils.WritePerformance(">>UpdateService.LoadStateAndUpdate stop " + timer.Elapsed); stateService.SuppressNotifications = false; }); }); }); } private void RestoreConnectionAsync() { Execute.BeginOnThreadPool(() => { var isAuthorized = SettingsHelper.GetValue(Constants.IsAuthorizedKey); if (!isAuthorized) return; Execute.BeginOnUIThread(() => { var mtProtoService = IoC.Get(); //mtProtoService.PingAsync(TLLong.Random(), result => { }, error => { }); mtProtoService.UpdateStatusAsync(TLBool.False, result => { }, error => { }); }); }); } private void CloseTransport() { var transportService = IoC.Get(); transportService.Close(); } public static void UpdateMainTile() { #if WNS_PUSH_SERVICE try { ToastNotificationManager.History.Clear(); } catch (Exception ex) { Telegram.Logs.Log.Write("ClearNotifications ex " + ex); Execute.ShowDebugMessage("Clear notifications history exception\n" + ex); } try { BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear(); TileUpdateManager.CreateTileUpdaterForApplication().Clear(); } catch (Exception ex) { Telegram.Logs.Log.Write("ClearTile ex " + ex); Execute.ShowDebugMessage("Clear tile exception\n" + ex); } #else // no way to clear toast history with MPNS //try //{ // ToastNotificationManager.History.Clear(); //} //catch (Exception ex) //{ // Telegram.Logs.Log.Write("ClearNotifications ex " + ex); // Execute.ShowDebugMessage("Clear notifications history exception\n" + ex); //} var tile = ShellTile.ActiveTiles.FirstOrDefault(); if (tile == null) return; #if WP8 var tileData = new IconicTileData { Count = 0, WideContent1 = "", WideContent2 = "", WideContent3 = "" }; #else var tileData = new StandardTileData{ Count = 0 }; #endif try { tile.Update(tileData); } catch (Exception ex) { Execute.ShowDebugMessage("Tile.Update exception\n" + ex); } #endif } private static void StartBugsenseAsync() { Execute.BeginOnUIThread(TimeSpan.FromSeconds(3.0), BugSenseWrapper.Init); } // The name of the incoming call task. private const string incomingCallTaskName = "PhoneVoIPApp.IncomingCallTask"; public static void InitHttpNotificationTask() { try { // Obtain a reference to the existing task, if any. var incomingCallTask = ScheduledActionService.Find(incomingCallTaskName) as VoipHttpIncomingCallTask; if (incomingCallTask != null) { if (incomingCallTask.IsScheduled == false) { // The incoming call task has been unscheduled due to OOM or throwing an unhandled exception twice in a row ScheduledActionService.Remove(incomingCallTaskName); } else { // The incoming call task has been scheduled and is still scheduled so there is nothing more to do return; } } // Create a new incoming call task. incomingCallTask = new VoipHttpIncomingCallTask(incomingCallTaskName, Constants.ToastNotificationChannelName); incomingCallTask.Description = "Incoming call task"; foreach (var action in ScheduledActionService.GetActions()) { ScheduledActionService.Remove(action.Name); } ScheduledActionService.Add(incomingCallTask); } catch (Exception ex) { Telegram.Logs.Log.Write("InitHttpNotificationTask ScheduledActionService.Add exception\n" + ex); } } private static void StartAgent() { InitHttpNotificationTask(); return; if (ScheduledActionService.Find(Constants.ScheduledAgentTaskName) != null) { ScheduledActionService.Remove(Constants.ScheduledAgentTaskName); } var task = new PeriodicTask(Constants.ScheduledAgentTaskName) { Description = AppResources.TileUpdaterTaskDescription }; try { ScheduledActionService.Add(task); #if DEBUG // If we're debugging, attempt to start the task immediately // this break our service and updates try { ScheduledActionService.LaunchForTest(Constants.ScheduledAgentTaskName, new TimeSpan(0, 0, 10)); } catch (Exception e) { TLUtils.WriteException(e); } #endif } catch (Exception e) { TLUtils.WriteException(e); } //SettingsHelper.SetValue(Constants.UnreadCountKey, 0); } private static void SetupViewLocator() { ViewLocator.DeterminePackUriFromType = (viewModelType, viewType) => { var assemblyName = ExtensionMethods.GetAssemblyName(viewType.Assembly); var uri = viewType.FullName.Replace(assemblyName #if WP8 //NOTE: at WP8 project deafult assembly name TelegramClient.WP8 instead of TelegramClient at WP7 .Replace(".WP8", string.Empty) #endif , string.Empty).Replace(".", "/") + ".xaml"; if (!ExtensionMethods.GetAssemblyName(Application.Current.GetType().Assembly).Equals(assemblyName)) { return "/" + assemblyName + ";component" + uri; } return uri; }; } } } ================================================ FILE: TelegramClient/CapabilityPlaceholder.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using Microsoft.Xna.Framework.Audio; namespace TelegramClient { // In Windows Phone applications that use the CaptureSource class, // you must also use the Microsoft.Devices.Camera, Microsoft.Devices.PhotoCamera, // or Microsoft.Xna.Framework.Audio.Microphone class to enable audio capture // and accurate capability detection in the application. // Since this sample does not need any of these classes, this unused // class prompts the Marketplace capability detection process to add the // ID_CAP_MICROPHONE capability to the application capabilities list upon ingestion. // For more information about capability detection, see: http://go.microsoft.com/fwlink/?LinkID=204620 public class CapabilityPlaceholder { Microphone unusedMic = null; private string unusedMethod() { return unusedMic.ToString(); } } } ================================================ FILE: TelegramClient/Commands.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace TelegramClient { public class Commands { public const string LogOutCommand = "LogOut"; } } ================================================ FILE: TelegramClient/Constants.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace TelegramClient { static class Constants { #if PRIVATE_BETA || DEBUG public const string LogEmail = "sms@telegram.org"; #else public const string LogEmail = "sms@telegram.org"; #endif public const int TelegramNotificationsId = 777000; public const string DefaultMeUrlPrefix = "https://t.me/"; public const string TelegramFaq = "https://telegram.org/faq"; public const string TelegramPrivacyPolicy = "https://telegram.org/privacy"; public const string TelegramShare = "https://telegram.org/dl"; public const string TelegramTroubleshooting = "https://telegram.org/faq#troubleshooting"; public const int VideoPreviewMaxSize = 90;//320; public const int VideoPreviewQuality = 87; public const int DocumentPreviewMaxSize = 90; public const int DocumentPreviewQuality = 87; public const int PhotoPreviewMaxSize = 90; public const int PhotoPreviewQuality = 87; public const string EmptyBackgroundString = "Empty"; public const string LibraryBackgroundString = "Library"; public const string AnimatedBackground1String = "AnimatedBackground1"; public const int MaximumMessageLength = 4096; public const double GlueGeoPointsDistance = 50.0; public const double DefaultMessageContentWidth = 323.0; public const double DefaultMessageContentHeight = 150.0; public const double MaxStickerDimension = 196.0; public const double MaxGifDimension = 323.0; public const double DeafultInlineBotResultHeight = 118.0; public const int ShowHelpTimeInSeconds = 120; public const int DialogsSlice = 20; public const int MessagesSlice = 25; public const string IsAuthorizedKey = "IsAuthorized"; public const string ConfigKey = "Config"; public const string CurrentUserKey = "CurrentUser"; public const string CurrentBackgroundKey = "CurrentBackground"; public const string SendByEnterKey = "SendByEnter"; public const string UnreadCountKey = "UnreadCountKey"; public const string SettingsKey = "SettingsKey"; public const string CommonNotifySettingsFileName = "CommonNotifySettings.xml"; public const string DelayedContactsFileName = "PeopleHub.dat"; public const string ScheduledAgentTaskName = "TelegramScheduledAgent"; public const string ToastNotificationChannelName = "TelegramNotificationChannel"; public const int MaxImportingContactsCount = 1300; public static string StaticGoogleMap = "https://maps.googleapis.com/maps/api/staticmap?center={0},{1}&zoom=16&size={2}x{3}&sensor=false&format=jpg&scale=2&language=en"; public const double SetTypingIntervalInSeconds = 5.0; public const int SendCallDefaultTimeout = 90; public const int DefaultCodeLength = 5; public const int DefaultForwardingMessagesCount = 50; public const string ImportedPhonesFileName = "importedPhones.dat"; public const string CachedServerFilesFileName = "cachedServerFiles.dat"; public const string AllStickersFileName = "allStickers.dat"; public const string MasksFileName = "masks.dat"; public const string FeaturedStickersFileName = "featuredStickers.dat"; public const string RecentStickersFileName = "recentStickers.dat"; public const string ArchivedStickersFileName = "archivedStickers.dat"; public const string WallpapersFileName = "wallpapers.dat"; public const string TelegramFolderName = "Telegram"; public const int UsernameMinLength = 5; public const int UsernameMaxLength = 32; public const double GetAllStickersInterval = 60.0 * 60.0; // 60 min public const int FileSliceLength = 50; public const int PhotoVideoSliceLength = 48; // 4 preview * 12 rows // FullHD public const double FullHDAppBarHeight = 60.0; public const double FullHDAppBarDifference = -12.0; //qHD public const double QHDAppBarHeight = 67.0; public const double QHDAppBarDifference = -5.0; public const double NotificationTimerInterval = 10.0; // seconds public const string SnapshotsDirectoryName = "Snapshots"; //passcode public const string AppCloseTimeKey = "AppCloseTime"; public const string PasscodeKey = "PasscodeEnabled"; public const string IsSimplePasscodeKey = "IsSimplePasscode"; public const string IsPasscodeEnabledKey = "IsPasscodeEnabled"; public const string PasscodeAutolockKey = "PasscodeAutolock"; public const string PasscodeParamsFileName = "passcode_params.dat"; public const int PasscodeHashIterations = 1000; //password public const int PasswordRecoveryCodeLength = 6; //passport public const uint DefaultPassportImageSize = 2048; public const uint MaxPassportFilesCount = 20; //notifications public const int WNSTokenType = 8; public const int MPNSTokenType = 3; public const int VoIPMPNSTokenType = 11; public const int NotificationInterval = 15; // Interval to count notifications (seconds) public const int UnmutedCount = 1; // Cont of notifications to show within interval //unread messages public const int MinUnreadCountToShowSeparator = 2; //venues public const string FoursquireCategoryIconUrl = @"https://foursquare.com/img/categories_v2/{0}_{1}.png"; //stickers public const string AddStickersLinkPlaceholder = @"https://t.me/addstickers/{0}"; //usernames public const string UsernameLinkPlaceholder = @"https://t.me/{0}"; //background tasks public const string PushNotificationsBackgroundTaskName = "PushNotificationsTask"; public const string MessageSchedulerBackgroundTaskName = "SchedulerTask"; public const string TimerMessageSchedulerBackgroundTaskName = "TimerSchedulerTask"; public const string BackgroundDifferenceLoaderTaskName = "BackgroundDifferenceLoader"; public const string InteractiveNotificationsBackgroundTaskName = "InteractiveNotificationsBackgroundTask"; //message search public const int SearchMessagesSliceLimit = 5; //search public const string RecentSearchResultsFileName = "search_chats_recent.dat"; public const string TopPeersFileName = "top_peers.dat"; //channels public const string ChannelIntroFileName = "channel_intro.dat"; //photo public const uint DefaultImageSize = 1280; //chat settings public const string ChatSettingsFileName = "chat_settings.dat"; public const string SuppressInlineBotsHintFileName = "suppress_inline_bots_hint.dat"; //contacts settings public const string ContactsSettingsFileName = "contacts_settings.dat"; // services public static int HttpDownloadersCount = 5; public static int MinSecretChatWithStickersLayer = 23; public static int MinSecretChatWithRepliesLayer = 45; public static int MinSecretChatWithCaptionsLayer = 45; public static int MinSecretChatWithVenuesLayer = 45; public static int MinSecretChatWithInlineBotsLayer = 45; public static int MinSecretChatWithExtendedKeyVisualizationLayer = 46; public static int MinSecretChatWithAudioAsDocumentsLayer = 46; public static int MinSecretChatWithRoundVideoLayer = 66; public static int MinSecretChatWithGroupedMediaLayer = 73; public const string InlineBotsNotificationFileName = "inlinebots_notificaiton.dat"; public const string WebPagePreviewsFileName = "webpagepreviews_notificaiton.dat"; public const int RecheckBotInlineGeoAccessInterval = #if DEBUG 10; // seconds #else 600; // seconds #endif public const string SpambotUsername = "spambot"; public const string InlineBotsFileName = "inline_bots.dat"; // camera public const string CameraSettingsFileName = "camera_settings.dat"; // photo picker public const string PhotoPickerSettingsFileName = "photo_picker_settings.dat"; public const int DefaultTmpPasswordLifetime = #if DEBUG 60 * 5; #else 60 * 30; #endif public const string TmpPasswordFileName = "tmp_password.dat"; public const string CallsSecurityFileName = "calls_security.dat"; public const string SavedCountFileName = "saved_count.dat"; public const int MinSetsToAddFavedSticker = 5; public const double MinDistanceToUpdateLiveLocation = 20.0; public const int MaxCacheCapacity = 50; public const int MaxGroupedMediaCount = 10; // update public const string PreviewUpdateUri = "ms-windows-store://pdp/?productid=9P0F9KC5TSTT"; public const string UpdateUri = "ms-windows-store://pdp/?productid=9WZDNCRDZHS0"; public const string PassportConfigFileName = "passport_config.dat"; } } ================================================ FILE: TelegramClient/Controls/BrowserNavigationService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using Caliburn.Micro; using Microsoft.Devices; using Microsoft.Phone.Tasks; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Controls.Extensions; using TelegramClient.Converters; using TelegramClient.Resources; using TelegramClient.Services; using TelegramClient.Views; namespace Telegram.EmojiPanel { public class TreeNode { public string Key { get; set; } public Dictionary Values { get; set; } public bool IsEnded { get; set; } public TreeNode(string key) { Key = key; Values = new Dictionary(); } } public static class Emoji { private static Dictionary _dict; public static Dictionary Dict { get { if (_dict == null) { InitializeDict(); } return _dict; } } private static Dictionary _skinnedDict; public static Dictionary SkinnedDict { get { if (_skinnedDict == null) { InitializeDict(); } return _skinnedDict; } } private static Dictionary _joinedEmojiPartDict; public static Dictionary JoinedEmojiPartDict { get { if (_joinedEmojiPartDict == null) { InitializeDict(); } return _joinedEmojiPartDict; } } private static TreeNode _joinedEmojiTree; public static TreeNode JoinedEmojiTree { get { if (_joinedEmojiTree == null) { InitializeDict(); } return _joinedEmojiTree; } } private static Dictionary _skinsDict; public static Dictionary SkinsDict { get { if (_skinsDict == null) { InitializeDict(); } return _skinsDict; } } private static Dictionary _flagPrefixes; public static Dictionary FlagsPrefixes { get { if (_flagPrefixes == null) { InitializeDict(); } return _flagPrefixes; } } public static string ZeroWidthJoiner = "200D"; public static string EmojiStyleVarianSelector = "FE0F"; public static string TextStyleVarianSelector = "FE0E"; private static void AddTreeNodes(TreeNode node, int index, params string[] values) { if (_dict == null) return; if (index >= values.Length) { node.IsEnded = true; return; } var key = values[index]; TreeNode internalNode; if (node.Values.TryGetValue(key, out internalNode)) { AddTreeNodes(internalNode, index + 1, values); } else { internalNode = new TreeNode(key); node.Values[key] = internalNode; AddTreeNodes(internalNode, index + 1, values); } } private static void InitializeDict() { _dict = new Dictionary(); _skinnedDict = new Dictionary(); _skinsDict = new Dictionary(); _joinedEmojiPartDict = new Dictionary(); _joinedEmojiTree = new TreeNode(string.Empty); _flagPrefixes = new Dictionary(); _flagPrefixes["D83CDDE6"] = "D83CDDE6"; _flagPrefixes["D83CDDE7"] = "D83CDDE7"; _flagPrefixes["D83CDDE8"] = "D83CDDE8"; _flagPrefixes["D83CDDE9"] = "D83CDDE9"; _flagPrefixes["D83CDDEA"] = "D83CDDEA"; _flagPrefixes["D83CDDEB"] = "D83CDDEB"; _flagPrefixes["D83CDDEC"] = "D83CDDEC"; _flagPrefixes["D83CDDED"] = "D83CDDED"; _flagPrefixes["D83CDDEE"] = "D83CDDEE"; _flagPrefixes["D83CDDEF"] = "D83CDDEF"; _flagPrefixes["D83CDDF0"] = "D83CDDF0"; _flagPrefixes["D83CDDF1"] = "D83CDDF1"; _flagPrefixes["D83CDDF2"] = "D83CDDF2"; _flagPrefixes["D83CDDF3"] = "D83CDDF3"; _flagPrefixes["D83CDDF4"] = "D83CDDF4"; _flagPrefixes["D83CDDF5"] = "D83CDDF5"; _flagPrefixes["D83CDDF6"] = "D83CDDF6"; _flagPrefixes["D83CDDF7"] = "D83CDDF7"; _flagPrefixes["D83CDDF8"] = "D83CDDF8"; _flagPrefixes["D83CDDF9"] = "D83CDDF9"; _flagPrefixes["D83CDDFA"] = "D83CDDFA"; _flagPrefixes["D83CDDFB"] = "D83CDDFB"; _flagPrefixes["D83CDDFC"] = "D83CDDFC"; _flagPrefixes["D83CDDFD"] = "D83CDDFD"; _flagPrefixes["D83CDDFE"] = "D83CDDFE"; _flagPrefixes["D83CDDFF"] = "D83CDDFF"; _joinedEmojiPartDict["D83DDC69"] = "D83DDC69"; _joinedEmojiPartDict["D83DDC68"] = "D83DDC68"; _joinedEmojiPartDict["2764"] = "2764"; _joinedEmojiPartDict["D83DDC8B"] = "D83DDC8B"; _joinedEmojiPartDict["D83DDC66"] = "D83DDC66"; _joinedEmojiPartDict["D83DDC67"] = "D83DDC67"; _joinedEmojiPartDict["D83DDC41"] = "D83DDC41"; _joinedEmojiPartDict["D83DDDE8"] = "D83DDDE8"; AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6E", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC3", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC6F", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2764", "200D", "D83DDC8B", "200D", "D83DDC68"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2764", "200D", "D83DDC68"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC66", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC67", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC67", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFB", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFC", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFD", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFE", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "D83CDFFF", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "2695"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "2696"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "2708"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2764", "200D", "D83DDC8B", "200D", "D83DDC69"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2764", "200D", "D83DDC69"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDF3E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDF73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDF93"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDFA4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDFA8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDFEB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83CDFED"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC66", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDCBB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDCBC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDD2C"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDD27"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDE80"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFB", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFC", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFD", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFE", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "D83CDFFF", "200D", "D83DDE92"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC71", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC73", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC77", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC81", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC82", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC86", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC87", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDD75", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4B", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4D", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE4E", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE45", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE46", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDE47", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB6", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD26", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD37", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2764FE0F", "200D", "D83DDC69"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2764FE0F", "200D", "D83DDC68"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "2764FE0F", "200D", "D83DDC8B", "200D", "D83DDC69"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "2764FE0F", "200D", "D83DDC8B", "200D", "D83DDC68"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC41", "200D", "D83DDDE8"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC69", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC69", "200D", "D83DDC66", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC69", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC69", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC69", "200D", "D83DDC66", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC69", "200D", "D83DDC69", "200D", "D83DDC67", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC68", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC68", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC68", "200D", "D83DDC67", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC68", "200D", "D83DDC66", "200D", "D83DDC66"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDC68", "200D", "D83DDC68", "200D", "D83DDC67", "200D", "D83DDC67"); AddTreeNodes(_joinedEmojiTree, 0, "26F9"); AddTreeNodes(_joinedEmojiTree, 0, "26F9D83C", "DFFB"); AddTreeNodes(_joinedEmojiTree, 0, "26F9D83C", "DFFC"); AddTreeNodes(_joinedEmojiTree, 0, "26F9D83C", "DFFD"); AddTreeNodes(_joinedEmojiTree, 0, "26F9D83C", "DFFE"); AddTreeNodes(_joinedEmojiTree, 0, "26F9D83C", "DFFF"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "26F9", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC4", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCA", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCC", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEA3", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB4", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83DDEB5", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD38", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD39", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3C", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3C", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3D", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFB", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFC", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFD", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFE", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFF", "200D", "2642"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83EDD3E", "D83CDFFF", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFF3", "200D", "D83CDF08"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFC7", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFB"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFC"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFD"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFE"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFF"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFB", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFC", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFD", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFE", "200D", "2640"); AddTreeNodes(_joinedEmojiTree, 0, "D83CDFCB", "D83CDFFF", "200D", "2640"); _skinsDict["D83CDFFB"] = "D83CDFFB"; _skinsDict["D83CDFFC"] = "D83CDFFC"; _skinsDict["D83CDFFD"] = "D83CDFFD"; _skinsDict["D83CDFFE"] = "D83CDFFE"; _skinsDict["D83CDFFF"] = "D83CDFFF"; _skinnedDict["D83DDC41"] = "D83DDC41"; _skinnedDict["D83DDC6F"] = "D83DDC6F"; // workaround _skinnedDict["D83EDD26"] = "D83EDD26"; // workaround _skinnedDict["D83EDD37"] = "D83EDD37"; // workaround _skinnedDict["D83DDD75"] = "D83DDD75"; // workaround _skinnedDict["D83EDD3C"] = "D83EDD3C"; // workaround _skinnedDict["D83EDD38"] = "D83EDD38"; // workaround _skinnedDict["D83EDD3E"] = "D83EDD3E"; // workaround _skinnedDict["D83CDFCC"] = "D83CDFCC"; // workaround _skinnedDict["D83EDD3D"] = "D83EDD3D"; // workaround _skinnedDict["D83EDD39"] = "D83EDD39"; // workaround _skinnedDict["D83CDFF3"] = "D83CDFF3"; // workaround _skinnedDict["D83DDC6E"] = "D83DDC6E"; // workaround _skinnedDict["D83DDC82"] = "D83DDC82"; // workaround _skinnedDict["D83DDC77"] = "D83DDC77"; // workaround _skinnedDict["D83DDC73"] = "D83DDC73"; // workaround _skinnedDict["D83DDC71"] = "D83DDC71"; // workaround _skinnedDict["D83DDE47"] = "D83DDE47"; // workaround _skinnedDict["D83DDC81"] = "D83DDC81"; // workaround _skinnedDict["D83DDE45"] = "D83DDE45"; // workaround _skinnedDict["D83DDE46"] = "D83DDE46"; // workaround _skinnedDict["D83DDE4B"] = "D83DDE4B"; // workaround _skinnedDict["D83DDD26"] = "D83DDD26"; // workaround _skinnedDict["D83DDE4E"] = "D83DDE4E"; // workaround _skinnedDict["D83DDE4D"] = "D83DDE4D"; // workaround _skinnedDict["D83DDC87"] = "D83DDC87"; // workaround _skinnedDict["D83DDC86"] = "D83DDC86"; // workaround _skinnedDict["D83DDEB6"] = "D83DDEB6"; // workaround _skinnedDict["D83CDFC3"] = "D83CDFC3"; // workaround _skinnedDict["D83DDC69"] = "D83DDC69"; // workaround _skinnedDict["D83DDC68"] = "D83DDC68"; // workaround _skinnedDict["D83DDEB4"] = "D83DDEB4"; // workaround _skinnedDict["D83DDEB5"] = "D83DDEB5"; // workaround _skinnedDict["D83CDFC7"] = "D83CDFC7"; // workaround _skinnedDict["D83DDEA3"] = "D83DDEA3"; // workaround _skinnedDict["D83CDFCA"] = "D83CDFCA"; // workaround _skinnedDict["D83CDFC4"] = "D83CDFC4"; // workaround _skinnedDict["26F9"] = "26F9"; // workaround _skinnedDict["D83CDFCB"] = "D83CDFCB"; // workaround _skinnedDict["D83DDD74"] = "D83DDD74"; _skinnedDict["D83DDD74D83CDFFB"] = "D83DDD74D83CDFFB"; _skinnedDict["D83DDD74D83CDFFC"] = "D83DDD74D83CDFFC"; _skinnedDict["D83DDD74D83CDFFD"] = "D83DDD74D83CDFFD"; _skinnedDict["D83DDD74D83CDFFE"] = "D83DDD74D83CDFFE"; _skinnedDict["D83DDD74D83CDFFF"] = "D83DDD74D83CDFFF"; _skinnedDict["D83DDD7A"] = "D83DDD7A"; _skinnedDict["D83DDD7AD83CDFFB"] = "D83DDD7AD83CDFFB"; _skinnedDict["D83DDD7AD83CDFFC"] = "D83DDD7AD83CDFFC"; _skinnedDict["D83DDD7AD83CDFFD"] = "D83DDD7AD83CDFFD"; _skinnedDict["D83DDD7AD83CDFFE"] = "D83DDD7AD83CDFFE"; _skinnedDict["D83DDD7AD83CDFFF"] = "D83DDD7AD83CDFFF"; _skinnedDict["D83EDD30"] = "D83EDD30"; _skinnedDict["D83EDD30D83CDFFB"] = "D83EDD30D83CDFFB"; _skinnedDict["D83EDD30D83CDFFC"] = "D83EDD30D83CDFFC"; _skinnedDict["D83EDD30D83CDFFD"] = "D83EDD30D83CDFFD"; _skinnedDict["D83EDD30D83CDFFE"] = "D83EDD30D83CDFFE"; _skinnedDict["D83EDD30D83CDFFF"] = "D83EDD30D83CDFFF"; _skinnedDict["D83EDD34"] = "D83EDD34"; _skinnedDict["D83EDD34D83CDFFB"] = "D83EDD34D83CDFFB"; _skinnedDict["D83EDD34D83CDFFC"] = "D83EDD34D83CDFFC"; _skinnedDict["D83EDD34D83CDFFD"] = "D83EDD34D83CDFFD"; _skinnedDict["D83EDD34D83CDFFE"] = "D83EDD34D83CDFFE"; _skinnedDict["D83EDD34D83CDFFF"] = "D83EDD34D83CDFFF"; _skinnedDict["D83EDD35"] = "D83EDD35"; _skinnedDict["D83EDD35D83CDFFB"] = "D83EDD35D83CDFFB"; _skinnedDict["D83EDD35D83CDFFC"] = "D83EDD35D83CDFFC"; _skinnedDict["D83EDD35D83CDFFD"] = "D83EDD35D83CDFFD"; _skinnedDict["D83EDD35D83CDFFE"] = "D83EDD35D83CDFFE"; _skinnedDict["D83EDD35D83CDFFF"] = "D83EDD35D83CDFFF"; _skinnedDict["D83EDD36"] = "D83EDD36"; _skinnedDict["D83EDD36D83CDFFB"] = "D83EDD36D83CDFFB"; _skinnedDict["D83EDD36D83CDFFC"] = "D83EDD36D83CDFFC"; _skinnedDict["D83EDD36D83CDFFD"] = "D83EDD36D83CDFFD"; _skinnedDict["D83EDD36D83CDFFE"] = "D83EDD36D83CDFFE"; _skinnedDict["D83EDD36D83CDFFF"] = "D83EDD36D83CDFFF"; _skinnedDict["D83EDD1A"] = "D83EDD1A"; _skinnedDict["D83EDD1AD83CDFFB"] = "D83EDD1AD83CDFFB"; _skinnedDict["D83EDD1AD83CDFFC"] = "D83EDD1AD83CDFFC"; _skinnedDict["D83EDD1AD83CDFFD"] = "D83EDD1AD83CDFFD"; _skinnedDict["D83EDD1AD83CDFFE"] = "D83EDD1AD83CDFFE"; _skinnedDict["D83EDD1AD83CDFFF"] = "D83EDD1AD83CDFFF"; _skinnedDict["D83EDD1B"] = "D83EDD1B"; _skinnedDict["D83EDD1BD83CDFFB"] = "D83EDD1BD83CDFFB"; _skinnedDict["D83EDD1BD83CDFFC"] = "D83EDD1BD83CDFFC"; _skinnedDict["D83EDD1BD83CDFFD"] = "D83EDD1BD83CDFFD"; _skinnedDict["D83EDD1BD83CDFFE"] = "D83EDD1BD83CDFFE"; _skinnedDict["D83EDD1BD83CDFFF"] = "D83EDD1BD83CDFFF"; _skinnedDict["D83EDD1C"] = "D83EDD1C"; _skinnedDict["D83EDD1CD83CDFFB"] = "D83EDD1CD83CDFFB"; _skinnedDict["D83EDD1CD83CDFFC"] = "D83EDD1CD83CDFFC"; _skinnedDict["D83EDD1CD83CDFFD"] = "D83EDD1CD83CDFFD"; _skinnedDict["D83EDD1CD83CDFFE"] = "D83EDD1CD83CDFFE"; _skinnedDict["D83EDD1CD83CDFFF"] = "D83EDD1CD83CDFFF"; _skinnedDict["D83EDD1E"] = "D83EDD1E"; _skinnedDict["D83EDD1ED83CDFFB"] = "D83EDD1ED83CDFFB"; _skinnedDict["D83EDD1ED83CDFFC"] = "D83EDD1ED83CDFFC"; _skinnedDict["D83EDD1ED83CDFFD"] = "D83EDD1ED83CDFFD"; _skinnedDict["D83EDD1ED83CDFFE"] = "D83EDD1ED83CDFFE"; _skinnedDict["D83EDD1ED83CDFFF"] = "D83EDD1ED83CDFFF"; _skinnedDict["D83EDD19"] = "D83EDD19"; _skinnedDict["D83EDD19D83CDFFB"] = "D83EDD19D83CDFFB"; _skinnedDict["D83EDD19D83CDFFC"] = "D83EDD19D83CDFFC"; _skinnedDict["D83EDD19D83CDFFD"] = "D83EDD19D83CDFFD"; _skinnedDict["D83EDD19D83CDFFE"] = "D83EDD19D83CDFFE"; _skinnedDict["D83EDD19D83CDFFF"] = "D83EDD19D83CDFFF"; _skinnedDict["D83DDE4C"] = "D83DDE4C"; _skinnedDict["D83DDE4CD83CDFFB"] = "D83DDE4CD83CDFFB"; _skinnedDict["D83DDE4CD83CDFFC"] = "D83DDE4CD83CDFFC"; _skinnedDict["D83DDE4CD83CDFFD"] = "D83DDE4CD83CDFFD"; _skinnedDict["D83DDE4CD83CDFFE"] = "D83DDE4CD83CDFFE"; _skinnedDict["D83DDE4CD83CDFFF"] = "D83DDE4CD83CDFFF"; _skinnedDict["D83DDC4F"] = "D83DDC4F"; _skinnedDict["D83DDC4FD83CDFFB"] = "D83DDC4FD83CDFFB"; _skinnedDict["D83DDC4FD83CDFFC"] = "D83DDC4FD83CDFFC"; _skinnedDict["D83DDC4FD83CDFFD"] = "D83DDC4FD83CDFFD"; _skinnedDict["D83DDC4FD83CDFFE"] = "D83DDC4FD83CDFFE"; _skinnedDict["D83DDC4FD83CDFFF"] = "D83DDC4FD83CDFFF"; _skinnedDict["D83DDC4B"] = "D83DDC4B"; _skinnedDict["D83DDC4BD83CDFFB"] = "D83DDC4BD83CDFFB"; _skinnedDict["D83DDC4BD83CDFFC"] = "D83DDC4BD83CDFFC"; _skinnedDict["D83DDC4BD83CDFFD"] = "D83DDC4BD83CDFFD"; _skinnedDict["D83DDC4BD83CDFFE"] = "D83DDC4BD83CDFFE"; _skinnedDict["D83DDC4BD83CDFFF"] = "D83DDC4BD83CDFFF"; _skinnedDict["D83DDC4D"] = "D83DDC4D"; _skinnedDict["D83DDC4DD83CDFFB"] = "D83DDC4DD83CDFFB"; _skinnedDict["D83DDC4DD83CDFFC"] = "D83DDC4DD83CDFFC"; _skinnedDict["D83DDC4DD83CDFFD"] = "D83DDC4DD83CDFFD"; _skinnedDict["D83DDC4DD83CDFFE"] = "D83DDC4DD83CDFFE"; _skinnedDict["D83DDC4DD83CDFFF"] = "D83DDC4DD83CDFFF"; _skinnedDict["D83DDC4E"] = "D83DDC4E"; _skinnedDict["D83DDC4ED83CDFFB"] = "D83DDC4ED83CDFFB"; _skinnedDict["D83DDC4ED83CDFFC"] = "D83DDC4ED83CDFFC"; _skinnedDict["D83DDC4ED83CDFFD"] = "D83DDC4ED83CDFFD"; _skinnedDict["D83DDC4ED83CDFFE"] = "D83DDC4ED83CDFFE"; _skinnedDict["D83DDC4ED83CDFFF"] = "D83DDC4ED83CDFFF"; _skinnedDict["D83DDC4A"] = "D83DDC4A"; _skinnedDict["D83DDC4AD83CDFFB"] = "D83DDC4AD83CDFFB"; _skinnedDict["D83DDC4AD83CDFFC"] = "D83DDC4AD83CDFFC"; _skinnedDict["D83DDC4AD83CDFFD"] = "D83DDC4AD83CDFFD"; _skinnedDict["D83DDC4AD83CDFFE"] = "D83DDC4AD83CDFFE"; _skinnedDict["D83DDC4AD83CDFFF"] = "D83DDC4AD83CDFFF"; _skinnedDict["D83DDC4C"] = "D83DDC4C"; _skinnedDict["D83DDC4CD83CDFFB"] = "D83DDC4CD83CDFFB"; _skinnedDict["D83DDC4CD83CDFFC"] = "D83DDC4CD83CDFFC"; _skinnedDict["D83DDC4CD83CDFFD"] = "D83DDC4CD83CDFFD"; _skinnedDict["D83DDC4CD83CDFFE"] = "D83DDC4CD83CDFFE"; _skinnedDict["D83DDC4CD83CDFFF"] = "D83DDC4CD83CDFFF"; _skinnedDict["D83DDC46"] = "D83DDC46"; _skinnedDict["D83DDC46D83CDFFB"] = "D83DDC46D83CDFFB"; _skinnedDict["D83DDC46D83CDFFC"] = "D83DDC46D83CDFFC"; _skinnedDict["D83DDC46D83CDFFD"] = "D83DDC46D83CDFFD"; _skinnedDict["D83DDC46D83CDFFE"] = "D83DDC46D83CDFFE"; _skinnedDict["D83DDC46D83CDFFF"] = "D83DDC46D83CDFFF"; _skinnedDict["D83DDC47"] = "D83DDC47"; _skinnedDict["D83DDC47D83CDFFB"] = "D83DDC47D83CDFFB"; _skinnedDict["D83DDC47D83CDFFC"] = "D83DDC47D83CDFFC"; _skinnedDict["D83DDC47D83CDFFD"] = "D83DDC47D83CDFFD"; _skinnedDict["D83DDC47D83CDFFE"] = "D83DDC47D83CDFFE"; _skinnedDict["D83DDC47D83CDFFF"] = "D83DDC47D83CDFFF"; _skinnedDict["D83DDC48"] = "D83DDC48"; _skinnedDict["D83DDC48D83CDFFB"] = "D83DDC48D83CDFFB"; _skinnedDict["D83DDC48D83CDFFC"] = "D83DDC48D83CDFFC"; _skinnedDict["D83DDC48D83CDFFD"] = "D83DDC48D83CDFFD"; _skinnedDict["D83DDC48D83CDFFE"] = "D83DDC48D83CDFFE"; _skinnedDict["D83DDC48D83CDFFF"] = "D83DDC48D83CDFFF"; _skinnedDict["D83DDC49"] = "D83DDC49"; _skinnedDict["D83DDC49D83CDFFB"] = "D83DDC49D83CDFFB"; _skinnedDict["D83DDC49D83CDFFC"] = "D83DDC49D83CDFFC"; _skinnedDict["D83DDC49D83CDFFD"] = "D83DDC49D83CDFFD"; _skinnedDict["D83DDC49D83CDFFE"] = "D83DDC49D83CDFFE"; _skinnedDict["D83DDC49D83CDFFF"] = "D83DDC49D83CDFFF"; _skinnedDict["D83DDC50"] = "D83DDC50"; _skinnedDict["D83DDC50D83CDFFB"] = "D83DDC50D83CDFFB"; _skinnedDict["D83DDC50D83CDFFC"] = "D83DDC50D83CDFFC"; _skinnedDict["D83DDC50D83CDFFD"] = "D83DDC50D83CDFFD"; _skinnedDict["D83DDC50D83CDFFE"] = "D83DDC50D83CDFFE"; _skinnedDict["D83DDC50D83CDFFF"] = "D83DDC50D83CDFFF"; _skinnedDict["D83DDCAA"] = "D83DDCAA"; _skinnedDict["D83DDCAAD83CDFFB"] = "D83DDCAAD83CDFFB"; _skinnedDict["D83DDCAAD83CDFFC"] = "D83DDCAAD83CDFFC"; _skinnedDict["D83DDCAAD83CDFFD"] = "D83DDCAAD83CDFFD"; _skinnedDict["D83DDCAAD83CDFFE"] = "D83DDCAAD83CDFFE"; _skinnedDict["D83DDCAAD83CDFFF"] = "D83DDCAAD83CDFFF"; _skinnedDict["D83DDE4F"] = "D83DDE4F"; _skinnedDict["D83DDE4FD83CDFFB"] = "D83DDE4FD83CDFFB"; _skinnedDict["D83DDE4FD83CDFFC"] = "D83DDE4FD83CDFFC"; _skinnedDict["D83DDE4FD83CDFFD"] = "D83DDE4FD83CDFFD"; _skinnedDict["D83DDE4FD83CDFFE"] = "D83DDE4FD83CDFFE"; _skinnedDict["D83DDE4FD83CDFFF"] = "D83DDE4FD83CDFFF"; _skinnedDict["D83DDD95"] = "D83DDD95"; _skinnedDict["D83DDD95D83CDFFB"] = "D83DDD95D83CDFFB"; _skinnedDict["D83DDD95D83CDFFC"] = "D83DDD95D83CDFFC"; _skinnedDict["D83DDD95D83CDFFD"] = "D83DDD95D83CDFFD"; _skinnedDict["D83DDD95D83CDFFE"] = "D83DDD95D83CDFFE"; _skinnedDict["D83DDD95D83CDFFF"] = "D83DDD95D83CDFFF"; _skinnedDict["D83DDD90"] = "D83DDD90"; _skinnedDict["D83DDD90D83CDFFB"] = "D83DDD90D83CDFFB"; _skinnedDict["D83DDD90D83CDFFC"] = "D83DDD90D83CDFFC"; _skinnedDict["D83DDD90D83CDFFD"] = "D83DDD90D83CDFFD"; _skinnedDict["D83DDD90D83CDFFE"] = "D83DDD90D83CDFFE"; _skinnedDict["D83DDD90D83CDFFF"] = "D83DDD90D83CDFFF"; _skinnedDict["D83EDD18"] = "D83EDD18"; _skinnedDict["D83EDD18D83CDFFB"] = "D83EDD18D83CDFFB"; _skinnedDict["D83EDD18D83CDFFC"] = "D83EDD18D83CDFFC"; _skinnedDict["D83EDD18D83CDFFD"] = "D83EDD18D83CDFFD"; _skinnedDict["D83EDD18D83CDFFE"] = "D83EDD18D83CDFFE"; _skinnedDict["D83EDD18D83CDFFF"] = "D83EDD18D83CDFFF"; _skinnedDict["D83DDD96"] = "D83DDD96"; _skinnedDict["D83DDD96D83CDFFB"] = "D83DDD96D83CDFFB"; _skinnedDict["D83DDD96D83CDFFC"] = "D83DDD96D83CDFFC"; _skinnedDict["D83DDD96D83CDFFD"] = "D83DDD96D83CDFFD"; _skinnedDict["D83DDD96D83CDFFE"] = "D83DDD96D83CDFFE"; _skinnedDict["D83DDD96D83CDFFF"] = "D83DDD96D83CDFFF"; _skinnedDict["D83DDC85"] = "D83DDC85"; _skinnedDict["D83DDC85D83CDFFB"] = "D83DDC85D83CDFFB"; _skinnedDict["D83DDC85D83CDFFC"] = "D83DDC85D83CDFFC"; _skinnedDict["D83DDC85D83CDFFD"] = "D83DDC85D83CDFFD"; _skinnedDict["D83DDC85D83CDFFE"] = "D83DDC85D83CDFFE"; _skinnedDict["D83DDC85D83CDFFF"] = "D83DDC85D83CDFFF"; _skinnedDict["D83DDC42"] = "D83DDC42"; _skinnedDict["D83DDC42D83CDFFB"] = "D83DDC42D83CDFFB"; _skinnedDict["D83DDC42D83CDFFC"] = "D83DDC42D83CDFFC"; _skinnedDict["D83DDC42D83CDFFD"] = "D83DDC42D83CDFFD"; _skinnedDict["D83DDC42D83CDFFE"] = "D83DDC42D83CDFFE"; _skinnedDict["D83DDC42D83CDFFF"] = "D83DDC42D83CDFFF"; _skinnedDict["D83DDC43"] = "D83DDC43"; _skinnedDict["D83DDC43D83CDFFB"] = "D83DDC43D83CDFFB"; _skinnedDict["D83DDC43D83CDFFC"] = "D83DDC43D83CDFFC"; _skinnedDict["D83DDC43D83CDFFD"] = "D83DDC43D83CDFFD"; _skinnedDict["D83DDC43D83CDFFE"] = "D83DDC43D83CDFFE"; _skinnedDict["D83DDC43D83CDFFF"] = "D83DDC43D83CDFFF"; _skinnedDict["D83DDC76"] = "D83DDC76"; _skinnedDict["D83DDC76D83CDFFB"] = "D83DDC76D83CDFFB"; _skinnedDict["D83DDC76D83CDFFC"] = "D83DDC76D83CDFFC"; _skinnedDict["D83DDC76D83CDFFD"] = "D83DDC76D83CDFFD"; _skinnedDict["D83DDC76D83CDFFE"] = "D83DDC76D83CDFFE"; _skinnedDict["D83DDC76D83CDFFF"] = "D83DDC76D83CDFFF"; _skinnedDict["D83DDC66"] = "D83DDC66"; _skinnedDict["D83DDC66D83CDFFB"] = "D83DDC66D83CDFFB"; _skinnedDict["D83DDC66D83CDFFC"] = "D83DDC66D83CDFFC"; _skinnedDict["D83DDC66D83CDFFD"] = "D83DDC66D83CDFFD"; _skinnedDict["D83DDC66D83CDFFE"] = "D83DDC66D83CDFFE"; _skinnedDict["D83DDC66D83CDFFF"] = "D83DDC66D83CDFFF"; _skinnedDict["D83DDC67"] = "D83DDC67"; _skinnedDict["D83DDC67D83CDFFB"] = "D83DDC67D83CDFFB"; _skinnedDict["D83DDC67D83CDFFC"] = "D83DDC67D83CDFFC"; _skinnedDict["D83DDC67D83CDFFD"] = "D83DDC67D83CDFFD"; _skinnedDict["D83DDC67D83CDFFE"] = "D83DDC67D83CDFFE"; _skinnedDict["D83DDC67D83CDFFF"] = "D83DDC67D83CDFFF"; _skinnedDict["D83DDC74"] = "D83DDC74"; _skinnedDict["D83DDC74D83CDFFB"] = "D83DDC74D83CDFFB"; _skinnedDict["D83DDC74D83CDFFC"] = "D83DDC74D83CDFFC"; _skinnedDict["D83DDC74D83CDFFD"] = "D83DDC74D83CDFFD"; _skinnedDict["D83DDC74D83CDFFE"] = "D83DDC74D83CDFFE"; _skinnedDict["D83DDC74D83CDFFF"] = "D83DDC74D83CDFFF"; _skinnedDict["D83DDC75"] = "D83DDC75"; _skinnedDict["D83DDC75D83CDFFB"] = "D83DDC75D83CDFFB"; _skinnedDict["D83DDC75D83CDFFC"] = "D83DDC75D83CDFFC"; _skinnedDict["D83DDC75D83CDFFD"] = "D83DDC75D83CDFFD"; _skinnedDict["D83DDC75D83CDFFE"] = "D83DDC75D83CDFFE"; _skinnedDict["D83DDC75D83CDFFF"] = "D83DDC75D83CDFFF"; _skinnedDict["D83DDC72"] = "D83DDC72"; _skinnedDict["D83DDC72D83CDFFB"] = "D83DDC72D83CDFFB"; _skinnedDict["D83DDC72D83CDFFC"] = "D83DDC72D83CDFFC"; _skinnedDict["D83DDC72D83CDFFD"] = "D83DDC72D83CDFFD"; _skinnedDict["D83DDC72D83CDFFE"] = "D83DDC72D83CDFFE"; _skinnedDict["D83DDC72D83CDFFF"] = "D83DDC72D83CDFFF"; _skinnedDict["D83DDC83"] = "D83DDC83"; _skinnedDict["D83DDC83D83CDFFB"] = "D83DDC83D83CDFFB"; _skinnedDict["D83DDC83D83CDFFC"] = "D83DDC83D83CDFFC"; _skinnedDict["D83DDC83D83CDFFD"] = "D83DDC83D83CDFFD"; _skinnedDict["D83DDC83D83CDFFE"] = "D83DDC83D83CDFFE"; _skinnedDict["D83DDC83D83CDFFF"] = "D83DDC83D83CDFFF"; _skinnedDict["D83CDF85"] = "D83CDF85"; _skinnedDict["D83CDF85D83CDFFB"] = "D83CDF85D83CDFFB"; _skinnedDict["D83CDF85D83CDFFC"] = "D83CDF85D83CDFFC"; _skinnedDict["D83CDF85D83CDFFD"] = "D83CDF85D83CDFFD"; _skinnedDict["D83CDF85D83CDFFE"] = "D83CDF85D83CDFFE"; _skinnedDict["D83CDF85D83CDFFF"] = "D83CDF85D83CDFFF"; _skinnedDict["D83DDC7C"] = "D83DDC7C"; _skinnedDict["D83DDC7CD83CDFFB"] = "D83DDC7CD83CDFFB"; _skinnedDict["D83DDC7CD83CDFFC"] = "D83DDC7CD83CDFFC"; _skinnedDict["D83DDC7CD83CDFFD"] = "D83DDC7CD83CDFFD"; _skinnedDict["D83DDC7CD83CDFFE"] = "D83DDC7CD83CDFFE"; _skinnedDict["D83DDC7CD83CDFFF"] = "D83DDC7CD83CDFFF"; _skinnedDict["D83DDC78"] = "D83DDC78"; _skinnedDict["D83DDC78D83CDFFB"] = "D83DDC78D83CDFFB"; _skinnedDict["D83DDC78D83CDFFC"] = "D83DDC78D83CDFFC"; _skinnedDict["D83DDC78D83CDFFD"] = "D83DDC78D83CDFFD"; _skinnedDict["D83DDC78D83CDFFE"] = "D83DDC78D83CDFFE"; _skinnedDict["D83DDC78D83CDFFF"] = "D83DDC78D83CDFFF"; _skinnedDict["D83DDC70"] = "D83DDC70"; _skinnedDict["D83DDC70D83CDFFB"] = "D83DDC70D83CDFFB"; _skinnedDict["D83DDC70D83CDFFC"] = "D83DDC70D83CDFFC"; _skinnedDict["D83DDC70D83CDFFD"] = "D83DDC70D83CDFFD"; _skinnedDict["D83DDC70D83CDFFE"] = "D83DDC70D83CDFFE"; _skinnedDict["D83DDC70D83CDFFF"] = "D83DDC70D83CDFFF"; _skinnedDict["D83DDEC0"] = "D83DDEC0"; _skinnedDict["D83DDEC0D83CDFFB"] = "D83DDEC0D83CDFFB"; _skinnedDict["D83DDEC0D83CDFFC"] = "D83DDEC0D83CDFFC"; _skinnedDict["D83DDEC0D83CDFFD"] = "D83DDEC0D83CDFFD"; _skinnedDict["D83DDEC0D83CDFFE"] = "D83DDEC0D83CDFFE"; _skinnedDict["D83DDEC0D83CDFFF"] = "D83DDEC0D83CDFFF"; _skinnedDict["270A"] = "270A"; _skinnedDict["270AD83CDFFB"] = "270AD83CDFFB"; _skinnedDict["270AD83CDFFC"] = "270AD83CDFFC"; _skinnedDict["270AD83CDFFD"] = "270AD83CDFFD"; _skinnedDict["270AD83CDFFE"] = "270AD83CDFFE"; _skinnedDict["270AD83CDFFF"] = "270AD83CDFFF"; _skinnedDict["270B"] = "270B"; _skinnedDict["270BD83CDFFB"] = "270BD83CDFFB"; _skinnedDict["270BD83CDFFC"] = "270BD83CDFFC"; _skinnedDict["270BD83CDFFD"] = "270BD83CDFFD"; _skinnedDict["270BD83CDFFE"] = "270BD83CDFFE"; _skinnedDict["270BD83CDFFF"] = "270BD83CDFFF"; _skinnedDict["270C"] = "270C"; _skinnedDict["270CD83CDFFB"] = "270CD83CDFFB"; _skinnedDict["270CD83CDFFC"] = "270CD83CDFFC"; _skinnedDict["270CD83CDFFD"] = "270CD83CDFFD"; _skinnedDict["270CD83CDFFE"] = "270CD83CDFFE"; _skinnedDict["270CD83CDFFF"] = "270CD83CDFFF"; _skinnedDict["270D"] = "270D"; _skinnedDict["270DD83CDFFB"] = "270DD83CDFFB"; _skinnedDict["270DD83CDFFC"] = "270DD83CDFFC"; _skinnedDict["270DD83CDFFD"] = "270DD83CDFFD"; _skinnedDict["270DD83CDFFE"] = "270DD83CDFFE"; _skinnedDict["270DD83CDFFF"] = "270DD83CDFFF"; _skinnedDict["261D"] = "261D"; _skinnedDict["261DD83CDFFB"] = "261DD83CDFFB"; _skinnedDict["261DD83CDFFC"] = "261DD83CDFFC"; _skinnedDict["261DD83CDFFD"] = "261DD83CDFFD"; _skinnedDict["261DD83CDFFE"] = "261DD83CDFFE"; _skinnedDict["261DD83CDFFF"] = "261DD83CDFFF"; _dict["002320E3"] = "002320E3"; _dict["003020E3"] = "003020E3"; _dict["003120E3"] = "003120E3"; _dict["003220E3"] = "003220E3"; _dict["003320E3"] = "003320E3"; _dict["003420E3"] = "003420E3"; _dict["003520E3"] = "003520E3"; _dict["003620E3"] = "003620E3"; _dict["003720E3"] = "003720E3"; _dict["003820E3"] = "003820E3"; _dict["003920E3"] = "003920E3"; _dict["00A9"] = "00A9"; _dict["00AE"] = "00AE"; _dict["203C"] = "203C"; _dict["2049"] = "2049"; _dict["2122"] = "2122"; _dict["2139"] = "2139"; _dict["2194"] = "2194"; _dict["2195"] = "2195"; _dict["2196"] = "2196"; _dict["2197"] = "2197"; _dict["2198"] = "2198"; _dict["2199"] = "2199"; _dict["21A9"] = "21A9"; _dict["21AA"] = "21AA"; _dict["231A"] = "231A"; _dict["231B"] = "231B"; _dict["2328"] = "2328"; _dict["23E9"] = "23E9"; _dict["23EA"] = "23EA"; _dict["23EB"] = "23EB"; _dict["23EC"] = "23EC"; _dict["23ED"] = "23ED"; _dict["23EE"] = "23EE"; _dict["23EF"] = "23EF"; _dict["23F0"] = "23F0"; _dict["23F1"] = "23F1"; _dict["23F2"] = "23F2"; _dict["23F3"] = "23F3"; _dict["23F8"] = "23F8"; _dict["23F9"] = "23F9"; _dict["23FA"] = "23FA"; _dict["24C2"] = "24C2"; _dict["25AA"] = "25AA"; _dict["25AB"] = "25AB"; _dict["25B6"] = "25B6"; _dict["25C0"] = "25C0"; _dict["25FB"] = "25FB"; _dict["25FC"] = "25FC"; _dict["25FD"] = "25FD"; _dict["25FE"] = "25FE"; _dict["2600"] = "2600"; _dict["2601"] = "2601"; _dict["2602"] = "2602"; _dict["2603"] = "2603"; _dict["2604"] = "2604"; _dict["260E"] = "260E"; _dict["2611"] = "2611"; _dict["2614"] = "2614"; _dict["2618"] = "2618"; _dict["2614FE0F"] = "2614"; _dict["2615"] = "2615"; _dict["261D"] = "261D"; _dict["2620"] = "2620"; _dict["2622"] = "2622"; _dict["2623"] = "2623"; _dict["2626"] = "2626"; _dict["262A"] = "262A"; _dict["262E"] = "262E"; _dict["262F"] = "262F"; _dict["2638"] = "2638"; _dict["2639"] = "2639"; _dict["263A"] = "263A"; _dict["2648"] = "2648"; _dict["2649"] = "2649"; _dict["264A"] = "264A"; _dict["264B"] = "264B"; _dict["264C"] = "264C"; _dict["264D"] = "264D"; _dict["264E"] = "264E"; _dict["264F"] = "264F"; _dict["2650"] = "2650"; _dict["2651"] = "2651"; _dict["2652"] = "2652"; _dict["2653"] = "2653"; _dict["2660"] = "2660"; _dict["2663"] = "2663"; _dict["2665"] = "2665"; _dict["2666"] = "2666"; _dict["2668"] = "2668"; _dict["267B"] = "267B"; _dict["267F"] = "267F"; _dict["2692"] = "2692"; _dict["2693"] = "2693"; _dict["2694"] = "2694"; _dict["2696"] = "2696"; _dict["2697"] = "2697"; _dict["2699"] = "2699"; _dict["269B"] = "269B"; _dict["269C"] = "269C"; _dict["26A0"] = "26A0"; _dict["26A1"] = "26A1"; _dict["26AA"] = "26AA"; _dict["26AB"] = "26AB"; _dict["26B0"] = "26B0"; _dict["26B1"] = "26B1"; _dict["26BD"] = "26BD"; _dict["26BE"] = "26BE"; _dict["26C4"] = "26C4"; _dict["26C5"] = "26C5"; _dict["26C8"] = "26C8"; _dict["26CE"] = "26CE"; _dict["26CF"] = "26CF"; _dict["26D1"] = "26D1"; _dict["26D3"] = "26D3"; _dict["26D4"] = "26D4"; _dict["26E9"] = "26E9"; _dict["26EA"] = "26EA"; _dict["26F0"] = "26F0"; _dict["26F1"] = "26F1"; _dict["26F2"] = "26F2"; _dict["26F3"] = "26F3"; _dict["26F4"] = "26F4"; _dict["26F5"] = "26F5"; _dict["26F7"] = "26F7"; _dict["26F8"] = "26F8"; _dict["26FA"] = "26FA"; _dict["26FD"] = "26FD"; _dict["2702"] = "2702"; _dict["2705"] = "2705"; _dict["2708"] = "2708"; _dict["2709"] = "2709"; _dict["270A"] = "270A"; _dict["270B"] = "270B"; _dict["270C"] = "270C"; _dict["270F"] = "270F"; _dict["2712"] = "2712"; _dict["2714"] = "2714"; _dict["2716"] = "2716"; _dict["271D"] = "271D"; _dict["2721"] = "2721"; _dict["2728"] = "2728"; _dict["2733"] = "2733"; _dict["2734"] = "2734"; _dict["2744"] = "2744"; _dict["2747"] = "2747"; _dict["274C"] = "274C"; _dict["274E"] = "274E"; _dict["2753"] = "2753"; _dict["2754"] = "2754"; _dict["2755"] = "2755"; _dict["2757"] = "2757"; _dict["2763"] = "2763"; _dict["2764"] = "2764"; _dict["2764FE0F"] = "2764"; _dict["2795"] = "2795"; _dict["2796"] = "2796"; _dict["2797"] = "2797"; _dict["27A1"] = "27A1"; _dict["27B0"] = "27B0"; _dict["27BF"] = "27BF"; _dict["2934"] = "2934"; _dict["2935"] = "2935"; _dict["2B05"] = "2B05"; _dict["2B06"] = "2B06"; _dict["2B07"] = "2B07"; _dict["2B1B"] = "2B1B"; _dict["2B1C"] = "2B1C"; _dict["2B50"] = "2B50"; _dict["2B55"] = "2B55"; _dict["3030"] = "3030"; _dict["303D"] = "303D"; _dict["3297"] = "3297"; _dict["3299"] = "3299"; _dict["D83CDC04"] = "D83CDC04"; _dict["D83CDCCF"] = "D83CDCCF"; _dict["D83CDD70"] = "D83CDD70"; _dict["D83CDD71"] = "D83CDD71"; _dict["D83CDD7E"] = "D83CDD7E"; _dict["D83CDD7F"] = "D83CDD7F"; _dict["D83CDD8E"] = "D83CDD8E"; _dict["D83CDD91"] = "D83CDD91"; _dict["D83CDD92"] = "D83CDD92"; _dict["D83CDD93"] = "D83CDD93"; _dict["D83CDD94"] = "D83CDD94"; _dict["D83CDD95"] = "D83CDD95"; _dict["D83CDD96"] = "D83CDD96"; _dict["D83CDD97"] = "D83CDD97"; _dict["D83CDD98"] = "D83CDD98"; _dict["D83CDD99"] = "D83CDD99"; _dict["D83CDD9A"] = "D83CDD9A"; _dict["D83CDDE8D83CDDF3"] = "D83CDDE8D83CDDF3"; _dict["D83CDDE9D83CDDEA"] = "D83CDDE9D83CDDEA"; _dict["D83CDDEAD83CDDF8"] = "D83CDDEAD83CDDF8"; _dict["D83CDDEBD83CDDF7"] = "D83CDDEBD83CDDF7"; _dict["D83CDDECD83CDDE7"] = "D83CDDECD83CDDE7"; _dict["D83CDDEED83CDDF9"] = "D83CDDEED83CDDF9"; _dict["D83CDDEFD83CDDF5"] = "D83CDDEFD83CDDF5"; _dict["D83CDDF0D83CDDF7"] = "D83CDDF0D83CDDF7"; _dict["D83CDDF7D83CDDFA"] = "D83CDDF7D83CDDFA"; _dict["D83CDDFAD83CDDF8"] = "D83CDDFAD83CDDF8"; _dict["D83CDDE6D83CDDFA"] = "D83CDDE6D83CDDFA"; _dict["D83CDDE6D83CDDF9"] = "D83CDDE6D83CDDF9"; _dict["D83CDDE6D83CDDFF"] = "D83CDDE6D83CDDFF"; _dict["D83CDDE6D83CDDFD"] = "D83CDDE6D83CDDFD"; _dict["D83CDDE6D83CDDF1"] = "D83CDDE6D83CDDF1"; _dict["D83CDDE9D83CDDFF"] = "D83CDDE9D83CDDFF"; _dict["D83CDDE6D83CDDF8"] = "D83CDDE6D83CDDF8"; _dict["D83CDDE6D83CDDEE"] = "D83CDDE6D83CDDEE"; _dict["D83CDDE6D83CDDF4"] = "D83CDDE6D83CDDF4"; _dict["D83CDDE6D83CDDE9"] = "D83CDDE6D83CDDE9"; _dict["D83CDDE6D83CDDF6"] = "D83CDDE6D83CDDF6"; _dict["D83CDDE6D83CDDEC"] = "D83CDDE6D83CDDEC"; _dict["D83CDDE6D83CDDF7"] = "D83CDDE6D83CDDF7"; _dict["D83CDDE6D83CDDF2"] = "D83CDDE6D83CDDF2"; _dict["D83CDDE6D83CDDFC"] = "D83CDDE6D83CDDFC"; _dict["D83CDDE6D83CDDEB"] = "D83CDDE6D83CDDEB"; _dict["D83CDDE7D83CDDF8"] = "D83CDDE7D83CDDF8"; _dict["D83CDDE7D83CDDE9"] = "D83CDDE7D83CDDE9"; _dict["D83CDDE7D83CDDE7"] = "D83CDDE7D83CDDE7"; _dict["D83CDDE7D83CDDED"] = "D83CDDE7D83CDDED"; _dict["D83CDDE7D83CDDFE"] = "D83CDDE7D83CDDFE"; _dict["D83CDDE7D83CDDFF"] = "D83CDDE7D83CDDFF"; _dict["D83CDDE7D83CDDEA"] = "D83CDDE7D83CDDEA"; _dict["D83CDDE7D83CDDEF"] = "D83CDDE7D83CDDEF"; _dict["D83CDDE7D83CDDF2"] = "D83CDDE7D83CDDF2"; _dict["D83CDDE7D83CDDEC"] = "D83CDDE7D83CDDEC"; _dict["D83CDDE7D83CDDF4"] = "D83CDDE7D83CDDF4"; _dict["D83CDDE7D83CDDF6"] = "D83CDDE7D83CDDF6"; _dict["D83CDDE7D83CDDE6"] = "D83CDDE7D83CDDE6"; _dict["D83CDDE7D83CDDFC"] = "D83CDDE7D83CDDFC"; _dict["D83CDDE7D83CDDF7"] = "D83CDDE7D83CDDF7"; _dict["D83CDDEED83CDDF4"] = "D83CDDEED83CDDF4"; _dict["D83CDDE7D83CDDF3"] = "D83CDDE7D83CDDF3"; _dict["D83CDDE7D83CDDEB"] = "D83CDDE7D83CDDEB"; _dict["D83CDDE7D83CDDEE"] = "D83CDDE7D83CDDEE"; _dict["D83CDDE7D83CDDF9"] = "D83CDDE7D83CDDF9"; _dict["D83CDDFBD83CDDFA"] = "D83CDDFBD83CDDFA"; _dict["D83CDDFBD83CDDE6"] = "D83CDDFBD83CDDE6"; _dict["D83CDDECD83CDDE7"] = "D83CDDECD83CDDE7"; _dict["D83CDDEDD83CDDFA"] = "D83CDDEDD83CDDFA"; _dict["D83CDDFBD83CDDEA"] = "D83CDDFBD83CDDEA"; _dict["D83CDDFBD83CDDEC"] = "D83CDDFBD83CDDEC"; _dict["D83CDDFBD83CDDEE"] = "D83CDDFBD83CDDEE"; _dict["D83CDDF9D83CDDF1"] = "D83CDDF9D83CDDF1"; _dict["D83CDDFBD83CDDF3"] = "D83CDDFBD83CDDF3"; _dict["D83CDDECD83CDDE6"] = "D83CDDECD83CDDE6"; _dict["D83CDDEDD83CDDF9"] = "D83CDDEDD83CDDF9"; _dict["D83CDDECD83CDDFE"] = "D83CDDECD83CDDFE"; _dict["D83CDDECD83CDDF2"] = "D83CDDECD83CDDF2"; _dict["D83CDDECD83CDDED"] = "D83CDDECD83CDDED"; _dict["D83CDDECD83CDDF5"] = "D83CDDECD83CDDF5"; _dict["D83CDDECD83CDDF9"] = "D83CDDECD83CDDF9"; _dict["D83CDDECD83CDDF3"] = "D83CDDECD83CDDF3"; _dict["D83CDDECD83CDDFC"] = "D83CDDECD83CDDFC"; _dict["D83CDDE9D83CDDEA"] = "D83CDDE9D83CDDEA"; _dict["D83CDDECD83CDDEC"] = "D83CDDECD83CDDEC"; _dict["D83CDDECD83CDDEE"] = "D83CDDECD83CDDEE"; _dict["D83CDDEDD83CDDF3"] = "D83CDDEDD83CDDF3"; _dict["D83CDDEDD83CDDF0"] = "D83CDDEDD83CDDF0"; _dict["D83CDDECD83CDDE9"] = "D83CDDECD83CDDE9"; _dict["D83CDDECD83CDDF1"] = "D83CDDECD83CDDF1"; _dict["D83CDDECD83CDDF7"] = "D83CDDECD83CDDF7"; _dict["D83CDDECD83CDDEA"] = "D83CDDECD83CDDEA"; _dict["D83CDDECD83CDDFA"] = "D83CDDECD83CDDFA"; _dict["D83CDDE9D83CDDF0"] = "D83CDDE9D83CDDF0"; _dict["D83CDDEFD83CDDEA"] = "D83CDDEFD83CDDEA"; _dict["D83CDDE9D83CDDEF"] = "D83CDDE9D83CDDEF"; _dict["D83CDDE9D83CDDF2"] = "D83CDDE9D83CDDF2"; _dict["D83CDDE9D83CDDF4"] = "D83CDDE9D83CDDF4"; _dict["D83CDDEAD83CDDFA"] = "D83CDDEAD83CDDFA"; _dict["D83CDDEAD83CDDEC"] = "D83CDDEAD83CDDEC"; _dict["D83CDDFFD83CDDF2"] = "D83CDDFFD83CDDF2"; _dict["D83CDDEAD83CDDED"] = "D83CDDEAD83CDDED"; _dict["D83CDDFFD83CDDFC"] = "D83CDDFFD83CDDFC"; _dict["D83CDDEED83CDDF1"] = "D83CDDEED83CDDF1"; _dict["D83CDDEED83CDDF3"] = "D83CDDEED83CDDF3"; _dict["D83CDDEED83CDDE9"] = "D83CDDEED83CDDE9"; _dict["D83CDDEFD83CDDF4"] = "D83CDDEFD83CDDF4"; _dict["D83CDDEED83CDDF6"] = "D83CDDEED83CDDF6"; _dict["D83CDDEED83CDDF7"] = "D83CDDEED83CDDF7"; _dict["D83CDDEED83CDDEA"] = "D83CDDEED83CDDEA"; _dict["D83CDDEED83CDDF8"] = "D83CDDEED83CDDF8"; _dict["D83CDDEAD83CDDF8"] = "D83CDDEAD83CDDF8"; _dict["D83CDDEED83CDDF9"] = "D83CDDEED83CDDF9"; _dict["D83CDDFED83CDDEA"] = "D83CDDFED83CDDEA"; _dict["D83CDDE8D83CDDFB"] = "D83CDDE8D83CDDFB"; _dict["D83CDDF0D83CDDFF"] = "D83CDDF0D83CDDFF"; _dict["D83CDDF0D83CDDFE"] = "D83CDDF0D83CDDFE"; _dict["D83CDDF0D83CDDED"] = "D83CDDF0D83CDDED"; _dict["D83CDDE8D83CDDF2"] = "D83CDDE8D83CDDF2"; _dict["D83CDDE8D83CDDE6"] = "D83CDDE8D83CDDE6"; _dict["D83CDDEED83CDDE8"] = "D83CDDEED83CDDE8"; _dict["D83CDDF6D83CDDE6"] = "D83CDDF6D83CDDE6"; _dict["D83CDDF0D83CDDEA"] = "D83CDDF0D83CDDEA"; _dict["D83CDDE8D83CDDFE"] = "D83CDDE8D83CDDFE"; _dict["D83CDDF0D83CDDEC"] = "D83CDDF0D83CDDEC"; _dict["D83CDDF0D83CDDEE"] = "D83CDDF0D83CDDEE"; _dict["D83CDDE8D83CDDF3"] = "D83CDDE8D83CDDF3"; _dict["D83CDDF0D83CDDF5"] = "D83CDDF0D83CDDF5"; _dict["D83CDDE8D83CDDE8"] = "D83CDDE8D83CDDE8"; _dict["D83CDDE8D83CDDF4"] = "D83CDDE8D83CDDF4"; _dict["D83CDDF0D83CDDF2"] = "D83CDDF0D83CDDF2"; _dict["D83CDDE8D83CDDEC"] = "D83CDDE8D83CDDEC"; _dict["D83CDDE8D83CDDE9"] = "D83CDDE8D83CDDE9"; _dict["D83CDDFDD83CDDF0"] = "D83CDDFDD83CDDF0"; _dict["D83CDDE8D83CDDF7"] = "D83CDDE8D83CDDF7"; _dict["D83CDDE8D83CDDEE"] = "D83CDDE8D83CDDEE"; _dict["D83CDDE8D83CDDFA"] = "D83CDDE8D83CDDFA"; _dict["D83CDDF0D83CDDFC"] = "D83CDDF0D83CDDFC"; _dict["D83CDDE8D83CDDFC"] = "D83CDDE8D83CDDFC"; _dict["D83CDDF1D83CDDE6"] = "D83CDDF1D83CDDE6"; _dict["D83CDDF1D83CDDFB"] = "D83CDDF1D83CDDFB"; _dict["D83CDDF1D83CDDF8"] = "D83CDDF1D83CDDF8"; _dict["D83CDDF1D83CDDF7"] = "D83CDDF1D83CDDF7"; _dict["D83CDDF1D83CDDE7"] = "D83CDDF1D83CDDE7"; _dict["D83CDDF1D83CDDFE"] = "D83CDDF1D83CDDFE"; _dict["D83CDDF1D83CDDF9"] = "D83CDDF1D83CDDF9"; _dict["D83CDDF1D83CDDEE"] = "D83CDDF1D83CDDEE"; _dict["D83CDDF1D83CDDFA"] = "D83CDDF1D83CDDFA"; _dict["D83CDDF2D83CDDFA"] = "D83CDDF2D83CDDFA"; _dict["D83CDDF2D83CDDF7"] = "D83CDDF2D83CDDF7"; _dict["D83CDDF2D83CDDEC"] = "D83CDDF2D83CDDEC"; _dict["D83CDDFED83CDDF9"] = "D83CDDFED83CDDF9"; _dict["D83CDDF2D83CDDF4"] = "D83CDDF2D83CDDF4"; _dict["D83CDDF2D83CDDF0"] = "D83CDDF2D83CDDF0"; _dict["D83CDDF2D83CDDFC"] = "D83CDDF2D83CDDFC"; _dict["D83CDDF2D83CDDFE"] = "D83CDDF2D83CDDFE"; _dict["D83CDDF2D83CDDF1"] = "D83CDDF2D83CDDF1"; _dict["D83CDDF2D83CDDFB"] = "D83CDDF2D83CDDFB"; _dict["D83CDDF2D83CDDF9"] = "D83CDDF2D83CDDF9"; _dict["D83CDDF2D83CDDE6"] = "D83CDDF2D83CDDE6"; _dict["D83CDDF2D83CDDF6"] = "D83CDDF2D83CDDF6"; _dict["D83CDDF2D83CDDED"] = "D83CDDF2D83CDDED"; _dict["D83CDDF2D83CDDFD"] = "D83CDDF2D83CDDFD"; _dict["D83CDDEBD83CDDF2"] = "D83CDDEBD83CDDF2"; _dict["D83CDDF2D83CDDFF"] = "D83CDDF2D83CDDFF"; _dict["D83CDDF2D83CDDE9"] = "D83CDDF2D83CDDE9"; _dict["D83CDDF2D83CDDE8"] = "D83CDDF2D83CDDE8"; _dict["D83CDDF2D83CDDF3"] = "D83CDDF2D83CDDF3"; _dict["D83CDDF2D83CDDF8"] = "D83CDDF2D83CDDF8"; _dict["D83CDDF2D83CDDF2"] = "D83CDDF2D83CDDF2"; _dict["D83CDDF3D83CDDE6"] = "D83CDDF3D83CDDE6"; _dict["D83CDDF3D83CDDF7"] = "D83CDDF3D83CDDF7"; _dict["D83CDDF3D83CDDF5"] = "D83CDDF3D83CDDF5"; _dict["D83CDDF3D83CDDEA"] = "D83CDDF3D83CDDEA"; _dict["D83CDDF3D83CDDEC"] = "D83CDDF3D83CDDEC"; _dict["D83CDDF3D83CDDF1"] = "D83CDDF3D83CDDF1"; _dict["D83CDDF3D83CDDEE"] = "D83CDDF3D83CDDEE"; _dict["D83CDDF3D83CDDFA"] = "D83CDDF3D83CDDFA"; _dict["D83CDDF3D83CDDFF"] = "D83CDDF3D83CDDFF"; _dict["D83CDDF3D83CDDE8"] = "D83CDDF3D83CDDE8"; _dict["D83CDDF3D83CDDF4"] = "D83CDDF3D83CDDF4"; _dict["D83CDDEED83CDDF2"] = "D83CDDEED83CDDF2"; _dict["D83CDDF3D83CDDEB"] = "D83CDDF3D83CDDEB"; _dict["D83CDDE8D83CDDFD"] = "D83CDDE8D83CDDFD"; _dict["D83CDDF8D83CDDED"] = "D83CDDF8D83CDDED"; _dict["D83CDDE8D83CDDF0"] = "D83CDDE8D83CDDF0"; _dict["D83CDDF9D83CDDE8"] = "D83CDDF9D83CDDE8"; _dict["D83CDDE6D83CDDEA"] = "D83CDDE6D83CDDEA"; _dict["D83CDDF4D83CDDF2"] = "D83CDDF4D83CDDF2"; _dict["D83CDDF5D83CDDF0"] = "D83CDDF5D83CDDF0"; _dict["D83CDDF5D83CDDFC"] = "D83CDDF5D83CDDFC"; _dict["D83CDDF5D83CDDF8"] = "D83CDDF5D83CDDF8"; _dict["D83CDDF5D83CDDE6"] = "D83CDDF5D83CDDE6"; _dict["D83CDDF5D83CDDEC"] = "D83CDDF5D83CDDEC"; _dict["D83CDDF5D83CDDFE"] = "D83CDDF5D83CDDFE"; _dict["D83CDDF5D83CDDEA"] = "D83CDDF5D83CDDEA"; _dict["D83CDDF5D83CDDF3"] = "D83CDDF5D83CDDF3"; _dict["D83CDDF5D83CDDF1"] = "D83CDDF5D83CDDF1"; _dict["D83CDDF5D83CDDF9"] = "D83CDDF5D83CDDF9"; _dict["D83CDDF5D83CDDF7"] = "D83CDDF5D83CDDF7"; _dict["D83CDDF0D83CDDF7"] = "D83CDDF0D83CDDF7"; _dict["D83CDDF7D83CDDEA"] = "D83CDDF7D83CDDEA"; _dict["D83CDDF7D83CDDFA"] = "D83CDDF7D83CDDFA"; _dict["D83CDDF7D83CDDFC"] = "D83CDDF7D83CDDFC"; _dict["D83CDDF7D83CDDF4"] = "D83CDDF7D83CDDF4"; _dict["D83CDDF8D83CDDFB"] = "D83CDDF8D83CDDFB"; _dict["D83CDDFCD83CDDF8"] = "D83CDDFCD83CDDF8"; _dict["D83CDDF8D83CDDF2"] = "D83CDDF8D83CDDF2"; _dict["D83CDDF8D83CDDF9"] = "D83CDDF8D83CDDF9"; _dict["D83CDDF8D83CDDE6"] = "D83CDDF8D83CDDE6"; _dict["D83CDDF8D83CDDFF"] = "D83CDDF8D83CDDFF"; _dict["D83CDDF2D83CDDF5"] = "D83CDDF2D83CDDF5"; _dict["D83CDDF8D83CDDE8"] = "D83CDDF8D83CDDE8"; _dict["D83CDDE7D83CDDF1"] = "D83CDDE7D83CDDF1"; _dict["D83CDDF5D83CDDF2"] = "D83CDDF5D83CDDF2"; _dict["D83CDDF8D83CDDF3"] = "D83CDDF8D83CDDF3"; _dict["D83CDDFBD83CDDE8"] = "D83CDDFBD83CDDE8"; _dict["D83CDDF0D83CDDF3"] = "D83CDDF0D83CDDF3"; _dict["D83CDDF1D83CDDE8"] = "D83CDDF1D83CDDE8"; _dict["D83CDDF7D83CDDF8"] = "D83CDDF7D83CDDF8"; _dict["D83CDDF8D83CDDEC"] = "D83CDDF8D83CDDEC"; _dict["D83CDDF8D83CDDFD"] = "D83CDDF8D83CDDFD"; _dict["D83CDDF8D83CDDFE"] = "D83CDDF8D83CDDFE"; _dict["D83CDDF8D83CDDF0"] = "D83CDDF8D83CDDF0"; _dict["D83CDDF8D83CDDEE"] = "D83CDDF8D83CDDEE"; _dict["D83CDDFAD83CDDF8"] = "D83CDDFAD83CDDF8"; _dict["D83CDDF8D83CDDE7"] = "D83CDDF8D83CDDE7"; _dict["D83CDDF8D83CDDF4"] = "D83CDDF8D83CDDF4"; _dict["D83CDDF8D83CDDE9"] = "D83CDDF8D83CDDE9"; _dict["D83CDDF8D83CDDF7"] = "D83CDDF8D83CDDF7"; _dict["D83CDDF8D83CDDF1"] = "D83CDDF8D83CDDF1"; _dict["D83CDDF9D83CDDEF"] = "D83CDDF9D83CDDEF"; _dict["D83CDDF9D83CDDED"] = "D83CDDF9D83CDDED"; _dict["D83CDDF9D83CDDFC"] = "D83CDDF9D83CDDFC"; _dict["D83CDDF9D83CDDFF"] = "D83CDDF9D83CDDFF"; _dict["D83CDDF9D83CDDEC"] = "D83CDDF9D83CDDEC"; _dict["D83CDDF9D83CDDF0"] = "D83CDDF9D83CDDF0"; _dict["D83CDDF9D83CDDF4"] = "D83CDDF9D83CDDF4"; _dict["D83CDDF9D83CDDF9"] = "D83CDDF9D83CDDF9"; _dict["D83CDDF9D83CDDFB"] = "D83CDDF9D83CDDFB"; _dict["D83CDDF9D83CDDF3"] = "D83CDDF9D83CDDF3"; _dict["D83CDDF9D83CDDF2"] = "D83CDDF9D83CDDF2"; _dict["D83CDDF9D83CDDF7"] = "D83CDDF9D83CDDF7"; _dict["D83CDDFAD83CDDEC"] = "D83CDDFAD83CDDEC"; _dict["D83CDDFAD83CDDFF"] = "D83CDDFAD83CDDFF"; _dict["D83CDDFAD83CDDE6"] = "D83CDDFAD83CDDE6"; _dict["D83CDDFCD83CDDEB"] = "D83CDDFCD83CDDEB"; _dict["D83CDDFAD83CDDFE"] = "D83CDDFAD83CDDFE"; _dict["D83CDDEBD83CDDF4"] = "D83CDDEBD83CDDF4"; _dict["D83CDDEBD83CDDEF"] = "D83CDDEBD83CDDEF"; _dict["D83CDDF5D83CDDED"] = "D83CDDF5D83CDDED"; _dict["D83CDDEBD83CDDEE"] = "D83CDDEBD83CDDEE"; _dict["D83CDDEBD83CDDF0"] = "D83CDDEBD83CDDF0"; _dict["D83CDDEBD83CDDF7"] = "D83CDDEBD83CDDF7"; _dict["D83CDDECD83CDDEB"] = "D83CDDECD83CDDEB"; _dict["D83CDDF5D83CDDEB"] = "D83CDDF5D83CDDEB"; _dict["D83CDDF9D83CDDEB"] = "D83CDDF9D83CDDEB"; _dict["D83CDDEDD83CDDF7"] = "D83CDDEDD83CDDF7"; _dict["D83CDDE8D83CDDEB"] = "D83CDDE8D83CDDEB"; _dict["D83CDDF9D83CDDE9"] = "D83CDDF9D83CDDE9"; _dict["D83CDDF2D83CDDEA"] = "D83CDDF2D83CDDEA"; _dict["D83CDDE8D83CDDFF"] = "D83CDDE8D83CDDFF"; _dict["D83CDDE8D83CDDF1"] = "D83CDDE8D83CDDF1"; _dict["D83CDDE8D83CDDED"] = "D83CDDE8D83CDDED"; _dict["D83CDDF8D83CDDEA"] = "D83CDDF8D83CDDEA"; _dict["D83CDDF1D83CDDF0"] = "D83CDDF1D83CDDF0"; _dict["D83CDDEAD83CDDE8"] = "D83CDDEAD83CDDE8"; _dict["D83CDDECD83CDDF6"] = "D83CDDECD83CDDF6"; _dict["D83CDDEAD83CDDF7"] = "D83CDDEAD83CDDF7"; _dict["D83CDDEAD83CDDEA"] = "D83CDDEAD83CDDEA"; _dict["D83CDDEAD83CDDF9"] = "D83CDDEAD83CDDF9"; _dict["D83CDDFFD83CDDE6"] = "D83CDDFFD83CDDE6"; _dict["D83CDDECD83CDDF8"] = "D83CDDECD83CDDF8"; _dict["D83CDDF8D83CDDF8"] = "D83CDDF8D83CDDF8"; _dict["D83CDDEFD83CDDF2"] = "D83CDDEFD83CDDF2"; _dict["D83CDDEFD83CDDF5"] = "D83CDDEFD83CDDF5"; _dict["D83CDE01"] = "D83CDE01"; _dict["D83CDE02"] = "D83CDE02"; _dict["D83CDE1A"] = "D83CDE1A"; _dict["D83CDE2F"] = "D83CDE2F"; _dict["D83CDE32"] = "D83CDE32"; _dict["D83CDE33"] = "D83CDE33"; _dict["D83CDE34"] = "D83CDE34"; _dict["D83CDE35"] = "D83CDE35"; _dict["D83CDE36"] = "D83CDE36"; _dict["D83CDE37"] = "D83CDE37"; _dict["D83CDE38"] = "D83CDE38"; _dict["D83CDE39"] = "D83CDE39"; _dict["D83CDE3A"] = "D83CDE3A"; _dict["D83CDE50"] = "D83CDE50"; _dict["D83CDE51"] = "D83CDE51"; _dict["D83CDF00"] = "D83CDF00"; _dict["D83CDF01"] = "D83CDF01"; _dict["D83CDF02"] = "D83CDF02"; _dict["D83CDF03"] = "D83CDF03"; _dict["D83CDF04"] = "D83CDF04"; _dict["D83CDF05"] = "D83CDF05"; _dict["D83CDF06"] = "D83CDF06"; _dict["D83CDF07"] = "D83CDF07"; _dict["D83CDF08"] = "D83CDF08"; _dict["D83CDF09"] = "D83CDF09"; _dict["D83CDF0A"] = "D83CDF0A"; _dict["D83CDF0B"] = "D83CDF0B"; _dict["D83CDF0C"] = "D83CDF0C"; _dict["D83CDF0D"] = "D83CDF0D"; _dict["D83CDF0E"] = "D83CDF0E"; _dict["D83CDF0F"] = "D83CDF0F"; _dict["D83CDF10"] = "D83CDF10"; _dict["D83CDF11"] = "D83CDF11"; _dict["D83CDF12"] = "D83CDF12"; _dict["D83CDF13"] = "D83CDF13"; _dict["D83CDF14"] = "D83CDF14"; _dict["D83CDF15"] = "D83CDF15"; _dict["D83CDF16"] = "D83CDF16"; _dict["D83CDF17"] = "D83CDF17"; _dict["D83CDF18"] = "D83CDF18"; _dict["D83CDF19"] = "D83CDF19"; _dict["D83CDF1A"] = "D83CDF1A"; _dict["D83CDF1B"] = "D83CDF1B"; _dict["D83CDF1C"] = "D83CDF1C"; _dict["D83CDF1D"] = "D83CDF1D"; _dict["D83CDF1E"] = "D83CDF1E"; _dict["D83CDF1F"] = "D83CDF1F"; _dict["D83CDF20"] = "D83CDF20"; _dict["D83CDF21"] = "D83CDF21"; _dict["D83CDF24"] = "D83CDF24"; _dict["D83CDF25"] = "D83CDF25"; _dict["D83CDF26"] = "D83CDF26"; _dict["D83CDF27"] = "D83CDF27"; _dict["D83CDF28"] = "D83CDF28"; _dict["D83CDF29"] = "D83CDF29"; _dict["D83CDF2A"] = "D83CDF2A"; _dict["D83CDF2B"] = "D83CDF2B"; _dict["D83CDF2C"] = "D83CDF2C"; _dict["D83CDF2D"] = "D83CDF2D"; _dict["D83CDF2E"] = "D83CDF2E"; _dict["D83CDF2F"] = "D83CDF2F"; _dict["D83CDF30"] = "D83CDF30"; _dict["D83CDF31"] = "D83CDF31"; _dict["D83CDF32"] = "D83CDF32"; _dict["D83CDF33"] = "D83CDF33"; _dict["D83CDF34"] = "D83CDF34"; _dict["D83CDF35"] = "D83CDF35"; _dict["D83CDF36"] = "D83CDF36"; _dict["D83CDF37"] = "D83CDF37"; _dict["D83CDF38"] = "D83CDF38"; _dict["D83CDF39"] = "D83CDF39"; _dict["D83CDF3A"] = "D83CDF3A"; _dict["D83CDF3B"] = "D83CDF3B"; _dict["D83CDF3C"] = "D83CDF3C"; _dict["D83CDF3D"] = "D83CDF3D"; _dict["D83CDF3E"] = "D83CDF3E"; _dict["D83CDF3F"] = "D83CDF3F"; _dict["D83CDF40"] = "D83CDF40"; _dict["D83CDF41"] = "D83CDF41"; _dict["D83CDF42"] = "D83CDF42"; _dict["D83CDF43"] = "D83CDF43"; _dict["D83CDF44"] = "D83CDF44"; _dict["D83CDF45"] = "D83CDF45"; _dict["D83CDF46"] = "D83CDF46"; _dict["D83CDF47"] = "D83CDF47"; _dict["D83CDF48"] = "D83CDF48"; _dict["D83CDF49"] = "D83CDF49"; _dict["D83CDF4A"] = "D83CDF4A"; _dict["D83CDF4B"] = "D83CDF4B"; _dict["D83CDF4C"] = "D83CDF4C"; _dict["D83CDF4D"] = "D83CDF4D"; _dict["D83CDF4E"] = "D83CDF4E"; _dict["D83CDF4F"] = "D83CDF4F"; _dict["D83CDF50"] = "D83CDF50"; _dict["D83CDF51"] = "D83CDF51"; _dict["D83CDF52"] = "D83CDF52"; _dict["D83CDF53"] = "D83CDF53"; _dict["D83CDF54"] = "D83CDF54"; _dict["D83CDF55"] = "D83CDF55"; _dict["D83CDF56"] = "D83CDF56"; _dict["D83CDF57"] = "D83CDF57"; _dict["D83CDF58"] = "D83CDF58"; _dict["D83CDF59"] = "D83CDF59"; _dict["D83CDF5A"] = "D83CDF5A"; _dict["D83CDF5B"] = "D83CDF5B"; _dict["D83CDF5C"] = "D83CDF5C"; _dict["D83CDF5D"] = "D83CDF5D"; _dict["D83CDF5E"] = "D83CDF5E"; _dict["D83CDF5F"] = "D83CDF5F"; _dict["D83CDF60"] = "D83CDF60"; _dict["D83CDF61"] = "D83CDF61"; _dict["D83CDF62"] = "D83CDF62"; _dict["D83CDF63"] = "D83CDF63"; _dict["D83CDF64"] = "D83CDF64"; _dict["D83CDF65"] = "D83CDF65"; _dict["D83CDF66"] = "D83CDF66"; _dict["D83CDF67"] = "D83CDF67"; _dict["D83CDF68"] = "D83CDF68"; _dict["D83CDF69"] = "D83CDF69"; _dict["D83CDF6A"] = "D83CDF6A"; _dict["D83CDF6B"] = "D83CDF6B"; _dict["D83CDF6C"] = "D83CDF6C"; _dict["D83CDF6D"] = "D83CDF6D"; _dict["D83CDF6E"] = "D83CDF6E"; _dict["D83CDF6F"] = "D83CDF6F"; _dict["D83CDF70"] = "D83CDF70"; _dict["D83CDF71"] = "D83CDF71"; _dict["D83CDF72"] = "D83CDF72"; _dict["D83CDF73"] = "D83CDF73"; _dict["D83CDF74"] = "D83CDF74"; _dict["D83CDF75"] = "D83CDF75"; _dict["D83CDF76"] = "D83CDF76"; _dict["D83CDF77"] = "D83CDF77"; _dict["D83CDF78"] = "D83CDF78"; _dict["D83CDF79"] = "D83CDF79"; _dict["D83CDF7A"] = "D83CDF7A"; _dict["D83CDF7B"] = "D83CDF7B"; _dict["D83CDF7C"] = "D83CDF7C"; _dict["D83CDF7D"] = "D83CDF7D"; _dict["D83CDF7E"] = "D83CDF7E"; _dict["D83CDF7F"] = "D83CDF7F"; _dict["D83CDF80"] = "D83CDF80"; _dict["D83CDF81"] = "D83CDF81"; _dict["D83CDF82"] = "D83CDF82"; _dict["D83CDF83"] = "D83CDF83"; _dict["D83CDF84"] = "D83CDF84"; _dict["D83CDF85"] = "D83CDF85"; _dict["D83CDF86"] = "D83CDF86"; _dict["D83CDF87"] = "D83CDF87"; _dict["D83CDF88"] = "D83CDF88"; _dict["D83CDF89"] = "D83CDF89"; _dict["D83CDF8A"] = "D83CDF8A"; _dict["D83CDF8B"] = "D83CDF8B"; _dict["D83CDF8C"] = "D83CDF8C"; _dict["D83CDF8D"] = "D83CDF8D"; _dict["D83CDF8E"] = "D83CDF8E"; _dict["D83CDF8F"] = "D83CDF8F"; _dict["D83CDF90"] = "D83CDF90"; _dict["D83CDF91"] = "D83CDF91"; _dict["D83CDF92"] = "D83CDF92"; _dict["D83CDF93"] = "D83CDF93"; _dict["D83CDF96"] = "D83CDF96"; _dict["D83CDF97"] = "D83CDF97"; _dict["D83CDF99"] = "D83CDF99"; _dict["D83CDF9A"] = "D83CDF9A"; _dict["D83CDF9B"] = "D83CDF9B"; _dict["D83CDF9E"] = "D83CDF9E"; _dict["D83CDF9F"] = "D83CDF9F"; _dict["D83CDFA0"] = "D83CDFA0"; _dict["D83CDFA1"] = "D83CDFA1"; _dict["D83CDFA2"] = "D83CDFA2"; _dict["D83CDFA3"] = "D83CDFA3"; _dict["D83CDFA4"] = "D83CDFA4"; _dict["D83CDFA5"] = "D83CDFA5"; _dict["D83CDFA6"] = "D83CDFA6"; _dict["D83CDFA7"] = "D83CDFA7"; _dict["D83CDFA8"] = "D83CDFA8"; _dict["D83CDFA9"] = "D83CDFA9"; _dict["D83CDFAA"] = "D83CDFAA"; _dict["D83CDFAB"] = "D83CDFAB"; _dict["D83CDFAC"] = "D83CDFAC"; _dict["D83CDFAD"] = "D83CDFAD"; _dict["D83CDFAE"] = "D83CDFAE"; _dict["D83CDFAF"] = "D83CDFAF"; _dict["D83CDFB0"] = "D83CDFB0"; _dict["D83CDFB1"] = "D83CDFB1"; _dict["D83CDFB2"] = "D83CDFB2"; _dict["D83CDFB3"] = "D83CDFB3"; _dict["D83CDFB4"] = "D83CDFB4"; _dict["D83CDFB5"] = "D83CDFB5"; _dict["D83CDFB6"] = "D83CDFB6"; _dict["D83CDFB7"] = "D83CDFB7"; _dict["D83CDFB8"] = "D83CDFB8"; _dict["D83CDFB9"] = "D83CDFB9"; _dict["D83CDFBA"] = "D83CDFBA"; _dict["D83CDFBB"] = "D83CDFBB"; _dict["D83CDFBC"] = "D83CDFBC"; _dict["D83CDFBD"] = "D83CDFBD"; _dict["D83CDFBE"] = "D83CDFBE"; _dict["D83CDFBF"] = "D83CDFBF"; _dict["D83CDFC0"] = "D83CDFC0"; _dict["D83CDFC1"] = "D83CDFC1"; _dict["D83CDFC2"] = "D83CDFC2"; _dict["D83CDFC5"] = "D83CDFC5"; _dict["D83CDFC6"] = "D83CDFC6"; _dict["D83CDFC8"] = "D83CDFC8"; _dict["D83CDFC9"] = "D83CDFC9"; _dict["D83CDFCD"] = "D83CDFCD"; _dict["D83CDFCE"] = "D83CDFCE"; _dict["D83CDFCF"] = "D83CDFCF"; _dict["D83CDFD0"] = "D83CDFD0"; _dict["D83CDFD1"] = "D83CDFD1"; _dict["D83CDFD2"] = "D83CDFD2"; _dict["D83CDFD3"] = "D83CDFD3"; _dict["D83CDFD4"] = "D83CDFD4"; _dict["D83CDFD5"] = "D83CDFD5"; _dict["D83CDFD6"] = "D83CDFD6"; _dict["D83CDFD7"] = "D83CDFD7"; _dict["D83CDFD8"] = "D83CDFD8"; _dict["D83CDFD9"] = "D83CDFD9"; _dict["D83CDFDA"] = "D83CDFDA"; _dict["D83CDFDB"] = "D83CDFDB"; _dict["D83CDFDC"] = "D83CDFDC"; _dict["D83CDFDD"] = "D83CDFDD"; _dict["D83CDFDE"] = "D83CDFDE"; _dict["D83CDFDF"] = "D83CDFDF"; _dict["D83CDFE0"] = "D83CDFE0"; _dict["D83CDFE1"] = "D83CDFE1"; _dict["D83CDFE2"] = "D83CDFE2"; _dict["D83CDFE3"] = "D83CDFE3"; _dict["D83CDFE4"] = "D83CDFE4"; _dict["D83CDFE5"] = "D83CDFE5"; _dict["D83CDFE6"] = "D83CDFE6"; _dict["D83CDFE7"] = "D83CDFE7"; _dict["D83CDFE8"] = "D83CDFE8"; _dict["D83CDFE9"] = "D83CDFE9"; _dict["D83CDFEA"] = "D83CDFEA"; _dict["D83CDFEB"] = "D83CDFEB"; _dict["D83CDFEC"] = "D83CDFEC"; _dict["D83CDFED"] = "D83CDFED"; _dict["D83CDFEE"] = "D83CDFEE"; _dict["D83CDFEF"] = "D83CDFEF"; _dict["D83CDFF0"] = "D83CDFF0"; _dict["D83CDFF3"] = "D83CDFF3"; _dict["D83CDFF4"] = "D83CDFF4"; _dict["D83CDFF5"] = "D83CDFF5"; _dict["D83CDFF7"] = "D83CDFF7"; _dict["D83CDFF8"] = "D83CDFF8"; _dict["D83CDFF9"] = "D83CDFF9"; _dict["D83CDFFA"] = "D83CDFFA"; _dict["D83DDC00"] = "D83DDC00"; _dict["D83DDC01"] = "D83DDC01"; _dict["D83DDC02"] = "D83DDC02"; _dict["D83DDC03"] = "D83DDC03"; _dict["D83DDC04"] = "D83DDC04"; _dict["D83DDC05"] = "D83DDC05"; _dict["D83DDC06"] = "D83DDC06"; _dict["D83DDC07"] = "D83DDC07"; _dict["D83DDC08"] = "D83DDC08"; _dict["D83DDC09"] = "D83DDC09"; _dict["D83DDC0A"] = "D83DDC0A"; _dict["D83DDC0B"] = "D83DDC0B"; _dict["D83DDC0C"] = "D83DDC0C"; _dict["D83DDC0D"] = "D83DDC0D"; _dict["D83DDC0E"] = "D83DDC0E"; _dict["D83DDC0F"] = "D83DDC0F"; _dict["D83DDC10"] = "D83DDC10"; _dict["D83DDC11"] = "D83DDC11"; _dict["D83DDC12"] = "D83DDC12"; _dict["D83DDC13"] = "D83DDC13"; _dict["D83DDC14"] = "D83DDC14"; _dict["D83DDC15"] = "D83DDC15"; _dict["D83DDC16"] = "D83DDC16"; _dict["D83DDC17"] = "D83DDC17"; _dict["D83DDC18"] = "D83DDC18"; _dict["D83DDC19"] = "D83DDC19"; _dict["D83DDC1A"] = "D83DDC1A"; _dict["D83DDC1B"] = "D83DDC1B"; _dict["D83DDC1C"] = "D83DDC1C"; _dict["D83DDC1D"] = "D83DDC1D"; _dict["D83DDC1E"] = "D83DDC1E"; _dict["D83DDC1F"] = "D83DDC1F"; _dict["D83DDC20"] = "D83DDC20"; _dict["D83DDC21"] = "D83DDC21"; _dict["D83DDC22"] = "D83DDC22"; _dict["D83DDC23"] = "D83DDC23"; _dict["D83DDC24"] = "D83DDC24"; _dict["D83DDC25"] = "D83DDC25"; _dict["D83DDC26"] = "D83DDC26"; _dict["D83DDC27"] = "D83DDC27"; _dict["D83DDC28"] = "D83DDC28"; _dict["D83DDC29"] = "D83DDC29"; _dict["D83DDC2A"] = "D83DDC2A"; _dict["D83DDC2B"] = "D83DDC2B"; _dict["D83DDC2C"] = "D83DDC2C"; _dict["D83DDC2D"] = "D83DDC2D"; _dict["D83DDC2E"] = "D83DDC2E"; _dict["D83DDC2F"] = "D83DDC2F"; _dict["D83DDC30"] = "D83DDC30"; _dict["D83DDC31"] = "D83DDC31"; _dict["D83DDC32"] = "D83DDC32"; _dict["D83DDC33"] = "D83DDC33"; _dict["D83DDC34"] = "D83DDC34"; _dict["D83DDC35"] = "D83DDC35"; _dict["D83DDC36"] = "D83DDC36"; _dict["D83DDC37"] = "D83DDC37"; _dict["D83DDC38"] = "D83DDC38"; _dict["D83DDC39"] = "D83DDC39"; _dict["D83DDC3A"] = "D83DDC3A"; _dict["D83DDC3B"] = "D83DDC3B"; _dict["D83DDC3C"] = "D83DDC3C"; _dict["D83DDC3D"] = "D83DDC3D"; _dict["D83DDC3E"] = "D83DDC3E"; _dict["D83DDC3F"] = "D83DDC3F"; _dict["D83DDC40"] = "D83DDC40"; _dict["D83DDC41"] = "D83DDC41"; _dict["D83DDC42"] = "D83DDC42"; _dict["D83DDC43"] = "D83DDC43"; _dict["D83DDC44"] = "D83DDC44"; _dict["D83DDC45"] = "D83DDC45"; _dict["D83DDC46"] = "D83DDC46"; _dict["D83DDC47"] = "D83DDC47"; _dict["D83DDC48"] = "D83DDC48"; _dict["D83DDC49"] = "D83DDC49"; _dict["D83DDC4A"] = "D83DDC4A"; _dict["D83DDC4B"] = "D83DDC4B"; _dict["D83DDC4C"] = "D83DDC4C"; _dict["D83DDC4D"] = "D83DDC4D"; _dict["D83DDC4E"] = "D83DDC4E"; //_dict["D83DDC4F"] = "D83DDC4F"; _dict["D83DDC50"] = "D83DDC50"; _dict["D83DDC51"] = "D83DDC51"; _dict["D83DDC52"] = "D83DDC52"; _dict["D83DDC53"] = "D83DDC53"; _dict["D83DDC54"] = "D83DDC54"; _dict["D83DDC55"] = "D83DDC55"; _dict["D83DDC56"] = "D83DDC56"; _dict["D83DDC57"] = "D83DDC57"; _dict["D83DDC58"] = "D83DDC58"; _dict["D83DDC59"] = "D83DDC59"; _dict["D83DDC5A"] = "D83DDC5A"; _dict["D83DDC5B"] = "D83DDC5B"; _dict["D83DDC5C"] = "D83DDC5C"; _dict["D83DDC5D"] = "D83DDC5D"; _dict["D83DDC5E"] = "D83DDC5E"; _dict["D83DDC5F"] = "D83DDC5F"; _dict["D83DDC60"] = "D83DDC60"; _dict["D83DDC61"] = "D83DDC61"; _dict["D83DDC62"] = "D83DDC62"; _dict["D83DDC63"] = "D83DDC63"; _dict["D83DDC64"] = "D83DDC64"; _dict["D83DDC65"] = "D83DDC65"; _dict["D83DDC66"] = "D83DDC66"; _dict["D83DDC67"] = "D83DDC67"; _dict["D83DDC68"] = "D83DDC68"; _dict["D83DDC6A"] = "D83DDC6A"; _dict["D83DDC6B"] = "D83DDC6B"; _dict["D83DDC6C"] = "D83DDC6C"; _dict["D83DDC6D"] = "D83DDC6D"; _dict["D83DDC6E"] = "D83DDC6E"; _dict["D83DDC6F"] = "D83DDC6F"; _dict["D83DDC70"] = "D83DDC70"; _dict["D83DDC72"] = "D83DDC72"; _dict["D83DDC74"] = "D83DDC74"; _dict["D83DDC75"] = "D83DDC75"; _dict["D83DDC76"] = "D83DDC76"; _dict["D83DDC78"] = "D83DDC78"; _dict["D83DDC79"] = "D83DDC79"; _dict["D83DDC7A"] = "D83DDC7A"; _dict["D83DDC7B"] = "D83DDC7B"; _dict["D83DDC7C"] = "D83DDC7C"; _dict["D83DDC7D"] = "D83DDC7D"; _dict["D83DDC7E"] = "D83DDC7E"; _dict["D83DDC7F"] = "D83DDC7F"; _dict["D83DDC80"] = "D83DDC80"; _dict["D83DDC83"] = "D83DDC83"; _dict["D83DDC84"] = "D83DDC84"; _dict["D83DDC85"] = "D83DDC85"; _dict["D83DDC88"] = "D83DDC88"; _dict["D83DDC89"] = "D83DDC89"; _dict["D83DDC8A"] = "D83DDC8A"; _dict["D83DDC8B"] = "D83DDC8B"; _dict["D83DDC8C"] = "D83DDC8C"; _dict["D83DDC8D"] = "D83DDC8D"; _dict["D83DDC8E"] = "D83DDC8E"; _dict["D83DDC8F"] = "D83DDC8F"; _dict["D83DDC90"] = "D83DDC90"; _dict["D83DDC91"] = "D83DDC91"; _dict["D83DDC92"] = "D83DDC92"; _dict["D83DDC93"] = "D83DDC93"; _dict["D83DDC94"] = "D83DDC94"; _dict["D83DDC95"] = "D83DDC95"; _dict["D83DDC96"] = "D83DDC96"; _dict["D83DDC97"] = "D83DDC97"; _dict["D83DDC98"] = "D83DDC98"; _dict["D83DDC99"] = "D83DDC99"; _dict["D83DDC9A"] = "D83DDC9A"; _dict["D83DDC9B"] = "D83DDC9B"; _dict["D83DDC9C"] = "D83DDC9C"; _dict["D83DDC9D"] = "D83DDC9D"; _dict["D83DDC9E"] = "D83DDC9E"; _dict["D83DDC9F"] = "D83DDC9F"; _dict["D83DDCA0"] = "D83DDCA0"; _dict["D83DDCA1"] = "D83DDCA1"; _dict["D83DDCA2"] = "D83DDCA2"; _dict["D83DDCA3"] = "D83DDCA3"; _dict["D83DDCA4"] = "D83DDCA4"; _dict["D83DDCA5"] = "D83DDCA5"; _dict["D83DDCA6"] = "D83DDCA6"; _dict["D83DDCA7"] = "D83DDCA7"; _dict["D83DDCA8"] = "D83DDCA8"; _dict["D83DDCA9"] = "D83DDCA9"; _dict["D83DDCAA"] = "D83DDCAA"; _dict["D83DDCAB"] = "D83DDCAB"; _dict["D83DDCAC"] = "D83DDCAC"; _dict["D83DDCAD"] = "D83DDCAD"; _dict["D83DDCAE"] = "D83DDCAE"; _dict["D83DDCAF"] = "D83DDCAF"; _dict["D83DDCB0"] = "D83DDCB0"; _dict["D83DDCB1"] = "D83DDCB1"; _dict["D83DDCB2"] = "D83DDCB2"; _dict["D83DDCB3"] = "D83DDCB3"; _dict["D83DDCB4"] = "D83DDCB4"; _dict["D83DDCB5"] = "D83DDCB5"; _dict["D83DDCB6"] = "D83DDCB6"; _dict["D83DDCB7"] = "D83DDCB7"; _dict["D83DDCB8"] = "D83DDCB8"; _dict["D83DDCB9"] = "D83DDCB9"; _dict["D83DDCBA"] = "D83DDCBA"; _dict["D83DDCBB"] = "D83DDCBB"; _dict["D83DDCBC"] = "D83DDCBC"; _dict["D83DDCBD"] = "D83DDCBD"; _dict["D83DDCBE"] = "D83DDCBE"; _dict["D83DDCBF"] = "D83DDCBF"; _dict["D83DDCC0"] = "D83DDCC0"; _dict["D83DDCC1"] = "D83DDCC1"; _dict["D83DDCC2"] = "D83DDCC2"; _dict["D83DDCC3"] = "D83DDCC3"; _dict["D83DDCC4"] = "D83DDCC4"; _dict["D83DDCC5"] = "D83DDCC5"; _dict["D83DDCC6"] = "D83DDCC6"; _dict["D83DDCC7"] = "D83DDCC7"; _dict["D83DDCC8"] = "D83DDCC8"; _dict["D83DDCC9"] = "D83DDCC9"; _dict["D83DDCCA"] = "D83DDCCA"; _dict["D83DDCCB"] = "D83DDCCB"; _dict["D83DDCCC"] = "D83DDCCC"; _dict["D83DDCCD"] = "D83DDCCD"; _dict["D83DDCCE"] = "D83DDCCE"; _dict["D83DDCCF"] = "D83DDCCF"; _dict["D83DDCD0"] = "D83DDCD0"; _dict["D83DDCD1"] = "D83DDCD1"; _dict["D83DDCD2"] = "D83DDCD2"; _dict["D83DDCD3"] = "D83DDCD3"; _dict["D83DDCD4"] = "D83DDCD4"; _dict["D83DDCD5"] = "D83DDCD5"; _dict["D83DDCD6"] = "D83DDCD6"; _dict["D83DDCD7"] = "D83DDCD7"; _dict["D83DDCD8"] = "D83DDCD8"; _dict["D83DDCD9"] = "D83DDCD9"; _dict["D83DDCDA"] = "D83DDCDA"; _dict["D83DDCDB"] = "D83DDCDB"; _dict["D83DDCDC"] = "D83DDCDC"; _dict["D83DDCDD"] = "D83DDCDD"; _dict["D83DDCDE"] = "D83DDCDE"; _dict["D83DDCDF"] = "D83DDCDF"; _dict["D83DDCE0"] = "D83DDCE0"; _dict["D83DDCE1"] = "D83DDCE1"; _dict["D83DDCE2"] = "D83DDCE2"; _dict["D83DDCE3"] = "D83DDCE3"; _dict["D83DDCE4"] = "D83DDCE4"; _dict["D83DDCE5"] = "D83DDCE5"; _dict["D83DDCE6"] = "D83DDCE6"; _dict["D83DDCE7"] = "D83DDCE7"; _dict["D83DDCE8"] = "D83DDCE8"; _dict["D83DDCE9"] = "D83DDCE9"; _dict["D83DDCEA"] = "D83DDCEA"; _dict["D83DDCEB"] = "D83DDCEB"; _dict["D83DDCEC"] = "D83DDCEC"; _dict["D83DDCED"] = "D83DDCED"; _dict["D83DDCEE"] = "D83DDCEE"; _dict["D83DDCEF"] = "D83DDCEF"; _dict["D83DDCF0"] = "D83DDCF0"; _dict["D83DDCF1"] = "D83DDCF1"; _dict["D83DDCF2"] = "D83DDCF2"; _dict["D83DDCF3"] = "D83DDCF3"; _dict["D83DDCF4"] = "D83DDCF4"; _dict["D83DDCF5"] = "D83DDCF5"; _dict["D83DDCF6"] = "D83DDCF6"; _dict["D83DDCF7"] = "D83DDCF7"; _dict["D83DDCF8"] = "D83DDCF8"; _dict["D83DDCF9"] = "D83DDCF9"; _dict["D83DDCFA"] = "D83DDCFA"; _dict["D83DDCFB"] = "D83DDCFB"; _dict["D83DDCFC"] = "D83DDCFC"; _dict["D83DDCFD"] = "D83DDCFD"; _dict["D83DDCFF"] = "D83DDCFF"; _dict["D83DDD00"] = "D83DDD00"; _dict["D83DDD01"] = "D83DDD01"; _dict["D83DDD02"] = "D83DDD02"; _dict["D83DDD03"] = "D83DDD03"; _dict["D83DDD04"] = "D83DDD04"; _dict["D83DDD05"] = "D83DDD05"; _dict["D83DDD06"] = "D83DDD06"; _dict["D83DDD07"] = "D83DDD07"; _dict["D83DDD08"] = "D83DDD08"; _dict["D83DDD09"] = "D83DDD09"; _dict["D83DDD0A"] = "D83DDD0A"; _dict["D83DDD0B"] = "D83DDD0B"; _dict["D83DDD0C"] = "D83DDD0C"; _dict["D83DDD0D"] = "D83DDD0D"; _dict["D83DDD0E"] = "D83DDD0E"; _dict["D83DDD0F"] = "D83DDD0F"; _dict["D83DDD10"] = "D83DDD10"; _dict["D83DDD11"] = "D83DDD11"; _dict["D83DDD12"] = "D83DDD12"; _dict["D83DDD13"] = "D83DDD13"; _dict["D83DDD14"] = "D83DDD14"; _dict["D83DDD15"] = "D83DDD15"; _dict["D83DDD16"] = "D83DDD16"; _dict["D83DDD17"] = "D83DDD17"; _dict["D83DDD18"] = "D83DDD18"; _dict["D83DDD19"] = "D83DDD19"; _dict["D83DDD1A"] = "D83DDD1A"; _dict["D83DDD1B"] = "D83DDD1B"; _dict["D83DDD1C"] = "D83DDD1C"; _dict["D83DDD1D"] = "D83DDD1D"; _dict["D83DDD1E"] = "D83DDD1E"; _dict["D83DDD1F"] = "D83DDD1F"; _dict["D83DDD20"] = "D83DDD20"; _dict["D83DDD21"] = "D83DDD21"; _dict["D83DDD22"] = "D83DDD22"; _dict["D83DDD23"] = "D83DDD23"; _dict["D83DDD24"] = "D83DDD24"; _dict["D83DDD25"] = "D83DDD25"; _dict["D83DDD27"] = "D83DDD27"; _dict["D83DDD28"] = "D83DDD28"; _dict["D83DDD29"] = "D83DDD29"; _dict["D83DDD2A"] = "D83DDD2A"; _dict["D83DDD2B"] = "D83DDD2B"; _dict["D83DDD2C"] = "D83DDD2C"; _dict["D83DDD2D"] = "D83DDD2D"; _dict["D83DDD2E"] = "D83DDD2E"; _dict["D83DDD2F"] = "D83DDD2F"; _dict["D83DDD30"] = "D83DDD30"; _dict["D83DDD31"] = "D83DDD31"; _dict["D83DDD32"] = "D83DDD32"; _dict["D83DDD33"] = "D83DDD33"; _dict["D83DDD34"] = "D83DDD34"; _dict["D83DDD35"] = "D83DDD35"; _dict["D83DDD36"] = "D83DDD36"; _dict["D83DDD37"] = "D83DDD37"; _dict["D83DDD38"] = "D83DDD38"; _dict["D83DDD39"] = "D83DDD39"; _dict["D83DDD3A"] = "D83DDD3A"; _dict["D83DDD3B"] = "D83DDD3B"; _dict["D83DDD3C"] = "D83DDD3C"; _dict["D83DDD3D"] = "D83DDD3D"; _dict["D83DDD49"] = "D83DDD49"; _dict["D83DDD4A"] = "D83DDD4A"; _dict["D83DDD4B"] = "D83DDD4B"; _dict["D83DDD4C"] = "D83DDD4C"; _dict["D83DDD4D"] = "D83DDD4D"; _dict["D83DDD4E"] = "D83DDD4E"; _dict["D83DDD50"] = "D83DDD50"; _dict["D83DDD51"] = "D83DDD51"; _dict["D83DDD52"] = "D83DDD52"; _dict["D83DDD53"] = "D83DDD53"; _dict["D83DDD54"] = "D83DDD54"; _dict["D83DDD55"] = "D83DDD55"; _dict["D83DDD56"] = "D83DDD56"; _dict["D83DDD57"] = "D83DDD57"; _dict["D83DDD58"] = "D83DDD58"; _dict["D83DDD59"] = "D83DDD59"; _dict["D83DDD5A"] = "D83DDD5A"; _dict["D83DDD5B"] = "D83DDD5B"; _dict["D83DDD5C"] = "D83DDD5C"; _dict["D83DDD5D"] = "D83DDD5D"; _dict["D83DDD5E"] = "D83DDD5E"; _dict["D83DDD5F"] = "D83DDD5F"; _dict["D83DDD60"] = "D83DDD60"; _dict["D83DDD61"] = "D83DDD61"; _dict["D83DDD62"] = "D83DDD62"; _dict["D83DDD63"] = "D83DDD63"; _dict["D83DDD64"] = "D83DDD64"; _dict["D83DDD65"] = "D83DDD65"; _dict["D83DDD66"] = "D83DDD66"; _dict["D83DDD67"] = "D83DDD67"; _dict["D83DDD6F"] = "D83DDD6F"; _dict["D83DDD70"] = "D83DDD70"; _dict["D83DDD73"] = "D83DDD73"; _dict["D83DDD76"] = "D83DDD76"; _dict["D83DDD77"] = "D83DDD77"; _dict["D83DDD78"] = "D83DDD78"; _dict["D83DDD79"] = "D83DDD79"; _dict["D83DDD87"] = "D83DDD87"; _dict["D83DDD8A"] = "D83DDD8A"; _dict["D83DDD8B"] = "D83DDD8B"; _dict["D83DDD8C"] = "D83DDD8C"; _dict["D83DDD8D"] = "D83DDD8D"; _dict["D83DDDA4"] = "D83DDDA4"; _dict["D83DDDA5"] = "D83DDDA5"; _dict["D83DDDA8"] = "D83DDDA8"; _dict["D83DDDB1"] = "D83DDDB1"; _dict["D83DDDB2"] = "D83DDDB2"; _dict["D83DDDBC"] = "D83DDDBC"; _dict["D83DDDC2"] = "D83DDDC2"; _dict["D83DDDC3"] = "D83DDDC3"; _dict["D83DDDC4"] = "D83DDDC4"; _dict["D83DDDD1"] = "D83DDDD1"; _dict["D83DDDD2"] = "D83DDDD2"; _dict["D83DDDD3"] = "D83DDDD3"; _dict["D83DDDDC"] = "D83DDDDC"; _dict["D83DDDDD"] = "D83DDDDD"; _dict["D83DDDDE"] = "D83DDDDE"; _dict["D83DDDE1"] = "D83DDDE1"; _dict["D83DDDE3"] = "D83DDDE3"; _dict["D83DDDE8"] = "D83DDDE8"; _dict["D83DDDEF"] = "D83DDDEF"; _dict["D83DDDF3"] = "D83DDDF3"; _dict["D83DDDFA"] = "D83DDDFA"; _dict["D83DDDFB"] = "D83DDDFB"; _dict["D83DDDFC"] = "D83DDDFC"; _dict["D83DDDFD"] = "D83DDDFD"; _dict["D83DDDFE"] = "D83DDDFE"; _dict["D83DDDFF"] = "D83DDDFF"; _dict["D83DDE00"] = "D83DDE00"; _dict["D83DDE01"] = "D83DDE01"; _dict["D83DDE02"] = "D83DDE02"; _dict["D83DDE03"] = "D83DDE03"; _dict["D83DDE04"] = "D83DDE04"; _dict["D83DDE05"] = "D83DDE05"; _dict["D83DDE06"] = "D83DDE06"; _dict["D83DDE07"] = "D83DDE07"; _dict["D83DDE08"] = "D83DDE08"; _dict["D83DDE09"] = "D83DDE09"; _dict["D83DDE0A"] = "D83DDE0A"; _dict["D83DDE0B"] = "D83DDE0B"; _dict["D83DDE0C"] = "D83DDE0C"; _dict["D83DDE0D"] = "D83DDE0D"; _dict["D83DDE0E"] = "D83DDE0E"; _dict["D83DDE0F"] = "D83DDE0F"; _dict["D83DDE10"] = "D83DDE10"; _dict["D83DDE11"] = "D83DDE11"; _dict["D83DDE12"] = "D83DDE12"; _dict["D83DDE13"] = "D83DDE13"; _dict["D83DDE14"] = "D83DDE14"; _dict["D83DDE15"] = "D83DDE15"; _dict["D83DDE16"] = "D83DDE16"; _dict["D83DDE17"] = "D83DDE17"; _dict["D83DDE18"] = "D83DDE18"; _dict["D83DDE19"] = "D83DDE19"; _dict["D83DDE1A"] = "D83DDE1A"; _dict["D83DDE1B"] = "D83DDE1B"; _dict["D83DDE1C"] = "D83DDE1C"; _dict["D83DDE1D"] = "D83DDE1D"; _dict["D83DDE1E"] = "D83DDE1E"; _dict["D83DDE1F"] = "D83DDE1F"; _dict["D83DDE20"] = "D83DDE20"; _dict["D83DDE21"] = "D83DDE21"; _dict["D83DDE22"] = "D83DDE22"; _dict["D83DDE23"] = "D83DDE23"; _dict["D83DDE24"] = "D83DDE24"; _dict["D83DDE25"] = "D83DDE25"; _dict["D83DDE26"] = "D83DDE26"; _dict["D83DDE27"] = "D83DDE27"; _dict["D83DDE28"] = "D83DDE28"; _dict["D83DDE29"] = "D83DDE29"; _dict["D83DDE2A"] = "D83DDE2A"; _dict["D83DDE2B"] = "D83DDE2B"; _dict["D83DDE2C"] = "D83DDE2C"; _dict["D83DDE2D"] = "D83DDE2D"; _dict["D83DDE2E"] = "D83DDE2E"; _dict["D83DDE2F"] = "D83DDE2F"; _dict["D83DDE30"] = "D83DDE30"; _dict["D83DDE31"] = "D83DDE31"; _dict["D83DDE32"] = "D83DDE32"; _dict["D83DDE33"] = "D83DDE33"; _dict["D83DDE34"] = "D83DDE34"; _dict["D83DDE35"] = "D83DDE35"; _dict["D83DDE36"] = "D83DDE36"; _dict["D83DDE37"] = "D83DDE37"; _dict["D83DDE38"] = "D83DDE38"; _dict["D83DDE39"] = "D83DDE39"; _dict["D83DDE3A"] = "D83DDE3A"; _dict["D83DDE3B"] = "D83DDE3B"; _dict["D83DDE3C"] = "D83DDE3C"; _dict["D83DDE3D"] = "D83DDE3D"; _dict["D83DDE3E"] = "D83DDE3E"; _dict["D83DDE3F"] = "D83DDE3F"; _dict["D83DDE40"] = "D83DDE40"; _dict["D83DDE41"] = "D83DDE41"; _dict["D83DDE42"] = "D83DDE42"; _dict["D83DDE43"] = "D83DDE43"; _dict["D83DDE44"] = "D83DDE44"; _dict["D83DDE47"] = "D83DDE47"; _dict["D83DDE48"] = "D83DDE48"; _dict["D83DDE49"] = "D83DDE49"; _dict["D83DDE4A"] = "D83DDE4A"; _dict["D83DDE4F"] = "D83DDE4F"; _dict["D83DDE80"] = "D83DDE80"; _dict["D83DDE81"] = "D83DDE81"; _dict["D83DDE82"] = "D83DDE82"; _dict["D83DDE83"] = "D83DDE83"; _dict["D83DDE84"] = "D83DDE84"; _dict["D83DDE85"] = "D83DDE85"; _dict["D83DDE86"] = "D83DDE86"; _dict["D83DDE87"] = "D83DDE87"; _dict["D83DDE88"] = "D83DDE88"; _dict["D83DDE89"] = "D83DDE89"; _dict["D83DDE8A"] = "D83DDE8A"; _dict["D83DDE8B"] = "D83DDE8B"; _dict["D83DDE8C"] = "D83DDE8C"; _dict["D83DDE8D"] = "D83DDE8D"; _dict["D83DDE8E"] = "D83DDE8E"; _dict["D83DDE8F"] = "D83DDE8F"; _dict["D83DDE90"] = "D83DDE90"; _dict["D83DDE91"] = "D83DDE91"; _dict["D83DDE92"] = "D83DDE92"; _dict["D83DDE93"] = "D83DDE93"; _dict["D83DDE94"] = "D83DDE94"; _dict["D83DDE95"] = "D83DDE95"; _dict["D83DDE96"] = "D83DDE96"; _dict["D83DDE97"] = "D83DDE97"; _dict["D83DDE98"] = "D83DDE98"; _dict["D83DDE99"] = "D83DDE99"; _dict["D83DDE9A"] = "D83DDE9A"; _dict["D83DDE9B"] = "D83DDE9B"; _dict["D83DDE9C"] = "D83DDE9C"; _dict["D83DDE9D"] = "D83DDE9D"; _dict["D83DDE9E"] = "D83DDE9E"; _dict["D83DDE9F"] = "D83DDE9F"; _dict["D83DDEA0"] = "D83DDEA0"; _dict["D83DDEA1"] = "D83DDEA1"; _dict["D83DDEA2"] = "D83DDEA2"; _dict["D83DDEA4"] = "D83DDEA4"; _dict["D83DDEA5"] = "D83DDEA5"; _dict["D83DDEA6"] = "D83DDEA6"; _dict["D83DDEA7"] = "D83DDEA7"; _dict["D83DDEA8"] = "D83DDEA8"; _dict["D83DDEA9"] = "D83DDEA9"; _dict["D83DDEAA"] = "D83DDEAA"; _dict["D83DDEAB"] = "D83DDEAB"; _dict["D83DDEAC"] = "D83DDEAC"; _dict["D83DDEAD"] = "D83DDEAD"; _dict["D83DDEAE"] = "D83DDEAE"; _dict["D83DDEAF"] = "D83DDEAF"; _dict["D83DDEB0"] = "D83DDEB0"; _dict["D83DDEB1"] = "D83DDEB1"; _dict["D83DDEB2"] = "D83DDEB2"; _dict["D83DDEB3"] = "D83DDEB3"; _dict["D83DDEB7"] = "D83DDEB7"; _dict["D83DDEB8"] = "D83DDEB8"; _dict["D83DDEB9"] = "D83DDEB9"; _dict["D83DDEBA"] = "D83DDEBA"; _dict["D83DDEBB"] = "D83DDEBB"; _dict["D83DDEBC"] = "D83DDEBC"; _dict["D83DDEBD"] = "D83DDEBD"; _dict["D83DDEBE"] = "D83DDEBE"; _dict["D83DDEBF"] = "D83DDEBF"; _dict["D83DDEC0"] = "D83DDEC0"; _dict["D83DDEC1"] = "D83DDEC1"; _dict["D83DDEC2"] = "D83DDEC2"; _dict["D83DDEC3"] = "D83DDEC3"; _dict["D83DDEC4"] = "D83DDEC4"; _dict["D83DDEC5"] = "D83DDEC5"; _dict["D83DDECB"] = "D83DDECB"; _dict["D83DDECC"] = "D83DDECC"; _dict["D83DDECD"] = "D83DDECD"; _dict["D83DDECE"] = "D83DDECE"; _dict["D83DDECF"] = "D83DDECF"; _dict["D83DDED0"] = "D83DDED0"; _dict["D83DDED1"] = "D83DDED1"; _dict["D83DDED2"] = "D83DDED2"; _dict["D83DDEE0"] = "D83DDEE0"; _dict["D83DDEE1"] = "D83DDEE1"; _dict["D83DDEE2"] = "D83DDEE2"; _dict["D83DDEE3"] = "D83DDEE3"; _dict["D83DDEE4"] = "D83DDEE4"; _dict["D83DDEE5"] = "D83DDEE5"; _dict["D83DDEE9"] = "D83DDEE9"; _dict["D83DDEEB"] = "D83DDEEB"; _dict["D83DDEEC"] = "D83DDEEC"; _dict["D83DDEF0"] = "D83DDEF0"; _dict["D83DDEF3"] = "D83DDEF3"; _dict["D83DDEF4"] = "D83DDEF4"; _dict["D83DDEF5"] = "D83DDEF5"; _dict["D83DDEF6"] = "D83DDEF6"; _dict["D83EDD10"] = "D83EDD10"; _dict["D83EDD11"] = "D83EDD11"; _dict["D83EDD12"] = "D83EDD12"; _dict["D83EDD13"] = "D83EDD13"; _dict["D83EDD14"] = "D83EDD14"; _dict["D83EDD15"] = "D83EDD15"; _dict["D83EDD16"] = "D83EDD16"; _dict["D83EDD17"] = "D83EDD17"; _dict["D83EDD18"] = "D83EDD18"; _dict["D83EDD1D"] = "D83EDD1D"; _dict["D83EDD20"] = "D83EDD20"; _dict["D83EDD21"] = "D83EDD21"; _dict["D83EDD22"] = "D83EDD22"; _dict["D83EDD23"] = "D83EDD23"; _dict["D83EDD24"] = "D83EDD24"; _dict["D83EDD25"] = "D83EDD25"; _dict["D83EDD27"] = "D83EDD27"; _dict["D83EDD33"] = "D83EDD33"; _dict["D83EDD35"] = "D83EDD35"; _dict["D83EDD3A"] = "D83EDD3A"; _dict["D83EDD40"] = "D83EDD40"; _dict["D83EDD41"] = "D83EDD41"; _dict["D83EDD42"] = "D83EDD42"; _dict["D83EDD43"] = "D83EDD43"; _dict["D83EDD44"] = "D83EDD44"; _dict["D83EDD45"] = "D83EDD45"; _dict["D83EDD47"] = "D83EDD47"; _dict["D83EDD48"] = "D83EDD48"; _dict["D83EDD49"] = "D83EDD49"; _dict["D83EDD4A"] = "D83EDD4A"; _dict["D83EDD4B"] = "D83EDD4B"; _dict["D83EDD50"] = "D83EDD50"; _dict["D83EDD51"] = "D83EDD51"; _dict["D83EDD52"] = "D83EDD52"; _dict["D83EDD53"] = "D83EDD53"; _dict["D83EDD54"] = "D83EDD54"; _dict["D83EDD55"] = "D83EDD55"; _dict["D83EDD56"] = "D83EDD56"; _dict["D83EDD57"] = "D83EDD57"; _dict["D83EDD58"] = "D83EDD58"; _dict["D83EDD59"] = "D83EDD59"; _dict["D83EDD5A"] = "D83EDD5A"; _dict["D83EDD5B"] = "D83EDD5B"; _dict["D83EDD5C"] = "D83EDD5C"; _dict["D83EDD5D"] = "D83EDD5D"; _dict["D83EDD5E"] = "D83EDD5E"; _dict["D83EDD80"] = "D83EDD80"; _dict["D83EDD81"] = "D83EDD81"; _dict["D83EDD82"] = "D83EDD82"; _dict["D83EDD83"] = "D83EDD83"; _dict["D83EDD84"] = "D83EDD84"; _dict["D83EDD85"] = "D83EDD85"; _dict["D83EDD86"] = "D83EDD86"; _dict["D83EDD87"] = "D83EDD87"; _dict["D83EDD88"] = "D83EDD88"; _dict["D83EDD89"] = "D83EDD89"; _dict["D83EDD8A"] = "D83EDD8A"; _dict["D83EDD8B"] = "D83EDD8B"; _dict["D83EDD8C"] = "D83EDD8C"; _dict["D83EDD8D"] = "D83EDD8D"; _dict["D83EDD8E"] = "D83EDD8E"; _dict["D83EDD8F"] = "D83EDD8F"; _dict["D83EDD90"] = "D83EDD90"; _dict["D83EDD91"] = "D83EDD91"; _dict["D83EDDC0"] = "D83EDDC0"; _dict["2639"] = "2639FE0F"; _dict["263AFE0F"] = "263A"; _dict["26AAFE0F"] = "26AA"; _dict["26ABFE0F"] = "26AB"; _dict["25AAFE0F"] = "25AA"; _dict["25ABFE0F"] = "25AB"; _dict["2B1BFE0F"] = "2B1B"; _dict["2B1CFE0F"] = "2B1C"; _dict["25FBFE0F"] = "25FB"; _dict["25FCFE0F"] = "25FC"; _dict["25FDFE0F"] = "25FD"; _dict["25FEFE0F"] = "25FE"; _dict["25B6FE0F"] = "25B6"; _dict["0023FE0F20E3"] = "002320E3"; _dict["002AFE0F20E3"] = "002A20E3"; _dict["0030FE0F20E3"] = "003020E3"; _dict["0031FE0F20E3"] = "003120E3"; _dict["0032FE0F20E3"] = "003220E3"; _dict["0033FE0F20E3"] = "003320E3"; _dict["0034FE0F20E3"] = "003420E3"; _dict["0035FE0F20E3"] = "003520E3"; _dict["0036FE0F20E3"] = "003620E3"; _dict["0037FE0F20E3"] = "003720E3"; _dict["0038FE0F20E3"] = "003820E3"; _dict["0039FE0F20E3"] = "003920E3"; } } public static class BrowserNavigationService { private static double _fontScaleFactor = 1.0; public static double FontScaleFactor { get { return _fontScaleFactor; } set { _fontScaleFactor = value; } } // http://daringfireball.net/2010/07/improved_regex_for_matching_urls //private static readonly Regex RE_URL = new Regex(@"(?i)\b(((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»“”‘’]))|([a-z0-9.\-]+(\.ru|\.com|\.net|\.org|\.us|\.it|\.co\.uk)(?![a-z0-9]))|([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]*[a-zA-Z0-9-]+))"); //public static readonly Regex UserMentionRegex = new Regex(@"\[id\d+.*?\|.*?\]"); //public static readonly Regex GroupMentionRegex = new Regex(@"\[club\d+.*?\|.*?\]"); public static readonly DependencyProperty AddFooterProperty = DependencyProperty.RegisterAttached( "AddFooter", typeof(bool), typeof(BrowserNavigationService), new PropertyMetadata(default(bool))); public static void SetAddFooter(DependencyObject element, bool value) { element.SetValue(AddFooterProperty, value); } public static bool GetAddFooter(DependencyObject element) { return (bool)element.GetValue(AddFooterProperty); } public static readonly DependencyProperty SuppressParsingProperty = DependencyProperty.RegisterAttached( "SuppressParsing", typeof(bool), typeof(BrowserNavigationService), new PropertyMetadata(default(bool))); public static void SetSuppressParsing(DependencyObject element, bool value) { element.SetValue(SuppressParsingProperty, value); } public static bool GetSuppressParsing(DependencyObject element) { return (bool)element.GetValue(SuppressParsingProperty); } public static readonly DependencyProperty MediaProperty = DependencyProperty.RegisterAttached( "Media", typeof(TLMessageMediaBase), typeof(BrowserNavigationService), new PropertyMetadata(default(TLMessageMediaBase))); public static void SetMedia(DependencyObject element, TLMessageMediaBase value) { element.SetValue(MediaProperty, value); } public static TLMessageMediaBase GetMedia(DependencyObject element) { return (TLMessageMediaBase)element.GetValue(MediaProperty); } public static readonly DependencyProperty MessageProperty = DependencyProperty.RegisterAttached( "Message", typeof(TLMessageBase), typeof(BrowserNavigationService), new PropertyMetadata(default(TLMessageBase))); public static void SetMessage(DependencyObject element, TLMessageBase value) { element.SetValue(MessageProperty, value); } public static TLMessageBase GetMessage(DependencyObject element) { return (TLMessageBase)element.GetValue(MessageProperty); } public static readonly DependencyProperty DecryptedMessageProperty = DependencyProperty.RegisterAttached( "DecryptedMessage", typeof(TLDecryptedMessageBase), typeof(BrowserNavigationService), new PropertyMetadata(default(TLDecryptedMessageBase))); public static void SetDecryptedMessage(DependencyObject element, TLDecryptedMessageBase value) { element.SetValue(DecryptedMessageProperty, value); } public static TLDecryptedMessageBase GetDecryptedMessage(DependencyObject element) { return (TLDecryptedMessageBase)element.GetValue(DecryptedMessageProperty); } public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached( "Text", typeof(string), typeof(BrowserNavigationService), new PropertyMetadata(null, OnTextChanged) ); public static string GetText(DependencyObject d) { return d.GetValue(TextProperty) as string; } public static void SetText(DependencyObject d, string value) { d.SetValue(TextProperty, value); } public static event EventHandler TelegramLinkAction; private static void RaiseTelegramLinkAction(TelegramEventArgs e) { var handler = TelegramLinkAction; if (handler != null) handler(null, e); } public static event EventHandler SearchHashtag; private static void RaiseSearchHashtag(TelegramHashtagEventArgs e) { var handler = SearchHashtag; if (handler != null) handler(null, e); } public static event EventHandler InvokeCommand; private static void RaiseInvokeCommand(TelegramCommandEventArgs e) { var handler = InvokeCommand; if (handler != null) handler(null, e); } public static event EventHandler OpenGame; private static void RaiseOpenGame(TelegramGameEventArgs e) { var handler = OpenGame; if (handler != null) handler(null, e); } public static event EventHandler MentionNavigated; private static void RaiseMentionNavigated(TelegramMentionEventArgs e) { var handler = MentionNavigated; if (handler != null) handler(null, e); } public static event EventHandler OpenPhone; private static void RaiseOpenPhone(TelegramPhoneEventArgs e) { var handler = OpenPhone; if (handler != null) handler(null, e); } public static Hyperlink GetHyperlink(string text, string link, Action action, Brush foreground) { var hyperlink = new Hyperlink { TextDecorations = null, MouseOverTextDecorations = null }; if (foreground != null) { hyperlink.Foreground = foreground; hyperlink.MouseOverForeground = foreground; } else { hyperlink.ClearValue(Hyperlink.ForegroundProperty); hyperlink.ClearValue(Hyperlink.MouseOverForegroundProperty); } hyperlink.Inlines.Add(new Run { Text = text }); Uri uri = null; try { uri = new Uri(link, UriKind.RelativeOrAbsolute); } catch (Exception ex) { } hyperlink.NavigateUri = uri; hyperlink.Click += (sender, args) => { var result = MessageBoxResult.OK; if (!link.StartsWith("tlg://") && !string.Equals(text, link, StringComparison.OrdinalIgnoreCase) && !string.Equals("http://" + text, link, StringComparison.OrdinalIgnoreCase)) { result = MessageBox.Show(string.Format(AppResources.OpenUrlConfirmation, link), AppResources.Confirm, MessageBoxButton.OKCancel); } if (result == MessageBoxResult.OK) { action(hyperlink, link); } }; return hyperlink; } private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = d as RichTextBox; if (textBox == null) return; var message = GetMessage(textBox); var decryptedMessage = GetDecryptedMessage(textBox); var media = GetMedia(textBox); var addFooter = GetAddFooter(textBox); textBox.Blocks.Clear(); var paragraph = new Paragraph(); var newText = (string)e.NewValue; if (string.IsNullOrEmpty(newText)) return; //newText = newText + " "; var suppressParsing = GetSuppressParsing(textBox); List splitData; var message34 = message as TLMessage34; var decryptedMessage45 = decryptedMessage as TLDecryptedMessage45; if (message34 != null && message34.Entities != null) { splitData = GetSplitData(newText, message34.Entities); } else if (decryptedMessage45 != null && decryptedMessage45.Entities != null) { splitData = GetSplitData(newText, decryptedMessage45.Entities); } else { splitData = suppressParsing ? new List { newText } : ParseText(newText); } foreach (var splStr in splitData) { var innerSplit = splStr.Split('\b'); if (innerSplit.Length == 1) { AddRawText(textBox, paragraph, innerSplit[0], textBox.FontStyle, textBox.FontWeight, textBox.FontFamily); } else if (innerSplit.Length > 1) { if (string.Equals(innerSplit[0], "pre")) { AddRawText(textBox, paragraph, innerSplit[1], textBox.FontStyle, textBox.FontWeight, new FontFamily("Courier New")); } else if (string.Equals(innerSplit[0], "code")) { AddRawText(textBox, paragraph, innerSplit[1], textBox.FontStyle, textBox.FontWeight, new FontFamily("Courier New")); } else if (string.Equals(innerSplit[0], "italic")) { AddRawText(textBox, paragraph, innerSplit[1], FontStyles.Italic, textBox.FontWeight, textBox.FontFamily); } else if (string.Equals(innerSplit[0], "bold")) { AddRawText(textBox, paragraph, innerSplit[1], textBox.FontStyle, FontWeights.SemiBold, textBox.FontFamily); } else if (suppressParsing) { AddRawText(textBox, paragraph, innerSplit[0], textBox.FontStyle, textBox.FontWeight, textBox.FontFamily); } else { var hyperlinkForeground = (message is TLMessage || decryptedMessage is TLDecryptedMessage) ? (Brush)Application.Current.Resources["TelegramTextAccentBrush"] : null;//textBox.Foreground;//null; var hyp = GetHyperlink(innerSplit[1], innerSplit[0], (h, navstr) => NavigateOnHyperlink(navstr, textBox), hyperlinkForeground); paragraph.Inlines.Add(hyp); } } } if (addFooter) { var footerRun = new Run { Foreground = #if DEBUG new SolidColorBrush(Colors.Transparent) #else new SolidColorBrush(Colors.Transparent) #endif }; paragraph.Inlines.Add(footerRun); textBox.Tag = footerRun; } // var message48 = message as TLMessage48; // if (!string.IsNullOrEmpty(footerText) // && message48 != null // && (message48.Media == null || message48.Media is TLMessageMediaEmpty)) // { // var footerBuilder = new StringBuilder(); // footerBuilder.Append(" "); // if (GetIsChannelMessage(textBox) // && message48.AuthorVisibility == Visibility.Visible // && message48.Author != null) // { // footerBuilder.Append(string.Format("{0} ", message48.Author.FullName2)); // } // if (message48.ViewsVisibility == Visibility.Visible) // { // footerBuilder.Append(string.Format("vc {0}, ", new MessageViewsConverter().Convert(message48.Views, null, null, null))); // } // footerBuilder.Append("/ " + footerText + " W"); // var dateRun = new Run { FontSize= footerFontSize, Text = footerBuilder.ToString(), Foreground = //#if DEBUG // new SolidColorBrush(Colors.Red) //#else // new SolidColorBrush(Colors.Transparent) //#endif // }; // paragraph.Inlines.Add(dateRun); // } textBox.Blocks.Add(paragraph); } private static List GetSplitData(string newText, TLVector entities) { var splitData = new List(); var position = 0; var length = 0; var possibleLength = 0; string subString; for (var i = 0; i < entities.Count; i++) { if (entities[i].Offset.Value > position) { possibleLength = entities[i].Offset.Value - position; length = (position + possibleLength) > newText.Length ? newText.Length - position : possibleLength; subString = newText.Substring(position, length); splitData.Add(subString); position += length; } possibleLength = entities[i].Length.Value; length = (position + possibleLength) > newText.Length ? newText.Length - position : possibleLength; subString = newText.Substring(position, length); splitData.Add(GetSplitItem(entities[i], subString)); position += length; } if (position < newText.Length) { possibleLength = newText.Length - position; length = (position + possibleLength) > newText.Length ? newText.Length - position : possibleLength; subString = newText.Substring(position, length); splitData.Add(subString); position += length; } return splitData; } private static string GetSplitItem(TLMessageEntityBase entity, string text) { if (entity is TLInputMessageEntityMentionName) { return string.Format("tlg://?action=profile&{1}\b{0}", text, ((TLInputMessageEntityMentionName)entity).User); } if (entity is TLMessageEntityMentionName) { return string.Format("tlg://?action=profile&user_id={1}\b{0}", text, ((TLMessageEntityMentionName)entity).UserId); } if (entity is TLMessageEntityMention) { return string.Format("tlg://?action=mention&q={0}\b{0}", text); } if (entity is TLMessageEntityHashtag) { return string.Format("tlg://?action=search&q={0}\b{0}", text); } if (entity is TLMessageEntityBotCommand) { return string.Format("tlg://?action=command&q={0}\b{0}", text); } if (entity is TLMessageEntityUrl) { return string.Format("{0}\b{0}", text); } if (entity is TLMessageEntityEmail) { return string.Format("mailto:{0}\b{0}", text); } if (entity is TLMessageEntityBold) { return string.Format("bold\b{0}", text); } if (entity is TLMessageEntityItalic) { //return text; return string.Format("italic\b{0}", text); } if (entity is TLMessageEntityCode) { return string.Format("code\b{0}", text); } if (entity is TLMessageEntityPre) { return string.Format("pre\b{0}", text); } if (entity is TLMessageEntityTextUrl) { var url = ((TLMessageEntityTextUrl)entity).Url; return string.Format("{0}\b{1}", url, text); } if (entity is TLMessageEntityCashtag) { return string.Format("pre\b{0}", text); } if (entity is TLMessageEntityPhone) { var config = IoC.Get().GetConfig() as TLConfig76; if (config != null && !config.IgnorePhoneEntities) { return string.Format("tlg://?action=phone&q={0}\b{0}", text); } return text; } return text; } private static void AddRawText(RichTextBox text_block, Paragraph par, string raw_text, FontStyle fontStyle, FontWeight fontWeight, FontFamily fontFamily) { var textEnumerator = StringInfo.GetTextElementEnumerator(raw_text); bool cont = false; var nextElements = new List>(); //string nextText = null; //byte[] nextBytes = null; //string nextBytesStr = null; StringBuilder sb = new StringBuilder(); // Note: Begins at element -1 (none). cont = textEnumerator.MoveNext(); while (cont) { string text; byte[] bytes; string bytesStr; if (nextElements.Count > 0) { text = nextElements[0].Item1; bytes = nextElements[0].Item2; bytesStr = nextElements[0].Item3; nextElements.RemoveAt(0); } else { text = textEnumerator.GetTextElement(); bytes = Encoding.BigEndianUnicode.GetBytes(text); bytesStr = ConvertToHexString(bytes); } if (Emoji.FlagsPrefixes.ContainsKey(bytesStr) && textEnumerator.MoveNext()) { var text2 = textEnumerator.GetTextElement(); var bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); var bytesStr2 = ConvertToHexString(bytes2); bytesStr += bytesStr2; text += text2; } string bytesValue2; if (string.IsNullOrEmpty(bytesStr) || Emoji.SkinsDict.TryGetValue(bytesStr, out bytesValue2)) { if (nextElements.Count == 0) { cont = textEnumerator.MoveNext(); } continue; //skip unknown skin emoji } string bytesValue; TreeNode node; //System.Diagnostics.Debug.WriteLine(bytesStr); // skinned emoji if (Emoji.SkinnedDict.TryGetValue(bytesStr, out bytesValue)) { if (textEnumerator.MoveNext()) { var text2 = textEnumerator.GetTextElement(); var bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); var bytesStr2 = ConvertToHexString(bytes2); if (string.IsNullOrEmpty(bytesStr2)) { if (textEnumerator.MoveNext()) { text2 = textEnumerator.GetTextElement(); bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); bytesStr2 = ConvertToHexString(bytes2); } } // skins if (Emoji.SkinsDict.TryGetValue(bytesStr2, out bytesValue2) && Emoji.SkinnedDict.TryGetValue(bytesStr + bytesStr2, out bytesValue2)) { bytesValue = bytesValue2; } // joined emoji else if (Emoji.JoinedEmojiTree.Values.TryGetValue(bytesStr, out node) && node.Values.TryGetValue(bytesStr2, out node)) { var initBytesValue = bytesValue; bytesValue += bytesStr2; var localNextElements = new List>(); var isJoinedEmoji = true; cont = textEnumerator.MoveNext(); while (cont) { text2 = textEnumerator.GetTextElement(); bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); bytesStr2 = ConvertToHexString(bytes2); localNextElements.Add(new Tuple(text2, bytes2, bytesStr2)); if (string.IsNullOrEmpty(bytesStr2)) { if (textEnumerator.MoveNext()) { text2 = textEnumerator.GetTextElement(); bytes2 = Encoding.BigEndianUnicode.GetBytes(text2); bytesStr2 = ConvertToHexString(bytes2); localNextElements.Add(new Tuple(text2, bytes2, bytesStr2)); } } var previousNode = node; if (node.Values.TryGetValue(bytesStr2, out node)) { bytesValue += bytesStr2; if (node.Values.Count == 0) { localNextElements.Clear(); break; } } else { if (previousNode.IsEnded) { localNextElements.Clear(); localNextElements.Add(new Tuple(text2, bytes2, bytesStr2)); } isJoinedEmoji = previousNode.IsEnded; break; } cont = textEnumerator.MoveNext(); if (!cont) { localNextElements.Clear(); } } if (!isJoinedEmoji) { bytesValue = initBytesValue; } for (var i = 0; i < localNextElements.Count; i++) { nextElements.Add(localNextElements[i]); } } else { nextElements.Add(new Tuple(text2, bytes2, bytesStr2)); } } AddTextAndEmoji(text_block, par, fontStyle, fontWeight, fontFamily, sb, bytesValue); } else if (Emoji.Dict.TryGetValue(bytesStr, out bytesValue)) { AddTextAndEmoji(text_block, par, fontStyle, fontWeight, fontFamily, sb, bytesValue); } else { sb = sb.Append(text); } if (nextElements.Count == 0) { cont = textEnumerator.MoveNext(); } } var sbStrLast = sb.ToString(); if (sbStrLast != string.Empty) { par.Inlines.Add(GetRunWithStyle(sbStrLast, text_block, fontStyle, fontWeight, fontFamily)); } } private static void AddTextAndEmoji(RichTextBox text_block, Paragraph par, FontStyle fontStyle, FontWeight fontWeight, FontFamily fontFamily, StringBuilder sb, string bytesValue) { var sbStr = sb.ToString(); sb.Clear(); if (sbStr != string.Empty) { par.Inlines.Add(GetRunWithStyle(sbStr, text_block, fontStyle, fontWeight, fontFamily)); } double imageHeight; //System.Diagnostics.Debug.WriteLine(bytesValue); par.Inlines.Add(GetImage(bytesValue, out imageHeight)); text_block.MinHeight = imageHeight; //+ 10; } public static string ConvertToHexString(byte[] bytes) { //remove end FE0F/FE0E bytes var length = bytes.Length; if (bytes.Length >= 2 && bytes[bytes.Length - 2] == 254 && (bytes[bytes.Length - 1] == 15 || bytes[bytes.Length - 1] == 14)) { length -= 2; } var sb = new StringBuilder(); for (var i = 0; i < length; i++) { sb = sb.Append(Convert.ToString(bytes[i], 16).PadLeft(2, '0')); } return sb.ToString().ToUpperInvariant(); } // Fetch run with PhoneTextNormalStyle public static Run GetRunWithStyle(string text, RichTextBox richTextBox, FontStyle fontStyle, FontWeight fontWeight, FontFamily fontFamily) { var run = new Run(); run.FontFamily = richTextBox.FontFamily; //run.FontSize = richTextBox.FontSize * TextScaleFactor; //run.Foreground = richTextBox.Foreground;// (Brush)Application.Current.Resources["PhoneForegroundBrush"]; run.Text = text; run.FontStyle = fontStyle; run.FontWeight = fontWeight; run.FontFamily = fontFamily; return run; } private static InlineUIContainer GetImage(string name, out double height) { var image = new Image(); image.Source = new BitmapImage(new Uri(string.Format("/Assets/Emoji/Separated/{0}.png", name), UriKind.RelativeOrAbsolute)); image.Height = 27 * FontScaleFactor; image.Width = 27 * FontScaleFactor; image.VerticalAlignment = VerticalAlignment.Center; image.Margin = new Thickness(0, 5.0, 0, -5.0); var container = new InlineUIContainer { }; height = image.Height; container.Child = image;//new Border {Child = image, Background = new SolidColorBrush(Colors.Red), Opacity = 0.7}; return container; } private static void NavigateOnHyperlink(string navstr, RichTextBox textBox) { var message = GetMessage(textBox); var media = GetMedia(textBox); var contentControl = VisualTreeExtensions.FindParentOfType(textBox); if (contentControl != null) { media = contentControl.Content as TLMessageMediaBase; } if (string.IsNullOrEmpty(navstr)) return; if (navstr.StartsWith("tlg://?action=profile")) { var mentionIndex = navstr.IndexOf("user_id", StringComparison.OrdinalIgnoreCase); if (mentionIndex != -1) { var userIdString = navstr.Substring(mentionIndex).Replace("user_id=", string.Empty); if (string.Equals(userIdString, "self", StringComparison.OrdinalIgnoreCase)) { RaiseMentionNavigated(new TelegramMentionEventArgs { UserId = IoC.Get().CurrentUserId }); return; } int userId; if (int.TryParse(userIdString, out userId)) { RaiseMentionNavigated(new TelegramMentionEventArgs { UserId = userId }); } } mentionIndex = navstr.IndexOf("chat_id", StringComparison.OrdinalIgnoreCase); if (mentionIndex != -1) { var userIdString = navstr.Substring(mentionIndex).Replace("chat_id=", string.Empty); int userId; if (int.TryParse(userIdString, out userId)) { RaiseMentionNavigated(new TelegramMentionEventArgs { ChatId = userId }); } } mentionIndex = navstr.IndexOf("channel_id", StringComparison.OrdinalIgnoreCase); if (mentionIndex != -1) { var userIdString = navstr.Substring(mentionIndex).Replace("channel_id=", string.Empty); int userId; if (int.TryParse(userIdString, out userId)) { RaiseMentionNavigated(new TelegramMentionEventArgs { ChannelId = userId }); } } } else if (navstr.StartsWith("tlg://?action=mention")) { var mentionIndex = navstr.IndexOf('@'); if (mentionIndex != -1) { var mention = navstr.Substring(mentionIndex); RaiseMentionNavigated(new TelegramMentionEventArgs { Mention = mention }); } } else if (navstr.StartsWith("tlg://?action=search")) { var hashtagIndex = navstr.IndexOf('#'); if (hashtagIndex != -1) { var hashtag = navstr.Substring(hashtagIndex); RaiseSearchHashtag(new TelegramHashtagEventArgs { Hashtag = hashtag }); } } else if (navstr.StartsWith("tlg://?action=command")) { var commandIndex = navstr.LastIndexOf('/'); if (commandIndex != -1) { var command = navstr.Substring(commandIndex); RaiseInvokeCommand(new TelegramCommandEventArgs { Command = command, Message = message, Media = media }); } } else if (navstr.StartsWith("tlg://?action=game")) { RaiseOpenGame(new TelegramGameEventArgs { Message = message }); } else if (navstr.StartsWith("tlg://?action=phone")) { var phoneIndex = navstr.IndexOf("q", StringComparison.OrdinalIgnoreCase); if (phoneIndex != -1) { var phoneString = navstr.Substring(phoneIndex).Replace("q=", string.Empty); if (!string.IsNullOrEmpty(phoneString)) { RaiseOpenPhone(new TelegramPhoneEventArgs { Phone = phoneString }); } } } else if (navstr.StartsWith("tg://")) { Uri uri = null; try { uri = new Uri("/Protocol?encodedLaunchUri=" + HttpUtility.UrlEncode(navstr), UriKind.Relative); } catch (Exception e) { } if (uri == null) return; TelegramViewBase.NavigateToTelegramUriAsync(uri); } else if (!navstr.Contains("@")) { if (navstr.ToLowerInvariant().Contains("telegram.me") || navstr.ToLowerInvariant().Contains("t.me")) { RaiseTelegramLinkAction(new TelegramEventArgs { Uri = navstr }); } else { var task = new WebBrowserTask(); task.URL = HttpUtility.UrlEncode(navstr); task.Show(); } } else { EmailComposeTask emailComposeTask = new EmailComposeTask(); if (navstr.StartsWith("http://")) { navstr = navstr.Remove(0, 7); } emailComposeTask.To = navstr; emailComposeTask.Show(); } } public static bool IsValidUsernameSymbol(char symbol) { if ((symbol >= 'a' && symbol <= 'z') || (symbol >= 'A' && symbol <= 'Z') || (symbol >= '0' && symbol <= '9') || symbol == '_') { return true; } return false; } public static bool IsValidUsername(string username) { if (username.Length <= 3) { return false; } if (username.Length > 32) { return false; } if (username[0] != '@') { return false; } for (var i = 1; i < username.Length; i++) { if (!IsValidUsernameSymbol(username[i])) { return false; } } return true; } private static bool IsValidCommand(string command) { if (command.Length <= 2) { return false; } if (command.Length > 32) { return false; } if (command[0] != '/') { return false; } for (var i = 1; i < command.Length; i++) { if (!IsValidUsernameSymbol(command[i])) { return false; } } return true; } public static List ParseText(string html) { //#if DEBUG // return new List{ html }; // VibrateController.Default.Start(TimeSpan.FromSeconds(0.2)); //#endif var originalHtml = html; html = html.Replace("\n", " \n "); var rx = new Regex("(https?:\\/\\/)?(([A-Za-zА-Яа-яЁё0-9@][A-Za-zА-Яа-яЁё0-9@\\-_\\.]*[A-Za-zА-Яа-яЁё0-9@])(\\/([A-Za-zА-Яа-я0-9@\\-_#%&?+\\/\\.=;:~!]*[^\\.\\,;\\(\\)\\?<\\&\\s:])?)?)", RegexOptions.IgnoreCase | RegexOptions.Compiled); html = rx.Replace(html, delegate(Match m) { var full = m.Value; if (full.IndexOf('@') == 0 && IsValidUsername(full)) return string.Format("\atlg://?action=mention&q={0}\b{1}\a", full, full); var protocol = (m.Groups.Count > 1) ? m.Groups[1].Value : "http://"; if (protocol == string.Empty) protocol = "http://"; var url = (m.Groups.Count > 2) ? m.Groups[2].Value : string.Empty; var domain = (m.Groups.Count > 3) ? m.Groups[3].Value : string.Empty; if (domain.IndexOf(".") == -1 || domain.IndexOf("..") != -1) return full; var topDomain = domain.Split('.').LastOrDefault(); if (topDomain.Length > 5 || !("guru,info,name,aero,arpa,coop,museum,mobi,travel,xxx,asia,biz,com,net,org,gov,mil,edu,int,tel,ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,az,ba,bb,bd,be,bf,bg,bh,bi,bj,bm,bn,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,ck,cl,cm,cn,co,cr,cu,cv,cx,cy,cz,de,dj,dk,dm,do,dz,ec,ee,eg,eh,er,es,et,eu,fi,fj,fk,fm,fo,fr,ga,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gu,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,il,im,in,io,iq,ir,is,it,je,jm,jo,jp,ke,kg,kh,ki,km,kn,kp,kr,kw,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mm,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,mz,na,nc,ne,nf,ng,ni,nl,no,np,nr,nu,nz,om,pa,pe,pf,pg,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,um,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,ye,yt,yu,za,zm,zw,рф,cat,pro" .Split(',').Contains(topDomain))) return full; if (full.IndexOf('@') != -1) return string.Format("\amailto:{0}\b{1}\a", full, full); full = HttpUtility.UrlDecode(full); if (full.Length > 55) full = full.Substring(0, 53) + ".."; return string.Format("\a{0}\b{1}\a", (protocol + url), full); }); // is # but not #️⃣ (0x0023 0xFE0F 0x20E3) var hashIndex = originalHtml.IndexOf('#'); if (hashIndex != -1 && !(hashIndex + 2 < originalHtml.Length && originalHtml[hashIndex + 1] == 0xFE0F && originalHtml[hashIndex + 2] == 0x20E3)) { var hashtagRx = new Regex("(^|[\\s])#[\\w@\\.]+", RegexOptions.Compiled); html = hashtagRx.Replace(html, match => { var trimmedText = match.Value.TrimStart(); var trimStart = trimmedText.Length < match.Value.Length ? match.Value.Substring(0, match.Value.Length - trimmedText.Length) : string.Empty; var trimEnd = trimmedText.EndsWith(".") ? "." : string.Empty; var displayText = trimmedText.TrimEnd('.'); var internalText = "tlg://?action=search&q=" + displayText; return string.Format("{0}\a{1}\b{2}\a{3}", trimStart, internalText, displayText, trimEnd); }); } if (originalHtml.IndexOf('/') != -1) { html = html.ReplaceByRegex("(^|[\\s])\\/[A-Za-z_0-9]{1,64}(@[A-Za-z_0-9]{5,32})?([\\w]|$)", " \atlg://?action=command&q=$0\b$0\a"); } html = html.Replace("\n ", "\n").Replace(" \n", "\n"); if (html.StartsWith(" ")) html = html.Remove(0, 1); return html.Split('\a').ToList(); } } public static class StringExtensions { public static string ReplaceByRegex(this string str, string regexStr, string replace) { var regex = new Regex(regexStr); var result = regex.Replace(str, replace); return result; } } public class TelegramEventArgs : EventArgs { public string Uri { get; set; } } public class TelegramHashtagEventArgs : EventArgs { public string Hashtag { get; set; } } public class TelegramCommandEventArgs : EventArgs { public string Command { get; set; } public TLMessageBase Message { get; set; } public TLMessageMediaBase Media { get; set; } } public class TelegramGameEventArgs : EventArgs { public TLMessageBase Message { get; set; } } public class TelegramMentionEventArgs : EventArgs { public string Mention { get; set; } public int UserId { get; set; } public int ChatId { get; set; } public int ChannelId { get; set; } } public class TelegramPhoneEventArgs : EventArgs { public string Phone { get; set; } } } ================================================ FILE: TelegramClient/Controls/TelegramNavigationInTransition.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace TelegramClient.Controls { /// /// Has navigation-in /// s /// for the designer experiences. /// public class TelegramNavigationInTransition : TelegramNavigationTransition { } } ================================================ FILE: TelegramClient/Controls/TelegramNavigationOutTransition.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // namespace TelegramClient.Controls { /// /// Has navigation-out /// s /// for the designer experiences. /// public class TelegramNavigationOutTransition : TelegramNavigationTransition { } } ================================================ FILE: TelegramClient/Controls/TelegramNavigationTransition.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using Microsoft.Phone.Controls; namespace TelegramClient.Controls { /// /// Has /// s /// for the designer experiences. /// public class TelegramNavigationTransition : DependencyObject { /// /// The /// /// for the backward /// . /// public static readonly DependencyProperty BackwardProperty = DependencyProperty.Register("Backward", typeof(TransitionElement), typeof(TelegramNavigationTransition), null); /// /// The /// /// for the forward /// . /// public static readonly DependencyProperty ForwardProperty = DependencyProperty.Register("Forward", typeof(TransitionElement), typeof(TelegramNavigationTransition), null); /// /// The navigation transition will begin. /// public event RoutedEventHandler BeginTransition; /// /// The navigation transition has ended. /// public event RoutedEventHandler EndTransition; /// /// Gets or sets the backward /// . /// public TransitionElement Backward { get { return (TransitionElement)GetValue(BackwardProperty); } set { SetValue(BackwardProperty, value); } } /// /// Gets or sets the forward /// . /// public TransitionElement Forward { get { return (TransitionElement)GetValue(ForwardProperty); } set { SetValue(ForwardProperty, value); } } /// /// Triggers . /// internal void OnBeginTransition() { if (BeginTransition != null) { BeginTransition(this, new RoutedEventArgs()); } } /// /// Triggers . /// internal void OnEndTransition() { if (EndTransition != null) { EndTransition(this, new RoutedEventArgs()); } } } } ================================================ FILE: TelegramClient/Controls/TelegramRichTextBox.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; using System.Windows.Media.Imaging; using Telegram.Api.TL; namespace Telegram.EmojiPanel { public class TelegramRichTextBox : Control { private Run _footerRun; public static readonly DependencyProperty FooterFontSizeProperty = DependencyProperty.Register( "FooterFontSize", typeof (double), typeof (TelegramRichTextBox), new PropertyMetadata(18.87, OnFooterFontSizeChanged)); private static void OnFooterFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var telegramRichTextBox = d as TelegramRichTextBox; if (telegramRichTextBox != null) { if (telegramRichTextBox._footerRun != null) { telegramRichTextBox._footerRun.Text = (string)e.NewValue; } } } public double FooterFontSize { get { return (double) GetValue(FooterFontSizeProperty); } set { SetValue(FooterFontSizeProperty, value); } } public static readonly DependencyProperty FooterProperty = DependencyProperty.Register( "Footer", typeof (string), typeof (TelegramRichTextBox), new PropertyMetadata(default(string), OnFooterChanged)); private static void OnFooterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var telegramRichTextBox = d as TelegramRichTextBox; if (telegramRichTextBox != null) { if (telegramRichTextBox._footerRun != null) { telegramRichTextBox._footerRun.Text = (string)e.NewValue; } } } public string Footer { get { return (string) GetValue(FooterProperty); } set { SetValue(FooterProperty, value); } } public static readonly DependencyProperty EntitiesProperty = DependencyProperty.Register( "Entities", typeof (IList), typeof (TelegramRichTextBox), new PropertyMetadata(default(IList))); public IList Entities { get { return (IList) GetValue(EntitiesProperty); } set { SetValue(EntitiesProperty, value); } } public static readonly DependencyProperty TextWrappingProperty = DependencyProperty.Register( "TextWrapping", typeof (TextWrapping), typeof (TelegramRichTextBox), new PropertyMetadata(TextWrapping.Wrap)); public TextWrapping TextWrapping { get { return (TextWrapping) GetValue(TextWrappingProperty); } set { SetValue(TextWrappingProperty, value); } } public static readonly DependencyProperty TextTrimmingProperty = DependencyProperty.Register( "TextTrimming", typeof (TextTrimming), typeof (TelegramRichTextBox), new PropertyMetadata(default(TextTrimming))); public TextTrimming TextTrimming { get { return (TextTrimming) GetValue(TextTrimmingProperty); } set { SetValue(TextTrimmingProperty, value); } } public static readonly DependencyProperty TextAlignmentProperty = DependencyProperty.Register( "TextAlignment", typeof (TextAlignment), typeof (TelegramRichTextBox), new PropertyMetadata(TextAlignment.Left, OnTextAlignmentChanged)); private static void OnTextAlignmentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = (TelegramRichTextBox)d; if (textBox != null && textBox._stackPanel != null) { foreach (var child in textBox._stackPanel.Children) { var richTextBox = child as RichTextBox; if (richTextBox != null) { richTextBox.TextAlignment = (TextAlignment) e.NewValue; } } } } public TextAlignment TextAlignment { get { return (TextAlignment) GetValue(TextAlignmentProperty); } set { SetValue(TextAlignmentProperty, value); } } public void SetForeground(Brush foreground) { if (_stackPanel != null) { foreach (var child in _stackPanel.Children) { var richTextBox = child as RichTextBox; if (richTextBox != null) { richTextBox.Foreground = foreground; } } } } public static readonly DependencyProperty MoreElementProperty = DependencyProperty.Register( "MoreElement", typeof (FrameworkElement), typeof (TelegramRichTextBox), new PropertyMetadata(default(FrameworkElement), OnMoreElementChanged)); private static void OnMoreElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var telegramRichTextBox = (TelegramRichTextBox) d; telegramRichTextBox.OnSizeChanged(null, null); } public FrameworkElement MoreElement { get { return (FrameworkElement) GetValue(MoreElementProperty); } set { SetValue(MoreElementProperty, value); } } public static readonly DependencyProperty TextScaleFactorProperty = DependencyProperty.Register( "TextScaleFactor", typeof (double), typeof (TelegramRichTextBox), new PropertyMetadata(1.0, OnFontScaleFactorChanged)); private static void OnFontScaleFactorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textBox = (TelegramRichTextBox)d; if (textBox != null && textBox._stackPanel != null) { foreach (var child in textBox._stackPanel.Children) { var richTextBox = child as RichTextBox; if (richTextBox != null) { richTextBox.FontSize = textBox._defaultFontSize*(double) e.NewValue; foreach (var block in richTextBox.Blocks) { var paragraph = block as Paragraph; if (paragraph != null) { foreach (var inline in paragraph.Inlines) { var uiContainer = inline as InlineUIContainer; if (uiContainer != null) { var image = uiContainer.Child as Image; if (image != null) { var size = 27.0 * (double)e.NewValue; image.Height = size; image.Width = size; } } } } } } } } } private double _defaultFontSize; public double TextScaleFactor { get { return (double) GetValue(TextScaleFactorProperty); } set { SetValue(TextScaleFactorProperty, value); } } private StackPanel _stackPanel; private TextBlock measureTxt; public TelegramRichTextBox() { DefaultStyleKey = typeof(TelegramRichTextBox); SizeChanged += OnSizeChanged; } private void OnSizeChanged(object sender, SizeChangedEventArgs e) { if (MoreElement != null) { if (ActualHeight > 0.0 && MaxHeight > 0.0 && ActualHeight >= MaxHeight) { MoreElement.Visibility = Visibility.Visible; } else { MoreElement.Visibility = Visibility.Collapsed; } } } public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(TelegramRichTextBox), new PropertyMetadata("", OnTextPropertyChanged)); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TelegramRichTextBox source = (TelegramRichTextBox)d; string value = (string)e.NewValue; //if (value.Length <= 2) //{ // value += "TTT"; //} //System.Diagnostics.Debug.WriteLine("oldText={0} newText={1} foreground={2} textAlignment={3}", e.OldValue, e.NewValue, ((SolidColorBrush)source.Foreground).Color, source.TextAlignment); source.ParseText(value); } public override void OnApplyTemplate() { _defaultFontSize = FontSize; _stackPanel = GetTemplateChild("StackPanel") as StackPanel; ParseText(Text); base.OnApplyTemplate(); } private void ParseText(string value) { if (value == null) { value = ""; } if (_stackPanel == null) { return; } //System.Diagnostics.Debug.WriteLine("{0} ParseText", GetHashCode()); // Clear previous TextBlocks _stackPanel.Children.Clear(); var suppressParsing = BrowserNavigationService.GetSuppressParsing(this); var message = DataContext as TLMessageBase ?? BrowserNavigationService.GetMessage(this); var decryptedMessage = DataContext as TLDecryptedMessageBase; var fitIn2000Pixels = CheckFitInMaxRenderHeight(value); if (fitIn2000Pixels) { var textBlock = GetTextBlock(); BrowserNavigationService.SetSuppressParsing(textBlock, suppressParsing); BrowserNavigationService.SetMessage(textBlock, message); BrowserNavigationService.SetDecryptedMessage(textBlock, decryptedMessage); BrowserNavigationService.SetAddFooter(textBlock, true); BrowserNavigationService.SetText(textBlock, value); _stackPanel.Children.Add(textBlock); _footerRun = GetFooter(textBlock); } else { ParseLineExtended(value); } } private Run GetFooter(RichTextBox textBlock) { var run = textBlock.Tag as Run; if (run != null) { run.Text = Footer; run.FontSize = FooterFontSize; } return run; } private readonly int MAX_STR_LENGTH = 1100; private void ParseLineExtended(string allText) { if (string.IsNullOrEmpty(allText)) return; int cutIndex = MAX_STR_LENGTH; if (cutIndex >= allText.Length) cutIndex = allText.Length - 1; var endOfSentenceIndAfterCut = allText.IndexOf(".", cutIndex); if (endOfSentenceIndAfterCut >= 0 && endOfSentenceIndAfterCut - cutIndex < 200) { cutIndex = endOfSentenceIndAfterCut; } else { var whiteSpaceIndAfterCut = allText.IndexOf(' ', cutIndex); if (whiteSpaceIndAfterCut >= 0 && whiteSpaceIndAfterCut - cutIndex < 100) { cutIndex = whiteSpaceIndAfterCut; } } // add all whitespaces before cut while (cutIndex + 1 < allText.Length && allText[cutIndex + 1] == ' ') { cutIndex++; } var suppressParsing = BrowserNavigationService.GetSuppressParsing(this); var message = DataContext as TLMessageBase; var decryptedMessage = DataContext as TLDecryptedMessageBase; var leftSide = allText.Substring(0, cutIndex + 1); allText = allText.Substring(cutIndex + 1); var isLastTextBlock = allText.Length <= 0; var textBlock = GetTextBlock(); BrowserNavigationService.SetSuppressParsing(textBlock, suppressParsing); BrowserNavigationService.SetMessage(textBlock, message); BrowserNavigationService.SetDecryptedMessage(textBlock, decryptedMessage); if (isLastTextBlock) { BrowserNavigationService.SetAddFooter(textBlock, true); } BrowserNavigationService.SetText(textBlock, leftSide); _stackPanel.Children.Add(textBlock); _footerRun = GetFooter(textBlock); if (!isLastTextBlock) { ParseLineExtended(allText); } } private bool CheckFitInMaxRenderHeight(string value) { return value.Length <= MAX_STR_LENGTH; } private RichTextBox GetTextBlock() { var textBlock = new RichTextBox(); textBlock.TextAlignment = TextAlignment; textBlock.TextWrapping = TextWrapping; textBlock.IsReadOnly = true; textBlock.FontSize = FontSize * TextScaleFactor; textBlock.FontFamily = FontFamily; textBlock.HorizontalContentAlignment = HorizontalContentAlignment; textBlock.Foreground = Foreground; textBlock.Padding = new Thickness(0, 0, 0, 0); textBlock.Margin = new Thickness(0, 0, 0, 0); textBlock.FlowDirection = FlowDirection; return textBlock; } } public class Utils { public static readonly Regex HyperlinkRegex = new Regex("(?i)\\b(((?:https?://|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»“”‘’]))|([a-z0-9.\\-]+(\\.ru|\\.com|\\.net|\\.org|\\.us|\\.it|\\.co\\.uk)(?![a-z0-9]))|([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]*[a-zA-Z0-9-]+))"); public static string GetFormattedLink(string link) { var flag = link.EndsWith(","); if (flag && link.Length > 1) link = link.Substring(0, link.Length - 1); if (!link.StartsWith("http", StringComparison.OrdinalIgnoreCase)) link = "http://" + link; return link; } public static Inline GetTextBlock(string text) { return new Run { Text = text }; } public static Inline GetHyperlinkBlock(string text, string link) { var hyperlink = new Hyperlink(); hyperlink.Inlines.Add(text); hyperlink.NavigateUri = new Uri(link, UriKind.Absolute); return hyperlink; } public static Inline GetEmojiBlock(string emoji) { var uiContainer = new InlineUIContainer(); uiContainer.Child = new Image { Source = GetEmojiSource(emoji), Width = 30, Height = 30 }; return uiContainer; } public static ImageSource GetEmojiSource(string emoji) { return new BitmapImage(new Uri(emoji)); } public static Regex GetRegex(bool supportEmoji) { if (supportEmoji) { return HyperlinkRegex; } return HyperlinkRegex; } } } ================================================ FILE: TelegramClient/Controls/TelegramTransitionFrame.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; using Caliburn.Micro; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using Telegram.Api.Extensions; using TelegramClient.Services; using TelegramClient.Themes.Default.Templates; using TelegramClient.ViewModels.Additional; using TelegramClient.Views.Additional; using TelegramClient.Views.Calls; using TelegramClient.Views.Controls; namespace TelegramClient.Controls { public class TelegramTransitionFrame : TransitionFrame { public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof(string), typeof(TelegramTransitionFrame), new PropertyMetadata(default(string))); public string Title { get { return (string)GetValue(TitleProperty); } set { SetValue(TitleProperty, value); } } private UIElement _blockingProgress; private Border _clientArea; private StackPanel _blockingPanel; private LockscreenView _passcodePanel; //private TextBlock _debugInfo; //public TextBlock DebugInfo { get { return _debugInfo; } } //private ListBox _debugList; //public ListBox DebugList { get { return _debugList; } } private MediaElement _element; public MediaElement Element { get { return _element; } } private ContentControl _callPlaceholder; private ContentControl _blockingPlaceholder; private Border _player; public TelegramTransitionFrame() { DefaultStyleKey = typeof(TelegramTransitionFrame); Loaded += OnLoaded; Navigating += OnNavigating; //AddOrRemoveEventHandler(); } #region Handle Software buttons private void OnUnloaded(object sender, RoutedEventArgs e) { this.Unloaded -= this.OnUnloaded; this.AddOrRemoveEventHandler(remove: true); } private bool AddOrRemoveEventHandler(bool remove = false) { var ei = GetType().GetEvents(); var pi = GetType().GetProperties(); var evInfo = GetType().GetEvent("NavigationBarVisibilityChanged", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); if (evInfo != null) { var method = evInfo.AddMethod; if (remove) { method = evInfo.RemoveMethod; } method.Invoke(this, new EventHandler[] { OnNavBarVisibilityChanged }); Unloaded += OnUnloaded; return true; } return false; } private void UpdateMargin(double occludedHeight) { Margin = new Thickness(0, 0, 0, occludedHeight); } private void OnNavBarVisibilityChanged(object sender, System.EventArgs e) { var occludedHeightProp = e.GetType().GetProperties().SingleOrDefault(p => p.Name == "OccludedHeight"); if (occludedHeightProp != null) { var occludedHeight = (double)occludedHeightProp.GetValue(e); UpdateMargin(occludedHeight); } } #endregion private void OnNavigating(object sender, NavigatingCancelEventArgs e) { if (_passcodePanel != null && _passcodePanel.Visibility == Visibility.Visible && e.IsCancelable) { e.Cancel = true; } } private void OnLoaded(object sender, RoutedEventArgs e) { } public override void OnApplyTemplate() { base.OnApplyTemplate(); _blockingProgress = GetTemplateChild("BlockingProgress") as Border; _clientArea = GetTemplateChild("ClientArea") as Border; _blockingPanel = GetTemplateChild("BlockingPanel") as StackPanel; _passcodePanel = GetTemplateChild("PasscodePanel") as LockscreenView; //_debugInfo = GetTemplateChild("DebugInfo") as TextBlock; _element = GetTemplateChild("Element") as MediaElement; if (_element != null) { _element.MediaOpened += PlayerOnMediaOpened; _element.MediaFailed += PlayerOnMediaFailed; _element.MediaEnded += PlayerOnMediaEnded; } _callPlaceholder = GetTemplateChild("CallPlaceholder") as ContentControl; _blockingPlaceholder = GetTemplateChild("BlockingPlaceholder") as ContentControl; _player = GetTemplateChild("Player") as Border; if (_player != null) { _player.ManipulationDelta += PlayerOnManipulationDelta; _player.ManipulationCompleted += PlayerOnManipulationCompleted; } //#if !DEBUG //if (_debugInfo != null) _debugInfo.Visibility = Visibility.Collapsed; //if (_debugList != null) _debugList.Visibility = Visibility.Collapsed; //#endif if (_returnToCallControl != null) { _callPlaceholder.Content = _returnToCallControl; } if (PasscodeUtils.IsLockscreenRequired) { OpenLockscreen(); } } private void PlayerOnManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { if (_player.Visibility == Visibility.Visible) { var position = _player.TransformToVisual(Application.Current.RootVisual).Transform(new Point(80.0, 80.0)); System.Diagnostics.Debug.WriteLine(position.X + " " + position.Y); var toX = 0.0; var toY = 0.0; var transform = _player.RenderTransform as TranslateTransform; if (transform != null) { if (position.X < 40.0) { toX = transform.X - 160.0; } else if (position.X > 440.0) { toX = transform.X + 160.0; } else if (position.Y < 40.0) { toY = transform.Y - 160.0; } else if (position.Y > 760.0) { toY = transform.Y + 160.0; } if (Math.Abs(toY) > 0.001 || Math.Abs(toX) > 0.001) { var storyborad = new Storyboard(); if (Math.Abs(toY) > 0.001) { var translateYAnimaiton = new DoubleAnimation { To = toY, Duration = TimeSpan.FromSeconds(0.15), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 3.0 } }; Storyboard.SetTarget(translateYAnimaiton, transform); Storyboard.SetTargetProperty(translateYAnimaiton, new PropertyPath("Y")); storyborad.Children.Add(translateYAnimaiton); } else if (Math.Abs(toX) > 0.001) { var translateYAnimaiton = new DoubleAnimation { To = toX, Duration = TimeSpan.FromSeconds(0.15), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 3.0 } }; Storyboard.SetTarget(translateYAnimaiton, transform); Storyboard.SetTargetProperty(translateYAnimaiton, new PropertyPath("X")); storyborad.Children.Add(translateYAnimaiton); } storyborad.Completed += (o, args) => { _player.Visibility = Visibility.Collapsed; _player.RenderTransform = null; PlayerOnMediaEnded(_element, new RoutedEventArgs()); }; _element.Stop(); Telegram.Api.Helpers.Execute.BeginOnUIThread(storyborad.Begin); } } } } private void PlayerOnManipulationDelta(object sender, ManipulationDeltaEventArgs e) { var translateTransform = _player.RenderTransform as TranslateTransform; if (translateTransform == null) { translateTransform = new TranslateTransform(); _player.RenderTransform = translateTransform; } translateTransform.X += e.DeltaManipulation.Translation.X; translateTransform.Y += e.DeltaManipulation.Translation.Y; e.Handled = true; } private void PlayerOnMediaEnded(object sender, RoutedEventArgs e) { var mediaElement = sender as MediaElement; if (mediaElement != null) { var player = mediaElement.Tag as GifPlayerControl; if (player != null) { player.OnMediaEnded(); return; } var audioPlayer = mediaElement.Tag as MessagePlayerControl; if (audioPlayer != null) { audioPlayer.OnMediaEnded(); return; } } } private void PlayerOnMediaFailed(object sender, ExceptionRoutedEventArgs e) { var mediaElement = sender as MediaElement; if (mediaElement != null) { var player = mediaElement.Tag as GifPlayerControl; if (player != null) { player.OnMediaFailed(e); return; } var audioPlayer = mediaElement.Tag as MessagePlayerControl; if (audioPlayer != null) { audioPlayer.OnMediaFailed(e); return; } } } private void PlayerOnMediaOpened(object sender, RoutedEventArgs routedEventArgs) { var mediaElement = sender as MediaElement; if (mediaElement != null) { var player = mediaElement.Tag as GifPlayerControl; if (player != null) { player.OnMediaOpened(); return; } var audioPlayer = mediaElement.Tag as MessagePlayerControl; if (audioPlayer != null) { audioPlayer.OnMediaOpened(); return; } } } private TranslateTransform _frameTransform; public static readonly DependencyProperty RootFrameTransformProperty = DependencyProperty.Register( "RootFrameTransformProperty", typeof(double), typeof(TelegramTransitionFrame), new PropertyMetadata(OnRootFrameTransformChanged)); private static void OnRootFrameTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = d as TelegramTransitionFrame; if (view != null) { view._frameTransform.Y = 0; } } public double RootFrameTransform { get { return (double)GetValue(RootFrameTransformProperty); } set { SetValue(RootFrameTransformProperty, value); } } private void SetRootFrameBinding() { var frame = (Frame)Application.Current.RootVisual; _frameTransform = ((TranslateTransform)((TransformGroup)frame.RenderTransform).Children[0]); var binding = new Binding("Y") { Source = _frameTransform }; SetBinding(RootFrameTransformProperty, binding); } private void RemoveRootFrameBinding() { ClearValue(RootFrameTransformProperty); } private IList _buttons = new List(); private IList _menuItems = new List(); private bool _removeApplicationBar; private double _previousOpacity; private Color _previousColor; private bool _isSystemTrayVisible; public bool IsPasscodeActive { get { return _passcodePanel != null && _passcodePanel.Visibility == Visibility.Visible; } } private bool _stateExists; public void OpenLockscreen() { if (_passcodePanel != null && _clientArea != null) { if (_passcodePanel.DataContext == null) { var viewModel = new LockscreenViewModel(); _passcodePanel.DataContext = viewModel; viewModel.PasscodeIncorrect += _passcodePanel.OnPasscodeIncorrect; } _passcodePanel.Visibility = Visibility.Visible; var page = Content as PhoneApplicationPage; if (page != null) { _passcodePanel.ParentPage = page; SetRootFrameBinding(); page.IsHitTestVisible = false; if (!_stateExists) { _stateExists = true; _isSystemTrayVisible = SystemTray.IsVisible; SystemTray.IsVisible = false; if (page.ApplicationBar != null) { if (_buttons.Count == 0) { foreach (var button in page.ApplicationBar.Buttons) { _buttons.Add(button); } } if (_menuItems.Count == 0) { foreach (var menuItem in page.ApplicationBar.MenuItems) { _menuItems.Add(menuItem); } } //page.ApplicationBar.IsVisible = false; page.ApplicationBar.Buttons.Clear(); page.ApplicationBar.MenuItems.Clear(); } else { page.ApplicationBar = new ApplicationBar(); //page.ApplicationBar.IsVisible = false; _removeApplicationBar = true; } _previousColor = page.ApplicationBar.BackgroundColor; _previousOpacity = page.ApplicationBar.Opacity; page.ApplicationBar.Opacity = 1.0; page.ApplicationBar.BackgroundColor = Colors.Transparent; } } _passcodePanel.FocusPasscode(); } } public void CloseLockscreen() { if (_passcodePanel != null && _clientArea != null) { _passcodePanel.Visibility = Visibility.Collapsed; var page = Content as PhoneApplicationPage; if (page != null) { RemoveRootFrameBinding(); page.IsHitTestVisible = true; _stateExists = false; SystemTray.IsVisible = _isSystemTrayVisible; if (_removeApplicationBar) { page.ApplicationBar = null; _removeApplicationBar = false; } if (page.ApplicationBar != null) { page.ApplicationBar.Buttons.Clear(); page.ApplicationBar.MenuItems.Clear(); foreach (var button in _buttons) { page.ApplicationBar.Buttons.Add(button); } foreach (var menuItem in _menuItems) { page.ApplicationBar.MenuItems.Add(menuItem); } _buttons.Clear(); _menuItems.Clear(); page.ApplicationBar.BackgroundColor = _previousColor; page.ApplicationBar.Opacity = _previousOpacity; //page.ApplicationBar.IsVisible = true; } } } } public bool IsLockScreenOpen() { return _passcodePanel != null && _passcodePanel.Visibility == Visibility.Visible; } public void OpenBlockingProgress() { if (_blockingProgress != null && _clientArea != null) { _clientArea.IsHitTestVisible = false; _blockingProgress.Visibility = Visibility.Visible; _blockingPanel.Visibility = Visibility.Visible; } } public void CloseBlockingProgress() { if (_blockingProgress != null && _clientArea != null) { _clientArea.IsHitTestVisible = true; _blockingProgress.Visibility = Visibility.Collapsed; _blockingPanel.Visibility = Visibility.Collapsed; } } public bool IsBlockingProgressOpen() { return _blockingProgress != null && _blockingProgress.Visibility == Visibility.Visible; } private ReturnToCallControl _returnToCallControl; public ContentControl CallPlaceholder { get { return _callPlaceholder; } } public void ShowCallPlaceholder(System.Action callback) { if (_callPlaceholder == null || _callPlaceholder.Content != null) { _returnToCallControl = new ReturnToCallControl(); _returnToCallControl.Tap += (o, e) => { callback.SafeInvoke(); }; return; } var returnToCallControl = new ReturnToCallControl(); returnToCallControl.Tap += (o, e) => { callback.SafeInvoke(); }; _callPlaceholder.Content = returnToCallControl; } public void HideCallPlaceholder() { _returnToCallControl = null; if (_callPlaceholder != null) { _callPlaceholder.Content = null; } } private UpdateAppControl _updateAppControl; public ContentControl BlockingPlaceholder { get { return _blockingPlaceholder; } } public void ShowBlockingPlaceholder(System.Action callback) { var updateAppControl = new UpdateAppControl(); updateAppControl.TapBottomMenu += (o, e) => { callback.SafeInvoke(); }; _blockingPlaceholder.Content = updateAppControl; _blockingPlaceholder.Visibility = Visibility.Visible; } public void HideBlockingPlaceholder() { _updateAppControl = null; if (_blockingPlaceholder != null) { _blockingPlaceholder.Content = null; _blockingPlaceholder.Visibility = Visibility.Collapsed; } } public bool IsPlayerVisible { get { return _player != null && _player.Visibility == Visibility.Visible; } } public void ShowPlayer(Brush brush) { if (_player == null) return; _player.Visibility = Visibility.Visible; _player.Background = brush; } public void HidePlayer() { _player.Visibility = Visibility.Collapsed; _player.Background = null; } } } ================================================ FILE: TelegramClient/Controls/TelegramTransitionService.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; namespace TelegramClient.Controls { /// /// Provides attached properties for navigation /// s. /// /// Preview public static class TelegramTransitionService { /// /// The /// /// for the in s. /// public static readonly DependencyProperty NavigationInTransitionProperty = DependencyProperty.RegisterAttached("NavigationInTransition", typeof(TelegramNavigationInTransition), typeof(TelegramTransitionService), null); /// /// The /// /// for the in s. /// public static readonly DependencyProperty NavigationOutTransitionProperty = DependencyProperty.RegisterAttached("NavigationOutTransition", typeof(TelegramNavigationOutTransition), typeof(TelegramTransitionService), null); /// /// Gets the /// s /// of /// /// for a /// . /// /// The . /// The public static TelegramNavigationInTransition GetNavigationInTransition(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } return (TelegramNavigationInTransition)element.GetValue(NavigationInTransitionProperty); } /// /// Gets the /// s /// of /// /// for a /// . /// /// The . /// The public static TelegramNavigationOutTransition GetNavigationOutTransition(UIElement element) { if (element == null) { throw new ArgumentNullException("element"); } return (TelegramNavigationOutTransition)element.GetValue(NavigationOutTransitionProperty); } /// /// Sets a /// /// to /// /// for a /// . /// /// The . /// The . /// The public static void SetNavigationInTransition(UIElement element, TelegramNavigationInTransition value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(NavigationInTransitionProperty, value); } /// /// Sets a /// s /// to /// /// for a /// . /// /// The . /// The . /// The public static void SetNavigationOutTransition(UIElement element, TelegramNavigationOutTransition value) { if (element == null) { throw new ArgumentNullException("element"); } element.SetValue(NavigationOutTransitionProperty, value); } } } ================================================ FILE: TelegramClient/Controls/TelegramTurnstileTransition.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Windows; using System.Windows.Media; using System.Windows.Media.Animation; using Microsoft.Phone.Controls; namespace TelegramClient.Controls { public class TelegramTurnstileTransition : TransitionElement { public static readonly DependencyProperty ModeProperty = DependencyProperty.Register("Mode", typeof (TurnstileTransitionMode), typeof (TelegramTurnstileTransition), null); public TurnstileTransitionMode Mode { get { return (TurnstileTransitionMode)GetValue(ModeProperty); } set { SetValue(ModeProperty, value); } } static TelegramTurnstileTransition() { } public override ITransition GetTransition(UIElement element) { return new Transition(element, TelegramTurnstileAnimations.GetAnimation(element, Mode)); } } public static class TelegramTurnstileAnimations { public static Storyboard GetAnimation(UIElement element, TurnstileTransitionMode mode) { if (!(element.Projection is PlaneProjection)) { element.Projection = new PlaneProjection { CenterOfRotationX = 0.0 }; } if (mode == TurnstileTransitionMode.ForwardIn) { return ForwardIn(element); } if (mode == TurnstileTransitionMode.ForwardOut) { return ForwardOut(element); } if (mode == TurnstileTransitionMode.BackwardIn) { return BackwardIn(element); } return BackwardOut(element); } public static Storyboard ForwardIn(UIElement element) { var storyboard = new Storyboard(); var rotationYAnimation = new DoubleAnimationUsingKeyFrames(); rotationYAnimation.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = -80 }); rotationYAnimation.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.35), Value = 0, KeySpline = new KeySpline { ControlPoint1 = new Point(0.10000000149011612, 0.89999997615811421), ControlPoint2 = new Point(0.20000000298023224, 1) } }); Storyboard.SetTargetProperty(rotationYAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); storyboard.Children.Add(rotationYAnimation); var globalOffsetXAnimation = new DoubleAnimationUsingKeyFrames(); globalOffsetXAnimation.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 200 }); globalOffsetXAnimation.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.35), Value = 0, KeySpline = new KeySpline { ControlPoint1 = new Point(0.10000000149011612, 0.89999997615811421), ControlPoint2 = new Point(0.20000000298023224, 1) } }); Storyboard.SetTargetProperty(globalOffsetXAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.LocalOffsetX)")); storyboard.Children.Add(globalOffsetXAnimation); var opacityAnimation = new DoubleAnimationUsingKeyFrames(); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.01), Value = 1 }); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("(UIElement.Opacity)")); storyboard.Children.Add(opacityAnimation); Storyboard.SetTarget(storyboard, element); return storyboard; } public static Storyboard ForwardOut(UIElement element) { var storyboard = new Storyboard(); var rotationYAnimation = new DoubleAnimationUsingKeyFrames(); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.22), Value = 30, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 5 } }); Storyboard.SetTargetProperty(rotationYAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); storyboard.Children.Add(rotationYAnimation); var globalOffsetXAnimation = new DoubleAnimationUsingKeyFrames(); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.22), Value = -100, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 5 } }); Storyboard.SetTargetProperty(globalOffsetXAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.GlobalOffsetX)")); storyboard.Children.Add(globalOffsetXAnimation); var opacityAnimation = new DoubleAnimationUsingKeyFrames(); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 1 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.219), Value = 1 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.22), Value = 0 }); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("(UIElement.Opacity)")); storyboard.Children.Add(opacityAnimation); Storyboard.SetTarget(storyboard, element); return storyboard; } public static Storyboard BackwardIn(UIElement element) { var storyboard = new Storyboard(); var rotationYAnimation = new DoubleAnimationUsingKeyFrames(); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 50 }); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.35), Value = 0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6 } }); Storyboard.SetTargetProperty(rotationYAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); storyboard.Children.Add(rotationYAnimation); var globalOffsetXAnimation = new DoubleAnimationUsingKeyFrames(); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = -60 }); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.35), Value = 0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6 } }); Storyboard.SetTargetProperty(globalOffsetXAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.GlobalOffsetX)")); storyboard.Children.Add(globalOffsetXAnimation); var opacityAnimation = new DoubleAnimationUsingKeyFrames(); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.001), Value = 1 }); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("(UIElement.Opacity)")); storyboard.Children.Add(opacityAnimation); Storyboard.SetTarget(storyboard, element); return storyboard; } public static Storyboard BackwardOut(UIElement element) { var storyboard = new Storyboard(); var rotationYAnimation = new DoubleAnimationUsingKeyFrames(); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); rotationYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.2), Value = -60, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 5 } }); Storyboard.SetTargetProperty(rotationYAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); storyboard.Children.Add(rotationYAnimation); var globalOffsetXAnimation = new DoubleAnimationUsingKeyFrames(); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 0 }); globalOffsetXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.2), Value = 60, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 6 } }); Storyboard.SetTargetProperty(globalOffsetXAnimation, new PropertyPath("(UIElement.Projection).(PlaneProjection.GlobalOffsetX)")); storyboard.Children.Add(globalOffsetXAnimation); var opacityAnimation = new DoubleAnimationUsingKeyFrames(); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.0), Value = 1 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.19), Value = 1 }); opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame { KeyTime = TimeSpan.FromSeconds(0.2), Value = 0 }); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("(UIElement.Opacity)")); storyboard.Children.Add(opacityAnimation); Storyboard.SetTarget(storyboard, element); return storyboard; } } } ================================================ FILE: TelegramClient/Controls/TestScrollableTextBlock.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System.Windows; using System.Windows.Controls; namespace Telegram.EmojiPanel { public class TestScrollableTextBlock : Control { private StackPanel stackPanel; private TextBlock measureTxt; public TestScrollableTextBlock() { DefaultStyleKey = typeof(TestScrollableTextBlock); } public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(TestScrollableTextBlock), new PropertyMetadata("", OnTextPropertyChanged)); public static readonly DependencyProperty LineHeightProperty = DependencyProperty.Register( "LineHeight", typeof(double), typeof(TestScrollableTextBlock), null); public string Text { get { return (string)GetValue(TextProperty); } set { SetValue(TextProperty, value); } } private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //TestScrollableTextBlock source = (TestScrollableTextBlock)d; //string value = (string)e.NewValue; //source.ParseText(value); } public override void OnApplyTemplate() { stackPanel = GetTemplateChild("StackPanel") as StackPanel; ParseText(Text); base.OnApplyTemplate(); } private void ParseText(string value) { if (value == null) { value = ""; } if (this.stackPanel == null) { return; } // Clear previous TextBlocks this.stackPanel.Children.Clear(); bool fitIn2000Pixels = CheckFitInMaxRenderHeight(value); if (fitIn2000Pixels) { RichTextBox textBlock = this.GetTextBlock(); BrowserNavigationService.SetText(textBlock, value); this.stackPanel.Children.Add(textBlock); } else { ParseLineExtended(value); } } private readonly int MAX_STR_LENGTH = 1100; private void ParseLineExtended(string allText) { if (string.IsNullOrEmpty(allText)) return; int cutIndex = MAX_STR_LENGTH; if (cutIndex >= allText.Length) cutIndex = allText.Length - 1; var endOfSentenceIndAfterCut = allText.IndexOf(".", cutIndex); if (endOfSentenceIndAfterCut >= 0 && endOfSentenceIndAfterCut - cutIndex < 200) { cutIndex = endOfSentenceIndAfterCut; } else { var whiteSpaceIndAfterCut = allText.IndexOf(' ', cutIndex); if (whiteSpaceIndAfterCut >= 0 && whiteSpaceIndAfterCut - cutIndex < 100) { cutIndex = whiteSpaceIndAfterCut; } } // add all whitespaces before cut while (cutIndex + 1 < allText.Length && allText[cutIndex + 1] == ' ') { cutIndex++; } string leftSide = allText.Substring(0, cutIndex + 1); RichTextBox textBlock = this.GetTextBlock(); BrowserNavigationService.SetText(textBlock, leftSide); this.stackPanel.Children.Add(textBlock); allText = allText.Substring(cutIndex + 1); if (allText.Length > 0) { ParseLineExtended(allText); } } private bool CheckFitInMaxRenderHeight(string value) { return value.Length <= MAX_STR_LENGTH; } private RichTextBox GetTextBlock() { RichTextBox textBlock = new RichTextBox(); textBlock.TextWrapping = TextWrapping.Wrap; textBlock.IsReadOnly = true; textBlock.FontSize = this.FontSize; textBlock.FontFamily = this.FontFamily; textBlock.HorizontalContentAlignment = this.HorizontalContentAlignment; textBlock.Foreground = Foreground; textBlock.Padding = new Thickness(-12, 0, 0, 0); return textBlock; } } } ================================================ FILE: TelegramClient/Controls/TransitionFrame.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Diagnostics; using System.Reflection; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; using Microsoft.Phone.Controls; namespace TelegramClient.Controls { /// /// Enables navigation transitions for /// s. /// /// Preview [TemplatePart(Name = FirstTemplatePartName, Type = typeof(ContentPresenter))] [TemplatePart(Name = SecondTemplatePartName, Type = typeof(ContentPresenter))] public class TransitionFrame : PhoneApplicationFrame { #region Constants and Statics /// /// The new /// /// template part name. /// private const string FirstTemplatePartName = "FirstContentPresenter"; /// /// The old /// /// template part name. /// private const string SecondTemplatePartName = "SecondContentPresenter"; /// /// A single shared instance for setting BitmapCache on a visual. /// internal static readonly CacheMode BitmapCacheMode = new BitmapCache(); #endregion #region Template Parts /// /// The first . /// private ContentPresenter _firstContentPresenter; /// /// The second . /// private ContentPresenter _secondContentPresenter; /// /// The new . /// private ContentPresenter _newContentPresenter; /// /// The old . /// private ContentPresenter _oldContentPresenter; #endregion /// /// Indicates whether a navigation is forward. /// private bool _isForwardNavigation; /// /// Determines whether to set the new content to the first or second /// . /// private bool _useFirstAsNew; /// /// A value indicating whether the old transition has completed and the /// new transition can begin. /// private bool _readyToTransitionToNewContent; /// /// A value indicating whether the new content has been loaded and the /// new transition can begin. /// private bool _contentReady; /// /// A value indicating whether the exit transition is currently being performed. /// private bool _performingExitTransition; /// /// A value indicating whether the navigation is cancelled. /// private bool _navigationStopped; /// /// The transition to use to move in new content once the old transition /// is complete and ready for movement. /// private ITransition _storedNewTransition; /// /// The stored NavigationIn transition instance to use once the old /// transition is complete and ready for movement. /// private TelegramNavigationInTransition _storedNavigationInTransition; /// /// The transition to use to complete the old transition. /// private ITransition _storedOldTransition; /// /// The stored NavigationOut transition instance. /// private TelegramNavigationOutTransition _storedNavigationOutTransition; /// /// Initialzies a new instance of the TransitionFrame class. /// public TransitionFrame() : base() { DefaultStyleKey = typeof(TransitionFrame); Navigating += OnNavigating; NavigationStopped += OnNavigationStopped; NavigationFailed += OnNavigationFailed; } private void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { } /// /// Flips the logical content presenters to prepare for the next visual /// transition. /// private void FlipPresenters() { _newContentPresenter = _useFirstAsNew ? _firstContentPresenter : _secondContentPresenter; _oldContentPresenter = _useFirstAsNew ? _secondContentPresenter : _firstContentPresenter; _useFirstAsNew = !_useFirstAsNew; } /// /// Handles the Navigating event of the frame, the immediate way to /// begin a transition out before the new page has loaded or had its /// layout pass. /// /// The source object. /// The event arguments. private void OnNavigating(object sender, NavigatingCancelEventArgs e) { //if (e.NavigationMode == NavigationMode.Reset // || e.Uri.OriginalString == "app://external/" // || e.Uri.OriginalString.StartsWith("/Protocol?encodedLaunchUri")) //|| e.Uri.OriginalString.Contains("msg_id")) // return; // If the current application is not the origin // and destination of the navigation, ignore it. // e.g. do not play a transition when the // application gets deactivated because the shell // will animate the frame out automatically. if (!e.IsNavigationInitiator) { return; } _isForwardNavigation = e.NavigationMode != NavigationMode.Back; var oldElement = Content as UIElement; if (oldElement == null) { return; } EnsureLastTransitionIsComplete(); FlipPresenters(); TransitionElement oldTransitionElement = null; TelegramNavigationOutTransition navigationOutTransition = null; ITransition oldTransition = null; if (!e.Uri.OriginalString.Contains("msg_id") && !e.Uri.OriginalString.Contains("SecondaryTile") && !e.Uri.OriginalString.StartsWith("/Protocol?encodedLaunchUri") && !e.Uri.OriginalString.Contains("rndParam") && !(e.Uri.OriginalString == "/Views/ShellView.xaml" && e.NavigationMode == NavigationMode.New) && !(e.Uri.OriginalString.StartsWith("/Views/Additional/SettingsView.xaml?Action=DC_UPDATE"))) { navigationOutTransition = TelegramTransitionService.GetNavigationOutTransition(oldElement); } if (navigationOutTransition != null) { oldTransitionElement = _isForwardNavigation ? navigationOutTransition.Forward : navigationOutTransition.Backward; } if (oldTransitionElement != null) { oldTransition = oldTransitionElement.GetTransition(oldElement); } if (oldTransition != null) { EnsureStoppedTransition(oldTransition); _storedNavigationOutTransition = navigationOutTransition; _storedOldTransition = oldTransition; oldTransition.Completed += OnExitTransitionCompleted; _performingExitTransition = true; PerformTransition(navigationOutTransition, _oldContentPresenter, oldTransition); PrepareContentPresenterForCompositor(_oldContentPresenter); } else { _readyToTransitionToNewContent = true; } } /// /// Handles the NavigationStopped event of the frame. Set a value indicating /// that the navigation is cancelled. /// private void OnNavigationStopped(object sender, NavigationEventArgs e) { _navigationStopped = true; } /// /// Stops the last navigation transition if it's active and a new navigation occurs. /// private void EnsureLastTransitionIsComplete() { _readyToTransitionToNewContent = false; _contentReady = false; if (_performingExitTransition) { Debug.Assert(_storedOldTransition != null && _storedNavigationOutTransition != null); // If the app calls GoBack on NavigatedTo, we want the old content to be null // because you can't have the same content in two spots on the visual tree. if (_oldContentPresenter != null) { _oldContentPresenter.Content = null; } if (_storedOldTransition != null) { _storedOldTransition.Stop(); } _storedNavigationOutTransition = null; _storedOldTransition = null; if (_storedNewTransition != null) { _storedNewTransition.Stop(); _storedNewTransition = null; _storedNavigationInTransition = null; } _performingExitTransition = false; } } /// /// Handles the completion of the exit transition, automatically /// continuing to bring in the new element's transition as well if it is /// ready. /// /// The source object. /// The event arguments. private void OnExitTransitionCompleted(object sender, System.EventArgs e) { _readyToTransitionToNewContent = true; _performingExitTransition = false; if (_navigationStopped) { // Restore the old content presenter's interactivity if the navigation is cancelled. CompleteTransition(_storedNavigationOutTransition, _oldContentPresenter, _storedOldTransition); _navigationStopped = false; } else { CompleteTransition(_storedNavigationOutTransition, /*_oldContentPresenter*/ null, _storedOldTransition); } _storedNavigationOutTransition = null; _storedOldTransition = null; if (_contentReady) { ITransition newTransition = _storedNewTransition; TelegramNavigationInTransition navigationInTransition = _storedNavigationInTransition; _storedNewTransition = null; _storedNavigationInTransition = null; TransitionNewContent(newTransition, navigationInTransition); } } /// /// When overridden in a derived class, is invoked whenever application /// code or internal processes (such as a rebuilding layout pass) call /// . /// In simplest terms, this means the method is called just before a UI /// element displays in an application. /// public override void OnApplyTemplate() { base.OnApplyTemplate(); _firstContentPresenter = GetTemplateChild(FirstTemplatePartName) as ContentPresenter; _secondContentPresenter = GetTemplateChild(SecondTemplatePartName) as ContentPresenter; _newContentPresenter = _secondContentPresenter; _oldContentPresenter = _firstContentPresenter; _useFirstAsNew = true; _readyToTransitionToNewContent = true; if (Content != null) { OnContentChanged(null, Content); } } /// /// Called when the value of the /// /// property changes. /// /// The old . /// The new . protected override void OnContentChanged(object oldContent, object newContent) { base.OnContentChanged(oldContent, newContent); _contentReady = true; UIElement oldElement = oldContent as UIElement; UIElement newElement = newContent as UIElement; // Require the appropriate template parts plus a new element to // transition to. if (_firstContentPresenter == null || _secondContentPresenter == null || newElement == null) { return; } TelegramNavigationInTransition navigationInTransition = null; ITransition newTransition = null; if (newElement != null) { navigationInTransition = TelegramTransitionService.GetNavigationInTransition(newElement); TransitionElement newTransitionElement = null; if (navigationInTransition != null) { newTransitionElement = _isForwardNavigation ? navigationInTransition.Forward : navigationInTransition.Backward; } if (newTransitionElement != null) { newElement.UpdateLayout(); newTransition = newTransitionElement.GetTransition(newElement); PrepareContentPresenterForCompositor(_newContentPresenter); } } _newContentPresenter.Opacity = 0; _newContentPresenter.Visibility = Visibility.Visible; _newContentPresenter.Content = newElement; _oldContentPresenter.Opacity = 1; _oldContentPresenter.Visibility = Visibility.Visible; _oldContentPresenter.Content = oldElement; if (_readyToTransitionToNewContent) { TransitionNewContent(newTransition, navigationInTransition); } else { _storedNewTransition = newTransition; _storedNavigationInTransition = navigationInTransition; } } /// /// Transitions the new . /// /// The /// for the new . /// The /// for the new . private void TransitionNewContent(ITransition newTransition, TelegramNavigationInTransition navigationInTransition) { if (_oldContentPresenter != null) { _oldContentPresenter.Visibility = Visibility.Collapsed; _oldContentPresenter.Content = null; } if (null == newTransition) { RestoreContentPresenterInteractivity(_newContentPresenter); return; } EnsureStoppedTransition(newTransition); newTransition.Completed += delegate { CompleteTransition(navigationInTransition, _newContentPresenter, newTransition); }; _readyToTransitionToNewContent = false; _storedNavigationInTransition = null; _storedNewTransition = null; PerformTransition(navigationInTransition, _newContentPresenter, newTransition); } /// /// This checks to make sure that, if the transition not be in the clock /// state of Stopped, that is will be stopped. /// /// The transition instance. private static void EnsureStoppedTransition(ITransition transition) { if (transition != null && transition.GetCurrentState() != ClockState.Stopped) { transition.Stop(); } } /// /// Performs a transition when given the appropriate components, /// includes calling the appropriate start event and ensuring opacity /// on the content presenter. /// /// The navigation transition. /// The content presenter. /// The transition instance. private static void PerformTransition(TelegramNavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition) { if (navigationTransition != null) { navigationTransition.OnBeginTransition(); //var dynMethod = navigationTransition.GetType().GetMethod("OnBeginTransition", BindingFlags.NonPublic | BindingFlags.Instance); //dynMethod.Invoke(navigationTransition, new object[] { }); } if (presenter != null && presenter.Opacity != 1) { presenter.Opacity = 1; } if (transition != null) { transition.Begin(); } } /// /// Completes a transition operation by stopping it, restoring /// interactivity, and then firing the OnEndTransition event. /// /// The navigation transition. /// The content presenter. /// The transition instance. private static void CompleteTransition(TelegramNavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition) { if (transition != null) { transition.Stop(); } RestoreContentPresenterInteractivity(presenter); if (navigationTransition != null) { navigationTransition.OnEndTransition(); //var dynMethod = navigationTransition.GetType().GetMethod("OnEndTransition", BindingFlags.NonPublic | BindingFlags.Instance); //dynMethod.Invoke(navigationTransition, new object[] { }); } } /// /// Updates the content presenter for off-thread compositing for the /// transition animation. Also disables interactivity on it to prevent /// accidental touches. /// /// The content presenter instance. /// A value indicating whether to apply /// a bitmap cache. private static void PrepareContentPresenterForCompositor(ContentPresenter presenter, bool applyBitmapCache = true) { if (presenter != null) { if (applyBitmapCache) { presenter.CacheMode = BitmapCacheMode; } presenter.IsHitTestVisible = false; } } /// /// Restores the interactivity for the presenter post-animation, also /// removes the BitmapCache value. /// /// The content presenter instance. private static void RestoreContentPresenterInteractivity(ContentPresenter presenter) { if (presenter != null) { presenter.CacheMode = null; if (presenter.Opacity != 1) { presenter.Opacity = 1; } presenter.IsHitTestVisible = true; } } } } ================================================ FILE: TelegramClient/Converters/BackgroundImageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Windows; using System.Windows.Data; using System.Windows.Media.Imaging; using Telegram.Api.TL; using TelegramClient.ViewModels.Additional; namespace TelegramClient.Converters { public class BackgroundBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var bagroundItem = value as BackgroundItem; if (bagroundItem == null) return null; if (string.Equals(bagroundItem.Name, Constants.LibraryBackgroundString)) { return Application.Current.Resources["PhoneAccentBrush"]; } return Application.Current.Resources["PhoneChromeBrush"]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class BackgroundImageConverter : IValueConverter { private BitmapCreateOptions _createOptions = BitmapCreateOptions.BackgroundCreation; public BitmapCreateOptions CreateOptions { get { return _createOptions; } set { _createOptions = value; } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var bagroundItem = value as BackgroundItem; if (bagroundItem == null) return null; if (string.Equals(bagroundItem.Name, Constants.LibraryBackgroundString)) { var fileName = bagroundItem.IsoFileName; if (!string.IsNullOrEmpty(fileName)) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { return null; } BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var b = new BitmapImage(); b.CreateOptions = CreateOptions; b.SetSource(stream); imageSource = b; } } catch (Exception) { return null; } return imageSource; } } return bagroundItem.SourceString; } if (bagroundItem.Name.StartsWith("telegram", StringComparison.OrdinalIgnoreCase)) { var fileName = bagroundItem.IsoFileName; if (!string.IsNullOrEmpty(fileName)) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var b = new BitmapImage(); b.CreateOptions = CreateOptions; b.SetSource(stream); imageSource = b; } return imageSource; } catch (Exception) { return null; } } } } } if (bagroundItem.Wallpaper != null) { var width = 99.0; double result; if (Double.TryParse((string)parameter, out result)) { width = result; } var size = GetPhotoSize(bagroundItem.Wallpaper.Sizes, width); if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnOrEnqueueImage(null, false, location, bagroundItem.Wallpaper, size.Size, null); } } } var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; var image = new BitmapImage(); image.CreateOptions = CreateOptions; image.UriSource = isLightTheme? new Uri("/Images/W10M/default.png", UriKind.Relative) : null; return image; } public static TLPhotoSize GetPhotoSize(TLVector photoSizes, double width) { TLPhotoSize size = null; var sizes = photoSizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } return size; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/BooleanToValueConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class BooleanToValueConverter : IValueConverter { public object TrueValue { get; set; } public object FalseValue { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (bool)value ? TrueValue : FalseValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/BooleanToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class BooleanToVisibilityConverter : IValueConverter { #region Implementation of IValueConverter /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || !(value is bool)) return Visibility.Collapsed; var result = (bool) value; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { result = !result; } return result ? Visibility.Visible : Visibility.Collapsed; } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } } ================================================ FILE: TelegramClient/Converters/ChatForbiddenToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { } ================================================ FILE: TelegramClient/Converters/ChatToMaxHeight.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class ChatToMaxHeight : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (bool) value ? 22.0 : 44.0; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ChatToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class ChatToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isChat = value is TLChatBase; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isChat = !isChat; } return isChat ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/CountToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public enum ComparandType { MoreThan, Equals, LessThan } public class CountToVisibilityConverter : IValueConverter { public ComparandType Type { get; set; } /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is int) || parameter == null) return Visibility.Collapsed; try { var count = int.Parse(parameter.ToString()); if (Type == ComparandType.MoreThan) { return (int)value > count ? Visibility.Visible : Visibility.Collapsed; } if (Type == ComparandType.LessThan) { return (int)value < count ? Visibility.Visible : Visibility.Collapsed; } return (int)value == count ? Visibility.Visible : Visibility.Collapsed; } catch (Exception) { return Visibility.Collapsed; } } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/DebugVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class DebugVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { #if DEBUG return Visibility.Visible; #endif return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/DefaultPhotoConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // //#define PHOTO_CACHE_DISABLED using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Imaging; using Caliburn.Micro; using Microsoft.Phone; using Telegram.Api; using Telegram.Api.Extensions; using Telegram.Api.Services.FileManager; using Telegram.Api.TL; using TelegramClient.Helpers; using TelegramClient.Services; using TelegramClient.ViewModels; using TelegramClient.ViewModels.Dialogs; using TelegramClient.Views.Dialogs; using TelegramClient.Views.Media; #if WP81 using Windows.Graphics.Imaging; #endif #if WP8 using TelegramClient_WebP.LibWebP; #endif namespace TelegramClient.Converters { public class InlineBotResultPhotoConverter : IValueConverter { public static BitmapImage ReturnOrEnqueueImage(TLFileLocation location, TLBotInlineResultBase owner, TLInt fileSize) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { if (fileSize != null) { Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => { var fileManager = IoC.Get(); fileManager.DownloadFile(location, owner, fileSize, item => Execute.BeginOnUIThread(() => { owner.NotifyOfPropertyChange(() => owner.Self); })); }); } } else { BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.SetSource(stream); imageSource = image; } } catch (Exception) { return null; } return imageSource; } } return null; } public static TLPhotoSize GetPhotoSize(TLPhoto photo, object parameter = null) { var width = 311.0; double result; if (Double.TryParse((string)parameter, out result)) { width = result; } TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } return size; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var resultMedia = value as TLBotInlineMediaResult; if (resultMedia != null) { var photo = resultMedia.Photo as TLPhoto; if (photo != null) { var size = GetPhotoSize(photo, parameter); if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(location, resultMedia, size.Size); } } } var document = resultMedia.Document as TLDocument; if (document != null) { var cachedSize = document.Thumb as TLPhotoCachedSize; if (cachedSize != null) { BitmapImage imageSource; try { var image = new BitmapImage(); image.SetSource(new MemoryStream(cachedSize.Bytes.Data)); imageSource = image; } catch (Exception) { return null; } return imageSource; } var size = document.Thumb as TLPhotoSize; if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(location, resultMedia, size.Size); } } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MediaPhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var photo = value as TLPhoto; if (photo != null) { var imageSource = GetImageSource(photo, 311.0); if (imageSource != null) return imageSource; imageSource = GetImageSource(photo, 800.0); if (imageSource != null) return imageSource; } return null; } private static object GetImageSource(TLPhoto photo, double width) { TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.SetSource(stream); imageSource = image; } } catch (Exception) { return null; } return imageSource; } } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var timer = Stopwatch.StartNew(); var photoSize = value as TLPhotoSize; if (photoSize != null) { var location = photoSize.Location as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnImage(timer, location); } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ProfileSmallPhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var timer = Stopwatch.StartNew(); var userProfilePhoto = value as TLUserProfilePhoto; if (userProfilePhoto != null) { var location = userProfilePhoto.PhotoSmall as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnOrEnqueueImage(timer, false, location, userProfilePhoto, new TLInt(0), null, true); } } var chatPhoto = value as TLChatPhoto; if (chatPhoto != null) { var location = chatPhoto.PhotoSmall as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnOrEnqueueImage(timer, false, location, chatPhoto, new TLInt(0), null, true); } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ProfileBigPhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var timer = Stopwatch.StartNew(); var userProfilePhoto = value as TLUserProfilePhoto; if (userProfilePhoto != null) { var location = userProfilePhoto.PhotoBig as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnOrEnqueueImage(timer, false, location, userProfilePhoto, new TLInt(0), null, true, result => Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { userProfilePhoto.NotifyOfPropertyChange(() => userProfilePhoto.Self); })); } } var chatPhoto = value as TLChatPhoto; if (chatPhoto != null) { var location = chatPhoto.PhotoBig as TLFileLocation; if (location != null) { return DefaultPhotoConverter.ReturnOrEnqueueImage(timer, false, location, chatPhoto, new TLInt(0), null, true, result => Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { chatPhoto.NotifyOfPropertyChange(() => chatPhoto.Self); })); } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DefaultPhotoConverter : IValueConverter { public bool CheckChatSettings { get; set; } public static BitmapImage ReturnOrEnqueueImage(bool checkChatSettings, TLEncryptedFile location, TLObject owner, TLDecryptedMessageMediaBase mediaPhoto, bool isBackground) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.Id, location.DCId, location.AccessHash); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { TLObject with = null; if (checkChatSettings) { var navigationService = IoC.Get(); var dialogDetailsView = navigationService.CurrentContent as SecretDialogDetailsView; if (dialogDetailsView != null) { var dialogDetailsViewModel = dialogDetailsView.DataContext as SecretDialogDetailsViewModel; if (dialogDetailsViewModel != null) { with = dialogDetailsViewModel.With; } } } var stateService = IoC.Get(); var chatSettings = stateService.GetChatSettings(); if (chatSettings != null) { if (with is TLUserBase && !chatSettings.AutoDownloadPhotoPrivateChats) { return null; } if (with is TLChatBase && !chatSettings.AutoDownloadPhotoGroups) { return null; } } if (mediaPhoto != null) mediaPhoto.DownloadingProgress = 0.01; Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => { var fileManager = IoC.Get(); fileManager.DownloadFile(location, owner); }); } else { BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); if (isBackground) { image.CreateOptions |= BitmapCreateOptions.BackgroundCreation; } image.SetSource(stream); imageSource = image; } } catch (Exception) { return null; } return imageSource; } } return null; } public static BitmapImage ReturnImage(Stopwatch timer, TLFileLocation location) { //return null; var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { } else { BitmapImage imageSource; try { //using (var stream = new IsolatedStorageFileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, store)) //{ // stream.Seek(0, SeekOrigin.Begin); // var image = new BitmapImage(); // image.SetSource(stream); // imageSource = image; //} using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.CreateOptions = BitmapCreateOptions.DelayCreation | BitmapCreateOptions.BackgroundCreation; image.SetSource(stream); imageSource = image; } } catch (Exception ex) { Telegram.Api.Helpers.Execute.ShowDebugMessage(ex.ToString()); return null; } //TLUtils.WritePerformance("DefaultPhotoConverter time: " + timer.Elapsed); return imageSource; } } return null; } #if !PHOTO_CACHE_DISABLED private static LRUCache> _photoCache = new LRUCache>(100); #endif public static BitmapImage ReturnOrEnqueueImage(Stopwatch timer, bool checkChatSettings, TLFileLocation location, TLObject owner, TLInt fileSize, TLMessageMediaPhoto mediaPhoto, bool isBackground = false, Action callback = null) { var fileName = string.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { if (fileSize != null) { TLObject with = null; if (checkChatSettings) { var navigationService = IoC.Get(); var dialogDetailsView = navigationService.CurrentContent as DialogDetailsView; if (dialogDetailsView != null) { var dialogDetailsViewModel = dialogDetailsView.DataContext as DialogDetailsViewModel; if (dialogDetailsViewModel != null) { with = dialogDetailsViewModel.With; } } } var stateService = IoC.Get(); var chatSettings = stateService.GetChatSettings(); if (chatSettings != null) { if (with is TLUserBase && !chatSettings.AutoDownloadPhotoPrivateChats) { return null; } if (with is TLChatBase && !chatSettings.AutoDownloadPhotoGroups) { return null; } } if (location.DCId.Value == 0) return null; if (mediaPhoto != null) mediaPhoto.DownloadingProgress = 0.01; Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => { var fileManager = IoC.Get(); fileManager.DownloadFile(location, owner, fileSize, callback); }); } } else { BitmapImage imageSource; try { BitmapImage image; #if !PHOTO_CACHE_DISABLED WeakReference reference; if (_photoCache.TryGetValue(fileName, out reference) && reference.TryGetTarget(out image)) { if (image.PixelHeight > 0 || image.PixelWidth > 0) { return image; } } #endif using (IsolatedStorageFileStream stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); image = new BitmapImage(); if (isBackground) { image.CreateOptions |= BitmapCreateOptions.BackgroundCreation; } image.SetSource(stream); #if !PHOTO_CACHE_DISABLED if (image.CreateOptions.HasFlag(BitmapCreateOptions.BackgroundCreation)) { var wrapper = new BitmapImageWrapper(fileName, image); wrapper.Subscribe(bi => { _photoCache[fileName] = new WeakReference(image); }); } else { _photoCache[fileName] = new WeakReference(image); } #endif imageSource = image; } } catch (Exception ex) { Telegram.Api.Helpers.Execute.ShowDebugMessage(ex.ToString()); return null; } return imageSource; } } return null; } #if !PHOTO_CACHE_DISABLED public static void InvalidateCacheItem(string key) { _photoCache.Remove(key); } #endif #region Profile Photo #if !PHOTO_CACHE_DISABLED private static readonly LRUCache> _cachedSources = new LRUCache>(200); #else private static readonly Dictionary _cachedSources = new Dictionary(); #endif public static BitmapSource ReturnOrEnqueueProfileImage(Stopwatch timer, TLFileLocation location, TLObject owner, TLInt fileSize, bool isBackground = false) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); #if !PHOTO_CACHE_DISABLED BitmapImage bitmapImage; WeakReference weakImageSource; if (_cachedSources.TryGetValue(fileName, out weakImageSource) && weakImageSource.TryGetTarget(out bitmapImage)) { return bitmapImage; } #else BitmapSource bitmapImage; WeakReference weakImageSource; if (_cachedSources.TryGetValue(fileName, out weakImageSource)) { if (weakImageSource.IsAlive) { bitmapImage = weakImageSource.Target as BitmapSource; //System.Diagnostics.Debug.WriteLine("DefaultPhotoConverter weakImageSource return elapsed=" + ShellViewModel.Timer.Elapsed); return bitmapImage; } } #endif using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { if (fileSize != null) { var fileManager = IoC.Get(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => { fileManager.DownloadFile(location, owner, fileSize); }); } } else { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); if (isBackground) { image.CreateOptions = BitmapCreateOptions.DelayCreation | BitmapCreateOptions.BackgroundCreation; } image.SetSource(stream); bitmapImage = image; #if !PHOTO_CACHE_DISABLED if (image.CreateOptions.HasFlag(BitmapCreateOptions.BackgroundCreation)) { var wrapper = new BitmapImageWrapper(fileName, bitmapImage); wrapper.Subscribe(bi => { _cachedSources[fileName] = new WeakReference(image); }); } else { _cachedSources[fileName] = new WeakReference(image); } #else _cachedSources[fileName] = new WeakReference(bitmapImage); #endif } } catch (Exception) { return null; } return bitmapImage; } } return null; } #endregion #if WP8 private static readonly Dictionary> _cachedWebPImages = new Dictionary>(); private static ImageSource DecodeWebPImage(string cacheKey, byte[] buffer, System.Action faultCallback = null) { try { WeakReference reference; if (_cachedWebPImages.TryGetValue(cacheKey, out reference)) { WriteableBitmap cachedBitmap; if (reference.TryGetTarget(out cachedBitmap)) { return cachedBitmap; } } var decoder = new WebPDecoder(); int width = 0, height = 0; byte[] decoded = null; //try //{ if (buffer == null) { Telegram.Logs.Log.Write("DefaultPhotoConverter.DecodeWebPImage buffer=null"); } else { //buffer = null; decoded = decoder.DecodeRgbA(buffer, out width, out height); } //} //catch (Exception ex) //{ // faultCallback.SafeInvoke(); // // не получается сконвертировать, битый файл // //store.DeleteFile(documentLocalFileName); // Telegram.Api.Helpers.Execute.ShowDebugMessage("WebPDecoder.DecodeRgbA ex " + ex); //} if (decoded == null) return null; var wb = new WriteableBitmap(width, height); for (var i = 0; i < decoded.Length / 4; i++) { int r = decoded[4 * i]; int g = decoded[4 * i + 1]; int b = decoded[4 * i + 2]; int a = decoded[4 * i + 3]; a <<= 24; r <<= 16; g <<= 8; int iPixel = a | r | g | b; wb.Pixels[i] = iPixel; } _cachedWebPImages[cacheKey] = new WeakReference(wb); return wb; } catch (Exception ex) { TLUtils.WriteException("WebPDecode ex ", ex); //Telegram.Api.Helpers.Execute.BeginOnThreadPool(faultCallback); return null; } return null; } public static ImageSource ReturnOrEnqueueStickerPreview(TLFileLocation location, TLObject owner, TLInt fileSize) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(fileName)) { if (fileSize != null) { var fileManager = IoC.Get(); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => { fileManager.DownloadFile(location, owner, fileSize); }); } } else { byte[] buffer; using (var file = store.OpenFile(fileName, FileMode.Open)) { buffer = new byte[file.Length]; file.Read(buffer, 0, buffer.Length); } return DecodeWebPImage(fileName, buffer, () => { using (var localStore = IsolatedStorageFile.GetUserStoreForApplication()) { localStore.DeleteFile(fileName); } }); } } return null; } private static ImageSource ReturnOrEnqueueSticker(TLDecryptedMessageMediaExternalDocument document, TLObject owner) { if (document == null) return null; var documentLocalFileName = document.GetFileName(); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(documentLocalFileName)) { // 1. download full size IoC.Get().DownloadFileAsync(document.FileName, document.DCId, document.ToInputFileLocation(), owner, document.Size, progress => { }); // 2. download preview var thumbCachedSize = document.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var fileName = "cached" + document.GetFileName(); var buffer = thumbCachedSize.Bytes.Data; if (buffer == null) return null; return DecodeWebPImage(fileName, buffer, () => { }); } var thumbPhotoSize = document.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueStickerPreview(location, owner, thumbPhotoSize.Size); } } } else { if (document.Size.Value > 0 && document.Size.Value < Telegram.Api.Constants.StickerMaxSize) { byte[] buffer; using (var file = store.OpenFile(documentLocalFileName, FileMode.Open)) { buffer = new byte[file.Length]; file.Read(buffer, 0, buffer.Length); } return DecodeWebPImage(documentLocalFileName, buffer, () => { using (var localStore = IsolatedStorageFile.GetUserStoreForApplication()) { localStore.DeleteFile(documentLocalFileName); } }); } } } return null; } public static ImageSource ReturnOrEnqueueSticker(TLDocument22 document, TLObject sticker) { if (document == null) return null; var documentLocalFileName = document.GetFileName(); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(documentLocalFileName)) { TLObject owner = document; if (sticker != null) { owner = sticker; } // 1. download full size IoC.Get().DownloadFileAsync(document.FileName, document.DCId, document.ToInputFileLocation(), owner, document.Size, progress => { }); // 2. download preview var thumbCachedSize = document.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var fileName = "cached" + document.GetFileName(); var buffer = thumbCachedSize.Bytes.Data; if (buffer == null) return null; return DecodeWebPImage(fileName, buffer, () => { }); } var thumbPhotoSize = document.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueStickerPreview(location, sticker, thumbPhotoSize.Size); } } } else { if (document.DocumentSize > 0 && document.DocumentSize < Telegram.Api.Constants.StickerMaxSize) { byte[] buffer; using (var file = store.OpenFile(documentLocalFileName, FileMode.Open)) { buffer = new byte[file.Length]; file.Read(buffer, 0, buffer.Length); } return DecodeWebPImage(documentLocalFileName, buffer, () => { using (var localStore = IsolatedStorageFile.GetUserStoreForApplication()) { localStore.DeleteFile(documentLocalFileName); } }); } } } return null; } #endif public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //System.Diagnostics.Debug.WriteLine("DefaultPhotoConverter elapsed=" + ShellViewModel.Timer.Elapsed); if (value == null) return null; var timer = Stopwatch.StartNew(); var encryptedPhoto = value as TLEncryptedFile; if (encryptedPhoto != null) { var isBackground = parameter != null && Equals(parameter, "Background"); return ReturnOrEnqueueImage(CheckChatSettings, encryptedPhoto, encryptedPhoto, null, isBackground); } var userProfilePhoto = value as TLUserProfilePhoto; if (userProfilePhoto != null) { var location = userProfilePhoto.PhotoSmall as TLFileLocation; if (location != null) { return ReturnOrEnqueueProfileImage(timer, location, userProfilePhoto, new TLInt(0), false); } } var chatPhoto = value as TLChatPhoto; if (chatPhoto != null) { var location = chatPhoto.PhotoSmall as TLFileLocation; if (location != null) { return ReturnOrEnqueueProfileImage(timer, location, chatPhoto, new TLInt(0), false); } } var decrypteMedia = value as TLDecryptedMessageMediaBase; if (decrypteMedia != null) { var decryptedMediaVideo = value as TLDecryptedMessageMediaVideo; if (decryptedMediaVideo != null) { var buffer = decryptedMediaVideo.Thumb.Data; if (buffer.Length > 0 && decryptedMediaVideo.ThumbW.Value > 0 && decryptedMediaVideo.ThumbH.Value > 0) { try { var memoryStream = new MemoryStream(buffer); var bitmap = PictureDecoder.DecodeJpeg(memoryStream); bitmap.BoxBlur(37); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, decryptedMediaVideo.ThumbW.Value, decryptedMediaVideo.ThumbH.Value, 0, 70); return ImageUtils.CreateImage(blurredStream.ToArray()); } catch (Exception ex) { } } return ImageUtils.CreateImage(buffer); } var decryptedMediaDocument = value as TLDecryptedMessageMediaDocument; if (decryptedMediaDocument != null) { var location = decryptedMediaDocument.File as TLEncryptedFile; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.Id, location.DCId, location.AccessHash); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { BitmapImage imageSource; try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.SetSource(stream); imageSource = image; } } catch (Exception) { return null; } return imageSource; } } } var buffer = decryptedMediaDocument.Thumb.Data; return ImageUtils.CreateImage(buffer); } var decryptedMediaPhoto = value as TLDecryptedMessageMediaPhoto; if (decryptedMediaPhoto != null) { if (decryptedMediaPhoto.Bitmap != null) { var bitmap = decryptedMediaPhoto.Bitmap; decryptedMediaPhoto.Bitmap = null; return bitmap; } } var file = decrypteMedia.File as TLEncryptedFile; if (file != null) { if (!decrypteMedia.IsCanceled) { var isBackground = parameter != null && Equals(parameter, "Background"); return ReturnOrEnqueueImage(CheckChatSettings, file, decrypteMedia, decrypteMedia, isBackground); } } } TLDecryptedMessageMediaExternalDocument decryptedMediaExternalDocument; var decryptedMessage = value as TLDecryptedMessage; if (decryptedMessage != null) { decryptedMediaExternalDocument = decryptedMessage.Media as TLDecryptedMessageMediaExternalDocument; if (decryptedMediaExternalDocument != null) { #if WP8 return ReturnOrEnqueueSticker(decryptedMediaExternalDocument, decryptedMessage); #endif return null; } } decryptedMediaExternalDocument = value as TLDecryptedMessageMediaExternalDocument; if (decryptedMediaExternalDocument != null) { #if WP8 return ReturnOrEnqueueSticker(decryptedMediaExternalDocument, decryptedMediaExternalDocument); #endif return null; } var photoMedia = value as TLMessageMediaPhoto; if (photoMedia != null) { if (photoMedia.Bitmap != null) { var bitmap = photoMedia.Bitmap; photoMedia.Bitmap = null; return bitmap; } value = photoMedia.Photo; } var photo = value as TLPhoto; if (photo != null) { bool isBackground; var size = GetPhotoSize(parameter, photo, out isBackground); if (size != null) { if (!string.IsNullOrEmpty(size.TempUrl)) { if (photoMedia != null) photoMedia.DownloadingProgress = 0.01; return size.TempUrl; } var location = size.Location as TLFileLocation; if (location != null) { if (photoMedia == null || !photoMedia.IsCanceled) { Action callback = null; if (photoMedia == null) { callback = item => Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { photo.NotifyOfPropertyChange(() => photo.Self); }); } return ReturnOrEnqueueImage(timer, CheckChatSettings, location, photo, size.Size, photoMedia, isBackground, callback); } } } } #if WP8 var inlineMediaResult = value as TLBotInlineMediaResult; if (inlineMediaResult != null) { if (TLString.Equals(inlineMediaResult.Type, new TLString("sticker"), StringComparison.OrdinalIgnoreCase)) { var document22 = inlineMediaResult.Document as TLDocument22; if (document22 == null) return null; var thumbCachedSize = document22.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var fileName = "cached" + document22.GetFileName(); var buffer = thumbCachedSize.Bytes.Data; if (buffer == null) return null; return DecodeWebPImage(fileName, buffer, () => { }); } var thumbPhotoSize = document22.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueStickerPreview(location, inlineMediaResult, thumbPhotoSize.Size); } } if (TLMessageBase.IsSticker(document22)) { return ReturnOrEnqueueSticker(document22, inlineMediaResult); } } } var sticker = value as TLStickerItem; if (sticker != null) { var document22 = sticker.Document as TLDocument22; if (document22 == null) return null; var thumbCachedSize = document22.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var fileName = "cached" + document22.GetFileName(); var buffer = thumbCachedSize.Bytes.Data; if (buffer == null) return null; return DecodeWebPImage(fileName, buffer, () => { }); } var thumbPhotoSize = document22.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueStickerPreview(location, sticker, thumbPhotoSize.Size); } } if (TLMessageBase.IsSticker(document22)) { return ReturnOrEnqueueSticker(document22, sticker); } } #endif var document = value as TLDocument; if (document != null) { #if WP8 if (TLMessageBase.IsSticker(document)) { if (parameter != null && string.Equals(parameter.ToString(), "ignoreStickers", StringComparison.OrdinalIgnoreCase)) { return null; } return ReturnOrEnqueueSticker((TLDocument22)document, null); } #endif var thumbPhotoSize = document.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(timer, false, location, document, thumbPhotoSize.Size, null); } } var thumbCachedSize = document.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var buffer = thumbCachedSize.Bytes.Data; return ImageUtils.CreateImage(buffer); } } var videoMedia = value as TLMessageMediaVideo; if (videoMedia != null) { value = videoMedia.Video; } var video = value as TLVideo; if (video != null) { var thumbPhotoSize = video.Thumb as TLPhotoSize; if (thumbPhotoSize != null) { var location = thumbPhotoSize.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(timer, false, location, video, thumbPhotoSize.Size, null); } } var thumbCachedSize = video.Thumb as TLPhotoCachedSize; if (thumbCachedSize != null) { var buffer = thumbCachedSize.Bytes.Data; return ImageUtils.CreateImage(buffer); } } var invoiceMedia = value as TLMessageMediaInvoice; if (invoiceMedia != null) { } var webPageMedia = value as TLMessageMediaWebPage; if (webPageMedia != null) { value = webPageMedia.WebPage; } var decryptedWebPageMedia = value as TLDecryptedMessageMediaWebPage; if (decryptedWebPageMedia != null) { value = decryptedWebPageMedia.WebPage; } var webPage = value as TLWebPage; if (webPage != null) { var webPagePhoto = webPage.Photo as TLPhoto; if (webPagePhoto != null) { var width = 311.0; double result; if (Double.TryParse((string)parameter, out result)) { width = result; } TLPhotoSize size = null; var sizes = webPagePhoto.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(timer, false, location, webPage, size.Size, null); } } } } var gameMedia = value as TLMessageMediaGame; if (gameMedia != null) { value = gameMedia.Game; } //var decryptedWebPageMedia = value as TLDecryptedMessageMediaWebPage; //if (decryptedWebPageMedia != null) //{ // value = decryptedWebPageMedia.WebPage; //} var game = value as TLGame; if (game != null) { var gamePhoto = game.Photo as TLPhoto; if (gamePhoto != null) { var width = 311.0; double result; if (Double.TryParse((string)parameter, out result)) { width = result; } TLPhotoSize size = null; var sizes = gamePhoto.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { return ReturnOrEnqueueImage(timer, false, location, game, size.Size, null); } } } } return null; } private static TLPhotoSize GetPhotoSize(object parameter, TLPhoto photo, out bool isBackground) { var widthParameter = string.Empty; isBackground = false; if (parameter != null) { var p = parameter.ToString().Split('_'); if (p.Length > 0) { widthParameter = p[0]; } if (p.Length > 1) { isBackground = string.Equals(p[1], "background", StringComparison.OrdinalIgnoreCase); } } var width = 311.0; double result; if (!string.IsNullOrEmpty(widthParameter) && double.TryParse(widthParameter, out result)) { width = result; } TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (photoSize.W.Value > 90 && (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value))) { size = photoSize; } } return size; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ImageViewerPhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var photoMedia = value as TLMessageMediaPhoto; if (photoMedia != null) { value = photoMedia.Photo; } var webPageMedia = value as TLMessageMediaWebPage; if (webPageMedia != null) { var webPage = webPageMedia.WebPage as TLWebPage; if (webPage != null) { value = webPage.Photo; } } var photo = value as TLPhoto; if (photo != null) { var width = 311.0; BitmapSource image = ReturnImageBySize(photo, width); if (image != null) return image; if (webPageMedia != null) { width = 99.0; image = ReturnImageBySize(photo, width); if (image != null) return image; } else if (photoMedia != null) { image = new PhotoToThumbConverter().Convert(photoMedia, targetType, parameter, culture) as BitmapSource; } return image; } var documentMedia = value as TLMessageMediaDocument; if (documentMedia != null) { return new PhotoToThumbConverter().Convert(documentMedia, targetType, parameter, culture); } return null; } private static BitmapImage ReturnImageBySize(TLPhoto photo, double width) { TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { var location = size.Location as TLFileLocation; if (location != null) { var timer = Stopwatch.StartNew(); var image = DefaultPhotoConverter.ReturnImage(timer, location); if (image != null) { return image; } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhotoThumbConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //return new DefaultPhotoConverter().Convert(value, targetType, parameter, culture); BitmapImage image = null; if (value != null) { var photoFile = value as PhotoFile; if (photoFile != null) { var thumbnail = photoFile.Thumbnail; if (thumbnail != null) { image = new BitmapImage(); image.CreateOptions = BitmapCreateOptions.None; image.SetSource(thumbnail); Deployment.Current.Dispatcher.BeginInvoke(() => MultiImageEditorView.ImageOpened(photoFile)); } else { //Task.Factory.StartNew(async () => //{ // thumbnail = await photoFile.File.GetThumbnailAsync(ThumbnailMode.ListView, 99, ThumbnailOptions.None); // photoFile.Thumbnail = thumbnail; // Deployment.Current.Dispatcher.BeginInvoke(() => photoFile.RaisePropertyChanged("Self")); //}); } } } return (image); } //public object Convert(object value, Type targetType, object parameter, CultureInfo culture) //{ // throw new NotImplementedException(); //} public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); //var thumbnail = await item.File.GetThumbnailAsync(ThumbnailMode.ListView, 99, ThumbnailOptions.None); //item.Thumbnail = thumbnail; //item.RaisePropertyChanged("Thumbnail"); } } public class PhotoFileToTemplateConverter : IValueConverter { public DataTemplate PhotoTemplate { get; set; } public DataTemplate ButtonTemplate { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var photoFile = value as PhotoFile; if (photoFile != null) { return photoFile.IsButton ? ButtonTemplate : PhotoTemplate; } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } /// To avoid memory leaks with ImageOpened, ImageFailed events /// Check for details: /// http://blogs.developpeur.org/kookiz/archive/2013/02/17/wpdev-memory-leak-with-bitmapimage.aspx public class BitmapImageWrapper { public BitmapImage Image { get; protected set; } public string FileName { get; protected set; } private Action _imageOpened; private Action _imageFailed; public BitmapImageWrapper(string fileName, BitmapImage image) { FileName = fileName; Image = image; } //~BitmapImageWrapper() //{ //} public void Subscribe(Action imageOpened, Action imageFailed = null) { Image.ImageOpened += OnImageOpened; Image.ImageFailed += OnImageFailed; _imageOpened = imageOpened; _imageFailed = imageFailed; } private void OnImageFailed(object sender, ExceptionRoutedEventArgs e) { Image.ImageOpened -= OnImageOpened; Image.ImageFailed -= OnImageFailed; _imageFailed.SafeInvoke(this); } private void OnImageOpened(object sender, RoutedEventArgs e) { Image.ImageOpened -= OnImageOpened; Image.ImageFailed -= OnImageFailed; _imageOpened.SafeInvoke(this); } } } ================================================ FILE: TelegramClient/Converters/DialogCaptionConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services; using Telegram.Api.Services.Cache; //#if WP8 //using PhoneNumbers; //#endif using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class DialogCaptionConverter : IValueConverter { public static string Convert(object value) { if (value == null) return null; var channels = value as TLVector; if (channels != null) { return AppResources.Feed; } var user = value as TLUserBase; if (user != null) { if (user.Index == 333000) { return AppResources.AppName; } if (user.Index == Constants.TelegramNotificationsId) { return AppResources.TelegramNotifications; } if (user.IsRequest) { #if WP8 //var phoneUtil = PhoneNumberUtil.GetInstance(); //try //{ // return phoneUtil.Format(phoneUtil.Parse("+" + user.Phone.Value, ""), PhoneNumberFormat.INTERNATIONAL); //} //catch (Exception e) { return "+" + user.Phone.Value; } #else return "+" + user.Phone.Value; #endif } if (user is TLUserEmpty || user.IsDeleted) { } return user.FullName.Trim(); } var chat = value as TLChatBase; if (chat != null) { return chat.FullName.Trim(); } var encryptedChat = value as TLEncryptedChatCommon; if (encryptedChat != null) { var currentUserId = IoC.Get().CurrentUserId; var cache = IoC.Get(); if (currentUserId.Value == encryptedChat.AdminId.Value) { var cachedParticipant = cache.GetUser(encryptedChat.ParticipantId); return cachedParticipant != null ? cachedParticipant.FullName.Trim().ToUpperInvariant() : string.Empty; } var cachedAdmin = cache.GetUser(encryptedChat.AdminId); return cachedAdmin != null ? cachedAdmin.FullName.Trim() : string.Empty; } return value != null? value.ToString() : string.Empty; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool uppercase = false; if (parameter != null && string.Equals(parameter.ToString(), "uppercase", StringComparison.OrdinalIgnoreCase)) { uppercase = true; } var result = Convert(value) ?? string.Empty; if (uppercase) { return result.ToUpperInvariant(); } return result; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ChatInviteSubtitleConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var chatInvite54 = value as TLChatInvite54; if (chatInvite54 == null) return null; string subtitleText; if (chatInvite54.Participants != null && chatInvite54.Participants.Count > 0) { subtitleText = string.Format(AppResources.ChatInviteSubtitle, Utils.Language.Declension( chatInvite54.ParticipantsCount.Value, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural)) .ToLower(CultureInfo.CurrentUICulture); } else { subtitleText = Utils.Language.Declension( chatInvite54.ParticipantsCount.Value, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural) .ToLower(CultureInfo.CurrentUICulture); } return subtitleText; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/DialogDetailsBackgroundConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using TelegramClient.ViewModels.Additional; namespace TelegramClient.Converters { public class DialogDetailsBackgroundConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty ImageTemplateProperty = DependencyProperty.Register( "ImageTemplate", typeof (DataTemplate), typeof (DialogDetailsBackgroundConverter), new PropertyMetadata(default(DataTemplate))); public DataTemplate ImageTemplate { get { return (DataTemplate) GetValue(ImageTemplateProperty); } set { SetValue(ImageTemplateProperty, value); } } public static readonly DependencyProperty AnimatedTemplateProperty = DependencyProperty.Register( "AnimatedTemplate", typeof (DataTemplate), typeof (DialogDetailsBackgroundConverter), new PropertyMetadata(default(DataTemplate))); public DataTemplate AnimatedTemplate { get { return (DataTemplate) GetValue(AnimatedTemplateProperty); } set { SetValue(AnimatedTemplateProperty, value); } } public static readonly DependencyProperty EmptyTemplateProperty = DependencyProperty.Register( "EmptyTemplate", typeof (DataTemplate), typeof (DialogDetailsBackgroundConverter), new PropertyMetadata(default(DataTemplate))); public DataTemplate EmptyTemplate { get { return (DataTemplate) GetValue(EmptyTemplateProperty); } set { SetValue(EmptyTemplateProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //System.Diagnostics.Debug.WriteLine("DialogDetailsBackgroundConverter elapsed=" + ShellViewModel.Timer.Elapsed); var background = value as BackgroundItem; if (background == null || background.Name == "Empty") { return ImageTemplate; } if (background.Name == Constants.AnimatedBackground1String) { return AnimatedTemplate; } return ImageTemplate; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/DialogMessageFromConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using TelegramClient.Resources; using TelegramClient.Services; namespace TelegramClient.Converters { public class DialogMessageFromConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dialog = value as TLDialog; if (dialog != null) { var dialog53 = dialog as TLDialog53; if (dialog53 != null) { var draft = dialog53.Draft as TLDraftMessage; if (draft != null && !TLString.IsNullOrEmpty(draft.Message)) { var topMessage = dialog53.TopMessage; if (topMessage != null && topMessage.DateIndex < draft.Date.Value) { return string.Empty; //AppResources.Draft + ": "; } } } var messageBase = dialog.TopMessage; if (messageBase != null && messageBase.ShowFrom) { var messageCommon = messageBase as TLMessageCommon; if (messageCommon != null) { var user = messageCommon.From as TLUserBase; if (user != null) { var currentUserId = IoC.Get().CurrentUserId; if (currentUserId == user.Index) { return AppResources.You + ": "; } var firstName = user.FirstName != null ? user.FirstName.ToString().Trim() : string.Empty; var lastName = user.LastName != null ? user.LastName.ToString().Trim() : string.Empty; if (string.IsNullOrEmpty(firstName) && string.IsNullOrEmpty(lastName)) { return (user.Phone != null ? "+" + user.Phone : string.Empty) + ": "; } if (string.Equals(firstName, lastName, StringComparison.OrdinalIgnoreCase)) { return firstName + ": "; } if (string.IsNullOrEmpty(firstName)) { return lastName + ": "; } if (string.IsNullOrEmpty(lastName)) { return firstName + ": "; } return firstName + ": "; } var peerChannel = messageCommon.ToId as TLPeerChannel; if (peerChannel != null && (messageCommon.FromId == null || messageCommon.FromId.Value == -1)) { var channel = IoC.Get().GetChat(peerChannel.Id) as TLChannel; if (channel != null) { return channel.FullName + ": "; } var channelForbidden = IoC.Get().GetChat(peerChannel.Id) as TLChannelForbidden; if (channelForbidden != null) { return channelForbidden.FullName + ": "; } } } } } return string.Empty; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/DistanceAwayConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using TelegramClient.Resources; namespace TelegramClient.Converters { public class DistanceAwayConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is double)) return value; var distance = (double) value; if (distance < 1000) { return string.Format(AppResources.DistanceAway, (int) distance + AppResources.MetersShort); } return string.Format(AppResources.DistanceAway, String.Format("{0:0.#}", distance / 1000) + AppResources.KilometersShort); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/EmptyDialogMessageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class EmptyDialogMessageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase != null && userBase.Index == 333000) { return AppResources.GotAQuestionAboutTelegram; } var user = value as TLUser; if (user != null && user.BotInfo != null) { var botInfo = user.BotInfo as TLBotInfo; if (botInfo != null) { return botInfo.Description; } } return AppResources.NoMessagesYet; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/EmptyPhotoToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class EmptyChatPhotoToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isEmpty = value is TLChatPhotoEmpty; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isEmpty = !isEmpty; } return isEmpty ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class EmptyUserProfilePhotoToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isEmpty = value is TLUserProfilePhotoEmpty; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isEmpty = !isEmpty; } return isEmpty ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/EmptyStringToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class EmptyStringToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = value == null; var s = value as string; if (s != null) { visibility = string.IsNullOrEmpty(s); } if (string.Equals(System.Convert.ToString(parameter), "invert", StringComparison.OrdinalIgnoreCase)) { visibility = !visibility; } return visibility ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class EmptyTLStringToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = value == null; var s = value as TLString; if (s != null) { visibility = string.IsNullOrEmpty(s.ToString()); } if (string.Equals(System.Convert.ToString(parameter), "invert", StringComparison.OrdinalIgnoreCase)) { visibility = !visibility; } return visibility ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ExistsToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class ExistsToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isVisible = value != null; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isVisible = !isVisible; } return isVisible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ExtendedImageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Windows.Data; using ImageTools; namespace TelegramClient.Converters { public class ExtendedImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var imageSource = value as string; if (imageSource != null) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(imageSource)) { var file = store.OpenFile(imageSource, FileMode.Open, FileAccess.Read); { var image = new ExtendedImage(); image.LoadingCompleted += (sender, args) => { var count = image.Frames.Count; }; image.LoadingFailed += (sender, args) => { }; image.SetSource(file); return image; } } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/FileExtToColorConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media; using Telegram.Api.TL; namespace TelegramClient.Converters { public class FileExtToColorConverter : IValueConverter { public Brush Yellow { get; set; } public Brush Green { get; set; } public Brush Red { get; set; } public Brush Blue { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var fileExtColors = new []{Blue, Green, Red, Yellow}; var document = value as TLDocument; if (document == null) return fileExtColors[0]; var name = document.FileName.ToString(); if (name.Length != 0) { int color = -1; if (name.EndsWith(".doc") || name.EndsWith(".txt") || name.EndsWith(".psd")) { color = 0; } else if (name.EndsWith(".xls") || name.EndsWith(".csv")) { color = 1; } else if (name.EndsWith(".pdf") || name.EndsWith(".ppt") || name.EndsWith(".key")) { color = 2; } else if (name.EndsWith(".zip") || name.EndsWith(".rar") || name.EndsWith(".ai") || name.EndsWith(".mp3") || name.EndsWith(".mov") || name.EndsWith(".avi")) { color = 3; } if (color == -1) { int idx; var ext = (idx = name.LastIndexOf(".", StringComparison.Ordinal)) == -1 ? "" : name.Substring(idx + 1); if (ext.Length != 0) { color = ext[0] % fileExtColors.Length; } else { color = name[0] % fileExtColors.Length; } } return fileExtColors[color]; } return fileExtColors[0]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/FileNameConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class FileNameConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mediaDocument = value as TLMessageMediaDocument; if (mediaDocument == null) { return null; } var document = mediaDocument.Document as TLDocument; if (document == null) { return null; } var fileName = document.FileName.ToString(); if (string.IsNullOrEmpty(fileName)) { return AppResources.Document.ToLowerInvariant(); } return fileName; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/FileSizeConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class FileSizeConverter : IValueConverter { public static string Convert(long bytesCount) { if (bytesCount < 1024) { return string.Format("{0} B", bytesCount); } if (bytesCount < 1024 * 1024) { return string.Format("{0} KB", ((double)bytesCount / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } if (bytesCount < 1024 * 1024 * 1024) { return string.Format("{0} MB", ((double)bytesCount / 1024 / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } return string.Format("{0} GB", ((double)bytesCount / 1024 / 1024 / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is long) { return Convert((long) value); } if (value is int) { return Convert((int) value); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MessageViewsConverter : IValueConverter { public static string Convert(long viewsCount) { #if DEBUG return string.Format("{0}", viewsCount); #endif if (viewsCount < 1000) { return string.Format("{0}", viewsCount); } if (viewsCount < 1000 * 1000) { return string.Format("{0}K", ((double)viewsCount / 1000).ToString("0.0", CultureInfo.InvariantCulture)); } if (viewsCount < 1000 * 1000 * 1000) { return string.Format("{0}M", ((double)viewsCount / 1000 / 1000).ToString("0.0", CultureInfo.InvariantCulture)); } return string.Format("{0}B", ((double)viewsCount / 1000 / 1000 / 1000).ToString("0.0", CultureInfo.InvariantCulture)); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is TLInt) { return Convert(((TLInt)value).Value); } if (value is TLLong) { return Convert(((TLLong)value).Value); } if (value is long) { return Convert((long)value); } if (value is int) { return Convert((int)value); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ForwardedMessageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Windows; using System.Windows.Data; using Telegram.Api; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Controls.Utils; using TelegramClient.Resources; using Language = TelegramClient.Utils.Language; namespace TelegramClient.Converters { public class DeclensionConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty NominativeSingularProperty = DependencyProperty.Register( "NominativeSingular", typeof (string), typeof (DeclensionConverter), new PropertyMetadata(default(string))); public string NominativeSingular { get { return (string) GetValue(NominativeSingularProperty); } set { SetValue(NominativeSingularProperty, value); } } public static readonly DependencyProperty NominativePluralProperty = DependencyProperty.Register( "NominativePlural", typeof (string), typeof (DeclensionConverter), new PropertyMetadata(default(string))); public string NominativePlural { get { return (string) GetValue(NominativePluralProperty); } set { SetValue(NominativePluralProperty, value); } } public static readonly DependencyProperty GenitiveSingularProperty = DependencyProperty.Register( "GenitiveSingular", typeof (string), typeof (DeclensionConverter), new PropertyMetadata(default(string))); public string GenitiveSingular { get { return (string) GetValue(GenitiveSingularProperty); } set { SetValue(GenitiveSingularProperty, value); } } public static readonly DependencyProperty GenitivePluralProperty = DependencyProperty.Register( "GenitivePlural", typeof (string), typeof (DeclensionConverter), new PropertyMetadata(default(string))); public string GenitivePlural { get { return (string) GetValue(GenitivePluralProperty); } set { SetValue(GenitivePluralProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int count; if (value is int) { count = (int) value; } else { return null; } return Language.Declension( count, NominativeSingular, NominativePlural, GenitiveSingular, GenitivePlural).ToLower(CultureInfo.CurrentUICulture); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class InvoiceToDescriptionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mediaInvoice = value as TLMessageMediaInvoice; if (mediaInvoice == null) return null; if (mediaInvoice.ReceiptMsgId != null && mediaInvoice.ReceiptMsgId.Value >= 0) { return string.Format("{0} {1} {2}", mediaInvoice.TotalAmount.Value / Math.Pow(10.0, Currency.GetPow(mediaInvoice.Currency.ToString())), Currency.GetSymbol(mediaInvoice.Currency.ToString()), AppResources.Receipt).ToUpperInvariant(); } return string.Format("{0} {1} {2}", mediaInvoice.TotalAmount.Value / Math.Pow(10.0, Currency.GetPow(mediaInvoice.Currency.ToString())), Currency.GetSymbol(mediaInvoice.Currency.ToString()), mediaInvoice.Test ? AppResources.TestInvoice : AppResources.Invoice).ToUpperInvariant(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MessageToWebPageCaptionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message != null) { if (!string.IsNullOrEmpty(message.WebPageTitle)) { return message.WebPageTitle; } var mediaWebPage = message.Media as TLMessageMediaWebPage; if (mediaWebPage != null) { var webPage = mediaWebPage.WebPage as TLWebPage; if (webPage != null) { var caption = webPage.Title ?? webPage.SiteName;// ?? webPage.DisplayUrl; if (!TLString.IsNullOrEmpty(caption)) { return Language.CapitalizeFirstLetter(caption.ToString()); } caption = webPage.DisplayUrl; if (!TLString.IsNullOrEmpty(caption)) { var parts = caption.ToString().Split('.'); if (parts.Length >= 2) { return Language.CapitalizeFirstLetter(parts[parts.Length - 2]); } } } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class WebPageToCaptionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var webPage = value as TLWebPage; if (webPage != null) { return webPage.SiteName?? webPage.Title ?? webPage.DisplayUrl; } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class WebPageToDescriptionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var webPage = value as TLWebPage; if (webPage != null) { return webPage.Description ?? webPage.Title; } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class RecentItemToNameConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var user = value as TLUserBase; if (user != null) { return TLUserBase.GetFirstName(user.FirstName, user.LastName, user.Phone); } var chat = value as TLChatBase; if (chat != null) { return chat.FullName; } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MessageContainerToFromConverter : IValueConverter { public static string GetFirstName(TLMessage25 message) { var message48 = message as TLMessage48; if (message48 != null) { if (message48.FwdHeader != null) { var cacheService = InMemoryCacheService.Instance; var channelId = message48.FwdHeader.ChannelId; if (channelId != null) { var channel = cacheService.GetChat(message48.FwdHeader.ChannelId) as TLChannel; if (channel != null) { return channel.Title.ToString(); } } else { var userId = message48.FwdHeader.FromId; if (userId != null) { var fromUser = cacheService.GetUser(message48.FwdHeader.FromId); if (fromUser != null) { return TLUserBase.GetFirstName(fromUser.FirstName, fromUser.LastName, fromUser.Phone); } } } } } if (message != null) { var fromUser = message.FwdFrom as TLUserBase; if (fromUser != null) { return TLUserBase.GetFirstName(fromUser.FirstName, fromUser.LastName, fromUser.Phone); } var fromChat = message.FwdFrom as TLChannel; if (fromChat != null) { return fromChat.Title.ToString(); } var fromChatForbidden = message.FwdFrom as TLChannelForbidden; if (fromChatForbidden != null) { return fromChatForbidden.Title.ToString(); } } return null; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var messagesContainer = value as TLMessagesContainter; if (messagesContainer != null) { if (messagesContainer.FwdMessages != null) { var usersCache = new Dictionary(); var channelsCache = new Dictionary(); for (var i = 0; i < messagesContainer.FwdMessages.Count; i++) { var message = messagesContainer.FwdMessages[i]; if (message.FwdFromId != null) { if (!usersCache.ContainsKey(message.FwdFromId.Value)) { usersCache[message.FwdFromId.Value] = message; } } var message48 = message as TLMessage48; if (message48 != null) { if (message48.FwdHeader != null) { var channelId = message48.FwdHeader.ChannelId; if (channelId != null) { if (!channelsCache.ContainsKey(channelId.Value)) { channelsCache[channelId.Value] = message; } } else { var userId = message48.FwdHeader.FromId; if (userId != null) { if (!usersCache.ContainsKey(userId.Value)) { usersCache[userId.Value] = message; } } } } } var message40 = message as TLMessage40; if (message40 != null) { if (message40.FwdFromPeer != null) { var peerUser = message40.FwdFromPeer as TLPeerUser; if (peerUser != null) { if (!usersCache.ContainsKey(peerUser.Id.Value)) { usersCache[peerUser.Id.Value] = message; } } var peerChannel = message40.FwdFromPeer as TLPeerChannel; if (peerChannel != null) { if (!channelsCache.ContainsKey(peerChannel.Id.Value)) { channelsCache[peerChannel.Id.Value] = message; } } } } } var count = usersCache.Count + channelsCache.Count; if (count == 1) { return GetFirstName(messagesContainer.FwdMessages[0]); } if (count == 2) { var list = usersCache.Values.Union(channelsCache.Values).ToList(); var message1 = list[0]; var message2 = list[1]; return string.Format("{0}, {1}", GetFirstName(message1), GetFirstName(message2)); } if (count > 2) { return string.Format("{0} {1}", GetFirstName(messagesContainer.FwdMessages[0]), string.Format(AppResources.AndOthers, count - 1).ToLowerInvariant()); } } } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MessageContainerToContentConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var messagesContainer = value as TLMessagesContainter; if (messagesContainer != null) { if (messagesContainer.FwdMessages != null) { var count = messagesContainer.FwdMessages.Count; if (count == 1) { var mediaPhoto = messagesContainer.FwdMessages[0].Media as TLMessageMediaPhoto; if (mediaPhoto != null) { return AppResources.ForwardedPhotoNominativeSingular; } var mediaAudio = messagesContainer.FwdMessages[0].Media as TLMessageMediaAudio; if (mediaAudio != null) { return AppResources.ForwardedAudioNominativeSingular; } var mediaDocument = messagesContainer.FwdMessages[0].Media as TLMessageMediaDocument; if (mediaDocument != null) { if (messagesContainer.FwdMessages[0].IsVoice()) { return AppResources.ForwardedVoiceMessageNominativeSingular; } if (messagesContainer.FwdMessages[0].IsVideo()) { return AppResources.ForwardedVideoNominativeSingular; } if (messagesContainer.FwdMessages[0].IsGif()) { return AppResources.ForwardedGifNominativeSingular; } if (messagesContainer.FwdMessages[0].IsSticker()) { return AppResources.ForwardedStickerNominativeSingular; } return AppResources.ForwardedFileNominativeSingular; } var mediaVideo = messagesContainer.FwdMessages[0].Media as TLMessageMediaVideo; if (mediaVideo != null) { return AppResources.ForwardedVideoNominativeSingular; } var mediaLocation = messagesContainer.FwdMessages[0].Media as TLMessageMediaGeo; if (mediaLocation != null) { return AppResources.ForwardedLocationNominativeSingular; } var mediaContact = messagesContainer.FwdMessages[0].Media as TLMessageMediaContact; if (mediaContact != null) { return AppResources.ForwardedContactNominativeSingular; } return AppResources.ForwardedMessage; } if (count > 1) { var sameMedia = true; var media = messagesContainer.FwdMessages[0].Media; for (var i = 1; i < messagesContainer.FwdMessages.Count; i++) { if (messagesContainer.FwdMessages[i].Media.GetType() != media.GetType()) { sameMedia = false; break; } } if (sameMedia) { if (media is TLMessageMediaPhoto) { return Language.Declension( count, AppResources.ForwardedPhotoNominativeSingular, AppResources.ForwardedPhotoNominativePlural, AppResources.ForwardedPhotoGenitiveSingular, AppResources.ForwardedPhotoGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (media is TLMessageMediaAudio) { return Language.Declension( count, AppResources.ForwardedAudioNominativeSingular, AppResources.ForwardedAudioNominativePlural, AppResources.ForwardedAudioGenitiveSingular, AppResources.ForwardedAudioGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (media is TLMessageMediaDocument) { if (messagesContainer.FwdMessages[0].IsVoice()) { return Language.Declension( count, AppResources.ForwardedVoiceMessageNominativeSingular, AppResources.ForwardedVoiceMessageNominativePlural, AppResources.ForwardedVoiceMessageGenitiveSingular, AppResources.ForwardedVoiceMessageGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (messagesContainer.FwdMessages[0].IsVideo()) { return Language.Declension( count, AppResources.ForwardedVideoNominativeSingular, AppResources.ForwardedVideoNominativePlural, AppResources.ForwardedVideoGenitiveSingular, AppResources.ForwardedVideoGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (messagesContainer.FwdMessages[0].IsGif()) { return Language.Declension( count, AppResources.ForwardedGifNominativeSingular, AppResources.ForwardedGifNominativePlural, AppResources.ForwardedGifGenitiveSingular, AppResources.ForwardedGifGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (messagesContainer.FwdMessages[0].IsSticker()) { return Language.Declension( count, AppResources.ForwardedStickerNominativeSingular, AppResources.ForwardedStickerNominativePlural, AppResources.ForwardedStickerGenitiveSingular, AppResources.ForwardedStickerGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } return Language.Declension( count, AppResources.ForwardedFileNominativeSingular, AppResources.ForwardedFileNominativePlural, AppResources.ForwardedFileGenitiveSingular, AppResources.ForwardedFileGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (media is TLMessageMediaVideo) { return Language.Declension( count, AppResources.ForwardedVideoNominativeSingular, AppResources.ForwardedVideoNominativePlural, AppResources.ForwardedVideoGenitiveSingular, AppResources.ForwardedVideoGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (media is TLMessageMediaGeo) { return Language.Declension( count, AppResources.ForwardedLocationNominativeSingular, AppResources.ForwardedLocationNominativePlural, AppResources.ForwardedLocationGenitiveSingular, AppResources.ForwardedLocationGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } if (media is TLMessageMediaContact) { return Language.Declension( count, AppResources.ForwardedContactNominativeSingular, AppResources.ForwardedContactNominativePlural, AppResources.ForwardedContactGenitiveSingular, AppResources.ForwardedContactGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } } return Language.Declension( count, AppResources.ForwardedMessageNominativeSingular, AppResources.ForwardedMessageNominativePlural, AppResources.ForwardedMessageGenitiveSingular, AppResources.ForwardedMessageGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } } } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/GeoLocationToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class GeoLocationToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is TLMessageMediaEmpty || value is TLMessageMediaWebPage) { return Visibility.Visible; } if (value is TLDecryptedMessageMediaEmpty || value is TLDecryptedMessageMediaWebPage) { return Visibility.Visible; } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/GeoPointToStaticGoogleMapsConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Windows.Data; using System.Windows.Media.Imaging; using Caliburn.Micro; using Telegram.Api.Services.Cache; using Telegram.Api.Services.FileManager; using Telegram.Api.TL; using TelegramClient.Services; namespace TelegramClient.Converters { public class GeoPointToStaticGoogleMapsConverter : IValueConverter { private const int DefaultWidth = 311; private const int DefaultHeight = 150; public int Width { get; set; } public int Height { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var geoPoint = value as TLGeoPoint; if (geoPoint == null) return null; var width = Width != 0 ? Width : DefaultWidth; var height = Height != 0 ? Height : DefaultHeight; return string.Format(Constants.StaticGoogleMap, geoPoint.Lat.Value.ToString(new CultureInfo("en-US")), geoPoint.Long.Value.ToString(new CultureInfo("en-US")), width, height); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class GeoPointToStaticGoogleMapsConverter2 : IValueConverter { private static readonly Dictionary _cachedSources = new Dictionary(); public static BitmapSource ReturnOrEnqueueGeoPointImage(TLGeoPoint geoPoint, int width, int height, TLObject owner) { var destFileName = geoPoint.GetFileName(); BitmapSource imageSource; WeakReference weakImageSource; if (_cachedSources.TryGetValue(destFileName, out weakImageSource)) { if (weakImageSource.IsAlive) { imageSource = weakImageSource.Target as BitmapSource; return imageSource; } } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(destFileName)) { var sourceUri = string.Format(Constants.StaticGoogleMap, geoPoint.Lat.Value.ToString(new CultureInfo("en-US")), geoPoint.Long.Value.ToString(new CultureInfo("en-US")), width, height); var fileManager = IoC.Get(); fileManager.DownloadFileAsync(sourceUri, destFileName, owner, item => { var messageMediaGeoPoint = owner as IMessageMediaGeoPoint; if (messageMediaGeoPoint != null) { var newGeoPoint = messageMediaGeoPoint.Geo as TLGeoPoint; if (newGeoPoint != null) { var newFileName = newGeoPoint.GetFileName(); var oldFileName = destFileName; using (var store2 = IsolatedStorageFile.GetUserStoreForApplication()) { if (store2.FileExists(oldFileName)) { if (!string.IsNullOrEmpty(oldFileName) && !string.Equals(oldFileName, newFileName, StringComparison.OrdinalIgnoreCase)) { store2.CopyFile(oldFileName, newFileName, true); store2.DeleteFile(oldFileName); } } } } Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { var messageMediaBase = owner as TLMessageMediaBase; if (messageMediaBase != null) { messageMediaBase.NotifyOfPropertyChange(() => messageMediaBase.Self); } var decryptedMessageMediaBase = owner as TLDecryptedMessageMediaBase; if (decryptedMessageMediaBase != null) { decryptedMessageMediaBase.NotifyOfPropertyChange(() => decryptedMessageMediaBase.Self); } }); } }); } else { try { using (var stream = store.OpenFile(destFileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.SetSource(stream); imageSource = image; } _cachedSources[destFileName] = new WeakReference(imageSource); } catch (Exception) { return null; } return imageSource; } } return null; } private const int DefaultWidth = 311; private const int DefaultHeight = 150; public int Width { get; set; } public int Height { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mediaGeo = value as TLMessageMediaGeo; if (mediaGeo != null) { var geoPoint = mediaGeo.Geo as TLGeoPoint; if (geoPoint == null) return null; var width = Width != 0 ? Width : DefaultWidth; var height = Height != 0 ? Height : DefaultHeight; return ReturnOrEnqueueGeoPointImage(geoPoint, width, height, mediaGeo); } var decryptedMediaGeo = value as TLDecryptedMessageMediaGeoPoint; if (decryptedMediaGeo != null) { var geoPoint = decryptedMediaGeo.Geo as TLGeoPoint; if (geoPoint == null) return null; var width = Width != 0 ? Width : DefaultWidth; var height = Height != 0 ? Height : DefaultHeight; return ReturnOrEnqueueGeoPointImage(geoPoint, width, height, decryptedMediaGeo); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class GeoPointToStaticGoogleMapsConverter3 : IValueConverter { private static readonly Dictionary _cachedSources = new Dictionary(); public static BitmapSource ReturnOrEnqueueGeoPointImage(TLGeoPoint geoPoint, int width, int height, TLObject owner) { var destFileName = geoPoint.GetFileName(); BitmapSource imageSource; WeakReference weakImageSource; if (_cachedSources.TryGetValue(destFileName, out weakImageSource)) { if (weakImageSource.IsAlive) { imageSource = weakImageSource.Target as BitmapSource; return imageSource; } } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (!store.FileExists(destFileName)) { var config = IoC.Get().GetConfig() as TLConfig82; if (config == null) return null; var fileManager = IoC.Get(); var geoPoint82 = geoPoint as TLGeoPoint82; var accessHash = geoPoint82 != null ? geoPoint82.AccessHash : new TLLong(0); var inputLocation = new TLInputWebFileGeoPointLocation { GeoPoint = new TLInputGeoPoint { Long = geoPoint.Long, Lat = geoPoint.Lat }, AccessHash = accessHash, W = new TLInt(width), H = new TLInt(height), Zoom = new TLInt(15), Scale = new TLInt(2) }; fileManager.DownloadFile(config.WebfileDCId, inputLocation, destFileName, owner, item => { var messageMediaGeoPoint = owner as IMessageMediaGeoPoint; if (messageMediaGeoPoint != null) { var newGeoPoint = messageMediaGeoPoint.Geo as TLGeoPoint; if (newGeoPoint != null) { var newFileName = newGeoPoint.GetFileName(); var oldFileName = destFileName; using (var store2 = IsolatedStorageFile.GetUserStoreForApplication()) { if (store2.FileExists(oldFileName)) { if (!string.IsNullOrEmpty(oldFileName) && !string.Equals(oldFileName, newFileName, StringComparison.OrdinalIgnoreCase)) { store2.CopyFile(oldFileName, newFileName, true); store2.DeleteFile(oldFileName); } } } } Telegram.Api.Helpers.Execute.BeginOnUIThread(() => { var messageMediaBase = owner as TLMessageMediaBase; if (messageMediaBase != null) { messageMediaBase.NotifyOfPropertyChange(() => messageMediaBase.Self); } var decryptedMessageMediaBase = owner as TLDecryptedMessageMediaBase; if (decryptedMessageMediaBase != null) { decryptedMessageMediaBase.NotifyOfPropertyChange(() => decryptedMessageMediaBase.Self); } }); } }); } else { try { using (var stream = store.OpenFile(destFileName, FileMode.Open, FileAccess.Read)) { stream.Seek(0, SeekOrigin.Begin); var image = new BitmapImage(); image.SetSource(stream); imageSource = image; } _cachedSources[destFileName] = new WeakReference(imageSource); } catch (Exception) { return null; } return imageSource; } } return null; } private const int DefaultWidth = 311; private const int DefaultHeight = 150; public int Width { get; set; } public int Height { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mediaGeo = value as TLMessageMediaGeo; if (mediaGeo != null) { var geoPoint = mediaGeo.Geo as TLGeoPoint; if (geoPoint == null) return null; var width = Width != 0 ? Width : DefaultWidth; var height = Height != 0 ? Height : DefaultHeight; return ReturnOrEnqueueGeoPointImage(geoPoint, width, height, mediaGeo); } var decryptedMediaGeo = value as TLDecryptedMessageMediaGeoPoint; if (decryptedMediaGeo != null) { var geoPoint = decryptedMediaGeo.Geo as TLGeoPoint; if (geoPoint == null) return null; var width = Width != 0 ? Width : DefaultWidth; var height = Height != 0 ? Height : DefaultHeight; return ReturnOrEnqueueGeoPointImage(geoPoint, width, height, decryptedMediaGeo); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/GroupToBackgroundBrushValueConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Models; using TelegramClient.ViewModels.Additional; namespace TelegramClient.Converters { public class GroupToBackgroundBrushValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var group = value as AlphaKeyGroup; object result = null; if (group != null) { if (group.Count == 0) { result = Application.Current.Resources["PhoneChromeBrush"]; } else { result = Application.Current.Resources["PhoneAccentBrush"]; } } return result; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class CountryGroupToBackgroundBrushValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var group = value as CountriesInGroup; object result = null; if (group != null) { if (group.Count == 0) { result = Application.Current.Resources["PhoneChromeBrush"]; } else { result = Application.Current.Resources["PhoneAccentBrush"]; } } return result; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/GroupToForegroundBrushValueConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; using Telegram.Api.TL; using TelegramClient.Models; using TelegramClient.ViewModels.Additional; namespace TelegramClient.Converters { public class GroupToForegroundBrushValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var group = value as AlphaKeyGroup; object result = null; if (group != null) { if (group.Count == 0) { result = Application.Current.Resources["PhoneDisabledBrush"]; } else { result = new SolidColorBrush(Colors.White); } } return result; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class CountryGroupToForegroundBrushValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var group = value as CountriesInGroup; object result = null; if (group != null) { if (group.Count == 0) { result = Application.Current.Resources["PhoneDisabledBrush"]; } else { result = new SolidColorBrush(Colors.White); } } return result; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/IdToPlaceholderBackgroundConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Caliburn.Micro; using TelegramClient.Services; namespace TelegramClient.Converters { public class IdToPlaceholderBackgroundConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { long index; if (value is int) { index = (int)value; } else if (value is long) { index = (long)value; } else { return Application.Current.Resources["PhoneChromeBrush2"]; } if (index == 0) { return Application.Current.Resources["PhoneChromeBrush2"]; } if (index == -1) { return Application.Current.Resources["PhoneChromeBrush2"]; } if (index == -2) { return Application.Current.Resources["PhoneAccentBrush"]; } var currentUserId = IoC.Get().CurrentUserId; var number = Math.Abs(MD5Core.GetHash(string.Format("{0}{1}", value, currentUserId))[Math.Abs(index % 16)]) % 8; //switch (number) //{ // case 0: // return Application.Current.Resources["Placeholder0Brush"]; // case 1: // return Application.Current.Resources["Placeholder1Brush"]; // case 2: // return Application.Current.Resources["Placeholder2Brush"]; // case 3: // return Application.Current.Resources["Placeholder3Brush"]; // case 4: // return Application.Current.Resources["Placeholder4Brush"]; // case 5: // return Application.Current.Resources["Placeholder5Brush"]; //} //var number = (int) value % 8; switch (number) { case 0: return Application.Current.Resources["BlueBrush"]; case 1: return Application.Current.Resources["CyanBrush"]; case 2: return Application.Current.Resources["GreenBrush"]; case 3: return Application.Current.Resources["OrangeBrush"]; case 4: return Application.Current.Resources["PinkBrush"]; case 5: return Application.Current.Resources["PurpleBrush"]; case 6: return Application.Current.Resources["RedBrush"]; case 7: return Application.Current.Resources["YellowBrush"]; } return Application.Current.Resources["PhoneChromeBrush2"]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/IntToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class IntToVisibilityConverter : IValueConverter { /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || !(value is int) || parameter == null) return Visibility.Collapsed; try { var count = int.Parse(parameter.ToString()); return count == (int) value ? Visibility.Visible : Visibility.Collapsed; } catch(Exception) { return Visibility.Collapsed; } } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/InvertBooleanConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class InvertVisibilityConverter : IValueConverter { #region Implementation of IValueConverter /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return (Visibility) value == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible; } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } /// /// Inverts boolean value. /// public class InvertBooleanConverter : IValueConverter { #region Implementation of IValueConverter /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is bool)) return value; return !(bool)value; } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is bool)) return value; return !(bool)value; } #endregion } } ================================================ FILE: TelegramClient/Converters/IsSelectedToBackgroundConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; namespace TelegramClient.Converters { public class IsSelectedToBackgroundConverter : IValueConverter { public Color SelectedColor = Color.FromArgb(0, 0, 0, 0); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var notSelectedColor = (Color)Application.Current.Resources["PhoneBackgroundColor"]; notSelectedColor.A = 80; return (bool)value ? new SolidColorBrush(SelectedColor) : new SolidColorBrush(notSelectedColor); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/LowercaseConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class LowercaseConverter : IValueConverter { #region Implementation of IValueConverter /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is string)) return null; return Convert(value.ToString()); } public static string Convert(string value) { return value.ToLowerInvariant(); } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } } ================================================ FILE: TelegramClient/Converters/MaskConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Text; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class MaskConverter : DependencyObject, IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; var str = value.ToString(); var mask = "●"; if (parameter != null) { mask = parameter.ToString(); } var builder = new StringBuilder(); for (var i = 0; i < str.Length; i++) { builder.Append(mask); } return builder.ToString(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MediaContactToPhotoConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services.Cache; using Telegram.Api.TL; namespace TelegramClient.Converters { public class MediaContactToPhotoConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mediaContact = value as TLMessageMediaContact; if (mediaContact != null) { } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MediaEmptyToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO.IsolatedStorage; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class MediaEmptyToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = value is TLMessageMediaEmpty || value is TLMessageMediaWebPage; if (string.Equals((string) parameter, "invert", StringComparison.OrdinalIgnoreCase)) { visibility = !visibility; } return visibility ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DownloadMessageToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message == null) { return Visibility.Collapsed; } return DownloadMediaToVisibilityConverter.MediaFileExists(message.Media) ? Visibility.Collapsed : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DownloadMediaToVisibilityConverter : IValueConverter { public static bool MediaFileExists(TLMessageMediaBase value) { var mediaDocument = value as TLMessageMediaDocument; if (mediaDocument == null) { return true; } if (!string.IsNullOrEmpty(mediaDocument.IsoFileName)) { return true; } var document = mediaDocument.Document as TLDocument; if (document == null) { return true; } if (document.Size.Value == 0) { return true; } var fileName = document.GetFileName(); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { return true; } } return false; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return MediaFileExists(value as TLMessageMediaBase) ? Visibility.Collapsed : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MediaSizeConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class MediaSizeConverter : IValueConverter { public static string Convert(int bytesCount) { if (bytesCount < 1024) { return string.Format("{0} B", bytesCount); } if (bytesCount < 1024 * 1024) { return string.Format("{0} KB", ((double)bytesCount / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } if (bytesCount < 1024 * 1024 * 1024) { return string.Format("{0} MB", ((double)bytesCount / 1024 / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } return string.Format("{0} GB", ((double)bytesCount / 1024 / 1024 / 1024).ToString("0.0", CultureInfo.InvariantCulture)); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is int)) return string.Empty; var bytesCount = (int)value; return Convert(bytesCount); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MergeBrushesConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Windows.Data; namespace TelegramClient.Converters { public class MergeBrushesConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MessageStateToForegroundConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; using Caliburn.Micro; using Telegram.Api.Services; using Telegram.Api.TL; using TelegramClient.Services; namespace TelegramClient.Converters { public class MessageStateToForegroundConverter : IValueConverter { #region Implementation of IValueConverter public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var accentColor = (Brush)Application.Current.Resources["TelegramBadgeAccentBrush"]; var foregroundColor = (Brush)Application.Current.Resources["TelegramBadgeSubtleBrush"]; var dialog = value as TLDialog; if (dialog != null) { var notifySettings = dialog.NotifySettings as TLPeerNotifySettings; if (notifySettings != null) { var muteUntil = notifySettings.MuteUntil; if (muteUntil == null) { var alert = dialog.Peer is TLPeerUser ? IoC.Get().GetNotifySettings().ContactAlert : IoC.Get().GetNotifySettings().GroupAlert; return alert ? accentColor : foregroundColor; } var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = notifySettings.MuteUntil.Value * 4294967296 - clientDelta; var utc0SecsInt = muteUntil.Value - clientDelta / 4294967296.0; var muteUntilDateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); if (muteUntilDateTime > DateTime.Now) { return foregroundColor; } } return accentColor; } return accentColor; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } public class DialogToForegroundConverter : IValueConverter { #region Implementation of IValueConverter public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var accentColor = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"]); var foregroundColor = new SolidColorBrush((Color)Application.Current.Resources["PhoneForegroundColor"]); var encryptedDialog = value as TLEncryptedDialog; if (encryptedDialog != null) { return accentColor; } return foregroundColor; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } } ================================================ FILE: TelegramClient/Converters/MessageStatusConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class MessageStatusConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is MessageStatus) { var status = (MessageStatus) value; if (status == MessageStatus.Failed) return string.Format("{0}", AppResources.SendingFailed); if (status == MessageStatus.Confirmed) return string.Empty; if (status == MessageStatus.Sending) //return string.Format("{0}...", AppResources.Sending); return string.Empty; if (status == MessageStatus.Read) return string.Empty; if (status == MessageStatus.Compressing) return string.Format("{0}...", AppResources.Compressing); if (status == MessageStatus.Broadcast) return string.Empty; } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MessageToBriefInfoConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using TelegramClient.Resources; using TelegramClient.Services; using TelegramClient.Themes.Default.Templates; namespace TelegramClient.Converters { public class DialogToBriefInfoConverter : IValueConverter { public static string Convert(TLDecryptedMessageBase value, bool showContent) { var serviceMessage = value as TLDecryptedMessageService; if (serviceMessage != null) { if (serviceMessage.Action is TLDecryptedMessageActionEmpty) { return AppResources.SecretChatCreated; } return DecryptedServiceMessageToTextConverter.Convert(serviceMessage); } var message = value as TLDecryptedMessage; if (message != null) { var canSendString = string.Empty; if (message.Status == MessageStatus.Failed) { canSendString = string.Format("{0}: ", AppResources.SendingFailed); } var message73 = message as TLDecryptedMessage73; if (message73 != null && message73.GroupedId != null) { return canSendString + AppResources.Album; } if (message.Media != null) { var messageMediaWebPage = message.Media as TLDecryptedMessageMediaWebPage; if (messageMediaWebPage != null) { return canSendString + messageMediaWebPage.Url; } if (message.Media is TLDecryptedMessageMediaDocument) { if (message.IsVoice()) { return canSendString + AppResources.VoiceMessage; } if (message.IsVideo()) { return canSendString + AppResources.Video; } if (message.IsGif()) { return canSendString + AppResources.Gif; } return canSendString + AppResources.Document; } if (message.Media is TLDecryptedMessageMediaContact) { return canSendString + AppResources.Contact; } if (message.Media is TLDecryptedMessageMediaGeoPoint) { return canSendString + AppResources.GeoPoint; } if (message.Media is TLDecryptedMessageMediaPhoto) { return canSendString + AppResources.Photo; } if (message.Media is TLDecryptedMessageMediaVideo) { return canSendString + AppResources.Video; } if (message.Media is TLDecryptedMessageMediaAudio) { return canSendString + AppResources.Audio; } if (message.Media is TLDecryptedMessageMediaExternalDocument) { if (message.IsSticker()) { return canSendString + AppResources.Sticker; } return canSendString + AppResources.Document; } } if (message.Message != null) { if (showContent) { var str = message.Message != null? message.Message.ToString() : string.Empty; return canSendString + str.Substring(0, Math.Min(str.Length, 40)).Replace("\r\n", "\n").Replace('\n', ' '); } return canSendString + AppResources.Message; } } return null; } public static string Convert(TLMessageBase value, bool showContent) { var emptyMessage = value as TLMessageEmpty; if (emptyMessage != null) { return AppResources.EmptyMessage; } //var forwardedMessage = value as TLMessageForwarded; //if (forwardedMessage != null) //{ // return AppResources.ForwardedMessage; //} var serviceMessage = value as TLMessageService; if (serviceMessage != null) { return ServiceMessageToTextConverter.Convert(serviceMessage); //return AppResources.ServiceMessage; } var message = value as TLMessage; if (message != null) { var canSendString = string.Empty; if (message.Status == MessageStatus.Failed) { canSendString = string.Format("{0}: ", AppResources.SendingFailed); } var message73 = message as TLMessage73; if (message73 != null && message73.GroupedId != null) { return canSendString + AppResources.Album; } if (message.Media != null) { var mediaInvoice = message.Media as TLMessageMediaInvoice; if (mediaInvoice != null) { var description = mediaInvoice.Description; if (!TLString.IsNullOrEmpty(description)) { return canSendString + description; } return canSendString + AppResources.Invoice; } var mediaGame = message.Media as TLMessageMediaGame; if (mediaGame != null) { return canSendString + "🎮 " + mediaGame.Game.Title; } if (message.Media is TLMessageMediaDocument) { var captionString = string.Empty; var str = message.Message != null ? message.Message.ToString().Replace("\r\n", "\n").Replace('\n', ' ') : string.Empty; if (!string.IsNullOrEmpty(str)) { captionString = ", " + str.Substring(0, Math.Min(str.Length, 40)); } if (message.IsVoice()) { return canSendString + AppResources.VoiceMessage + captionString; } if (message.IsRoundVideo()) { return canSendString + AppResources.VideoMessage + captionString; } if (message.IsVideo()) { return canSendString + AppResources.Video + captionString; } if (message.IsGif()) { return canSendString + AppResources.Gif + captionString; } if (message.IsSticker()) { return canSendString + AppResources.Sticker + captionString; } var mediaDocument = message.Media as TLMessageMediaDocument45; if (mediaDocument != null) { var document = mediaDocument.Document as TLDocument22; if (document != null && !string.IsNullOrEmpty(document.DocumentName)) { return canSendString + document.DocumentName + captionString; } } return canSendString + AppResources.Document + captionString; } if (message.Media is TLMessageMediaContact) { return canSendString + AppResources.Contact; } if (message.Media is TLMessageMediaGeoLive) { return canSendString + AppResources.LiveLocation; } if (message.Media is TLMessageMediaGeo) { return canSendString + AppResources.GeoPoint; } if (message.Media is TLMessageMediaPhoto) { if (!TLString.IsNullOrEmpty(message.Message)) { var str = message.Message.ToString().Replace("\r\n", "\n").Replace('\n', ' '); if (!string.IsNullOrEmpty(str)) { return canSendString + AppResources.Photo + ", " + str.Substring(0, Math.Min(str.Length, 40)); } } return canSendString + AppResources.Photo; } if (message.Media is TLMessageMediaVideo) { return canSendString + AppResources.Video; } if (message.Media is TLMessageMediaAudio) { return canSendString + AppResources.Audio; } if (message.Media is TLMessageMediaUnsupportedBase) { return canSendString + AppResources.UnsupportedMedia; } } if (message.Message != null) { if (showContent) { var str = message.Message != null ? message.Message.ToString() : string.Empty; return canSendString + str.Substring(0, Math.Min(str.Length, 40)).Replace("\r\n", "\n").Replace('\n', ' '); } return canSendString + AppResources.Message; } } return null; } public static bool ShowDraft(TLDialog53 dialog) { if (dialog == null) return false; var draft = dialog.Draft as TLDraftMessage; if (draft != null) { if (dialog.Peer is TLPeerChannel) { var channel = dialog.With as TLChannel; if (channel != null && channel.IsBroadcast && !channel.Creator && !channel.IsEditor) { return false; } } var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage != null && !topMessage.Out.Value && topMessage.Unread.Value) { return false; } return true; } return false; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dialog = value as TLDialog; var broadcast = value as TLBroadcastDialog; if (dialog != null) { var dialog53 = dialog as TLDialog53; if (dialog53 != null) { if (ShowDraft(dialog53)) { var draft = dialog53.Draft as TLDraftMessage; if (draft != null) { if (TLString.IsNullOrEmpty(draft.Message) && draft.ReplyToMsgId != null && draft.ReplyToMsgId.Value > 0) { return AppResources.Reply.ToLowerInvariant(); } return draft.Message.ToString(); } } } var message = dialog.TopMessage; if (message != null) { return Convert(message, true); } } else if (broadcast != null) { var message = broadcast.TopMessage; if (message != null) { return Convert(message, true); } } else { var encryptedDialog = value as TLEncryptedDialog; if (encryptedDialog != null) { var chatId = encryptedDialog.Peer.Id; var encryptedChat = IoC.Get().GetEncryptedChat(chatId); var chatWaiting = encryptedChat as TLEncryptedChatWaiting; if (chatWaiting != null) { var participant = IoC.Get().GetUser(chatWaiting.ParticipantId); return string.Format(AppResources.WaitingForUserToGetOnline, participant.FirstName); } var chatDiscarded = encryptedChat as TLEncryptedChatDiscarded; if (chatDiscarded != null) { return AppResources.SecretChatDiscarded; } var chatEmpty = encryptedChat as TLEncryptedChatEmpty; if (chatEmpty != null) { return AppResources.EmptySecretChat; } var chat = encryptedChat as TLEncryptedChat; if (chat != null) { if (TLUtils.IsDisplayedDecryptedMessage(encryptedDialog.TopMessage)) { return Convert(encryptedDialog.TopMessage, true); } for (var i = 0; i < encryptedDialog.Messages.Count; i++) { if (TLUtils.IsDisplayedDecryptedMessage(encryptedDialog.Messages[i])) { return Convert(encryptedDialog.Messages[i], true); } } var currentUserId = IoC.Get().CurrentUserId; if (chat.AdminId.Value == currentUserId) { var cacheService = IoC.Get(); var user = cacheService.GetUser(chat.ParticipantId); if (user != null) { var userName = TLString.IsNullOrEmpty(user.FirstName) ? user.LastName : user.FirstName; return string.Format(AppResources.UserJoinedYourSecretChat, userName); } } else { return AppResources.YouJoinedTheSecretChat; } return AppResources.SecretChatCreated; } var chatRequested = encryptedChat as TLEncryptedChatRequested; if (chatRequested != null) { return AppResources.SecretChatRequested; } } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MessageToFontFamilyConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Windows; using System.Windows.Data; using Microsoft.Phone.Info; using Telegram.Api.TL; namespace TelegramClient.Converters { public class MessageToFontFamilyConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message != null) { var emptyMedia = message.Media as TLMessageMediaEmpty; if (emptyMedia != null) { return Application.Current.Resources["PhoneFontFamilyNormal"]; } return Application.Current.Resources["PhoneFontFamilySemiBold"]; } return Application.Current.Resources["PhoneFontFamilyNormal"]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/MuteUntilToStringConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services; using TelegramClient.Resources; using TelegramClient.Utils; namespace TelegramClient.Converters { public class MuteUntilToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is int)) { return null; } var muteUntil = (int)value; // Enabled if (muteUntil == 0) { return AppResources.Enabled; } // Disabled if (muteUntil == int.MaxValue) { return AppResources.Disabled; } // Other var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = muteUntil * 4294967296 - clientDelta; var utc0SecsInt = muteUntil - clientDelta / 4294967296.0; var muteUntilDateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); var now = DateTime.Now; var muteUntilTimeSpan = muteUntilDateTime - now; // Enabled if (muteUntilDateTime < now) { return AppResources.Enabled; } // Up to 1 hour var totalMinutes = (int)Math.Ceiling(muteUntilTimeSpan.TotalMinutes); if (totalMinutes < 60) { var minutes = Language.Declension( totalMinutes == 0 ? 1 : totalMinutes, AppResources.MinuteAccusative, null, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural, totalMinutes < 2 ? string.Format("{1} {0}", AppResources.MinuteNominativeSingular, 1).ToLowerInvariant() : string.Format("{1} {0}", AppResources.MinuteNominativePlural, Math.Abs(totalMinutes))).ToLowerInvariant(); return string.Format(AppResources.UnmuteIn, minutes); } // Up to 1 day var totalHours = (int)Math.Ceiling(muteUntilTimeSpan.TotalHours); if (totalHours < 24) { var hours = Language.Declension( totalHours == 0 ? 1 : totalHours, AppResources.HourNominativeSingular, null, AppResources.HourGenitiveSingular, AppResources.HourGenitivePlural, totalHours < 2 ? string.Format("{1} {0}", AppResources.HourNominativeSingular, 1).ToLowerInvariant() : string.Format("{1} {0}", AppResources.HourNominativePlural, Math.Abs(totalHours))).ToLowerInvariant(); return string.Format(AppResources.UnmuteIn, hours); } // Other var totalDays = (int)Math.Ceiling(muteUntilTimeSpan.TotalDays); if (totalDays >= 365) { return AppResources.Disabled; } var days = Language.Declension( totalDays == 0 ? 1 : totalDays, AppResources.DayNominativeSingular, null, AppResources.DayGenitiveSingular, AppResources.DayGenitivePlural, totalDays < 2 ? string.Format("{1} {0}", AppResources.DayNominativeSingular, 1).ToLowerInvariant() : string.Format("{1} {0}", AppResources.DayNominativePlural, Math.Abs(totalDays))).ToLowerInvariant(); return string.Format(AppResources.UnmuteIn, days); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MuteUntilToBoolConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is int)) { return null; } var muteUntil = (int)value; // Enabled if (muteUntil == 0) { return true; } // Disabled if (muteUntil == int.MaxValue) { return false; } // Other var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = muteUntil * 4294967296 - clientDelta; var utc0SecsInt = muteUntil - clientDelta / 4294967296.0; var muteUntilDateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); var now = DateTime.Now; // Enabled if (muteUntilDateTime < now) { return true; } return false; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/NotServiceMessageToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class NotServiceMessageToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isServiceMessage = value is TLMessageService; if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isServiceMessage = !isServiceMessage; } return isServiceMessage ? Visibility.Collapsed : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/NotifySettingsToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class DraftToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dialog53 = value as TLDialog53; if (dialog53 != null) { if (DialogToBriefInfoConverter.ShowDraft(dialog53)) { return Visibility.Visible; } } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ShowFromVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dialog = value as TLDialog; if (dialog != null) { var dialog53 = value as TLDialog53; if (dialog53 != null) { if (DialogToBriefInfoConverter.ShowDraft(dialog53)) { return Visibility.Collapsed; } } var topMessage = dialog.TopMessage; if (topMessage != null) { return topMessage.ShowFrom ? Visibility.Visible : Visibility.Collapsed; } } var encryptedDialog = value as TLEncryptedDialog; if (encryptedDialog != null) { var topMessage = encryptedDialog.TopMessage; if (topMessage != null) { return topMessage.ShowFrom ? Visibility.Visible : Visibility.Collapsed; } } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DialogToMessageStatusVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var dialog = value as TLDialog; if (dialog != null) { var dialog53 = value as TLDialog53; if (dialog53 != null) { if (DialogToBriefInfoConverter.ShowDraft(dialog53)) { return Visibility.Collapsed; } } var dialog71 = value as TLDialog71; if (dialog71 != null) { if (dialog71.IsPromo) { return Visibility.Collapsed; } } var topMessage = dialog.TopMessage as TLMessageCommon; if (topMessage != null) { if (!topMessage.Out.Value) { return Visibility.Collapsed; } var serviceMessage = topMessage as TLMessageService; if (serviceMessage != null && serviceMessage.Action is TLMessageActionClearHistory) { return Visibility.Collapsed; } } } var encryptedDialog = value as TLEncryptedDialog; if (encryptedDialog != null) { var topMessageCommon = encryptedDialog.TopMessage; if (topMessageCommon != null && !topMessageCommon.Out.Value) { return Visibility.Collapsed; } } return Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/OverlayAccentBrushConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using System.Windows.Media; namespace TelegramClient.Converters { public class OverlayAccentBrushConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty AccentColorProperty = DependencyProperty.Register("AccentColor", typeof (Color), typeof (OverlayAccentBrushConverter), new PropertyMetadata(default(Color))); public Color AccentColor { get { return (Color) GetValue(AccentColorProperty); } set { SetValue(AccentColorProperty, value); } } private Color? _prevColor; private Brush _prevBrush; public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (_prevColor.HasValue && _prevColor.Value != AccentColor) { _prevBrush = null; } if (_prevBrush == null) { var prevMixColor = Utils.ColorUtils.MergeColors(AccentColor, Color.FromArgb(100, 0, 0, 0)); _prevBrush = new SolidColorBrush(prevMixColor); _prevColor = AccentColor; } return _prevBrush; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PhoneNumberConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; //#if WP8 //using PhoneNumbers; //#endif using Telegram.Api.TL; using TelegramClient.Resources; using TelegramClient.Utils; namespace TelegramClient.Converters { public class SimplePhoneNumberConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var phone = value as TLString; if (phone == null) return value; var phoneString = phone.ToString(); return phoneString.StartsWith("+") ? phoneString : "+" + phoneString ; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhoneNumberConverter : IValueConverter { public static string Convert(TLString phone) { //#if WP8 // var phoneUtil = PhoneNumberUtil.GetInstance(); // try // { // return phoneUtil.Format(phoneUtil.Parse("+" + phone.Value, ""), PhoneNumberFormat.INTERNATIONAL).Replace('-', ' '); // } // catch (Exception e) // { // return "+" + phone.Value; // } //#endif return "+" + phone.Value; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var phone = value as TLString; if (phone == null) return value; return Convert(phone); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhoneCallToTitleConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var messageService = value as TLMessageService; if (messageService != null) { var actionPhoneCall = messageService.Action as TLMessageActionPhoneCall; if (actionPhoneCall != null) { var reason = actionPhoneCall.Reason; var duration = actionPhoneCall.Duration; if (duration != null) { return messageService.Out.Value ? AppResources.OutgoingCall : AppResources.IncomingCall; } var missed = reason as TLPhoneCallDiscardReasonMissed; if (missed != null) { if (messageService.Out.Value) { return AppResources.CanceledCall; } else { return AppResources.MissedCall; } } var busy = reason as TLPhoneCallDiscardReasonBusy; if (busy != null) { if (messageService.Out.Value) { return AppResources.OutgoingCall; } else { return AppResources.DeclinedCall; } } return messageService.Out.Value ? AppResources.OutgoingCall : AppResources.IncomingCall; } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhoneCallToSubtitleConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var messageService = value as TLMessageService; if (messageService != null) { var actionPhoneCall = messageService.Action as TLMessageActionPhoneCall; if (actionPhoneCall != null) { var duration = actionPhoneCall.Duration; var messageDateTimeConverter = (TLIntToDateTimeConverter)Application.Current.Resources["MessageDateTimeConverter"]; var timeString = messageDateTimeConverter.Convert(messageService.Date, null, null, null); var durationString = string.Empty; if (duration != null) { var durationTimeSpan = TimeSpan.FromSeconds(duration.Value); if (durationTimeSpan.TotalSeconds > 60.0) { durationString = Language.Declension( (int)durationTimeSpan.TotalMinutes, AppResources.MinuteNominativeSingular, AppResources.MinuteNominativePlural, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } else { durationString = Language.Declension( durationTimeSpan.Seconds, AppResources.SecondNominativeSingular, AppResources.SecondNominativePlural, AppResources.SecondGenitiveSingular, AppResources.SecondGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } } return timeString + (!string.IsNullOrEmpty(durationString) ? ", " + durationString : string.Empty); } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PhotoBytesToImageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.Windows.Data; using System.Windows.Media.Imaging; namespace TelegramClient.Converters { public class PhotoBytesToImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var buffer = value as byte[]; if (buffer == null) return null; BitmapImage imageSource; try { using (var stream = new MemoryStream(buffer)) { stream.Seek(0, SeekOrigin.Begin); var b = new BitmapImage(); b.SetSource(stream); imageSource = b; } } catch (Exception) { return null; } return imageSource; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PhotoToDimensionConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Linq; using System.Windows.Data; using Telegram.Api; using Telegram.Api.TL; namespace TelegramClient.Converters { public class InvoiceToDimensionConverter : IValueConverter { public static double GetWebDocumentDimension(TLWebDocumentBase webDocument, bool isWidth) { const double width = Constants.DefaultMessageContentWidth; if (isWidth) { return width; } var attributes = webDocument as IAttributes; if (attributes == null) { return double.NaN; } return StickerToDimensionConverter.GetAttributesDimension(attributes, isWidth, width); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = (string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase)); var mediaInvoice = value as TLMessageMediaInvoice; if (mediaInvoice == null) return null; var webDocument = mediaInvoice.Photo; if (webDocument == null) return null; return GetWebDocumentDimension(webDocument, isWidth); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class GameToDimensionConverter : IValueConverter { public static double GetGameDimension(TLGame game, bool isWidth) { const double width = 311.0 - 12.0; if (isWidth) { return width; } var photo = game.Photo as TLPhoto; if (photo == null) { return double.NaN; } TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { return width / size.W.Value * size.H.Value; //* 0.75; } return double.NaN; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = (string.Equals((string) parameter, "Width", StringComparison.OrdinalIgnoreCase)); var mediaGame = value as TLMessageMediaGame; if (mediaGame == null) return null; var game = mediaGame.Game; if (game == null) return null; return GetGameDimension(game, isWidth); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class WebPageToDimensionConverter : IValueConverter { public static double GetWebPageDimension(TLWebPage webPage, bool isWidth) { const double width = 311.0 - 12.0; if (isWidth) { return width; } var photo = webPage.Photo as TLPhoto; if (photo == null) { return double.NaN; } TLPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(width - size.W.Value) > Math.Abs(width - photoSize.W.Value)) { size = photoSize; } } if (size != null) { return width / size.W.Value * size.H.Value; //* 0.75; } return double.NaN; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = (string.Equals((string) parameter, "Width", StringComparison.OrdinalIgnoreCase)); var mediaWebPage = value as TLMessageMediaWebPage; if (mediaWebPage == null) return null; var webPage = mediaWebPage.WebPage as TLWebPage; if (webPage == null) return null; return GetWebPageDimension(webPage, isWidth); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DocumentToDimensionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { const double width = Constants.DefaultMessageContentWidth - 12.0; if (string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase)) { return width; } var media = value as TLMessageMediaDocument; if (media == null) { return double.NaN; } var document = media.Document as TLDocument; if (document == null) { return double.NaN; } if (string.Equals(document.MimeType.ToString(), "image/webp", StringComparison.OrdinalIgnoreCase)) { return double.NaN; } var size = document.Thumb as TLPhotoSize; if (size != null) { return width / size.W.Value * size.H.Value; } var cachedSize = document.Thumb as TLPhotoCachedSize; if (cachedSize != null) { return width / cachedSize.W.Value * cachedSize.H.Value; } return double.NaN; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class VideoToDimensionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { const double width = Constants.DefaultMessageContentWidth; if (string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase)) { return width; } var mediaDocument = value as TLMessageMediaDocument45; if (mediaDocument != null) { var video = mediaDocument.Video as TLDocument22; if (video == null) { return double.NaN; } var size = video.Thumb as TLPhotoSize; if (size != null) { return width / size.W.Value * size.H.Value; } var cachedSize = video.Thumb as TLPhotoCachedSize; if (cachedSize != null) { return width / cachedSize.W.Value * cachedSize.H.Value; } } var media = value as TLMessageMediaVideo; if (media != null) { var video = media.Video as TLVideo; if (video == null) { return double.NaN; } var size = video.Thumb as TLPhotoSize; if (size != null) { return width / size.W.Value * size.H.Value; } var cachedSize = video.Thumb as TLPhotoCachedSize; if (cachedSize != null) { return width / cachedSize.W.Value * cachedSize.H.Value; } } return double.NaN; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PhotoToDimensionConverter : IValueConverter { private double _maxDimension = Constants.DefaultMessageContentWidth; public double MaxDimension { get { return _maxDimension; } set { _maxDimension = value; } } public bool IsScaledVerticalPhoto(double minRatio, TLInt heigth, TLInt width) { var ratio = (double)heigth.Value / width.Value; return ratio > minRatio; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var minVerticalRatioToScale = 1.2; var scale = 1.2; // must be less than minVerticalRatioToScale to avoid large square photos if (string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase)) { var decryptedMediaPhoto = value as TLDecryptedMessageMediaPhoto; if (decryptedMediaPhoto != null) { if (decryptedMediaPhoto.H.Value > decryptedMediaPhoto.W.Value) { if (IsScaledVerticalPhoto(minVerticalRatioToScale, decryptedMediaPhoto.H, decryptedMediaPhoto.W)) { return scale * MaxDimension / decryptedMediaPhoto.H.Value * decryptedMediaPhoto.W.Value; } return MaxDimension / decryptedMediaPhoto.H.Value * decryptedMediaPhoto.W.Value; } return MaxDimension; } var mediaPhoto = value as TLMessageMediaPhoto; if (mediaPhoto != null) { value = mediaPhoto.Photo; } var photo = value as TLPhoto; if (photo != null) { IPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(MaxDimension - size.H.Value) > Math.Abs(MaxDimension - photoSize.H.Value)) { size = photoSize; } } if (size != null) { if (size.H.Value > size.W.Value) { if (IsScaledVerticalPhoto(minVerticalRatioToScale, size.H, size.W)) { return scale * MaxDimension / size.H.Value * size.W.Value; } return MaxDimension / size.H.Value * size.W.Value; } return MaxDimension; } } var mediaDocument = value as TLMessageMediaDocument; if (mediaDocument != null) { return new VideoToDimensionConverter().Convert(value, targetType, parameter, culture); } } { var decryptedMediaPhoto = value as TLDecryptedMessageMediaPhoto; if (decryptedMediaPhoto != null) { if (decryptedMediaPhoto.H.Value > decryptedMediaPhoto.W.Value) { if (IsScaledVerticalPhoto(minVerticalRatioToScale, decryptedMediaPhoto.H, decryptedMediaPhoto.W)) { return scale * MaxDimension; } return MaxDimension; } return MaxDimension / decryptedMediaPhoto.W.Value * decryptedMediaPhoto.H.Value; } var mediaPhoto = value as TLMessageMediaPhoto; if (mediaPhoto != null) { value = mediaPhoto.Photo; } var photo = value as TLPhoto; if (photo != null) { IPhotoSize size = null; var sizes = photo.Sizes.OfType(); foreach (var photoSize in sizes) { if (size == null || Math.Abs(MaxDimension - size.W.Value) > Math.Abs(MaxDimension - photoSize.W.Value)) { size = photoSize; } } if (size != null) { if (size.H.Value > size.W.Value) { if (IsScaledVerticalPhoto(minVerticalRatioToScale, size.H, size.W)) { return scale * MaxDimension; } return MaxDimension; } return MaxDimension / size.W.Value * size.H.Value; } } var mediaDocument = value as TLMessageMediaDocument; if (mediaDocument != null) { return new VideoToDimensionConverter().Convert(value, targetType, parameter, culture); } } return double.NaN; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class StickerPreviewToDimensionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { const double maxStickerDimension = 93.0; var isWidth = string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase); var attributes = value as IAttributes; if (attributes != null) { return StickerToDimensionConverter.GetAttributesDimension(attributes, isWidth, maxStickerDimension); } return isWidth ? double.NaN : maxStickerDimension; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class StickerToDimensionConverter : IValueConverter { public static double GetAttributesDimension(IAttributes sticker, bool isWidth, double maxStickerDimension) { TLDocumentAttributeImageSize imageSizeAttribute = null; for (var i = 0; i < sticker.Attributes.Count; i++) { imageSizeAttribute = sticker.Attributes[i] as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { break; } } if (imageSizeAttribute != null) { var width = imageSizeAttribute.W.Value; var height = imageSizeAttribute.H.Value; var maxDimension = Math.Max(width, height); if (maxDimension > maxStickerDimension) { var scaleFactor = maxStickerDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } return isWidth ? width : height; } return isWidth ? double.NaN : maxStickerDimension; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = string.Equals((string) parameter, "Width", StringComparison.OrdinalIgnoreCase); var attributes = value as IAttributes; if (attributes != null) { return GetAttributesDimension(attributes, isWidth, Constants.MaxStickerDimension); } return isWidth ? double.NaN : Constants.MaxStickerDimension; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class GifToDimensionConverter : IValueConverter { public static double GetGifDimension(double maxGifDimension, IPhotoSize thumb, IAttributes attributes, bool isWidth) { TLDocumentAttributeVideo videoAttribute = null; if (attributes != null) { for (var i = 0; i < attributes.Attributes.Count; i++) { videoAttribute = attributes.Attributes[i] as TLDocumentAttributeVideo; if (videoAttribute != null) { break; } } } if (videoAttribute != null) { var width = videoAttribute.W.Value; var height = videoAttribute.H.Value; var maxDimension = width; if (maxDimension > 0) { var scaleFactor = maxGifDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } } if (thumb != null) { var width = thumb.W.Value; var height = thumb.H.Value; var maxDimension = width; if (maxDimension > 0) { var scaleFactor = maxGifDimension / maxDimension; return isWidth ? scaleFactor * width : scaleFactor * height; } } return maxGifDimension; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase); var attributes = value as IAttributes; var document = value as TLDocument; var thumb = document != null ? document.Thumb as IPhotoSize : null; return GetGifDimension(Constants.MaxGifDimension, thumb, attributes, isWidth); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class WebPageGifToDimensionConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isWidth = string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase); var attributes = value as IAttributes; var document = value as TLDocument; var thumb = document != null ? document.Thumb as IPhotoSize : null; return GifToDimensionConverter.GetGifDimension(Constants.MaxGifDimension - 12.0 - 3.0 - 12.0, thumb, attributes, isWidth); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class InlineBotResultToWidthConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var result = value as TLBotInlineResult; if (result != null) { if (result.W != null && result.H != null) { var w = (double) result.W.Value; var h = (double) result.H.Value; if (w > 0.0 && h > 0.0) { return w / h * Constants.DeafultInlineBotResultHeight; } } } var mediaResult = value as TLBotInlineMediaResult; if (mediaResult != null) { var photo = mediaResult.Photo as TLPhoto; if (photo != null) { var photoSize = photo.Sizes.FirstOrDefault(x => x is IPhotoSize) as IPhotoSize; if (photoSize != null) { var w = (double)photoSize.W.Value; var h = (double)photoSize.H.Value; if (w > 0.0 && h > 0.0) { return w / h * Constants.DeafultInlineBotResultHeight; } } } var document = mediaResult.Document as TLDocument22; if (document != null) { var videoAttribute = document.Attributes.FirstOrDefault(x => x is TLDocumentAttributeVideo) as TLDocumentAttributeVideo; if (videoAttribute != null) { var w = (double)videoAttribute.W.Value; var h = (double)videoAttribute.H.Value; if (w > 0.0 && h > 0.0) { return w / h * Constants.DeafultInlineBotResultHeight; } } var imageSizeAttribute = document.Attributes.FirstOrDefault(x => x is TLDocumentAttributeImageSize) as TLDocumentAttributeImageSize; if (imageSizeAttribute != null) { var w = (double)imageSizeAttribute.W.Value; var h = (double)imageSizeAttribute.H.Value; if (w > 0.0 && h > 0.0) { return w / h * Constants.DeafultInlineBotResultHeight; } } var thumb = document.Thumb as IPhotoSize; if (thumb != null) { var w = (double)thumb.W.Value; var h = (double)thumb.H.Value; if (w > 0.0 && h > 0.0) { return w / h * Constants.DeafultInlineBotResultHeight; } } } } return double.NaN; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PhotoToThumbConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Linq; using System.Windows.Data; using System.Windows.Media.Imaging; using Caliburn.Micro; using Microsoft.Phone; using Telegram.Api.Services.FileManager; using Telegram.Api.TL; using TelegramClient.Helpers; namespace TelegramClient.Converters { public class PhotoToThumbConverter : IValueConverter { public bool Secret { get; set; } private readonly TelegramClient_WebP.ImageUtils _imageUtils = new TelegramClient_WebP.ImageUtils(); public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isBlurEnabled = parameter == null || !string.Equals(parameter.ToString(), "noblur", StringComparison.OrdinalIgnoreCase); var options = BitmapCreateOptions.DelayCreation | BitmapCreateOptions.BackgroundCreation; var decryptedMediaPhoto = value as TLDecryptedMessageThumbMediaBase; if (decryptedMediaPhoto != null) { var buffer = decryptedMediaPhoto.Thumb.Data; if (buffer.Length > 0 && decryptedMediaPhoto.ThumbW.Value > 0 && decryptedMediaPhoto.ThumbH.Value > 0) { if (!isBlurEnabled) { return ImageUtils.CreateImage(buffer, options); } else { try { var memoryStream = new MemoryStream(buffer); var bitmap = PictureDecoder.DecodeJpeg(memoryStream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, decryptedMediaPhoto.ThumbW.Value, decryptedMediaPhoto.ThumbH.Value, 0, 100); return ImageUtils.CreateImage(blurredStream, options); } catch (Exception ex) { } } } return null; } var mediaDocument = value as TLMessageMediaDocument; if (mediaDocument != null) { var document = mediaDocument.Document as TLDocument; if (document != null) { var size = document.Thumb as TLPhotoSize; if (size != null) { if (!string.IsNullOrEmpty(size.TempUrl)) { return size.TempUrl; } var location = size.Location as TLFileLocation; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); if (!isBlurEnabled) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { return ImageUtils.CreateImage(stream, options); } } catch (Exception ex) { } } else { var fileManager = IoC.Get(); fileManager.DownloadFile(location, document, size.Size, item => { mediaDocument.NotifyOfPropertyChange(() => mediaDocument.ThumbSelf); }); } } } else { BitmapImage preview; if (TryGetDocumentPreview(document.Id, out preview, options)) { return preview; } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { var bitmap = PictureDecoder.DecodeJpeg(stream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, size.W.Value, size.H.Value, 0, 100); return bitmap; } } catch (Exception ex) { } } } var fileManager = IoC.Get(); fileManager.DownloadFile(location, document, size.Size, item => { Execute.BeginOnUIThread(() => { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { var bitmap = PictureDecoder.DecodeJpeg(stream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, size.W.Value, size.H.Value, 0, 100); var previewfileName = string.Format("preview_document{0}.jpg", document.Id); SaveFile(previewfileName, blurredStream); mediaDocument.NotifyOfPropertyChange(() => mediaDocument.ThumbSelf); } } catch (Exception ex) { } } } }); }); } } } var cachedSize = document.Thumb as TLPhotoCachedSize; if (cachedSize != null) { if (!string.IsNullOrEmpty(cachedSize.TempUrl)) { return cachedSize.TempUrl; } var buffer = cachedSize.Bytes.Data; if (buffer != null && buffer.Length > 0) { if (!isBlurEnabled) { return ImageUtils.CreateImage(buffer, options); } else { BitmapImage preview; if (TryGetDocumentPreview(document.Id, out preview, options)) { return preview; } try { var bitmap = PictureDecoder.DecodeJpeg(new MemoryStream(buffer)); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, cachedSize.W.Value, cachedSize.H.Value, 0, 100); var fileName = string.Format("preview_document{0}.jpg", document.Id); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => SaveFile(fileName, blurredStream)); return ImageUtils.CreateImage(blurredStream, options); } catch (Exception ex) { } } } return null; } return null; } } var mediaPhoto = value as TLMessageMediaPhoto; if (mediaPhoto != null) { var photo = mediaPhoto.Photo as TLPhoto; if (photo != null) { var size = photo.Sizes.FirstOrDefault(x => TLString.Equals(x.Type, new TLString("s"), StringComparison.OrdinalIgnoreCase)) as TLPhotoSize; if (size != null) { if (!string.IsNullOrEmpty(size.TempUrl)) { return size.TempUrl; } var location = size.Location as TLFileLocation; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); if (!isBlurEnabled) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { return ImageUtils.CreateImage(stream, options); } } catch (Exception ex) { } } else { var fileManager = IoC.Get(); fileManager.DownloadFile(location, photo, size.Size, item => { mediaPhoto.NotifyOfPropertyChange(() => mediaPhoto.ThumbSelf); }); } } } else { BitmapImage preview; if (TryGetPhotoPreview(photo.Id, out preview, options)) { return preview; } using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { var bitmap = PictureDecoder.DecodeJpeg(stream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, size.W.Value, size.H.Value, 0, 100); return bitmap; } } catch (Exception ex) { } } } if (location.DCId.Value == 0) return null; var fileManager = IoC.Get(); fileManager.DownloadFile(location, photo, size.Size, item => { Execute.BeginOnUIThread(() => { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { var bitmap = PictureDecoder.DecodeJpeg(stream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, size.W.Value, size.H.Value, 0, 100); var previewfileName = string.Format("preview{0}.jpg", photo.Id); SaveFile(previewfileName, blurredStream); mediaPhoto.NotifyOfPropertyChange(() => mediaPhoto.ThumbSelf); } } catch (Exception ex) { } } } }); }); } } } var cachedSize = (TLPhotoCachedSize)photo.Sizes.FirstOrDefault(x => x is TLPhotoCachedSize); if (cachedSize != null) { if (!string.IsNullOrEmpty(cachedSize.TempUrl)) { return cachedSize.TempUrl; } var buffer = cachedSize.Bytes.Data; if (buffer != null && buffer.Length > 0) { if (!isBlurEnabled) { return ImageUtils.CreateImage(buffer, options); } else { BitmapImage preview; if (TryGetPhotoPreview(photo.Id, out preview, options)) { return preview; } try { var bitmap = PictureDecoder.DecodeJpeg(new MemoryStream(buffer)); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, cachedSize.W.Value, cachedSize.H.Value, 0, 100); var fileName = string.Format("preview{0}.jpg", photo.Id); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => SaveFile(fileName, blurredStream)); return ImageUtils.CreateImage(blurredStream, options); } catch (Exception ex) { } } } return null; } return null; } } var mediaGame = value as TLMessageMediaGame; if (mediaGame != null) { var photo = mediaGame.Photo as TLPhoto; if (photo != null) { var size = photo.Sizes.FirstOrDefault(x => TLString.Equals(x.Type, new TLString("s"), StringComparison.OrdinalIgnoreCase)) as TLPhotoSize; if (size != null) { if (!string.IsNullOrEmpty(size.TempUrl)) { return size.TempUrl; } var location = size.Location as TLFileLocation; if (location != null) { var fileName = String.Format("{0}_{1}_{2}.jpg", location.VolumeId, location.LocalId, location.Secret); if (!isBlurEnabled) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { return ImageUtils.CreateImage(stream, options); } } catch (Exception ex) { } } else { var fileManager = IoC.Get(); fileManager.DownloadFile(location, photo, size.Size, item => { mediaGame.NotifyOfPropertyChange(() => mediaGame.ThumbSelf); }); } } } else { BitmapImage preview; if (TryGetPhotoPreview(photo.Id, out preview, options)) { return preview; } var fileManager = IoC.Get(); fileManager.DownloadFile(location, photo, size.Size, item => { Execute.BeginOnUIThread(() => { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { var bitmap = PictureDecoder.DecodeJpeg(stream); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, size.W.Value, size.H.Value, 0, 100); var previewfileName = string.Format("preview{0}.jpg", photo.Id); SaveFile(previewfileName, blurredStream); mediaGame.NotifyOfPropertyChange(() => mediaGame.ThumbSelf); } } catch (Exception ex) { } } } }); }); } } } var cachedSize = (TLPhotoCachedSize) photo.Sizes.FirstOrDefault(x => x is TLPhotoCachedSize); if (cachedSize != null) { if (!string.IsNullOrEmpty(cachedSize.TempUrl)) { return cachedSize.TempUrl; } var buffer = cachedSize.Bytes.Data; if (buffer != null && buffer.Length > 0) { if (!isBlurEnabled) { return ImageUtils.CreateImage(buffer, options); } else { BitmapImage preview; if (TryGetPhotoPreview(photo.Id, out preview, options)) { return preview; } try { var bitmap = PictureDecoder.DecodeJpeg(new MemoryStream(buffer)); BlurBitmap(bitmap, Secret); var blurredStream = new MemoryStream(); bitmap.SaveJpeg(blurredStream, cachedSize.W.Value, cachedSize.H.Value, 0, 100); var fileName = string.Format("preview{0}.jpg", photo.Id); Telegram.Api.Helpers.Execute.BeginOnThreadPool(() => SaveFile(fileName, blurredStream)); return ImageUtils.CreateImage(blurredStream); } catch (Exception ex) { } } } return null; } return null; } } return null; } public static bool TryGetDocumentPreview(TLLong documentId, out BitmapImage preview, BitmapCreateOptions options) { preview = null; var fileName = string.Format("preview_document{0}.jpg", documentId); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { preview = ImageUtils.CreateImage(stream, options); return true; } } catch (Exception) { } } } return false; } public static bool TryGetPhotoPreview(TLLong photoId, out BitmapImage preview, BitmapCreateOptions options) { preview = null; var fileName = string.Format("preview{0}.jpg", photoId); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists(fileName)) { try { using (var stream = store.OpenFile(fileName, FileMode.Open, FileAccess.Read)) { preview = ImageUtils.CreateImage(stream, options); return true; } } catch (Exception) { } } } return false; } public static void SaveFile(string fileName, MemoryStream blurredStream) { using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { try { using (var stream = store.OpenFile(fileName, FileMode.OpenOrCreate, FileAccess.Write)) { var buffer = blurredStream.ToArray(); stream.Seek(0, SeekOrigin.Begin); stream.Write(buffer, 0, buffer.Length); } } catch (Exception) { } } } public void BlurBitmap(WriteableBitmap bitmap, bool secret) { //bitmap.BoxBlur(7); var pix = new byte[bitmap.Pixels.Length*4]; for (var j = 0; j < bitmap.Pixels.Length; j++) { pix[j*4] = (byte) bitmap.Pixels[j]; //r pix[j*4 + 1] = (byte) (bitmap.Pixels[j] >> 8); //g pix[j*4 + 2] = (byte) (bitmap.Pixels[j] >> 16); //b pix[j*4 + 3] = (byte) (bitmap.Pixels[j] >> 24); //a } var pixels = secret ? _imageUtils.FastSecretBlur(bitmap.PixelWidth, bitmap.PixelHeight, bitmap.PixelWidth * 4, pix) : _imageUtils.FastBlur(bitmap.PixelWidth, bitmap.PixelHeight, bitmap.PixelWidth*4, pix); for (var j = 0; j < bitmap.Pixels.Length; j++) { bitmap.Pixels[j] = pixels[j*4] + (pixels[j*4 + 1] << 8) + (pixels[j*4 + 2] << 16) + (pixels[j*4 + 3] << 24); } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PlaceholderDefaultImageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Data; using Telegram.Api; using Telegram.Api.TL; using TelegramClient.Resources; using TelegramClient.ViewModels; namespace TelegramClient.Converters { public class PlaceholderDefaultImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; var user = value as TLUserBase; if (user != null && user.Index == 333000) { #if WP81 return new Uri("/ApplicationIcon106.png", UriKind.Relative); #elif WP8 return new Uri("/ApplicationIcon210.png", UriKind.Relative); #endif return new Uri("/ApplicationIcon99.png", UriKind.Relative); } if (value is TLBroadcastChat) { return new Uri("/Images/Placeholder/placeholder.broadcast.png", UriKind.Relative); } return value is TLChatBase ? new Uri("/Images/Placeholder/placeholder.group.transparent-WXGA.png", UriKind.Relative) : new Uri("/Images/Placeholder/placeholder.user.transparent-WXGA.png", UriKind.Relative); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PlaceholderDefaultTextConverter : IValueConverter { public static string GetText(TLObject value) { if (value == null) return null; var word1 = string.Empty; var word2 = string.Empty; var user = value as TLUserBase; if (user != null) { word1 = user.FirstName != null ? user.FirstName.ToString() : string.Empty; word2 = user.LastName != null ? user.LastName.ToString() : string.Empty; if (word1.StartsWith("+") && string.IsNullOrEmpty(word2)) { word2 = word1.Substring(1).Trim(); } else if (word2.StartsWith("+") && string.IsNullOrEmpty(word1)) { word1 = word2.Substring(1).Trim(); } } var broadcast = value as TLBroadcastChat; if (broadcast != null) { var words = broadcast.FullName.Trim().Split(' '); if (words.Length > 0) { if (words.Length == 1) { var si = StringInfo.GetTextElementEnumerator(broadcast.FullName ?? string.Empty); word1 = si.MoveNext() ? si.GetTextElement() : string.Empty; word2 = si.MoveNext() ? si.GetTextElement() : string.Empty; } else { word1 = words[0]; word2 = words[words.Length - 1]; } } } var chat = value as TLChatBase; if (chat != null) { var words = chat.FullName.Trim().Split(' '); if (words.Length > 0) { if (words.Length == 1) { var si = StringInfo.GetTextElementEnumerator(chat.FullName ?? string.Empty); word1 = si.MoveNext() ? si.GetTextElement() : string.Empty; word2 = si.MoveNext() ? si.GetTextElement() : string.Empty; } else { word1 = words[0]; word2 = words[words.Length - 1]; } } } var si1 = StringInfo.GetTextElementEnumerator(word1 ?? string.Empty); var si2 = StringInfo.GetTextElementEnumerator(word2 ?? string.Empty); word1 = si1.MoveNext() ? si1.GetTextElement() : string.Empty; word2 = si2.MoveNext() ? si2.GetTextElement() : string.Empty; return string.Format("{0}{1}", word1, word2).Trim().ToUpperInvariant(); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //System.Diagnostics.Debug.WriteLine("PlaceholderDefaultTextConverter elapsed=" + ShellViewModel.Timer.Elapsed); return GetText(value as TLObject); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class LinkDefaultTextConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; var firstLetter = string.Empty; var message = value as TLMessage; if (message == null) return null; var links = message.Links; if (links != null && links.Count > 0) { firstLetter = GetFirstUrlLetter(links[0]); } else { var mediaWebPage = message.Media as TLMessageMediaWebPage; if (mediaWebPage != null) { var webPage = mediaWebPage.WebPage as TLWebPage; if (webPage != null) { if (!TLString.IsNullOrEmpty(webPage.DisplayUrl)) { firstLetter = GetFirstUrlLetter(webPage.DisplayUrl.ToString()); } } } } return firstLetter; } public static string GetFirstUrlLetter(string url) { url = url.Replace("http://", string.Empty); url = url.Replace("https://", string.Empty); url = url.Replace("www.", string.Empty); return GetFirstLetter(url); } public static string GetFirstLetter(string url) { var si = StringInfo.GetTextElementEnumerator(url); var word1 = si.MoveNext() ? si.GetTextElement() : string.Empty; return word1.Trim().ToUpperInvariant(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class InlineResultDefaultTextConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return null; var firstLetter = string.Empty; var botInlineMediaResult = value as TLBotInlineMediaResult; if (botInlineMediaResult != null) { var title = botInlineMediaResult.Title != null ? botInlineMediaResult.Title.ToString() : null; if (!string.IsNullOrEmpty(title)) return LinkDefaultTextConverter.GetFirstLetter(title); var description = botInlineMediaResult.Description != null? botInlineMediaResult.Description.ToString() : null; if (!string.IsNullOrEmpty(description)) return LinkDefaultTextConverter.GetFirstLetter(description); return null; } var botInlineResult = value as TLBotInlineResult; if (botInlineResult != null) { var contentUrl = botInlineResult.ContentUrl != null ? botInlineResult.ContentUrl.ToString() : null; if (!string.IsNullOrEmpty(contentUrl)) return LinkDefaultTextConverter.GetFirstUrlLetter(contentUrl); var title = botInlineResult.Title != null ? botInlineResult.Title.ToString() : null; if (!string.IsNullOrEmpty(title)) return LinkDefaultTextConverter.GetFirstLetter(title); var description = botInlineResult.Description != null ? botInlineResult.Description.ToString() : null; if (!string.IsNullOrEmpty(description)) return LinkDefaultTextConverter.GetFirstLetter(description); } return firstLetter; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/PrivateBetaToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class PrivateBetaToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { #if PRIVATE_BETA return Visibility.Visible; #else return Visibility.Collapsed; #endif } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class PrivateBetaIdentityToVisibilityConverter : IValueConverter { public static bool IsPrivateBeta { get { #if WP8 return Windows.ApplicationModel.Package.Current.Id.Name == "TelegramMessengerLLP.TelegramMessengerPreview"; #else #if DEBUG return true; #else return false; #endif #endif } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return IsPrivateBeta ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class LogVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return Telegram.Logs.Log.IsEnabled ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ProgressToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class ProgressToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isVisible; if (!(value is double)) return Visibility.Collapsed; var progress = (double)value; if (Math.Abs(progress) < 0.00001) { isVisible = false; } else { isVisible = Math.Abs(progress - 1.0) > 0.00001; } if (parameter is string && string.Equals((string) parameter, "invert", StringComparison.OrdinalIgnoreCase)) { isVisible = !isVisible; } return isVisible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ProgressBetween0and1ToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isVisible; var progress = (double)value; isVisible = progress > 0.0 && progress < 1.0; if (parameter is string && string.Equals((string)parameter, "invert", StringComparison.OrdinalIgnoreCase)) { isVisible = !isVisible; } return isVisible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ReplyMarkupButtonVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class ReplyMarkupButtonVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isVisible = false; var replyMarkup = value as TLReplyKeyboardMarkup; if (replyMarkup != null) { isVisible = true; } if (parameter != null && string.Equals(parameter.ToString(), "invert", StringComparison.OrdinalIgnoreCase)) { isVisible = !isVisible; } return isVisible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/SecretChatsAvailabilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class SecretChatsAvailabilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return true; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/SecretChatsForegroundConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class SecretChatsForegroundConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return Application.Current.Resources["PhoneForegroundBrush"]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/ServiceMessageToTextConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Text; using System.Windows; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Controls.Utils; using TelegramClient.Resources; using TelegramClient.Services; using TelegramClient.Views.Additional; using Language = TelegramClient.Utils.Language; namespace TelegramClient.Converters { public class DecryptedServiceMessageToTextConverter : IValueConverter { private static readonly Dictionary> _actionsCache = new Dictionary> { { typeof(TLDecryptedMessageActionAcceptKey), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionAcceptKey exchange_id=" + ((TLDecryptedMessageActionAcceptKey)action).ExchangeId; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionRequestKey), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionRequestKey exchange_id=" + ((TLDecryptedMessageActionRequestKey)action).ExchangeId; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionAbortKey), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionAbortKey exchange_id=" + ((TLDecryptedMessageActionAbortKey)action).ExchangeId; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionCommitKey), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionCommitKey exchange_id=" + ((TLDecryptedMessageActionCommitKey)action).ExchangeId; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionNoop), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionNoop"; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionEmpty), (action, fromUserId, fromUserFullName) => { #if DEBUG return AppResources.MessageActionEmpty; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionSetMessageTTL), (action, fromUserId, fromUserFullName) => { var currentUserId = IoC.Get().CurrentUserId; var resourceActionSetMessageTTL = string.Format(AppResources.MessageActionSetMessageTTL, fromUserFullName, @"{0}"); if (currentUserId == fromUserId) { resourceActionSetMessageTTL = AppResources.MessageActionYouSetMessageTTL; } var seconds = ((TLDecryptedMessageActionSetMessageTTL)action).TTLSeconds.Value; if (seconds == 0) { if (currentUserId == fromUserId) { return AppResources.MessageActionYouDisableMessageTTL; } return string.Format(AppResources.MessageActionDisableMessageTTL, fromUserFullName); } string secondsString; if (seconds < 60) { secondsString = Utils.Language.Declension(seconds, AppResources.SecondNominativeSingular, AppResources.SecondNominativePlural, AppResources.SecondGenitiveSingular, AppResources.SecondGenitivePlural); } else if (seconds < 60 * 60) { secondsString = Utils.Language.Declension(seconds / 60, AppResources.MinuteNominativeSingular, AppResources.MinuteNominativePlural, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural); } else if (seconds < TimeSpan.FromHours(24.0).TotalSeconds) { secondsString = Utils.Language.Declension((int)(seconds / TimeSpan.FromHours(1.0).TotalSeconds), AppResources.HourNominativeSingular, AppResources.HourNominativePlural, AppResources.HourGenitiveSingular, AppResources.HourGenitivePlural); } else if (seconds < TimeSpan.FromDays(7.0).TotalSeconds) { secondsString = Utils.Language.Declension((int)(seconds / TimeSpan.FromDays(1.0).TotalSeconds), AppResources.DayNominativeSingular, AppResources.DayNominativePlural, AppResources.DayGenitiveSingular, AppResources.DayGenitivePlural); } else if (seconds == TimeSpan.FromDays(7.0).TotalSeconds) { secondsString = Utils.Language.Declension(1, AppResources.WeekNominativeSingular, AppResources.WeekNominativePlural, AppResources.WeekGenitiveSingular, AppResources.WeekGenitivePlural); } else { secondsString = Utils.Language.Declension(seconds, AppResources.SecondNominativeSingular, AppResources.SecondNominativePlural, AppResources.SecondGenitiveSingular, AppResources.SecondGenitivePlural); } return string.Format(resourceActionSetMessageTTL, secondsString.ToLowerInvariant()); } }, { typeof(TLDecryptedMessageActionScreenshotMessages), (action, fromUserId, fromUserFullName) => { var currentUserId = IoC.Get().CurrentUserId; var resourceActionScreenshortMessage = string.Format(AppResources.MessageActionScreenshotMessages, fromUserFullName, @"{0}"); if (currentUserId == fromUserId) { resourceActionScreenshortMessage = AppResources.MessageActionYouScreenshotMessages; } return resourceActionScreenshortMessage; } }, { typeof(TLDecryptedMessageActionReadMessages), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionReadMessages random_id=" + string.Join(", ", ((TLDecryptedMessageActionReadMessages)action).RandomIds); #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionDeleteMessages), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionDeleteMessages random_id=" + string.Join(", ", ((TLDecryptedMessageActionDeleteMessages)action).RandomIds); #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionFlushHistory), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionFlushHistory"; #endif return string.Empty; } }, { typeof(TLDecryptedMessageActionNotifyLayer), (action, fromUserId, fromUserFullName) => { #if DEBUG return "TLDecryptedMessageActionNotifyLayer layer=" + ((TLDecryptedMessageActionNotifyLayer)action).Layer; #endif return string.Empty; } }, }; public static string Convert(TLDecryptedMessageService serviceMessage) { var fromId = serviceMessage.FromId; var fromUser = IoC.Get().GetUser(fromId); var fromUserFullName = fromUser != null ? fromUser.FullName : AppResources.User; var action = serviceMessage.Action; if (action != null && _actionsCache.ContainsKey(action.GetType())) { return _actionsCache[action.GetType()](action, fromId.Value, fromUserFullName); } #if DEBUG return serviceMessage.GetType().Name; #endif return AppResources.MessageActionEmpty; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var serviceMessage = value as TLDecryptedMessageService; if (serviceMessage != null) { return Convert(serviceMessage); } return AppResources.MessageActionEmpty; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ServiceMessageToTextConverter : IValueConverter { public static TLGame GetGame(TLMessageService message) { var reply = message.Reply as TLMessage31; if (reply != null) { var mediaGame = reply.Media as TLMessageMediaGame; if (mediaGame != null) { return mediaGame.Game; } } return null; } public static TLKeyboardButtonGame GetKeyboardButtonGame(TLMessageService message) { var reply = message.Reply as TLMessage31; if (reply != null) { if (reply.ReplyMarkup != null) { var replyKeyboardMarkup = reply.ReplyMarkup as TLReplyInlineMarkup; if (replyKeyboardMarkup != null) { foreach (var row in replyKeyboardMarkup.Rows) { foreach (var button in row.Buttons) { var keyboardButtonGame = button as TLKeyboardButtonGame; if (keyboardButtonGame != null) { return keyboardButtonGame; } } } } } } return null; } private static readonly Dictionary> _actionsCache = new Dictionary> { { typeof(TLMessageActionEmpty), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => AppResources.MessageActionEmpty }, { typeof(TLMessageActionSecureValuesSent), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var messageActionSecureValuesSent = action as TLMessageActionSecureValuesSent; if (messageActionSecureValuesSent != null) { var values = new List(); foreach (var type in messageActionSecureValuesSent.Types) { values.Add(SecureRequiredTypeToCaptionConverter.Convert(type)); } return string.Format(AppResources.MessageActionSecureValuesSent, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), string.Join(", ", values)); } return string.Empty; } }, { typeof(TLMessageActionSecureValuesSentMe), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { return string.Empty; } }, { typeof(TLMessageActionBotAllowed), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var messageActionBotAllowed = action as TLMessageActionBotAllowed; if (messageActionBotAllowed != null) { return string.Format(AppResources.MessageActionBotAllowed, messageActionBotAllowed.Domain); } return string.Empty; } }, { typeof(TLMessageActionCustomAction), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var messageActionCustomAction = action as TLMessageActionCustomAction; if (messageActionCustomAction != null) { return messageActionCustomAction.Message.ToString(); } return string.Empty; } }, { typeof(TLMessageActionPaymentSent), (message, action, fromfromUserId, fromUserFullName, useActiveLinks, noName) => GetPaymentSentString(action, message, fromUserFullName) }, { typeof(TLMessageActionPaymentSentMe), (message, action, fromfromUserId, fromUserFullName, useActiveLinks, noName) => GetPaymentSentString(action, message, fromUserFullName) }, { typeof(TLMessageActionPhoneCall), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var duration = ((TLMessageActionPhoneCall)action).Duration; var reason = ((TLMessageActionPhoneCall)action).Reason; var messageService = message as TLMessageService; if (messageService != null) { var messageDateTimeConverter = (TLIntToDateTimeConverter)Application.Current.Resources["MessageDateTimeConverter"]; var durationString = string.Empty; if (duration != null) { var durationTimeSpan = TimeSpan.FromSeconds(duration.Value); if (durationTimeSpan.TotalSeconds > 60.0) { durationString = Language.Declension( (int) durationTimeSpan.TotalMinutes, AppResources.MinuteNominativeSingular, AppResources.MinuteNominativePlural, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } else { durationString = Language.Declension( durationTimeSpan.Seconds, AppResources.SecondNominativeSingular, AppResources.SecondNominativePlural, AppResources.SecondGenitiveSingular, AppResources.SecondGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } } if (duration != null) { return messageService.Out.Value ? string.Format(AppResources.MessageActionOutgoingDurationCall, durationString) : string.Format(AppResources.MessageActionIncomingDurationCall, durationString); } var missed = reason as TLPhoneCallDiscardReasonMissed; if (missed != null) { if (messageService.Out.Value) { return AppResources.MessageActionCanceledCall; } else { return AppResources.MessageActionMissedCall; } } var busy2 = reason as TLPhoneCallDiscardReasonBusy; if (busy2 != null) { if (messageService.Out.Value) { return AppResources.MessageActionOutgoingCall; } else { return AppResources.MessageActionDeclinedCall; } } return messageService.Out.Value ? AppResources.MessageActionOutgoingCall : AppResources.MessageActionIncomingCall; } return null; } }, { typeof(TLMessageActionGameScore), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var score = ((TLMessageActionGameScore)action).Score.Value; var isPlural = score == 0 || score > 0; var user = IoC.Get().GetUser(new TLInt(fromUserId)) as TLUser; var userFullName = GetUserFullName(user, useActiveLinks, noName); var messageService = message as TLMessageService; if (messageService != null) { var game = GetGame(messageService); if (game != null) { var gameTitle = game.Title.ToString(); var reply = messageService.Reply as TLMessageCommon; if (reply != null) { gameTitle = GetGameFullNameString(gameTitle, messageService.Index, messageService.ToId, useActiveLinks); } if (user != null) { if (user.IsSelf) { return string.Format(isPlural ? AppResources.YourScoredAtGamePlural : AppResources.YourScoredAtGame, GetBoldString(score.ToString(CultureInfo.InvariantCulture), useActiveLinks), gameTitle); } return string.Format(isPlural ? AppResources.UserScoredAtGamePlural : AppResources.UserScoredAtGame, userFullName, GetBoldString(score.ToString(CultureInfo.InvariantCulture), useActiveLinks), gameTitle); } return string.Format(isPlural ? AppResources.UserScoredAtGamePlural : AppResources.UserScoredAtGame, AppResources.UserNominativeSingular, GetBoldString(score.ToString(CultureInfo.InvariantCulture), useActiveLinks), gameTitle); } if (user != null) { if (user.IsSelf) { return string.Format(isPlural ? AppResources.YourScoredPlural : AppResources.YourScored, score); } return string.Format(isPlural ? AppResources.UserScoredPlural : AppResources.UserScored, userFullName, score); } } return string.Format(isPlural ? AppResources.UserScoredPlural : AppResources.UserScored, AppResources.UserNominativeSingular, score); } }, { typeof(TLMessageActionChatCreate), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => string.Format(AppResources.MessageActionChatCreate, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), ((TLMessageActionChatCreate) action).Title) }, //{ typeof(TLMessageActionChannelCreate), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => string.Format(AppResources.MessageActionChannelCreate, GetFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), ((TLMessageActionChannelCreate) action).Title) }, { typeof(TLMessageActionChatEditPhoto), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => string.Format(AppResources.MessageActionChatEditPhoto, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName)) }, { typeof(TLMessageActionChatEditTitle), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => string.Format(AppResources.MessageActionChatEditTitle, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), ((TLMessageActionChatEditTitle) action).Title) }, { typeof(TLMessageActionChatDeletePhoto), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => string.Format(AppResources.MessageActionChatDeletePhoto, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName)) }, { typeof(TLMessageActionChatAddUser), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var userId = ((TLMessageActionChatAddUser)action).UserId; var user = IoC.Get().GetUser(userId); var userFullName = GetUserFullName(user, useActiveLinks, noName); if (userId.Value == fromUserId) { return string.Format(AppResources.MessageActionChatAddSelf, userFullName); } return string.Format(AppResources.MessageActionChatAddUser, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), userFullName); } }, { typeof(TLMessageActionChatAddUser41), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var users = ((TLMessageActionChatAddUser41)action).Users; var userFullName = new List(); foreach (var userId in users) { var user = IoC.Get().GetUser(userId); if (user != null) { userFullName.Add(GetUserFullName(user, useActiveLinks, noName)); } } if (users.Count == 1 && users[0].Value == fromUserId) { return string.Format(AppResources.MessageActionChatAddSelf, string.Join(", ", userFullName)); } return string.Format(AppResources.MessageActionChatAddUser, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), string.Join(", ", userFullName)); } }, { typeof(TLMessageActionScreenshotTaken), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var currentUserId = IoC.Get().CurrentUserId; var resourceActionScreenshortMessage = string.Format(AppResources.MessageActionScreenshotMessages, fromUserFullName, @"{0}"); if (currentUserId == fromUserId) { resourceActionScreenshortMessage = AppResources.MessageActionYouScreenshotMessages; } return resourceActionScreenshortMessage; } }, { typeof(TLMessageActionChatDeleteUser), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var userId = ((TLMessageActionChatDeleteUser)action).UserId; var user = IoC.Get().GetUser(userId); var userFullName = GetUserFullName(user, useActiveLinks, noName); if (userId.Value == fromUserId) { if (fromUserId == IoC.Get().CurrentUserId) { return AppResources.MessageActionLeftGroupSelf; } return string.Format(AppResources.MessageActionUserLeftGroup, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName)); } return string.Format(AppResources.MessageActionChatDeleteUser, GetUserFullNameString(fromUserFullName, fromUserId, useActiveLinks, noName), userFullName); } }, { typeof(TLMessageActionUnreadMessages), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => AppResources.UnreadMessages.ToLowerInvariant() }, { typeof(TLMessageActionContactRegistered), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var userId = ((TLMessageActionContactRegistered)action).UserId; var user = IoC.Get().GetUser(userId); var userFullName = user != null ? user.FirstName.ToString() : AppResources.User; if (string.IsNullOrEmpty(userFullName) && user != null) { userFullName = user.FullName; } return string.Format(AppResources.ContactRegistered, userFullName); } }, { typeof(TLMessageActionChatJoinedByLink), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var userId = new TLInt(fromUserId); var user = IoC.Get().GetUser(userId); var userFullName = user != null ? GetUserFullName(user, useActiveLinks, noName) : AppResources.User; if (string.IsNullOrEmpty(userFullName) && user != null) { userFullName = user.FullName; } return string.Format(AppResources.MessageActionChatJoinedByLink, userFullName); } }, { typeof(TLMessageActionMessageGroup), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var count = ((TLMessageActionMessageGroup) action).Group.Count.Value; return Language.Declension( count, AppResources.CommentNominativeSingular, AppResources.CommentNominativePlural, AppResources.CommentGenitiveSingular, AppResources.CommentGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } }, { typeof(TLMessageActionChatMigrateTo), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var channelId = ((TLMessageActionChatMigrateTo)action).ChannelId; var channel = IoC.Get().GetChat(channelId) as TLChannel; var channelFullName = channel != null ? channel.FullName : string.Empty; return string.Format(AppResources.MessageActionChatMigrateTo, GetChannelFullNameString(channelFullName, channelId.Value, useActiveLinks)); } }, { typeof(TLMessageActionChannelMigrateFrom), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { var chatId = ((TLMessageActionChannelMigrateFrom)action).ChatId; var chat = IoC.Get().GetChat(chatId); var chatFullName = chat != null ? chat.FullName : string.Empty; return string.Format(AppResources.MessageActionChannelMigrateFrom, GetChatFullNameString(chatFullName, chatId.Value, useActiveLinks)); } }, { typeof(TLMessageActionChatActivate), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { return AppResources.MessageActionChatActivate; } }, { typeof(TLMessageActionChatDeactivate), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { return AppResources.MessageActionChatDeactivate; } }, { typeof(TLMessageActionClearHistory), (message, action, fromUserId, fromUserFullName, useActiveLinks, noName) => { #if DEBUG return string.Format("{0}", action != null ? action.GetType().Name : AppResources.MessageActionEmpty); #endif return string.Empty; } }, }; private static string GetPaymentSentString(TLMessageActionBase action, TLMessageBase message, string fromUserFullName) { var actionPaymentSent = action as TLMessageActionPaymentSentBase; if (actionPaymentSent != null) { var serviceMessage49 = message as TLMessageService49; if (serviceMessage49 != null) { var replyToMsgId = serviceMessage49.ReplyToMsgId; if (replyToMsgId != null) { TLChannel channel = null; if (serviceMessage49.ToId is TLPeerChannel) { channel = IoC.Get().GetChat(serviceMessage49.ToId.Id) as TLChannel; } var reply = IoC.Get() .GetMessage(serviceMessage49.ReplyToMsgId, channel != null ? channel.Id : null) as TLMessage; if (reply != null) { var mediaInvoice = reply.Media as TLMessageMediaInvoice; if (mediaInvoice != null) { return string.Format(AppResources.MessageActionPaymentSentFor, (actionPaymentSent.TotalAmount.Value / Math.Pow(10.0, Currency.GetPow(actionPaymentSent.Currency.ToString())) + " " + Currency.GetSymbol(actionPaymentSent.Currency.ToString())), fromUserFullName, mediaInvoice.Title); } } } return string.Format(AppResources.MessageActionPaymentSent, (actionPaymentSent.TotalAmount.Value / Math.Pow(10.0, Currency.GetPow(actionPaymentSent.Currency.ToString())) + " " + Currency.GetSymbol(actionPaymentSent.Currency.ToString())), fromUserFullName); } } return null; } private static string GetBoldString(string score, bool useActiveLinks) { if (!useActiveLinks) { return score; } return '\a' + "bold" + '\b' + score + '\a'; } private static string GetGameFullNameString(string fullName, int msgId, TLPeerBase toId, bool useActiveLinks) { if (!useActiveLinks) { return fullName; } var channelIdString = toId is TLPeerChannel ? "&channel_id=" + toId.Id.Value : string.Empty; return '\a' + "tlg://?action=game&msg_id=" + msgId + channelIdString + '\b' + fullName + '\a'; } private static string GetUserFullName(TLUserBase user, bool useActiveLinks, bool noName) { if (user == null) return AppResources.User; return GetUserFullNameString(user.FullName2, user.Index, useActiveLinks, noName); } private static string GetUserFullNameString(string fullName, int userId, bool useActiveLinks, bool noName) { if (noName) { return string.Empty; } if (!useActiveLinks) { return fullName; } return '\a' + "tlg://?action=profile&user_id=" + userId + '\b' + fullName + '\a'; } private static string GetChatFullNameString(string fullName, int userId, bool useActiveLinks) { return fullName; if (!useActiveLinks) { return fullName; } return '\a' + "tlg://?action=profile&chat_id=" + userId + '\b' + fullName + '\a'; } private static string GetChannelFullNameString(string fullName, int userId, bool useActiveLinks) { return fullName; if (!useActiveLinks) { return fullName; } return '\a' + "tlg://?action=profile&channel_id=" + userId + '\b' + fullName + '\a'; } public static string Convert(TLMessageService serviceMessage, bool useActiveLinks = false, bool noName = false) { var fromId = serviceMessage.FromId; var fromUser = IoC.Get().GetUser(fromId); var fromUserFullName = fromUser != null ? fromUser.FullName2 : AppResources.User; //var stateService = IoC.Get(); //if (fromId.Value == stateService.CurrentUserId) //{ // fromUserFullName = AppResources.You; //} var action = serviceMessage.Action; if (serviceMessage.ToId is TLPeerChannel) { var channel = IoC.Get().GetChat(serviceMessage.ToId.Id) as TLChannel; var isMegaGroup = channel != null && channel.IsMegaGroup; var actionPinMessage = action as TLMessageActionPinMessage; if (actionPinMessage != null) { var serviceMessage49 = serviceMessage as TLMessageService49; if (serviceMessage49 != null) { var replyToMsgId = serviceMessage49.ReplyToMsgId; if (replyToMsgId != null && channel != null) { var reply = IoC.Get().GetMessage(serviceMessage49.ReplyToMsgId, channel.Id) as TLMessage; if (reply != null) { if (!isMegaGroup && fromUser == null) { useActiveLinks = false; fromUserFullName = channel.FullName; } var mediaGame = reply.Media as TLMessageMediaGame; if (mediaGame != null) { return string.Format(AppResources.MessageActionPinGame, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var text = reply.Message.ToString(); if (text.Length > 0) { if (text.Length > 20) { return string.Format(AppResources.MessageActionPinText, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), text.Substring(0, 20).Replace("\r\n", "\n").Replace("\n", " ") + "..."); } return string.Format(AppResources.MessageActionPinText, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), text); } var mediaPhoto = reply.Media as TLMessageMediaPhoto; if (mediaPhoto != null) { return string.Format(AppResources.MessageActionPinPhoto, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaDocument = reply.Media as TLMessageMediaDocument; if (mediaDocument != null) { if (TLMessageBase.IsSticker(mediaDocument.Document)) { return string.Format(AppResources.MessageActionPinSticker, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } if (TLMessageBase.IsVoice(mediaDocument.Document)) { return string.Format(AppResources.MessageActionPinVoiceMessage, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } if (TLMessageBase.IsMusic(mediaDocument.Document)) { return string.Format(AppResources.MessageActionPinTrack, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } if (TLMessageBase.IsVideo(mediaDocument.Document)) { return string.Format(AppResources.MessageActionPinVideo, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } if (TLMessageBase.IsGif(mediaDocument.Document)) { return string.Format(AppResources.MessageActionPinGif, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } return string.Format(AppResources.MessageActionPinFile, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaContact = reply.Media as TLMessageMediaContact; if (mediaContact != null) { return string.Format(AppResources.MessageActionPinContact, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaGeoLive = reply.Media as TLMessageMediaGeoLive; if (mediaGeoLive != null) { return string.Format(AppResources.MessageActionPinGeoLive, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaGeo = reply.Media as TLMessageMediaGeo; if (mediaGeo != null) { return string.Format(AppResources.MessageActionPinMap, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaAudio = reply.Media as TLMessageMediaAudio; if (mediaAudio != null) { return string.Format(AppResources.MessageActionPinVoiceMessage, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } var mediaVideo = reply.Media as TLMessageMediaVideo; if (mediaVideo != null) { return string.Format(AppResources.MessageActionPinVideo, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } } } return string.Format(AppResources.MessageActionPinMessage, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)); } } var actionChatAddUser41 = action as TLMessageActionChatAddUser41; if (actionChatAddUser41 != null) { var users = ((TLMessageActionChatAddUser41)action).Users; var userFullName = new List(); foreach (var userId in users) { var user = IoC.Get().GetUser(userId); if (user != null) { userFullName.Add(GetUserFullName(user, useActiveLinks, noName)); } } if (users.Count == 1 && users[0].Value == fromId.Value) { if (fromId.Value == IoC.Get().CurrentUserId) { return AppResources.MessageActionChatJoinSelf; } return string.Format(AppResources.MessageActionChatJoin, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), string.Join(", ", userFullName)); } return string.Format(AppResources.MessageActionChatAddUser, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), string.Join(", ", userFullName)); } var actionChannelCreate = action as TLMessageActionChannelCreate; if (actionChannelCreate != null) { return isMegaGroup ? string.Format(AppResources.MessageActionChatCreate, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), ((TLMessageActionChannelCreate)action).Title) : string.Format(AppResources.MessageActionChannelCreate, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), ((TLMessageActionChannelCreate) action).Title); } var actionChatEditPhoto = action as TLMessageActionChatEditPhoto; if (actionChatEditPhoto != null) { return isMegaGroup ? string.Format(AppResources.MessageActionChatEditPhoto, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)) : AppResources.MessageActionChannelEditPhoto; } var actionChatDeletePhoto = action as TLMessageActionChatDeletePhoto; if (actionChatDeletePhoto != null) { return isMegaGroup ? string.Format(AppResources.MessageActionChatDeletePhoto, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName)) : AppResources.MessageActionChannelDeletePhoto; } var actionChantEditTitle = action as TLMessageActionChatEditTitle; if (actionChantEditTitle != null) { return isMegaGroup ? string.Format(AppResources.MessageActionChatEditTitle, GetUserFullNameString(fromUserFullName, fromId.Value, useActiveLinks, noName), actionChantEditTitle.Title) : string.Format(AppResources.MessageActionChannelEditTitle, actionChantEditTitle.Title); } } if (action != null && _actionsCache.ContainsKey(action.GetType())) { return _actionsCache[action.GetType()](serviceMessage, action, fromId.Value, fromUserFullName, useActiveLinks, noName); } #if DEBUG return string.Format("{0} msg_id={1}", action != null ? action.ToString() : AppResources.MessageActionEmpty, serviceMessage.Id); #endif return AppResources.MessageActionEmpty; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var serviceMessage = value as TLMessageService; if (serviceMessage != null) { var useActiveLinks = false; var noUser = false; var p = parameter as string; if (p != null) { useActiveLinks = !p.StartsWith("nolinks", StringComparison.OrdinalIgnoreCase); noUser = p.EndsWith("nouser", StringComparison.OrdinalIgnoreCase); } return Convert(serviceMessage, useActiveLinks, noUser).Trim(' '); } return AppResources.MessageActionEmpty; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/StatusToImageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class StatusToImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is MessageStatus)) return null; var status = (MessageStatus) value; if (status == MessageStatus.Sending) { return new Uri("/Images/Messages/message.state.sending-WXGA.png", UriKind.Relative); } if (status == MessageStatus.Confirmed) { return new Uri("/Images/Messages/message.state.sent-WXGA.png", UriKind.Relative); } if (status == MessageStatus.Read) { return new Uri("/Images/Messages/message.state.read-WXGA.png", UriKind.Relative); } //if (status == MessageStatus.Broadcast) //{ // return new Uri("/Images/Messages/message.state.broadcast.png", UriKind.Relative); //} return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/StickerSetToCountStringConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class StickerSetToCountStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var set = value as TLStickerSet32; if (set != null) { return Utils.Language.Declension( set.Count.Value, AppResources.StickerNominativeSingular, AppResources.StickerNominativePlural, AppResources.StickerGenitiveSingular, AppResources.StickerGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/StringEqualsToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class StringEqualsToVisibilityConverter : IValueConverter { public bool IsInvert { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = false; if (value != null) { var values = ((string) parameter).Split(' '); foreach (var s in values) { if (string.Equals(value.ToString(), s, StringComparison.OrdinalIgnoreCase)) { visibility = true; break; } } if (IsInvert) { visibility = !visibility; } } return visibility ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DialogStatusEqualsToVisibilityConverter : IValueConverter { public bool IsInvert { get; set; } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var visibility = false; if (value != null) { var dialog = value as TLDialog; var broadcastDialog = value as TLBroadcastDialog; var encryptedDialog = value as TLEncryptedDialog; if (dialog != null) { var topMessage = dialog.TopMessage; if (topMessage != null) { value = topMessage.Status; } } else if (broadcastDialog != null) { var topMessage = broadcastDialog.TopMessage; if (topMessage != null) { value = topMessage.Status; } } else if (encryptedDialog != null) { var topMessage = encryptedDialog.TopMessage; if (topMessage != null && TLUtils.IsDisplayedDecryptedMessage(topMessage)) { value = topMessage.Status; } else { for (var i = 0; i < encryptedDialog.Messages.Count; i++) { if (TLUtils.IsDisplayedDecryptedMessage(encryptedDialog.Messages[i])) { value = encryptedDialog.Messages[i].Status; break; } } } } var values = ((string)parameter).Split(' '); foreach (var s in values) { if (string.Equals(value.ToString(), s, StringComparison.OrdinalIgnoreCase)) { visibility = true; break; } } if (IsInvert) { visibility = !visibility; } } return visibility ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/StringFormatConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class StringFormatConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty StringProperty = DependencyProperty.Register("String", typeof (string), typeof (StringFormatConverter), new PropertyMetadata(default(string))); public string String { get { return (string) GetValue(StringProperty); } set { SetValue(StringProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return string.Format(String, value); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/TLIntToDateTimeConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Threading; using System.Windows; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class TLIntToDateTimeConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty TodayFormatProperty = DependencyProperty.Register("TodayFormat", typeof(string), typeof(TLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string TodayFormat { get { return (string)GetValue(TodayFormatProperty); } set { SetValue(TodayFormatProperty, value); } } public static readonly DependencyProperty YesterdayStringProperty = DependencyProperty.Register("YesterdayString", typeof(string), typeof(TLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string YesterdayString { get { return (string)GetValue(YesterdayStringProperty); } set { SetValue(YesterdayStringProperty, value); } } public static readonly DependencyProperty YesterdayFormatProperty = DependencyProperty.Register("YesterdayFormat", typeof(string), typeof(TLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string YesterdayFormat { get { return (string)GetValue(YesterdayFormatProperty); } set { SetValue(YesterdayFormatProperty, value); } } public static readonly DependencyProperty RegularFormatProperty = DependencyProperty.Register("RegularFormat", typeof(string), typeof(TLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string RegularFormat { get { return (string)GetValue(RegularFormatProperty); } set { SetValue(RegularFormatProperty, value); } } public static readonly DependencyProperty LongRegularFormatProperty = DependencyProperty.Register("LongRegularFormat", typeof(string), typeof(TLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string LongRegularFormat { get { return (string)GetValue(LongRegularFormatProperty); } set { SetValue(LongRegularFormatProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { //#if DEBUG // return value; //#endif if (!(value is TLInt)) return value; var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = ((TLInt)value).Value * 4294967296 - clientDelta; var utc0SecsInt = ((TLInt)value).Value - clientDelta / 4294967296.0; var dateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); //var tzi = TimeZoneInfo.Local; //Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; var cultureInfo = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); var shortTimePattern = UserStatusToStringConverter.GetShortTimePattern(ref cultureInfo); //Today if ((dateTime.Date == DateTime.Now.Date) && !string.IsNullOrEmpty(TodayFormat)) return dateTime.ToString(string.Format(TodayFormat, shortTimePattern), cultureInfo); //Yesterday if ((dateTime.Date.AddDays(1) == DateTime.Now.Date) && !string.IsNullOrEmpty(YesterdayString)) return YesterdayString; if ((dateTime.Date.AddDays(1) == DateTime.Now.Date) && !string.IsNullOrEmpty(YesterdayFormat)) return dateTime.ToString(string.Format(YesterdayFormat, shortTimePattern), cultureInfo); //Long time ago (no more than one year ago) if (dateTime.Date.AddDays(365) >= DateTime.Now.Date && !string.IsNullOrEmpty(RegularFormat)) return dateTime.ToString(string.Format(RegularFormat, shortTimePattern), cultureInfo); //Long long time ago return dateTime.ToString(string.Format(LongRegularFormat, shortTimePattern), cultureInfo); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DialogTLIntToDateTimeConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty TodayFormatProperty = DependencyProperty.Register("TodayFormat", typeof(string), typeof(DialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string TodayFormat { get { return (string)GetValue(TodayFormatProperty); } set { SetValue(TodayFormatProperty, value); } } public static readonly DependencyProperty WeekFormatProperty = DependencyProperty.Register("WeekFormat", typeof(string), typeof(DialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string WeekFormat { get { return (string)GetValue(WeekFormatProperty); } set { SetValue(WeekFormatProperty, value); } } public static readonly DependencyProperty RegularFormatProperty = DependencyProperty.Register("RegularFormat", typeof(string), typeof(DialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string RegularFormat { get { return (string)GetValue(RegularFormatProperty); } set { SetValue(RegularFormatProperty, value); } } public static readonly DependencyProperty LongRegularFormatProperty = DependencyProperty.Register("LongRegularFormat", typeof(string), typeof(DialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string LongRegularFormat { get { return (string)GetValue(LongRegularFormatProperty); } set { SetValue(LongRegularFormatProperty, value); } } public static string Convert(TLInt date, string TodayFormat, string WeekFormat, string RegularFormat, string LongRegularFormat) { var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = date.Value * 4294967296 - clientDelta; var utc0SecsInt = date.Value - clientDelta / 4294967296.0; var dateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); var cultureInfo = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); var shortTimePattern = UserStatusToStringConverter.GetShortTimePattern(ref cultureInfo); //Today if ((dateTime.Date == DateTime.Now.Date) && !string.IsNullOrEmpty(TodayFormat)) return dateTime.ToString(string.Format(TodayFormat, shortTimePattern), cultureInfo); //Week if (dateTime.Date.AddDays(7) >= DateTime.Now.Date && !string.IsNullOrEmpty(WeekFormat)) return dateTime.ToString(string.Format(WeekFormat, shortTimePattern), cultureInfo); //Long time ago (no more than one year ago) if (dateTime.Date.AddDays(365) >= DateTime.Now.Date && !string.IsNullOrEmpty(RegularFormat)) return dateTime.ToString(string.Format(RegularFormat, shortTimePattern), cultureInfo); //Long long time ago return dateTime.ToString(string.Format(LongRegularFormat, shortTimePattern), cultureInfo); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is TLInt)) return value; return Convert((TLInt)value, TodayFormat, WeekFormat, RegularFormat, LongRegularFormat); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DraftDialogTLIntToDateTimeConverter : DependencyObject, IValueConverter { public static readonly DependencyProperty TodayFormatProperty = DependencyProperty.Register("TodayFormat", typeof(string), typeof(DraftDialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string TodayFormat { get { return (string)GetValue(TodayFormatProperty); } set { SetValue(TodayFormatProperty, value); } } public static readonly DependencyProperty WeekFormatProperty = DependencyProperty.Register("WeekFormat", typeof(string), typeof(DraftDialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string WeekFormat { get { return (string)GetValue(WeekFormatProperty); } set { SetValue(WeekFormatProperty, value); } } public static readonly DependencyProperty RegularFormatProperty = DependencyProperty.Register("RegularFormat", typeof(string), typeof(DraftDialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string RegularFormat { get { return (string)GetValue(RegularFormatProperty); } set { SetValue(RegularFormatProperty, value); } } public static readonly DependencyProperty LongRegularFormatProperty = DependencyProperty.Register("LongRegularFormat", typeof(string), typeof(DraftDialogTLIntToDateTimeConverter), new PropertyMetadata(default(string))); public string LongRegularFormat { get { return (string)GetValue(LongRegularFormatProperty); } set { SetValue(LongRegularFormatProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TLInt date = null; var dialog = value as TLDialog; if (dialog != null) { var dialog71 = dialog as TLDialog71; if (dialog71 != null && dialog71.IsPromo) { return AppResources.ProxySponsor; } var dialog53 = dialog as TLDialog53; if (dialog53 != null) { var messageCommon = dialog.TopMessage as TLMessageCommon; if (messageCommon != null) { date = messageCommon.Date; } var draft = dialog53.Draft as TLDraftMessage; if (draft != null) { if (date == null || draft.Date.Value > date.Value) { date = draft.Date; } } } else { var messageCommon = dialog.TopMessage as TLMessageCommon; if (messageCommon != null) { date = messageCommon.Date; } } } var encryptedDialog = value as TLEncryptedDialog; if (encryptedDialog != null) { var messageCommon = encryptedDialog.TopMessage; if (messageCommon != null) { date = messageCommon.Date; } } if (date == null) return null; return DialogTLIntToDateTimeConverter.Convert(date, TodayFormat, WeekFormat, RegularFormat, LongRegularFormat); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/TestBindingConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class TestBindingConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TLUtils.WritePerformance("==TestBindingConverter"); return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/TextMessageToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.IO; using System.IO.IsolatedStorage; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class TextMessageToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message == null) return Visibility.Collapsed; if (TLString.IsNullOrEmpty(message.Message)) return Visibility.Collapsed; return Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class MediaFileAvailableToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var message = value as TLMessage; if (message == null) return Visibility.Collapsed; #if WP8 var mediaDocument = message.Media as TLMessageMediaDocument; if (mediaDocument != null) { var file = mediaDocument.File; if (file == null) { var document = mediaDocument.Document as TLDocument; if (document != null) { var localFileName = document.GetFileName() ?? string.Empty; var globalFileName = mediaDocument.IsoFileName ?? string.Empty; var store = IsolatedStorageFile.GetUserStoreForApplication(); if (store.FileExists(localFileName) || store.FileExists(globalFileName) #if WP81 || File.Exists(globalFileName) #endif ) { return Visibility.Visible; } } } return file != null? Visibility.Visible : Visibility.Collapsed; } var mediaVideo = message.Media as TLMessageMediaVideo; if (mediaVideo != null) { var file = mediaVideo.File; if (file == null) { var video = mediaVideo.Video as TLVideo; if (video != null) { var localFileName = video.GetFileName() ?? string.Empty; var globalFileName = mediaVideo.IsoFileName ?? string.Empty; var store = IsolatedStorageFile.GetUserStoreForApplication(); if (store.FileExists(localFileName) || store.FileExists(globalFileName) #if WP81 || File.Exists(globalFileName) #endif ) { return Visibility.Visible; } } } return file != null ? Visibility.Visible : Visibility.Collapsed; } #endif return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/TextSizeToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class TextSizeToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is int)) { return Visibility.Collapsed; } return (int) value > 1500 ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UnreadCountToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class UnreadCountToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var unreadCount = value as TLInt; if (unreadCount == null) return Visibility.Collapsed; return unreadCount.Value == 0 ? Visibility.Collapsed : Visibility.Visible; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UnreadMessageConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class UnreadMessageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var unread = value as TLBool; if (unread != null) { return unread.Value ? "U" : "R"; } return string.Empty; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UnregisteredUserIdToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class ContactToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; return userBase != null && (userBase.IsContact || userBase.IsSelf) ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class SearchResultStatusToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase != null) { return Visibility.Visible; } var chat = value as TLChat; if (chat != null) { return Visibility.Visible; } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UppercaseConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; namespace TelegramClient.Converters { public class UppercaseConverter : IValueConverter { #region Implementation of IValueConverter /// /// Modifies the source data before passing it to the target for display in the UI. /// /// /// The value to be passed to the target dependency property. /// /// The source data being passed to the target.The of data expected by the target dependency property.An optional parameter to be used in the converter logic.The culture of the conversion. public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is string)) return null; return Convert(value.ToString()); } public static string Convert(string value) { return value.ToUpperInvariant(); } /// /// Modifies the target data before passing it to the source object. This method is called only in bindings. /// /// /// The value to be passed to the source object. /// /// The target data being passed to the source.The of data expected by the source object.An optional parameter to be used in the converter logic.The culture of the conversion. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } #endregion } } ================================================ FILE: TelegramClient/Converters/UserStatusToBrushConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class UserStatusToBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase == null) return Application.Current.Resources["PhoneSubtleBrush"]; var user = userBase as TLUser; if (user != null) { if (user.IsBot) { return Application.Current.Resources["PhoneSubtleBrush"]; } } var statusOnline = userBase.Status as TLUserStatusOnline; if (statusOnline != null) return Application.Current.Resources["TelegramAccentBrush"]; return Application.Current.Resources["PhoneSubtleBrush"]; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UserStatusToStringConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Threading; using System.Windows.Data; using Caliburn.Micro; using Telegram.Api.Services; using Telegram.Api.TL; using TelegramClient.Resources; using TelegramClient.Utils; namespace TelegramClient.Converters { public class UserStatusToStringConverter : IValueConverter { public static string GetShortTimePattern(ref CultureInfo ci) { if (ci.DateTimeFormat.ShortTimePattern.Contains("H")) { return "H:mm"; } ci.DateTimeFormat.AMDesignator = "am"; ci.DateTimeFormat.PMDesignator = "pm"; return "h:mmt"; } public static string Convert(TLUserStatus status) { if (status == null) { return AppResources.LastSeenLongTimeAgo; } if (!(status is TLUserStatusEmpty)) { if (status is TLUserStatusOnline) { return LowercaseConverter.Convert(AppResources.Online); } if (status is TLUserStatusRecently) { return LowercaseConverter.Convert(AppResources.LastSeenRecently); } if (status is TLUserStatusLastMonth) { return LowercaseConverter.Convert(AppResources.LastSeenWithinMonth); } if (status is TLUserStatusLastWeek) { return LowercaseConverter.Convert(AppResources.LastSeenWithinWeek); } if (status is TLUserStatusOffline) { var cultureInfo = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); var shortTimePattern = GetShortTimePattern(ref cultureInfo); var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = (((TLUserStatusOffline)status).WasOnline).Value * 4294967296 - clientDelta; var utc0SecsInt = ((TLUserStatusOffline)status).WasOnline.Value - clientDelta / 4294967296.0; //var utc0SecsInt = (((TLUserStatusOffline) status).WasOnline).Value; var lastSeen = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); var lastSeenTimeSpan = DateTime.Now - lastSeen; // Just now if (lastSeenTimeSpan.TotalMinutes <= 1) { return AppResources.LastSeenJustNow.ToLowerInvariant(); } // Up to one hour if (lastSeenTimeSpan < TimeSpan.FromMinutes(60.0)) { var minutes = Language.Declension( lastSeenTimeSpan.Minutes == 0 ? 1 : lastSeenTimeSpan.Minutes, AppResources.MinuteAccusative, null, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural, lastSeenTimeSpan.Minutes < 2 ? string.Format("{1} {0}", AppResources.MinuteNominativeSingular, 1).ToLowerInvariant() : string.Format("{1} {0}", AppResources.MinuteNominativePlural, Math.Abs(lastSeenTimeSpan.Minutes))).ToLowerInvariant(); return string.Format(AppResources.LastSeen, minutes).ToLowerInvariant(); } // Today if (lastSeen.Date == DateTime.Now.Date) { return string.Format( AppResources.LastSeenTodayAt.ToLowerInvariant(), new DateTime(lastSeen.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)); } // Yesterday if (lastSeen.Date.AddDays(1.0) == DateTime.Now.Date) { return string.Format( AppResources.LastSeenYesterdayAt.ToLowerInvariant(), new DateTime(lastSeen.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)); } // this year if (lastSeen.Date.AddDays(365) >= DateTime.Now.Date) { return string.Format( AppResources.LastSeenAtDate.ToLowerInvariant(), lastSeen.ToString(AppResources.UserStatusDayFormat, cultureInfo), new DateTime(lastSeen.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)); } return string.Format( AppResources.LastSeenAtDate.ToLowerInvariant(), lastSeen.ToString(AppResources.UserStatusYearDayFormat, cultureInfo), new DateTime(lastSeen.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)); } } return LowercaseConverter.Convert(AppResources.LastSeenLongTimeAgo); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase == null) return null; var user = userBase as TLUser; if (user != null) { if (user.IsBot) { if (user.IsBotAllHistory) { return AppResources.SeesAllMessages.ToLowerInvariant(); } return AppResources.OnlySeesMessagesStartingWithSlash.ToLowerInvariant(); } //if (user.IsSelf) //{ // return AppResources.ChatWithYourself.ToLowerInvariant(); //} } var status = userBase.Status; if (status == null) return LowercaseConverter.Convert(AppResources.LastSeenLongTimeAgo); return Convert(status); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class EditDateToStringConverter : IValueConverter { public static string GetShortTimePattern(ref CultureInfo ci) { if (ci.DateTimeFormat.ShortTimePattern.Contains("H")) { return "H:mm"; } ci.DateTimeFormat.AMDesignator = "am"; ci.DateTimeFormat.PMDesignator = "pm"; return "h:mmt"; } public static string Convert(TLInt editDate) { if (editDate == null || editDate.Value == 0) { return AppResources.UpdatedJustNow.ToLowerInvariant(); } var cultureInfo = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone(); var shortTimePattern = GetShortTimePattern(ref cultureInfo); var clientDelta = IoC.Get().ClientTicksDelta; //var utc0SecsLong = editDate.Value * 4294967296 - clientDelta; var utc0SecsInt = editDate.Value - clientDelta / 4294967296.0; //var utc0SecsInt = (((TLUserStatusOffline) status).WasOnline).Value; var editDateTime = Telegram.Api.Helpers.Utils.UnixTimestampToDateTime(utc0SecsInt); var editTimeSpan = DateTime.Now - editDateTime; // Just now if (editTimeSpan.TotalMinutes <= 1) { return AppResources.UpdatedJustNow.ToLowerInvariant(); } // Up to one hour if (editTimeSpan < TimeSpan.FromMinutes(60.0)) { var minutes = Language.Declension( editTimeSpan.Minutes == 0 ? 1 : editTimeSpan.Minutes, AppResources.MinuteAccusative, null, AppResources.MinuteGenitiveSingular, AppResources.MinuteGenitivePlural, editTimeSpan.Minutes < 2 ? string.Format("{1} {0}", AppResources.MinuteNominativeSingular, 1).ToLowerInvariant() : string.Format("{1} {0}", AppResources.MinuteNominativePlural, Math.Abs(editTimeSpan.Minutes))).ToLowerInvariant(); return string.Format(AppResources.UpdatedAgo, minutes).ToLowerInvariant(); } // Today if (editDateTime.Date == DateTime.Now.Date) { return string.Format( AppResources.UpdatedTodayAt, new DateTime(editDateTime.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)).ToLowerInvariant(); } // Yesterday if (editDateTime.Date.AddDays(1.0) == DateTime.Now.Date) { return string.Format( AppResources.UpdatedYesterdayAt, new DateTime(editDateTime.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)).ToLowerInvariant(); } // this year if (editDateTime.Date.AddDays(365) >= DateTime.Now.Date) { return string.Format( AppResources.UpdatedAtDate, editDateTime.ToString(AppResources.UserStatusDayFormat, cultureInfo), new DateTime(editDateTime.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)).ToLowerInvariant(); } return string.Format( AppResources.UpdatedAtDate, editDateTime.ToString(AppResources.UserStatusYearDayFormat, cultureInfo), new DateTime(editDateTime.TimeOfDay.Ticks).ToString(shortTimePattern, cultureInfo)).ToLowerInvariant(); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return Convert(value as TLInt); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class SearchResultStatusToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase != null) { var user = userBase as TLUser; if (user != null) { if (user.IsBot) { return AppResources.Bot.ToLowerInvariant(); } } var status = userBase.Status; if (status == null) return LowercaseConverter.Convert(AppResources.LastSeenLongTimeAgo); return UserStatusToStringConverter.Convert(status); } var channel = value as TLChannel; if (channel != null) { return null; } var chat = value as TLChat; if (chat != null) { var participantsCount = chat.ParticipantsCount.Value; return Language.Declension( participantsCount, AppResources.CompanyNominativeSingular, AppResources.CompanyNominativePlural, AppResources.CompanyGenitiveSingular, AppResources.CompanyGenitivePlural).ToLower(CultureInfo.CurrentUICulture); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class ViaBotToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as IUserName; if (userBase == null) return null; return string.Format(AppResources.Via.ToLowerInvariant(), "@" + userBase.UserName); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class DecryptedViaBotToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var viaBot = value as TLString; if (viaBot == null) return null; return string.Format(AppResources.Via, "@" + viaBot).ToLowerInvariant(); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UserStatusToVisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Globalization; using System.Windows; using System.Windows.Data; using Telegram.Api.TL; namespace TelegramClient.Converters { public class UserStatusToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var statusOnline = value as TLUserStatusOnline; if (statusOnline != null) { return Visibility.Visible; } return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/UserToActionStringConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows.Data; using Telegram.Api.TL; using TelegramClient.Resources; namespace TelegramClient.Converters { public class UserToActionStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var userBase = value as TLUserBase; if (userBase != null && userBase.IsRequest) { return AppResources.AddToContacts.ToUpperInvariant(); } if (userBase != null && userBase.IsForeign) { return AppResources.ShareMyContactInfo.ToUpperInvariant(); } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/Converters/WP8VisibilityConverter.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace TelegramClient.Converters { public class WP8VisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { #if WP8 return Visibility.Visible; #else return Visibility.Collapsed; #endif } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class WP81VisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { #if WP81 return Visibility.Visible; #else return Visibility.Collapsed; #endif } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/EmojiKeyboardTemplateSelector.cs ================================================ using System; using System.Globalization; using System.Windows; using System.Windows.Data; using TelegramClient.Views.Dialogs; namespace TelegramClient { public class EmojiKeyboardTemplateSelector : DependencyObject, IValueConverter { public static readonly DependencyProperty EmojiKeyboardTemplateProperty = DependencyProperty.Register("EmojiKeyboardTemplate", typeof (DataTemplate), typeof (EmojiKeyboardTemplateSelector), new PropertyMetadata(default(DataTemplate))); public DataTemplate EmojiKeyboardTemplate { get { return (DataTemplate) GetValue(EmojiKeyboardTemplateProperty); } set { SetValue(EmojiKeyboardTemplateProperty, value); } } public static readonly DependencyProperty EmptyTemplateProperty = DependencyProperty.Register("EmptyTemplate", typeof (DataTemplate), typeof (EmojiKeyboardTemplateSelector), new PropertyMetadata(default(DataTemplate))); public DataTemplate EmptyTemplate { get { return (DataTemplate) GetValue(EmptyTemplateProperty); } set { SetValue(EmptyTemplateProperty, value); } } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return value is EmojiKeyboard ? EmojiKeyboardTemplate : EmptyTemplate; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } } ================================================ FILE: TelegramClient/EmojiPanel/Controls/Emoji/EmojiControl.xaml ================================================  ================================================ FILE: TelegramClient/EmojiPanel/Controls/Emoji/EmojiControl.xaml.cs ================================================ // // This is the source code of Telegram for Windows Phone v. 3.x.x. // It is licensed under GNU GPL v. 2 or later. // You should have received a copy of the license in this archive (see LICENSE). // // Copyright Evgeny Nadymov, 2013-present. // using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Windows.Threading; using Caliburn.Micro; using Coding4Fun.Toolkit.Controls; using Microsoft.Devices; using Microsoft.Phone.Controls; using Microsoft.Phone.Info; using Microsoft.Phone.Shell; using Telegram.Api.Services; using Telegram.Api.Services.Cache; using Telegram.Api.TL; using Telegram.Controls; using Telegram.Controls.Extensions; using Telegram.Controls.VirtualizedView; using Telegram.EmojiPanel.Controls.Utilites; using TelegramClient.Converters; using TelegramClient.Resources; using TelegramClient.Services; using TelegramClient.ViewModels; using TelegramClient.Views; using TelegramClient.Views.Dialogs; using Binding = System.Windows.Data.Binding; using GestureEventArgs = System.Windows.Input.GestureEventArgs; using Execute = Telegram.Api.Helpers.Execute; using UnreadCounter = Telegram.Controls.UnreadCounter; namespace Telegram.EmojiPanel.Controls.Emoji { public partial class EmojiControl { public static readonly DependencyProperty IsStickersPanelVisibleProperty = DependencyProperty.Register( "IsStickersPanelVisible", typeof (bool), typeof (EmojiControl), new PropertyMetadata(OnIsStickersPanelVisible)); private static void OnIsStickersPanelVisible(DependencyObject d, DependencyPropertyChangedEventArgs e) { var emojiControl = d as EmojiControl; if (emojiControl != null) { emojiControl.UpdateButtons((bool)e.NewValue); } } public bool IsStickersPanelVisible { get { return (bool) GetValue(IsStickersPanelVisibleProperty); } set { SetValue(IsStickersPanelVisibleProperty, value); } } private List _category1Sprites; private List _category2Sprites; private List _category3Sprites; private List _category4Sprites; private List _category5Sprites; private List _recentStickersSprites; private List _favedStickersSprites; private List _groupStickersSprites; private List> _stickersSprites; public event EventHandler IsOpenedChanged; private void RaiseIsOpenedChanged(bool isOpened) { var eventHandler = IsOpenedChanged; if (eventHandler != null) { eventHandler(this, new IsOpenedEventArgs { IsOpened = isOpened }); } } public event EventHandler SettingsButtonClick; protected virtual void RaiseSettingsButtonClick() { var handler = SettingsButtonClick; if (handler != null) handler(this, EventArgs.Empty); } public event EventHandler StickerSetAdded; protected virtual void RaiseStickerSetAdded(StickerSetAddedEventArgs args) { var handler = StickerSetAdded; if (handler != null) handler(this, args); } public TextBox TextBoxTarget { get; set; } private const int FirstStickerSliceCount = 3; private const int FeaturedStickersSliceCount = 10; private const int AlbumOrientationHeight = 328; public const int PortraitOrientationHeight100 = 408; public const int PortraitOrientationHeight100WP10 = (int) 341.3333; public const int PortraitOrientationHeight112 = 408; public const int PortraitOrientationHeight112Software = 400; public const int PortraitOrientationHeight150 = 408; public const int PortraitOrientationHeight150Software = 400; public const int PortraitOrientationHeight160 = 408; public const int PortraitOrientationHeight160WP10 = (int) 341.6667; public const int PortraitOrientationHeight225 = 332; public static int PortraitOrientationHeight { get { #if WP8 var deviceName = DeviceStatus.DeviceName; var appBar = new ApplicationBar(); switch (Application.Current.Host.Content.ScaleFactor) { case 100: //Lumia 820 WVGA 480x800 if (!string.IsNullOrEmpty(deviceName)) { deviceName = deviceName.Replace("-", string.Empty).ToLowerInvariant(); //Lumia 640 if (deviceName.StartsWith("rm1067") // 640XL 720x1280 scale=100 wp10 ) { return PortraitOrientationHeight100WP10; } } return PortraitOrientationHeight100; break; case 112: //Lumia 535 qHD 540x960 // Software buttons //Lumia 535 if (appBar.DefaultSize == 67.0) { return PortraitOrientationHeight112Software; } return PortraitOrientationHeight112; break; case 150: //HTC 8X, 730, 830 720p 720x1280 //Software buttons //Lumia 730 if (appBar.DefaultSize == 67.0) { return PortraitOrientationHeight150Software; } return PortraitOrientationHeight150; break; case 160: //Lumia 925, 1020 WXGA 768x1280 if (!string.IsNullOrEmpty(deviceName)) { deviceName = deviceName.Replace("-", string.Empty).ToLowerInvariant(); //Lumia 950, 950XL 5,2 5,7 inch QHD 2560x1440 if (deviceName.StartsWith("rm1116") // 950XL dual sim || deviceName.StartsWith("rm1085") // 950XL single sim || deviceName.StartsWith("rm1118") // 950 dual sim || deviceName.StartsWith("rm1104")) // 950 single sim { return PortraitOrientationHeight160WP10; } } return PortraitOrientationHeight160; break; case 225: // Lumia 1520, 930 1020p 1080x1920 if (!string.IsNullOrEmpty(deviceName)) { deviceName = deviceName.Replace("-", string.Empty).ToLowerInvariant(); //Lumia 1520 6 inch 1020p if (deviceName.StartsWith("rm937") || deviceName.StartsWith("rm938") || deviceName.StartsWith("rm939") || deviceName.StartsWith("rm940")) { return PortraitOrientationHeight225; } } //Lumia 930 other 1020p return PortraitOrientationHeight100; break; } #endif return PortraitOrientationHeight100; } } private bool _isOpen; private bool _isPortrait = true; private bool _isTextBoxTargetFocused; private bool _isBlocked; // Block IsOpen during animation private int _currentCategory; private bool _wasRendered; private readonly TranslateTransform _frameTransform; private static EmojiControl _instance; public static EmojiControl GetInstance() { return _instance ?? (_instance = new EmojiControl()); } public static bool TryGetInstance(out EmojiControl instance) { instance = _instance; return instance != null; } public static bool HasInstance { get { return _instance != null; } } public static readonly DependencyProperty RootFrameTransformProperty = DependencyProperty.Register( "RootFrameTransform", typeof(double), typeof(EmojiControl), new PropertyMetadata(OnRootFrameTransformChanged)); public EmojiControl() { InitializeComponent(); //var frame = (Frame)Application.Current.RootVisual; //_frameTransform = ((TranslateTransform)((TransformGroup)frame.RenderTransform).Children[0]); //var binding = new Binding("Y") //{ // Source = _frameTransform //}; //SetBinding(RootFrameTransformProperty, binding); Preview.Margin = new Thickness(0.0, -(800.0 - PortraitOrientationHeight), 0.0, 0.0); VirtPanel.InitializeWithScrollViewer(CSV); VirtPanel.ScrollPositionChanged += VirtPanel_OnScrollPositionChanged; VirtPanel.ScrollStateChanged += VirtPanel_OnScrollStateChanged; FeaturedStickersVirtPanel.InitializeWithScrollViewer(FeaturedStickersCSV); FeaturedStickersVirtPanel.ScrollPositionChanged += FeaturedStickersVirtPanel_OnScrollPositionChanged; FeaturedStickersVirtPanel.ScrollStateChanged += FeaturedStickersVirtPanel_OnScrollStateChanged; //SizeChanged += OnSizeChanged; OnSizeChanged(null, null); LoadButtons(); LoadCachedFeaturedStickersAsync(); CurrentCategory = 0; } private void VirtPanel_OnScrollStateChanged(object sender, ScrollingStateChangedEventArgs e) { if (_searchSprite == null || string.IsNullOrEmpty(_searchSprite.Text)) return; if (!e.NewValue) { var unreadStickerSets = new List(); var height = CSV.VerticalOffset + CSV.ViewportHeight; var lastInViewDisplacement = double.PositiveInfinity; MyListItemBase lastInViewItem = null; foreach (var child in VirtPanel.Children) { var canvasTop = Canvas.GetTop(child); var displacement = Math.Abs(height - canvasTop); if (displacement <= lastInViewDisplacement && canvasTop < height) { var listItem = child as MyListItemBase; if (listItem != null) { lastInViewItem = listItem; lastInViewDisplacement = displacement; } } } if (lastInViewItem != null) { foreach (var item in VirtPanel.VirtItems) { var listItem = item.View; if (listItem != null) { var spriteItem = listItem.VirtSource as FeaturedStickerSpriteItem; if (spriteItem != null && spriteItem.StickerSet.Unread) { unreadStickerSets.Add(spriteItem.StickerSet); } } if (item.View == lastInViewItem) { break; } } } if (unreadStickerSets.Count > 0) { var id = new TLVector(); foreach (var unreadStickerSet in unreadStickerSets) { id.Add(unreadStickerSet.Id); } var mtProtoService = IoC.Get(); mtProtoService.ReadFeaturedStickersAsync(id, result => { foreach (var unreadStickerSet in unreadStickerSets) { unreadStickerSet.Unread = false; } if (_featuredStickers != null) { for (var i = 0; i < id.Count; i++) { for (var j = 0; j < _featuredStickers.Unread.Count; j++) { if (_featuredStickers.Unread[j].Value == id[i].Value) { _featuredStickers.Unread.RemoveAt(j); break; } } } var cacheService = IoC.Get(); cacheService.SaveFeaturedStickersAsync(_featuredStickers); } Execute.BeginOnUIThread(() => { foreach (var unreadStickerSet in unreadStickerSets) { unreadStickerSet.NotifyOfPropertyChange(() => unreadStickerSet.Unread); } if (_featuredStickers != null && _featuredStickersCounter != null) { _featuredStickersCounter.Counter = _featuredStickers.Unread.Count; } }); }, error => Execute.BeginOnUIThread(() => { Execute.ShowDebugMessage("messages.readFeaturedStickers error=" + error); })); } } } private void FeaturedStickersVirtPanel_OnScrollStateChanged(object sender, ScrollingStateChangedEventArgs e) { if (CurrentCategory != FeaturedStickersCategoryIndex) return; if (!e.NewValue) { var unreadStickerSets = new List(); var height = FeaturedStickersCSV.VerticalOffset + FeaturedStickersCSV.ViewportHeight; var lastInViewDisplacement = double.PositiveInfinity; MyListItemBase lastInViewItem = null; foreach (var child in FeaturedStickersVirtPanel.Children) { var canvasTop = Canvas.GetTop(child); var displacement = Math.Abs(height - canvasTop); if (displacement <= lastInViewDisplacement && canvasTop < height) { var listItem = child as MyListItemBase; if (listItem != null) { lastInViewItem = listItem; lastInViewDisplacement = displacement; } } } if (lastInViewItem != null) { foreach (var item in FeaturedStickersVirtPanel.VirtItems) { var listItem = item.View; if (listItem != null) { var spriteItem = listItem.VirtSource as FeaturedStickerSpriteItem; if (spriteItem != null && spriteItem.StickerSet.Unread) { unreadStickerSets.Add(spriteItem.StickerSet); } } if (item.View == lastInViewItem) { break; } } } if (unreadStickerSets.Count > 0) { var id = new TLVector(); foreach (var unreadStickerSet in unreadStickerSets) { id.Add(unreadStickerSet.Id); } //Execute.ShowDebugMessage("message.readFeaturedStickers id=" + string.Join(", ", unreadStickerSets.Select(x => x.Id.Value))); var mtProtoService = IoC.Get(); mtProtoService.ReadFeaturedStickersAsync(id, result => { foreach (var unreadStickerSet in unreadStickerSets) { unreadStickerSet.Unread = false; } if (_featuredStickers != null) { for (var i = 0; i < id.Count; i++) { for (var j = 0; j < _featuredStickers.Unread.Count; j++) { if (_featuredStickers.Unread[j].Value == id[i].Value) { _featuredStickers.Unread.RemoveAt(j); break; } } } var cacheService = IoC.Get(); cacheService.SaveFeaturedStickersAsync(_featuredStickers); } Execute.BeginOnUIThread(() => { foreach (var unreadStickerSet in unreadStickerSets) { unreadStickerSet.NotifyOfPropertyChange(() => unreadStickerSet.Unread); } if (_featuredStickers != null && _featuredStickersCounter != null) { _featuredStickersCounter.Counter = _featuredStickers.Unread.Count; } }); }, error => Execute.BeginOnUIThread(() => { Execute.ShowDebugMessage("messages.readFeaturedStickers error=" + error); })); } } } public void BindTextBox(TextBox textBox, bool isStickersPanelVisible = false) { TextBoxTarget = textBox; UpdateButtons(isStickersPanelVisible); textBox.GotFocus += TextBoxOnGotFocus; textBox.LostFocus += TextBoxOnLostFocus; } public void UnbindTextBox() { TextBoxTarget.GotFocus -= TextBoxOnGotFocus; TextBoxTarget.LostFocus -= TextBoxOnLostFocus; TextBoxTarget = null; } public bool IsOpen { get { return !_isTextBoxTargetFocused && _isOpen; } set { // Dont hide EmojiControl when keyboard is shown (or to be shown) if (!_isTextBoxTargetFocused && _isOpen == value || _isBlocked) return; if (value) { Open(); } else { Hide(); } RaiseIsOpenedChanged(value); } } public void SetHeight(double height) { //return; //EmojiContainer.MaxHeight = height; } private void Open() { _isOpen = true; if (TextBoxTarget != null) { TextBoxTarget.Dispatcher.BeginInvoke(() => VisualStateManager.GoToState(TextBoxTarget, "Focused", false)); } //var frame = (PhoneApplicationFrame)Application.Current.RootVisual; EmojiContainer.Visibility = Visibility.Visible; ButtonsGrid.Visibility = Visibility.Visible; StickersGrid.Visibility = Visibility.Collapsed; Deployment.Current.Dispatcher.BeginInvoke(() => LoadCategory(0)); //frame.BackKeyPress += OnBackKeyPress; //if (!(EmojiContainer.RenderTransform is TranslateTransform)) // EmojiContainer.RenderTransform = new TranslateTransform(); //var transform = (TranslateTransform)EmojiContainer.RenderTransform; var offset = _isPortrait ? PortraitOrientationHeight : AlbumOrientationHeight; SetHeight(offset); //var from = 0; //if (_frameTransform.Y < 0) // Keyboard is in view //{ // from = (int)_frameTransform.Y; // //_frameTransform.Y = -offset; // //transform.Y = offset;// -72; //} //transform.Y = offset;// -72 //if (from == offset) return; //frame.IsHitTestVisible = false; //_isBlocked = true; //var storyboard = new Storyboard(); //var doubleTransformFrame = new DoubleAnimation //{ // From = from, // To = -offset, // Duration = TimeSpan.FromMilliseconds(440), // EasingFunction = new ExponentialEase // { // EasingMode = EasingMode.EaseOut, // Exponent = 6 // } //}; //storyboard.Children.Add(doubleTransformFrame); //Storyboard.SetTarget(doubleTransformFrame, _frameTransform); //Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); //EmojiContainer.Dispatcher.BeginInvoke(async () => //{ // storyboard.Begin(); // if (_frameTransform.Y < 0) // Keyboard is in view // { // Focus(); // TextBoxTarget.Dispatcher.BeginInvoke(() // no effect without dispatcher // => VisualStateManager.GoToState(TextBoxTarget, "Focused", false)); // } // if (_wasRendered) return; // await Task.Delay(50); // LoadCategory(0); //}); //storyboard.Completed += (sender, args) => //{ // frame.IsHitTestVisible = true; // _isBlocked = false; //}; } private void Hide() { _isOpen = false; VisualStateManager.GoToState(TextBoxTarget, "Unfocused", false); EmojiContainer.Visibility = Visibility.Collapsed; //var frame = (PhoneApplicationFrame)Application.Current.RootVisual; //frame.BackKeyPress -= OnBackKeyPress; //if (_isTextBoxTargetFocused) //{ // _frameTransform.Y = 0; // EmojiContainer.Visibility = Visibility.Collapsed; // return; //} //VisualStateManager.GoToState(TextBoxTarget, "Unfocused", false); //frame.IsHitTestVisible = false; //_isBlocked = true; //var transform = (TranslateTransform)EmojiContainer.RenderTransform; //var storyboard = new Storyboard(); //var doubleTransformFrame = new DoubleAnimation //{ // From = -transform.Y, // To = 0, // Duration = TimeSpan.FromMilliseconds(440), // EasingFunction = new ExponentialEase // { // EasingMode = EasingMode.EaseOut, // Exponent = 6 // } //}; //storyboard.Children.Add(doubleTransformFrame); //Storyboard.SetTarget(doubleTransformFrame, _frameTransform); //Storyboard.SetTargetProperty(doubleTransformFrame, new PropertyPath("Y")); //storyboard.Begin(); //storyboard.Completed += (sender, args) => //{ // EmojiContainer.Visibility = Visibility.Collapsed; // frame.IsHitTestVisible = true; // _isBlocked = false; // transform.Y = 0; //}; } #region _isTextBoxTargetFocused listeners private void TextBoxOnGotFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = true; } private void TextBoxOnLostFocus(object sender, RoutedEventArgs routedEventArgs) { _isTextBoxTargetFocused = false; } #endregion /// /// Hide instance on pressing hardware Back button. Fires only when instance is opened. /// private void OnBackKeyPress(object sender, CancelEventArgs cancelEventArgs) { IsOpen = false; cancelEventArgs.Cancel = true; } private void VirtPanel_OnScrollPositionChanged(object sender, MyVirtualizingPanel.ScrollPositionChangedEventAgrs args) { //System.Diagnostics.Debug.WriteLine("scroll_height=" + scrollPositionChangedEventAgrs.ScrollHeight + " current_position=" + scrollPositionChangedEventAgrs.CurrentPosition); EmojiSpriteItem.ClearCurrentHighlight(); } private void FeaturedStickersVirtPanel_OnScrollPositionChanged(object sender, MyVirtualizingPanel.ScrollPositionChangedEventAgrs args) { if (CurrentCategory != FeaturedStickersCategoryIndex) return; if (args.CurrentPosition + 2000.0 >= args.ScrollHeight) { LoadNextFeaturedStickersSlice(); } } /// /// Changes tabs in UI and _currentCategory property /// public int CurrentCategory { get { return _currentCategory; } set { var previousCategory = GetCategoryButtonByIndex(_currentCategory); var nextCategory = GetCategoryButtonByIndex(value); if (previousCategory != null) previousCategory.Background = ButtonBackground; nextCategory.Background = (Brush)Application.Current.Resources["TelegramBadgeAccentBrush"]; _currentCategory = value; CSV.Visibility = value != FeaturedStickersCategoryIndex ? Visibility.Visible : Visibility.Collapsed; FeaturedStickersCSV.Visibility = value == FeaturedStickersCategoryIndex ? Visibility.Visible : Visibility.Collapsed; } } public void RemoveStickerSet(TLInputStickerSetBase stickerSet) { var setId = stickerSet.Name; if (_featuredStickers != null) { foreach (var featuredStickerSet in _featuredStickers.Sets) { var stickerSet32 = featuredStickerSet as TLStickerSet32; if (stickerSet32 != null && string.Equals(stickerSet32.Id.Value.ToString(), stickerSet.Name)) { stickerSet32.Installed = false; var stickerSet76 = stickerSet32 as TLStickerSet76; if (stickerSet76 != null) { stickerSet76.InstalledDate = null; } stickerSet32.NotifyOfPropertyChange(() => stickerSet32.Installed); } } } if (_stickerSets.ContainsKey(setId)) { _stickerSets.Remove(setId); var stateService = IoC.Get(); stateService.GetAllStickersAsync(cachedStickers => { var allStickers43 = cachedStickers as TLAllStickers43; if (allStickers43 != null && allStickers43.RecentStickers != null) { List recentStickers; if (_stickerSets.TryGetValue(@"tlg/recentlyUsed", out recentStickers)) { var recentStickersCache = new Dictionary(); for (var i = 0; i < recentStickers.Count; i++) { if (recentStickers[i].StickerSet.Name == setId) { recentStickersCache[recentStickers[i].Id.Value] = recentStickers[i].Id.Value; recentStickers.RemoveAt(i--); _reloadStickerSprites = true; } } for (var i = 0; i < allStickers43.RecentStickers.Documents.Count; i++) { var recentSticker = allStickers43.RecentStickers.Documents[i]; if (recentStickersCache.ContainsKey(recentSticker.Id.Value)) { allStickers43.RecentStickers.Documents.RemoveAt(i--); } } } } stateService.SaveAllStickersAsync(cachedStickers); UpdateStickersPanel(CurrentCategory); //UpdateStickersPanel(StickerCategoryIndex); }); } //UpdateAllStickersAsync(); } public void AddStickerSet(TLMessagesStickerSet stickerSet) { var stateService = IoC.Get(); stateService.GetAllStickersAsync(cachedStickers => { CreateSetsAndUpdatePanel(_currentCategory, cachedStickers); }); //var setId = stickerSet.Set.Id.ToString(); //if (_stickerSets.Count > 0 // && !_stickerSets.ContainsKey(setId)) //{ // var stickers = new List(); // foreach (var document in stickerSet.Documents) // { // var document22 = document as TLDocument22; // if (document22 != null) // { // stickers.Add(document22); // } // } // _stickerSets[setId] = stickers; // UpdateStickersPanel(_currentCategory); //} //UpdateAllStickersAsync(); } public void ReorderStickerSets() { var stateService = IoC.Get(); stateService.GetAllStickersAsync(cachedStickers => { CreateSetsAndUpdatePanel(_currentCategory, cachedStickers); }); } private void UpdateStickersPanel(int index) { var hasUnreadFeaturedStickers = _featuredStickers != null && _featuredStickers.Unread.Count > 0; StickersPanel.Children.Clear(); StickersPanel.Children.Add(_emojiButton); if (hasUnreadFeaturedStickers) { if (_featuredStickers != null && _featuredStickersCounter != null) { _featuredStickersCounter.Counter = _featuredStickers.Unread.Count; } StickersPanel.Children.Add(_featuredStickersGrid); } StickersPanel.Children.Add(_favedStickersButton); StickersPanel.Children.Add(_recentStickersButton); StickersPanel.Children.Add(_groupStickersButton); var isLightTheme = (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible; var buttonStyleResourceKey = isLightTheme ? "CategoryButtonLightThemeStyle" : "CategoryButtonDarkThemeStyle"; var buttonStyle = (Style)Resources[buttonStyleResourceKey]; string previousKey = null; if (index > RecentStickersCategoryIndex) { var previousCategory = GetCategoryButtonByIndex(_currentCategory); if (previousCategory != null) { previousKey = previousCategory.DataContext as string; } } var secondSlice = new List