Skip to content

Commit

Permalink
v0.3.1 - reading config.ini from a previous installation, disable/ena…
Browse files Browse the repository at this point in the history
…ble add-ons without deleting
  • Loading branch information
fmmmlee committed Aug 25, 2019
1 parent 9cb1d95 commit da9baee
Show file tree
Hide file tree
Showing 92 changed files with 1,634 additions and 165 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# GW2-UOAOM [![Current Version](https://img.shields.io/badge/version-0.3.0-blue)](https://github.com/fmmmlee/GW2-Addon-Manager/releases)
# GW2-UOAOM [![Current Version](https://img.shields.io/badge/version-0.3.1-blue)](https://github.com/fmmmlee/GW2-Addon-Manager/releases)
##### Guild Wars 2 Unofficial Add-On Manager
A tool to install and update some Guild Wars 2 add-ons without having to manually visit each website, check version numbers, download and rename dlls, etc.

![GW2-UOAOM-v0 3 0-updated](https://user-images.githubusercontent.com/30479162/63564235-337a0600-c519-11e9-97aa-45dfb819b5e8.JPG)
![GW2-UOAOM-v0 3 1](https://user-images.githubusercontent.com/30479162/63646348-0e76c600-c6c6-11e9-8f77-6e6075342633.JPG)

## Getting Started
Make sure your system meets the **Requirements** and that you don't have any unsupported add-ons (I hope to eventually expand the list). Don't run the program while GW2 or the GW2 launcher is running, as the program needs to access files that are locked while the game is active.
Expand Down
2 changes: 1 addition & 1 deletion application/source/GW2 Addon Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@
<Compile Include="arcdps.cs" />
<Compile Include="configuration.cs" />
<Compile Include="d912pxy.cs" />
<Compile Include="GitReleaseInfo.cs" />
<Compile Include="gw2hook.cs" />
<Compile Include="gw2radial.cs" />
<Compile Include="OpeningViewModel.cs" />
<Compile Include="PluginManagement.cs" />
<Compile Include="Updates.cs" />
<Compile Include="UpdatingView.xaml.cs">
<DependentUpon>UpdatingView.xaml</DependentUpon>
Expand Down
32 changes: 32 additions & 0 deletions application/source/OpeningView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,38 @@
BorderBrush="#ff8787"
Style="{DynamicResource BigContentButtons}"
/>
<Button Command="{Binding Path=DisableSelected}"
Grid.Row="3"
Content="Disable"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="40,45,5,5"
Width="45"
Height="20"
Background="White"
Foreground="Black"
FontSize="12"
FontFamily="Microsoft YaHei UI Light"
BorderThickness="1"
BorderBrush="DimGray"
Style="{DynamicResource BigContentButtons}"
/>
<Button Command="{Binding Path=EnableSelected}"
Grid.Row="3"
Content="Re-Enable"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="84,45,5,5"
Width="60"
Height="20"
Background="White"
Foreground="Black"
FontSize="12"
FontFamily="Microsoft YaHei UI Light"
BorderThickness="1"
BorderBrush="DimGray"
Style="{DynamicResource BigContentButtons}"
/>
<Button Grid.Row="3" x:Name="nextPage" Height="45" Width="120" Content="UPDATE"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Expand Down
6 changes: 4 additions & 2 deletions application/source/OpeningView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using GW2_Addon_Manager;
using System;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
Expand All @@ -16,6 +15,7 @@ public partial class AddOnSelector : Page
/* page initialization */
public AddOnSelector()
{
configuration.SelfVersionStatus();
theViewModel = new OpeningViewModel();
DataContext = theViewModel;
InitializeComponent();
Expand Down Expand Up @@ -43,6 +43,8 @@ private void minimize_clicked(object sender, RoutedEventArgs e)





/***** UPDATE button *****/
private void update_button_clicked(object sender, RoutedEventArgs e)
{
Expand Down
41 changes: 18 additions & 23 deletions application/source/OpeningViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using GalaSoft.MvvmLight.Command;
using GW2_Addon_Manager;
using IWshRuntimeLibrary;
using System;
using System.ComponentModel;
Expand Down Expand Up @@ -93,7 +92,9 @@ public string d912pxy_Content
set { _d912pxy_content = value; propertyChanged("d912pxy_Content"); }
}

/* game path */
/// <summary>
/// The Guild Wars 2 Game Path, displayed in the text box on the opening page.
/// </summary>
public string GamePath { get; set; }


Expand All @@ -119,35 +120,29 @@ public ICommand SetDefaultAddons
}

/// <summary>
/// Handles the delete selected addons button.
/// <see cref="ds_logic"/>
/// Handles the disable selected addons button.
/// </summary>
public ICommand DeleteSelected
public ICommand DisableSelected
{
get { return new RelayCommand<object>(param => ds_logic(), true); }
get { return new RelayCommand<object>(param =>PluginManagement.DisableSelected(this), true); }
}

/// <summary>
/// Deletes the currently selected addons.
/// <see cref="DeleteSelected"/>
/// <see cref="arcdps.delete(string)"/>
/// <see cref="gw2radial.delete(string)"/>
/// <see cref="d912pxy.delete(string)"/>
/// Handles the enable selected addons button.
/// </summary>
private void ds_logic()
public ICommand EnableSelected
{
string deletemsg = "This will delete any add-ons that are selected and all data associated with them! Are you sure you wish to continue?";
if (MessageBox.Show(deletemsg, "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
string gamePath = configuration.getConfig().game_path;
if (ArcDPS_CheckBox)
arcdps.delete(gamePath);
if (GW2Radial_CheckBox)
gw2radial.delete(gamePath);
if (d912pxy_CheckBox)
d912pxy.delete(gamePath);
}
get { return new RelayCommand<object>(param => PluginManagement.EnableSelected(this), true); }
}

/// <summary>
/// Handles the delete selected addons button.
/// </summary>
public ICommand DeleteSelected
{
get { return new RelayCommand<object>(param => PluginManagement.DeleteSelected(this), true); }
}


/// <summary>
/// Handles the create shortcut button under the options menu. <see cref="cs_logic"/>
Expand Down
87 changes: 87 additions & 0 deletions application/source/PluginManagement.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace GW2_Addon_Manager
{
class PluginManagement
{
/// <summary>
/// Deletes the currently selected addons.
/// <seealso cref="OpeningViewModel.DeleteSelected"/>
/// <seealso cref="arcdps.delete(string)"/>
/// <seealso cref="gw2radial.delete(string)"/>
/// <seealso cref="d912pxy.delete(string)"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void DeleteSelected(OpeningViewModel viewModel)
{
string deletemsg = "This will delete any add-ons that are selected and all data associated with them! Are you sure you wish to continue?";
if (MessageBox.Show(deletemsg, "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
string gamePath = configuration.getConfig().game_path;
if (viewModel.ArcDPS_CheckBox)
arcdps.delete(gamePath);
if (viewModel.GW2Radial_CheckBox)
gw2radial.delete(gamePath);
if (viewModel.d912pxy_CheckBox)
d912pxy.delete(gamePath);
}
}

/// <summary>
/// Disables the currently selected addons.
/// <seealso cref="OpeningViewModel.DisableSelected"/>
/// <seealso cref="arcdps.disable(string)"/>
/// <seealso cref="gw2radial.disable(string)"/>
/// <seealso cref="d912pxy.disable(string)"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void DisableSelected(OpeningViewModel viewModel)
{
string disablemsg = "This will disable the selected add-ons until you choose to re-enable them. Do you wish to continue?";
if (MessageBox.Show(disablemsg, "Disable", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
{
string gamePath = configuration.getConfig().game_path;
if (viewModel.ArcDPS_CheckBox)
arcdps.disable(gamePath);
if (viewModel.GW2Radial_CheckBox)
gw2radial.disable(gamePath);
if (viewModel.d912pxy_CheckBox)
d912pxy.disable(gamePath);
}

configuration.DisplayAddonStatus(viewModel);
}

/// <summary>
/// Enables the currently selected addons.
/// <seealso cref="OpeningViewModel.EnableSelected"/>
/// <seealso cref="arcdps.enable(string)"/>
/// <seealso cref="gw2radial.enable(string)"/>
/// <seealso cref="d912pxy.enable(string)"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void EnableSelected(OpeningViewModel viewModel)
{
string enablemsg = "This will enable any of the selected add-ons that are disabled. Do you wish to continue?";
if (MessageBox.Show(enablemsg, "Enable", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
{
string gamePath = configuration.getConfig().game_path;
if (viewModel.ArcDPS_CheckBox)
arcdps.enable(gamePath);
if (viewModel.GW2Radial_CheckBox)
gw2radial.enable(gamePath);
if (viewModel.d912pxy_CheckBox)
d912pxy.enable(gamePath);

configuration.DisplayAddonStatus(viewModel);
}

configuration.DisplayAddonStatus(viewModel);
}
}
}
8 changes: 5 additions & 3 deletions application/source/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,27 @@ public void getPreferences()
/// </summary>
public async void Update()
{
dynamic config_obj = configuration.getConfig();

/* Will this lead to stack overflow w/ too many recursions? */
/* Note: I have this weird if-else-if-else w/ application properties due to the execution going to the end and setting
the label to completed and stuff while the async functions were still running before. I've made changes since then but
I'm not sure if they fix that issue. Not really a priority atm but may test it when I feel like diving down that rabbit
hole again */

if ((bool)Application.Current.Properties["ArcDPS"])
if ((bool)Application.Current.Properties["ArcDPS"] && !(bool)config_obj.disabled.arcdps)
{
arcdps arc = new arcdps(arc_name, arc_templates_name, view);
await arc.update();
Update();
}
else if ((bool)Application.Current.Properties["GW2Radial"])
else if ((bool)Application.Current.Properties["GW2Radial"] && !(bool)config_obj.disabled.gw2radial)
{
gw2radial radial = new gw2radial(gw2radial_name, view);
await radial.update();
Update();
}
else if ((bool)Application.Current.Properties["d912pxy"])
else if ((bool)Application.Current.Properties["d912pxy"] && !(bool)config_obj.disabled.d912pxy)
{
d912pxy d912 = new d912pxy(d912pxy_name, view);
await d912.update();
Expand Down
35 changes: 35 additions & 0 deletions application/source/arcdps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,33 @@ public arcdps(string arc_name, string arc_templates_name, UpdatingViewModel view
this.arc_templates_name = arc_templates_name;
}

/// <summary>
/// Disables ArcDPS by moving its plugin into the 'Disabled Plugins' application subfolder.
/// </summary>
/// <param name="game_path">The Guild Wars 2 game path.</param>
public static void disable(string game_path)
{
dynamic config_obj = configuration.getConfig();
if (config_obj.installed.arcdps != null)
File.Move(game_path + "\\bin64\\" + config_obj.installed.arcdps, "Disabled Plugins\\arcdps.dll");

config_obj.disabled.arcdps = true;
configuration.setConfig(config_obj);
}

/// <summary>
/// Enables ArcDPS by moving its plugin back into the game's /bin64/ folder.
/// </summary>
/// <param name="game_path">The Guild Wars 2 game path.</param>
public static void enable(string game_path)
{
dynamic config_obj = configuration.getConfig();
if ((bool)config_obj.disabled.arcdps && config_obj.installed.arcdps != null)
File.Move("Disabled Plugins\\arcdps.dll", game_path + "\\bin64\\" + config_obj.installed.arcdps);

config_obj.disabled.arcdps = false;
configuration.setConfig(config_obj);
}


/***************************** DELETING *****************************/
Expand All @@ -57,7 +84,15 @@ public static void delete(string game_path)

/* if a .dll is associated with the add-on, delete it */
if (config_obj.installed.arcdps != null)
{
File.Delete(game_path + "\\bin64\\" + config_obj.installed.arcdps);
File.Delete(game_path + "\\bin64\\" + config_obj.arcdps_buildTemplates);
}


/* if the .dll is in the 'Disabled Plugins' folder, delete it */
if (File.Exists("Disabled Plugins\\arcdps.dll"))
File.Delete("Disabled Plugins\\arcdps.dll");

config_obj.version.arcdps = null; //no installed version
config_obj.installed.arcdps = null; //no installed .dll name
Expand Down
Loading

0 comments on commit da9baee

Please sign in to comment.