public int CheckOverlapDatarow(DataRow[] dRows, string ReadSentence) { int check = -1; for (int i = 0; i < dRows.Count(); i++) { if (dRows[i]["Code"].ToString() == KoreanHelper.DivideJaso(ReadSentence)) { check = i; } } return(check); }
public void MakeXML() { DataSet Sentence; DataTable ResultSentence; string DatasetPath = ""; OpenFileDialog ofd = new OpenFileDialog { DefaultExt = ".xml", Filter = "XML File (*.xml)|*.xml", Title = "Select your sentence dataset" }; if (ofd.ShowDialog() == DialogResult.OK) { DatasetPath = ofd.FileName; } Sentence = GetData(DatasetPath); Console.Write("Sentences Dataset path is " + DatasetPath + "\n"); ResultSentence = new DataTable(); ResultSentence.TableName = "Data"; DataColumn dc1 = new DataColumn("Name", typeof(string)); DataColumn dc2 = new DataColumn("Code", typeof(string)); DataColumn dc3 = new DataColumn("Count", typeof(int)); ResultSentence.Columns.Add(dc1); ResultSentence.Columns.Add(dc2); ResultSentence.Columns.Add(dc3); foreach (DataRow dRow in Sentence.Tables[0].Rows) { string s = KoreanHelper.DivideJaso(dRow["Name"].ToString()); DataRow newRow = ResultSentence.NewRow(); newRow["Name"] = dRow["Name"].ToString(); newRow["Code"] = s; newRow["Count"] = 0; ResultSentence.Rows.Add(newRow); } ResultSentence.WriteXml(DatasetPath); }