예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void numericUpDownDigits_ValueChanged(object sender, EventArgs e)
 {
     if ((comboBoxDataSize.SelectedText != string.Empty || comboBoxDataSize.SelectedText != null) && (numericUpDownDigits.Value >= 0 || numericUpDownDigits.Value <= 8))
     {
         labelPreview.Text = Supporter.BuildPi(comboBoxDataSize.SelectedValue.ToString(), numericUpDownDigits.Value);
     }
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sizes"></param>
        private void BuildBars(long[] sizes)
        {
            Dictionary <int, long> bars = new Dictionary <int, long>();

            for (int i = 0; i < sizes.Length; i++)
            {
                bars.Add(i, sizes[i]);
            }
            var items = from pair in bars
                        orderby pair.Value descending
                        select pair;

            List <long> sortedList      = new List <long>();
            List <long> unsortedList    = new List <long>();
            List <int>  sortedIndexList = new List <int>(bars.Count);

            sortedList.AddRange(bars.Values.ToArray());
            unsortedList.AddRange(bars.Values.ToArray());
            foreach (KeyValuePair <int, long> size in items)
            {
                sortedIndexList.Add(size.Key);
            }
            long max = Supporter.GetMaxValue(sortedList);

            for (int i = 0; i < sortedIndexList.Count(); i++)
            {
                barList.Add(BarBuilder(unsortedList[i], max));
            }
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 private void SetConfig()
 {
     files = radioButtonFiles.Checked ? true : false;
     btnBrowseBack.Visible = !files;
     ClearLists();
     if (rootPath != textBoxDir.Text || filtered != checkBoxFilter.Checked || subDirectories != checkBoxTopDirectoryOnly.Checked || files == radioButtonFiles.Checked)
     {
         rootPath       = textBoxDir.Text;
         filtered       = checkBoxFilter.Checked;
         subDirectories = checkBoxTopDirectoryOnly.Checked;
         if (files)
         {
             if (filtered)
             {
                 pathsArray = Supporter.GetFilesFiltered(rootPath, dataStore.filesExt, subDirectories);
                 paths      = pathsArray.ToList <string>();
                 names      = Supporter.GetFileNameList(paths);
             }
             else
             {
                 pathsArray = Directory.GetFiles(rootPath, "*.*", subDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
                 paths      = pathsArray.ToList <string>();
                 names      = Supporter.GetFileNameList(paths);
             }
         }
         else
         {
             pathsArray = Directory.GetDirectories(rootPath, "*.*", subDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
             paths      = pathsArray.ToList <string>();
             names      = Supporter.GetFileNameList(paths);
         }
     }
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 private void LoadSettings()
 {
     comboBoxDataSize.DataSource    = dataStore.dataSizes;
     numericUpDownDigits.Value      = Settings.Default.sortDigits;
     comboBoxDataSize.SelectedIndex = Settings.Default.sortSizes;
     labelPreview.Text = Supporter.BuildPi(comboBoxDataSize.SelectedValue.ToString(), numericUpDownDigits.Value);
 }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxDataSize_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxDataSize.SelectedIndex == 0)
     {
         numericUpDownDigits.Enabled = false;
     }
     else
     {
         numericUpDownDigits.Enabled = true;
     }
     labelPreview.Text = Supporter.BuildPi(comboBoxDataSize.SelectedValue.ToString(), numericUpDownDigits.Value);
 }
예제 #6
0
 public FrmShowTransferData(string[] pathsFrom, string[] pathsTo, string source, string dest, string fileLength)
 {
     InitializeComponent();
     this.pathsFrom         = pathsFrom;
     this.pathsTo           = pathsTo;
     listBoxFrom.DataSource = dataStore.GetShortPaths(pathsFrom, source);
     listBoxTo.DataSource   = dataStore.GetShortPaths(pathsTo, dest);
     labelFromInfo.Text     = Supporter.GetFolderName(source);
     toolTip.SetToolTip(labelFromInfo, source);
     toolTip.SetToolTip(pictureBoxFolder1, source);
     labelToInfo.Text = Supporter.GetFolderName(dest);
     toolTip.SetToolTip(labelToInfo, dest);
     toolTip.SetToolTip(pictureBoxFolder2, dest);
     labelFilesCount.Text  = string.Format("{0} files", pathsFrom.Length);
     labelFilesLength.Text = fileLength;
 }
예제 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="pathsToParse"></param>
 /// <param name="files"></param>
 private void FillValues(string[] pathsToParse, bool files)
 {
     labelFolderName.Text = Path.GetFileName(rootPath);
     if (files)
     {
         radioButtonFiles.Checked = true;
         for (int i = 0; i < pathsToParse.Length; i++)
         {
             lenghts.Add(new FileInfo(pathsToParse[i]).Length);
         }
         labelFilesInFolder.Text = string.Format("{0} files", pathsToParse.Length);
         //if (filtered)
         //{
         //    labelFoldersInFolder.Text = string.Format("{0} containing subfolders", Supporter.GetFoldersFiltered(rootPath, Array.SearchField, subDirectories);
         //}
         //else
         //{
         labelFoldersInFolder.Text = string.Format("{0} subfolders", Directory.GetDirectories(rootPath, "*.*", subDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Length);
         //}
     }
     else
     {
         radioButtonDirectories.Checked = true;
         checkBoxFilter.Enabled         = false;
         for (int i = 0; i < pathsToParse.Length; i++)
         {
             lenghts.Add(dataStore.GetDirSize(pathsToParse[i]));
         }
         labelFoldersInFolder.Text = string.Format("{0} subfolders", pathsToParse.Length);
         if (filtered)
         {
             labelFilesInFolder.Text = string.Format("{0} files", Supporter.GetFilesFiltered(rootPath, dataStore.filesExt, subDirectories).Length);
         }
         else
         {
             labelFilesInFolder.Text = string.Format("{0} files", Directory.GetFiles(rootPath, "*.*", subDirectories ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Length);
         }
     }
     labelSizeOfFolder.Text = Supporter.GetDataSizeString(Supporter.GetDirSize(rootPath), comboBoxDataSize.SelectedIndex, Convert.ToInt32(numericUpDownDigits.Value));
     for (int i = 0; i < pathsToParse.Length; i++)
     {
         names.Add(Path.GetFileNameWithoutExtension(pathsToParse[i]));
     }
 }
예제 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChooseDir_Click(object sender, EventArgs e)
        {
            string openPath;

            if (Directory.Exists(textBoxDir.Text))
            {
                openPath = textBoxDir.Text;
            }
            else
            {
                openPath = rootPath;
            }

            string path = Supporter.OpenFolderBrowserDialog(openPath);

            if (path != string.Empty)
            {
                textBoxDir.Text = path;
            }
        }
예제 #9
0
        private void LoadFilePair(int index)
        {
            labelFileName1.Text      = fileList[index].FileNameFirst;
            labelFileName2.Text      = fileList[index].FileNameSecond;
            labelFilePath1.Text      = fileList[index].FilePathFirst;
            labelFilePath2.Text      = fileList[index].FilePathSecond;
            labelFileSize1.Text      = Supporter.GetDataSizeString(fileList[index].FileLengthFirst);
            labelFileSize2.Text      = Supporter.GetDataSizeString(fileList[index].FileLengthSecond);
            labelFileLastWrite1.Text = fileList[index].LastModifiedFirstFile.ToString();
            labelFileLastWrite2.Text = fileList[index].LastModifiedSecondFile.ToString();
            labelFileCreation1.Text  = fileList[index].DateOfCreationFirstFile.ToString();
            labelFileCreation2.Text  = fileList[index].DateOfCreationSecondFile.ToString();
            if (fileList[index].FileLengthFirst != fileList[index].FileLengthSecond)
            {
                labelSize.Text = (fileList[index].FileLengthFirst > fileList[index].FileLengthSecond) ? ">" : "<";
            }
            else
            {
                labelSize.Text = "=";
            }

            if (fileList[index].LastModifiedFirstFile.Ticks != fileList[index].LastModifiedSecondFile.Ticks)
            {
                labelLastWrite.Text = (fileList[index].LastModifiedFirstFile.Ticks > fileList[index].LastModifiedSecondFile.Ticks) ? ">" : "<";
            }
            else
            {
                labelLastWrite.Text = "=";
            }

            if (fileList[index].DateOfCreationFirstFile.Ticks != fileList[index].DateOfCreationSecondFile.Ticks)
            {
                labelDOC.Text = (fileList[index].DateOfCreationFirstFile.Ticks > fileList[index].DateOfCreationSecondFile.Ticks) ? ">" : "<";
            }
            else
            {
                labelDOC.Text = "=";
            }
        }
예제 #10
0
        /// <summary>
        /// Validiert den eingegebenen Pfad, legt vorschaudaten in die labels und erzeugt eine Liste aller Dateien
        /// </summary>
        private void ValidatePath()
        {
            if (Directory.Exists(textBoxPath.Text))
            {
                string path = textBoxPath.Text;
                directoryPath = textBoxPath.Text;
                int filesTotal;
                int foldersTotal;

                foldersTotal = Directory.GetDirectories(path, "*.*", checkBoxAllDirectories.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Length;
                if (checkBoxAdvancedFilter.Checked)
                {
                    allFiles = Supporter.GetFilesFiltered(path, dataStore.filesExt, checkBoxAllDirectories.Checked).ToList <string>();

                    filesTotal = allFiles.Count;
                }
                else
                {
                    allFiles   = Directory.GetFiles(path, "*.*", checkBoxAllDirectories.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).ToList <string>();
                    filesTotal = allFiles.Count;
                }

                if (foldersTotal >= 2)
                {
                    btnShowFolders.Enabled = true;
                }
                else
                {
                    btnShowFolders.Enabled = false;
                }

                labelFoldername.Text   = Path.GetFileName(path);
                labelFilesTotal.Text   = string.Format("{0} files total", filesTotal);
                labelFoldersTotal.Text = string.Format("{0} subfolders", foldersTotal);
                ToggleLabels(true);
            }
        }
예제 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShowFile_Click(object sender, EventArgs e)
        {
            string path = GetSelectedPath();

            Supporter.OpenFile(path);
        }
예제 #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdvancedFilter_Click(object sender, EventArgs e)
 {
     Supporter.OpenFilter();
 }