Esempio n. 1
0
        private void dankYGAToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            MyOpenFileDialogControl openFileDialog = new MyOpenFileDialogControl();

            //openFileDialog.Multiselect = true;

            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                //lblFilePath.Text = openDialog.MSDialog.FileName;
            }
            else
            {
                return;
            }

            CustomControls.FolderSelectDialog saveFileDialog = new CustomControls.FolderSelectDialog();
            if (!saveFileDialog.ShowDialog())
            {
                return;
            }

            foreach (var item in openFileDialog.FileDlgFileNames)
            {
                YGAFile file = new YGAFile(item);
                file.Decompress(saveFileDialog.FileName + @"\" + Path.GetFileNameWithoutExtension(item) + ".png");
            }
        }
Esempio n. 2
0
        private void MyOpenFileDialogControl_FileNameChanged(IWin32Window sender, string filePath)
        {
            if (filePath.ToLower().EndsWith(".bmp") ||
                filePath.ToLower().EndsWith(".jpg") ||
                filePath.ToLower().EndsWith(".png") ||
                filePath.ToLower().EndsWith(".yga") ||
                filePath.ToLower().EndsWith(".gif"))
            {
                if (pbxPreview.Image != null)
                {
                    pbxPreview.Image.Dispose();
                }

                try
                {
                    FileInfo fi = new FileInfo(filePath);

                    if (filePath.ToLower().EndsWith(".yga"))
                    {
                        YGAFile file = new YGAFile(filePath);
                        pbxPreview.Image = file.Decompress();
                    }
                    else
                    {
                        pbxPreview.Image = Bitmap.FromFile(filePath);
                    }

                    lblSizeValue.Text   = (fi.Length / 1024).ToString() + "KB";
                    lblColorsValue.Text = GetColorsCountFromImage(pbxPreview.Image);
                    lblFormatValue.Text = "Yu-Gi-Oh Graphics Acronym (*.yga)";
                    FileDlgEnableOkBtn  = true;
                }
                catch (Exception) { FileDlgEnableOkBtn = false; }
            }
            else
            {
                if (pbxPreview.Image != null)
                {
                    pbxPreview.Image.Dispose();
                }
                pbxPreview.Image = null;
            }
        }
Esempio n. 3
0
        private void dankToYGAToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = true;

            openFileDialog.Filter = "Portable Network Graphic (*.png)|*.png";
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            CustomControls.FolderSelectDialog saveFileDialog = new CustomControls.FolderSelectDialog();
            if (!saveFileDialog.ShowDialog())
            {
                return;
            }

            foreach (var item in openFileDialog.FileNames)
            {
                YGAFile.ConvertToYGA(item, saveFileDialog.FileName + @"\" + Path.GetFileNameWithoutExtension(item) + ".yga");
            }
        }