Beispiel #1
0
 private void btnAddMany_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in this.listViewFilePick.Items)
     {
         ListViewHelper.AddItem(this.listViewSelectedItems, ObjectType.File, Path.Combine(this.fullPath, item.Text));
     }
 }
Beispiel #2
0
 private void btnAddSingle_Click(object sender, EventArgs e)
 {
     if (this.listViewFilePick.SelectedItems.Count > 0) // selected files
     {
         foreach (ListViewItem item in this.listViewFilePick.SelectedItems)
         {
             ListViewHelper.AddItem(this.listViewSelectedItems, ObjectType.File, Path.Combine(this.fullPath, item.Text));
         }
     }
     else // selected directory
     if (this.fullPath != Path.GetPathRoot(this.fullPath))
     {
         ListViewHelper.AddItem(this.listViewSelectedItems, ObjectType.Directory, this.fullPath);
     }
 }
Beispiel #3
0
        private void btnAddTree_Click(object sender, EventArgs e)
        {
            if (this.treeViewFolderPick.SelectedNode == null)
            {
                return;
            }

            DirectoryInfo dirInfo = new DirectoryInfo(this.fullPath);

            FileInfo[] filesInfo = dirInfo.GetFiles("*.*", SearchOption.AllDirectories);

            foreach (var fileInfo in filesInfo)
            {
                ListViewHelper.AddItem(this.listViewSelectedItems, ObjectType.File, fileInfo.FullName);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Previews changes on selected files according to the selected settings.
        /// </summary>
        private void PreviewWork()
        {
            try
            {
                var renameSettings = this.BuildRenameSettings();
                var renameEngine   = new RenameEngine(renameSettings);

                // get NamingRequest items
                var listViewItems  = ListViewHelper.GetCollectionItems(this.listViewSelectedItems.Items);
                var namingRequests = listViewItems.Select(a => new NamingRequest((ObjectType)a.Tag, a.Text)).ToList();

                // send the files/directories to calculate rename changes
                var namingResults = renameEngine.Preview(namingRequests);

                // refresh UI
                foreach (var namingResult in namingResults)
                {
                    ListViewHelper.AddItem(this.listViewPreview, namingResult.ObjectType, namingResult.OldName, namingResult.NewName);
                }
            }
            catch (Exception ex) { this.statusStripLabelPreview.Text = ex.Message; }
        }