static Expedition() { const string regPath = @"SOFTWARE\Expedition\Core"; try { RegistryKey key = Registry.CurrentUser.OpenSubKey(regPath); var dllPath = (string) key.GetValue("Location"); dllPath = dllPath + @"\ExpDLL.dll"; unsafe { void* handle = LoadLibrary(dllPath); if(handle == null) { throw new DllNotFoundException("Unable to find Expedition DLL"); } log.Debug("Successfully loaded ExpDLL.dll"); unloader = new LibraryUnloader(handle); } }catch(NullReferenceException e) { log.Fatal("Expedition not installed", e); } catch(DllNotFoundException e) { log.Fatal(e.Message, e); } }
static Expedition() { const string regPath = @"SOFTWARE\Expedition\Core"; try { RegistryKey key = Registry.CurrentUser.OpenSubKey(regPath); var dllPath = (string)key.GetValue("Location"); dllPath = dllPath + @"\ExpDLL.dll"; unsafe { void *handle = LoadLibrary(dllPath); if (handle == null) { throw new DllNotFoundException("Unable to find Expedition DLL"); } log.Debug("Successfully loaded ExpDLL.dll"); unloader = new LibraryUnloader(handle); } }catch (NullReferenceException e) { log.Fatal("Expedition not installed", e); } catch (DllNotFoundException e) { log.Fatal(e.Message, e); } }
static NativeLibNative() { string path; if (IntPtr.Size == 4) { path = "x86/NativeLib.dll"; } else { path = "x64/NativeLib.dll"; } unsafe { void *handle = LoadLibrary(path); if (handle == null) { throw new DllNotFoundException("unable to find the native library: " + path); } unloader = new LibraryUnloader(handle); } }
static StandardFormatsRunFactory() { string path; if (IntPtr.Size == 4) { path = "x86/livesplit_core.dll"; } else { path = "x64/livesplit_core.dll"; } unsafe { void *handle = LoadLibrary(path); if (handle == null) { throw new DllNotFoundException("Unable to find the native livesplit-core library: " + path); } unloader = new LibraryUnloader(handle); } }
static NativeMethods() { string path; // set the path according to some logic path = "somewhere/in/a/temporary/directory/Foo.dll"; unsafe { void *handle = LoadLibrary(path); if (handle == null) { throw new DllNotFoundException("unable to find the native Foo library: " + path); } unloader = new LibraryUnloader(handle); } }
static RivaTuner() { if (!IsRivaRunning()) { RunRiva(); } string path = "./dependencies/rivatuner/rivatuner.dll"; // x64 only, since PUBG is x64, so why would you run it on an x86 machine unsafe { void *handle = LoadLibrary(path); if (handle == null) { throw new DllNotFoundException("Unable to find the native rivatuner library: " + path); } unloader = new LibraryUnloader(handle); } }
static NativeMethods() { string path; if (IntPtr.Size == 4) { path = "path/to/the/32/bit/Foo.dll"; } else { path = "path/to/the/64/bit/Foo.dll"; } var handle = LoadLibrary(path); if (handle == null) { throw new DllNotFoundException("unable to find the native Foo library: " + path); } unloader = new LibraryUnloader(handle); }