private static bool DoIsExistIdEx(object dsNmOrId, Mode mode) { XMLOperation xmlOperation = new XMLOperation(SysConstManage.DSListFile); ILibXMLNodeRead noderead = xmlOperation.NodeRead("/DSList/DSInfoCollection/DSInfo"); while (!noderead.EOF) { if (mode == Mode.ByDSID) { int id = LibSysUtils.ToInt32(noderead.Attributions["DSID"].ToString()); if (id == LibSysUtils.ToInt32(dsNmOrId)) { return(true); } } else if (mode == Mode.ByDSName) { string dsName = noderead.InnerText.Trim(); if (string.Compare(dsNmOrId.ToString(), dsName, true) == 0) { return(true); } } noderead.ReadNext(); } return(false); }
private static DataSource DoGetDataSourceEx(object dsNmOrId, Mode mode) { DataSource datasource = null; XMLOperation xmlOperation = new XMLOperation(SysConstManage.DSListFile); ILibXMLNodeRead noderead = xmlOperation.NodeRead("/DSList/DSInfoCollection/DSInfo"); string dsname = null; string package = null; while (!noderead.EOF) { if (mode == Mode.ByDSID) { int id = LibSysUtils.ToInt32(noderead.Attributions["DSID"].ToString()); if (LibSysUtils.ToInt32(dsNmOrId) == id) { dsname = noderead.Attributions["Name"].ToString(); package = noderead.Attributions["PACKAGE"].ToString(); break; } } else if (mode == Mode.ByDSName) { dsname = noderead.Attributions["Name"].ToString(); if (string.Compare(dsname, dsNmOrId.ToString(), true) == 0) { package = noderead.Attributions["PACKAGE"].ToString().Trim(); break; } } noderead.ReadNext(); } InstanceDataSource(ref datasource, dsname, package); return(datasource); }
/** * 向xml中添加账户信息 */ private void AddAccount(string account, string password, string popHost, string smtpHost) { AccountInfo accountInfo = new AccountInfo(account, password, popHost, smtpHost); XMLOperation.AddAccountNode(accountInfo); AccountInfos = XMLOperation.loadAccouts(); }
public ActionResult Index() { _databases = XMLOperation.ReadFromFile(); _dBreeze?.Dispose(); var folderPath = HostingEnvironment.MapPath("~/Helpers/DBreeze"); _dBreeze = new DBreezeEngine(folderPath); return(View(_databases)); }
/// <summary>获取连接字符串 </summary> private void SetConnectionStr(SqlConnection connection) { XMLOperation xmldoc = new XMLOperation(SysConstManage.DBInfoFilePath); string service = xmldoc.NodeRead("/INFO/SERVICE").InnerText.Trim(); string database = xmldoc.NodeRead("/INFO/DATABASE").InnerText.Trim(); string uid = xmldoc.NodeRead("/INFO/DBACCOUNT").InnerText.Trim(); string pwd = xmldoc.NodeRead("/INFO/PASSWORD").InnerText.Trim(); connection.ConnectionString = string.Format("server={0};database={1};uid={2};password={3}", service, database, uid, pwd); }
public WelcomeViewModel(ContentControl content) { this.openLoginCommand = new DelegateCommand(); this.openLoginCommand.ExecuteAction = new Action <object>(this.openLogin); this.enterMailBoxCommand = new DelegateCommand(); this.enterMailBoxCommand.ExecuteAction = new Action <object>(this.enterMailBox); //读取账户 AccountInfos = XMLOperation.loadAccouts(); isAble = false; accountSelectedIndex = -1; contentControl = content; }
public ActionResult DeleteDatabase(string databaseName) { Database databaseToDelete = _databases.FirstOrDefault(x => x.Name == databaseName); if (databaseToDelete != null) { _databases.Remove(databaseToDelete); } XMLOperation.WriteToFile(_databases); return(View("Index", _databases)); }
private static List <T> LoadConfigurationModelElementNode() { XmlNode node = XMLOperation.GetElementNode(_xdoc, "//" + UploaderElement); List <T> list = new List <T>(); if (node != null) { T model = PopulateEntityFromCollection <T>(new T(), node.ChildNodes); list.Add(model); } return(list); }
public ActionResult CreateDatabase(Database database) { _currentDatabase = database; _currentDatabase.Tables = new List <Table>(); if (_databases.Select(d => d.Name).ToList().Contains(database.Name)) { return(View("Index", _databases)); } _databases.Add(database); XMLOperation.WriteToFile(_databases); return(View("Tables", _currentDatabase)); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (excl != null) { excl.Dispose(); } excl = null; if (mmm != null) { mmm.Dispose(); } mmm = null; if (RSPort != null) { RSPort.ClosePort(); } RSPort = null; bb = null; cc = null; if (xxxx != null) { xxxx.Close(); } xxxx = null; if (ww != null) { ww.Dispose(); } ww = null; if (Test != null) { Test.Close(); } Test = null; ReadData = null; //ll.Close(); }
private void SavePassword() { string password = pboxPassword1.Password; string secretCode = new AppConfigOperation().Read("AppSecret"); var aesUtil = new AESUtil(); var byteDatas = aesUtil.AesEncrypt(password, secretCode); var strData = Encoding.UTF8.GetString(byteDatas); var xml = new XMLOperation(); if (xml.SetNodeValue("/root/user/unlockpassword", strData)) { new AlertWindow("设置密码成功!").Show(); Close(); } else { new AlertWindow("设置密码失败!").Show(); } }
// switch mail user function private void ReceiveMail(object parameter) { Title = "收件箱"; Visibility = System.Windows.Visibility.Visible; AccountInfo a = AccountInfos[AccountSelectedIndex]; MailUtil.LoginInfo info_pop3 = new MailUtil.LoginInfo() { account = a.Account, passwd = a.Password, site = a.PopHost }; bool re = !MailUtil.validate_account_pop3(info_pop3); // for debug compare MailUtil.LoginInfo info_pop3_2 = new MailUtil.LoginInfo() { account = "*****@*****.**", passwd = "ybgissocute2020", site = "pop.163.com:110" }; bool rere = !MailUtil.validate_account_pop3(info_pop3_2); // account is invaliad if (!re) { // show tip and remove invalid account item DialogHost.Show(new ShowInvalidController(), null, null); //DialogHost.CloseDialogCommand.Execute(null, null); Console.WriteLine("Account Invalid !"); // delete account item and remove that in XML file also XMLOperation.DeleteAccouts(a); AccountInfos.RemoveAt(AccountSelectedIndex); return; } Content = new Frame { Content = new ReceiveMailController(AccountInfos[AccountSelectedIndex]) // don't flush }; }
private void Submit() { var recoveryFileStream = new RecoveryFileStream(); if (string.IsNullOrEmpty(_driveName))//判断当前选中磁盘名 { var xml = new XMLOperation(); _driveName = xml.GetNodeValue("/root/user/currentdrivename"); } var byteFile = recoveryFileStream.Read($@".\Data\bla_{_driveName}.rp"); if (0 == byteFile.Length) { btnErrorHint.Content = "未找到用户密钥文件"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } var aes = new AESUtil(); var afterAESStr = aes.AesDecrypt(byteFile, _key); if (string.IsNullOrEmpty(afterAESStr)) { btnErrorHint.Content = "密钥文件解析失败"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } var bl = new BitLockerExecute(_driveNumber[0].ToString()); if (!bl.Unlock(afterAESStr)) { btnErrorHint.Content = "加载了非此驱动器的密钥文件"; btnErrorHint.Visibility = Visibility.Visible; ClearSimplePassword(); return; } _onWindowCloseCallback(); Close(); }
public ActionResult GoToDatabases() { XMLOperation.WriteToFile(_databases); return(View("Index", _databases)); }
public Config GetConfig() { var path = HttpContext.Current.Server.MapPath("~/Config/config.xml"); return(XMLOperation <Config> .ReadFromXML(path)); }
public void ModifyConfig(Config config) { var path = HttpContext.Current.Server.MapPath("~/Config/config.xml"); XMLOperation <Config> .WriteToXML(config, path); }
private void MenuItem_DaoChuSelect_Click(object sender, EventArgs e) { try { if (((aisinoGrid == null) || (aisinoGrid.Rows == null)) || (aisinoGrid.Rows.Count == 0)) { MessageManager.ShowMsgBox("FPCX-000039"); } else if ((aisinoGrid.SelectedRows == null) || (aisinoGrid.SelectedRows.Count == 0)) { MessageManager.ShowMsgBox("FPCX-000040"); } else { FolderBrowserDialog dialog = new FolderBrowserDialog(); string str = string.Empty; if (!string.IsNullOrEmpty(str)) { if (Directory.Exists(str)) { dialog.SelectedPath = str; } } else { dialog.SelectedPath = Application.StartupPath; } if (dialog.ShowDialog() != DialogResult.OK) { dialog.Dispose(); } else { dialog.Dispose(); this.Refresh(); if (this.progressBar == null) { this.progressBar = new FPProgressBar(); } this.progressBar.SetTip("正在生成发票记录", "请等待任务完成", "加密发票导出过程"); this.progressBar.fpxf_progressBar.Value = 1; this.progressBar.Visible = true; this.progressBar.Show(); this.progressBar.Refresh(); this.ProcessStartThread(2 * this.step); this.progressBar.Refresh(); this.progressBar.SetTip("正在生成导出文件", "请等待任务完成", "加密发票导出过程"); this.ProcessStartThread(this.step); this.progressBar.Refresh(); string str2 = "增值税发票明细("; if (this.com_fpzl.Text == "普通发票") { str2 = "增值税普通发票明细("; } else if (this.com_fpzl.Text == "专用发票") { str2 = "增值税专用发票明细("; } string path = dialog.SelectedPath + @"\" + str2 + this.date_ksrq.Value.ToString("yyyy.MM.dd") + "-" + this.date_jsrq.Value.ToString("yyyy.MM.dd") + ")"; XMLOperation operation = new XMLOperation(); if (this.check_tongbutxt.Checked) { this.progressBar.SetTip("正在导出同步TXT文件", "请等待任务完成", "加密发票导出过程"); this.ProcessStartThread(this.step); this.progressBar.Refresh(); } else { this.ProcessStartThread(this.step); this.progressBar.Refresh(); } operation.SaveSelectToTxt(aisinoGrid.SelectedRows, path, this.date_ksrq.Value, this.date_jsrq.Value, this.check_tongbutxt.Checked); this.ProcessStartThread(this.step); this.progressBar.Refresh(); this.progressBar.Visible = false; this.progressBar.Refresh(); MessageManager.ShowMsgBox("FPCX-000038"); } } } catch (Exception exception) { this.loger.Error("[MenuItem_DaoChuAll_Click异常]" + exception.Message); } finally { if (this.progressBar != null) { this.progressBar.Visible = false; this.progressBar.Close(); this.progressBar.Dispose(); this.progressBar = null; GC.Collect(); } } }