Steamworks.DllCheck.CheckSteamAPIDLL C# (CSharp) Method

CheckSteamAPIDLL() private static method

private static CheckSteamAPIDLL ( ) : bool
return bool
		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

Usage Example

Exemplo n.º 1
0
 // Token: 0x0600042B RID: 1067 RVA: 0x0000F5B4 File Offset: 0x0000D7B4
 public static bool Test()
 {
     return(DllCheck.CheckSteamAPIDLL());
 }