예제 #1
0
        // Adds label to RequestQueueView
        private void AddLabelToRequestQueueView(EncryptionRequest request)
        {
            var label = new Label
            {
                Content = request.FileLocation
            };

            RequestQueueView.Children.Add(label);
        }
예제 #2
0
        private void DragStackPanel_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                // Get all files
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                // Push to queue
                foreach (var file in files)
                {
                    var request = new EncryptionRequest(file, GetKey());
                    // Add to queue
                    EncryptorManager.RequestEncrypt(request);

                    // Add a label
                    AddLabelToRequestQueueView(request);
                }
            }
        }
예제 #3
0
        // Take a request and manage its execution
        // Returns exit code indicating success of operation
        private static int ExecuteSingleEncryption(EncryptionRequest request)
        {
            // Expected arguments
            string[] arguments = { "-key", request.Key, request.FileLocation };

            // Standard process properties
            ProcessStartInfo setup = new ProcessStartInfo
            {
                FileName  = EXECUTABLE_FILE,
                Arguments = string.Join(" ", arguments),
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                UseShellExecute        = false,
                CreateNoWindow         = true
            };

            // Start VFAES
            var process = System.Diagnostics.Process.Start(setup);

            // Wait for exit and return success
            process.WaitForExit();

            return(process.ExitCode);
        }
예제 #4
0
 // Add an encryption request
 public static void RequestEncrypt(EncryptionRequest request)
 {
     RequestQueue.Add(request);
 }