Ejemplo n.º 1
0
        private void RenameButton_Click(object sender, EventArgs e)
        {
            var oldPath = filenamesLoaded[currentFile];
            var newPath = Path.Combine(Path.GetDirectoryName(oldPath), Guid.NewGuid().ToString().Substring(24) + "_" + NameTextbox.Text + Path.GetExtension(oldPath));

            // unload image.
            PreviewPictureBox.Image.Dispose();
            PreviewPictureBox.Image = null;
            PreviewPictureBox.Update();

            File.Move(oldPath, newPath);

            SetNextFile();
        }
Ejemplo n.º 2
0
        private void SetNextFile()
        {
            currentFile++;
            hasReplaced = false;

            if (filenamesLoaded.Length > currentFile)
            {
                var nextFile = filenamesLoaded[currentFile];

                // decide if auto-skip.
                if (AutoSkipShortNamesCheckbox.Checked && nextFile.Length < 12)
                {
                    SetNextFile();
                    return;
                }

                // load preview image without locking file.
                using (var bmpTemp = new Bitmap(nextFile))
                {
                    PreviewPictureBox.Image = new Bitmap(bmpTemp);
                    PreviewPictureBox.Update();
                }

                // prompt to rename.
                NameTextbox.Text = Path.GetFileNameWithoutExtension(nextFile);
                NameTextbox.Focus();
                NameTextbox.SelectAll();
            }
            else
            {
                MessageBox.Show("All files checked.");

                NameTextbox.Text     = string.Empty;
                RenameButton.Enabled = false;
            }
        }