//获得AES加密 private void Button_Click_15(object sender, RoutedEventArgs e) { SetterService setterService = new SetterService(); entity.Setter setter = setterService.getSetter(); MessageBox.Show(setter.Set_Unique_Id); }
//获得aes加密insert private void Button_Click_14(object sender, RoutedEventArgs e) { string mac = System.Text.Encoding.Default.GetString(AesUtil.Encrypt(System.Text.Encoding.Default.GetBytes("00:16:3E:0C:B2:B3"), ProtocolConstant.USB_DOG_PASSWORD)); //string mac = AesUtil.AesEncrypt("E4:02:9B:55:8E:30", "E4:02:9B:55:8E:30"); SetterService setterService = new SetterService(); entity.Setter setter = new entity.Setter(); setter.Set_Unique_Id = mac; setterService.InsertSetter(setter); //MessageBox.Show(mac); }
/// <summary> /// 备份 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BackUp(object sender, RoutedEventArgs e) { try { string DbUserName = ConfigUtil.GetEncrypt("DbUserName", ""); string DbPassword = ConfigUtil.GetEncrypt("DbPassword", ""); string DbUrl = ConfigUtil.GetEncrypt("DbUrl", ""); //指令 string strAddress = string.Format("mysqldump -h{0} -u{1} -p{2} --default-character-set=utf8 --lock-tables --routines --force --quick ", DbUrl, DbUserName, DbPassword); //string strAddress = string.Format("mysqldump -h{0} -u{1} -p{2} --default-character-set=utf8 --lock-tables --routines --force --quick ", "127.0.0.1", "root", "53231323xjh"); //数据库名称 //string strDB = "bdl1"; string strDB = ConfigUtil.GetEncrypt("DbName", ""); //mysql的路径 string mysqlPath = new SetterService().getPath() + @"\bin"; //备份的路径(获取前端页面) //string filePath = System.AppDomain.CurrentDomain.BaseDirectory + @"\BackUp\"; string filePath = textBox5.Text; if (!Directory.Exists(filePath)) //如果不存在就创建file文件夹 { Directory.CreateDirectory(filePath); //创建该文件夹 } //判断是否含空格 if (filePath.IndexOf(" ") != -1) { Console.WriteLine("保存路径中含空格"); MessageBoxX.Warning(LanguageUtils.ConvertLanguage("备份路径不能含有空格", "Backup path cannot contain spaces")); return; } //执行的指令 string cmd = strAddress + strDB + " > " + filePath + "bdl.sql"; string result = CommUtil.RunCmd(mysqlPath, cmd); //MessageBox.Show(result); //图片备份 CommUtil.CopyDirectory(filePath); if (("mysqldump: [Warning] Using a password on the command line interface can be insecure.".Trim()).Contains(result.Trim()) || ("Warning: Using a password on the command line interface can be insecure.".Trim()).Contains(result.Trim())) { MessageBoxX.Info(LanguageUtils.ConvertLanguage("数据备份成功", "Successful data backup")); } else { MessageBoxX.Error(LanguageUtils.ConvertLanguage("数据备份失败", " Data backup failed")); } } catch (Exception ex) { Console.WriteLine("执行sql异常,备份异常" + ex.ToString()); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { entity.Setter setter = new SetterService().getSetter(); System.Windows.MessageBox.Show(setter.Set_OrganizationSort.ToString() + "-"); }