Skip to content

Commit 409126a

Browse files
committed
Hide incomplete features.
1 parent 7b71978 commit 409126a

1 file changed

Lines changed: 42 additions & 25 deletions

File tree

CP2077SaveEditor/Views/Form1.cs

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public partial class Form1 : Form
3333
private int saveType = 0;
3434
private Random globalRand = new Random();
3535
public static bool psDataEnabled = true;
36+
public static bool wipEnabled = false;
3637

3738
//GUI
3839
private ModernButton activeTabButton = new ModernButton();
@@ -59,6 +60,11 @@ public partial class Form1 : Form
5960
{ 0xE5F556FCBB62A706, "V's Stash" },
6061
{ 0xEDAD8C9B086A615E, "River's Stash" }
6162
};
63+
private List<string> wipFields = new()
64+
{
65+
"Beard",
66+
"BeardStyle"
67+
};
6268

6369
public Form1()
6470
{
@@ -132,6 +138,37 @@ public Form1()
132138
numUpDown.ValueChanged += PlayerStatChanged;
133139
}
134140

141+
if (File.Exists(Environment.CurrentDirectory + "\\config.json"))
142+
{
143+
try
144+
{
145+
var config = JsonConvert.DeserializeObject<Dictionary<string, int>>(File.ReadAllText(Environment.CurrentDirectory + "\\config.json"));
146+
if (config.ContainsKey("SaveButtonPosition") && config["SaveButtonPosition"] == 1)
147+
{
148+
saveChangesButton.Location = new Point(saveChangesButton.Location.X, factsButton.Location.Y + factsButton.Height - 1);
149+
saveChangesButton.Anchor = AnchorStyles.Left | AnchorStyles.Top;
150+
}
151+
else if (config.ContainsKey("SaveButtonPosition") && config["SaveButtonPosition"] > 1)
152+
{
153+
saveChangesButton.Location = new Point(saveChangesButton.Location.X, saveChangesButton.Location.Y - config["SaveButtonPosition"]);
154+
}
155+
156+
if (config.ContainsKey("EnablePSData") && config["EnablePSData"] == 0)
157+
{
158+
psDataEnabled = false;
159+
}
160+
161+
if (config.ContainsKey("EnableWIPFeatures") && config["EnableWIPFeatures"] == 1)
162+
{
163+
wipEnabled = true;
164+
}
165+
}
166+
catch (Exception)
167+
{
168+
MessageBox.Show("Unable to read config.json", "Notice");
169+
}
170+
}
171+
135172
var lastPos = 20;
136173
foreach (PropertyInfo property in typeof(AppearanceHelper).GetProperties())
137174
{
@@ -140,6 +177,11 @@ public Form1()
140177
// MessageBox.Show(property.Name);
141178
//}
142179

180+
if (!wipEnabled && wipFields.Contains(property.Name))
181+
{
182+
continue;
183+
}
184+
143185
if (property.PropertyType.Name != "Object" && property.PropertyType.Name != "Boolean" && property.Name != "MainSections" && property.CanWrite == true)
144186
{
145187
var picker = new ModernValuePicker()
@@ -158,31 +200,6 @@ public Form1()
158200
}
159201
}
160202

161-
if (File.Exists(Environment.CurrentDirectory + "\\config.json"))
162-
{
163-
try
164-
{
165-
var config = JsonConvert.DeserializeObject<Dictionary<string, int>>(File.ReadAllText(Environment.CurrentDirectory + "\\config.json"));
166-
if (config["SaveButtonPosition"] == 1)
167-
{
168-
saveChangesButton.Location = new Point(saveChangesButton.Location.X, factsButton.Location.Y + factsButton.Height - 1);
169-
saveChangesButton.Anchor = AnchorStyles.Left | AnchorStyles.Top;
170-
}
171-
else if(config["SaveButtonPosition"] > 1)
172-
{
173-
saveChangesButton.Location = new Point(saveChangesButton.Location.X, saveChangesButton.Location.Y - config["SaveButtonPosition"]);
174-
}
175-
176-
if (config["EnablePSData"] == 0)
177-
{
178-
psDataEnabled = false;
179-
}
180-
}
181-
catch (Exception)
182-
{
183-
MessageBox.Show("Unable to read config.json", "Notice");
184-
}
185-
}
186203
}
187204

188205
private void SaveFile_ProgressChanged(object sender, SaveProgressChangedEventArgs e)

0 commit comments

Comments
 (0)