public static bool ReadConfig(string FilePath, ref string Database, ref string UserName, ref string PassWord, ref int Cabin, ref string IPMayGiamSat, ref string IPMayNhanDang, ref string LocalImagesPath, ref string ServerImagesPath, ref string ServerImagesPathBS, ref int PortDuLieuChinh, ref int PortDuLieuCu, ref int PortTroGiup, ref int PortMayNhanDangBienSo, ref int IdTram, ref int Status_, ref string Instance_) { try { ProcessXML processXML = new ProcessXML(FilePath); Database = processXML.XmlNodeValue("Catalog", "Database", ""); UserName = processXML.XmlNodeValue("Login", "Database", ""); PassWord = processXML.XmlNodeValue("Password", "Database", ""); Encryption.Encryption.Decode("ITVVA", ref UserName, UserName); Encryption.Encryption.Decode("ITVVA", ref PassWord, PassWord); IPMayGiamSat = processXML.XmlNodeValue("MayGiamSat", "Connect", ""); IPMayNhanDang = processXML.XmlNodeValue("NhanDangBienSo", "Connect", ""); LocalImagesPath = processXML.XmlNodeValue("LocalImagesPath", "Connect", ""); ServerImagesPath = processXML.XmlNodeValue("ServerImagesPath", "Connect", ""); ServerImagesPathBS = processXML.XmlNodeValue("ServerImagesPathBS", "Connect", ""); PortDuLieuChinh = int.Parse(processXML.XmlNodeValue("PortDuLieuChinh", "Connect", "")); PortDuLieuCu = int.Parse(processXML.XmlNodeValue("PortDuLieuCu", "Connect", "")); PortTroGiup = int.Parse(processXML.XmlNodeValue("PortTroGiup", "Connect", "")); PortMayNhanDangBienSo = int.Parse(processXML.XmlNodeValue("PortMayNhanDangBienSo", "Connect", "")); Cabin = int.Parse(processXML.XmlNodeValue("CabinID", "General", "")); IdTram = int.Parse(processXML.XmlNodeValue("TramId", "General", "")); Status_ = int.Parse(processXML.XmlNodeValue("Status", "General", "")); Instance_ = processXML.XmlNodeValue("Instance", "Database", ""); return(true); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception ex2 = ex; ProjectData.ClearProjectError(); } return(false); }
private void frmConfig_Load(object sender, EventArgs e) { this.Config = new ProcessXML("TollcabinConfig.xml"); try { this.LocalDatabase = this.Config.XmlNodeValue("Catalog", "Database", ""); this.LocalUserName = this.Config.XmlNodeValue("Login", "Database", ""); this.LocalPassWord = this.Config.XmlNodeValue("Password", "Database", ""); Encryption.Encryption.Decode("ITVVA", ref this.LocalUserName, this.LocalUserName); Encryption.Encryption.Decode("ITVVA", ref this.LocalPassWord, this.LocalPassWord); this.IPMayGiamSat = this.Config.XmlNodeValue("MayGiamSat", "Connect", ""); this.IPMayNhanDang = this.Config.XmlNodeValue("NhanDangBienSo", "Connect", ""); this.LocalImagesPath = this.Config.XmlNodeValue("LocalImagesPath", "Connect", ""); this.ServerImagesPath = this.Config.XmlNodeValue("ServerImagesPath", "Connect", ""); this.ServerImagesPathBS = this.Config.XmlNodeValue("ServerImagesPathBS", "Connect", ""); this.PortDuLieuChinh = Conversions.ToString(int.Parse(this.Config.XmlNodeValue("PortDuLieuChinh", "Connect", ""))); this.PortDuLieuCu = Conversions.ToString(int.Parse(this.Config.XmlNodeValue("PortDuLieuCu", "Connect", ""))); this.PortTroGiup = Conversions.ToString(int.Parse(this.Config.XmlNodeValue("PortTroGiup", "Connect", ""))); this.PortMayNhanDangBienSo = Conversions.ToString(int.Parse(this.Config.XmlNodeValue("PortMayNhanDangBienSo", "Connect", ""))); this.Cabin = Conversions.ToString(int.Parse(this.Config.XmlNodeValue("CabinID", "General", ""))); this.IdTram = int.Parse(this.Config.XmlNodeValue("TramId", "General", "")); this.Status = int.Parse(this.Config.XmlNodeValue("Status", "General", "")); this.Instance = this.Config.XmlNodeValue("Instance", "Database", ""); this.ServerDatabase = this.Config.XmlNodeValue("DatabaseServer", "SQLReplication", ""); this.ServerName = this.Config.XmlNodeValue("Server", "SQLReplication", ""); this.ServerSqlUser = this.Config.XmlNodeValue("UserServer", "SQLReplication", ""); Encryption.Encryption.Decode("ITVVA", ref this.ServerSqlUser, this.ServerSqlUser); this.ServerSqlPassword = this.Config.XmlNodeValue("PasswordServer", "SQLReplication", ""); Encryption.Encryption.Decode("ITVVA", ref this.ServerSqlPassword, this.ServerSqlPassword); this.ServerPublication = this.Config.XmlNodeValue("Publication", "SQLReplication", ""); this.ComPortBangDien = this.Config.XmlNodeValue("ComPortBangDien", "NewInfo", ""); this.ComPortBanPhim = this.Config.XmlNodeValue("ComPortBanPhim", "NewInfo", ""); this.ComPortDieuKhien = this.Config.XmlNodeValue("ComPortDieuKhien", "NewInfo", ""); this.ComPortDauDoc = this.Config.XmlNodeValue("ComPortDauDoc", "NewInfo", ""); this.DVRchanel = Conversions.ToInteger(this.Config.XmlNodeValue("DVRChanel", "NewInfo", "")); this.IPDauGhiHinh = this.Config.XmlNodeValue("videoCard", "NewInfo", ""); this.DauDocMaVach = Conversions.ToInteger(this.Config.XmlNodeValue("TenDauDoc", "NewInfo", "0")); if (Operators.CompareString(this.Config.XmlNodeValue("TinhNangThoai", "NewInfo", "0"), "0", false) != 0) { this.cbTinhNangThoai.Checked = true; } else { this.cbTinhNangThoai.Checked = false; } this.cbbbangDien.Text = this.ComPortBangDien; this.cbbComportNameKeyboard.Text = this.ComPortBanPhim; this.cbbComportNameController.Text = this.ComPortDieuKhien; this.cbbComportNameTicket.Text = this.ComPortDauDoc; this.tbServerName.Text = this.ServerName; this.tbServerSqlUser.Text = this.ServerSqlUser; this.tbServerSqlPassword.Text = this.ServerSqlPassword; this.tbServerDatabaseName.Text = this.ServerDatabase; this.tbPublicationName.Text = this.ServerPublication; this.tbLocalDatabase.Text = this.LocalDatabase; this.tbLocalSqlUser.Text = this.LocalUserName; this.tbLocalSqlPassword.Text = this.LocalPassWord; this.tbComputerWatch.Text = this.IPMayGiamSat; this.tbComputerRecognize.Text = this.IPMayNhanDang; this.tbServerFolderImage.Text = this.ServerImagesPath; this.tbServerFolderPlateImage.Text = this.ServerImagesPathBS; this.tbPortMain.Text = this.PortDuLieuChinh; this.tbPortSub.Text = this.PortDuLieuCu; this.tbPortRecognize.Text = this.PortMayNhanDangBienSo; this.tbLane.Text = this.Cabin; this.cbbCodeTram.Text = Conversions.ToString(this.IdTram); this.tbLocalInstance.Text = this.Instance; this.cbbPropertyLane.SelectedIndex = this.Status; this.tbLocalFolderlImage.Text = this.LocalImagesPath; this.cbbDauDoc.SelectedIndex = this.DauDocMaVach; this.tbIpDauGhi.Text = this.IPDauGhiHinh; if (this.DVRchanel >= 0) { this.cb0.Checked = (((long)this.DVRchanel & 1L) != 0L); this.cb1.Checked = (((long)this.DVRchanel & 2L) != 0L); this.cb2.Checked = (((long)this.DVRchanel & 4L) != 0L); this.cb3.Checked = (((long)this.DVRchanel & 8L) != 0L); this.cb4.Checked = (((long)this.DVRchanel & 16L) != 0L); this.cb5.Checked = (((long)this.DVRchanel & 32L) != 0L); this.cb6.Checked = (((long)this.DVRchanel & 64L) != 0L); this.cb7.Checked = (((long)this.DVRchanel & 128L) != 0L); this.cb8.Checked = (((long)this.DVRchanel & 256L) != 0L); this.cb9.Checked = (((long)this.DVRchanel & 512L) != 0L); this.cb10.Checked = (((long)this.DVRchanel & 1024L) != 0L); this.cb11.Checked = (((long)this.DVRchanel & 2048L) != 0L); this.cb12.Checked = (((long)this.DVRchanel & 4096L) != 0L); this.cb13.Checked = (((long)this.DVRchanel & 8192L) != 0L); this.cb14.Checked = (((long)this.DVRchanel & 16384L) != 0L); this.cb15.Checked = (((long)this.DVRchanel & 32768L) != 0L); } } catch (Exception expr_7F8) { ProjectData.SetProjectError(expr_7F8); MessageBox.Show("Có lỗi trong quá trình đọc thông tin cấu hình", "Thông báo.", MessageBoxButtons.OK, MessageBoxIcon.Hand); ProjectData.ClearProjectError(); } }