Skip to content

Commit

Permalink
Internal code improvements and new readme
Browse files Browse the repository at this point in the history
  • Loading branch information
li223 committed Jan 7, 2025
1 parent 6af4c1b commit b482b05
Show file tree
Hide file tree
Showing 8 changed files with 303 additions and 155 deletions.
10 changes: 4 additions & 6 deletions PermitSaveEditor/Data/MainWindowFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Newtonsoft.Json;
using Newtonsoft.Json;
using PermitSaveEditor.Data;
using PermitSaveEditor.Objects;
using System.Linq;
using System.Windows;
using Color = System.Windows.Media.Color;

namespace PermitSaveEditor;
Expand Down Expand Up @@ -97,5 +95,5 @@ public void HandleInputVisibility()
HealAll.IsEnabled = !DataManager.AllEnabled(_loadedSave!.NpcHealthDataList.Select(x => !x.IsSick));
}

public bool IsValid(string str, int min, int max) => int.TryParse(str, out int i) && i >= min && i <= max;
private bool IsValid(string str, int min, int max) => int.TryParse(str, out int i) && i >= min && i <= max;
}
2 changes: 2 additions & 0 deletions PermitSaveEditor/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ private async void LoadFileBtn_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
File.AppendAllText("log.txt", $"Error on file load: {ex.Message}");

LoadedFileText.Text = "File Name";
MessageBox.Show("Failed to load save file, data may be corrupted.", "Error", MessageBoxButton.OK);
}
Expand Down
6 changes: 3 additions & 3 deletions PermitSaveEditor/Objects/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public Color(string r, string g, string b, string a)
A = double.Parse(a);
}

[JsonProperty("a")]
public double A { get; set; }

[JsonProperty("r")]
public double R { get; set; }

Expand All @@ -33,9 +36,6 @@ public Color(string r, string g, string b, string a)
[JsonProperty("b")]
public double B { get; set; }

[JsonProperty("a")]
public double A { get; set; }

public (byte A, byte R, byte G, byte B) ToArgb()
{
return ((byte)(A * 255.0), (byte)(R * 255.0), (byte)(G * 255.0), (byte)(B * 255.0));
Expand Down
6 changes: 3 additions & 3 deletions PermitSaveEditor/Objects/GameSaveData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ public GameSaveData()
public List<object> NewDiseaseDataList { get; set; }

[JsonProperty("newQuestDataList")]
public NewQuestDataList[] NewQuestDataList { get; set; }
public string[] NewQuestDataList { get; set; }

[JsonProperty("eventStateData")]
public List<EventStateDatum> EventStateData { get; set; }
public List<EventStateData> EventStateData { get; set; }

[JsonProperty("activeQuestList")]
public List<ActiveQuestList> ActiveQuestList { get; set; }
Expand All @@ -163,7 +163,7 @@ public GameSaveData()
public List<NpcHealthDataList> NpcHealthDataList { get; set; }

[JsonProperty("roomEditorData")]
public List<RoomEditorDatum> RoomEditorData { get; set; }
public List<RoomEditorData> RoomEditorData { get; set; }

[JsonProperty("diseaseDay")]
public int DiseaseDay { get; set; }
Expand Down
Loading

0 comments on commit b482b05

Please sign in to comment.