-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathUserConfig.cs
More file actions
44 lines (41 loc) · 1.25 KB
/
Copy pathUserConfig.cs
File metadata and controls
44 lines (41 loc) · 1.25 KB
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
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();
}
}
}