Exemple #1
0
        private void GetExtensions(string sourcePathCopy)
        {
            var           content     = GroupItTools.GetContent(sourcePathCopy);
            StringBuilder sbBasicInfo = new StringBuilder();
            int           count       = 0;

            //  Amount
            content.ForEach(c => count++);

            //  File extensnions
            extensions.Clear();
            foreach (string fileName in content)
            {
                var ext = Path.GetExtension(fileName);
                if (!extensions.Contains(ext.ToLower()))
                {
                    extensions.Add(ext.ToLower());
                }
            }

            List <int> boxesWidths = new List <int>();

            for (int i = 0; i < extensions.Count; i++)
            {
                boxesWidths.Add(extensions[i].Length);
                chkBoxList.Items.Add(extensions[i]);
            }

            chkBoxList.ColumnWidth = boxesWidths.Max() * 15;
        }
Exemple #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                sourcePathCopy = txtBoxSource.Text;
                outputPath     = txtBoxDestination.Text;

                var chosenFileTypes = chkBoxList.CheckedItems.Cast <string>().ToList();
                //lblBasicInfo.Text = $"Info: Total files: {}";

                #region Tests
                // TODO: Remove hardcoded paths
                //sourcePathCopy = @"D:\Pictures\all";
                //sourcePathMove = @"D:\Pictures\testing - Copy";

                //outputPath = @"D:\Pictures\output";
                //outputPathMove = @"D:\Pictures\output - Copy";

                //chosenFileTypes = new List<string>() { ".jpg", ".cr2" };
                #endregion

                // Call Group API main function
                GroupItTools.GroupImages(sourcePathCopy, outputPath, chosenFileTypes, option);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }