Ejemplo n.º 1
0
        private void loadRegistrySettings()
        {
            try
            {
                jpegQuality = Math.Max(25, Math.Min(100, SettingsWrapper.getSettingValue(REG_JPEG_QUALITY, Constants.DEFAULT_JPEG_QUALITY)));
                grabMargin  = Math.Max(0, Math.Min(2 * Constants.DEFAULT_GRAB_MARGIN,
                                                   SettingsWrapper.getSettingValue(REG_GRAB_MARGIN, Constants.DEFAULT_GRAB_MARGIN)));

                smtpServer   = SettingsWrapper.getSettingValue(REG_SMTP_HOST, "");
                smtpPort     = SettingsWrapper.getSettingValue(REG_SMTP_PORT, 25);
                smtpUseSsl   = SettingsWrapper.getSettingValue(REG_SMTP_USE_SSL, 0) != 0;
                smtpUserName = SettingsWrapper.getSettingValue(REG_SMTP_USER, "");
                smtpPassword = Rot13.Rotate(SettingsWrapper.getSettingValue(REG_SMTP_PASSWORD, ""));

                showUsageHints          = SettingsWrapper.getSettingValue(REG_SHOW_HINTS, 1) != 0;
                limitGrabByActiveScreen = SettingsWrapper.getSettingValue(REG_LIMIT_GRAB, 0) != 0;

                magnifierZoomFactor = Math.Min(Constants.MAX_MAGNIFIER_ZOOM,
                                               Math.Max(Constants.MIN_MAGNIFIER_ZOOM,
                                                        SettingsWrapper.getSettingValue(REG_MAGNIFIER_ZOOM, Constants.DEFAULT_MAGNIFIER_ZOOM)));
                showGrabMagnifier = SettingsWrapper.getSettingValue(REG_SHOW_GRAB_MAGNIFIER, 1) != 0;
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.StackTrace);
            }
        }
Ejemplo n.º 2
0
        public JiraUpload(string fileName, string filePath, IEnumerable <string> texts, NameValueCollection cmdline)
        {
            InitializeComponent();

            Icon = Properties.Resources.trayIcon_Icon;

            name = fileName;
            path = filePath;

            buttonUpload.Enabled = false;

            RegistryKey key = Registry.CurrentUser.CreateSubKey(Constants.REG_KEY);

            if (key != null)
            {
                RegistryKey keyAccounts = key.CreateSubKey(REG_JIRA_ACCOUNTS);
                if (keyAccounts != null)
                {
                    foreach (string k in keyAccounts.GetSubKeyNames())
                    {
                        RegistryKey subkey = keyAccounts.OpenSubKey(k);

                        if (subkey != null)
                        {
                            string url    = (string)subkey.GetValue(REG_SERVER);
                            string user   = (string)subkey.GetValue(REG_USER);
                            string passwd = Rot13.Rotate((string)subkey.GetValue(REG_PASSWORD, ""));

                            accounts.Add(k, new JiraAccount(url, user, passwd));
                        }
                        comboEntryName.Items.Add(k);
                    }
                }
            }
            if (key != null)
            {
                string lastAccount = (string)key.GetValue(REG_LAST_JIRA_ACCOUNT, "");
                textIssueNumber.Text = (string)key.GetValue(REG_LAST_ISSUE, "");

                if (accounts.ContainsKey(lastAccount))
                {
                    comboEntryName.SelectedItem = lastAccount;
                }
            }

            setupFromCommandLine(cmdline);

            if (texts != null)
            {
                foreach (string text in texts)
                {
                    commentBox.Text += text + "\r\n";
                }
            }

            updateButtons();
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegistryKey key    = Registry.CurrentUser.CreateSubKey(Constants.REG_KEY + "\\" + REG_ACCOUNTS);
            string      passwd = checkStorePassword.Checked? Rot13.Rotate(textPassword.Text) : "";

            if (key != null)
            {
                key.SetValue(comboLogin.Text, passwd);
            }
        }
Ejemplo n.º 4
0
        private void textPassword_TextChanged(object sender, EventArgs e)
        {
            smtpPassword = textPassword.Text;
            if (SmtpPasswordChanged != null)
            {
                SmtpPasswordChanged(this, new ValueEventArgs <string>(smtpPassword));
            }

            if (!checkStorePassword.Checked)
            {
                return;
            }
            SettingsWrapper.saveSettingValue(REG_SMTP_PASSWORD, Rot13.Rotate(smtpPassword));
        }
Ejemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegistryKey key = Registry.CurrentUser.CreateSubKey(Constants.REG_KEY);

            if (key != null)
            {
                RegistryKey keyAccounts = key.CreateSubKey(REG_JIRA_ACCOUNTS);
                if (keyAccounts != null)
                {
                    RegistryKey sub = keyAccounts.CreateSubKey(comboEntryName.Text);
                    if (sub != null)
                    {
                        sub.SetValue(REG_USER, textLogin.Text);
                    }
                    string pwd = textPassword.Text;
                    if (pwd.Length > 0)
                    {
                        pwd = Rot13.Rotate(pwd);
                    }
                    if (checkStorePassword.Checked)
                    {
                        if (sub != null)
                        {
                            sub.SetValue(REG_PASSWORD, pwd);
                        }
                    }
                    if (sub != null)
                    {
                        sub.SetValue(REG_SERVER, textServerUrl.Text);
                        sub.SetValue(REG_LAST_ISSUE, textIssueNumber.Text);
                    }
                }
            }
            if (key != null)
            {
                key.SetValue(REG_LAST_JIRA_ACCOUNT, comboEntryName.Text);
            }

            accounts[comboEntryName.Text] = new JiraAccount(textServerUrl.Text, textLogin.Text, textPassword.Text);
            if (!comboEntryName.Items.Contains(comboEntryName.Text))
            {
                comboEntryName.Items.Add(comboEntryName.Text);
            }
        }
Ejemplo n.º 6
0
        public PicasawebUpload(string name, string fileName)
        {
            InitializeComponent();

            Icon = Properties.Resources.trayIcon_Icon;

            comboLogin.TextChanged += comboLogin_TextChanged;
            service       = new PicasaService("Kalamon-Mazio");
            this.fileName = fileName;
            this.name     = name;

            RegistryKey key         = Registry.CurrentUser.CreateSubKey(Constants.REG_KEY);
            RegistryKey keyAccounts = Registry.CurrentUser.CreateSubKey(Constants.REG_KEY + "\\" + REG_ACCOUNTS);

            if (keyAccounts != null)
            {
                foreach (string login in keyAccounts.GetValueNames())
                {
                    string password = keyAccounts.GetValue(login).ToString();
                    if (password.Length > 0)
                    {
                        password = Rot13.Rotate(password);
                    }
                    accounts.Add(login, password);
                    comboLogin.Items.Add(login);
                }
            }
            if (key != null)
            {
                string lastAccount = (string)key.GetValue(REG_LAST_ACCOUNT, "");
                if (accounts.ContainsKey(lastAccount))
                {
                    comboLogin.SelectedItem = lastAccount;
                }
            }

            updateItems();
        }