Skip to content

Commit

Permalink
Fixed Northstar Null enabledmods.json
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Feb 21, 2024
1 parent 64b5535 commit f5e721f
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 9 deletions.
Binary file modified VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/v17/fileList.bin
Binary file not shown.
24 changes: 15 additions & 9 deletions VTOL_2.0.0/Pages/Page_Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
Expand Down Expand Up @@ -302,7 +303,7 @@ public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo
// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);

if (jsonContent.IsNullOrEmpty() == true && jsonContent.Length < 5)
if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length < 5 || jsonContent == "Null")
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");

Expand Down Expand Up @@ -546,11 +547,12 @@ public async Task Call_Mods_From_Folder()
Snackbar.Title = VTOL.Resources.Languages.Language.ERROR;
Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution;
Snackbar.Message = VTOL.Resources.Languages.Language.File + Json_Path + VTOL.Resources.Languages.Language.CouldNotBeFoundOrHadAnErrorAndWasEdited;
Snackbar.ShowAsync();
Snackbar.Show();
});
}




List<NORTHSTARCOMPATIBLE_MOD> DIRECTORY_MODS = READ_UPDATE_MOD_LIST(subDirs);

CLEANED_FORMAT_MODS = DIRECTORY_MODS;
Expand Down Expand Up @@ -1110,11 +1112,15 @@ public void Move_Mods(string val, bool Enable_Disable)
});
}


// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);
// Parse the JSON content
JObject jsonObject = JObject.Parse(jsonContent);

// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);
if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length < 5 || jsonContent == "Null")
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");
}
// Parse the JSON content
JObject jsonObject = JObject.Parse(jsonContent);
string Name = val;
if (jsonObject.TryGetValue(Name, out _))
{
Expand Down Expand Up @@ -2362,7 +2368,7 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e)
string jsonContent = File.ReadAllText(Json_Path);


if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length > 2 || jsonContent == "null")
if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length > 2 || jsonContent == "Null")
{// Parse the JSON content


Expand Down

0 comments on commit f5e721f

Please sign in to comment.