Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Diagnostics;
- using Iuf.Network.Authentication;
- namespace AccessPool
- {
- public partial class Form1 : Form
- {
- Impersonation UserAccess;
- Process FileProcess;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void btnButton_Click(object sender, EventArgs e)
- {
- UserAccess = new Impersonation(txtUsername.Text, txtPassword.Text, "ametikool.local");
- try
- {
- UserAccess.ImpersonateUser();
- }
- catch (Exception ImpersonateException)
- {
- MessageBox.Show(ImpersonateException.ToString());
- }
- finally
- {
- MessageBox.Show("Access granted!");
- btnOpenFile.Enabled = true;
- }
- }
- private void btnOpenFile_Click(object sender, EventArgs e)
- {
- OpenFileDialog FileDialogObject = null;
- try
- {
- FileDialogObject = new OpenFileDialog();
- FileDialogObject.ShowDialog();
- }
- catch (Exception FileDialogException)
- {
- MessageBox.Show(FileDialogException.ToString());
- return;
- }
- finally
- {
- txtFilePath.Text = FileDialogObject.FileName;
- }
- }
- private void btnRun_Click(object sender, EventArgs e)
- {
- try
- {
- FileProcess = new Process();
- FileProcess.StartInfo.FileName = txtFilePath.Text;
- FileProcess.Start();
- }
- catch (Exception FileProcessException)
- {
- MessageBox.Show(FileProcessException.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement