예제 #1
0
파일: Main.cs 프로젝트: kwsch/png2bclim
        public void makeBCLIM(string path)
        {
            byte[] data = BCLIM.getBCLIM(path, CB_OutFormat.Text[0]);

            string fp = Path.GetFileNameWithoutExtension(path);

            fp = "new_" + fp.Substring(fp.IndexOf('_') + 1);
            string pp      = Path.GetDirectoryName(path);
            string newPath = Path.Combine(pp, fp + ".bclim");

            var sfd = new SaveFileDialog
            {
                FileName         = newPath,
                InitialDirectory = pp,
                Filter           = "BCLIM File|*.bclim" +
                                   "|All Files|*.*"
            };

            if (CHK_AutoSaveBCLIM.Checked || (sfd.ShowDialog() == DialogResult.OK))
            {
                File.WriteAllBytes(sfd.FileName, data);
            }

            PB_BCLIM.Image = new Bitmap(path);
            var bclim = BCLIM.analyze(sfd.FileName);

            showPaletteBox(bclim);
            GB_Details.Visible = true;
            L_Details.Text     = String.Format("{1}{0}{2}{0}{3}{0}{4}{0}{5}", Environment.NewLine,
                                               bclim.FileFormat, bclim.Width, bclim.Height, bclim.TileWidth, bclim.TileHeight);
        }
예제 #2
0
파일: Main.cs 프로젝트: HelloOO7/png2bclim
        public void makeBCLIM(string path)
        {
            string fp = Path.GetFileNameWithoutExtension(path);

            fp = "new_" + fp.Substring(fp.IndexOf('_') + 1);
            string pp = Path.GetDirectoryName(path);

            var sfd = new SaveFileDialog
            {
                FileName         = fp + (SaveAsBFLIM.Checked ? ".bflim" : ".bclim"),
                InitialDirectory = pp,
                Filter           = "BCLIM File|*.bclim" +
                                   "|BFLIM FILE|*.bflim" +
                                   "|All Files|*.*"
            };

            sfd.FilterIndex = SaveAsBFLIM.Checked ? 2 : 1;

            if (CHK_AutoSaveBCLIM.Checked || (sfd.ShowDialog() == DialogResult.OK))
            {
                bool FLIM = false;
                if (sfd.FileName.EndsWith(".bflim"))
                {
                    FLIM = true;
                }
                byte[] data = BCLIM.getBCLIM(path, CB_OutFormat.Text[0], FLIM);

                File.WriteAllBytes(sfd.FileName, data);

                PB_BCLIM.Image = new Bitmap(path);
                var bclim = BCLIM.analyze(sfd.FileName);
                showPaletteBox(bclim);
                GB_Details.Visible = true;
                L_Details.Text     = String.Format("{1}{0}{2}{0}{3}{0}{4}{0}{5}", Environment.NewLine,
                                                   bclim.FileFormat, bclim.Width, bclim.Height, 4, 4);
            }
        }