/// Ԣ欨�氠讠�㟰rogress 1
/// </summary>
/// <param name="value"></param>
private void ProgressInc(int value)
{
if (this.progress.InvokeRequired)
SetProgressIncCallBack d = new SetProgressIncCallBack(ProgressInc);
this.Invoke(d, new object[] { value });
}
else
progress.Increment(value);
/// <summary>
/// Į𡲲 衯דּ���易欨
/// <param name="source"></param>
/// <returns></returns>
private string prepare_string(string source)
string tmp = source;
//Ҩ칬 믲ﱻ㡭� 㼰樿 ᬥ 桪﮶㋊ string symbols = " .,()!@#$%^&*_-\\|/";
bool flag = true;
while (flag)
flag = false;
for (int i = 0; i < symbols.Length; i++)
//û檠쩸 כּ Ḡ죍
while (tmp.IndexOf(symbols[i]) == 0)
tmp = tmp.Remove(0, 1);
flag = true;
}//while ' '
//û檠쩸 כּ ࡪ﮶㋊ while (tmp.IndexOf(symbols[i]) == tmp.Length)
tmp = tmp.Remove(tmp.Length, 1);
}//for
}//while flag
//û檠壮ꮻ㡯칍
while (tmp.IndexOf(" ") >= 0)
tmp = tmp.Remove(tmp.IndexOf(" "), 1);
}//while " "
return tmp;
/// û𡲨벨�駠ﮠ /// </summary>
private void parse_syntax(string source)
//Ҿ垠ⴤ檠㲥
//�猪㲥 㭥㯧㱠
List<string> tmp = new List<string>();
string s = "";
SetProgressRange(0, source.Length);
for (int i = 0; i < source.Length; i++)
ProgressInc(1);
statistics.syntax_bytes++;
//Ʊ즠�魢褐- 欨
if (separators.IndexOf(source[i]) >= 0)
s = prepare_string(s);
//Ʊ즠랠𐴱- 渥䬠棠 if (s == "") continue;
//Ʊ즠宨릠�, 痢 㱿⮫桢館吝졡�
//Þ촷鳼 롪�颮 ��鼍
if (s.Length < 2)
s = "";
continue;
//ɱ묾� 뱠饠ﳰ�沫桮全 �ꡨ塮宮䬠� if (s.IndexOf(' ') < 0)
syntax_list.Add(s);
statistics.syntax_count++;
//Ʊ즠︥易褐�渠�졭㡢묾� 椮 ࡰᨡﮍ
if ((int)source[i] < 32) continue;
s += source[i];
//ū�, �鮲汴檱 졢�
Thread.Sleep(1);
/// û𡲥 ᮠ쩧 /// </summary>
public void AnalizeText()
WriteIntoText("Þ央�櫱;
/*
//Ԥᬿ檠饠 衣אַ㫠 㲥 泌 桤㯩 롢�
while (caption.IndexOf("'") >= 0)
caption = caption.Remove(caption.IndexOf("'"), 1);
while (caption.IndexOf("\"") >= 0)
caption = caption.Remove(caption.IndexOf("\""), 1);
while (source.IndexOf("'") >= 0)
source = source.Remove(source.IndexOf("'"), 1);
while (source.IndexOf("\"") >= 0)
source = source.Remove(source.IndexOf("\""), 1);
*/
WriteIntoText("û묾�㡪 ");
// string connection_string = "Provider=SQLOLEDB.1;Source=E-ART-LAPTOP\\SQLEXPRESS;Initial Catalog=adb;Integrated Security=SSPI";
string connection_string = "Provider=SQLOLEDB;Data Source=e-art-laptop\\sqlexpress;Integrated Security=SSPI;Initial Catalog=adb";
OleDbConnection connection = new OleDbConnection(connection_string);
WriteIntoText("û㮥㡲櫱 ");
CFileWriter.WriteToFile("texts\\" + caption + ".txt", source);
string SQLInsertText = "insert into texts(text, text_caption) values ('files/" + caption + ".txt', '" + caption + "');";
OleDbCommand command = new OleDbCommand(SQLInsertText, connection);
connection.Open();
command.ExecuteNonQuery();
//Ƞ𐴱롥ꡱ⯰ 鲲髨
timer_statistics.Enabled = true;
WriteIntoText("û鸥 ﮠ;
parse_syntax(source);
if (File.Exists("syntax.txt")) File.Delete("syntax.txt");
foreach (string s in syntax_list)
CFileWriter.WriteToFile("syntax.txt", s + '\n');
}//foreach
private void TextOperation_Click(object sender, EventArgs e)
private void FResult_FormClosing(object sender, FormClosingEventArgs e)
Application.Exit();
/// ϡ퀥𡲲᳨ /// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e)
l_syntax_bytes.Text = statistics.syntax_bytes.ToString();
l_syntax_count.Text = statistics.syntax_count.ToString();
FResult.Designer
namespace app
partial class FResult
/// Required designer variable.
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()
// label3
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label TextOperation;
private System.Windows.Forms.RichTextBox ProgressLog;
private System.Windows.Forms.ProgressBar progress;
private System.Windows.Forms.TabPage tabPage3;
Ñòðàíèöû: 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