private void LoadFile() { try { Dictionary <string, string> dictionary = new Dictionary <string, string>(); XmlRead read = new XmlRead(); Dictionary <string, string> item = read.GetItem(FileName.File1); foreach (KeyValuePair <string, string> pair in item) { this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value); dictionary.Add(pair.Key, pair.Value); } this.combobox.Items.Add("----------------------"); Dictionary <string, string> dictionary3 = read.GetItem(FileName.File2); foreach (KeyValuePair <string, string> pair in dictionary3) { this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value); dictionary.Add(pair.Key, pair.Value); } this.file_1.set_FileFilter("Excel文件(*.xls)|*.xls"); this.file_2.set_FileFilter("Excel文件(*.xls)|*.xls"); this.file_1.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File1Path"); this.file_2.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File2Path"); this.com_sheet_1.Text = IniRead.GetPrivateProfileString("File", "TableInFile1"); this.com_sheet_2.Text = IniRead.GetPrivateProfileString("File", "TableInFile2"); string privateProfileString = IniRead.GetPrivateProfileString("FieldCon", "FileNumber"); int result = 1; int.TryParse(privateProfileString, out result); this.radioButton1.Checked = result == 1; this.radioButton2.Checked = result == 2; DataGridView view = this.dataGridView1; DataTable table = WenBenItem.Items(); foreach (DataRow row in table.Rows) { string str2 = IniRead.GetPrivateProfileString("FieldCon", row["key"].ToString()); if (str2 != "0.0") { view.Rows[Convert.ToInt32(row["id"]) - 1].Cells["WenJianLie"].Value = str2; } } view.Rows[6].Cells["MoRen"].Value = IniRead.GetPrivateProfileString("FieldCon", "DefaultFuHeRen"); view.Rows[7].Cells["MoRen"].Value = IniRead.GetPrivateProfileString("FieldCon", "DefaultShouKuanRen"); view.Rows[0x13].Cells["MoRen"].Value = IniRead.GetPrivateProfileString("FieldCon", "DefaultShuiLv"); this.combo_1.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "MainTableField") + "]" + read.GetKey1(); this.combo_2.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "AssistantTableField") + "]" + read.GetKey2(); this.txt_1.Text = IniRead.GetPrivateProfileString("TableCon", "MainTableIgnoreRow"); this.txt_2.Text = IniRead.GetPrivateProfileString("TableCon", "AssistantTableIgnoreRow"); } catch (Exception exception) { HandleException.HandleError(exception); } }
private void CheckLastSetType() { if (File.Exists(IniRead.path)) { string privateProfileString = IniRead.GetPrivateProfileString("FieldCon", "Invtype"); if ((this.invtype == InvType.Common) || (this.invtype == InvType.Special)) { string str2 = this.invtype.ToString(); if ((privateProfileString.CompareTo("Common") != 0) && (privateProfileString.CompareTo("Special") != 0)) { CreateIniFile.Create(); } } else if (this.invtype.ToString().CompareTo(privateProfileString) != 0) { CreateIniFile.Create(); } } }
private DataTable ExcelLoad() { DataTable table2; try { string str = this.File1; string str2 = this.File2; string privateProfileString = IniRead.GetPrivateProfileString("File", "TableInFile1"); string str4 = IniRead.GetPrivateProfileString("File", "TableInFile2"); string s = IniRead.GetPrivateProfileString("FieldCon", "FileNumber"); int result = 1; int.TryParse(s, out result); List <ExcelMappingItem.Relation> yingShe = new List <ExcelMappingItem.Relation>(); DataTable table = WenBenItem.Items(); foreach (DataRow row in table.Rows) { string key = row["key"].ToString(); string str7 = IniRead.GetPrivateProfileString("FieldCon", key); ExcelMappingItem.Relation item = new ExcelMappingItem.Relation { Key = row["key"].ToString() }; int num2 = 0; int.TryParse(str7.Substring(0, str7.IndexOf('.')), out num2); item.TableFlag = num2; num2 = 0; int.TryParse(str7.Substring(str7.LastIndexOf('.') + 1), out num2); item.ColumnName = num2; yingShe.Add(item); } string defaultFuHeRen = IniRead.GetPrivateProfileString("FieldCon", "DefaultFuHeRen"); string defaultShouKuanRen = IniRead.GetPrivateProfileString("FieldCon", "DefaultShouKuanRen"); string defaultShuiLv = IniRead.GetPrivateProfileString("FieldCon", "DefaultShuiLv"); int num3 = 0; int.TryParse(IniRead.GetPrivateProfileString("TableCon", "MainTableField"), out num3); int num4 = num3; num3 = 0; int.TryParse(IniRead.GetPrivateProfileString("TableCon", "AssistantTableField"), out num3); int num5 = num3; num3 = 0; int.TryParse(IniRead.GetPrivateProfileString("TableCon", "MainTableIgnoreRow"), out num3); int num6 = num3; num3 = 0; int.TryParse(IniRead.GetPrivateProfileString("TableCon", "AssistantTableIgnoreRow"), out num3); int subHeadline = num3; switch (result) { case 1: return(this.GetFileData(str, privateProfileString, num6, yingShe, defaultFuHeRen, defaultShouKuanRen, defaultShuiLv)); case 2: return(GetFileData(str, str2, privateProfileString, str4, num6, subHeadline, num4, num5, yingShe, defaultFuHeRen, defaultShouKuanRen, defaultShuiLv)); } table2 = null; } catch (Exception) { throw; } return(table2); }