Skip to content

Commit

Permalink
added force redownload button and links to wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmmlee committed Aug 11, 2020
1 parent 63bc490 commit 89c5c36
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

namespace GW2_Addon_Manager
{
class PluginManagement
{
/// <summary>
/// Sets version fields of all installed and enabled addons to a dummy value so they are redownloaded, then starts update process.
/// Intended for use if a user borks their install (probably by manually deleting something in the /addons/ folder).
/// </summary>
public static bool ForceRedownload()
{
string redownloadmsg = "This will forcibly redownload all installed addons regardless of their version. Do you wish to continue?";
if (MessageBox.Show(redownloadmsg, "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
UserConfig config = Configuration.getConfigAsYAML();
config.version = config.version.ToDictionary(entry => entry.Key, entry => "dummy value");
Configuration.setConfigAsYAML(config);
return true;
}
return false;
}

/// <summary>
/// Deletes all addons and resets config to default state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
application_version: v1.1.1
application_version: v1.2.2
loader_version:
bin_folder:
isupdate: true
Expand Down
43 changes: 38 additions & 5 deletions application/GW2 Addon Manager/UI/OpeningPage/OpeningView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,33 @@
<TextBlock Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="320,0,0,37" FontFamily="Microsoft YaHei UI Light" FontSize="14">
<Run Text="Game Path"/>
</TextBlock>

<!--
horizontal stackpanel
link
link
link
-->
<TextBlock
Margin="110, 0, 0, -10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Background="Transparent"
Foreground="DimGray"
>
<Hyperlink NavigateUri="https://github.com/fmmmlee/GW2-Addon-Manager/wiki" RequestNavigate="Hyperlink_RequestNavigate" TextDecorations="None" FocusVisualStyle="{x:Null}">
<TextBlock Text="WIKI " FontFamily="Microsoft YaHei UI"/>
</Hyperlink>
|
<Hyperlink
NavigateUri="https://github.com/fmmmlee/GW2-Addon-Manager/wiki/Other-Useful-Programs"
RequestNavigate="Hyperlink_RequestNavigate"
TextDecorations="None"
FocusVisualStyle="{x:Null}"
ToolTip="Programs for GW2 not managed by GW2-UOAOM, such as TacO"
>
<TextBlock Text=" Companion Applications" FontFamily="Microsoft YaHei UI"/>
</Hyperlink>
</TextBlock>
<Menu x:Name="settings_list"
Grid.Row="1"
Margin="40,-13,0,0"
Expand All @@ -64,11 +90,18 @@
Template="{StaticResource AddonMenuItemControlTemplate}"
Style="{StaticResource AddonMenuItemStyle}"
/>
<MenuItem
Click="RedownloadAddons"
Header="Force Redownload"
ToolTip="Redownloads the addon loader and all addons regardless of version."
Template="{StaticResource AddonMenuItemControlTemplate}"
Style="{StaticResource AddonMenuItemStyle}"
/>
</MenuItem>
</Menu>
<TextBlock Text="{Binding UpdateAvailable}"
Grid.Row="1"
Margin="120,-6,0,0"
Margin="320,-6,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontFamily="Microsoft YaHei UI Light"
Expand All @@ -80,7 +113,7 @@
/>
<TextBlock Text="{Binding UpdateAvailable}"
Grid.Row="1"
Margin="120,-6,0,0"
Margin="320,-6,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontFamily="Microsoft YaHei UI Light"
Expand All @@ -92,7 +125,7 @@
/>
<ProgressBar
Grid.Row = "1"
Margin="235,-6,0,0"
Margin="435,-6,0,0"
Width="125"
Height="12"
HorizontalAlignment="Left"
Expand All @@ -103,7 +136,7 @@
/>
<Button
Grid.Row = "1"
Margin="215,-10,0,0"
Margin="415,-10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="50"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ private void minimize_clicked(object sender, RoutedEventArgs e)
/***************************** *** *****************************/



//just calls PluginManagement.ForceRedownload(); and then update_button_clicked
private void RedownloadAddons(object sender, RoutedEventArgs e)
{
if(PluginManagement.ForceRedownload())
update_button_clicked(sender, e);
}


/***** UPDATE button *****/
Expand All @@ -93,6 +98,7 @@ private void update_button_clicked(object sender, RoutedEventArgs e)

List<AddonInfoFromYaml> selectedAddons = new List<AddonInfoFromYaml>();

//the d3d9 wrapper is installed by default and hidden from the list displayed to the user, so it has to be added to this list manually
AddonInfoFromYaml wrapper = AddonYamlReader.getAddonInInfo("d3d9_wrapper");
wrapper.folder_name = "d3d9_wrapper";
selectedAddons.Add(wrapper);
Expand Down

0 comments on commit 89c5c36

Please sign in to comment.