Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test new log details #87

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
2 changes: 0 additions & 2 deletions VTOL_2.0.0/Pages/Page_Home.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3368,15 +3368,13 @@ private void Parse_Release(string json_name = "temp.json")
StreamWriter.WriteLine(User_Settings_Json_Strings);
StreamWriter.Close();
}
//Send_Info_Notif(GetTextResource("NOTIF_INFO_RELEASE_PARSED") + current_Northstar_version_Url);

}
else
{
DispatchIfNecessary(async () =>
{

//Send_Error_Notif(GetTextResource("NOTIF_ERROR_RELEASE_NOT_FOUND"));
SnackBar.Appearance = ControlAppearance.Danger;
SnackBar.Title = "ERROR!";
SnackBar.Message = VTOL.Resources.Languages.Language.Parse_Release_ReleaseNotFound;
Expand Down
85 changes: 62 additions & 23 deletions VTOL_2.0.0/Pages/Page_Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,22 @@ public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo
}

string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json");

if (File.Exists(Json_Path) == true)
if (!File.Exists(Json_Path))
{
// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);
File.WriteAllText(Json_Path, "{\t\t\n\n}");
DispatchIfNecessary(async () =>
{


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();
});
}

// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);

if (jsonContent.IsNullOrEmpty() == true && jsonContent.Length < 5)
{
Expand Down Expand Up @@ -472,7 +483,7 @@ public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo


}
}

}
catch (Exception ex)
{
Expand Down Expand Up @@ -525,15 +536,26 @@ public async Task Call_Mods_From_Folder()
{
string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json");


if (File.Exists(Json_Path))
if (!File.Exists(Json_Path))
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");
DispatchIfNecessary(async () =>
{


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();
});
}


List<NORTHSTARCOMPATIBLE_MOD> DIRECTORY_MODS = READ_UPDATE_MOD_LIST(subDirs);

CLEANED_FORMAT_MODS = DIRECTORY_MODS;

}

DispatchIfNecessary(async () =>

{
Expand Down Expand Up @@ -1074,10 +1096,21 @@ public void Move_Mods(string val, bool Enable_Disable)


string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json");


if (File.Exists(Json_Path))
if (!File.Exists(Json_Path))
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");
DispatchIfNecessary(async () =>
{


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();
});
}


// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);
// Parse the JSON content
Expand All @@ -1099,16 +1132,11 @@ public void Move_Mods(string val, bool Enable_Disable)
// Write back to the file
File.WriteAllText(Json_Path, updatedJson);

}
else
{


Snackbar.Title = VTOL.Resources.Languages.Language.ERROR;
Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution;
Snackbar.Message = "File" + Json_Path + " Could not be Edited.";
Snackbar.Show();


}

}
else
{
Expand Down Expand Up @@ -2315,10 +2343,21 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e)
var btn = sender as Wpf.Ui.Controls.Dialog;

string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json");
if (!File.Exists(Json_Path))
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");
DispatchIfNecessary(async () =>
{


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();
});
}


if (File.Exists(Json_Path))
{
// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);

Expand All @@ -2332,7 +2371,7 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e)

}

JObject jsonObject = JObject.Parse(jsonContent);
JObject jsonObject = JObject.Parse(jsonContent);
string Name = workingmod;
if (jsonObject.TryGetValue(Name, out _))
{
Expand All @@ -2349,7 +2388,7 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e)



}




Expand Down
33 changes: 22 additions & 11 deletions VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio



Console.WriteLine("Plugin Detected ------\n\n\n\n\n");
// Console.WriteLine("Plugin Detected ------\n\n\n\n\n");

bool consent_TM = false;

Expand Down Expand Up @@ -3707,7 +3707,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio
}
else if (mod_json == true && NS_CANDIDATE_INSTALL == false)
{
Console.WriteLine("Mod Detected ------\n\n\n\n\n");
// Console.WriteLine("Mod Detected ------\n\n\n\n\n");

if (File.Exists(manifest_json) == true)
{
Expand All @@ -3717,14 +3717,14 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio
if (manidata.SelectToken("namespace") == null)
{
// Create a new JObject for the namespace
Console.WriteLine("Namespace not found - Inserting : " + namespace_.ToString());
Log.Information("Namespace not found - Inserting : " + namespace_.ToString());
// namespaceObject[namespace__] = namespace_;
manidata["namespace"] = namespace_;


File.WriteAllText(manifest_json, manidata.ToString());

Console.WriteLine("File updated and saved.");
Log.Information("File updated and saved.");
}


Expand All @@ -3741,12 +3741,24 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio


string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json");
if (!File.Exists(Json_Path))
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");
DispatchIfNecessary(async () =>
{


if (File.Exists(Json_Path))
{
// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);
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();
});
}



// Read the JSON file
string jsonContent = File.ReadAllText(Json_Path);

if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length > 2 || jsonContent == "null")
{// Parse the JSON content
Expand All @@ -3768,7 +3780,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio
// Write back to the fileorder
File.WriteAllText(Json_Path, updatedJson);

}


Update_ActionCard_Progress(Action_Card_, 30, true);

Expand Down Expand Up @@ -3797,8 +3809,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio
}
else
{



DispatchIfNecessary(async () =>
{
Update_ActionCard_Progress(Action_Card_, 5);
Expand Down
18 changes: 18 additions & 0 deletions VTOL_2.0.0/Resources/Languages/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions VTOL_2.0.0/Resources/Languages/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -831,4 +831,10 @@
<data name="FATALERROR" xml:space="preserve">
<value>FATAL - ERROR</value>
</data>
<data name="CouldNotBeFoundOrHadAnErrorAndWasEdited" xml:space="preserve">
<value> " - Could not be Found or had an error and was Edited.</value>
</data>
<data name="File" xml:space="preserve">
<value>File - </value>
</data>
</root>
Loading