diff --git a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 index 6b6b8a9d..a22aba07 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 and b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 differ diff --git a/VTOL_2.0.0/MainWindow.xaml.cs b/VTOL_2.0.0/MainWindow.xaml.cs index 3b9d773a..67812b71 100644 --- a/VTOL_2.0.0/MainWindow.xaml.cs +++ b/VTOL_2.0.0/MainWindow.xaml.cs @@ -97,7 +97,25 @@ static void Main(string[] args) } + public string ProductVersion + { + get + { + try + { + string file = (FileVersionInfo.GetVersionInfo(Assembly.GetCallingAssembly().Location).ProductVersion).ToString(); + return file.Substring(0, file.IndexOf("+") + 1).Replace("+", ""); + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + } + return "1.0.0"; + } + } + public MainWindow() { try @@ -268,9 +286,9 @@ public MainWindow() true // Whether to change accents automatically ); + - - + VERSION_TEXT.Text = "VTOL - " + ProductVersion + " |"; if (IsAdministrator()) { @@ -283,13 +301,13 @@ public MainWindow() } - + } catch (Exception ex) { - + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -643,8 +661,8 @@ private void Log_Folder_warning_Click(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}"); } @@ -724,6 +742,7 @@ private void Changelog_Click(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}"); } } @@ -930,11 +949,12 @@ private void Main_Win_Control_StateChanged(object sender, EventArgs 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}"); - } + + } } diff --git a/VTOL_2.0.0/Pages/Page_Home.xaml.cs b/VTOL_2.0.0/Pages/Page_Home.xaml.cs index b0f985ce..4453d1b9 100644 --- a/VTOL_2.0.0/Pages/Page_Home.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Home.xaml.cs @@ -739,7 +739,7 @@ public string ProductVersion Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } - return "0.0.0"; + return "1.0.0"; } } @@ -752,7 +752,7 @@ async void Auto_Install_(bool resart_ = false) if (File.Exists(Current_Install_Folder + @"NorthstarLauncher.exe") && File.Exists(Current_Install_Folder + @"Titanfall2.exe")) { NSExe = Get_And_Set_Filepaths(Current_Install_Folder, "NorthstarLauncher.exe"); - await Task.Delay(1500); + await Task.Delay(200); // Get the file version info for the notepad. FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Current_Install_Folder + @"NorthstarLauncher.exe"); @@ -780,7 +780,7 @@ async void Auto_Install_(bool resart_ = false) NSExe = Get_And_Set_Filepaths(Current_Install_Folder, "NorthstarLauncher.exe"); }); - await Task.Delay(1500); + await Task.Delay(200); if (resart_ == true) { @@ -3240,7 +3240,7 @@ private void Parse_Release(string json_name = "temp.json") } } - + void Check_For_New_Northstar_Install() { try @@ -3312,13 +3312,14 @@ void Check_For_New_Northstar_Install() catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } } + async Task Install_NS_METHOD() { await Task.Run(async () => @@ -3596,7 +3597,7 @@ private void Completed(object sender, AsyncCompletedEventArgs e) public bool TryDeleteDirectory( string directoryPath, bool overwrite = true, int maxRetries = 10, -int millisecondsDelay = 300) +int millisecondsDelay = 100) { if (directoryPath == null) throw new ArgumentNullException(directoryPath); @@ -3631,7 +3632,7 @@ public bool TryDeleteDirectory( public bool TryCreateDirectory( string directoryPath, int maxRetries = 10, - int millisecondsDelay = 200) + int millisecondsDelay = 100) { if (directoryPath == null) throw new ArgumentNullException(directoryPath); @@ -3670,7 +3671,7 @@ public bool TryCreateDirectory( public bool TryMoveFile( string Origin, string Destination, bool overwrite = true, int maxRetries = 10, - int millisecondsDelay = 200) + int millisecondsDelay = 100) { if (Origin == null) throw new ArgumentNullException(Origin); @@ -3705,7 +3706,7 @@ public bool TryMoveFile( public bool TryCopyFile( string Origin, string Destination, bool overwrite = true, int maxRetries = 10, - int millisecondsDelay = 300) + int millisecondsDelay = 100) { if (Origin == null) throw new ArgumentNullException(Origin); diff --git a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml index 4a3b0609..30320c4a 100644 --- a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml +++ b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml @@ -177,7 +177,7 @@ - + diff --git a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs index 39ca9664..1639e299 100644 --- a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs @@ -1751,7 +1751,7 @@ public List orderlist(List List) } else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) { - List = List.OrderBy(ob => Convert.ToDateTime(ob.date_created)).ToList(); + List = List.OrderBy(ob => Convert.ToDateTime(ob.raw_date)).ToList(); } else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) @@ -1813,7 +1813,7 @@ public List orderlist(List List) } else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) { - List = List.OrderByDescending(ob => Convert.ToDateTime(ob.date_created)).ToList(); + List = List.OrderByDescending(ob => Convert.ToDateTime(ob.raw_date)).ToList(); } else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) @@ -1876,7 +1876,7 @@ private List LoadListViewData(List Filter_Type = null, bool Searc try { - + itemsList.Clear(); string ICON = ""; @@ -1892,91 +1892,91 @@ private List LoadListViewData(List Filter_Type = null, bool Searc string Dependencies_ = ""; string Update_data = ""; string Button_label = ""; - + if (Current_Mod_Filter_Tags != null) + { + Current_Mod_Filter_Tags = Current_Mod_Filter_Tags.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList(); + } + for (int i = 0; i < _updater.Thunderstore.Length; i++) + { + + if (_updater.Thunderstore[i].FullName.Contains("r2modman")) { - Current_Mod_Filter_Tags = Current_Mod_Filter_Tags.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList(); + continue; } - for (int i = 0; i < _updater.Thunderstore.Length; i++) - { - - if ( _updater.Thunderstore[i].FullName.Contains("r2modman") ) - { - continue; - } if (_updater.Thunderstore[i].IsDeprecated == true) { continue; } int rating = _updater.Thunderstore[i].RatingScore; - Tags = String.Join(" , ", _updater.Thunderstore[i].Categories); + Tags = String.Join(" , ", _updater.Thunderstore[i].Categories); - List versions = _updater.Thunderstore[i].versions; - if(Current_Mod_Filter_Tags != null && Current_Mod_Filter_Tags.Count > 0) - { + List versions = _updater.Thunderstore[i].versions; + if (Current_Mod_Filter_Tags != null && Current_Mod_Filter_Tags.Count > 0) + { - if (_updater.Thunderstore[i].Categories.Select(x => x).Intersect(Current_Mod_Filter_Tags).Any()) + if (_updater.Thunderstore[i].Categories.Select(x => x).Intersect(Current_Mod_Filter_Tags).Any()) + { + if (Search_ == true) { - if (Search_ == true) - { - if (_updater.Thunderstore[i].Name.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase) || _updater.Thunderstore[i].Owner.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase)) - { + if (_updater.Thunderstore[i].Name.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase) || _updater.Thunderstore[i].Owner.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase)) + { - foreach (var items in versions) + foreach (var items in versions) - { + { - Downloads.Add(Convert.ToInt32(items.Downloads)); + Downloads.Add(Convert.ToInt32(items.Downloads)); - } + } - downloads = (Downloads.Sum()).ToString(); + downloads = (Downloads.Sum()).ToString(); - for (var x = 0; x < versions.First().Dependencies.Count; x++) + for (var x = 0; x < versions.First().Dependencies.Count; x++) + { + if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) { - if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) - { - continue; - } - else - { - Dependencies.Add(versions.First().Dependencies[x]); + continue; + } + else + { + Dependencies.Add(versions.First().Dependencies[x]); } } - Dependencies_ = String.Join(", ", Dependencies); + Dependencies_ = String.Join(", ", Dependencies); - download_url = versions.First().DownloadUrl; - ICON = versions.First().Icon; - FileSize = versions.First().FileSize.ToString(); - Descrtiption = versions.First().Description; - Downloads.Clear(); - Dependencies.Clear(); + download_url = versions.First().DownloadUrl; + ICON = versions.First().Icon; + FileSize = versions.First().FileSize.ToString(); + Descrtiption = versions.First().Description; + Downloads.Clear(); + Dependencies.Clear(); string raw_size = versions.First().FileSize.ToString(); if (int.TryParse(FileSize, out int value)) - { - FileSize = Convert_To_Size(value); - } + { + FileSize = Convert_To_Size(value); + } string bg_color; string label; Compare_Mod_To_List(_updater.Thunderstore[i].Name, versions.First().VersionNumber, Main.Current_Installed_Mods, out bg_color, out label); @@ -2001,7 +2001,7 @@ private List LoadListViewData(List Filter_Type = null, bool Searc // is_nsfw = _updater.Thunderstore[i].HasNsfwContent ? 100 : 0; - itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, date_created = _updater.Thunderstore[i].DateCreated.ToString(), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name+ "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); + itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = _updater.Thunderstore[i].DateCreated.ToString(), date_created = ConvertDateToString(_updater.Thunderstore[i].DateCreated), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); @@ -2009,59 +2009,59 @@ private List LoadListViewData(List Filter_Type = null, bool Searc } - } - else - { + } + else + { - foreach (var items in versions) + foreach (var items in versions) - { - Downloads.Add(Convert.ToInt32(items.Downloads)); + { + Downloads.Add(Convert.ToInt32(items.Downloads)); - } + } - downloads = (Downloads.Sum()).ToString(); - for (var x = 0; x < versions.First().Dependencies.Count; x++) + downloads = (Downloads.Sum()).ToString(); + for (var x = 0; x < versions.First().Dependencies.Count; x++) + { + if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) { - if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) - { - continue; - } - else - { - Dependencies.Add(versions.First().Dependencies[x]); - - } + continue; + } + else + { + Dependencies.Add(versions.First().Dependencies[x]); } + } + - download_url = versions.First().DownloadUrl; + download_url = versions.First().DownloadUrl; - ICON = versions.First().Icon; - FileSize = versions.First().FileSize.ToString(); - Descrtiption = versions.First().Description; - Dependencies_ = String.Join(", ", Dependencies); + ICON = versions.First().Icon; + FileSize = versions.First().FileSize.ToString(); + Descrtiption = versions.First().Description; + Dependencies_ = String.Join(", ", Dependencies); - Dependencies.Clear(); + Dependencies.Clear(); - Downloads.Clear(); + Downloads.Clear(); string raw_size = versions.First().FileSize.ToString(); if (int.TryParse(FileSize, out int value)) - { - FileSize = Convert_To_Size(value); - } + { + FileSize = Convert_To_Size(value); + } string bg_color; string label; int is_favourite = 0; @@ -2073,7 +2073,7 @@ private List LoadListViewData(List Filter_Type = null, bool Searc } - Compare_Mod_To_List(_updater.Thunderstore[i].Name, versions.First().VersionNumber, Main.Current_Installed_Mods, out bg_color, out label ); + Compare_Mod_To_List(_updater.Thunderstore[i].Name, versions.First().VersionNumber, Main.Current_Installed_Mods, out bg_color, out label); if (bg_color == null || label == null) { bg_color = "#FF005D42"; @@ -2086,69 +2086,69 @@ private List LoadListViewData(List Filter_Type = null, bool Searc { Mod_Update_Counter++; } - // is_nsfw = _updater.Thunderstore[i].HasNsfwContent ? 100 : 0; + // is_nsfw = _updater.Thunderstore[i].HasNsfwContent ? 100 : 0; - itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, date_created = _updater.Thunderstore[i].DateCreated.ToString(), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite}); + itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = _updater.Thunderstore[i].DateCreated.ToString(), date_created = ConvertDateToString(_updater.Thunderstore[i].DateCreated), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); } } - } - else - { + } + else + { - if (Search_ == true) - { + if (Search_ == true) + { - if (_updater.Thunderstore[i].Name.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase) || _updater.Thunderstore[i].Owner.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase)) - { + if (_updater.Thunderstore[i].Name.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase) || _updater.Thunderstore[i].Owner.Contains(SearchQuery, StringComparison.OrdinalIgnoreCase)) + { - foreach (var items in versions) + foreach (var items in versions) - { + { - Downloads.Add(Convert.ToInt32(items.Downloads)); + Downloads.Add(Convert.ToInt32(items.Downloads)); - } + } - downloads = (Downloads.Sum()).ToString(); - for (var x = 0; x < versions.First().Dependencies.Count; x++) + downloads = (Downloads.Sum()).ToString(); + for (var x = 0; x < versions.First().Dependencies.Count; x++) + { + if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) { - if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) - { - continue; - } - else - { - Dependencies.Add(versions.First().Dependencies[x]); - - } + continue; + } + else + { + Dependencies.Add(versions.First().Dependencies[x]); } - Dependencies_ = String.Join(", ", Dependencies); + } - download_url = versions.First().DownloadUrl; - ICON = versions.First().Icon; - FileSize = versions.First().FileSize.ToString(); - Descrtiption = versions.First().Description; - Downloads.Clear(); - Dependencies.Clear(); + Dependencies_ = String.Join(", ", Dependencies); + + download_url = versions.First().DownloadUrl; + ICON = versions.First().Icon; + FileSize = versions.First().FileSize.ToString(); + Descrtiption = versions.First().Description; + Downloads.Clear(); + Dependencies.Clear(); string raw_size = versions.First().FileSize.ToString(); - if (int.TryParse(FileSize, out int value)) - { - FileSize = Convert_To_Size(value); - } + if (int.TryParse(FileSize, out int value)) + { + FileSize = Convert_To_Size(value); + } string bg_color; string label; // int is_nsfw = 0; @@ -2173,7 +2173,7 @@ private List LoadListViewData(List Filter_Type = null, bool Searc Mod_Update_Counter++; } // is_nsfw = _updater.Thunderstore[i].HasNsfwContent ? 100 : 0; - itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, date_created = _updater.Thunderstore[i].DateCreated.ToString(), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName , raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); + itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = _updater.Thunderstore[i].DateCreated.ToString(), date_created = ConvertDateToString(_updater.Thunderstore[i].DateCreated), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); @@ -2181,57 +2181,57 @@ private List LoadListViewData(List Filter_Type = null, bool Searc } - else - { + else + { - foreach (var items in versions) + foreach (var items in versions) - { - Downloads.Add(Convert.ToInt32(items.Downloads)); + { + Downloads.Add(Convert.ToInt32(items.Downloads)); - } + } - downloads = (Downloads.Sum()).ToString(); - for (var x = 0; x < versions.First().Dependencies.Count; x++) + downloads = (Downloads.Sum()).ToString(); + for (var x = 0; x < versions.First().Dependencies.Count; x++) + { + if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) { - if (versions.First().Dependencies[x].Contains("northstar-Northstar") || versions.First().Dependencies[x].Contains("ebkr-r2modman-")) - { - - continue; - } - else - { - Dependencies.Add(versions.First().Dependencies[x]); - } + continue; + } + else + { + Dependencies.Add(versions.First().Dependencies[x]); } - download_url = versions.First().DownloadUrl; + } - ICON = versions.First().Icon; - FileSize = versions.First().FileSize.ToString(); - Descrtiption = versions.First().Description; - Dependencies_ = String.Join(", ", Dependencies); + download_url = versions.First().DownloadUrl; - Dependencies.Clear(); + ICON = versions.First().Icon; + FileSize = versions.First().FileSize.ToString(); + Descrtiption = versions.First().Description; + Dependencies_ = String.Join(", ", Dependencies); - Downloads.Clear(); + Dependencies.Clear(); + + Downloads.Clear(); string raw_size = versions.First().FileSize.ToString(); if (int.TryParse(FileSize, out int value)) - { - FileSize = Convert_To_Size(value); - } + { + FileSize = Convert_To_Size(value); + } string bg_color; string label; int is_favourite = 0; @@ -2255,7 +2255,7 @@ private List LoadListViewData(List Filter_Type = null, bool Searc } //is_nsfw = _updater.Thunderstore[i].HasNsfwContent ? 100 : 0; - itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, date_created = _updater.Thunderstore[i].DateCreated.ToString(), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); + itemsList.Add(new Grid_ { Name = _updater.Thunderstore[i].Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = _updater.Thunderstore[i].DateCreated.ToString(), date_created = ConvertDateToString(_updater.Thunderstore[i].DateCreated), description = Descrtiption, owner = _updater.Thunderstore[i].Owner, Rating = rating, download_url = download_url + "|" + _updater.Thunderstore[i].Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = _updater.Thunderstore[i].PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = _updater.Thunderstore[i].FullName, raw_size = raw_size, Update_data = _updater.Thunderstore[i].Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); } @@ -2264,26 +2264,65 @@ private List LoadListViewData(List Filter_Type = null, bool Searc - - - - } - - - + } + + + + + + } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + } + return itemsList; + } + public static string ConvertDateToString(DateTime date) + { + TimeSpan timeSince = DateTime.Now - date; + string output = ""; + + if (timeSince.TotalHours < 1) + { + output = $"{Math.Max((int)timeSince.TotalMinutes, 1)} minutes ago"; + } + else if (timeSince.TotalHours < 12) + { + output = $"{Math.Max((int)timeSince.TotalHours, 1)} hours ago"; + } + else if (timeSince.TotalDays < 1) + { + output = "Today"; + } + else if (timeSince.TotalDays < 2) + { + output = "Yesterday"; + } + else if (timeSince.TotalDays < 7) + { + output = $"{Math.Max((int)timeSince.TotalDays, 1)} days ago"; + } + else if (timeSince.TotalDays >= 7) + { + if (timeSince.TotalDays < 14) + { + output = "1 week ago"; + } + else + { + output = date.ToString("yyyy-MM-dd"); // Replace with your desired date format + } } - return itemsList; + return output; } public string Search_For_Mod_Thunderstore(string SearchQuery = "None") @@ -3099,6 +3138,59 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio } + else if(Script.Length == 0) + { + string pluginsFolderName = "plugins"; // Folder name to search for + + string pluginsFolderPath = Path.Combine(Destination, pluginsFolderName); + + if (Directory.Exists(pluginsFolderPath)) + { + // Combine destination folder path and plugins folder name + string destFolderPath = Path.Combine(User_Settings_Vars.NorthstarInstallLocation, pluginsFolderName); + + // Copy plugins folder and its contents to destination folder + string[] files = Directory.GetFiles(pluginsFolderPath); + + // Copy each file to the destination folder + foreach (string file in files) + { + string fileName = Path.GetFileName(file); + string destFile = Path.Combine(destFolderPath, fileName); + TryCopyFile(file, destFile, true); + } + + DispatchIfNecessary(() => { + if (Progress_Bar != null) + { + Progress_Bar.Value = 0; + } + + SnackBar.Title = "SUCCESS"; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + SnackBar.Message = "Plugins in the mod folder have been copied successfully."; + SnackBar.Show(); + + + }); + } + else + { + DispatchIfNecessary(() => { + if (Progress_Bar != null) + { + Progress_Bar.Value = 0; + } + + SnackBar.Title = "SUCCESS"; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + SnackBar.Message = "Plugins .dll(s) not found or configured properly in the mod folder!"; + SnackBar.Show(); + + + }); + } + } } @@ -3259,7 +3351,8 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio }); if (File.Exists(User_Settings_Vars.NorthstarInstallLocation + @"NorthstarLauncher.exe")) { - + DispatchIfNecessary(() => + { FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(User_Settings_Vars.NorthstarInstallLocation + @"NorthstarLauncher.exe"); string Current_Ver_ = myFileVersionInfo.FileVersion; @@ -3267,8 +3360,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio Properties.Settings.Default.Version = Current_Ver_; Properties.Settings.Default.Save(); Northstar_VEr_Temp = Current_Ver_; - DispatchIfNecessary(() => - { + Main.NORTHSTAR_BUTTON.Content = "Northstar Version - " + Current_Ver_.Remove(0, 1); Main.VERSION_TEXT.Text = "VTOL - " + ProductVersion + " |"; Main.VERSION_TEXT.Refresh();