Improve notifications on automation set parsing.

This commit is contained in:
Ottermandias 2023-10-08 13:32:03 +02:00
parent 7c4ed0e891
commit e42a17ebd8

View file

@ -436,18 +436,18 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
if (designObj is not JObject j) if (designObj is not JObject j)
{ {
Glamourer.Messager.NotificationMessage( Glamourer.Messager.NotificationMessage(
$"Skipped loading design in Automation Set for {id.Incognito(null)}: Unknown design."); $"Skipped loading design in Automation Set {name}: Unknown design.", NotificationType.Warning);
continue; continue;
} }
var design = ToDesignObject(j); var design = ToDesignObject(set.Name, j);
if (design != null) if (design != null)
set.Designs.Add(design); set.Designs.Add(design);
} }
} }
} }
private AutoDesign? ToDesignObject(JObject jObj) private AutoDesign? ToDesignObject(string setName, JObject jObj)
{ {
var designIdentifier = jObj["Design"]?.ToObject<string?>(); var designIdentifier = jObj["Design"]?.ToObject<string?>();
Design? design = null; Design? design = null;
@ -456,13 +456,13 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
if (designIdentifier.Length == 0) if (designIdentifier.Length == 0)
{ {
Glamourer.Messager.NotificationMessage("Error parsing automatically applied design: No design specified."); Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design for set {setName}: No design specified.", NotificationType.Warning);
return null; return null;
} }
if (!Guid.TryParse(designIdentifier, out var guid)) if (!Guid.TryParse(designIdentifier, out var guid))
{ {
Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design: {designIdentifier} is not a valid GUID."); Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design for set {setName}: {designIdentifier} is not a valid GUID.", NotificationType.Warning);
return null; return null;
} }
@ -471,7 +471,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
if (design == null) if (design == null)
{ {
Glamourer.Messager.NotificationMessage( Glamourer.Messager.NotificationMessage(
$"Error parsing automatically applied design: The specified design {guid} does not exist."); $"Error parsing automatically applied design for set {setName}: The specified design {guid} does not exist.", NotificationType.Warning);
return null; return null;
} }
} }
@ -493,7 +493,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList<AutoDesignSet>, IDispos
{ {
if (!_jobs.JobGroups.TryGetValue((ushort)jobs, out var jobGroup)) if (!_jobs.JobGroups.TryGetValue((ushort)jobs, out var jobGroup))
{ {
Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design: The job condition {jobs} does not exist."); Glamourer.Messager.NotificationMessage($"Error parsing automatically applied design for set {setName}: The job condition {jobs} does not exist.", NotificationType.Warning);
return null; return null;
} }