(编辑:jimmy 日期: 2024/12/22 浏览:2)
// pep.sdk.reader.View.Textbook.BaseBookReader// Token: 0x06000750 RID: 1872 RVA: 0x00031A40 File Offset: 0x0002FC40private bool OpenPDF(string strPDFFile, string strBookID, string encrpytionType){if (!File.Exists(strPDFFile)){LogHelper.Instance.Error("下载的教材文件不存在,教材路径:" + strPDFFile);return false;}EncryptorHelper encryptorHelper = new EncryptorHelper();if (encrpytionType == "00") {:301_1001:}[color=#ff0000]数据库中教材全部为01,话说数据库的密码也是很长一串密钥,在此不再展开讲述,过程也不难,[/color]{string textBookPwd = encryptorHelper.GetTextBookPwd(strBookID);{:301_994:}[color=#ff0000]添加一句Environment.FailFast(textBookPwd);[/color][color=#ff0000][/color][color=#ff0000]不知为何,用LogHelper.Instance.Error()是不会记录到log中的。其他都可以。[/color]return this.ucReader.OpenFile(strPDFFile, textBookPwd);}if (!(encrpytionType == "01")){return false;}bool flag = false;byte[] array = null;try{array = encryptorHelper.FileDecrypt(strPDFFile);flag = this.ucReader.OpenBuffer(array, array.Length, "");if (!flag){LogHelper.Instance.Error("[color=#ff0000]教材解密到内存数组成功[/color],调用mSDK.OpenBuffer()返回false,打开教材失败!"); {:301_995:}[color=#ff00][/color][color=#ff00]此处是第一次见内存存PDF文件,尝试写出失败[/color]}return flag;}catch (Exception ex){LogHelper.Instance.Error("教材解密到内存数组失败!" + ex.ToString());string dataFolderPath = PepPathHelper.GetDataFolderPath("01", strBookID);string text = Path.Combine(dataFolderPath, strBookID);if (!Directory.Exists(dataFolderPath)){Directory.CreateDirectory(dataFolderPath);}if (File.Exists(text)){File.Delete(text);}if (array != null){using (FileStream fileStream = new FileStream(text, FileMode.CreateNew)){fileStream.Write(array, 0, array.Length);goto IL_11E;}}encryptorHelper.FileDecrypt(strPDFFile, text);IL_11E:flag = this.ucReader.OpenFile(text, "");if (!flag){LogHelper.Instance.Error(string.Format("教材打开失败,mSDK.OpenFile(strFile, \"\")返回false。教材路径:" + text + "。", new object[0]));}else{string text2 = "pep" + DateTime.Now.ToString(SdkConstants.DATE_TIME_FORMATE1);if (this.ucReader.SetUserPassword(text2)){this.ucReader.Save();flag = this.ucReader.OpenFile(text, text2);}}}this.mTextbookCore.pdfPagingControl.PageReader = this.ucReader;return flag;}