예제 #1
0
        private bool RenameFile(string path, StringBuilder outputString)
        {
            listBox1.ClearSelected();

            PhotoInfo photo = new PhotoInfo(path);

            string newFilePath = photo.GenerateFilePath();

            if (newFilePath != "")
            {
                int index = 0;
                while (File.Exists(newFilePath))
                {
                    newFilePath = photo.GenerateFilePath(++index);
                }
                File.Move(path, newFilePath);
                outputString.AppendLine("Generated new name and renamed file:\n" + path);
                return(true);
            }
            else
            {
                outputString.AppendLine("Not enough metadata to generate new name for file:\n" + path);
                return(false);
            }
        }
예제 #2
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     ClearView();
     if (listBox1.SelectedItem != null)
     {
         selectedPhoto = new PhotoInfo(listBox1.SelectedItem.ToString());
         SetView();
     }
 }