示例#1
0
 public void ShowAndDelFiles(FileUtilities fileToSplit)
 {
     this.Show();
     int i = 0;
     while (File.Exists(fileToSplit.FileSavePath + ".vip" + i.ToString())) { File.Delete(fileToSplit.FileSavePath + ".vip" + i.ToString()); i++; }
     if (File.Exists(fileToSplit.FileSavePath + ".vipmeta")) { File.Delete(fileToSplit.FileSavePath + ".vipmeta"); }
 }
示例#2
0
        private void buttonJoinSplitFiles_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = ".vip0 File|*.vip0";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {

                string directoryName = openFileDialog.FileName.Substring(0, openFileDialog.FileName.LastIndexOf('\\') + 1);
                string startingFile = openFileDialog.FileName; saveDirectory = directoryName;
                string fileName = startingFile.Substring(startingFile.LastIndexOf('\\') + 1, startingFile.LastIndexOf('.') - startingFile.LastIndexOf('\\') - 1);
                FileMetaData fileData = FileUtilities.ReadBackMetaFile(saveDirectory, fileName);
                buttonJoinSplitFiles.Enabled = false; buttonJoinCancel.Enabled = true; fileToSplit = new FileUtilities("1", "2"); fileToSplit.OrigFileFullSavePath = saveDirectory + fileData.OriginalFileName;
                fileToSplit.ActualFileSize = fileData.OrigFileSize;

                labelFile.Text = fileData.OriginalFileName; labelFileSize.Text = FileUtilities.GetStringFromActualSize(fileToSplit.ActualFileSize); labelNumSplit.Text = fileData.NoOfSplitFiles.ToString();
                if (fileData.FileCheckSum != "NC") labelChecksum.Text = fileData.FileCheckSum + "  [ " + fileData.CheckSumType.ToString() + " ]"; else labelChecksum.Text = "Not Calculated During Split";
                backgroundWorkerJoin.RunWorkerAsync(openFileDialog.FileName);
            }
            openFileDialog.Filter = "";
        }
示例#3
0
        private void browseButton_Click(object sender, EventArgs e)
        {
            DialogResult res = IsFolder?splitFolder.ShowDialog():openFileDialog.ShowDialog();
            if (res == DialogResult.OK)
            {
                comboBoxCustomSize.Items.Clear();
                if (!IsFolder)
                {
                    filePathLabel.Text = openFileDialog.FileName;
                    fileToSplit = new FileUtilities(openFileDialog.FileName, openFileDialog.InitialDirectory);
                    buttonCalcMD5.Enabled = true; labelMD5Show.Visible = false;
                    fileSizeLabel.Text = fileToSplit.FileSize; string t = fileToSplit.OrigFileName;

                    if (fileToSplit.MaxFileSize == "GB")
                    { comboBoxCustomSize.Items.Add("B"); comboBoxCustomSize.Items.Add("KB"); comboBoxCustomSize.Items.Add("MB"); comboBoxCustomSize.Items.Add("GB"); }
                    else if (fileToSplit.MaxFileSize == "MB")
                    { comboBoxCustomSize.Items.Add("B"); comboBoxCustomSize.Items.Add("KB"); comboBoxCustomSize.Items.Add("MB"); }
                    else if (fileToSplit.MaxFileSize == "KB")
                    { comboBoxCustomSize.Items.Add("B"); comboBoxCustomSize.Items.Add("KB"); }
                    else if (fileToSplit.MaxFileSize == "B")
                    { comboBoxCustomSize.Items.Add("B"); }
                }

                else
                {
                    filePathLabel.Text = splitFolder.SelectedPath;
                    folderSplit = null;
                    folderSplit = new FolderSplitWorker(splitFolder.SelectedPath, (int)buffer);
                    folderSplit.AccumulateFolderInfo(); folderSplit.ReportSplitProgress +=folderSplit_ReportSplitProgress;
                    folderSplit.SplittingDone +=folderSplit_SplittingDone;
                    fileSizeLabel.Text = FileUtilities.GetStringFromActualSize((float)folderSplit.TotalSize);
                    comboBoxCustomSize.Items.Add("B"); comboBoxCustomSize.Items.Add("KB"); comboBoxCustomSize.Items.Add("MB"); comboBoxCustomSize.Items.Add("GB");
                }

                 comboBoxCustomSize.SelectedIndex = 0; customSizeBox.Text = "1";
                 this.customSizeBox.TextChanged += new System.EventHandler(this.customSizeBox_TextChanged);
                 this.comboBoxCustomSize.SelectedIndexChanged += new System.EventHandler(this.comboBoxCustomSize_SelectedIndexChanged);

                 radioCustomSize.Checked = true; radioPredefSizes.Checked = false; radioNoOfFiles.Checked = false;
            }
        }