diff --git a/DownKyi.Core/Settings/SettingsManager.cs b/DownKyi.Core/Settings/SettingsManager.cs
index 4530a94..cbed751 100644
--- a/DownKyi.Core/Settings/SettingsManager.cs
+++ b/DownKyi.Core/Settings/SettingsManager.cs
@@ -3,12 +3,31 @@ using Newtonsoft.Json;
using System;
using System.IO;
+#if DEBUG
+#else
+using DownKyi.Core.Utils.Encryptor;
+#endif
+
namespace DownKyi.Core.Settings
{
public partial class SettingsManager
{
private static SettingsManager instance;
+ // 内存中保存一份配置
+ private AppSettings appSettings;
+
+#if DEBUG
+ // 设置的配置文件
+ private readonly string settingsName = Storage.StorageManager.GetSettings() + "_debug.json";
+#else
+ // 设置的配置文件
+ private readonly string settingsName = Storage.StorageManager.GetSettings();
+
+ // 密钥
+ private readonly string password = "YO1J$4#p";
+#endif
+
///
/// 获取SettingsManager实例
///
@@ -30,12 +49,6 @@ namespace DownKyi.Core.Settings
appSettings = GetSettings();
}
- // 内存中保存一份配置
- private AppSettings appSettings;
-
- // 设置的配置文件
- private readonly string settingsName = Storage.StorageManager.GetSettings();
-
///
/// 获取AppSettingsModel
///
@@ -48,6 +61,12 @@ namespace DownKyi.Core.Settings
string jsonWordTemplate = streamReader.ReadToEnd();
streamReader.Close();
+#if DEBUG
+#else
+ // 解密字符串
+ jsonWordTemplate = Encryptor.DecryptString(jsonWordTemplate, password);
+#endif
+
return JsonConvert.DeserializeObject(jsonWordTemplate);
}
catch (Exception e)
@@ -65,6 +84,12 @@ namespace DownKyi.Core.Settings
{
string json = JsonConvert.SerializeObject(appSettings);
+#if DEBUG
+#else
+ // 加密字符串
+ json = Encryptor.EncryptString(json, password);
+#endif
+
try
{
File.WriteAllText(settingsName, json);
diff --git a/DownKyi.Core/Storage/Constant.cs b/DownKyi.Core/Storage/Constant.cs
index 633ece9..55d340c 100644
--- a/DownKyi.Core/Storage/Constant.cs
+++ b/DownKyi.Core/Storage/Constant.cs
@@ -27,7 +27,7 @@ namespace DownKyi.Core.Storage
public static string Config { get; } = $"{Root}/Config";
// 设置
- public static string Settings { get; } = $"{Config}/Settings.json";
+ public static string Settings { get; } = $"{Config}/Settings";
// 登录cookies
public static string Login { get; } = $"{Config}/Login";