Exemplo n.º 1
0
        // Token: 0x0600025C RID: 604 RVA: 0x00007D3C File Offset: 0x00005F3C
        public static bool SaveConfig(RegConfig regconfig)
        {
            string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "config/reg.config");

            FPCache.Remove("FP_REGCONFIG");
            return(FPSerializer.Save <RegConfig>(regconfig, mapPath));
        }
Exemplo n.º 2
0
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="regconf"></param>
    public Register(RegConfig regconf)
    {
        reg = regconf;
        string serverTag = regconf.SvcName + regconf.PodName;

        userID = CRC32Utils.GetCRC32(serverTag);
    }
Exemplo n.º 3
0
        // Token: 0x060002DB RID: 731 RVA: 0x0000B0D8 File Offset: 0x000092D8
        protected override void View()
        {
            RegConfig regConfig = RegConfigs.GetRegConfig();
            string    @string   = FPRequest.GetString("username");

            if (@string == "")
            {
                this.ShowErrMsg("用户名不能为空");
            }
            else if (!FPUtils.IsSafeSqlString(@string))
            {
                this.ShowErrMsg("您使用的用户名有敏感字符");
            }
            else if (this.InRestrictArray(@string, regConfig.restrict))
            {
                this.ShowErrMsg("该用户名不允许使用");
            }
            else if (UserBll.CheckUserName(@string))
            {
                this.ShowErrMsg("该用户名已被使用");
            }
            else
            {
                Hashtable hashtable = new Hashtable();
                hashtable["error"]   = 0;
                hashtable["message"] = "正确";
                base.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                base.Response.Write(JsonMapper.ToJson(hashtable));
                base.Response.End();
            }
        }
 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 InitConfig(int tabIndex)
 {
     tabControlConfig.SelectedIndex = tabIndex;
     chkTruncatePath.Checked        = RegConfig.Get <bool>("TruncatePath");
     chkAppDataTempFolder.Checked   = RegConfig.Get <bool>("AppDataTempFolder");
     chkNewProfile.Checked          = RegConfig.Get <bool>("ExecuteNewProfile");
     chkEnableIncludeFile.Checked   = RegConfig.Get <bool>("EnableIncludeFile");
     chkAutoUnbind.Checked          = RegConfig.Get <bool>("AutoUnbind");
     chkAutoSaveProfile.Checked     = RegConfig.Get <bool>("AutoSaveProfile");
 }
        private void InitSettings()
        {
            FileHelper.CheckAssociation();
            _iconListManager = new IconListManager(imageList16, IconReader.IconSize.Small);
            _intialDirectory = RegConfig.Get <string>("InitialDirectory");

            toolStripUploader.Visible       = hideToolbarToolStripMenuItem.Checked = RegConfig.Get <bool>("Toolbar");
            statusStripUploader.Visible     = hideStatusbarToolStripMenuItem.Checked = RegConfig.Get <bool>("Statusbar");
            splitContainer2.Panel2Collapsed = !(logsToolStripMenuItem.Checked = RegConfig.Get <bool>("Logs&Details"));
            splitContainer1.Panel1Collapsed = !(profileExplorerToolStripMenuItem.Checked = RegConfig.Get <bool>("ProfileExplorer"));
        }
Exemplo n.º 7
0
        static void Main()
        {
            bool xpLook = RegConfig.Get <bool>("XPLook");

            if (!xpLook)
            {
                Application.EnableVisualStyles();
            }
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new PasswordForm());
        }
        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);
                }
            }
        }
Exemplo n.º 9
0
        // Token: 0x0600025B RID: 603 RVA: 0x00007CBC File Offset: 0x00005EBC
        public static RegConfig GetRegConfig()
        {
            RegConfig regConfig = FPCache.Get <RegConfig>("FP_REGCONFIG");

            lock (RegConfigs.lockHelper)
            {
                if (regConfig == null)
                {
                    string mapPath = FPUtils.GetMapPath(WebConfig.WebPath + "config/reg.config");
                    regConfig = FPSerializer.Load <RegConfig>(mapPath);
                    FPCache.Insert("FP_REGCONFIG", regConfig, mapPath);
                }
            }
            return(regConfig);
        }
Exemplo n.º 10
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;
     }
 }
Exemplo n.º 12
0
        public async Task Loaded(object sender, RoutedEventArgs args)
        {
            var config = RegConfig.Load();

            if (config == null)
            {
                // ReSharper disable once ExpressionIsAlwaysNull
                var settingsVm     = new SettingsVm(config);
                var settingsWindow = new SettingsWindow(settingsVm);
                if (settingsWindow.ShowDialog() == false)
                {
                    _mainWindow.Close();
                }
                else
                {
                    config = settingsVm.SqlConfig;
                    RegConfig.Save(config);
                }
            }

            _repositoryDb = new RepositoryDb();
            _repositoryDb.Connect(config);
        }
Exemplo n.º 13
0
 private void AppyOptions()
 {
     RegConfig.Set <bool>("Encrypt", chkEncryptContent.Checked);
     RegConfig.Set <bool>("HidePassword", chkHidePassword.Checked);
     RegConfig.Set <bool>("ShowPanel", chkShowDetails.Checked);
 }
Exemplo n.º 14
0
 private void InitOptions()
 {
     chkEncryptContent.Checked = RegConfig.Get <bool>("Encrypt");
     chkHidePassword.Checked   = RegConfig.Get <bool>("HidePassword");
     chkShowDetails.Checked    = RegConfig.Get <bool>("ShowPanel");
 }
        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;
            }
        }
        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;
            }
        }