private void btnBrowserT112_Click(object sender, EventArgs e) { string rootPath = Application.StartupPath; if (rdoReplaceAndRead.Checked == true) { openFileDialogT112.Filter = " Files(TT112*.001)|TT112*.001"; } else // rdoReadOnly is checked { openFileDialogT112.Filter = " Files(TT112*.Replaced)|TT112*.Replaced"; } string fileName = ""; int n = 0; if (openFileDialogT112.ShowDialog() == DialogResult.OK) { grdT112.Rows.Clear(); _messages.Clear(); n = openFileDialogT112.FileNames.Length; for (int i = 0; i < n; i++) { if (openFileDialogT112.FileNames[i].IndexOf("TT112") != -1) { fileName = openFileDialogT112.FileNames[i]; txtFilePathT112.Text = fileName; //IncomingFile parser = new IncomingFile(); IncommingFile parser = new IncommingFile(); List <classMessage> messages = parser.ParseMessages(fileName, rootPath); //classMessage[] messages = parser.ParseMessages(fileName, rootPath); _messages.AddRange(messages); } } if (rdoTransactionOnly.Checked == true) { HienThiTransactionOnly(grdT112, _messages); } else { HienThiAllMessages(grdT112, _messages); } } }
private void btnBrowserT112_Click(object sender, EventArgs e) { string rootPath = Application.StartupPath; //if(rdoReplaceAndRead.Checked == true) // openFileDialogT112.Filter = " Files(TT112*.001)|TT112*.001"; //else // rdoReadOnly is checked // openFileDialogT112.Filter = " Files(TT112*.Replaced)|TT112*.Replaced"; string fileName = ""; int n = 0; if (openFileDialogT112.ShowDialog() == DialogResult.OK) { grdT112.Rows.Clear(); _messages.Clear(); n = openFileDialogT112.FileNames.Length; //string s = "abxyXY þÓÍËÛ Þ¨á¨ªÎ¨çâÞâüæÍÅÛ è¯ÓÍ 10 abcdxy"; //hhhh //StringBuilder result = new StringBuilder(); //foreach (char c in s) //{ // if (Char.IsLetter(c)) // Console.WriteLine(c); //} //string value = "þÓÍËÛ Þ¨á¨ªÎ¨çâÞâüæÍÅÛ è¯ÓÍ 10"; //// Convert the string into a byte[]. //byte[] asciiBytes = Encoding.ASCII.GetBytes(value); //for (int i = 0; i < value.Length; i++) //{ // Console.WriteLine(value.Substring(i, 1) + " as ASCII value of: " + asciiBytes[i]); //} for (int i = 0; i < n; i++) { if (openFileDialogT112.FileNames[i].IndexOf("TT112") != -1) { fileName = openFileDialogT112.FileNames[i]; txtFilePathT112.Text = fileName; ReplaceTest(fileName); //IncomingFile parser = new IncomingFile(); IncommingFile parser = new IncommingFile(); List <classMessage> messages = parser.ParseMessages(fileName, rootPath); //classMessage[] messages = parser.ParseMessages(fileName,rootPath); _messages.AddRange(messages); } } if (rdoTransactionOnly.Checked == true) { HienThiTransactionOnly(grdT112, _messages); } else { HienThiAllMessages(grdT112, _messages); } } }