Merge pull request #187 from erri120/nitpicking-1

Nitpicking stuff #1
This commit is contained in:
Timothy Baldridge 2019-11-18 11:30:47 -07:00 committed by GitHub
commit 7773d033ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 9 deletions

View File

@ -23,8 +23,8 @@ namespace Wabbajack.Common
throw new ArgumentException("T must be an Enum");
}
DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
return attributes.Length > 0 ? attributes[0].Description : string.Empty;
var attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
return attributes.Length > 0 ? attributes[0].Description : val.ToString();
}
}
}

View File

@ -6,6 +6,7 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using CommonMark.Syntax;
using Newtonsoft.Json;
using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
@ -31,6 +32,8 @@ namespace Wabbajack.Lib.ModListRegistry
[JsonProperty("game")]
public Game Game { get; set; }
[JsonIgnore] public string GameName => this.Game.ToDescriptionString();
[JsonProperty("official")]
public bool Official { get; set; }
@ -75,8 +78,8 @@ namespace Wabbajack.Lib.ModListRegistry
public static List<ModlistMetadata> LoadFromGithub()
{
var client = new HttpClient();
Utils.Log("Loading Modlists from Github");
var result = client.GetStringSync(Consts.ModlistMetadataURL);
Utils.Log("Loading ModLists from Github");
var result = client.GetStringSync(Consts.ModlistMetadataURL);
return result.FromJSONString<List<ModlistMetadata>>();
}

View File

@ -16,10 +16,6 @@ namespace Wabbajack
{
this.Game = game;
this.DisplayName = game.ToDescriptionString();
if (string.IsNullOrWhiteSpace(this.DisplayName))
{
this.DisplayName = game.ToString();
}
}
}
}

View File

@ -97,7 +97,7 @@
Grid.Row="1"
Grid.Column="4"
HorizontalAlignment="Right"
Text="{Binding Game}"
Text="{Binding GameName}"
TextAlignment="Right" />
<TextBlock
Grid.Row="2"