private static bool CheckSteamAPIDLL() {
string fileName;
int fileBytes;
if (IntPtr.Size == 4) {
fileName = "steam_api.dll";
fileBytes = Version.SteamAPIDLLSize;
}
else {
fileName = "steam_api64.dll";
fileBytes = Version.SteamAPI64DLLSize;
}
IntPtr handle = GetModuleHandle(fileName);
if (handle == IntPtr.Zero) {
return true;
}
StringBuilder filePath = new StringBuilder(256);
GetModuleFileName(handle, filePath, filePath.Capacity);
string file = filePath.ToString();
// If we can not find the file we'll just skip it and let the DllNotFoundException take care of it.
if (System.IO.File.Exists(file)) {
System.IO.FileInfo fInfo = new System.IO.FileInfo(file);
if (fInfo.Length != fileBytes) {
return false;
}
if (System.Diagnostics.FileVersionInfo.GetVersionInfo(file).FileVersion != Version.SteamAPIDLLVersion) {
return false;
}
}
return true;
}
#endif