-
Notifications
You must be signed in to change notification settings - Fork 26
/
UserConfig.cs
52 lines (48 loc) · 1.41 KB
/
UserConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ja_learner
{
internal class UserConfig
{
public static bool useExtraPrompt = false;
private static string extraPromptFilename = "";
public static bool UseProxy = false;
public static string ExtraPromptFilename
{
get
{
return extraPromptFilename;
}
set
{
if (extraPromptFilename != value)
{
extraPromptFilename = value;
UpdateExtraPrompt();
}
}
}
public static string ExtraPrompt { get; private set; } = string.Empty;
public static void UpdateExtraPrompt()
{
var filePath = Path.Combine(Program.APP_SETTING.GPT.ExtraPromptDir, extraPromptFilename);
try
{
ExtraPrompt = File.ReadAllText(filePath);
}
catch { }
}
public static string[] GetExtraPromptFiles()
{
return Directory.CreateDirectory(Program.APP_SETTING.GPT.ExtraPromptDir) // 如果文件夹不存在,创建文件夹
.GetFiles()
.Select(x => x.Name)
.ToArray();
}
}
}