Inheritance: IWipeObject
        private unsafe void StatusDialog_Load(object sender, EventArgs e)
        {
            // read data from file mapping
            long handle;
            string[] args = Environment.GetCommandLineArgs();

            if(args.Length < 2) {
                this.Close();
            }

            if(long.TryParse(args[1], out handle) == false) {
                this.Close();
            }

            IntPtr view = MapViewOfFile((IntPtr)handle, SECTION_MAP_READ, 0, 0, IntPtr.Zero);
            SDHeader header;
            int position = 0;

            // error
            if(view == IntPtr.Zero) {
                this.Close();
                return;
            }

            try {
                header = (SDHeader)Marshal.PtrToStructure(view, typeof(SDHeader));
                operationType = header.OperationType;
                position += header.Size;

                // move operation, get drop folder
                if(operationType == MOVE_OPERATION) {
                    moveFolder = header.data1;
                }

                // get wipe objects
                for(int i = 0; i < header.ObjectCount; i++) {
                    string path;
                    SDObject obj = (SDObject)Marshal.PtrToStructure((IntPtr)(view.ToInt64() + position), typeof(SDObject));
                    path = Marshal.PtrToStringUni((IntPtr)(view.ToInt64() + position + obj.PathOffset));
                    position += obj.Size;

                    if(obj.ObjectType == OBJECT_TYPE_FILE) {
                        FileWipeObject file = new FileWipeObject();
                        file.Path = path;
                        file.WipeMethodId = WipeOptions.DefaultWipeMethod;

                        // add to wipe list
                        session.Items.Add(file);

                        if(operationType == MOVE_OPERATION) {
                            // add to copy list
                            FileCopyItem item = FileCopyItem.MoveToFolder(path, moveFolder);

                            if(item != null) {
                                fileCopy.Items.Add(item);
                            }
                        }
                    }
                    else if(obj.ObjectType == OBJECT_TYPE_FOLDER) {
                        FolderWipeObject folder = new FolderWipeObject();
                        folder.Path = path;
                        folder.DeleteFolders = true;
                        folder.WipeSubfolders = true;
                        folder.UseMask = false;
                        folder.UseRegex = false;
                        folder.WipeMethodId = WipeOptions.DefaultWipeMethod;
                        session.Items.Add(folder);

                        if(operationType == MOVE_OPERATION) {
                            // add to copy list
                            FolderCopyItem item = FolderCopyItem.MoveToFolder(path, moveFolder, true);

                            if(item != null) {
                                fileCopy.Items.Add(item);
                            }
                        }
                    }
                }
            }
            finally {
                // cleanup
                UnmapViewOfFile(view);
                CloseHandle((IntPtr)handle);
            }

            // start
            if(operationType == MOVE_OPERATION) {
                // copy data first
                StartCopy();
            }
            else {
                // start wipe directly
                StartWipe();
            }
        }
        public void InsertFile(string path)
        {
            if(_logger != null && _testMode) {
                _logger.LogMethodCall(path);
            }

            if(_session == null || _afterWipe) {
                return;
            }

            FileWipeObject file = new FileWipeObject();
            file.Path = path;
            file.WipeMethodId = WipeOptions.DefaultWipeMethod;

            // add to the list
            _session.BridgeItems.Add(file);

            // report to session
            if(reportActions) {
                ActionErrorReporter.ReportError(_session, _afterWipe, ErrorSeverity.Low, FileInsertOperation, path);
            }
        }
Beispiel #3
0
 public void DisposeTool()
 {
     _file = null;
     FileTextbox.Text = string.Empty;
     MethodChangeButton.Enabled = false;
     SaveButton.Enabled = false;
     BrowseButton.Enabled = false;
 }
Beispiel #4
0
        public void AddFile(string file)
        {
            Debug.AssertNotNull(file, "File is null");

            FileWipeObject fileObject = new FileWipeObject();
            fileObject.Path = file;

            // set default options
            fileObject.WipeMethodId = WipeOptions.DefaultWipeMethod;
            _session.Items.Add(fileObject);
            InsertObject(fileObject);
        }