public AnimationControl(IPluginHost pluginHost, NANR ani)
        {
            InitializeComponent();
            Read_Language();

            this.pluginHost = pluginHost;
            this.palette    = pluginHost.Get_Palette();
            this.image      = pluginHost.Get_Image();
            this.sprite     = pluginHost.Get_Sprite();
            this.ani        = ani;
            isAni           = true;

            if (ani.Struct.abnk.nBanks == 0)
            {
                MessageBox.Show("No animations.");
                isAni                      = false;
                tempo.Enabled              = false;
                comboAni.Enabled           = false;
                btnNext.Enabled            = false;
                btnPlay.Enabled            = false;
                btnPrevious.Enabled        = false;
                btnSave.Enabled            = false;
                btnStop.Enabled            = false;
                txtTime.Enabled            = false;
                checkCeldas.Enabled        = false;
                checkEntorno.Enabled       = false;
                checkImage.Enabled         = false;
                checkNumeros.Enabled       = false;
                checkTransparencia.Enabled = false;
            }


            for (int i = 0; i < ani.Names.Length; i++)
            {
                comboAni.Items.Add(ani.Names[i]);
            }
            if (isAni)
            {
                comboAni.SelectedIndex = 0;
            }

            ShowInfo();
            Get_Ani();

            tempo.Stop();
            tempo.Interval = Convert.ToInt32(txtTime.Text);

            if (isAni)
            {
                aniBox.Image = bitAni[0];
            }
        }
Example #2
0
        public AnimationControl(IPluginHost pluginHost, NANR ani)
        {
            InitializeComponent();
            Read_Language();

            this.pluginHost = pluginHost;
            this.palette = pluginHost.Get_Palette();
            this.image = pluginHost.Get_Image();
            this.sprite = pluginHost.Get_Sprite();
            this.ani = ani;
            isAni = true;

            if (ani.Struct.abnk.nBanks == 0)
            {
                MessageBox.Show("No animations.");
                isAni = false;
                tempo.Enabled = false;
                comboAni.Enabled = false;
                btnNext.Enabled = false;
                btnPlay.Enabled = false;
                btnPrevious.Enabled = false;
                btnSave.Enabled = false;
                btnStop.Enabled = false;
                txtTime.Enabled = false;
                checkCeldas.Enabled = false;
                checkEntorno.Enabled = false;
                checkImage.Enabled = false;
                checkNumeros.Enabled = false;
                checkTransparencia.Enabled = false;
            }

            for (int i = 0; i < ani.Names.Length; i++)
                comboAni.Items.Add(ani.Names[i]);
            if (isAni)
                comboAni.SelectedIndex = 0;

            ShowInfo();
            Get_Ani();

            tempo.Stop();
            tempo.Interval = Convert.ToInt32(txtTime.Text);

            if (isAni)
                aniBox.Image = bitAni[0];
        }
Example #3
0
        public Format Read2(sFile file)
        {
            string ext = "";

            if (file.size >= 4)
            {
                using (BinaryReader br = new BinaryReader(File.OpenRead(file.path)))
                {
                    ext = new String(Encoding.ASCII.GetChars(br.ReadBytes(4)));
                    br.Close();
                }
            }

            // Palette
            if (file.name.ToUpper().EndsWith(".NTFP") || file.name.ToUpper().EndsWith(".PLT"))
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return(Format.Palette);
            }
            else if (ext == "RLCN")
            {
                PaletteBase palette = new NCLR(file.path, file.id, file.name);
                pluginHost.Set_Palette(palette);
                return(Format.Palette);
            }
            else if (ext == "NCCL")
            {
                NCCL palette = new NCCL(file.path, file.id, file.name);
                pluginHost.Set_Palette(palette);
                return(Format.Palette);
            }
            else if (file.name.ToUpper().EndsWith(".NBFP"))
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return(Format.Palette);
            }
            else if (file.name.ToUpper().EndsWith(".NCL.L") && ext[0] != '\x10')
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return(Format.Palette);
            }


            // Tile
            ColorFormat depth = ColorFormat.colors256;

            if (pluginHost.Get_Palette().Loaded)
            {
                depth = pluginHost.Get_Palette().Depth;
            }

            if (file.name.ToUpper().EndsWith(".NTFT"))
            {
                RawImage image = new RawImage(file.path, file.id, TileForm.Lineal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return(Format.Tile);
            }
            else if (ext == "RGCN" || ext == "RBCN")
            {
                NCGR ncgr = new NCGR(file.path, file.id, file.name);
                pluginHost.Set_Image(ncgr);
                return(Format.Tile);
            }
            else if (ext == "NCCG")
            {
                NCCG image = new NCCG(file.path, file.id, file.name);
                pluginHost.Set_Image(image);
                return(Format.Tile);
            }
            else if (file.name.ToUpper().EndsWith(".NBFC") || file.name.ToUpper().EndsWith(".CHAR"))
            {
                RawImage image = new RawImage(file.path, file.id, TileForm.Horizontal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return(Format.Tile);
            }
            else if (file.name.ToUpper().EndsWith(".NCG.L") && ext[0] != '\x10')
            {
                RawImage image = new RawImage(file.path, file.id, TileForm.Horizontal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return(Format.Tile);
            }

            // Map
            if (file.name.ToUpper().EndsWith(".NBFS"))
            {
                RawMap map = new RawMap(file.path, file.id, 0, -1, true, file.name);
                pluginHost.Set_Map(map);
                return(Format.Map);
            }
            else if (ext == "RCSN")
            {
                NSCR nscr = new NSCR(file.path, file.id, file.name);
                pluginHost.Set_Map(nscr);
                return(Format.Map);
            }
            else if (ext == "NCSC")
            {
                NCSC map = new NCSC(file.path, file.id, file.name);
                pluginHost.Set_Map(map);
                return(Format.Map);
            }
            else if (file.name.ToUpper().EndsWith(".NSC.L") && ext[0] != '\x10')
            {
                RawMap map = new RawMap(file.path, file.id, 0, -1, true, file.name);
                pluginHost.Set_Map(map);
                return(Format.Map);
            }

            // Sprite
            if (ext == "NCOB")
            {
                NCOB sprite = new NCOB(file.path, file.id, file.name);
                pluginHost.Set_Sprite(sprite);
                pluginHost.Set_Image(sprite.Image);
                return(Format.Cell);
            }
            else if (ext == "RECN")
            {
                NCER ncer = new NCER(file.path, file.id, file.name);
                pluginHost.Set_Sprite(ncer);
                return(Format.Cell);
            }

            // Animation
            if (ext == "RNAN")
            {
                nanr = new NANR(pluginHost, file.path, file.id);
                return(Format.Animation);
            }

            return(Format.Unknown);
        }
Example #4
0
File: Main.cs Project: MetLob/tinke
        public Format Read2(sFile file)
        {
            string ext = "";
            if (file.size >= 4)
            {
                using (BinaryReader br = new BinaryReader(File.OpenRead(file.path)))
                {
                    ext = new String(Encoding.ASCII.GetChars(br.ReadBytes(4)));
                    br.Close();
                }
            }

            // Palette
            if (file.name.ToUpper().EndsWith(".NTFP") || file.name.ToUpper().EndsWith(".PLT"))
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return Format.Palette;
            }
            else if (ext == "RLCN")
            {
                PaletteBase palette = new NCLR(file.path, file.id, file.name);
                pluginHost.Set_Palette(palette);
                return Format.Palette;
            }
            else if (ext == "NCCL")
            {
                NCCL palette = new NCCL(file.path, file.id, file.name);
                pluginHost.Set_Palette(palette);
                return Format.Palette;
            }
            else if (file.name.ToUpper().EndsWith(".NBFP"))
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return Format.Palette;
            }
            else if (file.name.ToUpper().EndsWith(".NCL.L") && ext[0] != '\x10')
            {
                RawPalette palette = new RawPalette(file.path, file.id, true, 0, -1, file.name);
                pluginHost.Set_Palette(palette);
                return Format.Palette;
            }

            // Tile
            ColorFormat depth = ColorFormat.colors256;
            if (pluginHost.Get_Palette().Loaded)
                depth = pluginHost.Get_Palette().Depth;

            if (file.name.ToUpper().EndsWith(".NTFT"))
            {

                RawImage image = new RawImage(file.path, file.id, TileForm.Lineal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return Format.Tile;
            }
            else if (ext == "RGCN" || ext == "RBCN")
            {
                NCGR ncgr = new NCGR(file.path, file.id, file.name);
                pluginHost.Set_Image(ncgr);
                return Format.Tile;
            }
            else if (ext == "NCCG")
            {
                NCCG image = new NCCG(file.path, file.id, file.name);
                pluginHost.Set_Image(image);
                return Format.Tile;
            }
            else if (file.name.ToUpper().EndsWith(".NBFC") || file.name.ToUpper().EndsWith(".CHAR"))
            {
                RawImage image = new RawImage(file.path, file.id, TileForm.Horizontal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return Format.Tile;
            }
            else if (file.name.ToUpper().EndsWith(".NCG.L") && ext[0] != '\x10')
            {
                RawImage image = new RawImage(file.path, file.id, TileForm.Horizontal, depth, true, 0, -1, file.name);
                pluginHost.Set_Image(image);
                return Format.Tile;
            }

            // Map
            if (file.name.ToUpper().EndsWith(".NBFS"))
            {
                RawMap map = new RawMap(file.path, file.id, 0, -1, true, file.name);
                pluginHost.Set_Map(map);
                return Format.Map;
            }
            else if (ext == "RCSN")
            {
                NSCR nscr = new NSCR(file.path, file.id, file.name);
                pluginHost.Set_Map(nscr);
                return Format.Map;
            }
            else if (ext == "NCSC")
            {
                NCSC map = new NCSC(file.path, file.id, file.name);
                pluginHost.Set_Map(map);
                return Format.Map;
            }
            else if (file.name.ToUpper().EndsWith(".NSC.L") && ext[0] != '\x10')
            {
                RawMap map = new RawMap(file.path, file.id, 0, -1, true, file.name);
                pluginHost.Set_Map(map);
                return Format.Map;
            }

            // Sprite
            if (ext == "NCOB")
            {
                NCOB sprite = new NCOB(file.path, file.id, file.name);
                pluginHost.Set_Sprite(sprite);
                pluginHost.Set_Image(sprite.Image);
                return Format.Cell;
            }
            else if (ext == "RECN")
            {
                NCER ncer = new NCER(file.path, file.id, file.name);
                pluginHost.Set_Sprite(ncer);
                return Format.Cell;
            }

            // Animation
            if (ext == "RNAN")
            {
                nanr = new NANR(pluginHost, file.path, file.id);
                return Format.Animation;
            }

            return Format.Unknown;
        }