MySQL assembly loader fixed.

This commit is contained in:
feodor_fitsner 2012-07-04 02:09:48 -07:00
parent 90219f284f
commit 326b32e769

View file

@ -148,24 +148,30 @@ namespace WebsitePanel.Providers.Database
Log.WriteInfo("Connector location is either null or empty"); Log.WriteInfo("Connector location is either null or empty");
return null; return null;
} }
//
string assemblyFile = String.Empty; string assemblyFile = args.Name.Split(',')[0] + ".dll";
// Versions 5.x.x compatibility
if (connectorVersion.StartsWith("5.")) // 1st location
assemblyFile = Path.Combine(connectorLocation, @"Binaries\.NET 2.0\" + args.Name.Split(',')[0] + ".dll"); string assemblyPath = Path.Combine(connectorLocation, @"Binaries\.NET 2.0\" + assemblyFile);
// Newest versions compatibility if (!File.Exists(assemblyPath))
else {
assemblyFile = Path.Combine(connectorLocation, @"Assemblies\" + args.Name.Split(',')[0] + ".dll"); // 2nd location
// assemblyPath = Path.Combine(connectorLocation, @"Assemblies\" + assemblyFile);
Log.WriteInfo(assemblyFile);
// if (!File.Exists(assemblyPath))
if (!File.Exists(assemblyFile)) {
{ // 3rd location
Log.WriteInfo("Connector assembly could not be found or does not exist"); assemblyPath = Path.Combine(connectorLocation, @"Assemblies\v2.0" + assemblyFile);
return null;
} if (!File.Exists(assemblyPath))
// {
return Assembly.LoadFrom(assemblyFile); Log.WriteInfo("Connector assembly could not be found or does not exist");
return null; // sorry, cannot find
}
}
}
return Assembly.LoadFrom(assemblyPath);
} }
#endregion #endregion
@ -762,7 +768,15 @@ namespace WebsitePanel.Providers.Database
DataView dvProcesses = new DataView(dtProcesses); DataView dvProcesses = new DataView(dtProcesses);
foreach (DataRowView rowSid in dvProcesses) foreach (DataRowView rowSid in dvProcesses)
{ {
ExecuteNonQuery(String.Format("KILL {0}", rowSid["Id"])); string cmdText = String.Format("KILL {0}", rowSid["Id"]);
try
{
ExecuteNonQuery(cmdText);
}
catch(Exception ex)
{
Log.WriteError("Cannot drop MySQL connection: " + cmdText, ex);
}
} }
} }