Skip to content

Commit

Permalink
Bunch more changes and update sys works fully now
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Dec 17, 2022
1 parent 818d871 commit b208630
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 85 deletions.
2 changes: 1 addition & 1 deletion VTOL_2.0.0/Pages/Page_Mods.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@

</Image>
<ComboBox x:Name="Filter" Margin="135,93,40,0" BorderBrush="{x:Null}" Background="#C1424242" SelectedIndex="-1" VerticalAlignment="Top" SelectionChanged="ComboBox_SelectionChanged" Height="33" Padding="10,5,10,7" Grid.Column="1" ToolTip="Filter Mod List " >
<ComboBoxItem Name="Name">Name</ComboBoxItem>
<ComboBoxItem Name="Date">Date</ComboBoxItem>
<ComboBoxItem Name="Name">Name</ComboBoxItem>
<ComboBoxItem Name="Status">Status</ComboBoxItem>
</ComboBox>

Expand Down
101 changes: 17 additions & 84 deletions VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,86 +1269,7 @@ private void Compare_Mod_To_List(string modname, string Mod_version_current, Has
label = res;
bg_color = bg;
}
async void Check_Update_Tag(HandyControl.Controls.SimplePanel GridPanel_)
{
DispatchIfNecessary(() =>
{




// HandyControl.Controls.SimplePanel GridPanel_ = FindVisualChild<HandyControl.Controls.SimplePanel>(Card);
//Wpf.Ui.Controls.Button Button = FindVisualChild<Wpf.Ui.Controls.Button>(Card);
Wpf.Ui.Controls.Button Button = GridPanel_.FirstOrDefaultChild<Wpf.Ui.Controls.Button>(l => l.Name == "Install_Bttn_Thunderstore");
string[] name = Button.CommandParameter.ToString().Replace(" ", "_").Split("|");
string Mod_version_current = name[1];
//string namex = Regex.Replace(name[0], @"(\d+\.)(\d+\.)(\d)", "");
// namex = namex.Replace(" ", "_");
if (Main.Current_Installed_Mods.Count() > 2)
{
//debugging code. keep
// MessageBox.Show(string.Join("\n", name));

//MessageBox.Show(string.Join("\n", Main.Current_Installed_Mods));
// MessageBox.Show(Main.Current_Installed_Mods.Contains(name[0]).ToString());
// MessageBox.Show(Mod_version_current);

foreach (var item in Main.Current_Installed_Mods) {
//SnackBar.Title = "WARNING";
//SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger;
//SnackBar.Message = name[0].ToString();
//SnackBar.Show();

if (findString(Regex.Replace(item, @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-'), name[0], "_"))
{

Regex pattern = new Regex(@"\d+(\.\d+)+");
Match m = pattern.Match(item);
string version = m.Value;
int result = versionCompare(version,Mod_version_current);
switch (result)
{
//Button.Content = "Re-Install";
// Button.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFAD7F1A");

//fix versions
case 1:
Button.Content = "Install";
Button.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FF005D42");
break;
case -1:
Button.Content = "Update";
Button.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FF009817");

break;
case 0:
Button.Content = "Re-Install";
Button.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFAD7F1A");

break;
default:
Button.Content = "Install";
Button.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FF005D42");

break;
}

}






}



}


});
}

public static bool ContainsAny(string stringToTest, List<string> substrings)
{
if (string.IsNullOrEmpty(stringToTest) || substrings == null)
Expand Down Expand Up @@ -2184,6 +2105,8 @@ void downloader_DownloadCompleted(object sender, AsyncCompletedEventArgs e, Prog
}
else
{


Unpack_To_Location_Custom(Location, User_Settings_Vars.NorthstarInstallLocation + User_Settings_Vars.Profile_Path + @"\mods\" + Mod_Name, Progress_Bar, true, false, Skin_Install, NS_CANDIDATE_INSTALL,Mod_Name);
}

Expand Down Expand Up @@ -2219,13 +2142,23 @@ await Task.Run(() =>
};
}
var Destinfo = new DirectoryInfo(User_Settings_Vars.NorthstarInstallLocation);


if (!Directory.Exists(Destinfo.FullName + @"NS_Downloaded_Mods\"))
{
Directory.CreateDirectory(Destinfo.FullName + @"NS_Downloaded_Mods\");

}
else
{

Clear_Folder(Destinfo.FullName + @"NS_Downloaded_Mods\");
}

downloader.DownloadFileCompleted += delegate (object sender4, AsyncCompletedEventArgs e4)
{


downloader_DownloadCompleted(sender4, e4, Progress_Bar, words[1], Destinfo.FullName + @"NS_Downloaded_Mods\" + words[1] + ".zip",Skin_Install_,NS_CANDIDATE_INSTALL);
downloader_DownloadCompleted(sender4, e4, Progress_Bar, words[1], Destinfo.FullName + @"NS_Downloaded_Mods\" + Regex.Replace(words[1], @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') + ".zip",Skin_Install_,NS_CANDIDATE_INSTALL);
};

downloader.StartAsync();
Expand Down Expand Up @@ -2613,7 +2546,7 @@ async void Call_Mods_From_Folder_Lite()
}

}
public async Task Unpack_To_Location_Custom(string Target_Zip, string Destination, ProgressBar Progress_Bar, bool Clean_Thunderstore = false, bool clean_normal = false, bool Skin_Install = false,bool NS_CANDIDATE_INSTALL = false ,string mod_name = "~")
public async Task Unpack_To_Location_Custom(string Target_Zip, string Destination, ProgressBar Progress_Bar, bool Clean_Thunderstore = false, bool clean_normal = false, bool Skin_Install = false,bool NS_CANDIDATE_INSTALL = false ,string mod_name ="~")
{
//ToDo Check if url or zip location
//add drag and drop
Expand All @@ -2639,7 +2572,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio
{
Clear_Folder(mod);

TryDeleteDirectory(mod, true);
TryDeleteDirectory(mod, true);


}
Expand Down

0 comments on commit b208630

Please sign in to comment.