-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Alt.GlobalMeta.cs
60 lines (50 loc) · 1.69 KB
/
Alt.GlobalMeta.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
57
58
59
60
using System;
using System.Collections.Generic;
using AltV.Net.Elements.Args;
using AltV.Net.Shared.Utils;
namespace AltV.Net
{
public static partial class Alt
{
public static void SetMetaData(string key, object value) => CoreImpl.SetMetaData(key, value);
public static bool HasMetaData(string key) => CoreImpl.HasMetaData(key);
public static void DeleteMetaData(string key) => CoreImpl.DeleteMetaData(key);
public static bool GetMetaData<T>(string key, out T result)
{
CoreImpl.GetMetaData(key, out var mValue);
using (mValue)
{
try
{
result = Utils.GetCastedMValue<T>(mValue);
return true;
}
catch
{
result = default;
return false;
}
}
}
public static void SetSyncedMetaData(string key, object value) => CoreImpl.SetSyncedMetaData(key, value);
public static bool HasSyncedMetaData(string key) => CoreImpl.HasSyncedMetaData(key);
public static void DeleteSyncedMetaData(string key) => CoreImpl.DeleteSyncedMetaData(key);
public static bool GetSyncedMetaData<T>(string key, out T result)
{
CoreImpl.GetSyncedMetaData(key, out var mValue);
using (mValue)
{
try
{
result = Utils.GetCastedMValue<T>(mValue);
return true;
}
catch
{
result = default;
return false;
}
}
}
}
}