private void SendAudioInternal(TLMessage message, AudioEventArgs args = null) { var audioMedia = message.Media as TLMessageMediaAudio; if (audioMedia == null) { return; } var fileName = audioMedia.IsoFileName; if (string.IsNullOrEmpty(fileName)) { return; } var audio = audioMedia.Audio as TLAudio; if (audio == null) { return; } if (args != null) { var fileId = args.FileId ?? TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName, args.Parts); } else { var fileId = TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName); } }
private void SendAudioInternal(TLMessage message, AudioEventArgs args = null) { Telegram.Logs.Log.Write("DialogDetailsViewModel.SendAudioInternal rnd_id=" + message.RandomId); var documentMedia = message.Media as TLMessageMediaDocument; if (documentMedia != null) { var fileName = documentMedia.IsoFileName; if (string.IsNullOrEmpty(fileName)) { return; } var document = documentMedia.Document as TLDocument; if (document == null) { return; } if (args != null) { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("parts"); foreach (var part in args.Parts) { stringBuilder.AppendLine(string.Format("file_part={0} position={1} count={2} status={3}", part.FilePart, part.Position, part.Count, part.Status)); } Telegram.Logs.Log.Write("DialogDetailsViewModel.SendAudioInternal uploading rnd_id=" + message.RandomId + Environment.NewLine + stringBuilder); var fileId = args.FileId ?? TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName, args.Parts); } else { var fileId = TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName); } return; } var audioMedia = message.Media as TLMessageMediaAudio; if (audioMedia != null) { var fileName = audioMedia.IsoFileName; if (string.IsNullOrEmpty(fileName)) { return; } var audio = audioMedia.Audio as TLAudio; if (audio == null) { return; } if (args != null) { var fileId = args.FileId ?? TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName, args.Parts); } else { var fileId = TLLong.Random(); message.Media.FileId = fileId; message.Media.UploadingProgress = 0.001; UploadAudioFileManager.UploadFile(fileId, message, fileName); } return; } }