Changeset 2230


Ignore:
Timestamp:
08/04/10 03:06:57 (4 years ago)
Author:
lowjoel
Message:

Implemented secure move from the command line: it can be invoked using the move=<source>|<target> notation, where the move command is optional (pipes are fine)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.DefaultPlugins/ErasureTargets/SecureMoveErasureTargetConfigurer.cs

    r2118 r2230  
    2929using System.Windows.Forms; 
    3030using System.IO; 
     31using System.Text.RegularExpressions; 
    3132 
    3233using Eraser.Manager; 
     
    8384        public bool ProcessArgument(string argument) 
    8485        { 
    85             throw new NotImplementedException(); 
     86            //The secure move source and target, which are separated by a pipe. 
     87            Regex regex = new Regex("(move=)?(?<source>.*)\\|(?<target>.*)", 
     88                RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.RightToLeft); 
     89            Match match = regex.Match(argument); 
     90 
     91            if (match.Groups["source"].Success && match.Groups["target"].Success) 
     92            { 
     93                //Get the source and destination paths 
     94                fromTxt.Text = match.Groups["source"].Value; 
     95                toTxt.Text = match.Groups["target"].Value; 
     96 
     97                //Check the folder radio button if the source is a folder. 
     98                moveFileRadio.Checked = !( 
     99                    moveFolderRadio.Checked = Directory.Exists(fromTxt.Text)); 
     100                return true; 
     101            } 
     102 
     103            return false; 
    86104        } 
    87105 
Note: See TracChangeset for help on using the changeset viewer.