Пример #1
0
        public override ErrorInfo TryParseData(IDataModel model, string name, int dataIndex, ref IFormattedRun run)
        {
            var error = SpriteRunContentStrategy.IsValid(format.BitsPerPixel);

            if (error.HasError)
            {
                return(error);
            }
            var newRun = new TilemapRun(model, dataIndex, format);

            run = newRun;
            return(ErrorInfo.NoError);
        }
Пример #2
0
        public static RunStrategy GetStrategy(string format)
        {
            RunStrategy strategy;

            if (format == PCSRun.SharedFormatString)
            {
                strategy = new PCSRunContentStrategy();
            }
            else if (format.StartsWith(AsciiRun.SharedFormatString))
            {
                strategy = new AsciiRunContentStrategy();
            }
            else if (format == EggMoveRun.SharedFormatString)
            {
                strategy = new EggRunContentStrategy();
            }
            else if (format == PIERun.SharedFormatString)
            {
                strategy = new PIERunContentStrategy();
            }
            else if (format == PLMRun.SharedFormatString)
            {
                strategy = new PLMRunContentStrategy();
            }
            else if (format == XSERun.SharedFormatString)
            {
                strategy = new XseRunContentStrategy();
            }
            else if (format == BSERun.SharedFormatString)
            {
                strategy = new BseRunContentStrategy();
            }
            else if (format == ASERun.SharedFormatString)
            {
                strategy = new AseRunContentStrategy();
            }
            else if (format.StartsWith(OverworldSpriteListRun.SharedFormatString.Substring(0, OverworldSpriteListRun.SharedFormatString.Length - 1)))
            {
                strategy = new OverworldSpriteListContentStrategy(format);
            }
            else if (format == TrainerPokemonTeamRun.SharedFormatString)
            {
                strategy = new TrainerPokemonTeamRunContentStrategy();
            }
            else if (LzSpriteRun.TryParseSpriteFormat(format, out var spriteFormat))
            {
                strategy = new LzSpriteRunContentStrategy(spriteFormat);
            }
            else if (LzPaletteRun.TryParsePaletteFormat(format, out var paletteFormat))
            {
                strategy = new LzPaletteRunContentStrategy(paletteFormat);
            }
            else if (TilesetRun.TryParseTilesetFormat(format, out var tilesetFormat))
            {
                strategy = new TilesetRunContentStrategy(tilesetFormat);
            }
            else if (LzTilesetRun.TryParseTilesetFormat(format, out var lzTilesetFormat))
            {
                strategy = new LzTilesetRunContentStrategy(lzTilesetFormat);
            }
            else if (LzTilemapRun.TryParseTilemapFormat(format, out var tilemapFormat))
            {
                strategy = new LzTilemapRunContentStrategy(tilemapFormat);
            }
            else if (TilemapRun.TryParseTilemapFormat(format, out var tilemapFormat1))
            {
                strategy = new TilemapRunContentStrategy(tilemapFormat1);
            }
            else if (SpriteRun.TryParseSpriteFormat(format, out var spriteFormat1))
            {
                strategy = new SpriteRunContentStrategy(spriteFormat1);
            }
            else if (PaletteRun.TryParsePaletteFormat(format, out var paletteFormat1))
            {
                strategy = new PaletteRunContentStrategy(paletteFormat1);
            }
            else if (format.IndexOf("[") >= 0 && format.IndexOf("[") < format.IndexOf("]"))
            {
                strategy = new TableStreamRunContentStrategy();
            }
            else
            {
                return(null);
            }

            strategy.Format = format;
            return(strategy);
        }