forked from FabianTerhorst/coreclr-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAltAsync.ToAsync.cs
More file actions
112 lines (88 loc) · 4.3 KB
/
AltAsync.ToAsync.cs
File metadata and controls
112 lines (88 loc) · 4.3 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using AltV.Net.Async.Elements.Entities;
using AltV.Net.Elements.Entities;
namespace AltV.Net.Async
{
public static partial class AltAsync
{
public static IPlayer ToAsync(this IPlayer player, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(player) ? new AsyncPlayer(player, asyncContext) : null;
public static IVehicle ToAsync(this IVehicle vehicle, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(vehicle) ? new AsyncVehicle(vehicle, asyncContext) : null;
public static ICheckpoint ToAsync(this ICheckpoint checkpoint, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(checkpoint) ? new AsyncCheckpoint(checkpoint, asyncContext) : null;
public static IColShape ToAsync(this IColShape colShape, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(colShape) ? new AsyncColShape(colShape, asyncContext) : null;
public static IBlip ToAsync(this IBlip blip, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(blip) ? new AsyncBlip(blip, asyncContext) : null;
public static IVoiceChannel ToAsync(this IVoiceChannel voiceChannel, IAsyncContext asyncContext) =>
asyncContext == null || asyncContext.CreateRef(voiceChannel) ? new AsyncVoiceChannel(voiceChannel, asyncContext) : null;
public static IPlayer ToAsync(this IPlayer player) => new AsyncPlayer(player, null);
public static IVehicle ToAsync(this IVehicle vehicle) => new AsyncVehicle(vehicle, null);
public static ICheckpoint ToAsync(this ICheckpoint checkpoint) => new AsyncCheckpoint(checkpoint, null);
public static IColShape ToAsync(this IColShape colShape) => new AsyncColShape(colShape, null);
public static IBlip ToAsync(this IBlip blip) => new AsyncBlip(blip, null);
public static IVoiceChannel ToAsync(this IVoiceChannel voiceChannel) => new AsyncVoiceChannel(voiceChannel, null);
public static bool TryToAsync(this IPlayer thisValue, IAsyncContext asyncContext, out IPlayer player)
{
if (!asyncContext.CreateRef(thisValue, true))
{
player = default;
return false;
}
player = new AsyncPlayer(thisValue, asyncContext);
return true;
}
public static bool TryToAsync(this IVehicle thisValue, IAsyncContext asyncContext, out IVehicle vehicle)
{
if (!asyncContext.CreateRef(thisValue, true))
{
vehicle = default;
return false;
}
vehicle = new AsyncVehicle(thisValue, asyncContext);
return true;
}
public static bool TryToAsync(this ICheckpoint thisValue, IAsyncContext asyncContext,
out ICheckpoint checkpoint)
{
if (!asyncContext.CreateRef(thisValue, true))
{
checkpoint = default;
return false;
}
checkpoint = new AsyncCheckpoint(thisValue, asyncContext);
return true;
}
public static bool TryToAsync(this IColShape thisValue, IAsyncContext asyncContext, out IColShape colShape)
{
if (!asyncContext.CreateRef(thisValue, true))
{
colShape = default;
return false;
}
colShape = new AsyncColShape(thisValue, asyncContext);
return true;
}
public static bool TryToAsync(this IBlip thisValue, IAsyncContext asyncContext, out IBlip blip)
{
if (!asyncContext.CreateRef(thisValue, true))
{
blip = default;
return false;
}
blip = new AsyncBlip(thisValue, asyncContext);
return true;
}
public static bool TryToAsync(this IVoiceChannel thisValue, IAsyncContext asyncContext,
out IVoiceChannel voiceChannel)
{
if (!asyncContext.CreateRef(thisValue, true))
{
voiceChannel = default;
return false;
}
voiceChannel = new AsyncVoiceChannel(thisValue, asyncContext);
return true;
}
}
}