mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Changed ToDescriptionString to return toString if no description is present
This commit is contained in:
parent
2fde106b92
commit
bb2661f968
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
[JsonProperty("game")]
|
||||
public Game Game { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string GameName { get; set; }
|
||||
[JsonIgnore] public string GameName => this.Game.ToDescriptionString();
|
||||
|
||||
[JsonProperty("official")]
|
||||
public bool Official { get; set; }
|
||||
@ -80,15 +79,8 @@ namespace Wabbajack.Lib.ModListRegistry
|
||||
{
|
||||
var client = new HttpClient();
|
||||
Utils.Log("Loading ModLists from Github");
|
||||
var result = client.GetStringSync(Consts.ModlistMetadataURL);
|
||||
var list = result.FromJSONString<List<ModlistMetadata>>();
|
||||
list.Do(m =>
|
||||
{
|
||||
m.GameName = m.Game.ToDescriptionString();
|
||||
if (string.IsNullOrWhiteSpace(m.GameName))
|
||||
m.GameName = m.Game.ToString();
|
||||
});
|
||||
return list;
|
||||
var result = client.GetStringSync(Consts.ModlistMetadataURL);
|
||||
return result.FromJSONString<List<ModlistMetadata>>();
|
||||
}
|
||||
|
||||
public bool NeedsDownload(string modlistPath)
|
||||
|
@ -16,10 +16,6 @@ namespace Wabbajack
|
||||
{
|
||||
this.Game = game;
|
||||
this.DisplayName = game.ToDescriptionString();
|
||||
if (string.IsNullOrWhiteSpace(this.DisplayName))
|
||||
{
|
||||
this.DisplayName = game.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user