Fixes for broken bethesda tests.

This commit is contained in:
Timothy Baldridge 2020-04-10 15:52:31 -06:00
parent 712438c6a6
commit 0830480821
5 changed files with 14 additions and 179 deletions

View File

@ -238,7 +238,7 @@ namespace Wabbajack.Common
public class JsonNameSerializationBinder : ISerializationBinder
public class JsonNameSerializationBinder : DefaultSerializationBinder
{
private static Dictionary<string, Type> _nameToType = new Dictionary<string, Type>();
private static Dictionary<Type, string> _typeToName = new Dictionary<Type, string>();
@ -280,7 +280,7 @@ namespace Wabbajack.Common
}
public Type BindToType(string? assemblyName, string typeName)
public override Type BindToType(string? assemblyName, string typeName)
{
if (typeName.EndsWith("[]"))
{
@ -295,22 +295,17 @@ namespace Wabbajack.Common
if (val != null)
return val;
if (assemblyName != null)
{
var assembly = AppDomain.CurrentDomain.Load(assemblyName);
if (assembly != null)
{
var result = assembly.GetType(typeName);
if (result != null) return result;
}
}
throw new InvalidDataException($"No Binding name for {typeName}");
return base.BindToType(assemblyName, typeName);
}
public void BindToName(Type serializedType, out string? assemblyName, out string? typeName)
public override void BindToName(Type serializedType, out string? assemblyName, out string? typeName)
{
if (serializedType.FullName?.StartsWith("System.") ?? false)
{
base.BindToName(serializedType, out assemblyName, out typeName);
return;
}
if (!_typeToName.ContainsKey(serializedType))
{
throw new InvalidDataException($"No Binding name for {serializedType}");

View File

@ -998,7 +998,7 @@ namespace Wabbajack.Common
var encoded = ProtectedData.Protect(bytes, Encoding.UTF8.GetBytes(key), DataProtectionScope.LocalMachine);
Consts.LocalAppDataPath.CreateDirectory();
Consts.LocalAppDataPath.Combine(key).WriteAllBytes(bytes);
Consts.LocalAppDataPath.Combine(key).WriteAllBytes(encoded);
}
public static byte[] FromEncryptedData(string key)
{

View File

@ -96,8 +96,9 @@ namespace Wabbajack.Lib.Downloaders
result.ToEcryptedJson(DataName);
return result;
}
catch (Exception)
catch (Exception ex)
{
Utils.Error(ex, "Could not save Bethesda.NET login info");
return null;
}
}
@ -363,6 +364,7 @@ namespace Wabbajack.Lib.Downloaders
}
[JsonName("BethesdaNetData")]
public class BethesdaNetData
{
public string body { get; set; }

View File

@ -1,147 +0,0 @@
<UserControl
x:Class="Wabbajack.VortexCompilerConfigView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wabbajack"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Game"
TextAlignment="Center"
ToolTip="The game you wish to target" />
<ComboBox
Grid.Row="0"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
FontSize="14"
ItemsSource="{Binding GameOptions}"
SelectedValue="{Binding SelectedGame}"
ToolTip="The game you wish to target">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Margin="6,2" Text="{Binding DisplayName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Game Folder"
TextAlignment="Center"
ToolTip="The install folder for the game" />
<local:FilePicker
Grid.Row="1"
Grid.Column="2"
Height="30"
VerticalAlignment="Center"
PickerVM="{Binding GameLocation}"
FontSize="14"
ToolTip="The install folder for the game" />
<Grid
Grid.Row="2"
Grid.Column="2"
Height="28"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Margin="0,0,5,0"
Background="Transparent"
Command="{Binding FindGameInSteamCommand}"
Style="{StaticResource CircleButtonStyle}"
ToolTip="Attempt to locate the game in Steam">
<Image Margin="1" Source="../../Resources/Icons/steam.png" />
</Button>
<Button
Grid.Column="1"
Background="Transparent"
Command="{Binding FindGameInGogCommand}"
Style="{StaticResource CircleButtonStyle}"
ToolTip="Attempt to locate game in GoG">
<Image Margin="1" Source="../../Resources/Icons/gog.png" />
</Button>
</Grid>
<TextBlock
Grid.Row="0"
Grid.Column="4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Download Location"
TextAlignment="Center"
ToolTip="The folder to download your mods" />
<local:FilePicker
Grid.Row="0"
Grid.Column="6"
Height="30"
VerticalAlignment="Center"
PickerVM="{Binding DownloadsLocation}"
FontSize="14"
ToolTip="The folder to download your mods" />
<TextBlock
Grid.Row="1"
Grid.Column="4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Staging Location"
TextAlignment="Center" />
<local:FilePicker
Grid.Row="1"
Grid.Column="6"
Height="30"
VerticalAlignment="Center"
PickerVM="{Binding StagingLocation}"
FontSize="14" />
<TextBlock
Grid.Row="2"
Grid.Column="4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"
Text="Output Location"
TextAlignment="Center"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
<local:FilePicker
Grid.Row="2"
Grid.Column="6"
Height="30"
VerticalAlignment="Center"
PickerVM="{Binding Parent.OutputLocation}"
FontSize="14"
ToolTip="The folder to place the resulting modlist.wabbajack file" />
</Grid>
</UserControl>

View File

@ -1,15 +0,0 @@
using System.Windows.Controls;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for VortexCompilerConfigView.xaml
/// </summary>
public partial class VortexCompilerConfigView : UserControl
{
public VortexCompilerConfigView()
{
InitializeComponent();
}
}
}