コード例 #1
0
        public static GamePatch?GetOriginGamePatch(this MapInfo mapInfo)
        {
            var gameBuilds = mapInfo.GameVersion is not null
                ? GameBuildsProvider.GetGameBuilds(mapInfo.GameVersion)
                : GameBuildsProvider.GetGameBuilds(mapInfo.EditorVersion);

            return(gameBuilds.Count == 1 ? gameBuilds[0].GamePatch : null);
        }
コード例 #2
0
        public static bool TryDowngrade(this MapInfo mapInfo, GamePatch targetPatch)
        {
            try
            {
                while (mapInfo.GetMinimumPatch() > targetPatch)
                {
                    mapInfo.DowngradeOnce();
                }

                var targetGameBuild = GameBuildsProvider.GetGameBuilds(targetPatch)[0];

                mapInfo.EditorVersion = targetGameBuild.EditorVersion.Value;
                if (mapInfo.FormatVersion >= MapInfoFormatVersion.Lua)
                {
                    mapInfo.GameVersion = targetGameBuild.Version;
                }

                return(true);
            }
            catch
            {
                throw;
            }
        }