You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.7 KiB
C#
125 lines
3.7 KiB
C#
/*
|
|
* Created by SharpDevelop.
|
|
* User: Johannes
|
|
* Date: 01.06.2005
|
|
* Time: 10:40
|
|
*
|
|
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
|
*/
|
|
using System;
|
|
using System.IO;
|
|
using System.Drawing;
|
|
using System.Text.RegularExpressions;
|
|
using System.Windows.Forms;
|
|
|
|
namespace C__Viewer
|
|
{
|
|
/// <summary>
|
|
/// Description of MainForm.
|
|
/// </summary>
|
|
public class MainForm : System.Windows.Forms.Form
|
|
{
|
|
private System.Windows.Forms.RichTextBox richTextBox1;
|
|
private System.Windows.Forms.MainMenu mainMenu1;
|
|
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
|
private System.Windows.Forms.MenuItem menuItem2;
|
|
private System.Windows.Forms.MenuItem menuItem1;
|
|
public static string path;
|
|
public MainForm(string[] args)
|
|
{
|
|
|
|
//
|
|
// The InitializeComponent() call is required for Windows Forms designer support.
|
|
//
|
|
InitializeComponent();
|
|
|
|
//
|
|
// TODO: Add constructor code after the InitializeComponent() call.
|
|
//
|
|
}
|
|
|
|
[STAThread]
|
|
public static void Main(string[] args)
|
|
{
|
|
Application.Run(new MainForm(args));
|
|
}
|
|
|
|
#region Windows Forms Designer generated code
|
|
/// <summary>
|
|
/// This method is required for Windows Forms designer support.
|
|
/// Do not change the method contents inside the source code editor. The Forms designer might
|
|
/// not be able to load this method if it was changed manually.
|
|
/// </summary>
|
|
private void InitializeComponent() {
|
|
this.menuItem1 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem2 = new System.Windows.Forms.MenuItem();
|
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
|
this.mainMenu1 = new System.Windows.Forms.MainMenu();
|
|
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
|
this.SuspendLayout();
|
|
//
|
|
// menuItem1
|
|
//
|
|
this.menuItem1.Index = 0;
|
|
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
|
this.menuItem2});
|
|
this.menuItem1.Text = "Datei";
|
|
//
|
|
// menuItem2
|
|
//
|
|
this.menuItem2.Index = 0;
|
|
this.menuItem2.Text = "Öffnen...";
|
|
this.menuItem2.Click += new System.EventHandler(this.MenuItem2Click);
|
|
//
|
|
// openFileDialog1
|
|
//
|
|
this.openFileDialog1.Filter = "C# Dateien|*.cs|Alle Dateien|*.*";
|
|
//
|
|
// mainMenu1
|
|
//
|
|
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
|
this.menuItem1});
|
|
//
|
|
// richTextBox1
|
|
//
|
|
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.richTextBox1.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
|
|
this.richTextBox1.Name = "richTextBox1";
|
|
this.richTextBox1.Size = new System.Drawing.Size(544, 421);
|
|
this.richTextBox1.TabIndex = 0;
|
|
this.richTextBox1.Text = "";
|
|
//
|
|
// MainForm
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.ClientSize = new System.Drawing.Size(544, 421);
|
|
this.Controls.Add(this.richTextBox1);
|
|
this.Menu = this.mainMenu1;
|
|
this.Name = "MainForm";
|
|
this.Text = "MainForm";
|
|
this.ResumeLayout(false);
|
|
}
|
|
#endregion
|
|
|
|
void MenuItem2Click(object sender, System.EventArgs e)
|
|
{
|
|
if(openFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
using (StreamReader sr = new StreamReader(openFileDialog1.FileName))
|
|
{
|
|
String line;
|
|
while ((line = sr.ReadLine()) != null)
|
|
{
|
|
richTextBox1.Text += line+"\n";
|
|
}
|
|
|
|
richTextBox1.Find("public", RichTextBoxFinds.WholeWord);
|
|
richTextBox1.SelectionColor = Color.Blue;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|