public void LoadFrom(IErasureTarget target)
        {
            FolderErasureTarget folder = target as FolderErasureTarget;

            if (folder == null)
            {
                throw new ArgumentException("The provided erasure target type is not " +
                                            "supported by this configurer.");
            }

            folderPath.Text      = folder.Path;
            folderInclude.Text   = folder.IncludeMask;
            folderExclude.Text   = folder.ExcludeMask;
            folderDelete.Checked = folder.DeleteIfEmpty;
        }
예제 #2
0
        public ICollection <IErasureTarget> ProcessArgument(DragEventArgs e)
        {
            List <string> files = e.Data.GetDataPresent(DataFormats.FileDrop) ?
                                  new List <string>((string[])e.Data.GetData(DataFormats.FileDrop, false)) :
                                  new List <string>();

            List <IErasureTarget> result = new List <IErasureTarget>();

            foreach (string file in files)
            {
                if (Directory.Exists(file))
                {
                    FolderErasureTarget target = new FolderErasureTarget();
                    target.Path = file;
                    result.Add(target);
                }
            }

            return(result);
        }
        public bool SaveTo(IErasureTarget target)
        {
            FolderErasureTarget folder = target as FolderErasureTarget;

            if (folder == null)
            {
                throw new ArgumentException("The provided erasure target type is not " +
                                            "supported by this configurer.");
            }

            if (folderPath.Text.Length == 0)
            {
                errorProvider.SetError(folderPath, S._("Invalid folder path"));
                return(false);
            }

            folder.Path          = folderPath.Text;
            folder.IncludeMask   = folderInclude.Text;
            folder.ExcludeMask   = folderExclude.Text;
            folder.DeleteIfEmpty = folderDelete.Checked;
            return(true);
        }