Esempio n. 1
0
        public SettingsForm(List <string> systemScripts, UserScripts userScripts)
            : this()
        {
            _userScripts = userScripts;

            textBox1.Text = PluginSettings.Instance.HomePage;

            this.Text                      = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.label1.Text               = Utils.LanguageSupport.Instance.GetTranslation(STR_HOMEPAGE);
            this.groupBox2.Text            = Utils.LanguageSupport.Instance.GetTranslation(STR_SYSTEMSCRIPTS);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.listView2.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.groupBox3.Text            = Utils.LanguageSupport.Instance.GetTranslation(STR_USERSCRIPTS);
            this.button1.Text              = Utils.LanguageSupport.Instance.GetTranslation(STR_OK);
            this.button2.Text              = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE);
            this.button3.Text              = Utils.LanguageSupport.Instance.GetTranslation(STR_NEW);
            this.button4.Text              = Utils.LanguageSupport.Instance.GetTranslation(STR_RENAME);
            this.checkBox1.Text            = Utils.LanguageSupport.Instance.GetTranslation(STR_SUPPRESSSCRIPTERRORS);
            this.label4.Text               = Utils.LanguageSupport.Instance.GetTranslation(STR_COMPATIBILITY);

            checkBox1.Checked = PluginSettings.Instance.ScriptErrorsSuppressed;
            comboBox1.Items.AddRange((from a in _browserCompatibilityValues select a.ToString()).ToArray());
            comboBox1.SelectedIndex = comboBox1.Items.IndexOf((PluginSettings.Instance.CompatibilityMode / 1000).ToString());

            ListViewItem lvi;

            foreach (string s in systemScripts)
            {
                lvi         = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(s));
                lvi.Tag     = s;
                lvi.Checked = !PluginSettings.Instance.DisabledSystemScripts.Contains(s);
                listView1.Items.Add(lvi);
            }

            lvi         = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(STR_NAMESPACE));
            lvi.Tag     = userScripts.UsingNamespaces;
            lvi.Checked = true;
            listView2.Items.Add(lvi);

            foreach (UserScripts.Script scr in userScripts.Scripts)
            {
                UserScriptInfo scri = new UserScriptInfo();
                scri.Name           = scr.Name;
                scri.ClassCode      = scr.ClassCode;
                scri.OriginalScript = scr;

                lvi         = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(scr.Name));
                lvi.Tag     = scri;
                lvi.Checked = scr.Enabled;
                listView2.Items.Add(lvi);
            }
        }
Esempio n. 2
0
        public SettingsForm(List<string> systemScripts, UserScripts userScripts)
            : this()
        {
            _userScripts = userScripts;

            textBox1.Text = Properties.Settings.Default.HomePage;

            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_HOMEPAGE);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SYSTEMSCRIPTS);
            this.listView1.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.listView2.Columns[0].Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.groupBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_USERSCRIPTS);
            this.button1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OK);
            this.button2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_DELETE);
            this.button3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NEW);
            this.button4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_RENAME);
            this.checkBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SUPPRESSSCRIPTERRORS);
            this.label4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_COMPATIBILITY);

            checkBox1.Checked = Properties.Settings.Default.ScriptErrorsSuppressed;
            comboBox1.Items.AddRange((from a in _browserCompatibilityValues select a.ToString()).ToArray());
            comboBox1.SelectedIndex = comboBox1.Items.IndexOf((Properties.Settings.Default.CompatibilityMode / 1000).ToString());

            ListViewItem lvi;
            foreach (string s in systemScripts)
            {
                lvi = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(s));
                lvi.Tag = s;
                lvi.Checked = !Properties.Settings.Default.DisabledSystemScripts.Contains(s);
                listView1.Items.Add(lvi);
            }

            lvi = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(STR_NAMESPACE));
            lvi.Tag = userScripts.UsingNamespaces;
            lvi.Checked = true;
            listView2.Items.Add(lvi);

            foreach (UserScripts.Script scr in userScripts.Scripts)
            {
                UserScriptInfo scri = new UserScriptInfo();
                scri.Name = scr.Name;
                scri.ClassCode = scr.ClassCode;
                scri.OriginalScript = scr;

                lvi = new ListViewItem(Utils.LanguageSupport.Instance.GetTranslation(scr.Name));
                lvi.Tag = scri;
                lvi.Checked = scr.Enabled;
                listView2.Items.Add(lvi);
            }
        }
Esempio n. 3
0
        private void loadUserScripts()
        {
            _userScripts = new UserScripts();

            try
            {
                string p = Core.PluginDataPath;
                _userScripts.FileName = System.IO.Path.Combine(new string[] { p, "webscripts.xml" });

                if (System.IO.File.Exists(_userScripts.FileName))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(_userScripts.FileName);
                    XmlElement root = doc.DocumentElement;

                    _userScripts.UsingNamespaces = root.SelectSingleNode("UsingNamespaces").InnerText;

                    XmlNodeList sNodes = root.SelectSingleNode("Scripts").SelectNodes("Script");
                    if (sNodes != null)
                    {
                        foreach (XmlNode n in sNodes)
                        {
                            UserScripts.Script scr = new UserScripts.Script();

                            scr.Name      = n.SelectSingleNode("Name").InnerText;
                            scr.ClassCode = n.SelectSingleNode("ClassCode").InnerText;
                            scr.Enabled   = bool.Parse(n.SelectSingleNode("Enabled").InnerText);

                            _userScripts.Scripts.Add(scr);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 4
0
        private void loadUserScripts()
        {
            _userScripts = new UserScripts();

            try
            {
                string p = Core.PluginDataPath;
                _userScripts.FileName = System.IO.Path.Combine(new string[] { p, "webscripts.xml" });

                if (System.IO.File.Exists(_userScripts.FileName))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(_userScripts.FileName);
                    XmlElement root = doc.DocumentElement;

                    _userScripts.UsingNamespaces = root.SelectSingleNode("UsingNamespaces").InnerText;

                    XmlNodeList sNodes = root.SelectSingleNode("Scripts").SelectNodes("Script");
                    if (sNodes != null)
                    {
                        foreach (XmlNode n in sNodes)
                        {
                            UserScripts.Script scr = new UserScripts.Script();

                            scr.Name = n.SelectSingleNode("Name").InnerText;
                            scr.ClassCode = n.SelectSingleNode("ClassCode").InnerText;
                            scr.Enabled = bool.Parse(n.SelectSingleNode("Enabled").InnerText);

                            _userScripts.Scripts.Add(scr);
                        }
                    }
                }
            }
            catch
            {
            }
        }