-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathformEditorToml.cs
More file actions
173 lines (151 loc) · 7.33 KB
/
formEditorToml.cs
File metadata and controls
173 lines (151 loc) · 7.33 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FSR3ModSetupUtilityEnhanced
{
public partial class formEditorToml : Form
{
public string pathT { get; set; }
public string UncheckedToml { get; set; }
private string saveTomlPath;
private formSettings instance;
public formEditorToml()
{
InitializeComponent();
}
#region Load Toml Path
static Dictionary<string, string> folderFakeGpu = new Dictionary<string, string>()
{
{"0.7.4", @"\mods\Temp\FSR2FSR3_0.7.4\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.7.5", @"\mods\Temp\FSR2FSR3_0.7.5_hotfix\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.7.6", @"\mods\Temp\FSR2FSR3_0.7.6\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.8.0", @"\mods\Temp\FSR2FSR3_0.8.0\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.9.0", @"\mods\Temp\FSR2FSR3_0.9.0\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.0", @"\mods\Temp\FSR2FSR3_0.10.0\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.1", @"\mods\Temp\FSR2FSR3_0.10.1\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.1h1", @"\mods\Temp\FSR2FSR3_0.10.1h1\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.2h1", @"\mods\Temp\FSR2FSR3_0.10.2h1\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.3", @"\mods\Temp\FSR2FSR3_0.10.3\enable_fake_gpu\fsr2fsr3.config.toml"},
{"0.10.4", @"\mods\Temp\FSR2FSR3_0.10.4\enable_fake_gpu\fsr2fsr3.config.toml"},
{"Uniscaler",@"\mods\Temp\Uniscaler\enable_fake_gpu\uniscaler.config.toml"},
{"Uniscaler + Xess + Dlss",@"\mods\Temp\FSR2FSR3_Uniscaler_Xess_Dlss\enable_fake_gpu\uniscaler.config.toml"},
{"Uniscaler V2",@"\mods\Temp\Uniscaler_V2\enable_fake_gpu\uniscaler.config.toml"},
{"Uniscaler V3",@"\mods\Temp\Uniscaler_V3\enable_fake_gpu\uniscaler.config.toml"},
{"Uniscaler V4",@"\mods\Temp\Uniscaler_V4\enable_fake_gpu\uniscaler.config.toml"},
{"Uniscaler FSR 3.1",@"\mods\Temp\Uniscaler_FSR31\enable_fake_gpu\uniscaler.config.toml"},
{"The Callisto Protocol FSR3",@"\mods\Temp\FSR3_Callisto\enable_fake_gpu\fsr2fsr3.config.toml"},
{"FSR 3.1 Custom Wukong",@"\mods\Temp\Wukong_FSR31\enable_fake_gpu\uniscaler.config.toml" }
};
#endregion;
#region Reload Clean Toml Path
Dictionary<string, string> clean_file = new Dictionary<string, string>
{
{ "0.7.4", @"mods\FSR2FSR3_0.7.4\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.7.5", @"mods\FSR2FSR3_0.7.5_hotfix\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.7.6", @"mods\FSR2FSR3_0.7.6\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.8.0", @"mods\FSR2FSR3_0.8.0\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.9.0", @"mods\FSR2FSR3_0.9.0\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.0", @"mods\FSR2FSR3_0.10.0\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.1", @"mods\FSR2FSR3_0.10.1\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.1h1", @"mods\FSR2FSR3_0.10.1h1\\0.10.1h1\\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.2h1", @"mods\FSR2FSR3_0.10.2h1\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.3", @"mods\FSR2FSR3_0.10.3\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "0.10.4", @"mods\FSR2FSR3_0.10.4\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "Uniscaler", @"mods\FSR2FSR3_Uniscaler\enable_fake_gpu\uniscaler.config.toml" },
{ "Uniscaler + Xess + Dlss", @"mods\FSR2FSR3_Uniscaler_Xess_Dlss\enable_fake_gpu\uniscaler.config.toml" },
{ "Uniscaler V2", @"mods\FSR2FSR3_Uniscaler_V2\enable_fake_gpu\uniscaler.config.toml" },
{ "Uniscaler V3", @"mods\FSR2FSR3_Uniscaler_V3\enable_fake_gpu\uniscaler.config.toml"},
{ "Uniscaler V4", @"mods\FSR2FSR3_Uniscaler_V4\enable_fake_gpu\uniscaler.config.toml"},
{ "Uniscaler FSR 3.1",@"\mods\FSR2FSR3_Uniscaler_FSR3\enable_fake_gpu\\uniscaler.config.toml"},
{ "The Callisto Protocol FSR3", @"mods\FSR3_Callisto\enable_fake_gpu\fsr2fsr3.config.toml" },
{ "Uni Custom Miles", @"mods\FSR2FSR3_Miles\uni_miles_toml" },
{ "Dlss Jedi", @"mods\FSR2FSR3_Miles\uni_miles_toml" },
{ "FSR 3.1 Custom Wukong",@"mods\FSR3_WUKONG\WukongFSR31\enable_fake_gpu\uniscaler.config.toml" }
};
#endregion
public void SetPathT(string path)
{
this.pathT = path;
if (!string.IsNullOrEmpty(pathT) && folderFakeGpu.ContainsKey(pathT))
{
string pathTo = folderFakeGpu[pathT];
LoadToml(pathTo);
}
}
private void formEditorToml_Load(object sender, EventArgs e)
{
}
public void LoadToml(string pathToml)
{
try
{
pathToml = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) + pathToml);
string tomlContent = File.ReadAllText(pathToml);
saveTomlPath = pathToml;
richToml.Text = tomlContent;
}
catch (Exception ex)
{
}
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void formEditorToml_Resize(object sender, EventArgs e)
{
panel1.Size = new Size(ClientSize.Width / 2, ClientSize.Height / 2);
int x = (this.ClientSize.Width - panel1.Width) / 2;
int y = (this.ClientSize.Height - panel1.Height) / 2;
panel1.Location = new Point(x, y);
panel2.Size = new Size(panel1.Width, panel1.Height / 6);
panel2.Location = new Point(x, y - panel2.Height - 5);
int labelX = (panel2.Width - labelToml.Width) / 2;
int labelY = (panel2.Height - labelToml.Height) / 2;
labelToml.Location = new Point(labelX, labelY);
}
private void formEditorToml_FormClosed(object sender, FormClosedEventArgs e)
{
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
if (saveTomlPath != null)
{
try
{
File.WriteAllText(saveTomlPath, richToml.Text);
}
catch (Exception ex)
{
}
}
}
private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
string pathOldToml = saveTomlPath.ToString();
if (clean_file.ContainsKey(pathT))
{
string newpathNewToml = clean_file[pathT];
try
{
File.Copy(newpathNewToml, pathOldToml, true);
string newToml = File.ReadAllText(pathOldToml);
richToml.Text = newToml;
}
catch (Exception ex) { }
}
}
private void toolStripMenuItem4_Click(object sender, EventArgs e)
{
this.Dispose();
}
}
}