Skip to content

Commit

Permalink
(╥﹏╥)
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Jan 29, 2024
1 parent 7bdd742 commit 9e506d3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 24 deletions.
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.
15 changes: 4 additions & 11 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public MainWindow()
try
{
AppDataFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
LOG_Folder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + @"\[VTOL]__ERROR_LOGS\";
LOG_Folder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + @"\VTOL_ERROR_LOGS\";
//win 10
if (Environment.OSVersion.Platform == PlatformID.Win32NT && (Environment.OSVersion.Version.Build < 22000) ){

Expand Down Expand Up @@ -307,8 +307,7 @@ public MainWindow()
if (User_Settings_Vars != null)
{

// ProfileManager Profile_ = new ProfileManager();
// Profile_.InitializeProfiles(null);
;
string language = "en-EN";
switch (User_Settings_Vars.Language)
{
Expand Down Expand Up @@ -350,14 +349,9 @@ public MainWindow()

Send_Danger_Notif(VTOL.Resources.Languages.Language.CouldNotReadUserSettingsPleaseRunAsAdminOrRepairCleanYourInstallation, 10000);

}//todo update tools
}

Wpf.Ui.Appearance.Theme.Apply(
Wpf.Ui.Appearance.ThemeType.Unknown,
// Theme type
Wpf.Ui.Appearance.BackgroundType.None, // Background type
true // Whether to change accents automatically
);
Wpf.Ui.Appearance.Theme.Apply(Wpf.Ui.Appearance.ThemeType.Unknown, Wpf.Ui.Appearance.BackgroundType.None, true);



Expand All @@ -373,7 +367,6 @@ public MainWindow()
Admin_Label.Visibility = Visibility.Hidden;

}
// UserInterfaceCustomScale(1.5);
Check_For_New_Update(true);

}
Expand Down
44 changes: 31 additions & 13 deletions VTOL_2.0.0/Pages/Page_Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ static bool CustomKeyComparer(string key1, string key2)
public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsToUpdate, bool UPDATE_Folders = false)
{
List<NORTHSTARCOMPATIBLE_MOD> OUTPUT = new List<NORTHSTARCOMPATIBLE_MOD>();

if (modsToUpdate.Count() <= 0)
{
return OUTPUT;
Expand All @@ -272,8 +271,8 @@ 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)
{
File.WriteAllText(Json_Path, "{\t\t\n\n}");

Expand All @@ -293,8 +292,18 @@ public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo
string pattern = @"-\d+\.\d+\.\d+$";
Match match = Regex.Match(dirName, pattern);
// Remove the version number from the directory name
string dirNameWithoutVersion = match.Success ? dirName.Replace(match.Value, "") : dirName;
Console.WriteLine(dirNameWithoutVersion + "\n\n" + dirName);
string dirNameWithoutVersion = null;

dirNameWithoutVersion = match.Success ? dirName.Replace(match.Value, "") : dirName;

if (dirNameWithoutVersion == null)
{

dirNameWithoutVersion = match.Success ? dirInfo.Name.Replace(match.Value, "") : dirInfo.Name;
// Handle the case where the value is null


}
// Handle the case where the value is null
Mod.Name = dirNameWithoutVersion;
Mod.Value = false; // or some other appropriate value
Expand Down Expand Up @@ -413,7 +422,6 @@ public List<NORTHSTARCOMPATIBLE_MOD> READ_UPDATE_MOD_LIST(DirectoryInfo[] modsTo
}
catch (Exception ex)
{
Console.WriteLine("Invalid JSON: " + ex.Message);

Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

Expand Down Expand Up @@ -465,14 +473,15 @@ public async Task Call_Mods_From_Folder()
List<NORTHSTARCOMPATIBLE_MOD> DIRECTORY_MODS = READ_UPDATE_MOD_LIST(subDirs);

CLEANED_FORMAT_MODS = DIRECTORY_MODS;

}
DispatchIfNecessary(async () =>

{

Mod_Count_Label.Content = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ModCount + CLEANED_FORMAT_MODS.Count;
});

foreach (var Verified_Installed_Mod in CLEANED_FORMAT_MODS)
{
try
Expand Down Expand Up @@ -550,10 +559,10 @@ public async Task Call_Mods_From_Folder()
{
string[] parts = Verified_Installed_Mod.Namespace.Split('-');
string name = Verified_Installed_Mod.Namespace.Trim();
string author = null;
string ver = null;
string author = "NA";
string ver = "NA";

if (parts.Length > 1)
if (parts.Length == 3 )
{
author = parts[0];
name = parts[1];
Expand All @@ -566,7 +575,8 @@ public async Task Call_Mods_From_Folder()
}
catch (Exception ex)
{

Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

}
}
Main.loaded_mods = true;
Expand All @@ -591,6 +601,8 @@ public async Task Call_Mods_From_Folder()
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

}


Expand Down Expand Up @@ -938,6 +950,7 @@ private void ApplyDataBinding()
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

}
}
Expand Down Expand Up @@ -1593,6 +1606,7 @@ public static string FindFirstFile(string path, string searchPattern)
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

return string.Empty;
}
Expand All @@ -1612,8 +1626,10 @@ public static string FindFirstFile(string path, string searchPattern)
// Exception could occur due to insufficient permission.
directories = Directory.GetDirectories(path);
}
catch (Exception)
catch (Exception e)
{
Log.Error(e, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{e.InnerException}{Environment.NewLine}");

return string.Empty;
}

Expand All @@ -1635,9 +1651,10 @@ public static string FindFirstFile(string path, string searchPattern)



catch (Exception ex)
catch (Exception e)
{

Log.Error(e, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{e.InnerException}{Environment.NewLine}");

}
// If no file was found (neither in this directory nor in the child directories)
Expand Down Expand Up @@ -2747,6 +2764,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");

}
}
Expand Down

0 comments on commit 9e506d3

Please sign in to comment.