Merge pull request #139 from megalon/feature/reinstall-selected

Separate Install and Reinstall buttons
This commit is contained in:
Assistant 2020-05-12 18:32:21 -06:00 committed by GitHub
commit a6c5db47b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 198 additions and 40 deletions

View file

@ -47,6 +47,9 @@
<setting name="SelectedTheme" serializeAs="String">
<value />
</setting>
<setting name="ReinstallInstalled" serializeAs="String">
<value>True</value>
</setting>
</ModAssistant.Properties.Settings>
<ModAssistant.Settings1>
<setting name="InstallFolder" serializeAs="String">

View file

@ -28,6 +28,8 @@
<ResourceDictionary x:Name="GridViewColumnHeader_Style" Source="Styles/GridViewColumnHeader.xaml" />
<ResourceDictionary x:Name="ListView_Style" Source="Styles/ListView.xaml" />
<ResourceDictionary x:Name="ListViewItem_Style" Source="Styles/ListViewItem.xaml" />
<ResourceDictionary x:Name="Menu_Style" Source="Styles/Menu.xaml" />
<ResourceDictionary x:Name="MenuItem_Style" Source="Styles/MenuItem.xaml" />
<ResourceDictionary x:Name="CheckBox_Style" Source="Styles/CheckBox.xaml" />
<ResourceDictionary x:Name="ComboBoxItem_Style" Source="Styles/ComboBoxItem.xaml" />
<ResourceDictionary x:Name="ComboBox_Style" Source="Styles/ComboBox.xaml" />

View file

@ -20,6 +20,7 @@ namespace ModAssistant
public static bool SaveModSelection;
public static bool CheckInstalledMods;
public static bool SelectInstalledMods;
public static bool ReinstallInstalledMods;
public static string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
public static List<string> SavedMods = ModAssistant.Properties.Settings.Default.SavedMods.Split(',').ToList();
@ -64,6 +65,7 @@ namespace ModAssistant
SaveModSelection = ModAssistant.Properties.Settings.Default.SaveSelected;
CheckInstalledMods = ModAssistant.Properties.Settings.Default.CheckInstalled;
SelectInstalledMods = ModAssistant.Properties.Settings.Default.SelectInstalled;
ReinstallInstalledMods = ModAssistant.Properties.Settings.Default.ReinstallInstalled;
if (e.Args.Length == 0)
{

View file

@ -95,6 +95,7 @@
<sys:String x:Key="Options:SaveSelectedMods">Options:SaveSelectedMods</sys:String>
<sys:String x:Key="Options:CheckInstalledMods">Options:CheckInstalledMods</sys:String>
<sys:String x:Key="Options:SelectInstalledMods">Options:SelectInstalledMods</sys:String>
<sys:String x:Key="Options:ReinstallInstalledMods">Options:Reinstall Installed Mods</sys:String>
<sys:String x:Key="Options:EnableOneClickInstalls">Options:EnableOneClickInstalls</sys:String>
<sys:String x:Key="Options:BeatSaver">Options:BeatSaver</sys:String>
<sys:String x:Key="Options:ModelSaber">Options:ModelSaber</sys:String>

View file

@ -135,6 +135,7 @@
<sys:String x:Key="Options:SaveSelectedMods">Save Selected Mods</sys:String>
<sys:String x:Key="Options:CheckInstalledMods">Detect Installed Mods</sys:String>
<sys:String x:Key="Options:SelectInstalledMods">Select Installed Mods</sys:String>
<sys:String x:Key="Options:ReinstallInstalledMods">Reinstall Installed Mods</sys:String>
<sys:String x:Key="Options:EnableOneClickInstalls">Enable OneClick™ Installs</sys:String>
<sys:String x:Key="Options:BeatSaver">BeatSaver</sys:String>
<sys:String x:Key="Options:ModelSaber">ModelSaber</sys:String>

View file

@ -127,6 +127,7 @@
<sys:String x:Key="Options:SaveSelectedMods">保存选中的Mod</sys:String>
<sys:String x:Key="Options:CheckInstalledMods">检查已安装的Mod</sys:String>
<sys:String x:Key="Options:SelectInstalledMods">选中已安装的Mod</sys:String>
<sys:String x:Key="Options:ReinstallInstalledMods">Reinstall Installed Mods</sys:String>
<sys:String x:Key="Options:EnableOneClickInstalls">在以下站点启用OneClick™一键安装</sys:String>
<sys:String x:Key="Options:BeatSaver">BeatSaver</sys:String>
<sys:String x:Key="Options:ModelSaber">ModelSaber</sys:String>

View file

@ -198,26 +198,31 @@
</StackPanel>
</Button>
<Button
Name="InstallButton"
Grid.Column="2"
Width="100"
<StackPanel
Grid.Column="2" Orientation="Horizontal"
Height="40"
Width="100"
Margin="0,10,0,0"
HorizontalAlignment="Right"
Click="InstallButton_Click"
IsEnabled="False">
<StackPanel>
<TextBlock
HorizontalAlignment="Right">
<Button
Name="InstallButton"
Width="100"
Height="40"
HorizontalAlignment="Right"
Click="InstallButton_Click"
IsEnabled="False">
<StackPanel>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Text="{DynamicResource MainWindow:InstallButtonTop}" />
<TextBlock
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Text="{DynamicResource MainWindow:InstallButtonBottom}" />
</StackPanel>
</Button>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
</Grid>

View file

@ -178,6 +178,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\MenuItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles\Menu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\RepeatButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View file

@ -317,7 +317,10 @@ namespace ModAssistant.Pages
foreach (Mod mod in ModsList)
{
// Ignore mods that are newer than installed version
if (mod.ListItem.IsNewerVersionInstalled) continue;
if (mod.ListItem.GetVersionComparison > 0) continue;
// Ignore mods that are on current version if we aren't reinstalling mods
if (mod.ListItem.GetVersionComparison == 0 && !App.ReinstallInstalledMods) continue;
if (mod.name.ToLower() == "bsipa")
{
@ -573,12 +576,13 @@ namespace ModAssistant.Pages
}
}
public bool IsNewerVersionInstalled
public int GetVersionComparison
{
get
{
if (!IsInstalled) return false;
return _installedVersion > ModVersion;
if (!IsInstalled || _installedVersion < ModVersion) return -1;
if (_installedVersion > ModVersion) return 1;
return 0;
}
}

View file

@ -28,6 +28,7 @@
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
@ -135,9 +136,26 @@
Checked="SelectInstalled_Checked"
IsChecked="{Binding SelectInstalledMods, Mode=TwoWay}"
Unchecked="SelectInstalled_Unchecked" />
<TextBlock
Grid.Row="6"
Margin="50,5,5,5"
HorizontalAlignment="Left"
FontSize="16"
FontWeight="Bold"
Text="{DynamicResource Options:ReinstallInstalledMods}" />
<CheckBox
Name="ReinstallInstalled"
Grid.Row="6"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Checked="ReinstallInstalled_Checked"
IsChecked="{Binding ReinstallInstalledMods, Mode=TwoWay}"
Unchecked="ReinstallInstalled_Unchecked" />
<TextBlock
Grid.Row="7"
Margin="5"
HorizontalAlignment="Left"
FontSize="16"
@ -147,7 +165,7 @@
</TextBlock>
<TextBlock
Grid.Row="7"
Grid.Row="8"
Margin="50,5,5,5"
HorizontalAlignment="Left"
FontSize="16"
@ -155,7 +173,7 @@
Text="{DynamicResource Options:BeatSaver}" />
<CheckBox
Name="BeatSaverProtocolHandler"
Grid.Row="7"
Grid.Row="8"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
@ -164,7 +182,7 @@
Unchecked="BeatSaverProtocolHandler_Unchecked" />
<TextBlock
Grid.Row="8"
Grid.Row="9"
Margin="50,5,5,5"
HorizontalAlignment="Left"
FontSize="16"
@ -172,7 +190,7 @@
Text="{DynamicResource Options:ModelSaber}" />
<CheckBox
Name="ModelSaberProtocolHandler"
Grid.Row="8"
Grid.Row="9"
Grid.Column="1"
HorizontalAlignment="Left"
VerticalAlignment="Center"

View file

@ -21,6 +21,7 @@ namespace ModAssistant.Pages
public bool SaveSelection { get; set; }
public bool CheckInstalledMods { get; set; }
public bool SelectInstalledMods { get; set; }
public bool ReinstallInstalledMods { get; set; }
public bool ModelSaberProtocolHandlerEnabled { get; set; }
public bool BeatSaverProtocolHandlerEnabled { get; set; }
public string LogURL { get; private set; }
@ -33,8 +34,13 @@ namespace ModAssistant.Pages
SaveSelection = App.SaveModSelection;
CheckInstalledMods = App.CheckInstalledMods;
SelectInstalledMods = App.SelectInstalledMods;
ReinstallInstalledMods = App.ReinstallInstalledMods;
if (!CheckInstalledMods)
{
SelectInstalled.IsEnabled = false;
ReinstallInstalled.IsEnabled = false;
}
UpdateHandlerStatus();
@ -85,6 +91,7 @@ namespace ModAssistant.Pages
CheckInstalledMods = true;
Properties.Settings.Default.Save();
SelectInstalled.IsEnabled = true;
ReinstallInstalled.IsEnabled = true;
if (MainWindow.ModsOpened)
{
@ -99,6 +106,7 @@ namespace ModAssistant.Pages
CheckInstalledMods = false;
Properties.Settings.Default.Save();
SelectInstalled.IsEnabled = false;
ReinstallInstalled.IsEnabled = false;
if (MainWindow.ModsOpened)
{
@ -142,6 +150,22 @@ namespace ModAssistant.Pages
Properties.Settings.Default.Save();
}
private void ReinstallInstalled_Checked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ReinstallInstalled = true;
App.ReinstallInstalledMods = true;
ReinstallInstalledMods = true;
Properties.Settings.Default.Save();
}
private void ReinstallInstalled_Unchecked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ReinstallInstalled = false;
App.ReinstallInstalledMods = false;
ReinstallInstalledMods = false;
Properties.Settings.Default.Save();
}
private async void OpenLogsDirButton_Click(object sender, RoutedEventArgs e)
{
try

View file

@ -1,4 +1,4 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@ -9,20 +9,20 @@
//------------------------------------------------------------------------------
namespace ModAssistant.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -34,7 +34,7 @@ namespace ModAssistant.Properties {
this["InstallFolder"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -46,7 +46,7 @@ namespace ModAssistant.Properties {
this["StoreType"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@ -58,7 +58,7 @@ namespace ModAssistant.Properties {
this["SaveSelected"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
@ -70,7 +70,7 @@ namespace ModAssistant.Properties {
this["CheckInstalled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@ -82,7 +82,7 @@ namespace ModAssistant.Properties {
this["SavedMods"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@ -94,7 +94,7 @@ namespace ModAssistant.Properties {
this["Agreed"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
@ -106,7 +106,7 @@ namespace ModAssistant.Properties {
this["SelectInstalled"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -118,7 +118,7 @@ namespace ModAssistant.Properties {
this["GameVersion"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -130,7 +130,7 @@ namespace ModAssistant.Properties {
this["AllGameVersions"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
@ -142,7 +142,7 @@ namespace ModAssistant.Properties {
this["UpgradeRequired"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -154,7 +154,7 @@ namespace ModAssistant.Properties {
this["LastTab"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
@ -166,5 +166,17 @@ namespace ModAssistant.Properties {
this["SelectedTheme"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ReinstallInstalled {
get {
return ((bool)(this["ReinstallInstalled"]));
}
set {
this["ReinstallInstalled"] = value;
}
}
}
}

View file

@ -38,5 +38,8 @@
<Setting Name="SelectedTheme" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ReinstallInstalled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
</SettingsFile>

View file

@ -0,0 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Menu">
<Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextColor}" />
</Style>
</ResourceDictionary>

View file

@ -0,0 +1,66 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="MenuItem">
<Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource TextColor}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
BorderBrush="{DynamicResource ButtonOutline}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="4"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="Icon" Content="{TemplateBinding Icon}" ContentSource="Icon" HorizontalAlignment="Center" Height="16" Margin="3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
<Path x:Name="GlyphPanel" Data="F1M10,1.2L4.7,9.1 4.5,9.1 0,5.2 1.3,3.5 4.3,6.1 8.3,0 10,1.2z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Margin="3" Visibility="Collapsed" VerticalAlignment="Center"/>
<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Bottom">
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
<Grid RenderOptions.ClearTypeHint="Enabled">
<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="1">
<Rectangle x:Name="OpaqueRect" Fill="Black" Height="{Binding ActualHeight, ElementName=SubMenuBorder}" Width="{Binding ActualWidth, ElementName=SubMenuBorder}"/>
</Canvas>
<Rectangle Fill="#FFD7D7D7" HorizontalAlignment="Left" Margin="29,2,0,2" Width="1" />
<ItemsPresenter x:Name="ItemsPresenter" Margin="0,0,0,0" KeyboardNavigation.DirectionalNavigation="Cycle" Grid.IsSharedSizeScope="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle"/>
</Grid>
</ScrollViewer>
</Popup>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSuspendingPopupAnimation" Value="True">
<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" Value="{DynamicResource ButtonHighlightedBackground}" />
<Setter Property="Foreground" Value="{DynamicResource TextHighlighted}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="#FF707070"/>
<Setter Property="Fill" TargetName="GlyphPanel" Value="#FF707070"/>
</Trigger>
<Trigger Property="CanContentScroll" SourceName="SubMenuScrollViewer" Value="False">
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
<Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=SubMenuScrollViewer}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View file

@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--
ModAssistant BSMG theem by Megalon2D
ModAssistant BSMG theme by Megalon2D
https://twitter.com/megalon2D
-->