예제 #1
0
파일: KeyMgm.cs 프로젝트: Rrego6/Pass4Win
        /// <summary>
        /// Adds a key to a selected directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            KeySelect newKeySelect = new KeySelect();

            if (newKeySelect.ShowDialog() == DialogResult.OK)
            {
                if (listBox1.Items[0].ToString() == Strings.Error_keys_set)
                {
                    listBox1.Items.Clear();
                }
                listBox1.Items.Add(newKeySelect.gpgkey);
                string tmpFile = Path.GetDirectoryName(frmMain.cfg["PassDirectory"]) + "\\" + treeView1.SelectedNode.FullPath + "\\.gpg-id";
                using (StreamWriter w = new StreamWriter(tmpFile))
                {
                    foreach (var line in listBox1.Items)
                    {
                        w.WriteLine(line.ToString());
                    }
                }

                DirectoryInfo path = new DirectoryInfo(Path.GetDirectoryName(frmMain.cfg["PassDirectory"]) + "\\" + treeView1.SelectedNode.FullPath);

                foreach (var ffile in path.GetFiles())
                {
                    if (!ffile.Name.StartsWith("."))
                    {
                        recrypt(ffile.FullName);
                    }
                }

                ScanDirectory(path);
            }
            newKeySelect.Close();
        }
예제 #2
0
        /// <summary>
        ///     Inits the repo, gpg etc
        /// </summary>
        public FrmMain(FileSystemInterface fileSystemInterface, KeySelect keySelect, ConfigHandling config)
        {
            log.Debug("Init variables");
            fsi        = fileSystemInterface;
            _keySelect = keySelect;
            _config    = config;
            InitializeComponent();
            toolStripStatusLabel1.Text = "";

            log.Debug("init Bugsnag");
            var bugsnag = new BaseClient("23814316a6ecfe8ff344b6a467f07171");

            this.enableTray = false;

            // Getting actual version
            log.Debug("Getting program version");
            var assembly = Assembly.GetExecutingAssembly();
            var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version  = fvi.FileVersion;

            _config["version"] = version.Remove(5);
            Text = @"Pass4Win " + Strings.Version + @" " + _config["version"];
            // check config input
            log.Debug("Checking config validity");
            try
            {
                bool ChkBool = Directory.Exists(_config["PassDirectory"]);
                if (!ChkBool)
                {
                    throw new Exception("Pass directory fail");
                }
                ChkBool = File.Exists(_config["GPGEXE"]);
                if (!ChkBool)
                {
                    throw new Exception("GPG location fail");
                }
                if (_config["UseGitRemote"] || _config["ExternalGit"])
                {
                    // nobody cares, we want the exception and it's auto generated due to a null value or not a boolean
                }
            }
            catch
            {
                // no matter if it's a first run or a corrupt entry, let them fix it.
                log.Debug("Config corrupt or first run");
                _config["FirstRun"] = true;
                Program.Scope.Resolve <FrmConfig>().ShowDialog();
            }

            // checking for update in the background
            log.Debug("Checking online for latest release");
            LatestPass4WinRelease();

            // making new git object
            if (_config["ExternalGit"])
            {
                log.Debug("Using an external git executable");
                GitRepo = new GitHandling(_config["PassDirectory"], _config["GitRemote"], _config["ExternalGitLocation"]);
            }
            else
            {
                log.Debug("Using the internal git executable");
                GitRepo = new GitHandling(_config["PassDirectory"], _config["GitRemote"]);
            }

            //checking git status
            if (_config["UseGitRemote"] == true || _config["ExternalGit"])
            {
                if (GitRepo.ConnectToRepo() || (_config["ExternalGit"]))
                {
                    log.Debug("Remote Git is valid and active");
                    this.gitRepoOffline      = false;
                    toolStripOffline.Visible = false;
                    if (!GitRepo.Fetch(_config["GitUser"], DecryptConfig(_config["GitPass"], "pass4win")))
                    {
                        // Something failed which shouldn't fail, rechecking online status
                        CheckOnline(false);
                    }
                }
                // checking if we can clone, otherwise make a new one
                else if (!GitRepo.GitClone(_config["GitUser"], DecryptConfig(_config["GitPass"], "pass4win")))
                {
                    log.Debug("Making a new git repo");
                    Repository.Init(_config["PassDirectory"], false);
                    GitRepo.ConnectToRepo();
                    toolStripOffline.Visible = true;
                }
            }
            // no connection, no repo. So make a new one
            else if (!GitHandling.IsValid(_config["PassDirectory"]))
            {
                log.Debug("Making a new git repo");
                Repository.Init(_config["PassDirectory"], false);
                GitRepo.ConnectToRepo();
                toolStripOffline.Visible = true;
            }

            // Init GPG if needed
            string gpgfile = _config["PassDirectory"];

            gpgfile += "\\.gpg-id";
            // Check if we need to init the directory
            if (!File.Exists(gpgfile))
            {
                log.Debug("Creating .gpg-id");
                // ReSharper disable once AssignNullToNotNullAttribute
                Directory.CreateDirectory(Path.GetDirectoryName(gpgfile));
                if (_keySelect.ShowDialog() == DialogResult.OK)
                {
                    using (var w = new StreamWriter(gpgfile))
                    {
                        w.Write(_keySelect.Gpgkey);
                    }

                    if (!GitRepo.Commit(gpgfile))
                    {
                        MessageBox.Show(
                            Strings.FrmMain_EncryptCallback_Commit_failed_,
                            Strings.Error,
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    _keySelect.Close();
                    MessageBox.Show(Strings.Error_nokey, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(1);
                }
            }
            // Setting the exe location for the GPG Dll
            GpgInterface.ExePath = _config["GPGEXE"];

            // Fill tree
            CreateNodes();

            this.enableTray = true;
        }
예제 #3
0
파일: Main.cs 프로젝트: bazmecode/Pass4Win
        /// <summary>
        ///     Inits the repo, gpg etc
        /// </summary>
        public FrmMain()
        {
            InitializeComponent();
            toolStripStatusLabel1.Text = "";

            // ReSharper disable once UnusedVariable
            var bugsnag = new BaseClient("23814316a6ecfe8ff344b6a467f07171");

            this.enableTray = false;

            // Getting actual version
            var assembly = Assembly.GetExecutingAssembly();
            var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version = fvi.FileVersion;
            Cfg["version"] = version.Remove(5, 2);

            Text = @"Pass4Win " + Strings.Version + @" " + Cfg["version"];


            // checking for update this an async operation
#pragma warning disable 4014
            LatestPass4WinRelease();
#pragma warning restore 4014

            // Do we have a valid password store and settings
            try
            {
                if (Cfg["PassDirectory"] == "")
                {
                    // this will fail, I know ugly hack
                }
            }
            catch (Exception)
            {
                Cfg["FirstRun"] = true;
                var config = new FrmConfig();
                config.ShowDialog();
            }
            //checking git status
            if (!IsValid(Cfg["PassDirectory"]))
            {
                // Remote or generate a new one
                if (Cfg["UseGitRemote"] == true)
                {
                    // check if server is alive
                    if (IsGitAlive(Cfg["UseGitRemote"]) || IsHttpsAlive(Cfg["UseGitRemote"]))
                    {
                        // clone the repo and catch any error
                        try
                        {
                            Clone(Cfg["GitRemote"], Cfg["PassDirectory"],
                                new CloneOptions
                                {
                                    CredentialsProvider = (url, user, cred) => new UsernamePasswordCredentials
                                    {
                                        Username = Cfg["GitUser"],
                                        Password = DecryptConfig(Cfg["GitPass"], "pass4win")
                                    }
                                });
                        }
                        catch (Exception)
                        {
                            MessageBox.Show(Strings.Error_connection, Strings.Error, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                            this.toolStripOffline.Visible = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(Strings.Error_git_unreachable, Strings.Error, MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                        toolStripOffline.Visible = true;
                    }
                }
                else
                {
                    // creating new Git
                    Repository.Init(Cfg["PassDirectory"], false);
                    toolStripOffline.Visible = true;
                }
            }
            else
            {
                // Do we do remote or not
                CheckOnline(true);
            }

            // Making sure core.autocrlf = true
            using (var repo = new Repository(Cfg["PassDirectory"]))
            {
                repo.Config.Set("core.autocrlf", true);
            }

            // Init GPG if needed
            string gpgfile = Cfg["PassDirectory"];
            gpgfile += "\\.gpg-id";
            // Check if we need to init the directory
            if (!File.Exists(gpgfile))
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                Directory.CreateDirectory(Path.GetDirectoryName(gpgfile));
                var newKeySelect = new KeySelect();
                if (newKeySelect.ShowDialog() == DialogResult.OK)
                {
                    using (var w = new StreamWriter(gpgfile))
                    {
                        w.Write(newKeySelect.Gpgkey);
                    }
                    using (var repo = new Repository(Cfg["PassDirectory"]))
                    {
                        repo.Stage(gpgfile);
                        repo.Commit("gpgid added",
                            new Signature("pass4win", "pass4win", DateTimeOffset.Now),
                            new Signature("pass4win", "pass4win", DateTimeOffset.Now));
                    }
                }
                else
                {
                    newKeySelect.Close();
                    MessageBox.Show(Strings.Error_nokey, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(1);
                }
            }
            // Setting the exe location for the GPG Dll
            GpgInterface.ExePath = Cfg["GPGEXE"];

            // init FileSystemInterface class
            fsi = new FileSystemInterface(Cfg["PassDirectory"]);

            // Fill tree
            CreateNodes();
    
            this.enableTray = true;
        }
예제 #4
0
        /// <summary>
        /// Adds a key to a selected directory
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            KeySelect newKeySelect = new KeySelect();
            if (newKeySelect.ShowDialog() == DialogResult.OK)
            {
                if (listBox1.Items[0].ToString() == Strings.Error_keys_set)
                    listBox1.Items.Clear();
                listBox1.Items.Add(newKeySelect.Gpgkey);
                string tmpFile = Path.GetDirectoryName(FrmMain.Cfg["PassDirectory"]) + "\\" + treeView1.SelectedNode.FullPath + "\\.gpg-id";
                using (StreamWriter w = new StreamWriter(tmpFile))
                {
                    foreach(var line in listBox1.Items){
                        w.WriteLine(line.ToString());
                    }
                }

                DirectoryInfo path = new DirectoryInfo(Path.GetDirectoryName(FrmMain.Cfg["PassDirectory"]) + "\\" + treeView1.SelectedNode.FullPath);

                foreach (var ffile in path.GetFiles())
                {
                    if (!ffile.Name.StartsWith("."))
                        Recrypt(ffile.FullName);
                }

                ScanDirectory(path);
            }
            newKeySelect.Close();
        }
예제 #5
0
파일: Main.cs 프로젝트: Rrego6/Pass4Win
        /// <summary>
        /// Inits the repo, gpg etc
        /// </summary>
        public frmMain()
        {
            InitializeComponent();

            var bugsnag = new BaseClient("23814316a6ecfe8ff344b6a467f07171");

            EnableTray = false;

            // Getting actual version
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;

            cfg["version"] = version.Remove(5, 2);

            this.Text = "Pass4Win " + Strings.Version + " " + cfg["version"];

            // checking for update this an async operation
            LatestPass4WinRelease();

            // Do we have a valid password store and settings
            try
            {
                if (cfg["PassDirectory"] == "")
                {
                    // this will fail, I know ugly hack
                }
            }
            catch
            {
                cfg["FirstRun"] = true;
                frmConfig Config       = new frmConfig();
                var       dialogResult = Config.ShowDialog();
            }
            //checking git status
            if (!LibGit2Sharp.Repository.IsValid(cfg["PassDirectory"]))
            {
                // Remote or generate a new one
                if (cfg["UseGitRemote"] == true)
                {
                    // check if server is alive
                    if (IsGITAlive(cfg["UseGitRemote"]) || IsHTTPSAlive(cfg["UseGitRemote"]))
                    {
                        // clone the repo and catch any error
                        try
                        {
                            string clonedRepoPath = LibGit2Sharp.Repository.Clone(cfg["GitRemote"], cfg["PassDirectory"], new CloneOptions()
                            {
                                CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials
                                {
                                    Username = cfg["GitUser"],
                                    Password = DecryptConfig(cfg["GitPass"], "pass4win")
                                }
                            });
                        }
                        catch
                        {
                            MessageBox.Show(Strings.Error_connection, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            toolStripOffline.Visible = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(Strings.Error_git_unreachable, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        toolStripOffline.Visible = true;
                    }
                }
                else
                {
                    // creating new Git
                    var repo = LibGit2Sharp.Repository.Init(cfg["PassDirectory"], false);
                    toolStripOffline.Visible = true;
                }
            }
            else
            {
                // Do we do remote or not
                CheckOnline(true);
            }

            // Making sure core.autocrlf = true
            using (var repo = new LibGit2Sharp.Repository(cfg["PassDirectory"]))
            {
                repo.Config.Set("core.autocrlf", true);
            }

            // Init GPG if needed
            string gpgfile = cfg["PassDirectory"];

            gpgfile += "\\.gpg-id";
            // Check if we need to init the directory
            if (!File.Exists(gpgfile))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(gpgfile));
                KeySelect newKeySelect = new KeySelect();
                if (newKeySelect.ShowDialog() == DialogResult.OK)
                {
                    using (StreamWriter w = new StreamWriter(gpgfile))
                    {
                        w.Write(newKeySelect.gpgkey);
                    }
                    using (var repo = new LibGit2Sharp.Repository(cfg["PassDirectory"]))
                    {
                        repo.Stage(gpgfile);
                        repo.Commit("gpgid added", new LibGit2Sharp.Signature("pass4win", "pass4win", System.DateTimeOffset.Now), new LibGit2Sharp.Signature("pass4win", "pass4win", System.DateTimeOffset.Now));
                    }
                }
                else
                {
                    newKeySelect.Close();
                    MessageBox.Show(Strings.Error_nokey, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    System.Environment.Exit(1);
                }
            }
            // Setting the exe location for the GPG Dll
            GpgInterface.ExePath = cfg["GPGEXE"];

            // Setting up datagrid
            dt.Columns.Add("colPath", typeof(string));
            dt.Columns.Add("colText", typeof(string));

            treeDt.Columns.Add("colPath", typeof(string));
            treeDt.Columns.Add("colText", typeof(string));

            ListDirectory(new DirectoryInfo(cfg["PassDirectory"]), "");
            fillDirectoryTree(dirTreeView, cfg["PassDirectory"]);

            dataPass.DataSource         = dt.DefaultView;
            dataPass.Columns[0].Visible = false;

            EnableTray = true;
        }
예제 #6
0
파일: Main.cs 프로젝트: shaleh/Pass4Win
        /// <summary>
        ///     Inits the repo, gpg etc
        /// </summary>
        public FrmMain(FileSystemInterface fileSystemInterface, KeySelect keySelect, ConfigHandling config)
        {
            log.Debug("Init variables");
            fsi = fileSystemInterface;
            _keySelect = keySelect;
            _config = config;
            InitializeComponent();
            toolStripStatusLabel1.Text = "";

            log.Debug("init Bugsnag");
            var bugsnag = new BaseClient("23814316a6ecfe8ff344b6a467f07171");

            this.enableTray = false;
            // Getting actual version
            log.Debug("Getting program version");
            var assembly = Assembly.GetExecutingAssembly();
            var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version = fvi.FileVersion;
            _config["version"] = version.Remove(5);
            Text = @"Pass4Win " + Strings.Version + @" " + _config["version"];
            // check config input
            log.Debug("Checking config validity");
            try
            {
                bool ChkBool = Directory.Exists(_config["PassDirectory"]);
                if (!ChkBool)
                    throw new Exception("Pass directory fail");
                ChkBool = File.Exists(_config["GPGEXE"]);
                if (!ChkBool)
                    throw new Exception("GPG location fail");
                if (_config["UseGitRemote"] || _config["ExternalGit"])
                {
                    // nobody cares, we want the exception and it's auto generated due to a null value or not a boolean
                }
            }
            catch
            {
                // no matter if it's a first run or a corrupt entry, let them fix it.
                log.Debug("Config corrupt or first run");
                _config["FirstRun"] = true;
                Program.Scope.Resolve<FrmConfig>().ShowDialog();
            }

            // checking for update in the background
            log.Debug("Checking online for latest release");
            LatestPass4WinRelease();

            // making new git object
            if (_config["ExternalGit"] && !Program.NoGit)
            {
                log.Debug("Using an external git executable");
                GitRepo = new GitHandling(_config["PassDirectory"], _config["GitRemote"], _config["ExternalGitLocation"]);
            }
            else if (!Program.NoGit)
            {
                log.Debug("Using the internal git executable");
                GitRepo = new GitHandling(_config["PassDirectory"], _config["GitRemote"]);
            }

            //checking git status
            if (_config["UseGitRemote"] == true || _config["ExternalGit"])
            {
                if (!Program.NoGit)
                {
                    if (GitRepo.ConnectToRepo() || (_config["ExternalGit"]))
                    {
                        log.Debug("Remote Git is valid and active");
                        this.gitRepoOffline = false;
                        toolStripOffline.Visible = false;
                        if (!GitRepo.Fetch(_config["GitUser"], DecryptConfig(_config["GitPass"], "pass4win")))
                        {
                            // Something failed which shouldn't fail, rechecking online status
                            CheckOnline(false);
                        }
                    }
                    // checking if we can clone, otherwise make a new one
                    else if (!GitRepo.GitClone(_config["GitUser"], DecryptConfig(_config["GitPass"], "pass4win")))
                    {
                        log.Debug("Making a new git repo");
                        Repository.Init(_config["PassDirectory"], false);
                        GitRepo.ConnectToRepo();
                        toolStripOffline.Visible = true;
                    }
                    // no connection, no repo. So make a new one
                    else if (!GitHandling.IsValid(_config["PassDirectory"]))
                    {
                        log.Debug("Making a new git repo");
                        Repository.Init(_config["PassDirectory"], false);
                        GitRepo.ConnectToRepo();
                        toolStripOffline.Visible = true;
                    }
                }
            }

            // Init GPG if needed
            string gpgfile = _config["PassDirectory"];
            gpgfile += "\\.gpg-id";
            // Check if we need to init the directory
            if (!File.Exists(gpgfile))
            {
                log.Debug("Creating .gpg-id");
                // ReSharper disable once AssignNullToNotNullAttribute
                Directory.CreateDirectory(Path.GetDirectoryName(gpgfile));
                if (_keySelect.ShowDialog() == DialogResult.OK)
                {
                    using (var w = new StreamWriter(gpgfile))
                    {
                        w.Write(_keySelect.Gpgkey);
                    }

                    if (!Program.NoGit)
                    {
                        if (!GitRepo.Commit(gpgfile))
                        {
                            MessageBox.Show(
                                Strings.FrmMain_EncryptCallback_Commit_failed_,
                                Strings.Error,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
                else
                {
                    _keySelect.Close();
                    MessageBox.Show(Strings.Error_nokey, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(1);
                }
            }
            // Setting the exe location for the GPG Dll
            GpgInterface.ExePath = _config["GPGEXE"];

            // Fill tree
            CreateNodes();

            this.enableTray = true;
        }
예제 #7
0
파일: Main.cs 프로젝트: Rrego6/Pass4Win
        /// <summary>
        /// Inits the repo, gpg etc
        /// </summary>
        public frmMain()
        {
            InitializeComponent();

            var bugsnag = new BaseClient("23814316a6ecfe8ff344b6a467f07171");

            EnableTray = false;

            // Getting actual version
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;
            cfg["version"] = version.Remove(5, 2);

            this.Text = "Pass4Win " + Strings.Version + " " + cfg["version"];

            // checking for update this an async operation
            LatestPass4WinRelease();

            // Do we have a valid password store and settings
            try
            {
                if (cfg["PassDirectory"] == "")
                {
                    // this will fail, I know ugly hack
                }
            }
            catch
            {
                cfg["FirstRun"] = true;
                frmConfig Config = new frmConfig();
                var dialogResult = Config.ShowDialog();
                
            }
            //checking git status
            if (!LibGit2Sharp.Repository.IsValid(cfg["PassDirectory"]))
            {
                // Remote or generate a new one
                if (cfg["UseGitRemote"] == true)
                {
                    // check if server is alive
                    if (IsGITAlive(cfg["UseGitRemote"]) || IsHTTPSAlive(cfg["UseGitRemote"]))
                    {
                        // clone the repo and catch any error
                        try
                        {
                            string clonedRepoPath = LibGit2Sharp.Repository.Clone(cfg["GitRemote"], cfg["PassDirectory"], new CloneOptions()
                            {
                                CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials
                                {
                                    Username = cfg["GitUser"],
                                    Password = DecryptConfig(cfg["GitPass"], "pass4win")
                                }
                            });
                        }
                        catch
                        {
                            MessageBox.Show(Strings.Error_connection, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            toolStripOffline.Visible = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(Strings.Error_git_unreachable, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        toolStripOffline.Visible = true;
                    }
                }
                else
                {
                    // creating new Git
                    var repo = LibGit2Sharp.Repository.Init(cfg["PassDirectory"], false);
                    toolStripOffline.Visible = true;
                }
            }
            else
            {
                // Do we do remote or not
                CheckOnline(true);
            }

            // Making sure core.autocrlf = true
            using (var repo = new LibGit2Sharp.Repository(cfg["PassDirectory"]))
            {
                repo.Config.Set("core.autocrlf", true);
            }

            // Init GPG if needed
            string gpgfile = cfg["PassDirectory"];
            gpgfile += "\\.gpg-id";
            // Check if we need to init the directory
            if (!File.Exists(gpgfile))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(gpgfile));
                KeySelect newKeySelect = new KeySelect();
                if (newKeySelect.ShowDialog() == DialogResult.OK)
                {
                    using (StreamWriter w = new StreamWriter(gpgfile))
                    {
                        w.Write(newKeySelect.gpgkey);
                    }
                    using (var repo = new LibGit2Sharp.Repository(cfg["PassDirectory"]))
                    {
                        repo.Stage(gpgfile);
                        repo.Commit("gpgid added", new LibGit2Sharp.Signature("pass4win", "pass4win", System.DateTimeOffset.Now), new LibGit2Sharp.Signature("pass4win", "pass4win", System.DateTimeOffset.Now));
                    }
                }
                else
                {
                    newKeySelect.Close();
                    MessageBox.Show(Strings.Error_nokey, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    System.Environment.Exit(1);
                }
            }
            // Setting the exe location for the GPG Dll
            GpgInterface.ExePath = cfg["GPGEXE"];

            // Setting up datagrid
            dt.Columns.Add("colPath", typeof(string));
            dt.Columns.Add("colText", typeof(string));

            treeDt.Columns.Add("colPath", typeof(string));
            treeDt.Columns.Add("colText", typeof(string));

            ListDirectory(new DirectoryInfo(cfg["PassDirectory"]), "");
            fillDirectoryTree(dirTreeView, cfg["PassDirectory"]);

            dataPass.DataSource = dt.DefaultView;
            dataPass.Columns[0].Visible = false;

            EnableTray = true;
        }