Browse Source

其他-OCR分包下载缓存逻辑添加安全检查

liyijie 1 year ago
parent
commit
71510d54a3
1 changed files with 55 additions and 46 deletions
  1. 55 46
      PDF Office/App.xaml.cs

+ 55 - 46
PDF Office/App.xaml.cs

@@ -219,64 +219,73 @@ namespace PDF_Master
 
         private void InitSettings()
         {
-            //是否是更新后
-            if (Settings.Default.UpdateSettings)
+            try
             {
-                //内嵌文档更新时 显示文档到最前方
-                //每次版本更新留意检查IsGuidPDFUpdated 值,如果没有内嵌文档更新,要设为false
-                if (Settings.Default.IsGuidPDFUpdated)
+                //是否是更新后
+                if (Settings.Default.UpdateSettings)
                 {
-                    App.IsGuidPDFUpdated = true;
-                    Settings.Default.IsGuidPDFUpdated = false;
-                }
+                    //内嵌文档更新时 显示文档到最前方
+                    //每次版本更新留意检查IsGuidPDFUpdated 值,如果没有内嵌文档更新,要设为false
+                    if (Settings.Default.IsGuidPDFUpdated)
+                    {
+                        App.IsGuidPDFUpdated = true;
+                        Settings.Default.IsGuidPDFUpdated = false;
+                    }
 
-                Settings.Default.Upgrade();
-                //清除OCR下载内容
-                Settings.Default.AppProperties.OCRFile_Url = "";
-                Settings.Default.AppProperties.OCRmodelMD5 = "";
+                    Settings.Default.Upgrade();
+                    Settings.Default.UpdateSettings = false;
+                    //清除OCR下载内容
+                    if (Settings.Default.AppProperties == null)
+                    {
+                        Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                    }
+                    Settings.Default.AppProperties.OCRFile_Url = "";
+                    Settings.Default.AppProperties.OCRmodelMD5 = "";
 
-                Settings.Default.UpdateSettings = false;
-                
-                //重置用于弹窗的记录参数
-            }
-            if (Settings.Default.ADDate == null)
-            {
-                Settings.Default.ADDate = new PDFSettings.ADDate();
-            }
+                    //重置用于弹窗的记录参数
+                }
+                if (Settings.Default.ADDate == null)
+                {
+                    Settings.Default.ADDate = new PDFSettings.ADDate();
+                }
 
-            if (Settings.Default.PDFEditList == null)
-            {
-                Settings.Default.PDFEditList = new PDFSettings.PDFEditList();
-            }
-            if (Settings.Default.UserDate == null)
-            {
-                Settings.Default.UserDate = new PDFSettings.UserDate();
-            }
+                if (Settings.Default.PDFEditList == null)
+                {
+                    Settings.Default.PDFEditList = new PDFSettings.PDFEditList();
+                }
+                if (Settings.Default.UserDate == null)
+                {
+                    Settings.Default.UserDate = new PDFSettings.UserDate();
+                }
 
-            if (Settings.Default.AppProperties == null)
-            {
-                Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
-            }
+                if (Settings.Default.AppProperties == null)
+                {
+                    Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                }
 
-            if (Settings.Default.RecentOpenFiles == null)
-            {
-                Settings.Default.RecentOpenFiles = new RecentOpenFiles();
-            }
+                if (Settings.Default.RecentOpenFiles == null)
+                {
+                    Settings.Default.RecentOpenFiles = new RecentOpenFiles();
+                }
 
-            if (Settings.Default.RedactionsSettings == null)
-                Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
+                if (Settings.Default.RedactionsSettings == null)
+                    Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
 
-            if (Settings.Default.AppProperties == null)
-                Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
+                if (Settings.Default.AppProperties == null)
+                    Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
 
-            if (Settings.Default.AllPDFToolsList == null)
-                Settings.Default.AllPDFToolsList = new PDFSettings.AllPDFToolsList();
+                if (Settings.Default.AllPDFToolsList == null)
+                    Settings.Default.AllPDFToolsList = new PDFSettings.AllPDFToolsList();
 
-            if (Settings.Default.QuickPDFToolsList == null)
-                Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
+                if (Settings.Default.QuickPDFToolsList == null)
+                    Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
 
-            if (Settings.Default.PresetFontList == null)
-                Settings.Default.PresetFontList = new PDFSettings.PresetFontList();
+                if (Settings.Default.PresetFontList == null)
+                    Settings.Default.PresetFontList = new PDFSettings.PresetFontList();
+            }
+            catch { 
+            
+            }
         }
 
         protected override void OnStartup(StartupEventArgs e)