Ejemplo n.º 1
0
        private void SaveBackupPath()
        {
            ISettingStore ini = Core.SettingStore;

            if (ini != null)
            {
                ini.WriteBool("ResourceStore", "EnableBackup", _enableBackupBox.Checked);
                ini.WriteString("ResourceStore", "BackupPath", _backupPath.Text);
            }
        }
Ejemplo n.º 2
0
        public static void SetBackupDefaults()
        {
            ISettingStore ini = Core.SettingStore;

            if (ini.ReadString("ResourceStore", "EnableBackup").Length == 0)
            {
                ini.WriteBool("ResourceStore", "EnableBackup", true);
                ini.WriteString("ResourceStore", "BackupPath", GetDefaultBackupPath(OMEnv.WorkDir));
            }
        }
Ejemplo n.º 3
0
        public override void OK()
        {
            ISettingStore ini = Core.SettingStore;

            if (_defaultProxyButton.Checked)
            {
                ini.WriteString("HttpProxy", "Address", string.Empty);
            }
            else
            {
                string address = _address.Text;
                ini.WriteString("HttpProxy", "Address", address);
                ini.WriteInt("HttpProxy", "Port", (int)_port.Value);
                ini.WriteString("HttpProxy", "User", _user.Text);
                ini.WriteString("HttpProxy", "Password", _password.Text);
                ini.WriteBool("HttpProxy", "BypassLocal", _bypassLocal.Checked);
                ini.WriteString("HttpProxy", "BypassList", _bypassList.Text);
            }
            HttpReader.LoadHttpConfig();
        }
Ejemplo n.º 4
0
        public override void OK()
        {
            ISettingStore ini = Core.SettingStore;

            string profile = (_lbxProfiles.SelectedIndex <= 0) ? "" : (string)_lbxProfiles.SelectedItem;

            ini.WriteString("Miranda", "ProfileToIndex", profile);
            IniSettings.CreateCategories   = _chkCreateCategories.Checked;
            IniSettings.LatestOnTop        = _chkLatestOnTop.Checked;
            IniSettings.SyncImmediate      = _radSyncImmediate.Checked;
            IniSettings.ConversationPeriod = (int)_udConversationPeriod.Value * 60;
        }
Ejemplo n.º 5
0
        public override void OK()
        {
            _ini.WriteBool("MailFormat", "GreetingInReplies", _chkGreetingInReplies.Checked);
            _ini.WriteBool("MailFormat", "PrefixInitials", _chkPrefixInitials.Checked);
            _ini.WriteString("MailFormat", "GreetingString", _boxPrefix.Text);

            _ini.WriteBool("MailFormat", "UseSignature", _chkUseSignature.Checked);
            if (_chkUseSignature.Checked)
            {
                _ini.WriteString("MailFormat", "Signature", _signatureBox.Text);
            }

            int signatureInReplies = 1;

            if (_radReplySignatureNone.Checked)
            {
                signatureInReplies = 0;
            }
            else if (_radSignatureAfterQuoting.Checked)
            {
                signatureInReplies = 2;
            }
            _ini.WriteInt("MailFormat", "SignatureInReplies", signatureInReplies);
        }
Ejemplo n.º 6
0
        public override void OK()
        {
            ISettingStore ini = Core.SettingStore;
            int           markReadMS;

            if (!_chkMarkAsRead.Checked)
            {
                markReadMS = 0;
            }
            else
            {
                markReadMS = (int)_udMarkAsReadSeconds.Value * 1000;
                if (markReadMS == 0)
                {
                    markReadMS = 1;
                }
            }
            ini.WriteInt("Resources", "MarkAsReadTimeOut", markReadMS);
            ini.WriteBool("Resources", "ShowSearchContext", _chkShowContext.Checked);
            ini.WriteBool("Resources", "UseShortDateFormat", _chkUseShortDateFormat.Checked);
            ini.WriteBool("Search", "AutoSwitchToResults", _chkSwitchToTab.Checked);
            ini.WriteBool("Resources", "LinksInNewWindow", _radBrowserWindow.Checked);
            ini.WriteBool("Resources", "LinksInPreviewPane", _radPreviewPane.Checked);
            ini.WriteBool("Resources", "MinimizeToTray", _chkMinimizeToTray.Checked);

            ini.WriteInt("General", "BalloonTimeout", (int)_udPeriod.Value);
            ini.WriteInt("General", "BalloonBackgroundR", panelSample.BackColor.R);
            ini.WriteInt("General", "BalloonBackgroundG", panelSample.BackColor.G);
            ini.WriteInt("General", "BalloonBackgroundB", panelSample.BackColor.B);

            if (isValidPrefixes())
            {
                SubjectComparer.SubjectPrefixes = _editSubjectPrefixes.Text;
                ini.WriteString(SubjectComparer.csIniSection, SubjectComparer.csIniKey, _editSubjectPrefixes.Text);
            }

            Core.UIManager.DefaultFormattingFont   = new Font(_currFont, _currFontSize);
            Core.TextIndexManager.IdleIndexingMode = _chkIdleTextIndex.Checked;
        }
Ejemplo n.º 7
0
        public override void OK()
        {
            string exts = _textExtsList.Text;

            if (exts.Length == 0)
            {
                exts         = ".txt";
                _wereChanges = true;
            }
            if (_wereChanges)
            {
                ISettingStore settings = Core.SettingStore;
                settings.WriteString("FilePlugin", "PlainTextExts", exts);
                settings.WriteBool("FilePlugin", "IndexHidden", _indexHiddenCheckBox.Checked);
                settings.WriteBool("FilePlugin", "ViewHidden", _viewHiddenCheckBox.Checked);
                if (!IsStartupPane)
                {
                    FoldersCollection.Instance.Interrupted = true;
                    FoldersCollection.Instance.WaitUntilFinished();
                    FoldersCollection.LoadFoldersForest();
                }
            }
        }
Ejemplo n.º 8
0
        /**
         * Writes a single attachment type to the INI file.
         */

        private static void WriteAttachmentType(ISettingStore ini, int index, string name, string exts)
        {
            ini.WriteString("Attachments", "Attachment" + index + "Name", name);
            ini.WriteString("Attachments", "Attachment" + index + "Exts", exts);
        }
Ejemplo n.º 9
0
        public AnnotationForm()
        {
            Settings = Core.SettingStore;
            InitializeComponent();

            //-----------------------------------------------------------------
            int xPos   = Settings.ReadInt("Annotations", "LocationX", -1),
                yPos   = Settings.ReadInt("Annotations", "LocationY", -1);
            int width  = Settings.ReadInt("Annotations", "Width", -1),
                height = Settings.ReadInt("Annotations", "Height", -1);

            if (xPos != -1 && yPos != -1)
            {
                Location         = new Point(xPos, yPos);
                _defaultPosition = false;
            }
            else
            {
                _defaultPosition = true;
            }
            if (width != -1 && height != -1)
            {
                this.Size = new Size(width, height);
            }

            if (IsOutsideScreen(Location))
            {
                this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Right / 2,
                                          Screen.PrimaryScreen.WorkingArea.Bottom / 2);
            }

            //-----------------------------------------------------------------
            int opacity = Settings.ReadInt("Annotations", "Opacity", -1);

            if (opacity != -1)
            {
                SavedOpacity = Opacity;
                try
                {
                    Opacity = ((double)opacity) / 100.0;
                }
                catch (Exception)
                {
                    // ignore
                }
            }

            string color = Settings.ReadString("Annotations", "BackColor");

            if (!String.IsNullOrEmpty(color))
            {
                if (IsValidColor(color))
                {
                    richText.BackColor = Color.FromName(color);
                }
                else
                {
                    MessageBox.Show(this, "Color name for the Annotation background is illegal", "Illegal Color Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.WriteString("Annotations", "BackColor", "Info");
                }
            }
            color = Settings.ReadString("Annotations", "ForeColor");
            if (!String.IsNullOrEmpty(color))
            {
                if (IsValidColor(color))
                {
                    richText.ForeColor = Color.FromName(color);
                }
                else
                {
                    MessageBox.Show(this, "Color name for the Annotation foreground is illegal", "Illegal Color Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.WriteString("Annotations", "ForeColor", "Black");
                }
            }

            Hide();
        }
Ejemplo n.º 10
0
        private void ShowExceptionDialog()
        {
            if (_exceptionDialogVisible)
            {
                return;
            }

            _exceptionDialogVisible = true;
            bool exceptionFatal = false;

            try
            {
                while (true)
                {
                    QueuedException qex = null;
                    lock ( _exceptionQueue )
                    {
                        if (_exceptionQueue.Count > 0)
                        {
                            qex = (QueuedException)_exceptionQueue.Dequeue();
                        }
                    }
                    if (qex == null)
                    {
                        break;
                    }

                    if ((qex.Flags & ExceptionReportFlags.Fatal) != 0)
                    {
                        exceptionFatal = true;
                    }

                    Exception ex = qex.Exception;
                    if (ex is AsyncProcessorException)
                    {
                        ex = ex.InnerException;
                    }
                    if (ex is TargetInvocationException)
                    {
                        ex = ex.InnerException;
                    }

                    ISettingStore ini = Core.SettingStore;
                    using (ExceptionReportForm dlg = new ExceptionReportForm())
                    {
                        ProxySettings proxySettings = new ProxySettings();
                        try
                        {
                            string address = ini.ReadString("HttpProxy", "Address");
                            proxySettings.CustomProxy = address.Length > 0;
                            if (proxySettings.CustomProxy)
                            {
                                proxySettings.Host     = address;
                                proxySettings.Port     = ini.ReadInt("HttpProxy", "Port", 3128);
                                proxySettings.Login    = ini.ReadString("HttpProxy", "User");
                                proxySettings.Password = ini.ReadString("HttpProxy", "Password");
                            }
                            dlg.SetProxy(proxySettings);
                        }
                        catch (Exception pex)
                        {
                            Trace.WriteLine("Failed to set exception reporter proxy: " + pex.ToString());
                        }
                        // Setup our submitter
                        dlg.Submitter  = new RPCExceptionSubmitter();
                        dlg.ProjectKey = "OM";
                        dlg.DisplaySubmissionResult = true;
                        string userName = ini.ReadString("ErrorReport", "UserName");
                        string password = ini.ReadString("ErrorReport", "Password");
                        if (userName.Length > 0 && password.Length > 0)
                        {
                            dlg.SetITNLogin(userName, password);
                        }
                        else
                        {
                            dlg.SetDefaultLogin("om_anonymous", "guest");
                        }

                        if ((qex.Flags & ExceptionReportFlags.AttachLog) != 0)
                        {
                            dlg.AttachLog = true;
                        }

                        dlg.SetBuildNumber(Assembly.GetExecutingAssembly().GetName().Version.Build);

                        IWin32Window ownerWindow = (_ownerControl == null || _ownerControl.IsDisposed) ? null : _ownerControl;

                        if (dlg.ReportException(ownerWindow, ex, GetExceptionDescription()) == DialogResult.OK)
                        {
                            if (dlg.ITNUserName != "om_anonymous")
                            {
                                ini.WriteString("ErrorReport", "UserName", dlg.ITNUserName);
                                ini.WriteString("ErrorReport", "Password", dlg.ITNPassword);
                            }

                            if (dlg.AttachLog)
                            {
                                LogManager.SubmitErrorLog();
                            }
                            proxySettings = dlg.ProxySettings;
                            if (!proxySettings.CustomProxy)
                            {
                                ini.WriteString("HttpProxy", "Address", string.Empty);
                            }
                            else
                            {
                                ini.WriteString("HttpProxy", "Address", proxySettings.Host);
                                ini.WriteInt("HttpProxy", "Port", proxySettings.Port);
                                ini.WriteString("HttpProxy", "User", proxySettings.Login);
                                ini.WriteString("HttpProxy", "Password", proxySettings.Password);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(null, "An exception has occured in the application, and the exception reporter failed to present it.\n\n" + ex.Message + "\n\nThe application will now be terminated.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                exceptionFatal = true;
            }
            _exceptionDialogVisible = false;

            if (exceptionFatal)
            {
                (Core.MainWindow as MainFrame).ForceClose();
            }
        }