private List<DataStruct> getwords(String source) { List<DataStruct> tmp_dataList = new List<DataStruct>(); string restult = ""; String[] tmp_data_word_info = null; String[] tmp_data_word = source.Split('{'); for (int i = 1; i < tmp_data_word.Length; i++) { DataStruct tmp_data = new DataStruct(); tmp_data_word_info = tmp_data_word[i].Split('['); for (int j = 1; j < tmp_data_word_info.Length; j++) { if (tmp_data_word_info[j].StartsWith("Unit:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("Unit:", ""); restult = restult.Replace("]", ""); if (restult != "") { try { tmp_data.setUnit(Int32.Parse(restult)); } catch { MessageBox.Show("Unit is not a number"); break; } } } else if (tmp_data_word_info[j].StartsWith("EnglishWord:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("EnglishWord:", ""); restult = restult.Replace("]", ""); tmp_data.setEnglishWord(restult); } else if (tmp_data_word_info[j].StartsWith("ChineseWord1:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("ChineseWord1:", ""); restult = restult.Replace("]", ""); tmp_data.setChineseWord1(restult); } else if (tmp_data_word_info[j].StartsWith("ChineseWord2:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("ChineseWord2:", ""); restult = restult.Replace("]", ""); tmp_data.setChineseWord2(restult); } else if (tmp_data_word_info[j].StartsWith("ChineseWord3:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("ChineseWord3:", ""); restult = restult.Replace("]", ""); tmp_data.setChineseWord3(restult); } else if (tmp_data_word_info[j].StartsWith("ChineseWord4:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("ChineseWord4:", ""); restult = restult.Replace("]", ""); tmp_data.setChineseWord4(restult); } else if (tmp_data_word_info[j].StartsWith("Tested:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("Tested:", ""); restult = restult.Replace("]", ""); tmp_data.setTested(bool.Parse(restult)); } else if (tmp_data_word_info[j].StartsWith("TestResult:") && tmp_data_word_info[j].EndsWith("]")) { restult = tmp_data_word_info[j].Replace("TestResult:", ""); restult = restult.Replace("]", ""); tmp_data.setTestResult(bool.Parse(restult)); } } tmp_dataList.Add(tmp_data); } return tmp_dataList; }