-
Notifications
You must be signed in to change notification settings - Fork 9
/
ThrowIf.cs
43 lines (37 loc) · 1015 Bytes
/
ThrowIf.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
namespace Com.Xenthrax.DllInjector
{
public partial class DllInjector : IDisposable
{
private void ThrowIfDisposed()
{
if (this.Disposed)
throw new ObjectDisposedException(this.GetType().Name);
}
private void ThrowIfNoProcess()
{
if (this._Process == null || this._Process.HasExited)
throw new NullReferenceException("Process does not exist or has exited.");
}
private void ThrowIfNoHandle()
{
if (!this.HasProcessHandle)
throw new Exception("AcquireProcessHandle must be called prior to calling this function.");
}
private void ThrowIfNoCLR()
{
if (!this.HasCommonLanguageRuntime)
throw new Exception("LoadCommonLanguageRuntime must be called prior to calling this function.");
}
private void ThrowIfx86()
{
if (!this.Is64BitProcess)
throw new Exception("Requires x64");
}
private void ThrowIfx64()
{
if (this.Is64BitProcess)
throw new Exception("Requires x86");
}
}
}