private void AddFiles(AddFile file)
 {
     _loadFile = file;
     if (file == AddFile.FILES)
     {
         using (OpenFileDialog opd = new OpenFileDialog()) {
             opd.Filter      = Dialogs.GetFilters(Filters.SUPPORTED_FILES);
             opd.Multiselect = false;
             if (opd.ShowDialog().Equals(DialogResult.OK))
             {
                 _directory = Path.GetDirectoryName(opd.FileName);
                 _folder    = Path.GetFileName(_directory);
                 RegConfig.Set <string>("InitialDirectory", _directory);
                 StartLoadFiles(true);
             }
         }
     }
     else
     {
         using (FolderBrowserDialog fbd = new FolderBrowserDialog()) {
             fbd.Description  = Titles.FOLDER_BROWSER;
             fbd.SelectedPath = _intialDirectory;
             if (fbd.ShowDialog().Equals(DialogResult.OK))
             {
                 _directory = fbd.SelectedPath;
                 _folder    = Path.GetFileName(_directory);
                 RegConfig.Set <string>("InitialDirectory", _directory);
                 StartLoadFiles(true);
             }
         }
     }
 }
        private void Checkboxes_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox chk = sender as CheckBox;

            if (chk != null)
            {
                if (chk.Tag != null)
                {
                    RegConfig.Set <bool>(chk.Tag.ToString(), chk.Checked);
                }
            }
        }
Exemple #3
0
        public static void CheckAssociation()
        {
            string ext    = "auudb";
            string logExt = RegConfig.Get <string>(ext);

            if (string.IsNullOrEmpty(logExt))
            {
                string logIcon = Path.Combine(Application.StartupPath, "Uploader.Database.ico");
                RegConfig.Set <string>(ext, logIcon);
                FileAssociation fa = new FileAssociation();
                fa.Extension   = ext;
                fa.ContentType = "";
                fa.Description = "App Updates Database ";
                fa.ProgramId   = Application.ProductName + "." + ext;
                fa.IconPath    = logIcon;

                fa.AddCommand("open", Application.ExecutablePath + " %1");
                fa.Create();
            }
        }
 private void InitializeSettings()
 {
     RegConfig.Set <bool>("Encrypt", _encryptContent);
     _hidePassword = RegConfig.Get <bool>("HidePassword");
     _showPanel    = RegConfig.Get <bool>("ShowPanel");
     splitContainerPwd.Panel2Collapsed = true;
     menuHidePwd.Checked    = _hidePassword;
     toolStripPwd.Visible   = menuToolbar.Checked = RegConfig.Get <bool>("Toolbar");
     statusStripPwd.Visible = menuStatus.Checked = RegConfig.Get <bool>("Statusbar");
     menuXPLook.Checked     = RegConfig.Get <bool>("XPLook");
     if (menuXPLook.Checked)
     {
         menuStrip1.RenderMode   = ToolStripRenderMode.System;
         toolStripPwd.RenderMode = ToolStripRenderMode.System;
     }
     else
     {
         menuStrip1.RenderMode   = ToolStripRenderMode.Professional;
         toolStripPwd.RenderMode = ToolStripRenderMode.Professional;
     }
 }
 private void AppyOptions()
 {
     RegConfig.Set <bool>("Encrypt", chkEncryptContent.Checked);
     RegConfig.Set <bool>("HidePassword", chkHidePassword.Checked);
     RegConfig.Set <bool>("ShowPanel", chkShowDetails.Checked);
 }
        private void Action(string tag)
        {
            switch (tag)
            {
            case "ADD":
                using (NewPasswordForm npf = new NewPasswordForm(_pwds, string.Empty)) {
                    if (npf.ShowDialog().Equals(DialogResult.OK))
                    {
                        _pwds.Add(npf.Credential);
                        InitializePasswords();
                    }
                }
                break;

            case "REMOVE":
                if (!string.IsNullOrEmpty(_selectedId))
                {
                    if (MessageBox.Show(Messages.REMOVE, "Remove Credential", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes))
                    {
                        _pwds.Delete(_selectedId);
                        InitializePasswords();
                    }
                }
                break;

            case "EDIT":
                if (!string.IsNullOrEmpty(_selectedId))
                {
                    using (NewPasswordForm npf = new NewPasswordForm(_pwds, _selectedId)) {
                        if (npf.ShowDialog().Equals(DialogResult.OK))
                        {
                            _pwds.Update(npf.Credential, _selectedId);
                            InitializePasswords();
                        }
                    }
                }
                break;

            case "CLEAR":
                if (MessageBox.Show(Messages.CLEAR, "Clear Credentials", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes))
                {
                    _pwds.ClearAll();
                    InitializePasswords();
                }
                break;

            case "COPY":
                Clipboard.SetText(string.Format("{0}\t{1}", lblUsername.Text, lblPassword.Text));
                break;

            case "COPY_USER":
                Clipboard.SetText(lblUsername.Text);
                break;

            case "COPY_PWD":
                Clipboard.SetText(lblPassword.Text);
                break;

            case "RELOAD":
                InitializePasswords();
                break;

            case "SETTINGS":
                using (OptionForm opt = new OptionForm()) {
                    opt.ShowDialog();
                    InitializeSettings();
                    InitializePasswords();
                }
                break;

            case "HELP":
                using (HelpForm h = new HelpForm()) {
                    h.ShowDialog();
                }
                break;

            case "EXIT":
                Close();
                break;

            case "ABOUT":
                using (AboutForm a = new AboutForm()) {
                    a.ShowDialog();
                }
                break;

            case "HIDEPWD":
                if (_hidePassword)
                {
                    if (MessageBox.Show(Messages.SHOW, "Show Password", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        RegConfig.Set <bool>("HidePassword", menuHidePwd.Checked);
                        _hidePassword = menuHidePwd.Checked;
                    }
                }
                else
                {
                    RegConfig.Set <bool>("HidePassword", menuHidePwd.Checked);
                    _hidePassword = menuHidePwd.Checked;
                }
                InitializePasswords();
                break;

            case "TOOLBAR":
                RegConfig.Set <bool>("Toolbar", menuToolbar.Checked);
                toolStripPwd.Visible = menuToolbar.Checked;
                break;

            case "STATUS":
                RegConfig.Set <bool>("Statusbar", menuStatus.Checked);
                statusStripPwd.Visible = menuStatus.Checked;
                break;

            case "XPLOOK":
                RegConfig.Set <bool>("XPLook", menuXPLook.Checked);
                Application.Restart();
                break;

            default:
                break;
            }
        }
        private void Action(string tag)
        {
            switch (tag)
            {
            case "NEW_PROF":
                //NewProfile();
                break;

            case "CREATE_ENV":
                using (NewEnvForm env = new NewEnvForm()) {
                    if (env.ShowDialog().Equals(DialogResult.OK))
                    {
                        // Check if exist name

                        if (_envVariables.SetEnvironmentVariable(env.EnvName, env.EnvValue))
                        {
                            using (RestartForm r = new RestartForm(env.EnvName, tag)) {
                                if (r.ShowDialog().Equals(DialogResult.OK))
                                {
                                    Application.Restart();
                                }
                                else
                                {
                                    InitEnvironmentVariables();
                                }
                            }
                        }
                    }
                }
                break;

            case "ENV_UPDATE":
                DialogResult resu = MessageBox.Show(string.Format("Are you sure you want to update {0} in environment variable?", txtEnvName.Text), "Update Environment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (resu.Equals(DialogResult.Yes))
                {
                    if (_envVariables.SetEnvironmentVariable(txtEnvName.Text, txtEnvValue.Text))
                    {
                        using (RestartForm r = new RestartForm(txtEnvName.Text, tag)) {
                            if (r.ShowDialog().Equals(DialogResult.OK))
                            {
                                InitEnvironmentVariables();
                            }
                        }
                    }
                }
                break;

            case "ENV_DELETE":
                DialogResult resd = MessageBox.Show(string.Format("Are you sure you want to delete {0} in environment variable?", txtEnvName.Text), "Delete Environment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (resd.Equals(DialogResult.Yes))
                {
                    if (_envVariables.DeleteEnvironmentVariable(txtEnvName.Text))
                    {
                        using (RestartForm r = new RestartForm(txtEnvName.Text, tag)) {
                            if (r.ShowDialog().Equals(DialogResult.OK))
                            {
                                InitEnvironmentVariables();
                            }
                        }
                    }
                }
                break;

            case "FIND":
                break;

            case "SAVE":
                if (_isLoading)
                {
                    return;
                }
                using (NewArchive na = new NewArchive()) {
                    if (na.ShowDialog().Equals(DialogResult.OK))
                    {
                    }
                }
                break;

            case "ADD_FILE":
                AddFiles(AddFile.FILES);
                break;

            case "ADD_FOLDER":
                AddFiles(AddFile.FOLDER);
                break;

            case "REFRESH":
                InitWorkspace();
                break;

            case "SERVER_CONFIG":
            case "OPTIONS":
                using (ConfigServerForm config = new ConfigServerForm(tag.Equals("SERVER_CONFIG") ? 1 : 0)) {
                    if (config.ShowDialog().Equals(DialogResult.OK))
                    {
                        InitSettings();
                    }
                }
                break;

            case "EXIT":
                Close();
                break;

            case "ABOUT":
                using (AboutForm about = new AboutForm()) {
                    about.ShowDialog();
                }
                break;

            case "HELP":
                using (HelpForm help = new HelpForm()) {
                    help.ShowDialog();
                }
                break;

            case "TOOLBAR":
                RegConfig.Set <bool>("Toolbar", hideToolbarToolStripMenuItem.Checked);
                toolStripUploader.Visible = hideToolbarToolStripMenuItem.Checked;
                break;

            case "STATUSBAR":
                RegConfig.Set <bool>("Statusbar", hideStatusbarToolStripMenuItem.Checked);
                statusStripUploader.Visible = hideStatusbarToolStripMenuItem.Checked;
                break;

            case "PROFILE_DETAILS":
                break;

            case "PROFILE_EXPLORER":
                RegConfig.Set <bool>("ProfileExplorer", profileExplorerToolStripMenuItem.Checked);
                splitContainer1.Panel1Collapsed = !profileExplorerToolStripMenuItem.Checked;
                break;

            case "LOGS":
                RegConfig.Set <bool>("Logs&Details", logsToolStripMenuItem.Checked);
                splitContainer2.Panel2Collapsed = !logsToolStripMenuItem.Checked;
                break;

            case "CLEAR_WORKSPACE":
                if (_archives != null)
                {
                    if (MessageBox.Show("Workspace will be deleted permanently!\nAre you sure you want to clear all workspace?", "Clear Workspace", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        List <Archive> ws = _archives.GetProfiles();
                        if (ws.Count > 0)
                        {
                            foreach (Archive w in ws)
                            {
                            }
                        }
                        _archives.ClearWorkspaces();
                        InitWorkspace();
                    }
                }
                break;

            case "CLEAR_LOGS":
                if (_logs != null)
                {
                    if (MessageBox.Show("Logs will be deleted permanently!\nAre you sure you want to clear all logs?", "Clear Logs", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        _logs.ClearAllLog();
                        _logs.Initialize(logsListBox);
                    }
                }
                break;

            case "CLEAR_HISTORY":
                if (_selectedArchive != null)
                {
                    if (MessageBox.Show("History will be deleted permanently!\nAre you sure you want to clear all history?", "Clear History", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                    }
                }
                break;

            case "SOURCE_EXT":
            case "SOURCE_FOLDER":

                break;

            default:
                break;
            }
        }
        private void Action(string tag)
        {
            switch (tag)
            {
            case "NEW_PROF":
                //NewProfile();
                break;

            case "SAVE_PROF":
                SaveProfile();
                break;

            case "ADD_FILES":
                AddFiles(AddFile.FILES);
                break;

            case "ADD_FOLDER":
                AddFiles(AddFile.FOLDER);
                break;

            case "REFRESH":
                InitWorkspace();
                InitHistory(_workspaceTable);
                break;

            case "UNBIND":
                Unbind();
                break;

            case "SERVER_CONFIG":
            case "OPTIONS":
                using (ConfigServerForm config = new ConfigServerForm(tag.Equals("SERVER_CONFIG") ? 1 : 0)) {
                    if (config.ShowDialog().Equals(DialogResult.OK))
                    {
                        InitSettings();
                    }
                }
                break;

            case "EXIT":
                Close();
                break;

            case "ABOUT":
                using (AboutForm about = new AboutForm()) {
                    about.ShowDialog();
                }
                break;

            case "HELP":
                using (HelpForm help = new HelpForm()) {
                    help.ShowDialog();
                }
                break;

            case "TOOLBAR":
                RegConfig.Set <bool>("Toolbar", hideToolbarToolStripMenuItem.Checked);
                toolStripUploader.Visible = hideToolbarToolStripMenuItem.Checked;
                break;

            case "STATUSBAR":
                RegConfig.Set <bool>("Statusbar", hideStatusbarToolStripMenuItem.Checked);
                statusStripUploader.Visible = hideStatusbarToolStripMenuItem.Checked;
                break;

            case "PROFILE_DETAILS":
                break;

            case "PROFILE_EXPLORER":
                RegConfig.Set <bool>("ProfileExplorer", profileExplorerToolStripMenuItem.Checked);
                splitContainer1.Panel1Collapsed = !profileExplorerToolStripMenuItem.Checked;
                break;

            case "LOGS":
                RegConfig.Set <bool>("Logs&Details", logsToolStripMenuItem.Checked);
                splitContainer2.Panel2Collapsed = !logsToolStripMenuItem.Checked;
                break;

            case "CLEAR_WORKSPACE":
                if (_workspacse != null)
                {
                    if (MessageBox.Show("Workspace will be deleted permanently!\nAre you sure you want to clear all workspace?", "Clear Workspace", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        List <Workspace> ws = _workspacse.GetProfiles();
                        if (ws.Count > 0)
                        {
                            foreach (Workspace w in ws)
                            {
                                _history.ClearHistory(w.Name.RemoveNonAlphaNumeric().ToLower());
                            }
                        }
                        _workspacse.ClearWorkspaces();
                        InitWorkspace();
                    }
                }
                break;

            case "CLEAR_LOGS":
                if (_logs != null)
                {
                    if (MessageBox.Show("Logs will be deleted permanently!\nAre you sure you want to clear all logs?", "Clear Logs", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        _logs.ClearAllLog();
                        _logs.Initialize(listLogs);
                    }
                }
                break;

            case "CLEAR_HISTORY":
                if (_selectedWorkspace != null)
                {
                    if (MessageBox.Show("History will be deleted permanently!\nAre you sure you want to clear all history?", "Clear History", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
                    {
                        _history.ClearHistory();
                        InitHistory(_selectedWorkspace.Name);
                    }
                }
                break;

            case "SOURCE_EXT":
            case "SOURCE_FOLDER":
                using (SourceForm s = new SourceForm(tag)) {
                    if (s.ShowDialog().Equals(DialogResult.OK))
                    {
                        string    extension = s.SourceName.StartsWith(".") ? s.SourceName : "." + s.SourceName;
                        RidSource rs        = new RidSource()
                        {
                            Name = (tag.Equals("SOURCE_EXT")) ? extension : s.SourceName,
                            Type = (tag.Equals("SOURCE_EXT")) ? "Extension" : "Folder"
                        };
                        _ridSources.Add(rs);
                        _ridSources.Initialize(listViewRids);
                        _listSources = _ridSources.GetSources();
                    }
                }
                break;

            default:
                break;
            }
        }