private void DirectoryCopyFlags_SelectedValueChanged(object sender, EventArgs e) { for (int i = 0; i < DirectoryCopyFlags.Items.Count; i++) { switch (i) { case 0: ProfileManager.CurrentProfile.DirectoryCopyFlags.Data = DirectoryCopyFlags.GetItemChecked(i); break; case 1: ProfileManager.CurrentProfile.DirectoryCopyFlags.Attributes = DirectoryCopyFlags.GetItemChecked(i); break; case 2: ProfileManager.CurrentProfile.DirectoryCopyFlags.TimeStamps = DirectoryCopyFlags.GetItemChecked(i); break; case 3: ProfileManager.CurrentProfile.DirectoryCopyFlags.Security = DirectoryCopyFlags.GetItemChecked(i); break; case 4: ProfileManager.CurrentProfile.DirectoryCopyFlags.Owner = DirectoryCopyFlags.GetItemChecked(i); break; case 5: ProfileManager.CurrentProfile.DirectoryCopyFlags.Auditing = DirectoryCopyFlags.GetItemChecked(i); break; } } }
internal string Parse() { var version = VersionManager.Version; var options = new StringBuilder(); // Set Source, Destination and FileFilter options.Append($"\"{Source}\" "); options.Append($"\"{Destination}\" "); options.Append($"\"{FileFilter}\" "); #region Set Options var cleanedCopyFlags = CopyFlags.CleanOptionInput(); var cleanedDirectoryCopyFlags = DirectoryCopyFlags.CleanOptionInput(); if (!string.IsNullOrWhiteSpace(cleanedCopyFlags)) { options.Append(string.Format(COPY_FLAGS, cleanedCopyFlags)); } if (!string.IsNullOrWhiteSpace(cleanedDirectoryCopyFlags)) { options.Append(string.Format(DIRECTORY_COPY_FLAGS, cleanedDirectoryCopyFlags)); } if (CopySubdirectories) { options.Append(COPY_SUBDIRECTORIES); } if (CopySubdirectoriesIncludingEmpty) { options.Append(COPY_SUBDIRECTORIES_INCLUDING_EMPTY); } if (Depth > 0) { options.Append(string.Format(DEPTH, Depth)); } if (EnableRestartMode) { options.Append(ENABLE_RESTART_MODE); } if (EnableBackupMode) { options.Append(ENABLE_BACKUP_MODE); } if (EnableRestartModeWithBackupFallback) { options.Append(ENABLE_RESTART_MODE_WITH_BACKUP_FALLBACK); } if (UseUnbufferedIo && version >= 6.2) { options.Append(USE_UNBUFFERED_IO); } if (EnableEfsRawMode) { options.Append(ENABLE_EFSRAW_MODE); } if (CopyFilesWithSecurity) { options.Append(COPY_FILES_WITH_SECURITY); } if (CopyAll) { options.Append(COPY_ALL); } if (RemoveFileInformation) { options.Append(REMOVE_FILE_INFORMATION); } if (FixFileSecurityOnAllFiles) { options.Append(FIX_FILE_SECURITY_ON_ALL_FILES); } if (FixFileTimesOnAllFiles) { options.Append(FIX_FILE_TIMES_ON_ALL_FILES); } if (Purge) { options.Append(PURGE); } if (Mirror) { options.Append(MIRROR); } if (MoveFiles) { options.Append(MOVE_FILES); } if (MoveFilesAndDirectories) { options.Append(MOVE_FILES_AND_DIRECTORIES); } if (!string.IsNullOrWhiteSpace(AddAttributes)) { options.Append(string.Format(ADD_ATTRIBUTES, AddAttributes.CleanOptionInput())); } if (!string.IsNullOrWhiteSpace(RemoveAttributes)) { options.Append(string.Format(REMOVE_ATTRIBUTES, RemoveAttributes.CleanOptionInput())); } if (CreateDirectoryAndFileTree) { options.Append(CREATE_DIRECTORY_AND_FILE_TREE); } if (FatFiles) { options.Append(FAT_FILES); } if (TurnLongPathSupportOff) { options.Append(TURN_LONG_PATH_SUPPORT_OFF); } if (MonitorSourceChangesLimit > 0) { options.Append(string.Format(MONITOR_SOURCE_CHANGES_LIMIT, MonitorSourceChangesLimit)); } if (MonitorSourceTimeLimit > 0) { options.Append(string.Format(MONITOR_SOURCE_TIME_LIMIT, MonitorSourceTimeLimit)); } if (!string.IsNullOrWhiteSpace(RunHours)) { options.Append(string.Format(RUN_HOURS, RunHours.CleanOptionInput())); } if (CheckPerFile) { options.Append(CHECK_PER_FILE); } if (InterPacketGap > 0) { options.Append(string.Format(INTER_PACKET_GAP, InterPacketGap)); } if (CopySymbolicLink) { options.Append(COPY_SYMBOLIC_LINK); } if (MultiThreadedCopiesCount > 0) { options.Append(string.Format(MULTITHREADED_COPIES_COUNT, MultiThreadedCopiesCount)); } if (DoNotCopyDirectoryInfo && version >= 6.2) { options.Append(DO_NOT_COPY_DIRECTORY_INFO); } if (DoNotUseWindowsCopyOffload && version >= 6.2) { options.Append(DO_NOT_USE_WINDOWS_COPY_OFFLOAD); } #endregion Set Options return(options.ToString()); }
private void SettingsForm_Load(object sender, EventArgs e) { ProfileName.Text = ProfileManager.CurrentName; FileFilter.Text = ProfileManager.CurrentProfile.FileFilter; EnableRestartMode.Checked = ProfileManager.CurrentProfile.EnableRestartMode; EnableBackupMode.Checked = ProfileManager.CurrentProfile.EnableBackupMode; UseUnbufferedIo.Checked = ProfileManager.CurrentProfile.UseUnbufferedIo; if (ProfileManager.CurrentProfile.Mirror) { Mirror.Checked = true; CopySubdirectories.Checked = true; CopySubdirectoriesIncludingEmpty.Checked = true; Purge.Checked = true; CopySubdirectories.Enabled = false; CopySubdirectoriesIncludingEmpty.Enabled = false; Purge.Enabled = false; } else { CopySubdirectories.Checked = ProfileManager.CurrentProfile.CopySubdirectories; CopySubdirectoriesIncludingEmpty.Checked = ProfileManager.CurrentProfile.CopySubdirectoriesIncludingEmpty; Purge.Checked = ProfileManager.CurrentProfile.Purge; } Depth.Value = ProfileManager.CurrentProfile.Depth; MoveFiles.Checked = ProfileManager.CurrentProfile.MoveFiles; MoveFilesAndDirectories.Checked = ProfileManager.CurrentProfile.MoveFilesAndDirectories; CreateDirectoryAndFileTree.Checked = ProfileManager.CurrentProfile.CreateDirectoryAndFileTree; FatFiles.Checked = ProfileManager.CurrentProfile.FatFiles; TurnLongPathSupportOff.Checked = ProfileManager.CurrentProfile.TurnLongPathSupportOff; CopySymbolicLink.Checked = ProfileManager.CurrentProfile.CopySymobolicLink; DoNotUseWindowsCopyOffload.Checked = ProfileManager.CurrentProfile.DoNotUseWindowsCopyOffload; CheckPerFile.Checked = ProfileManager.CurrentProfile.CheckPerFile; if (ProfileManager.CurrentProfile.EnableEfsRawMode || ProfileManager.CurrentProfile.InterPacketGap > 0) { UseEfwRawMode.Checked = ProfileManager.CurrentProfile.EnableEfsRawMode; InterPacketGap.Value = ProfileManager.CurrentProfile.InterPacketGap; MultiThreadedCopies.Enabled = false; } else if (ProfileManager.CurrentProfile.MultiThreadedCopiesCount > 0) { MultiThreadedCopies.Value = ProfileManager.CurrentProfile.MultiThreadedCopiesCount; UseEfwRawMode.Enabled = false; InterPacketGap.Enabled = false; } RetryCount.Value = ProfileManager.CurrentProfile.RetryCount; RetryWaitTime.Value = ProfileManager.CurrentProfile.RetryWaitTime; // File Copy Flags if (ProfileManager.CurrentProfile.FileCopyFlags.Data) { FileCopyFlags.SetItemChecked(0, true); } if (ProfileManager.CurrentProfile.FileCopyFlags.Attributes) { FileCopyFlags.SetItemChecked(1, true); } if (ProfileManager.CurrentProfile.FileCopyFlags.TimeStamps) { FileCopyFlags.SetItemChecked(2, true); } if (ProfileManager.CurrentProfile.FileCopyFlags.Security) { FileCopyFlags.SetItemChecked(3, true); } if (ProfileManager.CurrentProfile.FileCopyFlags.Owner) { FileCopyFlags.SetItemChecked(4, true); } if (ProfileManager.CurrentProfile.FileCopyFlags.Auditing) { FileCopyFlags.SetItemChecked(5, true); } // Directory Copy Flags if (ProfileManager.CurrentProfile.DirectoryCopyFlags.Data) { DirectoryCopyFlags.SetItemChecked(0, true); } if (ProfileManager.CurrentProfile.DirectoryCopyFlags.Attributes) { DirectoryCopyFlags.SetItemChecked(1, true); } if (ProfileManager.CurrentProfile.DirectoryCopyFlags.TimeStamps) { DirectoryCopyFlags.SetItemChecked(2, true); } // Add Attributes if (ProfileManager.CurrentProfile.AddAttributes.ReadOnly) { AddAttributes.SetItemChecked(0, true); } if (ProfileManager.CurrentProfile.AddAttributes.Archive) { AddAttributes.SetItemChecked(1, true); } if (ProfileManager.CurrentProfile.AddAttributes.System) { AddAttributes.SetItemChecked(2, true); } if (ProfileManager.CurrentProfile.AddAttributes.Hidden) { AddAttributes.SetItemChecked(3, true); } if (ProfileManager.CurrentProfile.AddAttributes.Compressed) { AddAttributes.SetItemChecked(4, true); } if (ProfileManager.CurrentProfile.AddAttributes.NotContentIndexed) { AddAttributes.SetItemChecked(5, true); } if (ProfileManager.CurrentProfile.AddAttributes.Encrypted) { AddAttributes.SetItemChecked(6, true); } if (ProfileManager.CurrentProfile.AddAttributes.Temporary) { AddAttributes.SetItemChecked(7, true); } if (ProfileManager.CurrentProfile.AddAttributes.Offline) { AddAttributes.SetItemChecked(8, true); } // Remove Attributes if (ProfileManager.CurrentProfile.RemoveAttributes.ReadOnly) { RemoveAttributes.SetItemChecked(0, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Archive) { RemoveAttributes.SetItemChecked(1, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.System) { RemoveAttributes.SetItemChecked(2, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Hidden) { RemoveAttributes.SetItemChecked(3, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Compressed) { RemoveAttributes.SetItemChecked(4, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.NotContentIndexed) { RemoveAttributes.SetItemChecked(5, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Encrypted) { RemoveAttributes.SetItemChecked(6, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Temporary) { RemoveAttributes.SetItemChecked(7, true); } if (ProfileManager.CurrentProfile.RemoveAttributes.Offline) { RemoveAttributes.SetItemChecked(8, true); } // Events EnableRestartMode.CheckedChanged += new EventHandler(EnableRestartMode_CheckedChanged); EnableBackupMode.CheckedChanged += new EventHandler(EnableBackupMode_CheckedChanged); UseEfwRawMode.CheckedChanged += new EventHandler(UseEfwRawMode_CheckedChanged); UseUnbufferedIo.CheckedChanged += new EventHandler(UseUnbufferedIo_CheckedChanged); CopySubdirectoriesIncludingEmpty.CheckedChanged += new EventHandler(CopySubdirectoriesIncludingEmpty_CheckedChanged); Purge.CheckedChanged += new EventHandler(Purge_CheckedChanged); CopySubdirectories.CheckedChanged += new EventHandler(CopySubdirectories_CheckedChanged); Mirror.CheckedChanged += new EventHandler(Mirror_CheckedChanged); FileFilter.TextChanged += new EventHandler(FileFilter_TextChanged); RemoveAttributes.SelectedValueChanged += new EventHandler(RemoveAttributes_SelectedValueChanged); AddAttributes.SelectedValueChanged += new EventHandler(AddAttributes_SelectedValueChanged); DirectoryCopyFlags.SelectedValueChanged += new EventHandler(DirectoryCopyFlags_SelectedValueChanged); FileCopyFlags.SelectedValueChanged += new EventHandler(FileCopyFlags_SelectedValueChanged); CheckPerFile.CheckedChanged += new EventHandler(CheckPerFile_CheckedChanged); InterPacketGap.ValueChanged += new EventHandler(InterPacketGap_ValueChanged); MultiThreadedCopies.ValueChanged += new EventHandler(MultiThreadedCopies_ValueChanged); DoNotUseWindowsCopyOffload.CheckedChanged += new EventHandler(DoNotUseWindowsCopyOffload_CheckedChanged); CopySymbolicLink.CheckedChanged += new EventHandler(CopySymbolicLink_CheckedChanged); TurnLongPathSupportOff.CheckedChanged += new EventHandler(TurnLongPathSupportOff_CheckedChanged); FatFiles.CheckedChanged += new EventHandler(FatFiles_CheckedChanged); UseEfwRawMode.CheckedChanged += new EventHandler(UseEfwRawMode_CheckedChanged); CreateDirectoryAndFileTree.CheckedChanged += new EventHandler(CreateDirectoryAndFileTree_CheckedChanged); MoveFilesAndDirectories.CheckedChanged += new EventHandler(MoveFilesAndDirectories_CheckedChanged); MoveFiles.CheckedChanged += new EventHandler(MoveFiles_CheckedChanged); Depth.ValueChanged += new EventHandler(Depth_ValueChanged); RetryCount.ValueChanged += new EventHandler(RetryCount_ValueChanged); RetryWaitTime.ValueChanged += new EventHandler(RetryWaitTime_ValueChanged); }