Skip to content

Commit 4cacf4b

Browse files
create setting functions
1 parent d5851a9 commit 4cacf4b

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/HyperMC/Data/Settings.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,34 @@ public class manager
88
{
99
string path = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\\.hypermc\\settings";
1010

11-
public void createSettingsFolder(string SettingFileName)
11+
public void createSettingsFolder(string SettingType)
1212
{
13-
string setting_file_path = $"{path}\\{SettingFileName}";
13+
string setting_file_path = $"{path}\\{SettingType}";
1414
if(!Directory.Exists(setting_file_path))
1515
{
1616
Directory.CreateDirectory(setting_file_path);
1717
}
1818
}
19-
public void addSetting(string settingName, string settingValue)
19+
public void addSetting(string settingFolder, string settingName, string settingValue, bool overwriteIfExists)
2020
{
21+
void checkIfExists()
22+
{
23+
if (!Directory.Exists($"{path}\\{settingFolder}"))
24+
{
25+
createSettingsFolder(settingFolder);
26+
}
27+
}
28+
void writeSettingFile()
29+
{
30+
if(File.Exists($"{path}\\{settingFolder}\\{settingName}") && overwriteIfExists)
31+
{
32+
File.Create($"{path}\\{settingFolder}\\{settingName}.json");
33+
}
34+
}
35+
checkIfExists();
36+
2137

38+
2239
}
2340
}
2441
}

0 commit comments

Comments
 (0)