Пример #1
0
        private void B_ImportCGB_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter = CGearBackground.Filter + "|PokeStock C-Gear Skin|*.psk"
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var path = ofd.FileName;
            var len  = new FileInfo(path).Length;

            if (len != CGearBackground.SIZE_CGB)
            {
                WinFormsUtil.Error($"Incorrect size, got {len} bytes, expected {CGearBackground.SIZE_CGB} bytes.");
                return;
            }

            byte[] data = File.ReadAllBytes(path);
            bg = new CGearBackground(data);
            PB_Background.Image = CGearExtensions.GetBitmap(bg);
        }
Пример #2
0
        private void B_ImportPNG_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter   = "PNG File|*.png",
                FileName = "Background.png",
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Bitmap img = (Bitmap)Image.FromFile(ofd.FileName);

            try
            {
                bg = CGearExtensions.GetCGearBackground(img);
                PB_Background.Image = CGearExtensions.GetBitmap(bg);
            }
            catch (Exception ex)
            {
                WinFormsUtil.Error(ex.Message);
            }
        }
Пример #3
0
        public SAV_CGearSkin(SaveFile sav)
        {
            SAV = (SAV5)(Origin = sav).Clone();
            InitializeComponent();

            byte[] data = SAV.CGearSkinData;
            bg = new CGearBackground(data);

            PB_Background.Image = CGearExtensions.GetBitmap(bg);
        }
Пример #4
0
        public SAV_CGearSkin(SaveFile sav)
        {
            InitializeComponent();
            WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);
            SAV = (SAV5)(Origin = sav).Clone();

            byte[] data = SAV.CGearSkinData;
            bg = new CGearBackground(data);

            PB_Background.Image = CGearExtensions.GetBitmap(bg);
        }