-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButtonLabelsConfiguration.cs
More file actions
60 lines (48 loc) · 2.32 KB
/
ButtonLabelsConfiguration.cs
File metadata and controls
60 lines (48 loc) · 2.32 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using Newtonsoft.Json;
using System;
using System.IO;
namespace ChatGPTExtension
{
public class ButtonLabelsConfiguration
{
public string VSNETToAI { get; set; } = "Editor to {AI}";
public string FixCode { get; set; } = "Fix Code";
public string FixCodePrompt { get; set; } = "Fix {languageCode} code below:";
public string ImproveCode { get; set; } = "Improve Code";
public string ImproveCodePrompt { get; set; } = "Improve {languageCode} code below:";
public string CompleteCode { get; set; } = "Complete Code";
public string CompleteCodePrompt { get; set; } = "Please show new full complete code without explanations with complete methods implementation for the provided code without any placeholders like ... or assuming code segments. Do not create methods you dont know. Keep all original comments.";
public string ContinueCode { get; set; } = "Continue Code";
public string ContinueCodePrompt { get; set; } = "Continue code generation";
public string AIToVSNET { get; set; } = "{AI} to Editor";
public string NewFile { get; set; } = "📄 New File";
public string AttachFile { get; set; } = "📎Attach File";
public string EnableCopyCode { get; set; } = "Copy Code";
private const string FileName = "buttonlabels.json";
private static readonly string _configPath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"ChatGPTExtension", FileName);
public static ButtonLabelsConfiguration Load()
{
if (File.Exists(_configPath))
{
try
{
var json = File.ReadAllText(_configPath);
return JsonConvert.DeserializeObject<ButtonLabelsConfiguration>(json) ?? new ButtonLabelsConfiguration();
}
catch
{
return new ButtonLabelsConfiguration();
}
}
return new ButtonLabelsConfiguration();
}
public void Save()
{
Directory.CreateDirectory(Path.GetDirectoryName(_configPath));
var json = JsonConvert.SerializeObject(this, Formatting.Indented);
File.WriteAllText(_configPath, json);
}
}
}