From 4b0a2d90b95a33721fc0a5485af020b944e663be Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 20 Jul 2018 20:22:46 -0700 Subject: [PATCH] Add xmldoc --- PKHeX.Core/Legality/Analysis.cs | 62 +++++++++++++++++-- PKHeX.Core/Legality/Enums/Severity.cs | 16 ++++- PKHeX.Core/Legality/Enums/TradebackType.cs | 15 +++++ PKHeX.Core/Legality/Learnset/Learnset.cs | 14 +++++ PKHeX.Core/Legality/Learnset/Learnset1.cs | 3 + PKHeX.Core/Legality/Learnset/Learnset6.cs | 3 + PKHeX.Core/Legality/Ribbons/RibbonResult.cs | 6 ++ PKHeX.Core/Legality/Ribbons/RibbonStrings.cs | 3 + PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs | 5 +- 9 files changed, 121 insertions(+), 6 deletions(-) diff --git a/PKHeX.Core/Legality/Analysis.cs b/PKHeX.Core/Legality/Analysis.cs index ff7754f07..0731f2fc9 100644 --- a/PKHeX.Core/Legality/Analysis.cs +++ b/PKHeX.Core/Legality/Analysis.cs @@ -13,18 +13,49 @@ namespace PKHeX.Core public partial class LegalityAnalysis { internal readonly PKM pkm; + internal readonly PersonalInfo PersonalInfo; private readonly bool Error; private readonly List Parse = new List(); private IEncounterable EncounterOriginalGB; + + /// + /// Matched encounter data for the . + /// public IEncounterable EncounterMatch => Info.EncounterMatch; + + /// + /// Original encounter data for the . + /// + /// + /// Generation 1/2 that are transferred forward to Generation 7 are restricted to new encounter details. + /// By retaining their original match, more information can be provided by the parse. + /// public IEncounterable EncounterOriginal => EncounterOriginalGB ?? EncounterMatch; + /// + /// Indicates if all checks ran to completion. + /// + /// This value is false if any checks encountered an error. public readonly bool Parsed; + + /// + /// Indicates if all checks returned a result. + /// public readonly bool Valid; - public readonly PersonalInfo PersonalInfo; + + /// + /// Contains various data reused for multiple checks. + /// public LegalInfo Info { get; private set; } + + /// + /// Creates a report message with optional verbosity for in-depth analysis. + /// + /// Include all details in the parse, including valid check messages. + /// Single line string public string Report(bool verbose = false) => verbose ? GetVerboseLegalityReport() : GetLegalityReport(); + private IEnumerable AllSuggestedMoves { get @@ -177,8 +208,18 @@ private void ParsePK7() UpdateChecks(); } - public void AddLine(Severity s, string c, CheckIdentifier i) => AddLine(new CheckResult(s, c, i)); - public void AddLine(CheckResult chk) => Parse.Add(chk); + /// + /// Adds a new Check parse value. + /// + /// Check severity + /// Check comment + /// Check type + internal void AddLine(Severity s, string c, CheckIdentifier i) => AddLine(new CheckResult(s, c, i)); + + /// + /// Adds a new Check parse value. + /// + internal void AddLine(CheckResult chk) => Parse.Add(chk); private void UpdateVCTransferInfo() { @@ -337,7 +378,9 @@ private string GetVerboseLegalityReport() return GetLegalityReport() + string.Join(Environment.NewLine, lines); } - // Suggestions + /// + /// Gets the current array of four moves that might be legal. + /// public int[] GetSuggestedRelearn() { if (Info?.RelearnBase == null || Info.Generation < 6) @@ -355,6 +398,13 @@ public int[] GetSuggestedRelearn() window.CopyTo(start, moves, 0, count); return moves; } + + /// + /// Gets four moves which can be learned depending on the input arguments. + /// + /// Allow TM moves + /// Allow Tutor moves + /// Allow Move Reminder public int[] GetSuggestedMoves(bool tm, bool tutor, bool reminder) { if (!Parsed) @@ -370,6 +420,10 @@ public int[] GetSuggestedMoves(bool tm, bool tutor, bool reminder) var evos = Info.EvoChainsAllGens; return Legal.GetValidMoves(pkm, evos, Tutor: tutor, Machine: tm, MoveReminder: reminder).Skip(1).ToArray(); // skip move 0 } + + /// + /// Gets an object containing met data properties that might be legal. + /// public EncounterStatic GetSuggestedMetInfo() => EncounterSuggestion.GetSuggestedMetInfo(pkm); } } diff --git a/PKHeX.Core/Legality/Enums/Severity.cs b/PKHeX.Core/Legality/Enums/Severity.cs index d1defdc79..657c91ae6 100644 --- a/PKHeX.Core/Legality/Enums/Severity.cs +++ b/PKHeX.Core/Legality/Enums/Severity.cs @@ -10,11 +10,25 @@ namespace PKHeX.Core /// public enum Severity { + /// + /// Cannot determine validity; not valid. + /// Indeterminate = -2, + + /// + /// Definitively not valid. + /// Invalid = -1, + + /// + /// Suspicious values, but still valid. + /// Fishy = 0, + + /// + /// Values are valid. + /// Valid = 1, - NotImplemented = 2, } public static partial class Extensions diff --git a/PKHeX.Core/Legality/Enums/TradebackType.cs b/PKHeX.Core/Legality/Enums/TradebackType.cs index 83bc9eb92..5f2159ef9 100644 --- a/PKHeX.Core/Legality/Enums/TradebackType.cs +++ b/PKHeX.Core/Legality/Enums/TradebackType.cs @@ -6,9 +6,24 @@ /// Used for only Generation 1/2 data. public enum TradebackType { + /// + /// Information can originate from either generation without restrictions. + /// Any, + + /// + /// Information can only originate from Gen1. + /// Gen1_NotTradeback, + + /// + /// Information can only originate from Gen2. + /// Gen2_NotTradeback, + + /// + /// Information can only exist if has visited both Gen1 and Gen2. + /// WasTradeback } } diff --git a/PKHeX.Core/Legality/Learnset/Learnset.cs b/PKHeX.Core/Legality/Learnset/Learnset.cs index 322127e9a..d5d706fb6 100644 --- a/PKHeX.Core/Legality/Learnset/Learnset.cs +++ b/PKHeX.Core/Legality/Learnset/Learnset.cs @@ -3,10 +3,24 @@ namespace PKHeX.Core { + /// + /// Levelup Learn Movepool Information + /// public abstract class Learnset { + /// + /// Amount of moves present. + /// protected int Count; + + /// + /// Moves that can be learned. + /// protected int[] Moves; + + /// + /// Levels at which a move at a given index can be learned. + /// protected int[] Levels; /// diff --git a/PKHeX.Core/Legality/Learnset/Learnset1.cs b/PKHeX.Core/Legality/Learnset/Learnset1.cs index 3fe7dbff5..229c3e381 100644 --- a/PKHeX.Core/Legality/Learnset/Learnset1.cs +++ b/PKHeX.Core/Legality/Learnset/Learnset1.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// Levelup Learn Movepool Information + /// public sealed class Learnset1 : Learnset { private Learnset1(byte[] data, ref int offset) diff --git a/PKHeX.Core/Legality/Learnset/Learnset6.cs b/PKHeX.Core/Legality/Learnset/Learnset6.cs index 9a71f2706..df4d56d55 100644 --- a/PKHeX.Core/Legality/Learnset/Learnset6.cs +++ b/PKHeX.Core/Legality/Learnset/Learnset6.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// Levelup Learn Movepool Information + /// public sealed class Learnset6 : Learnset { private Learnset6(byte[] data) diff --git a/PKHeX.Core/Legality/Ribbons/RibbonResult.cs b/PKHeX.Core/Legality/Ribbons/RibbonResult.cs index a5cbc95f6..04cd45fb4 100644 --- a/PKHeX.Core/Legality/Ribbons/RibbonResult.cs +++ b/PKHeX.Core/Legality/Ribbons/RibbonResult.cs @@ -1,5 +1,8 @@ namespace PKHeX.Core { + /// + /// Legality Check Parse object containing information about a single ribbon. + /// internal class RibbonResult { /// Ribbon Display Name @@ -15,6 +18,9 @@ public RibbonResult(string prop, bool invalid = true) Invalid = invalid; } + /// + /// Merges the result name with another provided result. + /// public void Combine(RibbonResult other) { Name += $" / {other.Name}"; diff --git a/PKHeX.Core/Legality/Ribbons/RibbonStrings.cs b/PKHeX.Core/Legality/Ribbons/RibbonStrings.cs index cf1f9ace0..5375c9993 100644 --- a/PKHeX.Core/Legality/Ribbons/RibbonStrings.cs +++ b/PKHeX.Core/Legality/Ribbons/RibbonStrings.cs @@ -2,6 +2,9 @@ namespace PKHeX.Core { + /// + /// String Translation Utility + /// public static class RibbonStrings { private static readonly Dictionary RibbonNames = new Dictionary(); diff --git a/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs b/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs index 4bad638e6..eb50f1b38 100644 --- a/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs +++ b/PKHeX.Core/Legality/Ribbons/RibbonVerifier.cs @@ -5,7 +5,10 @@ namespace PKHeX.Core { - internal class RibbonVerifier : Verifier + /// + /// Verifies the Ribbon values. + /// + public sealed class RibbonVerifier : Verifier { protected override CheckIdentifier Identifier => CheckIdentifier.Ribbon; public override void Verify(LegalityAnalysis data)