private MethodResult mysqldump(string databaseName, string destinationSqlScriptFile) { var result = new MethodResult(); var Location = Path.Combine(ImportHelper.GetRegistryKeyValue(MYSQL51_REGISTRY_KEY, "Location"), "bin", "mysqldump.exe"); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = String.Format("\"{0}\"", Location); startInfo.Arguments = String.Format("--host={0} --user={1} --password={2} --routines --triggers --events --add-drop-table --dump-date --opt --no-create-db --set-charset --database {3} -r \"{4}\"", Settings.Default.mysqlHost, Settings.Default.mysqlUser, Settings.Default.mysqlPassword, databaseName, destinationSqlScriptFile); startInfo.CreateNoWindow = true; startInfo.UseShellExecute = false; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = false; startInfo.WindowStyle = ProcessWindowStyle.Hidden; using (var execute = Process.Start(startInfo)) { execute.WaitForExit(); if (execute.ExitCode != 0) { result.Status = false; result.Msg = execute.StandardError.ReadToEnd(); } else { result.Status = true; } } return(result); }
private string GetMySQLDumpPath() { var Location = ImportHelper.GetRegistryKeyValue(MYSQL51_REGISTRY_KEY, "Location"); return(Path.Combine(Location, "bin", "mysqldump.exe")); }