예제 #1
0
        public void LoadFrom(IErasureTarget target)
        {
            FileErasureTarget file = target as FileErasureTarget;

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

            filePath.Text = file.Path;
        }
예제 #2
0
        public bool SaveTo(IErasureTarget target)
        {
            FileErasureTarget file = target as FileErasureTarget;

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

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

            file.Path = filePath.Text;
            return(true);
        }
        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 (File.Exists(file))
                {
                    FileErasureTarget target = new FileErasureTarget();
                    target.Path = file;
                    result.Add(target);
                }
            }

            return(result);
        }