private void StartBtn_Click(object sender, EventArgs e) { try { StartBtn.Enabled = false; AddCount = 0; InitList(new List <LineDbRecord>()); Records.Clear(); LogFld.Text = ""; LogFld.Refresh(); ParseNIST(); string[] file_list = Directory.GetFiles("lib\\src\\zaidel\\", "*.csv"); Common.Log("zaidel parsing..."); for (int i = 0; i < file_list.Length; i++) { MainForm.MForm.SetupPersents(i * 100.0 / file_list.Length); ParseZaidelLy(file_list[i]); } file_list = Directory.GetFiles("lib\\src\\zaidel\\elem\\", "*.csv"); Common.Log("zaidel\\element parsing..."); for (int i = 0; i < file_list.Length; i++) { MainForm.MForm.SetupPersents(i * 100.0 / file_list.Length); ParseZaidelElem(file_list[i]); } file_list = Directory.GetFiles("lib\\src\\plan\\duga\\", "*.csv"); Common.Log("plan\\duga parsing..."); for (int i = 0; i < file_list.Length; i++) { MainForm.MForm.SetupPersents(i * 100.0 / file_list.Length); ParseDugaPlanshet(file_list[i]); } FileStream fs = new FileStream("lib\\err.txt", FileMode.OpenOrCreate, FileAccess.Write); BinaryWriter bw = new BinaryWriter(fs); bw.Write(LogFld.Text); bw.Flush(); bw.Close(); InitList(Records); MainForm.MForm.SetupPersents(-1); MainForm.MForm.SetupMsg("Done", Color.Blue); Chanded = true; } catch (Exception ex) { Common.Log(ex); } StartBtn.Enabled = true; }
void LogException(string file, int line, string str, Exception ex) { if (LogFld.Text.Length > 10000) { return; } string endl = "" + (char)0xD + (char)0xA; string tmp = file + "(" + line.ToString() + ")" + str + endl + ex.Message + endl + endl + LogFld.Text; LogFld.Text = tmp; LogFld.Refresh(); }