Ejemplo n.º 1
0
        private void B_ImportPNG_Click(object sender, EventArgs e)
        {
            using var 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 = CGearImage.GetCGearBackground(img);
                PB_Background.Image = CGearImage.GetBitmap(bg);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                WinFormsUtil.Error(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void B_ImportCGB_Click(object sender, EventArgs e)
        {
            using var 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 = CGearImage.GetBitmap(bg);
        }
Ejemplo n.º 3
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 = CGearImage.GetBitmap(bg);
        }