private void PlayRecord(string fileName, string relativeName) { try { CurrentApp.WriteLog("PlayRecord", string.Format("FileName:{0};RelativeName:{1}", fileName, relativeName)); if (RecordInfoItem == null) { return; } int mediaType = RecordInfoItem.MediaType; bool noPlayScreen = false; if (ListUserSettingInfos != null) { var setting = ListUserSettingInfos.FirstOrDefault( c => c.ParamID == S3103Consts.USER_PARAM_PLAYSCREEN_NOPLAY); if (setting != null && setting.StringValue == "1") { noPlayScreen = true; } } bool autoRelative = true; if (ListUserSettingInfos != null) { var setting = ListUserSettingInfos.FirstOrDefault( c => c.ParamID == S3103Consts.USER_PARAM_AUTORELATIVEPLAY); if (setting != null && setting.StringValue == "0") { autoRelative = false; } } if (string.IsNullOrEmpty(fileName)) { CurrentApp.WriteLog("PlayRecord", string.Format("FileName is empty")); return; } if (string.IsNullOrEmpty(relativeName)) { CurrentApp.WriteLog("PlayRecord", string.Format("RelativeName is empty")); autoRelative = false; } string audioUrl = string.Format("{0}://{1}:{2}/{3}/{4}", CurrentApp.Session.AppServerInfo.SupportHttps ? "https" : "http", CurrentApp.Session.AppServerInfo.Address, CurrentApp.Session.AppServerInfo.Port, ConstValue.TEMP_DIR_MEDIADATA, fileName); string videoPath; switch (mediaType) { case 0: if (noPlayScreen) { VoicePlayer.MediaType = 1; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); VoicePlayer.Play(); } else { VoicePlayer.MediaType = 3; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); videoPath = string.Empty; RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn.Code); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.VideoUrl = videoPath; CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); VoicePlayer.Play(); } break; case 1: if (noPlayScreen || !autoRelative) { VoicePlayer.MediaType = 1; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); VoicePlayer.Play(); } else { VoicePlayer.MediaType = 3; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); videoPath = string.Empty; RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(relativeName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn.Code); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.VideoUrl = videoPath; CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); VoicePlayer.Play(); } break; case 2: if (!noPlayScreen) { VoicePlayer.MediaType = 2; videoPath = string.Empty; RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn.Code); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.VideoUrl = videoPath; CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); VoicePlayer.Play(); } break; default: CurrentApp.WriteLog("PlayRecord", string.Format("MediaType invalid.\t{0}", mediaType)); break; } } catch (Exception ex) { CurrentApp.WriteLog("PlayRecord", string.Format("Fail.\t{0}", ex.Message)); } }
private void PlayRecord() { try { if (RecordInfoItem == null) { return; } RecordInfo recordInfo = RecordInfoItem.RecordInfo; if (recordInfo == null) { return; } recordInfo.RecordReference = GetRecordInfoByRef(recordInfo.SerialID.ToString()); if (string.IsNullOrWhiteSpace(recordInfo.RecordReference)) { return; } if (ParentPage1 != null) { ParentPage1.SetBusy(true); } if (ParentPage2 != null) { ParentPage2.SetBusy(true); } string fileName = string.Empty; string relativeName = string.Empty; VoicePlayer.IsEnabled = false; mWorker = new BackgroundWorker(); mWorker.WorkerReportsProgress = true; mWorker.WorkerSupportsCancellation = true; mWorker.DoWork += (s, de) => { try { OperationReturn optReturn; //获取关联的录屏文件 GetRelativeRecordInfos(); //处理录音记录 RecordOperator recordOperator = new RecordOperator(recordInfo); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; recordOperator.ListSftpServers = ListSftpServers; recordOperator.ListDownloadParams = ListDownloadParams; recordOperator.ListEncryptInfo = ListEncryptInfo; recordOperator.Service03Helper = Service03Helper; //下载文件到AppServer optReturn = recordOperator.DownloadFileToAppServer(); if (!optReturn.Result) { workMsg = optReturn.Code; CurrentApp.WriteLog("DownloadAppServer", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); mWorker.ReportProgress(0); mWorker.Dispose(); return; } fileName = optReturn.Data.ToString(); var relativeRecord = RecordInfoItem.ListRelativeInfos.FirstOrDefault(); if (relativeRecord != null) { //如果有关联的录屏文件,下载录屏文件到AppServer recordOperator.RecordInfo = relativeRecord; optReturn = recordOperator.DownloadFileToAppServer(); if (!optReturn.Result) { CurrentApp.WriteLog("DownloadAppServer", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { relativeName = optReturn.Data.ToString(); } } recordOperator.RecordInfo = recordInfo; //原始解密 optReturn = recordOperator.OriginalDecryptRecord(fileName); if (!optReturn.Result) { workMsg = optReturn.Code; CurrentApp.WriteLog("OriginalDecrypt", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); mWorker.ReportProgress(1); mWorker.Dispose(); return; } fileName = optReturn.Data.ToString(); recordOperator.RecordInfo = recordInfo; //解密文件 optReturn = recordOperator.DecryptRecord(fileName); if (!optReturn.Result) { workMsg = optReturn.Code; CurrentApp.WriteLog("DecryptRecord", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); mWorker.ReportProgress(2); mWorker.Dispose(); return; } fileName = optReturn.Data.ToString(); recordOperator.RecordInfo = recordInfo; //转换格式 optReturn = recordOperator.ConvertWaveFormat(fileName); if (!optReturn.Result) { workMsg = optReturn.Code; CurrentApp.WriteLog("ConvertWaveFormat", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); mWorker.ReportProgress(3); mWorker.Dispose(); return; } fileName = optReturn.Data.ToString(); } catch (Exception ex) { CurrentApp.WriteLog("PlayRecord", string.Format("Fail.\t{0}", ex.Message)); } }; mWorker.ProgressChanged += (s, pe) => { ShowRecordOperatorMessage(workMsg); }; mWorker.RunWorkerCompleted += (s, re) => { mWorker.Dispose(); VoicePlayer.IsEnabled = true; if (ParentPage1 != null) { ParentPage1.SetBusy(false); } if (ParentPage2 != null) { ParentPage2.SetBusy(false); } PlayRecord(fileName, relativeName); }; mWorker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }
private void GetRealPassword(RecordEncryptInfo info) { try { if (RecordInfoItem == null) { return; } RecordInfo recordInfo = RecordInfoItem.RecordInfo; if (recordInfo == null) { return; } recordInfo.RecordReference = GetRecordInfoByRef(recordInfo.SerialID.ToString()); if (string.IsNullOrWhiteSpace(recordInfo.RecordReference)) { return; } if (ParentPage1 != null) { ParentPage1.SetBusy(true); } if (ParentPage2 != null) { ParentPage2.SetBusy(true); } bool isSuccess = false; mWorker = new BackgroundWorker(); mWorker.WorkerReportsProgress = true; mWorker.WorkerSupportsCancellation = true; mWorker.DoWork += (s, de) => { try { OperationReturn optReturn; RecordOperator recordOperator = new RecordOperator(recordInfo); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; recordOperator.ListSftpServers = ListSftpServers; recordOperator.ListDownloadParams = ListDownloadParams; recordOperator.ListEncryptInfo = ListEncryptInfo; recordOperator.Service03Helper = Service03Helper; optReturn = recordOperator.GetRealPassword(info); if (!optReturn.Result) { workMsg = optReturn.Code; CurrentApp.WriteLog("GetRealPass", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); mWorker.ReportProgress(0); mWorker.Dispose(); return; } isSuccess = true; } catch (Exception ex) { CurrentApp.WriteLog("GetRealPass", string.Format("Fail.\t{0}", ex.Message)); } }; mWorker.ProgressChanged += (s, pe) => { ShowRecordOperatorMessage(workMsg); }; mWorker.RunWorkerCompleted += (s, re) => { mWorker.Dispose(); if (ParentPage1 != null) { ParentPage1.SetBusy(false); } if (ParentPage2 != null) { ParentPage2.SetBusy(false); } if (!isSuccess) { CurrentApp.WriteLog("GetRealPass", string.Format("Get real password fail.")); return; } PlayRecord(); }; mWorker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }
private void GetRealPassword(RecordEncryptInfo info) { try { if (RecordInfoItem == null) { return; } RecordInfo recordInfo = RecordInfoItem.RecordInfo; if (recordInfo == null) { return; } if (ParentPage != null) { ParentPage.SetBusy(true, string.Empty); } bool isSuccess = false; mWorker = new BackgroundWorker(); mWorker.DoWork += (s, de) => { try { OperationReturn optReturn; RecordOperator recordOperator = new RecordOperator(recordInfo); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; recordOperator.ListSftpServers = ListSftpServers; recordOperator.ListDownloadParams = ListDownloadParams; recordOperator.ListEncryptInfo = ListEncryptInfo; recordOperator.Service03Helper = Service03Helper; optReturn = recordOperator.GetRealPassword(info); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("GetRealPass", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } isSuccess = true; } catch (Exception ex) { CurrentApp.WriteLog("GetRealPass", string.Format("Fail.\t{0}", ex.Message)); } }; mWorker.RunWorkerCompleted += (s, re) => { mWorker.Dispose(); if (ParentPage != null) { ParentPage.SetBusy(false, string.Empty); } if (!isSuccess) { CurrentApp.WriteLog("GetRealPass", string.Format("Get real password fail.")); return; } PlayRecord(); }; mWorker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }
private void PlayRecord(string fileName, List <string> listRelativeNames) { try { if (RecordInfoItem == null) { return; } RecordInfo recordInfo = RecordInfoItem.RecordInfo; if (recordInfo == null) { return; } int mediaType = recordInfo.MediaType; #region 自定义参数设置 bool noPlayScreen = false; if (ListUserSettingInfos != null) { var setting = ListUserSettingInfos.FirstOrDefault( c => c.ParamID == S3102Consts.USER_PARAM_PLAYSCREEN_NOPLAY); if (setting != null && setting.StringValue == "1") { noPlayScreen = true; } } bool autoRelative = true; if (ListUserSettingInfos != null) { var setting = ListUserSettingInfos.FirstOrDefault( c => c.ParamID == S3102Consts.USER_PARAM_AUTORELATIVEPLAY); if (setting != null && setting.StringValue == "0") { autoRelative = false; } } #endregion if (string.IsNullOrEmpty(fileName)) { CurrentApp.WriteLog("PlayRecord", string.Format("FileName is empty")); return; } if (listRelativeNames.Count <= 0) { CurrentApp.WriteLog("PlayRecord", string.Format("RelativeName is empty")); autoRelative = false; } VoicePlayer.Session = CurrentApp.Session; if (mediaType == 3) { #region 艺赛旗录屏播放 //艺赛旗录屏播放,需要设置服务器地址和艺赛旗流水号 if (noPlayScreen) { return; } CurrentApp.WriteLog("PlayRecord", string.Format("VedioPath:{0}(IsaVedio)", fileName)); VoicePlayer.MediaType = 2; VoicePlayer.IsIsaScreen = true; VoicePlayer.IsaServer = recordInfo.VoiceIP; VoicePlayer.IsaRefID = fileName; VoicePlayer.Play(); #endregion return; } string audioUrl = string.Format("{0}://{1}:{2}/{3}/{4}", CurrentApp.Session.AppServerInfo.SupportHttps ? "https" : "http", CurrentApp.Session.AppServerInfo.Address, CurrentApp.Session.AppServerInfo.Port, ConstValue.TEMP_DIR_MEDIADATA, fileName); string videoPath; string relativeName = string.Empty; switch (mediaType) { case 0: if (noPlayScreen) { VoicePlayer.MediaType = 1; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); VoicePlayer.Play(); } else { #region VCLog 录屏播放 VoicePlayer.ListVideoUrls.Clear(); VoicePlayer.MediaType = 3; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); videoPath = string.Empty; RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.IsIsaScreen = false; VoicePlayer.ListVideoUrls.Add(videoPath); CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); VoicePlayer.Play(); #endregion } break; case 1: if (noPlayScreen || !autoRelative) { VoicePlayer.MediaType = 1; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); VoicePlayer.Play(); } else { VoicePlayer.ListVideoUrls.Clear(); VoicePlayer.MediaType = 3; VoicePlayer.AudioUrl = audioUrl; CurrentApp.WriteLog("PlayRecord", string.Format("AudioUrl:{0}", audioUrl)); videoPath = string.Empty; var relativeRecords = RecordInfoItem.ListRelativeInfos; for (int i = 0; i < relativeRecords.Count; i++) { var relativeRecord = relativeRecords[i]; if (relativeRecord.MediaType == 3) { #region 艺赛旗录屏播放 if (listRelativeNames.Count > i) { relativeName = listRelativeNames[i]; } CurrentApp.WriteLog("PlayRecord", string.Format("VedioPath:{0}(IsaVedio)", relativeName)); VoicePlayer.IsIsaScreen = true; VoicePlayer.IsaServer = relativeRecord.VoiceIP; VoicePlayer.IsaRefID = relativeName; #endregion } else { #region VCLog 录屏播发 if (listRelativeNames.Count > i) { relativeName = listRelativeNames[i]; } if (!string.IsNullOrEmpty(relativeName)) { RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(relativeName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.IsIsaScreen = false; VoicePlayer.ListVideoUrls.Add(videoPath); CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); } #endregion } } VoicePlayer.Play(); } break; case 2: if (!noPlayScreen) { #region VCLog 录屏播放 VoicePlayer.MediaType = 2; videoPath = string.Empty; RecordOperator recordOperator = new RecordOperator(); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; OperationReturn optReturn = recordOperator.DownloadFileToLocal(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("DownloadToLocal", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { videoPath = optReturn.Data.ToString(); } VoicePlayer.IsIsaScreen = false; VoicePlayer.ListVideoUrls.Add(videoPath); CurrentApp.WriteLog("PlayRecord", string.Format("VideoPath:{0}", videoPath)); VoicePlayer.Play(); #endregion } break; default: CurrentApp.WriteLog("PlayRecord", string.Format("MediaType invalid.\t{0}", mediaType)); break; } } catch (Exception ex) { CurrentApp.WriteLog("PlayRecord", string.Format("Fail.\t{0}", ex.Message)); } }
private void PlayRecord() { try { if (RecordInfoItem == null) { return; } RecordInfo recordInfo = RecordInfoItem.RecordInfo; if (recordInfo == null) { return; } string fileName = string.Empty; VoicePlayer.IsEnabled = false; List <string> listRelativeNames = new List <string>(); //艺赛旗录屏无需下载,也不用解密转换等操作,直接跳过以下操作 if (recordInfo.MediaType == 3) { fileName = recordInfo.IsaRefID; VoicePlayer.IsEnabled = true; PlayRecord(fileName, listRelativeNames); return; } if (MainPage != null) { MainPage.SetBusy(true, string.Format("{0}", CurrentApp.GetMessageLanguageInfo("015", "Downloading record file..."))); } bool isOptSuccess = true; if (MainPage != null) { MainPage.IsBusy = true; } mWorker = new BackgroundWorker(); mWorker.DoWork += (s, de) => { try { OperationReturn optReturn; //获取关联的录屏文件 GetRelativeRecordInfos(); //处理录音记录 RecordOperator recordOperator = new RecordOperator(recordInfo); recordOperator.Debug += (cat, msg) => CurrentApp.WriteLog(cat, msg); recordOperator.Session = CurrentApp.Session; recordOperator.ListSftpServers = ListSftpServers; recordOperator.ListDownloadParams = ListDownloadParams; recordOperator.ListEncryptInfo = ListEncryptInfo; recordOperator.Service03Helper = Service03Helper; //下载文件到AppServer optReturn = recordOperator.DownloadFileToAppServer(); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("DownloadAppServer", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } fileName = optReturn.Data.ToString(); var relativeRecords = RecordInfoItem.ListRelativeInfos; if (relativeRecords.Count > 0) { //如果有关联的录屏文件 for (int i = 0; i < relativeRecords.Count; i++) { var relativeRecord = relativeRecords[i]; if (relativeRecord.MediaType == 3) { //艺赛旗录屏无需下载,也不用解密转换等操作,直接跳过以下操作 listRelativeNames.Add(relativeRecord.IsaRefID); } else { //下载录屏文件到AppServer recordOperator.RecordInfo = relativeRecord; optReturn = recordOperator.DownloadFileToAppServer(); if (!optReturn.Result) { CurrentApp.WriteLog("DownloadAppServer", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); } else { listRelativeNames.Add(optReturn.Data.ToString()); } } } } if (recordInfo.RecordVersion == 101) { //华为V3录音不需要解密,此处不做操作 } else { //原始解密 recordOperator.RecordInfo = recordInfo; optReturn = recordOperator.OriginalDecryptRecord(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("OriginalDecrypt", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } fileName = optReturn.Data.ToString(); //解密文件 recordOperator.RecordInfo = recordInfo; optReturn = recordOperator.DecryptRecord(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("DecryptRecord", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); if (optReturn.Code == Service03Consts.DECRYPT_PASSWORD_ERROR) { isOptSuccess = false; } return; } fileName = optReturn.Data.ToString(); } //转换格式 recordOperator.RecordInfo = recordInfo; optReturn = recordOperator.ConvertWaveFormat(fileName); if (!optReturn.Result) { ShowRecordOperatorMessage(optReturn); CurrentApp.WriteLog("ConvertWaveFormat", string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } fileName = optReturn.Data.ToString(); } catch (Exception ex) { CurrentApp.WriteLog("PlayRecord", string.Format("Fail.\t{0}", ex.Message)); } }; mWorker.RunWorkerCompleted += (s, re) => { mWorker.Dispose(); if (MainPage != null) { MainPage.SetBusy(false); } if (MainPage != null) { MainPage.IsBusy = false; } if (!isOptSuccess) { return; } VoicePlayer.IsEnabled = true; PlayRecord(fileName, listRelativeNames); }; mWorker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }