forked from altmp/coreclr-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibrary.cs
56 lines (45 loc) · 1.62 KB
/
Library.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
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.Runtime.CompilerServices;
using AltV.Net.CApi.Libraries;
using AltV.Net.Native;
#pragma warning disable CS8618
[assembly: InternalsVisibleTo("AltV.Net")]
[assembly: InternalsVisibleTo("AltV.Net.Shared")]
[assembly: InternalsVisibleTo("AltV.Net.Client")]
[assembly: InternalsVisibleTo("AltV.Net.Mock")]
[assembly: InternalsVisibleTo("AltV.Net.Mock2")]
[assembly: InternalsVisibleTo("AltV.Net.Async")]
namespace AltV.Net.CApi
{
public delegate bool EventCallback(IntPtr eventPointer, IntPtr userData);
public delegate void TickCallback(IntPtr userData);
public delegate void CommandCallback(StringView cmd, StringViewArray args, IntPtr userData);
public interface ILibrary
{
public IClientLibrary Client { get; }
public IServerLibrary Server { get; }
public ISharedLibrary Shared { get; }
public bool Outdated { get; }
}
public class Library : ILibrary
{
public IClientLibrary Client { get; }
public IServerLibrary Server { get; }
public ISharedLibrary Shared { get; }
public bool Outdated { get; }
public Library(Dictionary<ulong, IntPtr> funcTable, bool client)
{
Shared = new SharedLibrary(funcTable);
if (Shared.Outdated) Outdated = true;
if (client)
{
Client = new ClientLibrary(funcTable);
if (Client.Outdated) Outdated = true;
}
else
{
Server = new ServerLibrary(funcTable);
if (Server.Outdated) Outdated = true;
}
}
}
}