Skip to content

Commit

Permalink
v0.4.2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmmlee committed Sep 1, 2019
1 parent a500e58 commit f076684
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 21 deletions.
1 change: 1 addition & 0 deletions application/GW2 Addon Manager/GW2 Addon Manager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
</ApplicationDefinition>
<Compile Include="arcdps.cs" />
<Compile Include="arcdps_bhud.cs" />
<Compile Include="arcdps_mechanics.cs" />
<Compile Include="configuration.cs" />
<Compile Include="d912pxy.cs" />
<Compile Include="gw2radial.cs" />
Expand Down
22 changes: 11 additions & 11 deletions application/GW2 Addon Manager/OpeningView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<Label Grid.Row = "1" FontWeight="Bold" FontSize="60" Foreground="DimGray" Margin="30,0,0,0" FontFamily="Microsoft JhengHei UI Light" Width="Auto" HorizontalAlignment="Left" Content="GW2-UOAOM"/>
<TextBlock Grid.Row="1" Margin="40,75,0,0" FontSize ="16" Foreground="DimGray" FontFamily="Microsoft YaHei UI Light"><Run Text="Guild Wars 2 - Unofficial Add-On Manager"/></TextBlock>
<TextBlock Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="300,0,0,37" FontFamily="Microsoft YaHei UI Light" FontSize="14"><Run Text="Game Path"/></TextBlock>
<TextBlock Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="325,0,0,37" FontFamily="Microsoft YaHei UI Light" FontSize="14"><Run Text="Game Path"/></TextBlock>

<ComboBox x:Name="settings_list"
Grid.Row="1"
Expand Down Expand Up @@ -130,7 +130,7 @@
</TextBlock>
<Button Command="{Binding Path=SetGamePath}"
Grid.Row="2"
Margin="705,0,0,9"
Margin="730,0,0,9"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Content="SET"
Expand All @@ -147,7 +147,7 @@
/>
<TextBox Text="{Binding GamePath}"
Grid.Row="2"
Margin="300,0,0,10"
Margin="325,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Width="400"
Expand All @@ -157,16 +157,16 @@
FontSize="16"
FontFamily="Microsoft JhengHei Light"
/>
<Border Grid.Row="2" Width="200" Height="300" HorizontalAlignment="Left" Margin="40,20,0,0" BorderThickness="1" BorderBrush="DimGray" Background="WhiteSmoke">
<StackPanel Width="200" Height="275" HorizontalAlignment="Left">
<Border Grid.Row="2" Width="250" Height="300" HorizontalAlignment="Left" Margin="40,20,0,0" BorderThickness="1" BorderBrush="DimGray" Background="WhiteSmoke">
<StackPanel Width="250" Height="275" HorizontalAlignment="Left">

<Label FontSize="18" FontFamily="Microsoft YaHei UI" Margin="0,5,0,10" HorizontalAlignment="Center" Foreground="DimGray" Content="Add-Ons"/>
<TextBlock Width="195" Height="50" Margin="5,0,0,0" FontFamily="Microsoft YaHei UI Light"><Run Text="Select all currently installed add-"/><LineBreak/><Run Text="ons for Guild Wars 2 as well as any"/><LineBreak/><Run Text="you wish to install."/></TextBlock>
<CheckBox IsChecked="{Binding ArcDPS_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding ArcDPS_Content}"/>
<CheckBox IsChecked="{Binding GW2Radial_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding GW2Radial_Content}"/>
<CheckBox IsChecked="{Binding d912pxy_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding d912pxy_Content}"/>
<CheckBox IsChecked="{Binding arcdps_bhud_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding arcdps_bhud_Content}"/>

<TextBlock Width="225" Height="50" Margin="5,0,0,0" FontFamily="Microsoft YaHei UI Light"><Run Text="Select all currently installed add-ons for"/><LineBreak/><Run Text="Guild Wars 2 as well as any you want"/><LineBreak/><Run Text="to install."/></TextBlock>
<CheckBox IsChecked="{Binding ArcDPS_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding ArcDPS_Content}" ToolTip="Offers a DPS meter and build template functionality - by DeltaConnected"/>
<CheckBox IsChecked="{Binding GW2Radial_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding GW2Radial_Content}" ToolTip="Provides a menu with access to all your mounts with a single keypress - by Friendly0Fire"/>
<CheckBox IsChecked="{Binding d912pxy_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding d912pxy_Content}" ToolTip="Translates DirectX 9 calls to DirectX 12 for performance improvements - by Megai2"/>
<CheckBox IsChecked="{Binding arcdps_bhud_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding arcdps_bhud_Content}" ToolTip="Uses the ArcDPS Combat API to provide data to Blish HUD - by Greaka"/>
<CheckBox IsChecked="{Binding arcdps_mechanics_CheckBox}" Margin="5,5,5,5" FontSize="12" Foreground="Black" FontFamily="Microsoft YaHei UI Light" Content="{Binding arcdps_mechanics_Content}" ToolTip="Provides information about raid mechanics using the ArcDPS Combat API - by Martion"/>
<!--<CheckBox Name="gw2hook" Checked="Box_Checked" Margin="5,5,5,5" FontSize="14">Gw2 Hook</CheckBox>-->
</StackPanel>
</Border>
Expand Down
5 changes: 5 additions & 0 deletions application/GW2 Addon Manager/OpeningView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ private void update_button_clicked(object sender, RoutedEventArgs e)
else
Application.Current.Properties["arcdps_bhud"] = false;

if (theViewModel.arcdps_mechanics_CheckBox)
Application.Current.Properties["arcdps_mechanics"] = true;
else
Application.Current.Properties["arcdps_mechanics"] = false;

this.NavigationService.Navigate(new Uri("UpdatingView.xaml", UriKind.Relative));
}

Expand Down
20 changes: 20 additions & 0 deletions application/GW2 Addon Manager/OpeningViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ public string ArcDPS_Content
set { _arc_content = value; propertyChanged("ArcDPS_Content"); }
}

/* ArcDPS Mechanics Plugin */
private bool _arcdps_mechanics_box;
private string _arcdps_mechanics_content;
/// <summary>
/// The data binding for the ArcDPS checkbox's IsChecked property.
/// </summary>
public bool arcdps_mechanics_CheckBox
{
get { return _arcdps_mechanics_box; }
set { _arcdps_mechanics_box = value; propertyChanged("arcdps_mechanics_CheckBox"); }
}

/// <summary>
/// The data binding for the ArcDPS checkbox's Content property.
/// </summary>
public string arcdps_mechanics_Content
{
get { return _arcdps_mechanics_content; }
set { _arcdps_mechanics_content = value; propertyChanged("arcdps_mechanics_Content"); }
}

/* GW2 Radial */
private bool _radial_box;
Expand Down
12 changes: 12 additions & 0 deletions application/GW2 Addon Manager/PluginManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class PluginManagement
/// <seealso cref="arcdps.delete()"/>
/// <seealso cref="gw2radial.delete()"/>
/// <seealso cref="d912pxy.delete()"/>
/// <seealso cref="arcdps_bhud.delete()"/>
/// <seealso cref="arcdps_mechanics.delete()"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void DeleteSelected(OpeningViewModel viewModel)
Expand All @@ -27,6 +29,8 @@ public static void DeleteSelected(OpeningViewModel viewModel)
d912pxy.delete();
if (viewModel.arcdps_bhud_CheckBox)
arcdps_bhud.delete();
if (viewModel.arcdps_mechanics_CheckBox)
arcdps_mechanics.delete();

RenamePlugins();
}
Expand Down Expand Up @@ -106,6 +110,8 @@ public static void RenamePlugins()
/// <seealso cref="arcdps.disable()"/>
/// <seealso cref="gw2radial.disable()"/>
/// <seealso cref="d912pxy.disable()"/>
/// <seealso cref="arcdps_bhud.disable()"/>
/// <seealso cref="arcdps_mechanics.disable()"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void DisableSelected(OpeningViewModel viewModel)
Expand All @@ -122,6 +128,8 @@ public static void DisableSelected(OpeningViewModel viewModel)
d912pxy.disable();
if (viewModel.arcdps_bhud_CheckBox)
arcdps_bhud.disable();
if (viewModel.arcdps_mechanics_CheckBox)
arcdps_mechanics.disable();

RenamePlugins();
}
Expand All @@ -135,6 +143,8 @@ public static void DisableSelected(OpeningViewModel viewModel)
/// <seealso cref="arcdps.enable()"/>
/// <seealso cref="gw2radial.enable()"/>
/// <seealso cref="d912pxy.enable()"/>
/// <seealso cref="arcdps_bhud.enable()"/>
/// <seealso cref="arcdps_mechanics.enable()"/>
/// </summary>
/// <param name="viewModel">The DataContext for the application UI.</param>
public static void EnableSelected(OpeningViewModel viewModel)
Expand All @@ -151,6 +161,8 @@ public static void EnableSelected(OpeningViewModel viewModel)
d912pxy.enable();
if (viewModel.arcdps_bhud_CheckBox)
arcdps_bhud.enable();
if (viewModel.arcdps_mechanics_CheckBox)
arcdps_mechanics.enable();

RenamePlugins();
configuration.DisplayAddonStatus(viewModel);
Expand Down
6 changes: 6 additions & 0 deletions application/GW2 Addon Manager/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ hole again */
await bhud.update();
Update();
}
else if ((bool)Application.Current.Properties["arcdps_mechanics"] && !(bool)config_obj.disabled.arcdps_mechanics)
{
arcdps_mechanics mechanics = new arcdps_mechanics(view);
await mechanics.update();
Update();
}
else
{
view.label = "Complete";
Expand Down
11 changes: 6 additions & 5 deletions application/GW2 Addon Manager/arcdps_bhud.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.VisualBasic.FileIO;
using System.ComponentModel;
using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Net;
Expand Down Expand Up @@ -32,7 +31,7 @@ public arcdps_bhud(UpdatingViewModel view)
/* emptying progress bar */
currentView.showProgress = 0;

currentView.label = "Checking for Arcdps bhud updates";
currentView.label = "Checking for updates to ArcDPS for BlishHUD";
arcdps_bhud_zip_path = Path.Combine(Path.GetTempPath(), "arcdps_bhud.zip");
arcdps_bhud_expanded_path = Path.Combine(Path.GetTempPath(), "arcdps_bhud");
}
Expand Down Expand Up @@ -81,7 +80,9 @@ public static void delete()
string bin64 = game_path + "\\" + config_obj.bin_folder + "\\";

/* if a .dll is associated with the add-on, delete it */
if (config_obj.installed.arcdps_bhud != null)
if ((bool)config_obj.disabled.arcdps_bhud)
File.Delete("Disabled Plugins\\" + dll_name);
else if (config_obj.installed.arcdps_bhud != null)
File.Delete(bin64 + config_obj.installed.arcdps_bhud);

config_obj.version.arcdps_bhud = null; //no installed version
Expand All @@ -107,7 +108,7 @@ public async Task update()
dynamic config_obj = configuration.getConfig();
if (config_obj.version.arcdps_bhud == null || config_obj.version.arcdps_bhud != latestRelease)
{
currentView.label = "Downloading Arcdps bhud " + latestRelease;
currentView.label = "Downloading ArcDPS for BlishHUD " + latestRelease;
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(arcdps_bhud_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(arcdps_bhud_DownloadCompleted);
await client.DownloadFileTaskAsync(new System.Uri(downloadUrl), arcdps_bhud_zip_path);
Expand Down
129 changes: 129 additions & 0 deletions application/GW2 Addon Manager/arcdps_mechanics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Threading.Tasks;
using System.Windows;

namespace GW2_Addon_Manager
{
class arcdps_mechanics
{
UpdatingViewModel currentView;
static string dll_name = "d3d9_arcdps_mechanics.dll";
string game_path;
string bin64;
string downloadLocation = "http://martionlabs.com/wp-content/uploads/d3d9_arcdps_mechanics.dll";
string md5sumLocation = "http://martionlabs.com/wp-content/uploads/d3d9_arcdps_mechanics.dll.md5sum";

/// <summary>
/// The constructor sets several values to be used and also updates the UI to indicate that arcdps_mechanics is the current task.
/// </summary>
/// <param name="view">An instance of the <typeparamref>UpdatingViewModel</typeparamref> class serving as the DataContext for the application UI.</param>
public arcdps_mechanics(UpdatingViewModel view)
{
game_path = (string)Application.Current.Properties["game_path"];
bin64 = game_path + "\\" + configuration.getConfig().bin_folder + "\\";
currentView = view;

/* emptying progress bar */
currentView.showProgress = 0;

currentView.label = "Checking for updates to the ArcDPS Mechanics plugin";
}

/// <summary>
/// Disables arcdps mechanics by moving its plugin into the 'Disabled Plugins' application subfolder.
/// </summary>
public static void disable()
{
dynamic config_obj = configuration.getConfig();
string game_path = config_obj.game_path;
string bin64 = game_path + "\\" + config_obj.bin_folder + "\\";
if (config_obj.installed.arcdps_mechanics != null)
File.Move(bin64 + config_obj.installed.arcdps_mechanics, "Disabled Plugins\\" + dll_name);

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

/// <summary>
/// Enables arcdps mechanics by moving its plugin back into the game's /bin64/ or /bin/ folder.
/// </summary>
public static void enable()
{
dynamic config_obj = configuration.getConfig();
string game_path = config_obj.game_path;
string bin64 = game_path + "\\" + config_obj.bin_folder + "\\";

if ((bool)config_obj.disabled.arcdps_mechanics && config_obj.installed.arcdps_mechanics != null)
{
File.Move("Disabled Plugins\\" + dll_name, bin64 + dll_name);
}

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

/***************************** DELETING *****************************/
/// <summary>
/// Deletes the arcdps_mechanics plugin as well as the /arcdps_mechanics/ game subfolder.
/// </summary>
public static void delete()
{
dynamic config_obj = configuration.getConfig();
string game_path = config_obj.game_path;
string bin64 = game_path + "\\" + config_obj.bin_folder + "\\";

/* if a .dll is associated with the add-on, delete it */
if((bool)config_obj.disabled.arcdps_mechanics)
File.Delete("Disabled Plugins\\" + dll_name);
else if (config_obj.installed.arcdps_mechanics != null)
File.Delete(bin64 + config_obj.installed.arcdps_mechanics);



config_obj.version.arcdps_mechanics = null; //no installed version
config_obj.installed.arcdps_mechanics = null; //no installed .dll name
configuration.setConfig(config_obj); //writing to config.ini
}


/***************************** UPDATING *****************************/
/// <summary>
/// Asynchronously checks for and installs updates for the ArcDPS Mechanics plugin.
/// </summary>
/// <returns>A <c>Task</c> that can be awaited.</returns>
public async Task update()
{
var client = new WebClient();
string md5 = client.DownloadString(md5sumLocation);

dynamic config_obj = configuration.getConfig();
if (config_obj.version.arcdps_mechanics == null || config_obj.version.arcdps_mechanics != md5)
{
currentView.label = "Downloading ArcDPS Mechanics plugin";
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(arcdps_mechanics_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(arcdps_mechanics_DownloadCompleted);
await client.DownloadFileTaskAsync(new System.Uri(downloadLocation), bin64 + dll_name);

config_obj.installed.arcdps_mechanics = dll_name;
config_obj.version.arcdps_mechanics = md5;
configuration.setConfig(config_obj);
}
else
{
Application.Current.Properties["arcdps_mechanics"] = false;
}
}
void arcdps_mechanics_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
currentView.showProgress = e.ProgressPercentage;
}

void arcdps_mechanics_DownloadCompleted(object sender, AsyncCompletedEventArgs e)
{
Application.Current.Properties["arcdps_mechanics"] = false;
}
}
}
Loading

0 comments on commit f076684

Please sign in to comment.