示例#1
0
        /// <summary>
        /// Verifies the <see cref="GameVersion"/> properties, logging any problems it finds.
        /// </summary>
        ///
        /// <param name="extendedReporting">If <c>true</c>, do more extensive verification.</param>
        /// <param name="log">The log to append.</param>
        ///
        /// <returns>Returns <c>true</c> if problems found, otherwise <c>false</c>.</returns>
        internal bool VerifyGameVersionProperties(bool extendedReporting, ref StringBuilder log)
        {
            bool problems = false;

            if (extendedReporting && CompatibleWith == GameVersion.DefaultRelease)
            {
                problems = true;
                log.Append("- CompatibleWith missing\n");
            }

            // TODO: Replace static date with dynamic date when GameVersion class gets improved
            if (CompatibleWith < GameVersion.SunsetHarbor &&
                (BrokenBy == GameVersion.DefaultUntil || BrokenBy < GameVersion.SunsetHarbor) &&
                Updated != null && Updated.Value >= GameVersion.PatchDate("2020-03-26"))
            {
                problems = true;
                log.Append("> Might be compatible with Sunset Harbor?\n");
            }

            if (!Suppresses(Warning.InvalidVersionSequence))
            {
                // TODO: auto-determine ReleasedDuring based on Published date

                if (CompatibleWith < ReleasedDuring)
                {
                    problems = true;
                    log.Append("- CompatibleWith must be >= ReleasedDuring\n");
                }

                if (BrokenBy < ReleasedDuring)
                {
                    problems = true;
                    log.Append("- BrokenBy must be >= ReleasedDuring\n");
                }

                if (BrokenBy <= CompatibleWith)
                {
                    problems = true;
                    log.Append("- BrokenBy must be > CompatibleWith\n");
                }
            }

            // must be neither or both
            if (HasFlag(ItemFlags.BrokenByUpdate) == (BrokenBy == GameVersion.DefaultUntil))
            {
                problems = true;
                log.Append("- The BrokenByUpdate flag and BrokenBy properties must correlate\n");
            }

            return(problems);
        }