static public string ReadFile(string filename)
{
StreamReader Reader = new StreamReader(filename);
string result = "";
string tmp = "";
while ((tmp = Reader.ReadLine()) != null)
result += (tmp + '\n');
Reader.Close();
return result;
}
/// <summary>
/// ب᳠氠ࡱ箳��᪫� /// </summary>
/// <param name="filename">ɬ��param>
/// <param name="lineNo">ή 리 鮠�/param>
/// <returns>à︨�柮ull, 沫桱�㡭᪤殠</returns>
static public string ReadFile(string filename, int lineNo)
string tmp;
//Ů⩰졭�硱릍
for (int i = 0; i < lineNo; i++)
tmp = Reader.ReadLine();
if (tmp == null) //Υ𡢮콸㡱樍
return null;
}//for
result = Reader.ReadLine();
CFileWriter
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace app
static class CFileWriter
public static bool WriteToFile(string filename, string text)
StreamWriter f;
if (!File.Exists(filename))
try
f = File.CreateText(filename);
catch
return false;
}//if
else
f = new StreamWriter(filename, true);
}//else
f.WriteLine(text);
f.Close();
return true;
FMainDesigner.cs
partial class FMain
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// Clean up any resources being used.
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
if (disposing && (components != null))
components.Dispose();
base.Dispose(disposing);
#region Windows Form Designer generated code
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
private void InitializeComponent()
#endregion
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
FResult.cs
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Threading;
public partial class FResult : Form
/// Ƞ䯫衲櫱 /// </summary>
public string caption;
/// Ҡꡲ櫱눠 /// </summary>
public string source;
/// ӳ𡢳崲 �鳼鮲鸥衪﮷殭�步
private List<string> syntax_list = new List<string>();
/// ӳ𡢳崲 �鳼歠�桧㡽즬殲� /// </summary>
private List<string> semantic_list = new List<string>();
/// Ҩ칬 믲ﱻ㡰ᨤ欿�鸥 ⬮릠ࡲ櫱 /// </summary>
private string separators = ".,:-()!?\"';";
/// ު覬𐬿�Ჱ�拊 /// </summary>
private CStatistics statistics = new CStatistics();
public FResult()
InitializeComponent();
/// Callback-
/// 嬿 , ���館吝ﲲ���ﳮ랠衽즬殲᪠鮲汴檱� /// </summary>
/// <param name="text"></param>
delegate void SetTextCallback(string text);
delegate void SetProgressRangeCallBack(int min, int max);
delegate void SetProgressIncCallBack(int value);
delegate void SetLogCallBack(string text);
/// û𡨠𐩱�� � /// </summary>
private void WriteIntoText(string text)
if (this.TextOperation.InvokeRequired)
SetTextCallback d = new SetTextCallback(WriteIntoText);
this.Invoke(d, new object[] { text });
TextOperation.Text = text;
WriteIntoLog(text);
/// û�ᰨ櫱 쯣
private void WriteIntoLog(string text)
if (this.ProgressLog.InvokeRequired)
SetLogCallBack d = new SetLogCallBack(WriteIntoLog);
ProgressLog.Text += text;
ProgressLog.Text += '\n';
/// Ա㬨㡥𡤰ᮨ�콠progress
/// <param name="min"></param>
/// <param name="max"></param>
private void SetProgressRange(int min, int max)
if (this.progress.InvokeRequired)
SetProgressRangeCallBack d = new SetProgressRangeCallBack(SetProgressRange);
this.Invoke(d, new object[] { min, max });
this.progress.Minimum = min;
this.progress.Maximum = max;
Ñòðàíèöû: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42