Beispiel #1
0
        public void openMyFile()
        {
            Stream         stream = null;
            OpenFileDialog dialog = new OpenFileDialog
            {
                Filter           = "Code Doc (*.cd)|*.cd|Text Doc (*.txt)|*.txt|SoHax File (*.sh)|*.sh",
                RestoreDirectory = true
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    stream = dialog.OpenFile();
                    if (stream != null)
                    {
                        this.CodeEditor.LoadFile(dialog.FileName);
                        string startupPath = Application.StartupPath;
                        if (Directory.Exists(startupPath))
                        {
                            FileSyntaxModeProvider syntaxModeFileProvider = new FileSyntaxModeProvider(startupPath);
                            HighlightingManager.Manager.AddSyntaxModeFileProvider(syntaxModeFileProvider);
                            this.CodeEditor.SetHighlighting("GSC");
                        }
                        using (stream)
                        {
                        }
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message ?? "");
                }
            }
        }
Beispiel #2
0
        public Form5()
        {
            InitializeComponent();
            MySqlConnection connection = new MySqlConnection("server=localhost; database=bugtrackingregister; username=root; password = "******"select Username, Password, Email, type, Gender from bugregister";
            MySqlCommand    cmd = new MySqlCommand(sql, connection);
            MySqlDataReader drd = cmd.ExecuteReader();

            while (drd.Read())
            {
                ListViewItem lvt = new ListViewItem(drd["Username"].ToString());
                lvt.SubItems.Add(drd["Password"].ToString());
                lvt.SubItems.Add(drd["Email"].ToString());
                lvt.SubItems.Add(drd["type"].ToString());
                lvt.SubItems.Add(drd["Gender"].ToString());
                listView1.Items.Add(lvt);
            }

            connection.Close();

            string file = Application.StartupPath;
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(file))
            {
                fsmp = new FileSyntaxModeProvider(file);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
                richTextBox1.SetHighlighting("C/C++");
            }
        }
        /// <summary>
        /// Called when plugin is loaded into IDE.
        /// </summary>
        /// <param name="bridge">Object used to communicate with IDE from plugin.</param>
        public void onLoad(IIdeBridge bridge)
        {
            mBridge = bridge;
            FileSyntaxModeProvider fsmp = new FileSyntaxModeProvider(mBridge.GetPluginsPath() + @"\syntax");

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
        }
        protected override void OnLoad(EventArgs e)
        {
            FileSyntaxModeProvider provider = new FileSyntaxModeProvider(Path.Combine(Application.StartupPath, "Modes"));

            HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);

            foreach (string hl in HighlightingManager.Manager.HighlightingDefinitions.Keys)
            {
                ToolStripItem tsi = new ToolStripMenuItem(hl);
                tsi.Tag    = hl;
                tsi.Click += new EventHandler(Highlighting_Click);
                highlightingToolStripMenuItem.DropDown.Items.Add(tsi);
            }

            base.OnLoad(e);

            if (string.IsNullOrWhiteSpace(fileToLoad) == false && File.Exists(fileToLoad))
            {
                InternalOpenFile(fileToLoad);
            }
            else
            {
                newToolStripMenuItem_Click(null, null);
            }
        }
Beispiel #5
0
        //========================================================================
        public static void LoadSyntax()
        {
            //init intellisense
            RepGenComplete.ImgList = Util.MainForm.AutoCompleteIcons;
            string contents;

            try
            {
                contents = File.ReadAllText(Application.StartupPath + "\\Data\\RepGen.db.txt");
                RepGenComplete.LoadRecords(contents);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Loading RepGen Field DB\nAuto-Completion Will Not Be Available.\nError: " + ex.Message, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //init syntax highlighting
            if (!Directory.Exists(Application.StartupPath + "\\Data"))
            {
                MessageBox.Show("Couldn't Find Data Directory\nSyntax Highlighting Will Not Be Available.", "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            FileSyntaxModeProvider syntaxProvider = new FileSyntaxModeProvider(Application.StartupPath + "\\Data");

            HighlightingManager.Manager.AddSyntaxModeFileProvider(syntaxProvider);
        }
        public frmSqlEdit(ThisAddIn _addin)
        {
            addin = _addin;
            InitializeComponent();

            string dir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\gk.SQLConfigurator\";
            FileSyntaxModeProvider fsmProvider; // Provider

            if (Directory.Exists(dir))
            {
                string path = dir + "SQL-Mode.xshd";
                if (!File.Exists(path))
                {
                    File.WriteAllBytes(path, global::gk.SQLConfigurator.Properties.Resources.SQL_Mode);
                }
                fsmProvider = new FileSyntaxModeProvider(dir);                      // Create new provider with the highlighting directory.
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
                editor.SetHighlighting("SQL");                                      // Activate the highlighting, use the name from the SyntaxDefinition node.
            }

            editor.ShowEOLMarkers      = false;
            editor.ShowSpaces          = false;
            editor.ShowTabs            = false;
            editor.ShowInvalidLines    = false;
            editor.AllowCaretBeyondEOL = true;
            if (addin == null)
            {
                //btnSave.Hide();
                btnCheck.Hide();
            }
        }
Beispiel #7
0
        private void txtEditor_Load(object sender, EventArgs e)
        {
            string currentDirectory     = Application.StartupPath;
            FileSyntaxModeProvider fsmp = new FileSyntaxModeProvider(currentDirectory);

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
            txtEditor.ReadOnly = true;
        }
Beispiel #8
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            FileSyntaxModeProvider fsmp = new FileSyntaxModeProvider(Application.StartupPath);

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
            rtbCode.SetHighlighting("Python");

            openFileDialog1.InitialDirectory = Application.StartupPath + "\\python_samples";
        }
Beispiel #9
0
        private void ShitText_Load(object sender, EventArgs e)
        {
            FileSyntaxModeProvider fileSMP;

            if (Directory.Exists(Application.StartupPath))
            {
                fileSMP = new FileSyntaxModeProvider(Application.StartupPath);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fileSMP);
                shitText.SetHighlighting("BAT");
            }
        }
Beispiel #10
0
        private void initHighlight()
        {
            string path = Application.StartupPath + "\\HighlightFiles";
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(path))
            {
                fsmp = new FileSyntaxModeProvider(path);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
            }
        }
Beispiel #11
0
        private void rnkEd_Load(object sender, EventArgs e)
        {
            string dizin = Application.StartupPath;
            FileSyntaxModeProvider renklendirici;

            if (Directory.Exists(dizin))
            {
                renklendirici = new FileSyntaxModeProvider(dizin);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(renklendirici);
                //rnkEd.SetHighlighting();
            }
        }
Beispiel #12
0
        /// <summary>
        /// Crée une nouvelle page.
        /// </summary>
        void CreateNewPage(string fullpath, bool load)
        {
            // Création de l'éditeur de code.
            ICSharpCode.TextEditor.TextEditorControl editor = new ICSharpCode.TextEditor.TextEditorControl();
            string dir = "res\\";
            FileSyntaxModeProvider fsmProvider;

            if (Directory.Exists(dir))
            {
                fsmProvider = new FileSyntaxModeProvider(dir);

                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
                editor.SetHighlighting("clank");
            }
            editor.ConvertTabsToSpaces = true;
            editor.Dock              = System.Windows.Forms.DockStyle.Fill;
            editor.IsReadOnly        = false;
            editor.Location          = new System.Drawing.Point(0, 0);
            editor.Size              = new System.Drawing.Size(591, 249);
            editor.Font              = new System.Drawing.Font("Consolas", 10);
            editor.TabIndex          = 0;
            editor.Text              = "main\r\n{\r\n}\r\n";
            editor.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            // Ajout d'un nouveau tab page.
            int    index   = m_codeTabs.TabCount;
            string display = fullpath;

            if (File.Exists(fullpath))
            {
                display = Path.GetFileName(fullpath);
            }
            TabPage page = new TabPage(display);

            page.Controls.Add(editor);
            PageInfo info = new PageInfo()
            {
                SourceFile = fullpath, Page = page, Editor = editor
            };

            m_pageInfos.Add(info);

            editor.TextChanged += (object sender, EventArgs e) => { OnEditorTextChanged(info); };

            // Chargement ?
            if (load && File.Exists(fullpath))
            {
                string text = File.ReadAllText(fullpath);
                editor.Text = text;
            }

            m_codeTabs.TabPages.Add(page);
            m_codeTabs.SelectedTab = page;
        }
        private void editor2_Load(object sender, EventArgs e)
        {
            string dir = Application.StartupPath;
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(dir))
            {
                fsmp = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
                editor2.SetHighlighting("stream");
            }
        }
Beispiel #14
0
        private void editor_Load(object sender, EventArgs e)
        {
            string dirc = Application.StartupPath + "/lang";
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(dirc))
            {
                fsmp = new FileSyntaxModeProvider(dirc);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
                editor.SetHighlighting("PSC");
            }
        }
        //texteditor for keeping the source code anf for the syntax highlighting
        private void textEditorControl1_Load(object sender, EventArgs e)
        {
            string dric = Application.StartupPath;
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(dric))
            {
                fsmp = new FileSyntaxModeProvider(dric);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
                textEditorControl1.SetHighlighting("C#");
            }
        }
Beispiel #16
0
        /// <summary>
        ///  Assigns a programming language (<see cref="language"/>) from <see cref="txtLanguage"/>, then using a <see cref="FileSyntaxModeProvider"/>,
        ///  sets the code text area (<see cref="txtCode"/>) when its reloaded to highlight syntax for the selected programming language (<see cref="language"/>).
        /// </summary>
        private void TxtCode_Load(object sender, EventArgs e)
        {
            language = txtLanguage.Text;
            String dir = Application.StartupPath;
            FileSyntaxModeProvider fsmp;

            if (Directory.Exists(dir))
            {
                fsmp = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
                txtCode.SetHighlighting(language);
            }
        }
Beispiel #17
0
        static void Main()
        {
            //自定义代码高亮
            string path = Application.StartupPath + "\\highlighting";
            FileSyntaxModeProvider fsmp;

            fsmp = new FileSyntaxModeProvider(path);
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Beispiel #18
0
        private void SourceCodeEditor_Load(object sender, EventArgs e)
        {
            string dir = Application.StartupPath;

            FileSyntaxModeProvider fileSyntaxMode = new FileSyntaxModeProvider(dir);

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fileSyntaxMode);
            textEditorControl1.SetHighlighting("C#");
            textEditorControl1.Text = code;
            String text = textEditorControl1.Text;

            Debug.WriteLine(text);
        }
Beispiel #19
0
        /// <summary>The load highlighting provider.</summary>
        public void LoadHighlightingProvider()
        {
            if (_highlightingProviderLoaded)
            {
                return;
            }

            // see: http://wiki.sharpdevelop.net/Syntax%20highlighting.ashx
            string dir = Path.GetDirectoryName(GetType().Assembly.Location);
            FileSyntaxModeProvider fsmProvider = new FileSyntaxModeProvider(dir);

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
            _highlightingProviderLoaded = true;
        }
Beispiel #20
0
        private void InitHighlighting()
        {
            string dir = Path.Combine(Application.StartupPath, @"Highlighting\");

            if (Directory.Exists(dir))
            {
                var fsmProvider = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
                textEditorControl1.SetHighlighting("Scrape");
            }

            _executionHighlight = new HighlightColor(Color.Black, Color.Yellow, false, false);
            var highlightingStrategy = textEditorControl1.Document.HighlightingStrategy as DefaultHighlightingStrategy;

            _defaultHighlight = highlightingStrategy.GetColorFor("Selection");
        }
Beispiel #21
0
        public XSLForm()
        {
            InitializeComponent();

            string RunningPath = AppDomain.CurrentDomain.BaseDirectory;

            string dir = string.Format(@"{0}Highlighting", RunningPath); // Insert the path to your xshd-files.
            FileSyntaxModeProvider fsmProvider;                          // Provider

            if (Directory.Exists(dir))
            {
                fsmProvider = new FileSyntaxModeProvider(dir);                      // Create new provider with the highlighting directory.
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
                TextEditor.SetHighlighting("XSL-Tranny");                           // Activate the highlighting, use the name from the SyntaxDefinition node.
            }
        }
Beispiel #22
0
        public SourceForm()
        {
            InitializeComponent();

            // Syntax Highlighting
            var fsmProvider = new FileSyntaxModeProvider(Environment.CurrentDirectory);

            HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);
            textBoxSource.SetHighlighting("QL");

            // Fill demo presets
            _demoPresets.Add("Empty Form", "form formName { }");
            _demoPresets.Add("Questions", "form formName { \r\n\t\"Does it work?\" boolQ1: boolean\r\n\t\"And with two questions?\" boolQ2: boolean\r\n}");
            _demoPresets.Add("Conditional", "form formName {\r\n\t\"Display next question?\" boolQ1: boolean\r\n\tif (boolQ1) {\r\n\t\t\"Did you like it?\" boolQ2: boolean\r\n\t}\r\n}");
            _demoPresets.Add("Assignment", "form formName {\r\n\t\"Income?\" intQ1: integer\r\n\t\"Tax amount\" intTax = intQ1 / 100 * 52\r\n}");
            comboBoxDemos.Items.AddRange(_demoPresets.Keys.ToArray());
        }
Beispiel #23
0
        /// <summary>
        /// creates a method to setup the highlight manager for the texteditor control,
        /// loads the xshd definition file for the syntax definitions of this language and sets it to highlight manager
        /// </summary>
        public void highlightHandlers()
        {
            //Creates a FileSyntaxModeProvider object to provide binary for the color syntaxing
            FileSyntaxModeProvider fsmp;

            //Provide directory path for fsmp object
            string dirc = Application.StartupPath;

            //Checks if the provided directory path exists
            if (Directory.Exists(dirc))
            {
                //Initialize the fsmp object with the provided directory path
                fsmp = new FileSyntaxModeProvider(dirc);

                /*Pass the fsmp object created as argument for the sytanxmodefileprovider
                 * of highlightingmanager of the texteditor */
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp);
            }
        }
        public TextEditorCodeEditor(ISharedViewState sharedViewState)
        {
            _sharedViewState = sharedViewState;
            this.Dock        = DockStyle.Fill;

            _documents =
                new Dictionary <string, IDocument>();


            string dir = PathUtility.GetFullPath("Static"); // Insert the path to your xshd-files.
            FileSyntaxModeProvider fsmProvider;             // Provider

            if (Directory.Exists(dir))
            {
                fsmProvider = new FileSyntaxModeProvider(dir);                      // Create new provider with the highlighting directory.
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
                base.SetHighlighting("VS-C#");                                      // Activate the highlighting, use the name from the SyntaxDefinition node.
            }
        }
Beispiel #25
0
        public static void Init()
        {
            try
            {
                byte[] syntaxDefPath = Properties.Resources.Assembly;
                s_SyntaxFilePath = StreamService.WriteToTemporaryFile(syntaxDefPath);

                // this expects a directory for a path. not the actual file?
                string syntaxFileDir = Path.GetDirectoryName(s_SyntaxFilePath);

                var fsm = new FileSyntaxModeProvider(syntaxFileDir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsm);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Stack trace:\n" + ex.StackTrace);
                MessageBox.Show("Failed to load syntax file for highlighting. Keyword highlighting will be disabled!",
                                "File Editor Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #26
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var controller = new SingleInstanceController(typeof(MainForm));

            controller.MainFormCreated += delegate
            {
                Container = new UnityContainer().LoadConfiguration("compiler");
                ToolStripManager.Renderer = new Office2007Renderer.Office2007Renderer();
                var dir         = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); // Insert the path to your xshd-files.
                var fsmProvider = new FileSyntaxModeProvider(dir);
                HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider);                                  // Attach to the text editor.
            };
            controller.Run(args);
        }
Beispiel #27
0
 private void LoadHighlightingDefinitions()
 {
     try
     {
         const string dir = "Resources";
         if (Directory.Exists(dir))
         {
             var fsmProvider = new FileSyntaxModeProvider(dir);                  // Provider
             HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
             _editor.SetHighlighting(_highlightDefinitionsFiles);
         }
         else
         {
             throw new Exception("Missing highlihting definitions.");
         }
     }
     catch (Exception ex)
     {
         Log.Error("Error openning highlihting definitions.");
         Log.Error(ex.Message);
     }
 }
Beispiel #28
0
 private void LoadHighlightingDefinitions()
 {
     try
     {
         var dir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, "Resources");
         if (Directory.Exists(dir))
         {
             var fsmProvider = new FileSyntaxModeProvider(dir);                  // Provider
             HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmProvider); // Attach to the text editor.
             _sqlEditor.SetHighlighting(DatabaseConnection.DatabaseServer.HighlightingDefinitionsFile);
         }
         else
         {
             _log.ErrorFormat("Cannot find directory {0} to load highlighting definitions.", dir);
             throw new Exception("Missing highlighting definitions.");
         }
     }
     catch (Exception ex)
     {
         _log.Error("Error opening highlighting definitions.");
         _log.Error(ex.Message);
     }
 }
Beispiel #29
0
        //form
        private void ProxyAutoConfigDebugger_Form_Load(object sender, EventArgs e)
        {
            Application.VisualStyleState     = System.Windows.Forms.VisualStyles.VisualStyleState.ClientAndNonClientAreasEnabled;
            toolStripMenuItem_AutoIP.Checked = Properties.Settings.Default.AutoIPChecked;
            ToolStripMenuItem_AutoIP_CheckedChanged(toolStripMenuItem_AutoIP, null);
            toolStripMenuItem_FindProxyForURLEx.Checked = Properties.Settings.Default.FindProxyForURLExChecked;
            toolStripComboBox_Uri.ComboBox.Items.AddRange(Properties.Settings.Default.UriList.OfType <string>().ToArray());

            //initialize the editor control
            fileSyntaxModeProvider = new FileSyntaxModeProvider($"{AppDomain.CurrentDomain.BaseDirectory}");
            HighlightingManager.Manager.AddSyntaxModeFileProvider(fileSyntaxModeProvider);

            //put PAC into text editor. if doesn't exist, use default.
            textEditorControl_Editor.Text = (String.IsNullOrEmpty(Properties.Settings.Default.PAC_JavaScript)) ? Properties.Resources.PAC_JavaScript : Properties.Settings.Default.PAC_JavaScript;

            toolStripMenuItem_ToggleGlyphs.Checked = Properties.Settings.Default.ToggleGlyphs;
            ToolStripMenuItem_ToggleGlyphs_Click(toolStripMenuItem_ToggleGlyphs, null);
            toolStripMenuItem_ToggleColor.Checked = Properties.Settings.Default.ToggleColor;
            ToolStripMenuItem_ToggleColor_Click(toolStripMenuItem_ToggleColor, null);

            //initialize webBrowser_Results window
            InitializeWebBrowser_Results();
        }
Beispiel #30
0
        /// <summary>
        /// Initialisiert eigene Komponenten
        /// </summary>
        private void InitializeCustomComponent()
        {
            this.menuitemFile              = new ToolStripMenuItem();
            this.menuitemFile.Text         = "File";
            this.menuitemFile.Click       += new System.EventHandler(this.menuitemFile_Click);
            this.menuitemSeparator         = new ToolStripSeparator();
            this.menuitemSeparator.Visible = cfgFileManager.CfgFiles.Count > 0;

            //Add Load-MenuItems
            foreach (string path in cfgFileManager.cfgPaths)
            {
                ToolStripMenuItem cfgFileMenuItem = new ToolStripMenuItem();
                cfgFileMenuItem.ToolTipText = path;
                System.Text.RegularExpressions.Regex expr = new System.Text.RegularExpressions.Regex(@"(\\[^\\]+){0,4}$");
                cfgFileMenuItem.Text   = "..." + expr.Match(path).ToString();
                cfgFileMenuItem.Tag    = path;
                cfgFileMenuItem.Click += new EventHandler(this.cfgFileLoad_Click);
                this.menuitemLoad.DropDownItems.Add(cfgFileMenuItem);
            }
            this.menuitemLoad.DropDownItems.AddRange(
                new System.Windows.Forms.ToolStripItem[]
            {
                this.menuitemSeparator,
                this.menuitemFile
            });

            //TextEditor Anpassungen
            try
            {
                FileSyntaxModeProvider csgoSyntaxProvider = new FileSyntaxModeProvider("highlighting");
                HighlightingManager.Manager.AddSyntaxModeFileProvider(csgoSyntaxProvider);
                textEditor.SetHighlighting("CSGO");
            }
            catch (IOException ioEx)
            { /*TODO*/ }
        }