diff --git a/PlugifyProfiler/.gitignore b/PlugifyProfiler/.gitignore new file mode 100644 index 0000000..8313eab --- /dev/null +++ b/PlugifyProfiler/.gitignore @@ -0,0 +1,7 @@ +.vs/ +.idea/ +bin/ +obj/ +*.dll +*.pdb +*.json \ No newline at end of file diff --git a/PlugifyProfiler/Convars.cs b/PlugifyProfiler/Convars.cs new file mode 100644 index 0000000..b236bbc --- /dev/null +++ b/PlugifyProfiler/Convars.cs @@ -0,0 +1,53 @@ +using System; +using s2sdk; +using static s2sdk.s2sdk; + +namespace PlugifyProfiler; + +public partial class PlugifyProfiler +{ + internal ConVar? PlayerSpeedHasHostage; + public static int ConvarActionMultiplier = 1024; + + public void FindConvar() + { + profilerService.StartRecording("Find ConVar"); + PlayerSpeedHasHostage = ConVar.Find("sv_cs_player_speed_has_hostage"); + profilerService.StopRecording("Find ConVar"); + } + + public void ReadConvar() + { + profilerService.StartRecording($"Read ConVar ({ConvarActionMultiplier} times)"); + for (int i = 0; i < ConvarActionMultiplier; i++) + { + var value = PlayerSpeedHasHostage?.GetValue(); + } + profilerService.StopRecording($"Read ConVar ({ConvarActionMultiplier} times)"); + } + + public void WriteConvar() + { + profilerService.StartRecording($"Write ConVar ({ConvarActionMultiplier} times)"); + + for (int i = 0; i < ConvarActionMultiplier; i++) + { + PlayerSpeedHasHostage!.SetFloat(0.5f + (i % 10) * 0.1f, false, false); + } + + profilerService.StopRecording($"Write ConVar ({ConvarActionMultiplier} times)"); + } + + public void ReplicateConvarToClient(int playerid) + { + profilerService.StartRecording($"Replicate ConVar to Client ({ConvarActionMultiplier} times)"); + + for (int i = 0; i < ConvarActionMultiplier; i++) + { + PlayerSpeedHasHostage!.SendValue(playerid, Random.Shared.NextDouble().ToString()); + } + + profilerService.StopRecording($"Replicate ConVar to Client ({ConvarActionMultiplier} times)"); + + } +} \ No newline at end of file diff --git a/PlugifyProfiler/Entitites.cs b/PlugifyProfiler/Entitites.cs new file mode 100644 index 0000000..5a1c3be --- /dev/null +++ b/PlugifyProfiler/Entitites.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Numerics; +using s2sdk; +using static s2sdk.s2sdk; + +namespace PlugifyProfiler; + +public unsafe partial class PlugifyProfiler +{ + public List Entities = new(); + + public void CreateEntities() + { + profilerService.StartRecording($"Create {MaxEntities} entities"); + for (int i = 0; i < MaxEntities; i++) + { + Entities.Add(CreateEntityByName("point_worldtext")!); + } + profilerService.StopRecording($"Create {MaxEntities} entities"); + } + + public void SpawnEntities() + { + profilerService.StartRecording($"Spawn {Entities.Count} entities"); + foreach (var entity in Entities) + { + DispatchSpawn(entity); + } + profilerService.StopRecording($"Spawn {Entities.Count} entities"); + } + + public void SchemaWriteEntities() + { + profilerService.StartRecording($"Schema Write + Update ({Entities.Count} entities)"); + int index = 0; + foreach (var entity in Entities) + { + var text = $"Performance Test Entity #{index}{Random.Shared.NextInt64()}"; + SetEntSchemaString(entity, "CPointWorldText", "m_messageText", text, true, 0); + var color = Color.FromArgb(255, 255, 0, 0).ToRgba(); + SetEntSchema(entity, "CPointWorldText", "m_Color", color, true, 0); + index++; + } + profilerService.StopRecording($"Schema Write + Update ({Entities.Count} entities)"); + } + + public void SchemaReadEntities() + { + profilerService.StartRecording($"Schema Read ({Entities.Count} entities)"); + foreach (var entity in Entities) + { + var message = GetEntSchemaString(entity, "CPointWorldText", "m_messageText", 0); + var color = ColorExtensions.FromRgba((int)GetEntSchema(entity, "CPointWorldText", "m_Color", 0)); + var enabled = GetEntSchema(entity, "CPointWorldText", "m_bEnabled", 0); + var testColor = Color.FromArgb(255, Math.Clamp(color.R * 2, 0, 255), Math.Clamp(color.G * 2, 0, 255), Math.Clamp(color.B * 2, 0, 255)); + } + profilerService.StopRecording($"Schema Read ({Entities.Count} entities)"); + } + + public void VirtualCallEntities() + { + profilerService.StartRecording($"Virtual Calls (teleport {Entities.Count} entities)"); + int index = 0; + foreach (var entity in Entities) + { + TeleportEntity(entity, new Vector3(0, index * 10, 0), Vector3.Zero, Vector3.Zero); + index++; + } + profilerService.StopRecording($"Virtual Calls (teleport {Entities.Count} entities)"); + } + + public void GetGameRules() + { + profilerService.StartRecording("Get Game Rules"); + + var gameRules = s2sdk.s2sdk.GetGameRules(); + + profilerService.StopRecording("Get Game Rules"); + } + + public void DespawnEntity(int entity) + { + profilerService.StartRecording($"Despawn entity (1 entity)"); + RemoveEntity(entity); + profilerService.StopRecording($"Despawn entity (1 entity)"); + } + + public void TeleportAllGameEntities() + { + var i = GetFirstActiveEntity(); + var convertedEntities = new List(); + for (; i != -1; i = GetNextActiveEntity(i)) + { + convertedEntities.Add(i); + } + + profilerService.StartRecording("Teleport All Game Entities"); + + foreach (var entity in convertedEntities) + { + if (GetEntityClassname(entity) != "cs_player_controller") + { + TeleportEntity(entity, new Vector3(Random.Shared.Next(-1000, 1000), Random.Shared.Next(-1000, 1000), Random.Shared.Next(0, 500)), Vector3.Zero, Vector3.Zero); + } + } + + profilerService.StopRecording("Teleport All Game Entities"); + } +} + +public static class ColorExtensions +{ + public static int ToRgba(this Color c) + { + return (c.A << 24) | + (c.R << 16) | + (c.G << 8) | + c.B; + } + + public static Color FromRgba(int v) + { + byte a = (byte)((v >> 24) & 0xFF); + byte r = (byte)((v >> 16) & 0xFF); + byte g = (byte)((v >> 8) & 0xFF); + byte b = (byte)(v & 0xFF); + return Color.FromArgb(a, r, g, b); + } +} \ No newline at end of file diff --git a/PlugifyProfiler/GameEvents.cs b/PlugifyProfiler/GameEvents.cs new file mode 100644 index 0000000..27caf76 --- /dev/null +++ b/PlugifyProfiler/GameEvents.cs @@ -0,0 +1,21 @@ +using s2sdk; + +namespace PlugifyProfiler; + +public partial class PlugifyProfiler +{ + public void FireGameEventsToPlayer() + { + profilerService.StartRecording($"Fire Game Event to Players"); + + var e = new EventInfo("show_survival_respawn_status", true); + + e.SetString("loc_token", "some message"); + e.SetInt("duration", 1); + e.SetInt("userid", 0); + + e.FireToClient(0); + + profilerService.StopRecording($"Fire Game Event to Players"); + } +} \ No newline at end of file diff --git a/PlugifyProfiler/NetMessages.cs b/PlugifyProfiler/NetMessages.cs new file mode 100644 index 0000000..e798566 --- /dev/null +++ b/PlugifyProfiler/NetMessages.cs @@ -0,0 +1,45 @@ +using s2sdk; + +namespace PlugifyProfiler; + +public partial class PlugifyProfiler +{ + public static int NetMessageMultiplier = 1024; + + public void SendNetMessages() + { + profilerService.StartRecording($"Send NetMessage to All Players"); + + var message = new UserMessage(120); + message.SetFloat("frequency", 1.0f); + message.AddAllPlayers(); + message.Send(); + + profilerService.StopRecording($"Send NetMessage to All Players"); + } + + internal void CMsgSosStartSoundEventHandler(UserMessage msg) + { + profilerService.StartRecording($"CMsgSosStartSoundEvent Add All Recipients (Server sends NetMessage, {NetMessageMultiplier} times)"); + + for (int i = 0; i < NetMessageMultiplier; i++) + msg.AddAllPlayers(); + + profilerService.StopRecording($"CMsgSosStartSoundEvent Add All Recipients (Server sends NetMessage, {NetMessageMultiplier} times)"); + } + + // public void CCLCMsg_MoveHandler(CCLCMsg_Move msg, int playerid) + // { + // Core.Profiler.StartRecording($"CCLCMsg_Move Simulate Data (Server receives NetMessage, {NetMessageMultiplier} times)"); + + // for (int i = 0; i < NetMessageMultiplier; i++) + // { + // var data = BitConverter.ToString(msg.Data); // convert bytes to string + // _ = data.Length * playerid; + // } + + // Core.Profiler.StopRecording($"CCLCMsg_Move Simulate Data (Server receives NetMessage, {NetMessageMultiplier} times)"); + // } + + // this is disabled due to not being implemented yet in CounterStrikeSharp +} \ No newline at end of file diff --git a/PlugifyProfiler/PlugifyProfiler.cs b/PlugifyProfiler/PlugifyProfiler.cs new file mode 100644 index 0000000..18fed1c --- /dev/null +++ b/PlugifyProfiler/PlugifyProfiler.cs @@ -0,0 +1,119 @@ +using System; +using System.IO; +using Plugify; +using s2sdk; +using static s2sdk.s2sdk; + +namespace PlugifyProfiler; + +public unsafe partial class PlugifyProfiler : Plugin +{ + public static int MaxEntities = 1024; + public static int AddBots = 30; // by default there are 1 bot and 1 player spawned + public static int BotQuota = 32; + public bool IsTestInProgress = false; + public float StartMemory = 0.0f; + public float EndMemory = 0.0f; + + internal ConVar? BotQuotaConVar; + + private ProfileService profilerService = new(); + + public void OnPluginStart() + { + profilerService.Enable(); + + OnEntityCreated_Register((entity) => + { + if (!IsTestInProgress) return; + + DespawnEntity(entity); + }); + + OnGameFrame_Register((simulating, firstTick, lastTick) => + { + if (!IsTestInProgress) return; + + GetGameRules(); + TeleportAllGameEntities(); + + FindConvar(); + ReadConvar(); + WriteConvar(); + + var players = GetMaxClients(); + for (int i = 1; i <= players; i++) + { + ReplicateConvarToClient(i); + } + + FireGameEventsToPlayer(); + + SendNetMessages(); + }); + + var flags = ConVarFlag.LinkedConcommand | ConVarFlag.Release | ConVarFlag.ClientCanExecute; + AddConsoleCommand("preparetest", "", flags, PrepareTestCommand, HookMode.Post); + AddConsoleCommand("savetest", "", flags, SaveTestCommand, HookMode.Post); + AddConsoleCommand("starttest", "", flags, StartTestCommand, HookMode.Post); + AddConsoleCommand("endtest", "", flags, EndTestCommand, HookMode.Post); + + HookUserMessage(208, (msg) => + { + if (!IsTestInProgress) return ResultType.Continue; + CMsgSosStartSoundEventHandler(new UserMessage(msg)); + return ResultType.Continue; + }, HookMode.Post); + } + + public ResultType PrepareTestCommand(int caller, CommandCallingContext context, string[] arguments) + { + var cvar = ConVar.Find("bot_quota"); + cvar.SetValue(BotQuota.ToString(), false, false); + + for (int i = 0; i < AddBots; i++) + { + ServerCommand("bot_add"); + } + + Console.WriteLine($"Added {AddBots} bots for profiling test. Current bot quota is {cvar.GetValue()}. Total player count: {GetMaxClients()}"); + return ResultType.Continue; + } + + public ResultType SaveTestCommand(int caller, CommandCallingContext context, string[] arguments) + { + var json = profilerService.GenerateJSONPerformance(""); + File.WriteAllText("profiler_output.json", json); + Console.WriteLine("Profiler data saved to profiler_output.json"); + return ResultType.Continue; + } + + public ResultType StartTestCommand(int caller, CommandCallingContext context, string[] arguments) + { + StartMemory = GC.GetTotalMemory(true) / (1024.0f * 1024.0f); + IsTestInProgress = true; + + CreateEntities(); + SpawnEntities(); + + SchemaWriteEntities(); + SchemaReadEntities(); + VirtualCallEntities(); + return ResultType.Continue; + } + + public ResultType EndTestCommand(int caller, CommandCallingContext context, string[] arguments) + { + IsTestInProgress = false; + + EndMemory = GC.GetTotalMemory(false) / (1024.0f * 1024.0f); + GC.Collect(); + float MemoryAfterGC = GC.GetTotalMemory(false) / (1024.0f * 1024.0f); + + Console.WriteLine("=== Profiler Test Memory Usage ==="); + Console.WriteLine($"Memory Before Test: {StartMemory} MB"); + Console.WriteLine($"Memory After Test: {EndMemory} MB"); + Console.WriteLine($"Memory After GC: {MemoryAfterGC} MB"); + return ResultType.Continue; + } +} \ No newline at end of file diff --git a/PlugifyProfiler/PlugifyProfiler.csproj b/PlugifyProfiler/PlugifyProfiler.csproj new file mode 100644 index 0000000..ad06233 --- /dev/null +++ b/PlugifyProfiler/PlugifyProfiler.csproj @@ -0,0 +1,27 @@ + + + + net10.0 + disable + enable + true + PlugifyProfiler + ModSharpProfiler + + + + + Sharp.Extensions.GameEventManager.dll + + + + + + + + + + + + + diff --git a/PlugifyProfiler/PlugifyProfiler.pplugin b/PlugifyProfiler/PlugifyProfiler.pplugin new file mode 100644 index 0000000..e4a5ac1 --- /dev/null +++ b/PlugifyProfiler/PlugifyProfiler.pplugin @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/untrustedmodders/plugify/refs/heads/main/schemas/plugin.schema.json", + "version": "1.0.0", + "name": "PlugifyProfiler", + "description": "", + "author": "untrustedmodders", + "website": "https://github.com/untrustedmodders/", + "license": "MIT", + "entry": "PlugifyProfiler.dll", + "platforms": [], + "language": "dotnet", + "dependencies": [ + { + "name": "s2sdk" + } + ], + "methods": [ + ] +} diff --git a/PlugifyProfiler/PlugifyProfiler.sln b/PlugifyProfiler/PlugifyProfiler.sln new file mode 100644 index 0000000..2a55a4b --- /dev/null +++ b/PlugifyProfiler/PlugifyProfiler.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.2.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlugifyProfiler", "PlugifyProfiler.csproj", "{AE47CC31-C626-7BE4-BBD8-105B9EA52078}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AE47CC31-C626-7BE4-BBD8-105B9EA52078}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE47CC31-C626-7BE4-BBD8-105B9EA52078}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE47CC31-C626-7BE4-BBD8-105B9EA52078}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE47CC31-C626-7BE4-BBD8-105B9EA52078}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6CB51C79-5044-41CE-8848-A368670B0B08} + EndGlobalSection +EndGlobal diff --git a/PlugifyProfiler/PlugifyProfiler.sln.DotSettings.user b/PlugifyProfiler/PlugifyProfiler.sln.DotSettings.user new file mode 100644 index 0000000..44cb258 --- /dev/null +++ b/PlugifyProfiler/PlugifyProfiler.sln.DotSettings.user @@ -0,0 +1,2 @@ + + ForceIncluded \ No newline at end of file diff --git a/PlugifyProfiler/Profiler.cs b/PlugifyProfiler/Profiler.cs new file mode 100644 index 0000000..aff968e --- /dev/null +++ b/PlugifyProfiler/Profiler.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; + +internal class ProfileService +{ + private readonly object _lock = new(); + private bool _enabled = false; + + private readonly Dictionary> _statsTable = new(); + private readonly Dictionary> _activeStartsUs = new(); + + // High-precision timestamping via Stopwatch, mapped to epoch micros + private readonly long _swBaseTicks; + private readonly ulong _epochBaseMicros; + private readonly double _ticksToMicro; + + private sealed class Stat + { + public ulong Count; + public ulong TotalUs; + public ulong MinUs = ulong.MaxValue; + public ulong MaxUs = 0UL; + } + + public ProfileService() + { + _swBaseTicks = Stopwatch.GetTimestamp(); + // Capture epoch micros at approximately the same moment as base ticks + var epochTicks = DateTimeOffset.UtcNow.Ticks - DateTimeOffset.UnixEpoch.Ticks; // 100ns ticks + _epochBaseMicros = (ulong)(epochTicks / 10); + _ticksToMicro = 1_000_000.0 / Stopwatch.Frequency; + } + + private ulong NowMicrosecondsSinceUnixEpoch() + { + var deltaTicks = Stopwatch.GetTimestamp() - _swBaseTicks; + var micros = (ulong)(deltaTicks * _ticksToMicro); + return _epochBaseMicros + micros; + } + + public void Enable() + { + lock (_lock) + { + _statsTable.Clear(); + _activeStartsUs.Clear(); + _enabled = true; + } + } + + public void Disable() + { + lock (_lock) + { + _enabled = false; + _statsTable.Clear(); + _activeStartsUs.Clear(); + } + } + + public bool IsEnabled() + { + lock (_lock) + { + return _enabled; + } + } + + public void StartRecordingWithIdentifier(string identifier, string name) + { + if (!_enabled) return; + lock (_lock) + { + if (!_activeStartsUs.TryGetValue(identifier, out var startMap)) + { + startMap = new Dictionary(StringComparer.Ordinal); + _activeStartsUs[identifier] = startMap; + } + startMap[name] = NowMicrosecondsSinceUnixEpoch(); + } + } + public void StopRecordingWithIdentifier(string identifier, string name) + { + if (!_enabled) return; + lock (_lock) + { + if (!_activeStartsUs.TryGetValue(identifier, out var startMap)) return; + if (!startMap.TryGetValue(name, out var startUs)) return; + var endUs = NowMicrosecondsSinceUnixEpoch(); + var durUs = endUs > startUs ? endUs - startUs : 0UL; + startMap.Remove(name); + + if (!_statsTable.TryGetValue(identifier, out var nameToStat)) + { + nameToStat = new Dictionary(StringComparer.Ordinal); + _statsTable[identifier] = nameToStat; + } + if (!nameToStat.TryGetValue(name, out var stat)) + { + stat = new Stat(); + nameToStat[name] = stat; + } + + stat.Count++; + stat.TotalUs += durUs; + if (durUs < stat.MinUs) stat.MinUs = durUs; + if (durUs > stat.MaxUs) stat.MaxUs = durUs; + } + } + public void RecordTimeWithIdentifier(string identifier, string name, double duration) + { + lock (_lock) + { + if (!_enabled) return; + + var durUs = duration <= 0 ? 0UL : (ulong)duration; + + if (!_statsTable.TryGetValue(identifier, out var nameToStat)) + { + nameToStat = new Dictionary(StringComparer.Ordinal); + _statsTable[identifier] = nameToStat; + } + if (!nameToStat.TryGetValue(name, out var stat)) + { + stat = new Stat(); + nameToStat[name] = stat; + } + + stat.Count++; + stat.TotalUs += durUs; + if (durUs < stat.MinUs) stat.MinUs = durUs; + if (durUs > stat.MaxUs) stat.MaxUs = durUs; + } + } + + public void StartRecording(string name) + { + StartRecordingWithIdentifier("Plugify", name); + } + + public void StopRecording(string name) + { + StopRecordingWithIdentifier("Plugify", name); + } + + public void RecordTime(string name, double duration) + { + RecordTimeWithIdentifier("Plugify", name, duration); + } + + public string GenerateJSONPerformance(string pluginId) + { + // snapshot stats + Dictionary> stats; + lock (_lock) + { + stats = _statsTable.ToDictionary( + kv => kv.Key, + kv => kv.Value.ToDictionary(inner => inner.Key, inner => new Stat + { + Count = inner.Value.Count, + TotalUs = inner.Value.TotalUs, + MinUs = inner.Value.Count == 0 ? 0UL : inner.Value.MinUs, + MaxUs = inner.Value.MaxUs, + }, StringComparer.Ordinal), StringComparer.Ordinal); + } + + var traceEvents = new List>(); + + // Metadata events + traceEvents.Add(new Dictionary { + { "args", new Dictionary { { "name", "Plugify" } } }, + { "cat", "__metadata" }, + { "name", "process_name" }, + { "ph", "M" }, + { "pid", 1 }, + { "tid", 1 }, + { "ts", 0UL }, + }); + traceEvents.Add(new Dictionary { + { "args", new Dictionary { { "name", "Plugify Main" } } }, + { "cat", "__metadata" }, + { "name", "thread_name" }, + { "ph", "M" }, + { "pid", 1 }, + { "tid", 1 }, + { "ts", 0UL }, + }); + traceEvents.Add(new Dictionary { + { "args", new Dictionary { { "name", "Plugify Profiler" } } }, + { "cat", "__metadata" }, + { "name", "thread_name" }, + { "ph", "M" }, + { "pid", 1 }, + { "tid", 2 }, + { "ts", 0UL }, + }); + + string FormatUs(float us) + { + // switch to ms when duration reaches 0.01 ms (10 microseconds) + if (us >= 10f) + { + var ms = us / 1000f; + return $"{ms:F2}ms"; + } + var ius = (ulong)System.MathF.Max(0f, us); + return $"{ius:d}.00μs"; + } + + foreach (var (plugin, nameMap) in stats) + { + if (!string.IsNullOrEmpty(pluginId) && !string.Equals(pluginId, plugin, StringComparison.Ordinal)) + { + continue; + } + foreach (var (name, stat) in nameMap) + { + var count = stat.Count; + float minUs = count == 0 ? 0f : stat.MinUs; + float maxUs = stat.MaxUs; + float avgUs = count == 0 ? 0f : (float)(stat.TotalUs / (double)count); + var eventName = $"{name} [{plugin}] (min={FormatUs(minUs)},avg={FormatUs(avgUs)},max={FormatUs(maxUs)},count={(ulong)count})"; + + traceEvents.Add(new Dictionary { + { "name", eventName }, + { "ph", "X" }, + { "tid", 2 }, + { "pid", 1 }, + { "ts", 0UL }, + { "dur", stat.TotalUs }, + }); + } + } + + var root = new Dictionary { + { "traceEvents", traceEvents } + }; + + var options = new JsonSerializerOptions + { + PropertyNamingPolicy = null, + WriteIndented = false, + DefaultIgnoreCondition = JsonIgnoreCondition.Never, + }; + + return JsonSerializer.Serialize(root, options); + } +} diff --git a/PlugifyProfiler/README.md b/PlugifyProfiler/README.md new file mode 100644 index 0000000..323f52c --- /dev/null +++ b/PlugifyProfiler/README.md @@ -0,0 +1,68 @@ +# PlugifyProfiler + +A C# profiling plugin for Plugify framework to monitor and analyze performance metrics in Source 2 games. + +## Requirements + +This plugin requires one of the following to run: +- **Plugify Launcher**, or +- **Metamod plugin** (khook branch) + +For detailed installation guides for these requirements, visit: +**https://plugify.net/use-cases/integrations** + +## Dependencies + +To run this C# plugin, you need the following dependencies installed: + +1. **Source 2 SDK Plugin** - Provides Source 2 game functions +2. **DotNet Language Module** - Required to execute C# plugins + +## Installation + +### 1. Install Required Modules and Plugins + +Use the integrated package manager (mamba) to install all dependencies: + +```bash +# Install C++ language module (required to run C++ plugins) +mamba install -n modules -c "https://untrustedmodders.github.io/plugify-module-cpp/" plugify-module-cpp + +# Install plugin configuration support +mamba install -n plugins -c "https://untrustedmodders.github.io/plugify-plugin-configs/" plugify-plugin-configs + +# Install PolyHook for function hooking +mamba install -n plugins -c "https://untrustedmodders.github.io/plugify-plugin-polyhook/" plugify-plugin-polyhook + +# Install Source 2 SDK plugin (provides Source 2 game functions) +mamba install -n plugins -c "https://untrustedmodders.github.io/plugify-plugin-s2sdk/" plugify-plugin-s2sdk + +# Install DotNet language module (required for C# plugins) +mamba install -n modules -c "https://untrustedmodders.github.io/plugify-module-dotnet/" plugify-module-dotnet +``` + +### 2. Install the Plugin + +1. Build the plugin or download the pre-built binaries +2. Copy the plugin files to your Plugify plugins directory +3. Ensure the `PlugifyProfiler.pplugin` manifest and `PlugifyProfiler.dll` are in the same directory +4. Restart your game or reload Plugify plugins + +## Usage + +Once installed and loaded, the plugin will automatically start profiling the configured game functions and entities. + +## Testing + +To test this plugin, ensure you have: +- Plugify Launcher or Metamod plugin (khook branch) properly configured +- All dependencies installed via mamba +- A compatible Source 2 game running + +## License + +MIT License - See LICENSE file for details + +## Author + +untrustedmodders - https://github.com/untrustedmodders/ \ No newline at end of file diff --git a/PlugifyProfiler/imported/s2sdk/bodies.cs b/PlugifyProfiler/imported/s2sdk/bodies.cs new file mode 100644 index 0000000..9f20ef3 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/bodies.cs @@ -0,0 +1,167 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: bodies) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Applies an impulse to an entity at a specific world position. + /// + /// The handle of the entity. + /// The world position where the impulse will be applied. + /// The impulse vector to apply. + internal static delegate* AddBodyImpulseAtPosition = &___AddBodyImpulseAtPosition; + internal static delegate* unmanaged[Cdecl] __AddBodyImpulseAtPosition; + private static void ___AddBodyImpulseAtPosition(int entityHandle, Vector3 position, Vector3 impulse) + { + __AddBodyImpulseAtPosition(entityHandle, &position, &impulse); + } + + /// + /// Adds linear and angular velocity to the entity's physics object. + /// + /// The handle of the entity. + /// The linear velocity vector to add. + /// The angular velocity vector to add. + internal static delegate* AddBodyVelocity = &___AddBodyVelocity; + internal static delegate* unmanaged[Cdecl] __AddBodyVelocity; + private static void ___AddBodyVelocity(int entityHandle, Vector3 linearVelocity, Vector3 angularVelocity) + { + __AddBodyVelocity(entityHandle, &linearVelocity, &angularVelocity); + } + + /// + /// Detaches the entity from its parent. + /// + /// The handle of the entity. + internal static delegate* DetachBodyFromParent = &___DetachBodyFromParent; + internal static delegate* unmanaged[Cdecl] __DetachBodyFromParent; + private static void ___DetachBodyFromParent(int entityHandle) + { + __DetachBodyFromParent(entityHandle); + } + + /// + /// Retrieves the currently active sequence of the entity. + /// + /// The handle of the entity. + /// The sequence ID of the active sequence, or -1 if invalid. + internal static delegate* GetBodySequence = &___GetBodySequence; + internal static delegate* unmanaged[Cdecl] __GetBodySequence; + private static int ___GetBodySequence(int entityHandle) + { + int __retVal = __GetBodySequence(entityHandle); + return __retVal; + } + + /// + /// Checks whether the entity is attached to a parent. + /// + /// The handle of the entity. + /// True if attached to a parent, false otherwise. + internal static delegate* IsBodyAttachedToParent = &___IsBodyAttachedToParent; + internal static delegate* unmanaged[Cdecl] __IsBodyAttachedToParent; + private static Bool8 ___IsBodyAttachedToParent(int entityHandle) + { + Bool8 __retVal = __IsBodyAttachedToParent(entityHandle); + return __retVal; + } + + /// + /// Looks up a sequence ID by its name. + /// + /// The handle of the entity. + /// The name of the sequence. + /// The sequence ID, or -1 if not found. + internal static delegate* LookupBodySequence = &___LookupBodySequence; + internal static delegate* unmanaged[Cdecl] __LookupBodySequence; + private static int ___LookupBodySequence(int entityHandle, string name) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __LookupBodySequence(entityHandle, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves the duration of a specified sequence. + /// + /// The handle of the entity. + /// The name of the sequence. + /// The duration of the sequence in seconds, or 0 if invalid. + internal static delegate* SetBodySequenceDuration = &___SetBodySequenceDuration; + internal static delegate* unmanaged[Cdecl] __SetBodySequenceDuration; + private static float ___SetBodySequenceDuration(int entityHandle, string sequenceName) + { + float __retVal; + var __sequenceName = NativeMethods.ConstructString(sequenceName); + try { + __retVal = __SetBodySequenceDuration(entityHandle, &__sequenceName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__sequenceName); + } + return __retVal; + } + + /// + /// Sets the angular velocity of the entity. + /// + /// The handle of the entity. + /// The new angular velocity vector. + internal static delegate* SetBodyAngularVelocity = &___SetBodyAngularVelocity; + internal static delegate* unmanaged[Cdecl] __SetBodyAngularVelocity; + private static void ___SetBodyAngularVelocity(int entityHandle, Vector3 angVelocity) + { + __SetBodyAngularVelocity(entityHandle, &angVelocity); + } + + /// + /// Sets the material group of the entity. + /// + /// The handle of the entity. + /// The material group token to assign. + internal static delegate* SetBodyMaterialGroup = &___SetBodyMaterialGroup; + internal static delegate* unmanaged[Cdecl] __SetBodyMaterialGroup; + private static void ___SetBodyMaterialGroup(int entityHandle, string materialGroup) + { + var __materialGroup = NativeMethods.ConstructString(materialGroup); + try { + __SetBodyMaterialGroup(entityHandle, &__materialGroup); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__materialGroup); + } + } + + /// + /// Sets the linear velocity of the entity. + /// + /// The handle of the entity. + /// The new velocity vector. + internal static delegate* SetBodyVelocity = &___SetBodyVelocity; + internal static delegate* unmanaged[Cdecl] __SetBodyVelocity; + private static void ___SetBodyVelocity(int entityHandle, Vector3 velocity) + { + __SetBodyVelocity(entityHandle, &velocity); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/clients.cs b/PlugifyProfiler/imported/s2sdk/clients.cs new file mode 100644 index 0000000..93679d3 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/clients.cs @@ -0,0 +1,1859 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: clients) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Retrieves the player slot from a given entity pointer. + /// + /// A pointer to the entity (CBaseEntity*). + /// The player slot if valid, otherwise -1. + internal static delegate* EntPointerToPlayerSlot = &___EntPointerToPlayerSlot; + internal static delegate* unmanaged[Cdecl] __EntPointerToPlayerSlot; + private static int ___EntPointerToPlayerSlot(nint entity) + { + int __retVal = __EntPointerToPlayerSlot(entity); + return __retVal; + } + + /// + /// Returns a pointer to the entity instance by player slot index. + /// + /// Index of the player slot. + /// Pointer to the entity instance, or nullptr if the slot is invalid. + internal static delegate* PlayerSlotToEntPointer = &___PlayerSlotToEntPointer; + internal static delegate* unmanaged[Cdecl] __PlayerSlotToEntPointer; + private static nint ___PlayerSlotToEntPointer(int playerSlot) + { + nint __retVal = __PlayerSlotToEntPointer(playerSlot); + return __retVal; + } + + /// + /// Returns the entity handle associated with a player slot index. + /// + /// Index of the player slot. + /// The index of the entity, or -1 if the handle is invalid. + internal static delegate* PlayerSlotToEntHandle = &___PlayerSlotToEntHandle; + internal static delegate* unmanaged[Cdecl] __PlayerSlotToEntHandle; + private static int ___PlayerSlotToEntHandle(int playerSlot) + { + int __retVal = __PlayerSlotToEntHandle(playerSlot); + return __retVal; + } + + /// + /// Retrieves the client object from a given player slot. + /// + /// The index of the player's slot (0-based). + /// A pointer to the client object if found, otherwise nullptr. + internal static delegate* PlayerSlotToClientPtr = &___PlayerSlotToClientPtr; + internal static delegate* unmanaged[Cdecl] __PlayerSlotToClientPtr; + private static nint ___PlayerSlotToClientPtr(int playerSlot) + { + nint __retVal = __PlayerSlotToClientPtr(playerSlot); + return __retVal; + } + + /// + /// Retrieves the index of a given client object. + /// + /// A pointer to the client object (CServerSideClient*). + /// The player slot if found, otherwise -1. + internal static delegate* ClientPtrToPlayerSlot = &___ClientPtrToPlayerSlot; + internal static delegate* unmanaged[Cdecl] __ClientPtrToPlayerSlot; + private static int ___ClientPtrToPlayerSlot(nint client) + { + int __retVal = __ClientPtrToPlayerSlot(client); + return __retVal; + } + + /// + /// Returns the entity index for a given player slot. + /// + /// The index of the player's slot. + /// The entity index if valid, otherwise 0. + internal static delegate* PlayerSlotToClientIndex = &___PlayerSlotToClientIndex; + internal static delegate* unmanaged[Cdecl] __PlayerSlotToClientIndex; + private static int ___PlayerSlotToClientIndex(int playerSlot) + { + int __retVal = __PlayerSlotToClientIndex(playerSlot); + return __retVal; + } + + /// + /// Retrieves the player slot from a given client index. + /// + /// The index of the client. + /// The player slot if valid, otherwise -1. + internal static delegate* ClientIndexToPlayerSlot = &___ClientIndexToPlayerSlot; + internal static delegate* unmanaged[Cdecl] __ClientIndexToPlayerSlot; + private static int ___ClientIndexToPlayerSlot(int clientIndex) + { + int __retVal = __ClientIndexToPlayerSlot(clientIndex); + return __retVal; + } + + /// + /// Retrieves the player slot from a given player service. + /// + /// The service pointer. Like CCSPlayer_ItemServices, CCSPlayer_WeaponServices ect. + /// The player slot if valid, otherwise -1. + internal static delegate* PlayerServicesToPlayerSlot = &___PlayerServicesToPlayerSlot; + internal static delegate* unmanaged[Cdecl] __PlayerServicesToPlayerSlot; + private static int ___PlayerServicesToPlayerSlot(nint service) + { + int __retVal = __PlayerServicesToPlayerSlot(service); + return __retVal; + } + + /// + /// Retrieves a client's authentication string (SteamID). + /// + /// The index of the player's slot whose authentication string is being retrieved. + /// The authentication string. + internal static delegate* GetClientAuthId = &___GetClientAuthId; + internal static delegate* unmanaged[Cdecl] __GetClientAuthId; + private static string ___GetClientAuthId(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientAuthId(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Returns the client's Steam account ID, a unique number identifying a given Steam account. + /// + /// The index of the player's slot. + /// uint32_t The client's steam account ID. + internal static delegate* GetClientAccountId = &___GetClientAccountId; + internal static delegate* unmanaged[Cdecl] __GetClientAccountId; + private static uint ___GetClientAccountId(int playerSlot) + { + uint __retVal = __GetClientAccountId(playerSlot); + return __retVal; + } + + /// + /// Returns the client's SteamID64 — a unique 64-bit identifier of a Steam account. + /// + /// The index of the player's slot. + /// uint64_t The client's SteamID64. + internal static delegate* GetClientSteamID64 = &___GetClientSteamID64; + internal static delegate* unmanaged[Cdecl] __GetClientSteamID64; + private static ulong ___GetClientSteamID64(int playerSlot) + { + ulong __retVal = __GetClientSteamID64(playerSlot); + return __retVal; + } + + /// + /// Retrieves a client's IP address. + /// + /// The index of the player's slot. + /// The client's IP address. + internal static delegate* GetClientIp = &___GetClientIp; + internal static delegate* unmanaged[Cdecl] __GetClientIp; + private static string ___GetClientIp(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientIp(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves a client's language. + /// + /// The index of the player's slot. + /// The client's language. + internal static delegate* GetClientLanguage = &___GetClientLanguage; + internal static delegate* unmanaged[Cdecl] __GetClientLanguage; + private static string ___GetClientLanguage(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientLanguage(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves a client's operating system. + /// + /// The index of the player's slot. + /// The client's operating system. + internal static delegate* GetClientOS = &___GetClientOS; + internal static delegate* unmanaged[Cdecl] __GetClientOS; + private static string ___GetClientOS(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientOS(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Returns the client's name. + /// + /// The index of the player's slot. + /// The client's name. + internal static delegate* GetClientName = &___GetClientName; + internal static delegate* unmanaged[Cdecl] __GetClientName; + private static string ___GetClientName(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientName(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Returns the client's connection time in seconds. + /// + /// The index of the player's slot. + /// float Connection time in seconds. + internal static delegate* GetClientTime = &___GetClientTime; + internal static delegate* unmanaged[Cdecl] __GetClientTime; + private static float ___GetClientTime(int playerSlot) + { + float __retVal = __GetClientTime(playerSlot); + return __retVal; + } + + /// + /// Returns the client's current latency (RTT). + /// + /// The index of the player's slot. + /// float Latency value. + internal static delegate* GetClientLatency = &___GetClientLatency; + internal static delegate* unmanaged[Cdecl] __GetClientLatency; + private static float ___GetClientLatency(int playerSlot) + { + float __retVal = __GetClientLatency(playerSlot); + return __retVal; + } + + /// + /// Returns the client's access flags. + /// + /// The index of the player's slot. + /// uint64 Access flags as a bitmask. + internal static delegate* GetUserFlagBits = &___GetUserFlagBits; + internal static delegate* unmanaged[Cdecl] __GetUserFlagBits; + private static ulong ___GetUserFlagBits(int playerSlot) + { + ulong __retVal = __GetUserFlagBits(playerSlot); + return __retVal; + } + + /// + /// Sets the access flags on a client using a bitmask. + /// + /// The index of the player's slot. + /// Bitmask representing the flags to be set. + internal static delegate* SetUserFlagBits = &___SetUserFlagBits; + internal static delegate* unmanaged[Cdecl] __SetUserFlagBits; + private static void ___SetUserFlagBits(int playerSlot, ulong flags) + { + __SetUserFlagBits(playerSlot, flags); + } + + /// + /// Adds access flags to a client. + /// + /// The index of the player's slot. + /// Bitmask representing the flags to be added. + internal static delegate* AddUserFlags = &___AddUserFlags; + internal static delegate* unmanaged[Cdecl] __AddUserFlags; + private static void ___AddUserFlags(int playerSlot, ulong flags) + { + __AddUserFlags(playerSlot, flags); + } + + /// + /// Removes access flags from a client. + /// + /// The index of the player's slot. + /// Bitmask representing the flags to be removed. + internal static delegate* RemoveUserFlags = &___RemoveUserFlags; + internal static delegate* unmanaged[Cdecl] __RemoveUserFlags; + private static void ___RemoveUserFlags(int playerSlot, ulong flags) + { + __RemoveUserFlags(playerSlot, flags); + } + + /// + /// Checks if a certain player has been authenticated. + /// + /// The index of the player's slot. + /// true if the player is authenticated, false otherwise. + internal static delegate* IsClientAuthorized = &___IsClientAuthorized; + internal static delegate* unmanaged[Cdecl] __IsClientAuthorized; + private static Bool8 ___IsClientAuthorized(int playerSlot) + { + Bool8 __retVal = __IsClientAuthorized(playerSlot); + return __retVal; + } + + /// + /// Checks if a certain player is connected. + /// + /// The index of the player's slot. + /// true if the player is connected, false otherwise. + internal static delegate* IsClientConnected = &___IsClientConnected; + internal static delegate* unmanaged[Cdecl] __IsClientConnected; + private static Bool8 ___IsClientConnected(int playerSlot) + { + Bool8 __retVal = __IsClientConnected(playerSlot); + return __retVal; + } + + /// + /// Checks if a certain player has entered the game. + /// + /// The index of the player's slot. + /// true if the player is in the game, false otherwise. + internal static delegate* IsClientInGame = &___IsClientInGame; + internal static delegate* unmanaged[Cdecl] __IsClientInGame; + private static Bool8 ___IsClientInGame(int playerSlot) + { + Bool8 __retVal = __IsClientInGame(playerSlot); + return __retVal; + } + + /// + /// Checks if a certain player is the SourceTV bot. + /// + /// The index of the player's slot. + /// true if the client is the SourceTV bot, false otherwise. + internal static delegate* IsClientSourceTV = &___IsClientSourceTV; + internal static delegate* unmanaged[Cdecl] __IsClientSourceTV; + private static Bool8 ___IsClientSourceTV(int playerSlot) + { + Bool8 __retVal = __IsClientSourceTV(playerSlot); + return __retVal; + } + + /// + /// Checks if the client is alive or dead. + /// + /// The index of the player's slot. + /// true if the client is alive, false if dead. + internal static delegate* IsClientAlive = &___IsClientAlive; + internal static delegate* unmanaged[Cdecl] __IsClientAlive; + private static Bool8 ___IsClientAlive(int playerSlot) + { + Bool8 __retVal = __IsClientAlive(playerSlot); + return __retVal; + } + + /// + /// Checks if a certain player is a fake client. + /// + /// The index of the player's slot. + /// true if the client is a fake client, false otherwise. + internal static delegate* IsFakeClient = &___IsFakeClient; + internal static delegate* unmanaged[Cdecl] __IsFakeClient; + private static Bool8 ___IsFakeClient(int playerSlot) + { + Bool8 __retVal = __IsFakeClient(playerSlot); + return __retVal; + } + + /// + /// Retrieves the movement type of an client. + /// + /// The index of the player's slot whose movement type is to be retrieved. + /// The movement type of the entity, or 0 if the entity is invalid. + internal static delegate* GetClientMoveType = &___GetClientMoveType; + internal static delegate* unmanaged[Cdecl] __GetClientMoveType; + private static MoveType ___GetClientMoveType(int playerSlot) + { + MoveType __retVal = __GetClientMoveType(playerSlot); + return __retVal; + } + + /// + /// Sets the movement type of an client. + /// + /// The index of the player's slot whose movement type is to be set. + /// The movement type of the entity, or 0 if the entity is invalid. + internal static delegate* SetClientMoveType = &___SetClientMoveType; + internal static delegate* unmanaged[Cdecl] __SetClientMoveType; + private static void ___SetClientMoveType(int playerSlot, MoveType moveType) + { + __SetClientMoveType(playerSlot, moveType); + } + + /// + /// Retrieves the gravity scale of an client. + /// + /// The index of the player's slot whose gravity scale is to be retrieved. + /// The gravity scale of the client, or 0.0f if the client is invalid. + internal static delegate* GetClientGravity = &___GetClientGravity; + internal static delegate* unmanaged[Cdecl] __GetClientGravity; + private static float ___GetClientGravity(int playerSlot) + { + float __retVal = __GetClientGravity(playerSlot); + return __retVal; + } + + /// + /// Sets the gravity scale of an client. + /// + /// The index of the player's slot whose gravity scale is to be set. + /// The new gravity scale to set for the client. + internal static delegate* SetClientGravity = &___SetClientGravity; + internal static delegate* unmanaged[Cdecl] __SetClientGravity; + private static void ___SetClientGravity(int playerSlot, float gravity) + { + __SetClientGravity(playerSlot, gravity); + } + + /// + /// Retrieves the flags of an client. + /// + /// The index of the player's slot whose flags are to be retrieved. + /// The flags of the client, or 0 if the client is invalid. + internal static delegate* GetClientFlags = &___GetClientFlags; + internal static delegate* unmanaged[Cdecl] __GetClientFlags; + private static int ___GetClientFlags(int playerSlot) + { + int __retVal = __GetClientFlags(playerSlot); + return __retVal; + } + + /// + /// Sets the flags of an client. + /// + /// The index of the player's slot whose flags are to be set. + /// The new flags to set for the client. + internal static delegate* SetClientFlags = &___SetClientFlags; + internal static delegate* unmanaged[Cdecl] __SetClientFlags; + private static void ___SetClientFlags(int playerSlot, int flags) + { + __SetClientFlags(playerSlot, flags); + } + + /// + /// Retrieves the render color of an client. + /// + /// The index of the player's slot whose render color is to be retrieved. + /// The raw color value of the client's render color, or 0 if the client is invalid. + internal static delegate* GetClientRenderColor = &___GetClientRenderColor; + internal static delegate* unmanaged[Cdecl] __GetClientRenderColor; + private static int ___GetClientRenderColor(int playerSlot) + { + int __retVal = __GetClientRenderColor(playerSlot); + return __retVal; + } + + /// + /// Sets the render color of an client. + /// + /// The index of the player's slot whose render color is to be set. + /// The new raw color value to set for the client's render color. + internal static delegate* SetClientRenderColor = &___SetClientRenderColor; + internal static delegate* unmanaged[Cdecl] __SetClientRenderColor; + private static void ___SetClientRenderColor(int playerSlot, int color) + { + __SetClientRenderColor(playerSlot, color); + } + + /// + /// Retrieves the render mode of an client. + /// + /// The index of the player's slot whose render mode is to be retrieved. + /// The render mode of the client, or 0 if the client is invalid. + internal static delegate* GetClientRenderMode = &___GetClientRenderMode; + internal static delegate* unmanaged[Cdecl] __GetClientRenderMode; + private static RenderMode ___GetClientRenderMode(int playerSlot) + { + RenderMode __retVal = __GetClientRenderMode(playerSlot); + return __retVal; + } + + /// + /// Sets the render mode of an client. + /// + /// The index of the player's slot whose render mode is to be set. + /// The new render mode to set for the client. + internal static delegate* SetClientRenderMode = &___SetClientRenderMode; + internal static delegate* unmanaged[Cdecl] __SetClientRenderMode; + private static void ___SetClientRenderMode(int playerSlot, RenderMode renderMode) + { + __SetClientRenderMode(playerSlot, renderMode); + } + + /// + /// Retrieves the mass of an client. + /// + /// The index of the player's slot whose mass is to be retrieved. + /// The mass of the client, or 0 if the client is invalid. + internal static delegate* GetClientMass = &___GetClientMass; + internal static delegate* unmanaged[Cdecl] __GetClientMass; + private static int ___GetClientMass(int playerSlot) + { + int __retVal = __GetClientMass(playerSlot); + return __retVal; + } + + /// + /// Sets the mass of an client. + /// + /// The index of the player's slot whose mass is to be set. + /// The new mass value to set for the client. + internal static delegate* SetClientMass = &___SetClientMass; + internal static delegate* unmanaged[Cdecl] __SetClientMass; + private static void ___SetClientMass(int playerSlot, int mass) + { + __SetClientMass(playerSlot, mass); + } + + /// + /// Retrieves the friction of an client. + /// + /// The index of the player's slot whose friction is to be retrieved. + /// The friction of the client, or 0 if the client is invalid. + internal static delegate* GetClientFriction = &___GetClientFriction; + internal static delegate* unmanaged[Cdecl] __GetClientFriction; + private static float ___GetClientFriction(int playerSlot) + { + float __retVal = __GetClientFriction(playerSlot); + return __retVal; + } + + /// + /// Sets the friction of an client. + /// + /// The index of the player's slot whose friction is to be set. + /// The new friction value to set for the client. + internal static delegate* SetClientFriction = &___SetClientFriction; + internal static delegate* unmanaged[Cdecl] __SetClientFriction; + private static void ___SetClientFriction(int playerSlot, float friction) + { + __SetClientFriction(playerSlot, friction); + } + + /// + /// Retrieves the health of an client. + /// + /// The index of the player's slot whose health is to be retrieved. + /// The health of the client, or 0 if the client is invalid. + internal static delegate* GetClientHealth = &___GetClientHealth; + internal static delegate* unmanaged[Cdecl] __GetClientHealth; + private static int ___GetClientHealth(int playerSlot) + { + int __retVal = __GetClientHealth(playerSlot); + return __retVal; + } + + /// + /// Sets the health of an client. + /// + /// The index of the player's slot whose health is to be set. + /// The new health value to set for the client. + internal static delegate* SetClientHealth = &___SetClientHealth; + internal static delegate* unmanaged[Cdecl] __SetClientHealth; + private static void ___SetClientHealth(int playerSlot, int health) + { + __SetClientHealth(playerSlot, health); + } + + /// + /// Retrieves the max health of an client. + /// + /// The index of the player's slot whose max health is to be retrieved. + /// The max health of the client, or 0 if the client is invalid. + internal static delegate* GetClientMaxHealth = &___GetClientMaxHealth; + internal static delegate* unmanaged[Cdecl] __GetClientMaxHealth; + private static int ___GetClientMaxHealth(int playerSlot) + { + int __retVal = __GetClientMaxHealth(playerSlot); + return __retVal; + } + + /// + /// Sets the max health of an client. + /// + /// The index of the player's slot whose max health is to be set. + /// The new max health value to set for the client. + internal static delegate* SetClientMaxHealth = &___SetClientMaxHealth; + internal static delegate* unmanaged[Cdecl] __SetClientMaxHealth; + private static void ___SetClientMaxHealth(int playerSlot, int maxHealth) + { + __SetClientMaxHealth(playerSlot, maxHealth); + } + + /// + /// Retrieves the team number of an client. + /// + /// The index of the player's slot whose team number is to be retrieved. + /// The team number of the client, or 0 if the client is invalid. + internal static delegate* GetClientTeam = &___GetClientTeam; + internal static delegate* unmanaged[Cdecl] __GetClientTeam; + private static CSTeam ___GetClientTeam(int playerSlot) + { + CSTeam __retVal = __GetClientTeam(playerSlot); + return __retVal; + } + + /// + /// Sets the team number of an client. + /// + /// The index of the player's slot whose team number is to be set. + /// The new team number to set for the client. + internal static delegate* SetClientTeam = &___SetClientTeam; + internal static delegate* unmanaged[Cdecl] __SetClientTeam; + private static void ___SetClientTeam(int playerSlot, CSTeam team) + { + __SetClientTeam(playerSlot, team); + } + + /// + /// Retrieves the absolute origin of an client. + /// + /// The index of the player's slot whose absolute origin is to be retrieved. + /// A vector where the absolute origin will be stored. + internal static delegate* GetClientAbsOrigin = &___GetClientAbsOrigin; + internal static delegate* unmanaged[Cdecl] __GetClientAbsOrigin; + private static Vector3 ___GetClientAbsOrigin(int playerSlot) + { + Vector3 __retVal = __GetClientAbsOrigin(playerSlot); + return __retVal; + } + + /// + /// Sets the absolute origin of an client. + /// + /// The index of the player's slot whose absolute origin is to be set. + /// The new absolute origin to set for the client. + internal static delegate* SetClientAbsOrigin = &___SetClientAbsOrigin; + internal static delegate* unmanaged[Cdecl] __SetClientAbsOrigin; + private static void ___SetClientAbsOrigin(int playerSlot, Vector3 origin) + { + __SetClientAbsOrigin(playerSlot, &origin); + } + + /// + /// Retrieves the absolute scale of an client. + /// + /// The index of the player's slot whose absolute scale is to be retrieved. + /// A vector where the absolute scale will be stored. + internal static delegate* GetClientAbsScale = &___GetClientAbsScale; + internal static delegate* unmanaged[Cdecl] __GetClientAbsScale; + private static float ___GetClientAbsScale(int playerSlot) + { + float __retVal = __GetClientAbsScale(playerSlot); + return __retVal; + } + + /// + /// Sets the absolute scale of an client. + /// + /// The index of the player's slot whose absolute scale is to be set. + /// The new absolute scale to set for the client. + internal static delegate* SetClientAbsScale = &___SetClientAbsScale; + internal static delegate* unmanaged[Cdecl] __SetClientAbsScale; + private static void ___SetClientAbsScale(int playerSlot, float scale) + { + __SetClientAbsScale(playerSlot, scale); + } + + /// + /// Retrieves the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be retrieved. + /// A QAngle where the angular rotation will be stored. + internal static delegate* GetClientAbsAngles = &___GetClientAbsAngles; + internal static delegate* unmanaged[Cdecl] __GetClientAbsAngles; + private static Vector3 ___GetClientAbsAngles(int playerSlot) + { + Vector3 __retVal = __GetClientAbsAngles(playerSlot); + return __retVal; + } + + /// + /// Sets the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be set. + /// The new angular rotation to set for the client. + internal static delegate* SetClientAbsAngles = &___SetClientAbsAngles; + internal static delegate* unmanaged[Cdecl] __SetClientAbsAngles; + private static void ___SetClientAbsAngles(int playerSlot, Vector3 angle) + { + __SetClientAbsAngles(playerSlot, &angle); + } + + /// + /// Retrieves the local origin of an client. + /// + /// The index of the player's slot whose local origin is to be retrieved. + /// A vector where the local origin will be stored. + internal static delegate* GetClientLocalOrigin = &___GetClientLocalOrigin; + internal static delegate* unmanaged[Cdecl] __GetClientLocalOrigin; + private static Vector3 ___GetClientLocalOrigin(int playerSlot) + { + Vector3 __retVal = __GetClientLocalOrigin(playerSlot); + return __retVal; + } + + /// + /// Sets the local origin of an client. + /// + /// The index of the player's slot whose local origin is to be set. + /// The new local origin to set for the client. + internal static delegate* SetClientLocalOrigin = &___SetClientLocalOrigin; + internal static delegate* unmanaged[Cdecl] __SetClientLocalOrigin; + private static void ___SetClientLocalOrigin(int playerSlot, Vector3 origin) + { + __SetClientLocalOrigin(playerSlot, &origin); + } + + /// + /// Retrieves the local scale of an client. + /// + /// The index of the player's slot whose local scale is to be retrieved. + /// A vector where the local scale will be stored. + internal static delegate* GetClientLocalScale = &___GetClientLocalScale; + internal static delegate* unmanaged[Cdecl] __GetClientLocalScale; + private static float ___GetClientLocalScale(int playerSlot) + { + float __retVal = __GetClientLocalScale(playerSlot); + return __retVal; + } + + /// + /// Sets the local scale of an client. + /// + /// The index of the player's slot whose local scale is to be set. + /// The new local scale to set for the client. + internal static delegate* SetClientLocalScale = &___SetClientLocalScale; + internal static delegate* unmanaged[Cdecl] __SetClientLocalScale; + private static void ___SetClientLocalScale(int playerSlot, float scale) + { + __SetClientLocalScale(playerSlot, scale); + } + + /// + /// Retrieves the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be retrieved. + /// A QAngle where the angular rotation will be stored. + internal static delegate* GetClientLocalAngles = &___GetClientLocalAngles; + internal static delegate* unmanaged[Cdecl] __GetClientLocalAngles; + private static Vector3 ___GetClientLocalAngles(int playerSlot) + { + Vector3 __retVal = __GetClientLocalAngles(playerSlot); + return __retVal; + } + + /// + /// Sets the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be set. + /// The new angular rotation to set for the client. + internal static delegate* SetClientLocalAngles = &___SetClientLocalAngles; + internal static delegate* unmanaged[Cdecl] __SetClientLocalAngles; + private static void ___SetClientLocalAngles(int playerSlot, Vector3 angle) + { + __SetClientLocalAngles(playerSlot, &angle); + } + + /// + /// Retrieves the absolute velocity of an client. + /// + /// The index of the player's slot whose absolute velocity is to be retrieved. + /// A vector where the absolute velocity will be stored. + internal static delegate* GetClientAbsVelocity = &___GetClientAbsVelocity; + internal static delegate* unmanaged[Cdecl] __GetClientAbsVelocity; + private static Vector3 ___GetClientAbsVelocity(int playerSlot) + { + Vector3 __retVal = __GetClientAbsVelocity(playerSlot); + return __retVal; + } + + /// + /// Sets the absolute velocity of an client. + /// + /// The index of the player's slot whose absolute velocity is to be set. + /// The new absolute velocity to set for the client. + internal static delegate* SetClientAbsVelocity = &___SetClientAbsVelocity; + internal static delegate* unmanaged[Cdecl] __SetClientAbsVelocity; + private static void ___SetClientAbsVelocity(int playerSlot, Vector3 velocity) + { + __SetClientAbsVelocity(playerSlot, &velocity); + } + + /// + /// Retrieves the base velocity of an client. + /// + /// The index of the player's slot whose base velocity is to be retrieved. + /// A vector where the base velocity will be stored. + internal static delegate* GetClientBaseVelocity = &___GetClientBaseVelocity; + internal static delegate* unmanaged[Cdecl] __GetClientBaseVelocity; + private static Vector3 ___GetClientBaseVelocity(int playerSlot) + { + Vector3 __retVal = __GetClientBaseVelocity(playerSlot); + return __retVal; + } + + /// + /// Retrieves the local angular velocity of an client. + /// + /// The index of the player's slot whose local angular velocity is to be retrieved. + /// A vector where the local angular velocity will be stored. + internal static delegate* GetClientLocalAngVelocity = &___GetClientLocalAngVelocity; + internal static delegate* unmanaged[Cdecl] __GetClientLocalAngVelocity; + private static Vector3 ___GetClientLocalAngVelocity(int playerSlot) + { + Vector3 __retVal = __GetClientLocalAngVelocity(playerSlot); + return __retVal; + } + + /// + /// Retrieves the angular velocity of an client. + /// + /// The index of the player's slot whose angular velocity is to be retrieved. + /// A vector where the angular velocity will be stored. + internal static delegate* GetClientAngVelocity = &___GetClientAngVelocity; + internal static delegate* unmanaged[Cdecl] __GetClientAngVelocity; + private static Vector3 ___GetClientAngVelocity(int playerSlot) + { + Vector3 __retVal = __GetClientAngVelocity(playerSlot); + return __retVal; + } + + /// + /// Sets the angular velocity of an client. + /// + /// The index of the player's slot whose angular velocity is to be set. + /// The new angular velocity to set for the client. + internal static delegate* SetClientAngVelocity = &___SetClientAngVelocity; + internal static delegate* unmanaged[Cdecl] __SetClientAngVelocity; + private static void ___SetClientAngVelocity(int playerSlot, Vector3 velocity) + { + __SetClientAngVelocity(playerSlot, &velocity); + } + + /// + /// Retrieves the local velocity of an client. + /// + /// The index of the player's slot whose local velocity is to be retrieved. + /// A vector where the local velocity will be stored. + internal static delegate* GetClientLocalVelocity = &___GetClientLocalVelocity; + internal static delegate* unmanaged[Cdecl] __GetClientLocalVelocity; + private static Vector3 ___GetClientLocalVelocity(int playerSlot) + { + Vector3 __retVal = __GetClientLocalVelocity(playerSlot); + return __retVal; + } + + /// + /// Retrieves the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be retrieved. + /// A vector where the angular rotation will be stored. + internal static delegate* GetClientAngRotation = &___GetClientAngRotation; + internal static delegate* unmanaged[Cdecl] __GetClientAngRotation; + private static Vector3 ___GetClientAngRotation(int playerSlot) + { + Vector3 __retVal = __GetClientAngRotation(playerSlot); + return __retVal; + } + + /// + /// Sets the angular rotation of an client. + /// + /// The index of the player's slot whose angular rotation is to be set. + /// The new angular rotation to set for the client. + internal static delegate* SetClientAngRotation = &___SetClientAngRotation; + internal static delegate* unmanaged[Cdecl] __SetClientAngRotation; + private static void ___SetClientAngRotation(int playerSlot, Vector3 rotation) + { + __SetClientAngRotation(playerSlot, &rotation); + } + + /// + /// Returns the input Vector transformed from client to world space. + /// + /// The index of the player's slot + /// Point in client local space to transform + /// The point transformed to world space coordinates + internal static delegate* TransformPointClientToWorld = &___TransformPointClientToWorld; + internal static delegate* unmanaged[Cdecl] __TransformPointClientToWorld; + private static Vector3 ___TransformPointClientToWorld(int playerSlot, Vector3 point) + { + Vector3 __retVal = __TransformPointClientToWorld(playerSlot, &point); + return __retVal; + } + + /// + /// Returns the input Vector transformed from world to client space. + /// + /// The index of the player's slot + /// Point in world space to transform + /// The point transformed to client local space coordinates + internal static delegate* TransformPointWorldToClient = &___TransformPointWorldToClient; + internal static delegate* unmanaged[Cdecl] __TransformPointWorldToClient; + private static Vector3 ___TransformPointWorldToClient(int playerSlot, Vector3 point) + { + Vector3 __retVal = __TransformPointWorldToClient(playerSlot, &point); + return __retVal; + } + + /// + /// Get vector to eye position - absolute coords. + /// + /// The index of the player's slot + /// Eye position in absolute/world coordinates + internal static delegate* GetClientEyePosition = &___GetClientEyePosition; + internal static delegate* unmanaged[Cdecl] __GetClientEyePosition; + private static Vector3 ___GetClientEyePosition(int playerSlot) + { + Vector3 __retVal = __GetClientEyePosition(playerSlot); + return __retVal; + } + + /// + /// Get the qangles that this client is looking at. + /// + /// The index of the player's slot + /// Eye angles as a vector (pitch, yaw, roll) + internal static delegate* GetClientEyeAngles = &___GetClientEyeAngles; + internal static delegate* unmanaged[Cdecl] __GetClientEyeAngles; + private static Vector3 ___GetClientEyeAngles(int playerSlot) + { + Vector3 __retVal = __GetClientEyeAngles(playerSlot); + return __retVal; + } + + /// + /// Sets the forward velocity of an client. + /// + /// The index of the player's slot whose forward velocity is to be set. + /// + internal static delegate* SetClientForwardVector = &___SetClientForwardVector; + internal static delegate* unmanaged[Cdecl] __SetClientForwardVector; + private static void ___SetClientForwardVector(int playerSlot, Vector3 forward) + { + __SetClientForwardVector(playerSlot, &forward); + } + + /// + /// Get the forward vector of the client. + /// + /// The index of the player's slot to query + /// Forward-facing direction vector of the client + internal static delegate* GetClientForwardVector = &___GetClientForwardVector; + internal static delegate* unmanaged[Cdecl] __GetClientForwardVector; + private static Vector3 ___GetClientForwardVector(int playerSlot) + { + Vector3 __retVal = __GetClientForwardVector(playerSlot); + return __retVal; + } + + /// + /// Get the left vector of the client. + /// + /// The index of the player's slot to query + /// Left-facing direction vector of the client (aligned with the y axis) + internal static delegate* GetClientLeftVector = &___GetClientLeftVector; + internal static delegate* unmanaged[Cdecl] __GetClientLeftVector; + private static Vector3 ___GetClientLeftVector(int playerSlot) + { + Vector3 __retVal = __GetClientLeftVector(playerSlot); + return __retVal; + } + + /// + /// Get the right vector of the client. + /// + /// The index of the player's slot to query + /// Right-facing direction vector of the client + internal static delegate* GetClientRightVector = &___GetClientRightVector; + internal static delegate* unmanaged[Cdecl] __GetClientRightVector; + private static Vector3 ___GetClientRightVector(int playerSlot) + { + Vector3 __retVal = __GetClientRightVector(playerSlot); + return __retVal; + } + + /// + /// Get the up vector of the client. + /// + /// The index of the player's slot to query + /// Up-facing direction vector of the client + internal static delegate* GetClientUpVector = &___GetClientUpVector; + internal static delegate* unmanaged[Cdecl] __GetClientUpVector; + private static Vector3 ___GetClientUpVector(int playerSlot) + { + Vector3 __retVal = __GetClientUpVector(playerSlot); + return __retVal; + } + + /// + /// Get the client-to-world transformation matrix. + /// + /// The index of the player's slot to query + /// 4x4 transformation matrix representing client's position, rotation, and scale in world space + internal static delegate* GetClientTransform = &___GetClientTransform; + internal static delegate* unmanaged[Cdecl] __GetClientTransform; + private static Matrix4x4 ___GetClientTransform(int playerSlot) + { + Matrix4x4 __retVal = __GetClientTransform(playerSlot); + return __retVal; + } + + /// + /// Retrieves the model name of an client. + /// + /// The index of the player's slot whose model name is to be retrieved. + /// A string where the model name will be stored. + internal static delegate* GetClientModel = &___GetClientModel; + internal static delegate* unmanaged[Cdecl] __GetClientModel; + private static string ___GetClientModel(int playerSlot) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetClientModel(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the model name of an client. + /// + /// The index of the player's slot whose model name is to be set. + /// The new model name to set for the client. + internal static delegate* SetClientModel = &___SetClientModel; + internal static delegate* unmanaged[Cdecl] __SetClientModel; + private static void ___SetClientModel(int playerSlot, string model) + { + var __model = NativeMethods.ConstructString(model); + try { + __SetClientModel(playerSlot, &__model); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__model); + } + } + + /// + /// Retrieves the water level of an client. + /// + /// The index of the player's slot whose water level is to be retrieved. + /// The water level of the client, or 0.0f if the client is invalid. + internal static delegate* GetClientWaterLevel = &___GetClientWaterLevel; + internal static delegate* unmanaged[Cdecl] __GetClientWaterLevel; + private static float ___GetClientWaterLevel(int playerSlot) + { + float __retVal = __GetClientWaterLevel(playerSlot); + return __retVal; + } + + /// + /// Retrieves the ground client of an client. + /// + /// The index of the player's slot whose ground client is to be retrieved. + /// The handle of the ground client, or INVALID_EHANDLE_INDEX if the client is invalid. + internal static delegate* GetClientGroundEntity = &___GetClientGroundEntity; + internal static delegate* unmanaged[Cdecl] __GetClientGroundEntity; + private static int ___GetClientGroundEntity(int playerSlot) + { + int __retVal = __GetClientGroundEntity(playerSlot); + return __retVal; + } + + /// + /// Retrieves the effects of an client. + /// + /// The index of the player's slot whose effects are to be retrieved. + /// The effect flags of the client, or 0 if the client is invalid. + internal static delegate* GetClientEffects = &___GetClientEffects; + internal static delegate* unmanaged[Cdecl] __GetClientEffects; + private static int ___GetClientEffects(int playerSlot) + { + int __retVal = __GetClientEffects(playerSlot); + return __retVal; + } + + /// + /// Adds the render effect flag to an client. + /// + /// The index of the player's slot to modify + /// Render effect flags to add + internal static delegate* AddClientEffects = &___AddClientEffects; + internal static delegate* unmanaged[Cdecl] __AddClientEffects; + private static void ___AddClientEffects(int playerSlot, int effects) + { + __AddClientEffects(playerSlot, effects); + } + + /// + /// Removes the render effect flag from an client. + /// + /// The index of the player's slot to modify + /// Render effect flags to remove + internal static delegate* RemoveClientEffects = &___RemoveClientEffects; + internal static delegate* unmanaged[Cdecl] __RemoveClientEffects; + private static void ___RemoveClientEffects(int playerSlot, int effects) + { + __RemoveClientEffects(playerSlot, effects); + } + + /// + /// Get a vector containing max bounds, centered on object. + /// + /// The index of the player's slot to query + /// Vector containing the maximum bounds of the client's bounding box + internal static delegate* GetClientBoundingMaxs = &___GetClientBoundingMaxs; + internal static delegate* unmanaged[Cdecl] __GetClientBoundingMaxs; + private static Vector3 ___GetClientBoundingMaxs(int playerSlot) + { + Vector3 __retVal = __GetClientBoundingMaxs(playerSlot); + return __retVal; + } + + /// + /// Get a vector containing min bounds, centered on object. + /// + /// The index of the player's slot to query + /// Vector containing the minimum bounds of the client's bounding box + internal static delegate* GetClientBoundingMins = &___GetClientBoundingMins; + internal static delegate* unmanaged[Cdecl] __GetClientBoundingMins; + private static Vector3 ___GetClientBoundingMins(int playerSlot) + { + Vector3 __retVal = __GetClientBoundingMins(playerSlot); + return __retVal; + } + + /// + /// Get vector to center of object - absolute coords. + /// + /// The index of the player's slot to query + /// Vector pointing to the center of the client in absolute/world coordinates + internal static delegate* GetClientCenter = &___GetClientCenter; + internal static delegate* unmanaged[Cdecl] __GetClientCenter; + private static Vector3 ___GetClientCenter(int playerSlot) + { + Vector3 __retVal = __GetClientCenter(playerSlot); + return __retVal; + } + + /// + /// Teleports an client to a specified location and orientation. + /// + /// The index of the player's slot to teleport. + /// A pointer to a Vector representing the new absolute position. Use nan vector to not set. + /// A pointer to a QAngle representing the new orientation. Use nan vector to not set. + /// A pointer to a Vector representing the new velocity. Use nan vector to not set. + internal static delegate* TeleportClient = &___TeleportClient; + internal static delegate* unmanaged[Cdecl] __TeleportClient; + private static void ___TeleportClient(int playerSlot, Vector3 origin, Vector3 angles, Vector3 velocity) + { + __TeleportClient(playerSlot, &origin, &angles, &velocity); + } + + /// + /// Apply an absolute velocity impulse to an client. + /// + /// The index of the player's slot to apply impulse to + /// Velocity impulse vector to apply + internal static delegate* ApplyAbsVelocityImpulseToClient = &___ApplyAbsVelocityImpulseToClient; + internal static delegate* unmanaged[Cdecl] __ApplyAbsVelocityImpulseToClient; + private static void ___ApplyAbsVelocityImpulseToClient(int playerSlot, Vector3 vecImpulse) + { + __ApplyAbsVelocityImpulseToClient(playerSlot, &vecImpulse); + } + + /// + /// Apply a local angular velocity impulse to an client. + /// + /// The index of the player's slot to apply impulse to + /// Angular velocity impulse vector to apply + internal static delegate* ApplyLocalAngularVelocityImpulseToClient = &___ApplyLocalAngularVelocityImpulseToClient; + internal static delegate* unmanaged[Cdecl] __ApplyLocalAngularVelocityImpulseToClient; + private static void ___ApplyLocalAngularVelocityImpulseToClient(int playerSlot, Vector3 angImpulse) + { + __ApplyLocalAngularVelocityImpulseToClient(playerSlot, &angImpulse); + } + + /// + /// Invokes a named input method on a specified client. + /// + /// The handle of the target client that will receive the input. + /// The name of the input action to invoke. + /// The index of the player's slot that initiated the sequence of actions. + /// The index of the player's slot sending this event. Use -1 to specify + /// The value associated with the input action. + /// The type or classification of the value. + /// An identifier for tracking the output of this operation. + internal static delegate* AcceptClientInput = &___AcceptClientInput; + internal static delegate* unmanaged[Cdecl] __AcceptClientInput; + private static void ___AcceptClientInput(int playerSlot, string inputName, int activatorHandle, int callerHandle, object value, FieldType type, int outputId) + { + var __inputName = NativeMethods.ConstructString(inputName); + var __value = NativeMethods.ConstructVariant(value); + try { + __AcceptClientInput(playerSlot, &__inputName, activatorHandle, callerHandle, &__value, type, outputId); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__inputName); + NativeMethods.DestroyVariant(&__value); + } + } + + /// + /// Connects a script function to an player output. + /// + /// The handle of the player. + /// The name of the output to connect to. + /// The name of the script function to call. + internal static delegate* ConnectClientOutput = &___ConnectClientOutput; + internal static delegate* unmanaged[Cdecl] __ConnectClientOutput; + private static void ___ConnectClientOutput(int playerSlot, string output, string functionName) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __ConnectClientOutput(playerSlot, &__output, &__functionName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Disconnects a script function from an player output. + /// + /// The handle of the player. + /// The name of the output. + /// The name of the script function to disconnect. + internal static delegate* DisconnectClientOutput = &___DisconnectClientOutput; + internal static delegate* unmanaged[Cdecl] __DisconnectClientOutput; + private static void ___DisconnectClientOutput(int playerSlot, string output, string functionName) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __DisconnectClientOutput(playerSlot, &__output, &__functionName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Disconnects a script function from an I/O event on a different player. + /// + /// The handle of the calling player. + /// The name of the output. + /// The function name to disconnect. + /// The handle of the entity whose output is being disconnected. + internal static delegate* DisconnectClientRedirectedOutput = &___DisconnectClientRedirectedOutput; + internal static delegate* unmanaged[Cdecl] __DisconnectClientRedirectedOutput; + private static void ___DisconnectClientRedirectedOutput(int playerSlot, string output, string functionName, int targetHandle) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __DisconnectClientRedirectedOutput(playerSlot, &__output, &__functionName, targetHandle); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Fires an player output. + /// + /// The handle of the player firing the output. + /// The name of the output to fire. + /// The entity activating the output. + /// The entity that called the output. + /// The value associated with the input action. + /// The type or classification of the value. + /// Delay in seconds before firing the output. + internal static delegate* FireClientOutput = &___FireClientOutput; + internal static delegate* unmanaged[Cdecl] __FireClientOutput; + private static void ___FireClientOutput(int playerSlot, string outputName, int activatorHandle, int callerHandle, object value, FieldType type, float delay) + { + var __outputName = NativeMethods.ConstructString(outputName); + var __value = NativeMethods.ConstructVariant(value); + try { + __FireClientOutput(playerSlot, &__outputName, activatorHandle, callerHandle, &__value, type, delay); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__outputName); + NativeMethods.DestroyVariant(&__value); + } + } + + /// + /// Redirects an player output to call a function on another player. + /// + /// The handle of the player whose output is being redirected. + /// The name of the output to redirect. + /// The function name to call on the target player. + /// The handle of the entity that will receive the output call. + internal static delegate* RedirectClientOutput = &___RedirectClientOutput; + internal static delegate* unmanaged[Cdecl] __RedirectClientOutput; + private static void ___RedirectClientOutput(int playerSlot, string output, string functionName, int targetHandle) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __RedirectClientOutput(playerSlot, &__output, &__functionName, targetHandle); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Makes an client follow another client with optional bone merging. + /// + /// The index of the player's slot that will follow + /// The index of the player's slot to follow + /// If true, bones will be merged between entities + internal static delegate* FollowClient = &___FollowClient; + internal static delegate* unmanaged[Cdecl] __FollowClient; + private static void ___FollowClient(int playerSlot, int attachmentHandle, Bool8 boneMerge) + { + __FollowClient(playerSlot, attachmentHandle, boneMerge); + } + + /// + /// Makes an client follow another client and merge with a specific bone or attachment. + /// + /// The index of the player's slot that will follow + /// The index of the player's slot to follow + /// Name of the bone or attachment point to merge with + internal static delegate* FollowClientMerge = &___FollowClientMerge; + internal static delegate* unmanaged[Cdecl] __FollowClientMerge; + private static void ___FollowClientMerge(int playerSlot, int attachmentHandle, string boneOrAttachName) + { + var __boneOrAttachName = NativeMethods.ConstructString(boneOrAttachName); + try { + __FollowClientMerge(playerSlot, attachmentHandle, &__boneOrAttachName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__boneOrAttachName); + } + } + + /// + /// Apply damage to an client. + /// + /// The index of the player's slot receiving damage + /// The index of the player's slot inflicting damage (e.g., projectile) + /// The index of the attacking client + /// Direction and magnitude of force to apply + /// Position where the damage hit occurred + /// Amount of damage to apply + /// Bitfield of damage type flags + /// Amount of damage actually applied to the client + internal static delegate* TakeClientDamage = &___TakeClientDamage; + internal static delegate* unmanaged[Cdecl] __TakeClientDamage; + private static int ___TakeClientDamage(int playerSlot, int inflictorSlot, int attackerSlot, Vector3 force, Vector3 hitPos, float damage, DamageTypes damageTypes) + { + int __retVal = __TakeClientDamage(playerSlot, inflictorSlot, attackerSlot, &force, &hitPos, damage, damageTypes); + return __retVal; + } + + /// + /// Retrieves the pawn entity pointer associated with a client. + /// + /// The index of the player's slot. + /// A pointer to the client's pawn entity, or nullptr if the client or controller is invalid. + internal static delegate* GetClientPawn = &___GetClientPawn; + internal static delegate* unmanaged[Cdecl] __GetClientPawn; + private static nint ___GetClientPawn(int playerSlot) + { + nint __retVal = __GetClientPawn(playerSlot); + return __retVal; + } + + /// + /// Processes the target string to determine if one user can target another. + /// + /// The index of the player's slot making the target request. + /// The target string specifying the player or players to be targeted. + /// A vector where the result of the targeting operation will be stored. + internal static delegate* ProcessTargetString = &___ProcessTargetString; + internal static delegate* unmanaged[Cdecl] __ProcessTargetString; + private static int[] ___ProcessTargetString(int caller, string target) + { + int[] __retVal; + Vector192 __retVal_native; + var __target = NativeMethods.ConstructString(target); + try { + __retVal_native = __ProcessTargetString(caller, &__target); + // Unmarshal - Convert native data to managed data. + __retVal = new int[NativeMethods.GetVectorSizeInt32(&__retVal_native)]; + NativeMethods.GetVectorDataInt32(&__retVal_native, __retVal); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorInt32(&__retVal_native); + NativeMethods.DestroyString(&__target); + } + return __retVal; + } + + /// + /// Switches the player's team. + /// + /// The index of the player's slot. + /// The team index to switch the client to. + internal static delegate* SwitchClientTeam = &___SwitchClientTeam; + internal static delegate* unmanaged[Cdecl] __SwitchClientTeam; + private static void ___SwitchClientTeam(int playerSlot, CSTeam team) + { + __SwitchClientTeam(playerSlot, team); + } + + /// + /// Respawns a player. + /// + /// The index of the player's slot to respawn. + internal static delegate* RespawnClient = &___RespawnClient; + internal static delegate* unmanaged[Cdecl] __RespawnClient; + private static void ___RespawnClient(int playerSlot) + { + __RespawnClient(playerSlot); + } + + /// + /// Forces a player to commit suicide. + /// + /// The index of the player's slot. + /// If true, the client will explode upon death. + /// If true, the suicide will be forced. + internal static delegate* ForcePlayerSuicide = &___ForcePlayerSuicide; + internal static delegate* unmanaged[Cdecl] __ForcePlayerSuicide; + private static void ___ForcePlayerSuicide(int playerSlot, Bool8 explode, Bool8 force) + { + __ForcePlayerSuicide(playerSlot, explode, force); + } + + /// + /// Disconnects a client from the server as soon as the next frame starts. + /// + /// The index of the player's slot to be kicked. + internal static delegate* KickClient = &___KickClient; + internal static delegate* unmanaged[Cdecl] __KickClient; + private static void ___KickClient(int playerSlot) + { + __KickClient(playerSlot); + } + + /// + /// Bans a client for a specified duration. + /// + /// The index of the player's slot to be banned. + /// Duration of the ban in seconds. + /// If true, the client will be kicked immediately after being banned. + internal static delegate* BanClient = &___BanClient; + internal static delegate* unmanaged[Cdecl] __BanClient; + private static void ___BanClient(int playerSlot, float duration, Bool8 kick) + { + __BanClient(playerSlot, duration, kick); + } + + /// + /// Bans an identity (either an IP address or a Steam authentication string). + /// + /// The Steam ID to ban. + /// Duration of the ban in seconds. + /// If true, the client will be kicked immediately after being banned. + internal static delegate* BanIdentity = &___BanIdentity; + internal static delegate* unmanaged[Cdecl] __BanIdentity; + private static void ___BanIdentity(ulong steamId, float duration, Bool8 kick) + { + __BanIdentity(steamId, duration, kick); + } + + /// + /// Retrieves the handle of the client's currently active weapon. + /// + /// The index of the player's slot. + /// The entity handle of the active weapon, or INVALID_EHANDLE_INDEX if the client is invalid or has no active weapon. + internal static delegate* GetClientActiveWeapon = &___GetClientActiveWeapon; + internal static delegate* unmanaged[Cdecl] __GetClientActiveWeapon; + private static int ___GetClientActiveWeapon(int playerSlot) + { + int __retVal = __GetClientActiveWeapon(playerSlot); + return __retVal; + } + + /// + /// Retrieves a list of weapon handles owned by the client. + /// + /// The index of the player's slot. + /// A vector of entity handles for the client's weapons, or an empty vector if the client is invalid or has no weapons. + internal static delegate* GetClientWeapons = &___GetClientWeapons; + internal static delegate* unmanaged[Cdecl] __GetClientWeapons; + private static int[] ___GetClientWeapons(int playerSlot) + { + int[] __retVal; + Vector192 __retVal_native; + try { + __retVal_native = __GetClientWeapons(playerSlot); + // Unmarshal - Convert native data to managed data. + __retVal = new int[NativeMethods.GetVectorSizeInt32(&__retVal_native)]; + NativeMethods.GetVectorDataInt32(&__retVal_native, __retVal); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorInt32(&__retVal_native); + } + return __retVal; + } + + /// + /// Removes all weapons from a client, with an option to remove the suit as well. + /// + /// The index of the player's slot. + /// A boolean indicating whether to also remove the client's suit. + internal static delegate* RemoveWeapons = &___RemoveWeapons; + internal static delegate* unmanaged[Cdecl] __RemoveWeapons; + private static void ___RemoveWeapons(int playerSlot, Bool8 removeSuit) + { + __RemoveWeapons(playerSlot, removeSuit); + } + + /// + /// Forces a player to drop their weapon. + /// + /// The index of the player's slot. + /// The handle of weapon to drop. + /// Target direction. + /// Velocity to toss weapon or zero to just drop weapon. + internal static delegate* DropWeapon = &___DropWeapon; + internal static delegate* unmanaged[Cdecl] __DropWeapon; + private static void ___DropWeapon(int playerSlot, int weaponHandle, Vector3 target, Vector3 velocity) + { + __DropWeapon(playerSlot, weaponHandle, &target, &velocity); + } + + /// + /// Selects a player's weapon. + /// + /// The index of the player's slot. + /// The handle of weapon to bump. + internal static delegate* SelectWeapon = &___SelectWeapon; + internal static delegate* unmanaged[Cdecl] __SelectWeapon; + private static void ___SelectWeapon(int playerSlot, int weaponHandle) + { + __SelectWeapon(playerSlot, weaponHandle); + } + + /// + /// Switches a player's weapon. + /// + /// The index of the player's slot. + /// The handle of weapon to switch. + internal static delegate* SwitchWeapon = &___SwitchWeapon; + internal static delegate* unmanaged[Cdecl] __SwitchWeapon; + private static void ___SwitchWeapon(int playerSlot, int weaponHandle) + { + __SwitchWeapon(playerSlot, weaponHandle); + } + + /// + /// Removes a player's weapon. + /// + /// The index of the player's slot. + /// The handle of weapon to remove. + internal static delegate* RemoveWeapon = &___RemoveWeapon; + internal static delegate* unmanaged[Cdecl] __RemoveWeapon; + private static void ___RemoveWeapon(int playerSlot, int weaponHandle) + { + __RemoveWeapon(playerSlot, weaponHandle); + } + + /// + /// Gives a named item (e.g., weapon) to a client. + /// + /// The index of the player's slot. + /// The name of the item to give. + /// The entity handle of the created item, or INVALID_EHANDLE_INDEX if the client or item is invalid. + internal static delegate* GiveNamedItem = &___GiveNamedItem; + internal static delegate* unmanaged[Cdecl] __GiveNamedItem; + private static int ___GiveNamedItem(int playerSlot, string itemName) + { + int __retVal; + var __itemName = NativeMethods.ConstructString(itemName); + try { + __retVal = __GiveNamedItem(playerSlot, &__itemName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__itemName); + } + return __retVal; + } + + /// + /// Retrieves the state of a specific button for a client. + /// + /// The index of the player's slot. + /// The index of the button (0-2). + /// uint64_t The state of the specified button, or 0 if the client or button index is invalid. + internal static delegate* GetClientButtons = &___GetClientButtons; + internal static delegate* unmanaged[Cdecl] __GetClientButtons; + private static ulong ___GetClientButtons(int playerSlot, int buttonIndex) + { + ulong __retVal = __GetClientButtons(playerSlot, buttonIndex); + return __retVal; + } + + /// + /// Returns the client's armor value. + /// + /// The index of the player's slot. + /// The armor value of the client. + internal static delegate* GetClientArmor = &___GetClientArmor; + internal static delegate* unmanaged[Cdecl] __GetClientArmor; + private static int ___GetClientArmor(int playerSlot) + { + int __retVal = __GetClientArmor(playerSlot); + return __retVal; + } + + /// + /// Sets the client's armor value. + /// + /// The index of the player's slot. + /// The armor value to set. + internal static delegate* SetClientArmor = &___SetClientArmor; + internal static delegate* unmanaged[Cdecl] __SetClientArmor; + private static void ___SetClientArmor(int playerSlot, int armor) + { + __SetClientArmor(playerSlot, armor); + } + + /// + /// Returns the client's speed value. + /// + /// The index of the player's slot. + /// The speed value of the client. + internal static delegate* GetClientSpeed = &___GetClientSpeed; + internal static delegate* unmanaged[Cdecl] __GetClientSpeed; + private static float ___GetClientSpeed(int playerSlot) + { + float __retVal = __GetClientSpeed(playerSlot); + return __retVal; + } + + /// + /// Sets the client's speed value. + /// + /// The index of the player's slot. + /// The speed value to set. + internal static delegate* SetClientSpeed = &___SetClientSpeed; + internal static delegate* unmanaged[Cdecl] __SetClientSpeed; + private static void ___SetClientSpeed(int playerSlot, float speed) + { + __SetClientSpeed(playerSlot, speed); + } + + /// + /// Retrieves the amount of money a client has. + /// + /// The index of the player's slot. + /// The amount of money the client has, or 0 if the player slot is invalid. + internal static delegate* GetClientMoney = &___GetClientMoney; + internal static delegate* unmanaged[Cdecl] __GetClientMoney; + private static int ___GetClientMoney(int playerSlot) + { + int __retVal = __GetClientMoney(playerSlot); + return __retVal; + } + + /// + /// Sets the amount of money for a client. + /// + /// The index of the player's slot. + /// The amount of money to set. + internal static delegate* SetClientMoney = &___SetClientMoney; + internal static delegate* unmanaged[Cdecl] __SetClientMoney; + private static void ___SetClientMoney(int playerSlot, int money) + { + __SetClientMoney(playerSlot, money); + } + + /// + /// Retrieves the number of kills for a client. + /// + /// The index of the player's slot. + /// The number of kills the client has, or 0 if the player slot is invalid. + internal static delegate* GetClientKills = &___GetClientKills; + internal static delegate* unmanaged[Cdecl] __GetClientKills; + private static int ___GetClientKills(int playerSlot) + { + int __retVal = __GetClientKills(playerSlot); + return __retVal; + } + + /// + /// Sets the number of kills for a client. + /// + /// The index of the player's slot. + /// The number of kills to set. + internal static delegate* SetClientKills = &___SetClientKills; + internal static delegate* unmanaged[Cdecl] __SetClientKills; + private static void ___SetClientKills(int playerSlot, int kills) + { + __SetClientKills(playerSlot, kills); + } + + /// + /// Retrieves the number of deaths for a client. + /// + /// The index of the player's slot. + /// The number of deaths the client has, or 0 if the player slot is invalid. + internal static delegate* GetClientDeaths = &___GetClientDeaths; + internal static delegate* unmanaged[Cdecl] __GetClientDeaths; + private static int ___GetClientDeaths(int playerSlot) + { + int __retVal = __GetClientDeaths(playerSlot); + return __retVal; + } + + /// + /// Sets the number of deaths for a client. + /// + /// The index of the player's slot. + /// The number of deaths to set. + internal static delegate* SetClientDeaths = &___SetClientDeaths; + internal static delegate* unmanaged[Cdecl] __SetClientDeaths; + private static void ___SetClientDeaths(int playerSlot, int deaths) + { + __SetClientDeaths(playerSlot, deaths); + } + + /// + /// Retrieves the number of assists for a client. + /// + /// The index of the player's slot. + /// The number of assists the client has, or 0 if the player slot is invalid. + internal static delegate* GetClientAssists = &___GetClientAssists; + internal static delegate* unmanaged[Cdecl] __GetClientAssists; + private static int ___GetClientAssists(int playerSlot) + { + int __retVal = __GetClientAssists(playerSlot); + return __retVal; + } + + /// + /// Sets the number of assists for a client. + /// + /// The index of the player's slot. + /// The number of assists to set. + internal static delegate* SetClientAssists = &___SetClientAssists; + internal static delegate* unmanaged[Cdecl] __SetClientAssists; + private static void ___SetClientAssists(int playerSlot, int assists) + { + __SetClientAssists(playerSlot, assists); + } + + /// + /// Retrieves the total damage dealt by a client. + /// + /// The index of the player's slot. + /// The total damage dealt by the client, or 0 if the player slot is invalid. + internal static delegate* GetClientDamage = &___GetClientDamage; + internal static delegate* unmanaged[Cdecl] __GetClientDamage; + private static int ___GetClientDamage(int playerSlot) + { + int __retVal = __GetClientDamage(playerSlot); + return __retVal; + } + + /// + /// Sets the total damage dealt by a client. + /// + /// The index of the player's slot. + /// The amount of damage to set. + internal static delegate* SetClientDamage = &___SetClientDamage; + internal static delegate* unmanaged[Cdecl] __SetClientDamage; + private static void ___SetClientDamage(int playerSlot, int damage) + { + __SetClientDamage(playerSlot, damage); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/commands.cs b/PlugifyProfiler/imported/s2sdk/commands.cs new file mode 100644 index 0000000..23f9dc2 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/commands.cs @@ -0,0 +1,221 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: commands) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a console command as an administrative command. + /// + /// The name of the console command. + /// The admin flags that indicate which admin level can use this command. + /// A brief description of what the command does. + /// Command flags that define the behavior of the command. + /// A callback function that is invoked when the command is executed. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// true if the command was successfully created; otherwise, false. + internal static delegate* AddAdminCommand = &___AddAdminCommand; + internal static delegate* unmanaged[Cdecl] __AddAdminCommand; + private static Bool8 ___AddAdminCommand(string name, long adminFlags, string description, ConVarFlag flags, CommandCallback callback, HookMode type) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __AddAdminCommand(&__name, adminFlags, &__description, flags, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a console command or hooks an already existing one. + /// + /// The name of the console command. + /// A brief description of what the command does. + /// Command flags that define the behavior of the command. + /// A callback function that is invoked when the command is executed. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// true if the command was successfully created; otherwise, false. + internal static delegate* AddConsoleCommand = &___AddConsoleCommand; + internal static delegate* unmanaged[Cdecl] __AddConsoleCommand; + private static Bool8 ___AddConsoleCommand(string name, string description, ConVarFlag flags, CommandCallback callback, HookMode type) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __AddConsoleCommand(&__name, &__description, flags, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Removes a console command from the system. + /// + /// The name of the command to be removed. + /// The callback function associated with the command to be removed. + /// true if the command was successfully removed; otherwise, false. + internal static delegate* RemoveCommand = &___RemoveCommand; + internal static delegate* unmanaged[Cdecl] __RemoveCommand; + private static Bool8 ___RemoveCommand(string name, CommandCallback callback) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __RemoveCommand(&__name, Marshalling.GetFunctionPointerForDelegate(callback)); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Adds a callback that will fire when a command is sent to the server. + /// + /// The name of the command. + /// The callback function that will be invoked when the command is executed. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// Returns true if the callback was successfully added, false otherwise. + internal static delegate* AddCommandListener = &___AddCommandListener; + internal static delegate* unmanaged[Cdecl] __AddCommandListener; + private static Bool8 ___AddCommandListener(string name, CommandCallback callback, HookMode type) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __AddCommandListener(&__name, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Removes a callback that fires when a command is sent to the server. + /// + /// The name of the command. + /// The callback function to be removed. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// Returns true if the callback was successfully removed, false otherwise. + internal static delegate* RemoveCommandListener = &___RemoveCommandListener; + internal static delegate* unmanaged[Cdecl] __RemoveCommandListener; + private static Bool8 ___RemoveCommandListener(string name, CommandCallback callback, HookMode type) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __RemoveCommandListener(&__name, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Executes a server command as if it were run on the server console or through RCON. + /// + /// The command to execute on the server. + internal static delegate* ServerCommand = &___ServerCommand; + internal static delegate* unmanaged[Cdecl] __ServerCommand; + private static void ___ServerCommand(string command) + { + var __command = NativeMethods.ConstructString(command); + try { + __ServerCommand(&__command); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__command); + } + } + + /// + /// Executes a server command as if it were on the server console (or RCON) and stores the printed text into buffer. + /// + /// The command to execute on the server. + /// String to store command result into. + internal static delegate* ServerCommandEx = &___ServerCommandEx; + internal static delegate* unmanaged[Cdecl] __ServerCommandEx; + private static string ___ServerCommandEx(string command) + { + string __retVal; + String192 __retVal_native; + var __command = NativeMethods.ConstructString(command); + try { + __retVal_native = __ServerCommandEx(&__command); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__command); + } + return __retVal; + } + + /// + /// Executes a client command. + /// + /// The index of the client executing the command. + /// The command to execute on the client. + internal static delegate* ClientCommand = &___ClientCommand; + internal static delegate* unmanaged[Cdecl] __ClientCommand; + private static void ___ClientCommand(int playerSlot, string command) + { + var __command = NativeMethods.ConstructString(command); + try { + __ClientCommand(playerSlot, &__command); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__command); + } + } + + /// + /// Executes a client command on the server without network communication. + /// + /// The index of the client. + /// The command to be executed by the client. + internal static delegate* FakeClientCommand = &___FakeClientCommand; + internal static delegate* unmanaged[Cdecl] __FakeClientCommand; + private static void ___FakeClientCommand(int playerSlot, string command) + { + var __command = NativeMethods.ConstructString(command); + try { + __FakeClientCommand(playerSlot, &__command); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__command); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/console.cs b/PlugifyProfiler/imported/s2sdk/console.cs new file mode 100644 index 0000000..b70e272 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/console.cs @@ -0,0 +1,279 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: console) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Sends a message to the server console. + /// + /// The message to be sent to the server console. + internal static delegate* PrintToServer = &___PrintToServer; + internal static delegate* unmanaged[Cdecl] __PrintToServer; + private static void ___PrintToServer(string msg) + { + var __msg = NativeMethods.ConstructString(msg); + try { + __PrintToServer(&__msg); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__msg); + } + } + + /// + /// Sends a message to a client's console. + /// + /// The index of the player's slot to whom the message will be sent. + /// The message to be sent to the client's console. + internal static delegate* PrintToConsole = &___PrintToConsole; + internal static delegate* unmanaged[Cdecl] __PrintToConsole; + private static void ___PrintToConsole(int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToConsole(playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to a specific client in the chat area. + /// + /// The index of the player's slot to whom the message will be sent. + /// The message to be printed in the chat area. + internal static delegate* PrintToChat = &___PrintToChat; + internal static delegate* unmanaged[Cdecl] __PrintToChat; + private static void ___PrintToChat(int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToChat(playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to a specific client in the center of the screen. + /// + /// The index of the player's slot to whom the message will be sent. + /// The message to be printed in the center of the screen. + internal static delegate* PrintCenterText = &___PrintCenterText; + internal static delegate* unmanaged[Cdecl] __PrintCenterText; + private static void ___PrintCenterText(int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintCenterText(playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to a specific client with an alert box. + /// + /// The index of the player's slot to whom the message will be sent. + /// The message to be printed in the alert box. + internal static delegate* PrintAlertText = &___PrintAlertText; + internal static delegate* unmanaged[Cdecl] __PrintAlertText; + private static void ___PrintAlertText(int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintAlertText(playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a html message to a specific client in the center of the screen. + /// + /// The index of the player's slot to whom the message will be sent. + /// The HTML-formatted message to be printed. + /// The duration of the message in seconds. + internal static delegate* PrintCentreHtml = &___PrintCentreHtml; + internal static delegate* unmanaged[Cdecl] __PrintCentreHtml; + private static void ___PrintCentreHtml(int playerSlot, string message, int duration) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintCentreHtml(playerSlot, &__message, duration); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Sends a message to every client's console. + /// + /// The message to be sent to all clients' consoles. + internal static delegate* PrintToConsoleAll = &___PrintToConsoleAll; + internal static delegate* unmanaged[Cdecl] __PrintToConsoleAll; + private static void ___PrintToConsoleAll(string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToConsoleAll(&__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to all clients in the chat area. + /// + /// The message to be printed in the chat area for all clients. + internal static delegate* PrintToChatAll = &___PrintToChatAll; + internal static delegate* unmanaged[Cdecl] __PrintToChatAll; + private static void ___PrintToChatAll(string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToChatAll(&__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to all clients in the center of the screen. + /// + /// The message to be printed in the center of the screen for all clients. + internal static delegate* PrintCenterTextAll = &___PrintCenterTextAll; + internal static delegate* unmanaged[Cdecl] __PrintCenterTextAll; + private static void ___PrintCenterTextAll(string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintCenterTextAll(&__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a message to all clients with an alert box. + /// + /// The message to be printed in an alert box for all clients. + internal static delegate* PrintAlertTextAll = &___PrintAlertTextAll; + internal static delegate* unmanaged[Cdecl] __PrintAlertTextAll; + private static void ___PrintAlertTextAll(string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintAlertTextAll(&__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a html message to all clients in the center of the screen. + /// + /// The HTML-formatted message to be printed in the center of the screen for all clients. + /// The duration of the message in seconds. + internal static delegate* PrintCentreHtmlAll = &___PrintCentreHtmlAll; + internal static delegate* unmanaged[Cdecl] __PrintCentreHtmlAll; + private static void ___PrintCentreHtmlAll(string message, int duration) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintCentreHtmlAll(&__message, duration); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a colored message to a specific client in the chat area. + /// + /// The index of the player's slot to whom the message will be sent. + /// The message to be printed in the chat area with color. + internal static delegate* PrintToChatColored = &___PrintToChatColored; + internal static delegate* unmanaged[Cdecl] __PrintToChatColored; + private static void ___PrintToChatColored(int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToChatColored(playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Prints a colored message to all clients in the chat area. + /// + /// The colored message to be printed in the chat area for all clients. + internal static delegate* PrintToChatColoredAll = &___PrintToChatColoredAll; + internal static delegate* unmanaged[Cdecl] __PrintToChatColoredAll; + private static void ___PrintToChatColoredAll(string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __PrintToChatColoredAll(&__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + /// + /// Sends a reply message to a player or to the server console depending on the command context. + /// + /// The context from which the command was called (e.g., Console or Chat). + /// The slot/index of the player receiving the message. + /// The message string to be sent as a reply. + internal static delegate* ReplyToCommand = &___ReplyToCommand; + internal static delegate* unmanaged[Cdecl] __ReplyToCommand; + private static void ___ReplyToCommand(CommandCallingContext context, int playerSlot, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __ReplyToCommand(context, playerSlot, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/cvars.cs b/PlugifyProfiler/imported/s2sdk/cvars.cs new file mode 100644 index 0000000..ceeb68e --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/cvars.cs @@ -0,0 +1,2139 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: cvars) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a new console variable. + /// + /// The name of the console variable. + /// The default value of the console variable. + /// A description of the console variable's purpose. + /// Additional flags for the console variable. + /// A handle to the created console variable. + internal static delegate* CreateConVar = &___CreateConVar; + internal static delegate* unmanaged[Cdecl] __CreateConVar; + private static ulong ___CreateConVar(string name, object defaultValue, string description, ConVarFlag flags) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __defaultValue = NativeMethods.ConstructVariant(defaultValue); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVar(&__name, &__defaultValue, &__description, flags); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyVariant(&__defaultValue); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new boolean console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarBool = &___CreateConVarBool; + internal static delegate* unmanaged[Cdecl] __CreateConVarBool; + private static ulong ___CreateConVarBool(string name, Bool8 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Bool8 min, Bool8 hasMax, Bool8 max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarBool(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 16-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarInt16 = &___CreateConVarInt16; + internal static delegate* unmanaged[Cdecl] __CreateConVarInt16; + private static ulong ___CreateConVarInt16(string name, short defaultValue, string description, ConVarFlag flags, Bool8 hasMin, short min, Bool8 hasMax, short max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarInt16(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 16-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarUInt16 = &___CreateConVarUInt16; + internal static delegate* unmanaged[Cdecl] __CreateConVarUInt16; + private static ulong ___CreateConVarUInt16(string name, ushort defaultValue, string description, ConVarFlag flags, Bool8 hasMin, ushort min, Bool8 hasMax, ushort max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarUInt16(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 32-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarInt32 = &___CreateConVarInt32; + internal static delegate* unmanaged[Cdecl] __CreateConVarInt32; + private static ulong ___CreateConVarInt32(string name, int defaultValue, string description, ConVarFlag flags, Bool8 hasMin, int min, Bool8 hasMax, int max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarInt32(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 32-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarUInt32 = &___CreateConVarUInt32; + internal static delegate* unmanaged[Cdecl] __CreateConVarUInt32; + private static ulong ___CreateConVarUInt32(string name, uint defaultValue, string description, ConVarFlag flags, Bool8 hasMin, uint min, Bool8 hasMax, uint max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarUInt32(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 64-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarInt64 = &___CreateConVarInt64; + internal static delegate* unmanaged[Cdecl] __CreateConVarInt64; + private static ulong ___CreateConVarInt64(string name, long defaultValue, string description, ConVarFlag flags, Bool8 hasMin, long min, Bool8 hasMax, long max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarInt64(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 64-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarUInt64 = &___CreateConVarUInt64; + internal static delegate* unmanaged[Cdecl] __CreateConVarUInt64; + private static ulong ___CreateConVarUInt64(string name, ulong defaultValue, string description, ConVarFlag flags, Bool8 hasMin, ulong min, Bool8 hasMax, ulong max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarUInt64(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new floating-point console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarFloat = &___CreateConVarFloat; + internal static delegate* unmanaged[Cdecl] __CreateConVarFloat; + private static ulong ___CreateConVarFloat(string name, float defaultValue, string description, ConVarFlag flags, Bool8 hasMin, float min, Bool8 hasMax, float max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarFloat(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new double-precision console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarDouble = &___CreateConVarDouble; + internal static delegate* unmanaged[Cdecl] __CreateConVarDouble; + private static ulong ___CreateConVarDouble(string name, double defaultValue, string description, ConVarFlag flags, Bool8 hasMin, double min, Bool8 hasMax, double max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarDouble(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new color console variable. + /// + /// The name of the console variable. + /// The default color value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum color value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum color value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarColor = &___CreateConVarColor; + internal static delegate* unmanaged[Cdecl] __CreateConVarColor; + private static ulong ___CreateConVarColor(string name, int defaultValue, string description, ConVarFlag flags, Bool8 hasMin, int min, Bool8 hasMax, int max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarColor(&__name, defaultValue, &__description, flags, hasMin, min, hasMax, max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 2D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarVector2 = &___CreateConVarVector2; + internal static delegate* unmanaged[Cdecl] __CreateConVarVector2; + private static ulong ___CreateConVarVector2(string name, Vector2 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector2 min, Bool8 hasMax, Vector2 max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarVector2(&__name, &defaultValue, &__description, flags, hasMin, &min, hasMax, &max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 3D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarVector3 = &___CreateConVarVector3; + internal static delegate* unmanaged[Cdecl] __CreateConVarVector3; + private static ulong ___CreateConVarVector3(string name, Vector3 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector3 min, Bool8 hasMax, Vector3 max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarVector3(&__name, &defaultValue, &__description, flags, hasMin, &min, hasMax, &max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new 4D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarVector4 = &___CreateConVarVector4; + internal static delegate* unmanaged[Cdecl] __CreateConVarVector4; + private static ulong ___CreateConVarVector4(string name, Vector4 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector4 min, Bool8 hasMax, Vector4 max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarVector4(&__name, &defaultValue, &__description, flags, hasMin, &min, hasMax, &max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new quaternion angle console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + /// A handle to the created console variable data. + internal static delegate* CreateConVarQAngle = &___CreateConVarQAngle; + internal static delegate* unmanaged[Cdecl] __CreateConVarQAngle; + private static ulong ___CreateConVarQAngle(string name, Vector3 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector3 min, Bool8 hasMax, Vector3 max) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarQAngle(&__name, &defaultValue, &__description, flags, hasMin, &min, hasMax, &max); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Creates a new string console variable. + /// + /// The name of the console variable. + /// The default value of the console variable. + /// A description of the console variable's purpose. + /// Additional flags for the console variable. + /// A handle to the created console variable. + internal static delegate* CreateConVarString = &___CreateConVarString; + internal static delegate* unmanaged[Cdecl] __CreateConVarString; + private static ulong ___CreateConVarString(string name, string defaultValue, string description, ConVarFlag flags) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + var __defaultValue = NativeMethods.ConstructString(defaultValue); + var __description = NativeMethods.ConstructString(description); + try { + __retVal = __CreateConVarString(&__name, &__defaultValue, &__description, flags); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__defaultValue); + NativeMethods.DestroyString(&__description); + } + return __retVal; + } + + /// + /// Searches for a console variable. + /// + /// The name of the console variable to search for. + /// A handle to the console variable data if found; otherwise, nullptr. + internal static delegate* FindConVar = &___FindConVar; + internal static delegate* unmanaged[Cdecl] __FindConVar; + private static ulong ___FindConVar(string name) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindConVar(&__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Searches for a console variable of a specific type. + /// + /// The name of the console variable to search for. + /// The type of the console variable to search for. + /// A handle to the console variable data if found; otherwise, nullptr. + internal static delegate* FindConVar2 = &___FindConVar2; + internal static delegate* unmanaged[Cdecl] __FindConVar2; + private static ulong ___FindConVar2(string name, ConVarType type) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindConVar2(&__name, type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Creates a hook for when a console variable's value is changed. + /// + /// TThe handle to the console variable data. + /// The callback function to be executed when the variable's value changes. + internal static delegate* HookConVarChange = &___HookConVarChange; + internal static delegate* unmanaged[Cdecl] __HookConVarChange; + private static void ___HookConVarChange(ulong conVarHandle, ChangeCallback callback) + { + __HookConVarChange(conVarHandle, Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Removes a hook for when a console variable's value is changed. + /// + /// The handle to the console variable data. + /// The callback function to be removed. + internal static delegate* UnhookConVarChange = &___UnhookConVarChange; + internal static delegate* unmanaged[Cdecl] __UnhookConVarChange; + private static void ___UnhookConVarChange(ulong conVarHandle, ChangeCallback callback) + { + __UnhookConVarChange(conVarHandle, Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Checks if a specific flag is set for a console variable. + /// + /// The handle to the console variable data. + /// The flag to check against the console variable. + /// True if the flag is set; otherwise, false. + internal static delegate* IsConVarFlagSet = &___IsConVarFlagSet; + internal static delegate* unmanaged[Cdecl] __IsConVarFlagSet; + private static Bool8 ___IsConVarFlagSet(ulong conVarHandle, long flag) + { + Bool8 __retVal = __IsConVarFlagSet(conVarHandle, flag); + return __retVal; + } + + /// + /// Adds flags to a console variable. + /// + /// The handle to the console variable data. + /// The flags to be added. + internal static delegate* AddConVarFlags = &___AddConVarFlags; + internal static delegate* unmanaged[Cdecl] __AddConVarFlags; + private static void ___AddConVarFlags(ulong conVarHandle, ConVarFlag flags) + { + __AddConVarFlags(conVarHandle, flags); + } + + /// + /// Removes flags from a console variable. + /// + /// The handle to the console variable data. + /// The flags to be removed. + internal static delegate* RemoveConVarFlags = &___RemoveConVarFlags; + internal static delegate* unmanaged[Cdecl] __RemoveConVarFlags; + private static void ___RemoveConVarFlags(ulong conVarHandle, ConVarFlag flags) + { + __RemoveConVarFlags(conVarHandle, flags); + } + + /// + /// Retrieves the current flags of a console variable. + /// + /// The handle to the console variable data. + /// The current flags set on the console variable. + internal static delegate* GetConVarFlags = &___GetConVarFlags; + internal static delegate* unmanaged[Cdecl] __GetConVarFlags; + private static ConVarFlag ___GetConVarFlags(ulong conVarHandle) + { + ConVarFlag __retVal = __GetConVarFlags(conVarHandle); + return __retVal; + } + + /// + /// Gets the specified bound (max or min) of a console variable and stores it in the output string. + /// + /// The handle to the console variable data. + /// Indicates whether to get the maximum (true) or minimum (false) bound. + /// The bound value. + internal static delegate* GetConVarBounds = &___GetConVarBounds; + internal static delegate* unmanaged[Cdecl] __GetConVarBounds; + private static string ___GetConVarBounds(ulong conVarHandle, Bool8 max) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetConVarBounds(conVarHandle, max); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the specified bound (max or min) for a console variable. + /// + /// The handle to the console variable data. + /// Indicates whether to set the maximum (true) or minimum (false) bound. + /// The value to set as the bound. + internal static delegate* SetConVarBounds = &___SetConVarBounds; + internal static delegate* unmanaged[Cdecl] __SetConVarBounds; + private static void ___SetConVarBounds(ulong conVarHandle, Bool8 max, string value) + { + var __value = NativeMethods.ConstructString(value); + try { + __SetConVarBounds(conVarHandle, max, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Retrieves the default value of a console variable and stores it in the output string. + /// + /// The handle to the console variable data. + /// The output value in string format. + internal static delegate* GetConVarDefault = &___GetConVarDefault; + internal static delegate* unmanaged[Cdecl] __GetConVarDefault; + private static string ___GetConVarDefault(ulong conVarHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetConVarDefault(conVarHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves the current value of a console variable and stores it in the output string. + /// + /// The handle to the console variable data. + /// The output value in string format. + internal static delegate* GetConVarValue = &___GetConVarValue; + internal static delegate* unmanaged[Cdecl] __GetConVarValue; + private static string ___GetConVarValue(ulong conVarHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetConVarValue(conVarHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves the current value of a console variable and stores it in the output. + /// + /// The handle to the console variable data. + /// The output value. + internal static delegate* GetConVar = &___GetConVar; + internal static delegate* unmanaged[Cdecl] __GetConVar; + private static object ___GetConVar(ulong conVarHandle) + { + object __retVal; + Variant256 __retVal_native; + try { + __retVal_native = __GetConVar(conVarHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetVariantData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVariant(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves the current value of a boolean console variable. + /// + /// The handle to the console variable data. + /// The current boolean value of the console variable. + internal static delegate* GetConVarBool = &___GetConVarBool; + internal static delegate* unmanaged[Cdecl] __GetConVarBool; + private static Bool8 ___GetConVarBool(ulong conVarHandle) + { + Bool8 __retVal = __GetConVarBool(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a signed 16-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current int16_t value of the console variable. + internal static delegate* GetConVarInt16 = &___GetConVarInt16; + internal static delegate* unmanaged[Cdecl] __GetConVarInt16; + private static short ___GetConVarInt16(ulong conVarHandle) + { + short __retVal = __GetConVarInt16(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of an unsigned 16-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current uint16_t value of the console variable. + internal static delegate* GetConVarUInt16 = &___GetConVarUInt16; + internal static delegate* unmanaged[Cdecl] __GetConVarUInt16; + private static ushort ___GetConVarUInt16(ulong conVarHandle) + { + ushort __retVal = __GetConVarUInt16(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a signed 32-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current int32_t value of the console variable. + internal static delegate* GetConVarInt32 = &___GetConVarInt32; + internal static delegate* unmanaged[Cdecl] __GetConVarInt32; + private static int ___GetConVarInt32(ulong conVarHandle) + { + int __retVal = __GetConVarInt32(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of an unsigned 32-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current uint32_t value of the console variable. + internal static delegate* GetConVarUInt32 = &___GetConVarUInt32; + internal static delegate* unmanaged[Cdecl] __GetConVarUInt32; + private static uint ___GetConVarUInt32(ulong conVarHandle) + { + uint __retVal = __GetConVarUInt32(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a signed 64-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current int64_t value of the console variable. + internal static delegate* GetConVarInt64 = &___GetConVarInt64; + internal static delegate* unmanaged[Cdecl] __GetConVarInt64; + private static long ___GetConVarInt64(ulong conVarHandle) + { + long __retVal = __GetConVarInt64(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of an unsigned 64-bit integer console variable. + /// + /// The handle to the console variable data. + /// The current uint64_t value of the console variable. + internal static delegate* GetConVarUInt64 = &___GetConVarUInt64; + internal static delegate* unmanaged[Cdecl] __GetConVarUInt64; + private static ulong ___GetConVarUInt64(ulong conVarHandle) + { + ulong __retVal = __GetConVarUInt64(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a float console variable. + /// + /// The handle to the console variable data. + /// The current float value of the console variable. + internal static delegate* GetConVarFloat = &___GetConVarFloat; + internal static delegate* unmanaged[Cdecl] __GetConVarFloat; + private static float ___GetConVarFloat(ulong conVarHandle) + { + float __retVal = __GetConVarFloat(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a double console variable. + /// + /// The handle to the console variable data. + /// The current double value of the console variable. + internal static delegate* GetConVarDouble = &___GetConVarDouble; + internal static delegate* unmanaged[Cdecl] __GetConVarDouble; + private static double ___GetConVarDouble(ulong conVarHandle) + { + double __retVal = __GetConVarDouble(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a string console variable. + /// + /// The handle to the console variable data. + /// The current string value of the console variable. + internal static delegate* GetConVarString = &___GetConVarString; + internal static delegate* unmanaged[Cdecl] __GetConVarString; + private static string ___GetConVarString(ulong conVarHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetConVarString(conVarHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves the current value of a Color console variable. + /// + /// The handle to the console variable data. + /// The current Color value of the console variable. + internal static delegate* GetConVarColor = &___GetConVarColor; + internal static delegate* unmanaged[Cdecl] __GetConVarColor; + private static int ___GetConVarColor(ulong conVarHandle) + { + int __retVal = __GetConVarColor(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a Vector2D console variable. + /// + /// The handle to the console variable data. + /// The current Vector2D value of the console variable. + internal static delegate* GetConVarVector2 = &___GetConVarVector2; + internal static delegate* unmanaged[Cdecl] __GetConVarVector2; + private static Vector2 ___GetConVarVector2(ulong conVarHandle) + { + Vector2 __retVal = __GetConVarVector2(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a Vector console variable. + /// + /// The handle to the console variable data. + /// The current Vector value of the console variable. + internal static delegate* GetConVarVector = &___GetConVarVector; + internal static delegate* unmanaged[Cdecl] __GetConVarVector; + private static Vector3 ___GetConVarVector(ulong conVarHandle) + { + Vector3 __retVal = __GetConVarVector(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a Vector4D console variable. + /// + /// The handle to the console variable data. + /// The current Vector4D value of the console variable. + internal static delegate* GetConVarVector4 = &___GetConVarVector4; + internal static delegate* unmanaged[Cdecl] __GetConVarVector4; + private static Vector4 ___GetConVarVector4(ulong conVarHandle) + { + Vector4 __retVal = __GetConVarVector4(conVarHandle); + return __retVal; + } + + /// + /// Retrieves the current value of a QAngle console variable. + /// + /// The handle to the console variable data. + /// The current QAngle value of the console variable. + internal static delegate* GetConVarQAngle = &___GetConVarQAngle; + internal static delegate* unmanaged[Cdecl] __GetConVarQAngle; + private static Vector3 ___GetConVarQAngle(ulong conVarHandle) + { + Vector3 __retVal = __GetConVarQAngle(conVarHandle); + return __retVal; + } + + /// + /// Sets the value of a console variable. + /// + /// The handle to the console variable data. + /// The string value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarValue = &___SetConVarValue; + internal static delegate* unmanaged[Cdecl] __SetConVarValue; + private static void ___SetConVarValue(ulong conVarHandle, string value, Bool8 replicate, Bool8 notify) + { + var __value = NativeMethods.ConstructString(value); + try { + __SetConVarValue(conVarHandle, &__value, replicate, notify); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Sets the value of a console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVar = &___SetConVar; + internal static delegate* unmanaged[Cdecl] __SetConVar; + private static void ___SetConVar(ulong conVarHandle, object value, Bool8 replicate, Bool8 notify) + { + var __value = NativeMethods.ConstructVariant(value); + try { + __SetConVar(conVarHandle, &__value, replicate, notify); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVariant(&__value); + } + } + + /// + /// Sets the value of a boolean console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarBool = &___SetConVarBool; + internal static delegate* unmanaged[Cdecl] __SetConVarBool; + private static void ___SetConVarBool(ulong conVarHandle, Bool8 value, Bool8 replicate, Bool8 notify) + { + __SetConVarBool(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 16-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarInt16 = &___SetConVarInt16; + internal static delegate* unmanaged[Cdecl] __SetConVarInt16; + private static void ___SetConVarInt16(ulong conVarHandle, short value, Bool8 replicate, Bool8 notify) + { + __SetConVarInt16(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 16-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarUInt16 = &___SetConVarUInt16; + internal static delegate* unmanaged[Cdecl] __SetConVarUInt16; + private static void ___SetConVarUInt16(ulong conVarHandle, ushort value, Bool8 replicate, Bool8 notify) + { + __SetConVarUInt16(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 32-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarInt32 = &___SetConVarInt32; + internal static delegate* unmanaged[Cdecl] __SetConVarInt32; + private static void ___SetConVarInt32(ulong conVarHandle, int value, Bool8 replicate, Bool8 notify) + { + __SetConVarInt32(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 32-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarUInt32 = &___SetConVarUInt32; + internal static delegate* unmanaged[Cdecl] __SetConVarUInt32; + private static void ___SetConVarUInt32(ulong conVarHandle, uint value, Bool8 replicate, Bool8 notify) + { + __SetConVarUInt32(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 64-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarInt64 = &___SetConVarInt64; + internal static delegate* unmanaged[Cdecl] __SetConVarInt64; + private static void ___SetConVarInt64(ulong conVarHandle, long value, Bool8 replicate, Bool8 notify) + { + __SetConVarInt64(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 64-bit integer console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarUInt64 = &___SetConVarUInt64; + internal static delegate* unmanaged[Cdecl] __SetConVarUInt64; + private static void ___SetConVarUInt64(ulong conVarHandle, ulong value, Bool8 replicate, Bool8 notify) + { + __SetConVarUInt64(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a floating-point console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarFloat = &___SetConVarFloat; + internal static delegate* unmanaged[Cdecl] __SetConVarFloat; + private static void ___SetConVarFloat(ulong conVarHandle, float value, Bool8 replicate, Bool8 notify) + { + __SetConVarFloat(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a double-precision floating-point console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarDouble = &___SetConVarDouble; + internal static delegate* unmanaged[Cdecl] __SetConVarDouble; + private static void ___SetConVarDouble(ulong conVarHandle, double value, Bool8 replicate, Bool8 notify) + { + __SetConVarDouble(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a string console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarString = &___SetConVarString; + internal static delegate* unmanaged[Cdecl] __SetConVarString; + private static void ___SetConVarString(ulong conVarHandle, string value, Bool8 replicate, Bool8 notify) + { + var __value = NativeMethods.ConstructString(value); + try { + __SetConVarString(conVarHandle, &__value, replicate, notify); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Sets the value of a color console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarColor = &___SetConVarColor; + internal static delegate* unmanaged[Cdecl] __SetConVarColor; + private static void ___SetConVarColor(ulong conVarHandle, int value, Bool8 replicate, Bool8 notify) + { + __SetConVarColor(conVarHandle, value, replicate, notify); + } + + /// + /// Sets the value of a 2D vector console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarVector2 = &___SetConVarVector2; + internal static delegate* unmanaged[Cdecl] __SetConVarVector2; + private static void ___SetConVarVector2(ulong conVarHandle, Vector2 value, Bool8 replicate, Bool8 notify) + { + __SetConVarVector2(conVarHandle, &value, replicate, notify); + } + + /// + /// Sets the value of a 3D vector console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarVector3 = &___SetConVarVector3; + internal static delegate* unmanaged[Cdecl] __SetConVarVector3; + private static void ___SetConVarVector3(ulong conVarHandle, Vector3 value, Bool8 replicate, Bool8 notify) + { + __SetConVarVector3(conVarHandle, &value, replicate, notify); + } + + /// + /// Sets the value of a 4D vector console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarVector4 = &___SetConVarVector4; + internal static delegate* unmanaged[Cdecl] __SetConVarVector4; + private static void ___SetConVarVector4(ulong conVarHandle, Vector4 value, Bool8 replicate, Bool8 notify) + { + __SetConVarVector4(conVarHandle, &value, replicate, notify); + } + + /// + /// Sets the value of a quaternion angle console variable. + /// + /// The handle to the console variable data. + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + internal static delegate* SetConVarQAngle = &___SetConVarQAngle; + internal static delegate* unmanaged[Cdecl] __SetConVarQAngle; + private static void ___SetConVarQAngle(ulong conVarHandle, Vector3 value, Bool8 replicate, Bool8 notify) + { + __SetConVarQAngle(conVarHandle, &value, replicate, notify); + } + + /// + /// Replicates a console variable value to a specific client. This does not change the actual console variable value. + /// + /// The index of the client to replicate the value to. + /// The handle to the console variable data. + /// The value to send to the client. + internal static delegate* SendConVarValue = &___SendConVarValue; + internal static delegate* unmanaged[Cdecl] __SendConVarValue; + private static void ___SendConVarValue(int playerSlot, ulong conVarHandle, string value) + { + var __value = NativeMethods.ConstructString(value); + try { + __SendConVarValue(playerSlot, conVarHandle, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Replicates a console variable value to a specific client. This does not change the actual console variable value. + /// + /// The handle to the console variable data. + /// The index of the client to replicate the value to. + /// The value to send to the client. + internal static delegate* SendConVarValue2 = &___SendConVarValue2; + internal static delegate* unmanaged[Cdecl] __SendConVarValue2; + private static void ___SendConVarValue2(ulong conVarHandle, int playerSlot, string value) + { + var __value = NativeMethods.ConstructString(value); + try { + __SendConVarValue2(conVarHandle, playerSlot, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Retrieves the value of a client's console variable and stores it in the output string. + /// + /// The index of the client whose console variable value is being retrieved. + /// The name of the console variable to retrieve. + /// The output string to store the client's console variable value. + internal static delegate* GetClientConVarValue = &___GetClientConVarValue; + internal static delegate* unmanaged[Cdecl] __GetClientConVarValue; + private static string ___GetClientConVarValue(int playerSlot, string convarName) + { + string __retVal; + String192 __retVal_native; + var __convarName = NativeMethods.ConstructString(convarName); + try { + __retVal_native = __GetClientConVarValue(playerSlot, &__convarName); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__convarName); + } + return __retVal; + } + + /// + /// Replicates a console variable value to a specific fake client. This does not change the actual console variable value. + /// + /// The index of the fake client to replicate the value to. + /// The name of the console variable. + /// The value to set for the console variable. + internal static delegate* SetFakeClientConVarValue = &___SetFakeClientConVarValue; + internal static delegate* unmanaged[Cdecl] __SetFakeClientConVarValue; + private static void ___SetFakeClientConVarValue(int playerSlot, string convarName, string convarValue) + { + var __convarName = NativeMethods.ConstructString(convarName); + var __convarValue = NativeMethods.ConstructString(convarValue); + try { + __SetFakeClientConVarValue(playerSlot, &__convarName, &__convarValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__convarName); + NativeMethods.DestroyString(&__convarValue); + } + } + + /// + /// Starts a query to retrieve the value of a client's console variable. + /// + /// The index of the player's slot to query the value from. + /// The name of client convar to query. + /// A function to use as a callback when the query has finished. + /// Optional values to pass to the callback function. + /// A cookie that uniquely identifies the query. Returns -1 on failure, such as when used on a bot. + internal static delegate* QueryClientConVar = &___QueryClientConVar; + internal static delegate* unmanaged[Cdecl] __QueryClientConVar; + private static int ___QueryClientConVar(int playerSlot, string convarName, CvarValueCallback callback, object[] data) + { + int __retVal; + var __convarName = NativeMethods.ConstructString(convarName); + var __data = NativeMethods.ConstructVectorVariant(data, data.Length); + try { + __retVal = __QueryClientConVar(playerSlot, &__convarName, Marshalling.GetFunctionPointerForDelegate(callback), &__data); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__convarName); + NativeMethods.DestroyVectorVariant(&__data); + } + return __retVal; + } + + /// + /// Specifies that the given config file should be executed. + /// + /// List of handles to the console variable data. + /// If true, and the config file does not exist, such a config file will be automatically created and populated with information from the plugin's registered cvars. + /// Name of the config file, excluding the .cfg extension. Cannot be empty. + /// Folder under cfg/ to use. By default this is "plugify." Can be empty. + /// True on success, false otherwise. + internal static delegate* AutoExecConfig = &___AutoExecConfig; + internal static delegate* unmanaged[Cdecl] __AutoExecConfig; + private static Bool8 ___AutoExecConfig(ulong[] conVarHandles, Bool8 autoCreate, string name, string folder) + { + Bool8 __retVal; + var __conVarHandles = NativeMethods.ConstructVectorUInt64(conVarHandles, conVarHandles.Length); + var __name = NativeMethods.ConstructString(name); + var __folder = NativeMethods.ConstructString(folder); + try { + __retVal = __AutoExecConfig(&__conVarHandles, autoCreate, &__name, &__folder); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorUInt64(&__conVarHandles); + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__folder); + } + return __retVal; + } + + /// + /// Returns the current server language. + /// + /// The server language as a string. + internal static delegate* GetServerLanguage = &___GetServerLanguage; + internal static delegate* unmanaged[Cdecl] __GetServerLanguage; + private static string ___GetServerLanguage() + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetServerLanguage(); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for ConVar handle. + /// + internal sealed unsafe class ConVar + { + private ulong handle; + + /// + /// Creates a new console variable. + /// + /// The name of the console variable. + /// The default value of the console variable. + /// A description of the console variable's purpose. + /// Additional flags for the console variable. + public ConVar(string name, object defaultValue, string description, ConVarFlag flags) + { + this.handle = s2sdk.CreateConVar(name, defaultValue, description, flags); + } + + /// + /// Creates a new boolean console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, Bool8 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Bool8 min, Bool8 hasMax, Bool8 max) + { + this.handle = s2sdk.CreateConVarBool(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 16-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, short defaultValue, string description, ConVarFlag flags, Bool8 hasMin, short min, Bool8 hasMax, short max) + { + this.handle = s2sdk.CreateConVarInt16(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 16-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, ushort defaultValue, string description, ConVarFlag flags, Bool8 hasMin, ushort min, Bool8 hasMax, ushort max) + { + this.handle = s2sdk.CreateConVarUInt16(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 32-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, int defaultValue, string description, ConVarFlag flags, Bool8 hasMin, int min, Bool8 hasMax, int max) + { + this.handle = s2sdk.CreateConVarInt32(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 32-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, uint defaultValue, string description, ConVarFlag flags, Bool8 hasMin, uint min, Bool8 hasMax, uint max) + { + this.handle = s2sdk.CreateConVarUInt32(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 64-bit signed integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, long defaultValue, string description, ConVarFlag flags, Bool8 hasMin, long min, Bool8 hasMax, long max) + { + this.handle = s2sdk.CreateConVarInt64(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 64-bit unsigned integer console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, ulong defaultValue, string description, ConVarFlag flags, Bool8 hasMin, ulong min, Bool8 hasMax, ulong max) + { + this.handle = s2sdk.CreateConVarUInt64(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new floating-point console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, float defaultValue, string description, ConVarFlag flags, Bool8 hasMin, float min, Bool8 hasMax, float max) + { + this.handle = s2sdk.CreateConVarFloat(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new double-precision console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, double defaultValue, string description, ConVarFlag flags, Bool8 hasMin, double min, Bool8 hasMax, double max) + { + this.handle = s2sdk.CreateConVarDouble(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 2D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, Vector2 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector2 min, Bool8 hasMax, Vector2 max) + { + this.handle = s2sdk.CreateConVarVector2(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 3D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, Vector3 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector3 min, Bool8 hasMax, Vector3 max) + { + this.handle = s2sdk.CreateConVarVector3(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new 4D vector console variable. + /// + /// The name of the console variable. + /// The default value for the console variable. + /// A brief description of the console variable. + /// Flags that define the behavior of the console variable. + /// Indicates if a minimum value is provided. + /// The minimum value if hasMin is true. + /// Indicates if a maximum value is provided. + /// The maximum value if hasMax is true. + public ConVar(string name, Vector4 defaultValue, string description, ConVarFlag flags, Bool8 hasMin, Vector4 min, Bool8 hasMax, Vector4 max) + { + this.handle = s2sdk.CreateConVarVector4(name, defaultValue, description, flags, hasMin, min, hasMax, max); + } + + /// + /// Creates a new string console variable. + /// + /// The name of the console variable. + /// The default value of the console variable. + /// A description of the console variable's purpose. + /// Additional flags for the console variable. + public ConVar(string name, string defaultValue, string description, ConVarFlag flags) + { + this.handle = s2sdk.CreateConVarString(name, defaultValue, description, flags); + } + + /// + /// Internal constructor for creating ConVar from existing handle + /// + public ConVar(ulong handle, Ownership ownership = Ownership.Borrowed) + { + this.handle = handle; + } + + /// + /// Gets the underlying handle + /// + public ulong Handle => handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != 0; + + /// + /// Gets the underlying handle + /// + public ulong Get() => handle; + + /// + /// Releases ownership of the handle and returns it + /// + public ulong Release() + { + var h = handle; + handle = 0; + return h; + } + + /// + /// Resets the handle to invalid + /// + public void Reset() + { + handle = 0; + } + + /// + /// Searches for a console variable. + /// + /// The name of the console variable to search for. + /// A handle to the console variable data if found; otherwise, nullptr. + public static ConVar Find(string name) + { + return new ConVar(s2sdk.FindConVar(name), Ownership.Borrowed); + } + + /// + /// Searches for a console variable of a specific type. + /// + /// The name of the console variable to search for. + /// The type of the console variable to search for. + /// A handle to the console variable data if found; otherwise, nullptr. + public static ConVar Find2(string name, ConVarType type) + { + return new ConVar(s2sdk.FindConVar2(name, type), Ownership.Borrowed); + } + + /// + /// Creates a hook for when a console variable's value is changed. + /// + /// The callback function to be executed when the variable's value changes. + public void HookChange(ChangeCallback callback) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.HookConVarChange(handle, callback); + } + + /// + /// Removes a hook for when a console variable's value is changed. + /// + /// The callback function to be removed. + public void UnhookChange(ChangeCallback callback) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.UnhookConVarChange(handle, callback); + } + + /// + /// Checks if a specific flag is set for a console variable. + /// + /// The flag to check against the console variable. + /// True if the flag is set; otherwise, false. + public Bool8 IsFlagSet(long flag) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.IsConVarFlagSet(handle, flag); + } + + /// + /// Adds flags to a console variable. + /// + /// The flags to be added. + public void AddFlags(ConVarFlag flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.AddConVarFlags(handle, flags); + } + + /// + /// Removes flags from a console variable. + /// + /// The flags to be removed. + public void RemoveFlags(ConVarFlag flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.RemoveConVarFlags(handle, flags); + } + + /// + /// Retrieves the current flags of a console variable. + /// + /// The current flags set on the console variable. + public ConVarFlag GetFlags() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarFlags(handle); + } + + /// + /// Gets the specified bound (max or min) of a console variable and stores it in the output string. + /// + /// Indicates whether to get the maximum (true) or minimum (false) bound. + /// The bound value. + public string GetBounds(Bool8 max) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarBounds(handle, max); + } + + /// + /// Sets the specified bound (max or min) for a console variable. + /// + /// Indicates whether to set the maximum (true) or minimum (false) bound. + /// The value to set as the bound. + public void SetBounds(Bool8 max, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarBounds(handle, max, value); + } + + /// + /// Retrieves the default value of a console variable and stores it in the output string. + /// + /// The output value in string format. + public string GetDefault() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarDefault(handle); + } + + /// + /// Retrieves the current value of a console variable and stores it in the output string. + /// + /// The output value in string format. + public string GetValue() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarValue(handle); + } + + /// + /// Retrieves the current value of a console variable and stores it in the output. + /// + /// The output value. + public object GetObject() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVar(handle); + } + + /// + /// Retrieves the current value of a boolean console variable. + /// + /// The current boolean value of the console variable. + public Bool8 GetBool() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarBool(handle); + } + + /// + /// Retrieves the current value of a signed 16-bit integer console variable. + /// + /// The current int16_t value of the console variable. + public short GetInt16() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarInt16(handle); + } + + /// + /// Retrieves the current value of an unsigned 16-bit integer console variable. + /// + /// The current uint16_t value of the console variable. + public ushort GetUInt16() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarUInt16(handle); + } + + /// + /// Retrieves the current value of a signed 32-bit integer console variable. + /// + /// The current int32_t value of the console variable. + public int GetInt32() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarInt32(handle); + } + + /// + /// Retrieves the current value of an unsigned 32-bit integer console variable. + /// + /// The current uint32_t value of the console variable. + public uint GetUInt32() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarUInt32(handle); + } + + /// + /// Retrieves the current value of a signed 64-bit integer console variable. + /// + /// The current int64_t value of the console variable. + public long GetInt64() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarInt64(handle); + } + + /// + /// Retrieves the current value of an unsigned 64-bit integer console variable. + /// + /// The current uint64_t value of the console variable. + public ulong GetUInt64() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarUInt64(handle); + } + + /// + /// Retrieves the current value of a float console variable. + /// + /// The current float value of the console variable. + public float GetFloat() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarFloat(handle); + } + + /// + /// Retrieves the current value of a double console variable. + /// + /// The current double value of the console variable. + public double GetDouble() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarDouble(handle); + } + + /// + /// Retrieves the current value of a string console variable. + /// + /// The current string value of the console variable. + public string GetString() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarString(handle); + } + + /// + /// Retrieves the current value of a Color console variable. + /// + /// The current Color value of the console variable. + public int GetColor() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarColor(handle); + } + + /// + /// Retrieves the current value of a Vector2D console variable. + /// + /// The current Vector2D value of the console variable. + public Vector2 GetVector2() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarVector2(handle); + } + + /// + /// Retrieves the current value of a Vector console variable. + /// + /// The current Vector value of the console variable. + public Vector3 GetVector() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarVector(handle); + } + + /// + /// Retrieves the current value of a Vector4D console variable. + /// + /// The current Vector4D value of the console variable. + public Vector4 GetVector4() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarVector4(handle); + } + + /// + /// Retrieves the current value of a QAngle console variable. + /// + /// The current QAngle value of the console variable. + public Vector3 GetQAngle() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetConVarQAngle(handle); + } + + /// + /// Sets the value of a console variable. + /// + /// The string value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetValue(string value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarValue(handle, value, replicate, notify); + } + + /// + /// Sets the value of a console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void Set(object value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVar(handle, value, replicate, notify); + } + + /// + /// Sets the value of a boolean console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetBool(Bool8 value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarBool(handle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 16-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetInt16(short value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarInt16(handle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 16-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetUInt16(ushort value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarUInt16(handle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 32-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetInt32(int value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarInt32(handle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 32-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetUInt32(uint value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarUInt32(handle, value, replicate, notify); + } + + /// + /// Sets the value of a signed 64-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetInt64(long value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarInt64(handle, value, replicate, notify); + } + + /// + /// Sets the value of an unsigned 64-bit integer console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetUInt64(ulong value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarUInt64(handle, value, replicate, notify); + } + + /// + /// Sets the value of a floating-point console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetFloat(float value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarFloat(handle, value, replicate, notify); + } + + /// + /// Sets the value of a double-precision floating-point console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetDouble(double value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarDouble(handle, value, replicate, notify); + } + + /// + /// Sets the value of a string console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetString(string value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarString(handle, value, replicate, notify); + } + + /// + /// Sets the value of a color console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetColor(int value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarColor(handle, value, replicate, notify); + } + + /// + /// Sets the value of a 2D vector console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetVector2(Vector2 value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarVector2(handle, value, replicate, notify); + } + + /// + /// Sets the value of a 3D vector console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetVector3(Vector3 value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarVector3(handle, value, replicate, notify); + } + + /// + /// Sets the value of a 4D vector console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetVector4(Vector4 value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarVector4(handle, value, replicate, notify); + } + + /// + /// Sets the value of a quaternion angle console variable. + /// + /// The value to set for the console variable. + /// If set to true, the new convar value will be set on all clients. This will only work if the convar has the FCVAR_REPLICATED flag and actually exists on clients. + /// If set to true, clients will be notified that the convar has changed. This will only work if the convar has the FCVAR_NOTIFY flag. + public void SetQAngle(Vector3 value, Bool8 replicate, Bool8 notify) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetConVarQAngle(handle, value, replicate, notify); + } + + /// + /// Replicates a console variable value to a specific client. This does not change the actual console variable value. + /// + /// The index of the client to replicate the value to. + /// The value to send to the client. + public void SendValue(int playerSlot, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SendConVarValue2(handle, playerSlot, value); + } + + /// + /// Retrieves the value of a client's console variable and stores it in the output string. + /// + /// The index of the client whose console variable value is being retrieved. + /// The name of the console variable to retrieve. + /// The output string to store the client's console variable value. + public static string GetClientValue(int playerSlot, string convarName) + { + return s2sdk.GetClientConVarValue(playerSlot, convarName); + } + + /// + /// Replicates a console variable value to a specific fake client. This does not change the actual console variable value. + /// + /// The index of the fake client to replicate the value to. + /// The name of the console variable. + /// The value to set for the console variable. + public static void SetFakeClientValue(int playerSlot, string convarName, string convarValue) + { + s2sdk.SetFakeClientConVarValue(playerSlot, convarName, convarValue); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/debug.cs b/PlugifyProfiler/imported/s2sdk/debug.cs new file mode 100644 index 0000000..3815eba --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/debug.cs @@ -0,0 +1,233 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: debug) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Triggers a breakpoint in the debugger. + /// + internal static delegate* DebugBreak = &___DebugBreak; + internal static delegate* unmanaged[Cdecl] __DebugBreak; + private static void ___DebugBreak() + { + __DebugBreak(); + } + + /// + /// Draws a debug overlay box. + /// + /// Center of the box in world space. + /// Minimum bounds relative to the center. + /// Maximum bounds relative to the center. + /// Red color value. + /// Green color value. + /// Blue color value. + /// Alpha (transparency) value. + /// Duration (in seconds) to display the box. + internal static delegate* DebugDrawBox = &___DebugDrawBox; + internal static delegate* unmanaged[Cdecl] __DebugDrawBox; + private static void ___DebugDrawBox(Vector3 center, Vector3 mins, Vector3 maxs, int r, int g, int b, int a, float duration) + { + __DebugDrawBox(¢er, &mins, &maxs, r, g, b, a, duration); + } + + /// + /// Draws a debug box oriented in the direction of a forward vector. + /// + /// Center of the box. + /// Minimum bounds. + /// Maximum bounds. + /// Forward direction vector. + /// RGB color vector. + /// Alpha transparency. + /// Duration (in seconds) to display the box. + internal static delegate* DebugDrawBoxDirection = &___DebugDrawBoxDirection; + internal static delegate* unmanaged[Cdecl] __DebugDrawBoxDirection; + private static void ___DebugDrawBoxDirection(Vector3 center, Vector3 mins, Vector3 maxs, Vector3 forward, Vector3 color, float alpha, float duration) + { + __DebugDrawBoxDirection(¢er, &mins, &maxs, &forward, &color, alpha, duration); + } + + /// + /// Draws a debug circle. + /// + /// Center of the circle. + /// RGB color vector. + /// Alpha transparency. + /// Circle radius. + /// Whether to perform depth testing. + /// Duration (in seconds) to display the circle. + internal static delegate* DebugDrawCircle = &___DebugDrawCircle; + internal static delegate* unmanaged[Cdecl] __DebugDrawCircle; + private static void ___DebugDrawCircle(Vector3 center, Vector3 color, float alpha, float radius, Bool8 zTest, float duration) + { + __DebugDrawCircle(¢er, &color, alpha, radius, zTest, duration); + } + + /// + /// Clears all debug overlays. + /// + internal static delegate* DebugDrawClear = &___DebugDrawClear; + internal static delegate* unmanaged[Cdecl] __DebugDrawClear; + private static void ___DebugDrawClear() + { + __DebugDrawClear(); + } + + /// + /// Draws a debug overlay line. + /// + /// Start point of the line. + /// End point of the line. + /// Red color value. + /// Green color value. + /// Blue color value. + /// Whether to perform depth testing. + /// Duration (in seconds) to display the line. + internal static delegate* DebugDrawLine = &___DebugDrawLine; + internal static delegate* unmanaged[Cdecl] __DebugDrawLine; + private static void ___DebugDrawLine(Vector3 origin, Vector3 target, int r, int g, int b, Bool8 zTest, float duration) + { + __DebugDrawLine(&origin, &target, r, g, b, zTest, duration); + } + + /// + /// Draws a debug line using a color vector. + /// + /// Start point of the line. + /// End point of the line. + /// RGB color vector. + /// Whether to perform depth testing. + /// Duration (in seconds) to display the line. + internal static delegate* DebugDrawLine_vCol = &___DebugDrawLine_vCol; + internal static delegate* unmanaged[Cdecl] __DebugDrawLine_vCol; + private static void ___DebugDrawLine_vCol(Vector3 start, Vector3 end, Vector3 color, Bool8 zTest, float duration) + { + __DebugDrawLine_vCol(&start, &end, &color, zTest, duration); + } + + /// + /// Draws text at a specified screen position with line offset. + /// + /// X coordinate in screen space. + /// Y coordinate in screen space. + /// Line offset value. + /// The text string to display. + /// Red color value. + /// Green color value. + /// Blue color value. + /// Alpha transparency value. + /// Duration (in seconds) to display the text. + internal static delegate* DebugDrawScreenTextLine = &___DebugDrawScreenTextLine; + internal static delegate* unmanaged[Cdecl] __DebugDrawScreenTextLine; + private static void ___DebugDrawScreenTextLine(float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration) + { + var __text = NativeMethods.ConstructString(text); + try { + __DebugDrawScreenTextLine(x, y, lineOffset, &__text, r, g, b, a, duration); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__text); + } + } + + /// + /// Draws a debug sphere. + /// + /// Center of the sphere. + /// RGB color vector. + /// Alpha transparency. + /// Radius of the sphere. + /// Whether to perform depth testing. + /// Duration (in seconds) to display the sphere. + internal static delegate* DebugDrawSphere = &___DebugDrawSphere; + internal static delegate* unmanaged[Cdecl] __DebugDrawSphere; + private static void ___DebugDrawSphere(Vector3 center, Vector3 color, float alpha, float radius, Bool8 zTest, float duration) + { + __DebugDrawSphere(¢er, &color, alpha, radius, zTest, duration); + } + + /// + /// Draws text in 3D space. + /// + /// World-space position to draw the text at. + /// The text string to display. + /// If true, only draws when visible to camera. + /// Duration (in seconds) to display the text. + internal static delegate* DebugDrawText = &___DebugDrawText; + internal static delegate* unmanaged[Cdecl] __DebugDrawText; + private static void ___DebugDrawText(Vector3 origin, string text, Bool8 viewCheck, float duration) + { + var __text = NativeMethods.ConstructString(text); + try { + __DebugDrawText(&origin, &__text, viewCheck, duration); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__text); + } + } + + /// + /// Draws styled debug text on screen. + /// + /// X coordinate. + /// Y coordinate. + /// Line offset value. + /// Text string. + /// Red color value. + /// Green color value. + /// Blue color value. + /// Alpha transparency. + /// Duration (in seconds) to display the text. + /// Font name. + /// Font size. + /// Whether text should be bold. + internal static delegate* DebugScreenTextPretty = &___DebugScreenTextPretty; + internal static delegate* unmanaged[Cdecl] __DebugScreenTextPretty; + private static void ___DebugScreenTextPretty(float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration, string font, int size, Bool8 bold) + { + var __text = NativeMethods.ConstructString(text); + var __font = NativeMethods.ConstructString(font); + try { + __DebugScreenTextPretty(x, y, lineOffset, &__text, r, g, b, a, duration, &__font, size, bold); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__text); + NativeMethods.DestroyString(&__font); + } + } + + /// + /// Performs an assertion and logs a message if the assertion fails. + /// + /// Boolean value to test. + /// Message to display if the assertion fails. + internal static delegate* DebugScriptAssert = &___DebugScriptAssert; + internal static delegate* unmanaged[Cdecl] __DebugScriptAssert; + private static void ___DebugScriptAssert(Bool8 assertion, string message) + { + var __message = NativeMethods.ConstructString(message); + try { + __DebugScriptAssert(assertion, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/delegates.cs b/PlugifyProfiler/imported/s2sdk/delegates.cs new file mode 100644 index 0000000..51abe46 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/delegates.cs @@ -0,0 +1,179 @@ +using System; +using System.Numerics; + +using Plugify; + +// Generated from s2sdk.pplugin + +namespace s2sdk { +#pragma warning disable CS0649 + + /// + /// Handles the execution of a command triggered by a caller. This function processes the command, interprets its context, and handles any provided arguments. + /// + public delegate ResultType CommandCallback(int caller, CommandCallingContext context, string[] arguments); + + /// + /// Handles changes to a console variable's value. This function is called whenever the value of a specific console variable is modified. + /// + public delegate void ChangeCallback(ulong conVarHandle, string newValue, string oldValue); + + /// + /// Handles changes to a console variable's value. This function is called whenever the value of a specific console variable is modified. + /// + public delegate void CvarValueCallback(int playerSlot, int cookie, CvarValueStatus code, string name, string value, object[] data); + + /// + /// Defines a QueueTask Callback. + /// + public delegate void TaskCallback(object[] userData); + + /// + /// This function is a callback handler for entity output events. It is triggered when a specific output event is activated, and it handles the process by passing the activator, the caller, and a delay parameter for the output. + /// + public delegate ResultType HookEntityOutputCallback(int activatorHandle, int callerHandle, float flDelay); + + /// + /// Handles events triggered by the game event system. This function processes the event data, determines the necessary action, and optionally prevents event broadcasting. + /// + public delegate ResultType EventCallback(string name, nint event_, Bool8 dontBroadcast); + + /// + /// Handles the final result of a Yes/No vote. This function is called when a vote concludes, and is responsible for determining whether the vote passed based on the number of 'yes' and 'no' votes. Also receives context about the clients who participated in the vote. + /// + public delegate Bool8 YesNoVoteResult(int numVotes, int yesVotes, int noVotes, int numClients, int[] clientInfoSlot, int[] clientInfoItem); + + public delegate void YesNoVoteHandler(VoteAction action, int clientSlot, int choice); + + /// + /// This function is invoked when a timer event occurs. It handles the timer-related logic and performs necessary actions based on the event. + /// + public delegate void TimerCallback(uint timer, object[] userData); + + /// + /// Called on client connection. If you return true, the client will be allowed in the server. If you return false (or return nothing), the client will be rejected. If the client is rejected by this forward or any other, OnClientDisconnect will not be called.
Note: Do not write to rejectmsg if you plan on returning true. If multiple plugins write to the string buffer, it is not defined which plugin's string will be shown to the client, but it is guaranteed one of them will. + ///
+ public delegate Bool8 OnClientConnectCallback(int playerSlot, string name, string networkId); + + /// + /// Called on client connection. + /// + public delegate void OnClientConnect_PostCallback(int playerSlot); + + /// + /// Called once a client successfully connects. This callback is paired with OnClientDisconnect. + /// + public delegate void OnClientConnectedCallback(int playerSlot); + + /// + /// Called when a client is entering the game. + /// + public delegate void OnClientPutInServerCallback(int playerSlot); + + /// + /// Called when a client is disconnecting from the server. + /// + public delegate void OnClientDisconnectCallback(int playerSlot); + + /// + /// Called when a client is disconnected from the server. + /// + public delegate void OnClientDisconnect_PostCallback(int playerSlot, int reason); + + /// + /// Called when a client is activated by the game. + /// + public delegate void OnClientActiveCallback(int playerSlot, Bool8 isActive); + + /// + /// Called when a client is fully connected to the game. + /// + public delegate void OnClientFullyConnectCallback(int playerSlot); + + /// + /// Called whenever the client's settings are changed. + /// + public delegate void OnClientSettingsChangedCallback(int playerSlot); + + /// + /// Called when a client is fully connected to the game. + /// + public delegate void OnClientAuthenticatedCallback(int playerSlot, ulong steamID); + + /// + /// Called right before a round terminates. + /// + public delegate void OnRoundTerminatedCallback(float delay, CSRoundEndReason reason); + + /// + /// Called when an entity is created. + /// + public delegate void OnEntityCreatedCallback(int entityHandle); + + /// + /// Called when when an entity is destroyed. + /// + public delegate void OnEntityDeletedCallback(int entityHandle); + + /// + /// When an entity is reparented to another entity. + /// + public delegate void OnEntityParentChangedCallback(int entityHandle, int parentHandle); + + /// + /// When entities is transmitted to another entities. + /// + public delegate void OnServerCheckTransmitCallback(nint[] checkTransmitInfoList); + + /// + /// Called on every server startup. + /// + public delegate void OnServerStartupCallback(); + + /// + /// Called on every server activate. + /// + public delegate void OnServerActivateCallback(); + + /// + /// Called on every server spawn. + /// + public delegate void OnServerSpawnCallback(); + + /// + /// Called on every server started only once. + /// + public delegate void OnServerStartedCallback(); + + /// + /// Called on every map start. + /// + public delegate void OnMapStartCallback(); + + /// + /// Called on every map end. + /// + public delegate void OnMapEndCallback(); + + /// + /// Called before every server frame. Note that you should avoid doing expensive computations or declaring large local arrays. + /// + public delegate void OnGameFrameCallback(Bool8 simulating, Bool8 firstTick, Bool8 lastTick); + + /// + /// Called when the server is not in game. + /// + public delegate void OnUpdateWhenNotInGameCallback(float deltaTime); + + /// + /// Called before every server frame, before entities are updated. + /// + public delegate void OnPreWorldUpdateCallback(Bool8 simulating); + + /// + /// Callback function for user messages. + /// + public delegate ResultType UserMessageCallback(nint userMessage); + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/engine.cs b/PlugifyProfiler/imported/s2sdk/engine.cs new file mode 100644 index 0000000..ecd64ca --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/engine.cs @@ -0,0 +1,396 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: engine) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Finds a module by name. + /// + /// The name of the module to find. + /// A pointer to the specified module. + internal static delegate* FindModule = &___FindModule; + internal static delegate* unmanaged[Cdecl] __FindModule; + private static nint ___FindModule(string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindModule(&__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds an interface by name. + /// + /// The name of the interface to find. + /// A pointer to the interface. + internal static delegate* FindInterface = &___FindInterface; + internal static delegate* unmanaged[Cdecl] __FindInterface; + private static nint ___FindInterface(string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindInterface(&__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Queries an interface from a specified module. + /// + /// The name of the module to query the interface from. + /// The name of the interface to find. + /// A pointer to the queried interface. + internal static delegate* QueryInterface = &___QueryInterface; + internal static delegate* unmanaged[Cdecl] __QueryInterface; + private static nint ___QueryInterface(string module, string name) + { + nint __retVal; + var __module = NativeMethods.ConstructString(module); + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __QueryInterface(&__module, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__module); + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Returns the path of the game's directory. + /// + /// A reference to a string where the game directory path will be stored. + internal static delegate* GetGameDirectory = &___GetGameDirectory; + internal static delegate* unmanaged[Cdecl] __GetGameDirectory; + private static string ___GetGameDirectory() + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetGameDirectory(); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Returns the current map name. + /// + /// A reference to a string where the current map name will be stored. + internal static delegate* GetCurrentMap = &___GetCurrentMap; + internal static delegate* unmanaged[Cdecl] __GetCurrentMap; + private static string ___GetCurrentMap() + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetCurrentMap(); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Returns whether a specified map is valid or not. + /// + /// The name of the map to check for validity. + /// True if the map is valid, false otherwise. + internal static delegate* IsMapValid = &___IsMapValid; + internal static delegate* unmanaged[Cdecl] __IsMapValid; + private static Bool8 ___IsMapValid(string mapname) + { + Bool8 __retVal; + var __mapname = NativeMethods.ConstructString(mapname); + try { + __retVal = __IsMapValid(&__mapname); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__mapname); + } + return __retVal; + } + + /// + /// Returns the game time based on the game tick. + /// + /// The current game time. + internal static delegate* GetGameTime = &___GetGameTime; + internal static delegate* unmanaged[Cdecl] __GetGameTime; + private static float ___GetGameTime() + { + float __retVal = __GetGameTime(); + return __retVal; + } + + /// + /// Returns the game's internal tick count. + /// + /// The current tick count of the game. + internal static delegate* GetGameTickCount = &___GetGameTickCount; + internal static delegate* unmanaged[Cdecl] __GetGameTickCount; + private static int ___GetGameTickCount() + { + int __retVal = __GetGameTickCount(); + return __retVal; + } + + /// + /// Returns the time the game took processing the last frame. + /// + /// The frame time of the last processed frame. + internal static delegate* GetGameFrameTime = &___GetGameFrameTime; + internal static delegate* unmanaged[Cdecl] __GetGameFrameTime; + private static float ___GetGameFrameTime() + { + float __retVal = __GetGameFrameTime(); + return __retVal; + } + + /// + /// Returns a high-precision time value for profiling the engine. + /// + /// A high-precision time value. + internal static delegate* GetEngineTime = &___GetEngineTime; + internal static delegate* unmanaged[Cdecl] __GetEngineTime; + private static double ___GetEngineTime() + { + double __retVal = __GetEngineTime(); + return __retVal; + } + + /// + /// Returns the maximum number of clients that can connect to the server. + /// + /// The maximum client count, or -1 if global variables are not initialized. + internal static delegate* GetMaxClients = &___GetMaxClients; + internal static delegate* unmanaged[Cdecl] __GetMaxClients; + private static int ___GetMaxClients() + { + int __retVal = __GetMaxClients(); + return __retVal; + } + + /// + /// Precaches a given file. + /// + /// The name of the resource to be precached. + internal static delegate* Precache = &___Precache; + internal static delegate* unmanaged[Cdecl] __Precache; + private static void ___Precache(string resource) + { + var __resource = NativeMethods.ConstructString(resource); + try { + __Precache(&__resource); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__resource); + } + } + + /// + /// Checks if a specified file is precached. + /// + /// The name of the file to check. + internal static delegate* IsPrecached = &___IsPrecached; + internal static delegate* unmanaged[Cdecl] __IsPrecached; + private static Bool8 ___IsPrecached(string resource) + { + Bool8 __retVal; + var __resource = NativeMethods.ConstructString(resource); + try { + __retVal = __IsPrecached(&__resource); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__resource); + } + return __retVal; + } + + /// + /// Returns a pointer to the Economy Item System. + /// + /// A pointer to the Econ Item System. + internal static delegate* GetEconItemSystem = &___GetEconItemSystem; + internal static delegate* unmanaged[Cdecl] __GetEconItemSystem; + private static nint ___GetEconItemSystem() + { + nint __retVal = __GetEconItemSystem(); + return __retVal; + } + + /// + /// Checks if the server is currently paused. + /// + /// True if the server is paused, false otherwise. + internal static delegate* IsServerPaused = &___IsServerPaused; + internal static delegate* unmanaged[Cdecl] __IsServerPaused; + private static Bool8 ___IsServerPaused() + { + Bool8 __retVal = __IsServerPaused(); + return __retVal; + } + + /// + /// Queues a task to be executed on the next frame. + /// + /// A callback function to be executed on the next frame. + /// An array intended to hold user-related data, allowing for elements of any type. + internal static delegate* QueueTaskForNextFrame = &___QueueTaskForNextFrame; + internal static delegate* unmanaged[Cdecl] __QueueTaskForNextFrame; + private static void ___QueueTaskForNextFrame(TaskCallback callback, object[] userData) + { + var __userData = NativeMethods.ConstructVectorVariant(userData, userData.Length); + try { + __QueueTaskForNextFrame(Marshalling.GetFunctionPointerForDelegate(callback), &__userData); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorVariant(&__userData); + } + } + + /// + /// Queues a task to be executed on the next world update. + /// + /// A callback function to be executed on the next world update. + /// An array intended to hold user-related data, allowing for elements of any type. + internal static delegate* QueueTaskForNextWorldUpdate = &___QueueTaskForNextWorldUpdate; + internal static delegate* unmanaged[Cdecl] __QueueTaskForNextWorldUpdate; + private static void ___QueueTaskForNextWorldUpdate(TaskCallback callback, object[] userData) + { + var __userData = NativeMethods.ConstructVectorVariant(userData, userData.Length); + try { + __QueueTaskForNextWorldUpdate(Marshalling.GetFunctionPointerForDelegate(callback), &__userData); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorVariant(&__userData); + } + } + + /// + /// Returns the duration of a specified sound. + /// + /// The name of the sound to check. + /// The duration of the sound in seconds. + internal static delegate* GetSoundDuration = &___GetSoundDuration; + internal static delegate* unmanaged[Cdecl] __GetSoundDuration; + private static float ___GetSoundDuration(string name) + { + float __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetSoundDuration(&__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Emits a sound from a specified entity. + /// + /// The handle of the entity that will emit the sound. + /// The name of the sound to emit. + /// The pitch of the sound. + /// The volume of the sound. + /// The delay before the sound is played. + internal static delegate* EmitSound = &___EmitSound; + internal static delegate* unmanaged[Cdecl] __EmitSound; + private static void ___EmitSound(int entityHandle, string sound, int pitch, float volume, float delay) + { + var __sound = NativeMethods.ConstructString(sound); + try { + __EmitSound(entityHandle, &__sound, pitch, volume, delay); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__sound); + } + } + + /// + /// Stops a sound from a specified entity. + /// + /// The handle of the entity that will stop the sound. + /// The name of the sound to stop. + internal static delegate* StopSound = &___StopSound; + internal static delegate* unmanaged[Cdecl] __StopSound; + private static void ___StopSound(int entityHandle, string sound) + { + var __sound = NativeMethods.ConstructString(sound); + try { + __StopSound(entityHandle, &__sound); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__sound); + } + } + + /// + /// Emits a sound to a specific client. + /// + /// The index of the client to whom the sound will be emitted. + /// The channel through which the sound will be played. + /// The name of the sound to emit. + /// The volume of the sound. + /// The level of the sound. + /// Additional flags for sound playback. + /// The pitch of the sound. + /// The origin of the sound in 3D space. + /// The time at which the sound should be played. + internal static delegate* EmitSoundToClient = &___EmitSoundToClient; + internal static delegate* unmanaged[Cdecl] __EmitSoundToClient; + private static void ___EmitSoundToClient(int playerSlot, int channel, string sound, float volume, int soundLevel, int flags, int pitch, Vector3 origin, float soundTime) + { + var __sound = NativeMethods.ConstructString(sound); + try { + __EmitSoundToClient(playerSlot, channel, &__sound, volume, soundLevel, flags, pitch, &origin, soundTime); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__sound); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/entities.cs b/PlugifyProfiler/imported/s2sdk/entities.cs new file mode 100644 index 0000000..1ba8029 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/entities.cs @@ -0,0 +1,1769 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: entities) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Converts an entity index into an entity pointer. + /// + /// The index of the entity to convert. + /// A pointer to the entity instance, or nullptr if the entity does not exist. + internal static delegate* EntIndexToEntPointer = &___EntIndexToEntPointer; + internal static delegate* unmanaged[Cdecl] __EntIndexToEntPointer; + private static nint ___EntIndexToEntPointer(int entityIndex) + { + nint __retVal = __EntIndexToEntPointer(entityIndex); + return __retVal; + } + + /// + /// Retrieves the entity index from an entity pointer. + /// + /// A pointer to the entity whose index is to be retrieved. + /// The index of the entity, or -1 if the entity is nullptr. + internal static delegate* EntPointerToEntIndex = &___EntPointerToEntIndex; + internal static delegate* unmanaged[Cdecl] __EntPointerToEntIndex; + private static int ___EntPointerToEntIndex(nint entity) + { + int __retVal = __EntPointerToEntIndex(entity); + return __retVal; + } + + /// + /// Converts an entity pointer into an entity handle. + /// + /// A pointer to the entity to convert. + /// The entity handle as an integer, or INVALID_EHANDLE_INDEX if the entity is nullptr. + internal static delegate* EntPointerToEntHandle = &___EntPointerToEntHandle; + internal static delegate* unmanaged[Cdecl] __EntPointerToEntHandle; + private static int ___EntPointerToEntHandle(nint entity) + { + int __retVal = __EntPointerToEntHandle(entity); + return __retVal; + } + + /// + /// Retrieves the entity pointer from an entity handle. + /// + /// The entity handle to convert. + /// A pointer to the entity instance, or nullptr if the handle is invalid. + internal static delegate* EntHandleToEntPointer = &___EntHandleToEntPointer; + internal static delegate* unmanaged[Cdecl] __EntHandleToEntPointer; + private static nint ___EntHandleToEntPointer(int entityHandle) + { + nint __retVal = __EntHandleToEntPointer(entityHandle); + return __retVal; + } + + /// + /// Converts an entity index into an entity handle. + /// + /// The index of the entity to convert. + /// The entity handle as an integer, or -1 if the entity index is invalid. + internal static delegate* EntIndexToEntHandle = &___EntIndexToEntHandle; + internal static delegate* unmanaged[Cdecl] __EntIndexToEntHandle; + private static int ___EntIndexToEntHandle(int entityIndex) + { + int __retVal = __EntIndexToEntHandle(entityIndex); + return __retVal; + } + + /// + /// Retrieves the entity index from an entity handle. + /// + /// The entity handle from which to retrieve the index. + /// The index of the entity, or -1 if the handle is invalid. + internal static delegate* EntHandleToEntIndex = &___EntHandleToEntIndex; + internal static delegate* unmanaged[Cdecl] __EntHandleToEntIndex; + private static int ___EntHandleToEntIndex(int entityHandle) + { + int __retVal = __EntHandleToEntIndex(entityHandle); + return __retVal; + } + + /// + /// Checks if the provided entity handle is valid. + /// + /// The entity handle to check. + /// True if the entity handle is valid, false otherwise. + internal static delegate* IsValidEntHandle = &___IsValidEntHandle; + internal static delegate* unmanaged[Cdecl] __IsValidEntHandle; + private static Bool8 ___IsValidEntHandle(int entityHandle) + { + Bool8 __retVal = __IsValidEntHandle(entityHandle); + return __retVal; + } + + /// + /// Checks if the provided entity pointer is valid. + /// + /// The entity pointer to check. + /// True if the entity pointer is valid, false otherwise. + internal static delegate* IsValidEntPointer = &___IsValidEntPointer; + internal static delegate* unmanaged[Cdecl] __IsValidEntPointer; + private static Bool8 ___IsValidEntPointer(nint entity) + { + Bool8 __retVal = __IsValidEntPointer(entity); + return __retVal; + } + + /// + /// Retrieves the pointer to the first active entity. + /// + /// A handle to the first active entity. + internal static delegate* GetFirstActiveEntity = &___GetFirstActiveEntity; + internal static delegate* unmanaged[Cdecl] __GetFirstActiveEntity; + private static int ___GetFirstActiveEntity() + { + int __retVal = __GetFirstActiveEntity(); + return __retVal; + } + + /// + /// Retrieves the previous active entity. + /// + /// + /// Handle to the previous entity. + internal static delegate* GetPrevActiveEntity = &___GetPrevActiveEntity; + internal static delegate* unmanaged[Cdecl] __GetPrevActiveEntity; + private static int ___GetPrevActiveEntity(int entityHandle) + { + int __retVal = __GetPrevActiveEntity(entityHandle); + return __retVal; + } + + /// + /// Retrieves the next active entity. + /// + /// + /// Handle to the next entity. + internal static delegate* GetNextActiveEntity = &___GetNextActiveEntity; + internal static delegate* unmanaged[Cdecl] __GetNextActiveEntity; + private static int ___GetNextActiveEntity(int entityHandle) + { + int __retVal = __GetNextActiveEntity(entityHandle); + return __retVal; + } + + /// + /// Adds an entity output hook on a specified entity class name. + /// + /// The class name of the entity to hook the output for. + /// The output event name to hook. + /// The callback function to invoke when the output is fired. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// True if the hook was successfully added, false otherwise. + internal static delegate* HookEntityOutput = &___HookEntityOutput; + internal static delegate* unmanaged[Cdecl] __HookEntityOutput; + private static Bool8 ___HookEntityOutput(string classname, string output, HookEntityOutputCallback callback, HookMode type) + { + Bool8 __retVal; + var __classname = NativeMethods.ConstructString(classname); + var __output = NativeMethods.ConstructString(output); + try { + __retVal = __HookEntityOutput(&__classname, &__output, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__classname); + NativeMethods.DestroyString(&__output); + } + return __retVal; + } + + /// + /// Removes an entity output hook. + /// + /// The class name of the entity from which to unhook the output. + /// The output event name to unhook. + /// The callback function that was previously hooked. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// True if the hook was successfully removed, false otherwise. + internal static delegate* UnhookEntityOutput = &___UnhookEntityOutput; + internal static delegate* unmanaged[Cdecl] __UnhookEntityOutput; + private static Bool8 ___UnhookEntityOutput(string classname, string output, HookEntityOutputCallback callback, HookMode type) + { + Bool8 __retVal; + var __classname = NativeMethods.ConstructString(classname); + var __output = NativeMethods.ConstructString(output); + try { + __retVal = __UnhookEntityOutput(&__classname, &__output, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__classname); + NativeMethods.DestroyString(&__output); + } + return __retVal; + } + + /// + /// Finds an entity by classname with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The class name to search for. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByClassname = &___FindEntityByClassname; + internal static delegate* unmanaged[Cdecl] __FindEntityByClassname; + private static int ___FindEntityByClassname(int startFrom, string classname) + { + int __retVal; + var __classname = NativeMethods.ConstructString(classname); + try { + __retVal = __FindEntityByClassname(startFrom, &__classname); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__classname); + } + return __retVal; + } + + /// + /// Finds the nearest entity by classname to a point. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The class name to search for. + /// The center point to search around. + /// Maximum search radius. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByClassnameNearest = &___FindEntityByClassnameNearest; + internal static delegate* unmanaged[Cdecl] __FindEntityByClassnameNearest; + private static int ___FindEntityByClassnameNearest(int startFrom, string classname, Vector3 origin, float maxRadius) + { + int __retVal; + var __classname = NativeMethods.ConstructString(classname); + try { + __retVal = __FindEntityByClassnameNearest(startFrom, &__classname, &origin, maxRadius); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__classname); + } + return __retVal; + } + + /// + /// Finds an entity by classname within a radius with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The class name to search for. + /// The center of the search sphere. + /// The search radius. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByClassnameWithin = &___FindEntityByClassnameWithin; + internal static delegate* unmanaged[Cdecl] __FindEntityByClassnameWithin; + private static int ___FindEntityByClassnameWithin(int startFrom, string classname, Vector3 origin, float radius) + { + int __retVal; + var __classname = NativeMethods.ConstructString(classname); + try { + __retVal = __FindEntityByClassnameWithin(startFrom, &__classname, &origin, radius); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__classname); + } + return __retVal; + } + + /// + /// Finds an entity by name with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The targetname to search for. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByName = &___FindEntityByName; + internal static delegate* unmanaged[Cdecl] __FindEntityByName; + private static int ___FindEntityByName(int startFrom, string name) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindEntityByName(startFrom, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds the nearest entity by name to a point. + /// + /// The targetname to search for. + /// The point to search around. + /// Maximum search radius. + /// The handle of the nearest entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByNameNearest = &___FindEntityByNameNearest; + internal static delegate* unmanaged[Cdecl] __FindEntityByNameNearest; + private static int ___FindEntityByNameNearest(string name, Vector3 origin, float maxRadius) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindEntityByNameNearest(&__name, &origin, maxRadius); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds an entity by name within a radius with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The targetname to search for. + /// The center of the search sphere. + /// The search radius. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByNameWithin = &___FindEntityByNameWithin; + internal static delegate* unmanaged[Cdecl] __FindEntityByNameWithin; + private static int ___FindEntityByNameWithin(int startFrom, string name, Vector3 origin, float radius) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindEntityByNameWithin(startFrom, &__name, &origin, radius); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds an entity by targetname with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The targetname to search for. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityByTarget = &___FindEntityByTarget; + internal static delegate* unmanaged[Cdecl] __FindEntityByTarget; + private static int ___FindEntityByTarget(int startFrom, string name) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __FindEntityByTarget(startFrom, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds an entity within a sphere with iteration. + /// + /// The handle of the entity to start from, or INVALID_EHANDLE_INDEX to start fresh. + /// The center of the search sphere. + /// The search radius. + /// The handle of the found entity, or INVALID_EHANDLE_INDEX if none found. + internal static delegate* FindEntityInSphere = &___FindEntityInSphere; + internal static delegate* unmanaged[Cdecl] __FindEntityInSphere; + private static int ___FindEntityInSphere(int startFrom, Vector3 origin, float radius) + { + int __retVal = __FindEntityInSphere(startFrom, &origin, radius); + return __retVal; + } + + /// + /// Creates an entity by classname. + /// + /// The class name of the entity to create. + /// The handle of the created entity, or INVALID_EHANDLE_INDEX if creation failed. + internal static delegate* SpawnEntityByName = &___SpawnEntityByName; + internal static delegate* unmanaged[Cdecl] __SpawnEntityByName; + private static int ___SpawnEntityByName(string className) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + try { + __retVal = __SpawnEntityByName(&__className); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + } + return __retVal; + } + + /// + /// Creates an entity by string name but does not spawn it. + /// + /// The class name of the entity to create. + /// The entity handle of the created entity, or INVALID_EHANDLE_INDEX if the entity could not be created. + internal static delegate* CreateEntityByName = &___CreateEntityByName; + internal static delegate* unmanaged[Cdecl] __CreateEntityByName; + private static int ___CreateEntityByName(string className) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + try { + __retVal = __CreateEntityByName(&__className); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + } + return __retVal; + } + + /// + /// Spawns an entity into the game. + /// + /// The handle of the entity to spawn. + internal static delegate* DispatchSpawn = &___DispatchSpawn; + internal static delegate* unmanaged[Cdecl] __DispatchSpawn; + private static void ___DispatchSpawn(int entityHandle) + { + __DispatchSpawn(entityHandle); + } + + /// + /// Spawns an entity into the game with key-value properties. + /// + /// The handle of the entity to spawn. + /// A vector of keys representing the property names to set on the entity. + /// A vector of values corresponding to the keys, representing the property values to set on the entity. + internal static delegate* DispatchSpawn2 = &___DispatchSpawn2; + internal static delegate* unmanaged[Cdecl] __DispatchSpawn2; + private static void ___DispatchSpawn2(int entityHandle, string[] keys, object[] values) + { + var __keys = NativeMethods.ConstructVectorString(keys, keys.Length); + var __values = NativeMethods.ConstructVectorVariant(values, values.Length); + try { + __DispatchSpawn2(entityHandle, &__keys, &__values); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorString(&__keys); + NativeMethods.DestroyVectorVariant(&__values); + } + } + + /// + /// Marks an entity for deletion. + /// + /// The handle of the entity to be deleted. + internal static delegate* RemoveEntity = &___RemoveEntity; + internal static delegate* unmanaged[Cdecl] __RemoveEntity; + private static void ___RemoveEntity(int entityHandle) + { + __RemoveEntity(entityHandle); + } + + /// + /// Checks if an entity is a player controller. + /// + /// The handle of the entity. + /// True if the entity is a player controller, false otherwise. + internal static delegate* IsEntityPlayerController = &___IsEntityPlayerController; + internal static delegate* unmanaged[Cdecl] __IsEntityPlayerController; + private static Bool8 ___IsEntityPlayerController(int entityHandle) + { + Bool8 __retVal = __IsEntityPlayerController(entityHandle); + return __retVal; + } + + /// + /// Checks if an entity is a player pawn. + /// + /// The handle of the entity. + /// True if the entity is a player pawn, false otherwise. + internal static delegate* IsEntityPlayerPawn = &___IsEntityPlayerPawn; + internal static delegate* unmanaged[Cdecl] __IsEntityPlayerPawn; + private static Bool8 ___IsEntityPlayerPawn(int entityHandle) + { + Bool8 __retVal = __IsEntityPlayerPawn(entityHandle); + return __retVal; + } + + /// + /// Retrieves the class name of an entity. + /// + /// The handle of the entity whose class name is to be retrieved. + /// A string where the class name will be stored. + internal static delegate* GetEntityClassname = &___GetEntityClassname; + internal static delegate* unmanaged[Cdecl] __GetEntityClassname; + private static string ___GetEntityClassname(int entityHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEntityClassname(entityHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Retrieves the name of an entity. + /// + /// The handle of the entity whose name is to be retrieved. + internal static delegate* GetEntityName = &___GetEntityName; + internal static delegate* unmanaged[Cdecl] __GetEntityName; + private static string ___GetEntityName(int entityHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEntityName(entityHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the name of an entity. + /// + /// The handle of the entity whose name is to be set. + /// The new name to set for the entity. + internal static delegate* SetEntityName = &___SetEntityName; + internal static delegate* unmanaged[Cdecl] __SetEntityName; + private static void ___SetEntityName(int entityHandle, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __SetEntityName(entityHandle, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Retrieves the movement type of an entity. + /// + /// The handle of the entity whose movement type is to be retrieved. + /// The movement type of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityMoveType = &___GetEntityMoveType; + internal static delegate* unmanaged[Cdecl] __GetEntityMoveType; + private static MoveType ___GetEntityMoveType(int entityHandle) + { + MoveType __retVal = __GetEntityMoveType(entityHandle); + return __retVal; + } + + /// + /// Sets the movement type of an entity. + /// + /// The handle of the entity whose movement type is to be set. + /// The new movement type to set for the entity. + internal static delegate* SetEntityMoveType = &___SetEntityMoveType; + internal static delegate* unmanaged[Cdecl] __SetEntityMoveType; + private static void ___SetEntityMoveType(int entityHandle, MoveType moveType) + { + __SetEntityMoveType(entityHandle, moveType); + } + + /// + /// Retrieves the gravity scale of an entity. + /// + /// The handle of the entity whose gravity scale is to be retrieved. + /// The gravity scale of the entity, or 0.0f if the entity is invalid. + internal static delegate* GetEntityGravity = &___GetEntityGravity; + internal static delegate* unmanaged[Cdecl] __GetEntityGravity; + private static float ___GetEntityGravity(int entityHandle) + { + float __retVal = __GetEntityGravity(entityHandle); + return __retVal; + } + + /// + /// Sets the gravity scale of an entity. + /// + /// The handle of the entity whose gravity scale is to be set. + /// The new gravity scale to set for the entity. + internal static delegate* SetEntityGravity = &___SetEntityGravity; + internal static delegate* unmanaged[Cdecl] __SetEntityGravity; + private static void ___SetEntityGravity(int entityHandle, float gravity) + { + __SetEntityGravity(entityHandle, gravity); + } + + /// + /// Retrieves the flags of an entity. + /// + /// The handle of the entity whose flags are to be retrieved. + /// The flags of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityFlags = &___GetEntityFlags; + internal static delegate* unmanaged[Cdecl] __GetEntityFlags; + private static int ___GetEntityFlags(int entityHandle) + { + int __retVal = __GetEntityFlags(entityHandle); + return __retVal; + } + + /// + /// Sets the flags of an entity. + /// + /// The handle of the entity whose flags are to be set. + /// The new flags to set for the entity. + internal static delegate* SetEntityFlags = &___SetEntityFlags; + internal static delegate* unmanaged[Cdecl] __SetEntityFlags; + private static void ___SetEntityFlags(int entityHandle, int flags) + { + __SetEntityFlags(entityHandle, flags); + } + + /// + /// Retrieves the render color of an entity. + /// + /// The handle of the entity whose render color is to be retrieved. + /// The raw color value of the entity's render color, or 0 if the entity is invalid. + internal static delegate* GetEntityRenderColor = &___GetEntityRenderColor; + internal static delegate* unmanaged[Cdecl] __GetEntityRenderColor; + private static int ___GetEntityRenderColor(int entityHandle) + { + int __retVal = __GetEntityRenderColor(entityHandle); + return __retVal; + } + + /// + /// Sets the render color of an entity. + /// + /// The handle of the entity whose render color is to be set. + /// The new raw color value to set for the entity's render color. + internal static delegate* SetEntityRenderColor = &___SetEntityRenderColor; + internal static delegate* unmanaged[Cdecl] __SetEntityRenderColor; + private static void ___SetEntityRenderColor(int entityHandle, int color) + { + __SetEntityRenderColor(entityHandle, color); + } + + /// + /// Retrieves the render mode of an entity. + /// + /// The handle of the entity whose render mode is to be retrieved. + /// The render mode of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityRenderMode = &___GetEntityRenderMode; + internal static delegate* unmanaged[Cdecl] __GetEntityRenderMode; + private static RenderMode ___GetEntityRenderMode(int entityHandle) + { + RenderMode __retVal = __GetEntityRenderMode(entityHandle); + return __retVal; + } + + /// + /// Sets the render mode of an entity. + /// + /// The handle of the entity whose render mode is to be set. + /// The new render mode to set for the entity. + internal static delegate* SetEntityRenderMode = &___SetEntityRenderMode; + internal static delegate* unmanaged[Cdecl] __SetEntityRenderMode; + private static void ___SetEntityRenderMode(int entityHandle, RenderMode renderMode) + { + __SetEntityRenderMode(entityHandle, renderMode); + } + + /// + /// Retrieves the mass of an entity. + /// + /// The handle of the entity whose mass is to be retrieved. + /// The mass of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityMass = &___GetEntityMass; + internal static delegate* unmanaged[Cdecl] __GetEntityMass; + private static int ___GetEntityMass(int entityHandle) + { + int __retVal = __GetEntityMass(entityHandle); + return __retVal; + } + + /// + /// Sets the mass of an entity. + /// + /// The handle of the entity whose mass is to be set. + /// The new mass value to set for the entity. + internal static delegate* SetEntityMass = &___SetEntityMass; + internal static delegate* unmanaged[Cdecl] __SetEntityMass; + private static void ___SetEntityMass(int entityHandle, int mass) + { + __SetEntityMass(entityHandle, mass); + } + + /// + /// Retrieves the friction of an entity. + /// + /// The handle of the entity whose friction is to be retrieved. + /// The friction of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityFriction = &___GetEntityFriction; + internal static delegate* unmanaged[Cdecl] __GetEntityFriction; + private static float ___GetEntityFriction(int entityHandle) + { + float __retVal = __GetEntityFriction(entityHandle); + return __retVal; + } + + /// + /// Sets the friction of an entity. + /// + /// The handle of the entity whose friction is to be set. + /// The new friction value to set for the entity. + internal static delegate* SetEntityFriction = &___SetEntityFriction; + internal static delegate* unmanaged[Cdecl] __SetEntityFriction; + private static void ___SetEntityFriction(int entityHandle, float friction) + { + __SetEntityFriction(entityHandle, friction); + } + + /// + /// Retrieves the health of an entity. + /// + /// The handle of the entity whose health is to be retrieved. + /// The health of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityHealth = &___GetEntityHealth; + internal static delegate* unmanaged[Cdecl] __GetEntityHealth; + private static int ___GetEntityHealth(int entityHandle) + { + int __retVal = __GetEntityHealth(entityHandle); + return __retVal; + } + + /// + /// Sets the health of an entity. + /// + /// The handle of the entity whose health is to be set. + /// The new health value to set for the entity. + internal static delegate* SetEntityHealth = &___SetEntityHealth; + internal static delegate* unmanaged[Cdecl] __SetEntityHealth; + private static void ___SetEntityHealth(int entityHandle, int health) + { + __SetEntityHealth(entityHandle, health); + } + + /// + /// Retrieves the max health of an entity. + /// + /// The handle of the entity whose max health is to be retrieved. + /// The max health of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityMaxHealth = &___GetEntityMaxHealth; + internal static delegate* unmanaged[Cdecl] __GetEntityMaxHealth; + private static int ___GetEntityMaxHealth(int entityHandle) + { + int __retVal = __GetEntityMaxHealth(entityHandle); + return __retVal; + } + + /// + /// Sets the max health of an entity. + /// + /// The handle of the entity whose max health is to be set. + /// The new max health value to set for the entity. + internal static delegate* SetEntityMaxHealth = &___SetEntityMaxHealth; + internal static delegate* unmanaged[Cdecl] __SetEntityMaxHealth; + private static void ___SetEntityMaxHealth(int entityHandle, int maxHealth) + { + __SetEntityMaxHealth(entityHandle, maxHealth); + } + + /// + /// Retrieves the team number of an entity. + /// + /// The handle of the entity whose team number is to be retrieved. + /// The team number of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityTeam = &___GetEntityTeam; + internal static delegate* unmanaged[Cdecl] __GetEntityTeam; + private static CSTeam ___GetEntityTeam(int entityHandle) + { + CSTeam __retVal = __GetEntityTeam(entityHandle); + return __retVal; + } + + /// + /// Sets the team number of an entity. + /// + /// The handle of the entity whose team number is to be set. + /// The new team number to set for the entity. + internal static delegate* SetEntityTeam = &___SetEntityTeam; + internal static delegate* unmanaged[Cdecl] __SetEntityTeam; + private static void ___SetEntityTeam(int entityHandle, CSTeam team) + { + __SetEntityTeam(entityHandle, team); + } + + /// + /// Retrieves the owner of an entity. + /// + /// The handle of the entity whose owner is to be retrieved. + /// The handle of the owner entity, or INVALID_EHANDLE_INDEX if the entity is invalid. + internal static delegate* GetEntityOwner = &___GetEntityOwner; + internal static delegate* unmanaged[Cdecl] __GetEntityOwner; + private static int ___GetEntityOwner(int entityHandle) + { + int __retVal = __GetEntityOwner(entityHandle); + return __retVal; + } + + /// + /// Sets the owner of an entity. + /// + /// The handle of the entity whose owner is to be set. + /// The handle of the new owner entity. + internal static delegate* SetEntityOwner = &___SetEntityOwner; + internal static delegate* unmanaged[Cdecl] __SetEntityOwner; + private static void ___SetEntityOwner(int entityHandle, int ownerHandle) + { + __SetEntityOwner(entityHandle, ownerHandle); + } + + /// + /// Retrieves the parent of an entity. + /// + /// The handle of the entity whose parent is to be retrieved. + /// The handle of the parent entity, or INVALID_EHANDLE_INDEX if the entity is invalid. + internal static delegate* GetEntityParent = &___GetEntityParent; + internal static delegate* unmanaged[Cdecl] __GetEntityParent; + private static int ___GetEntityParent(int entityHandle) + { + int __retVal = __GetEntityParent(entityHandle); + return __retVal; + } + + /// + /// Sets the parent of an entity. + /// + /// The handle of the entity whose parent is to be set. + /// The handle of the new parent entity. + /// The name of the entity's attachment. + internal static delegate* SetEntityParent = &___SetEntityParent; + internal static delegate* unmanaged[Cdecl] __SetEntityParent; + private static void ___SetEntityParent(int entityHandle, int parentHandle, string attachmentName) + { + var __attachmentName = NativeMethods.ConstructString(attachmentName); + try { + __SetEntityParent(entityHandle, parentHandle, &__attachmentName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__attachmentName); + } + } + + /// + /// Retrieves the absolute origin of an entity. + /// + /// The handle of the entity whose absolute origin is to be retrieved. + /// A vector where the absolute origin will be stored. + internal static delegate* GetEntityAbsOrigin = &___GetEntityAbsOrigin; + internal static delegate* unmanaged[Cdecl] __GetEntityAbsOrigin; + private static Vector3 ___GetEntityAbsOrigin(int entityHandle) + { + Vector3 __retVal = __GetEntityAbsOrigin(entityHandle); + return __retVal; + } + + /// + /// Sets the absolute origin of an entity. + /// + /// The handle of the entity whose absolute origin is to be set. + /// The new absolute origin to set for the entity. + internal static delegate* SetEntityAbsOrigin = &___SetEntityAbsOrigin; + internal static delegate* unmanaged[Cdecl] __SetEntityAbsOrigin; + private static void ___SetEntityAbsOrigin(int entityHandle, Vector3 origin) + { + __SetEntityAbsOrigin(entityHandle, &origin); + } + + /// + /// Retrieves the absolute scale of an entity. + /// + /// The handle of the entity whose absolute scale is to be retrieved. + /// A vector where the absolute scale will be stored. + internal static delegate* GetEntityAbsScale = &___GetEntityAbsScale; + internal static delegate* unmanaged[Cdecl] __GetEntityAbsScale; + private static float ___GetEntityAbsScale(int entityHandle) + { + float __retVal = __GetEntityAbsScale(entityHandle); + return __retVal; + } + + /// + /// Sets the absolute scale of an entity. + /// + /// The handle of the entity whose absolute scale is to be set. + /// The new absolute scale to set for the entity. + internal static delegate* SetEntityAbsScale = &___SetEntityAbsScale; + internal static delegate* unmanaged[Cdecl] __SetEntityAbsScale; + private static void ___SetEntityAbsScale(int entityHandle, float scale) + { + __SetEntityAbsScale(entityHandle, scale); + } + + /// + /// Retrieves the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be retrieved. + /// A QAngle where the angular rotation will be stored. + internal static delegate* GetEntityAbsAngles = &___GetEntityAbsAngles; + internal static delegate* unmanaged[Cdecl] __GetEntityAbsAngles; + private static Vector3 ___GetEntityAbsAngles(int entityHandle) + { + Vector3 __retVal = __GetEntityAbsAngles(entityHandle); + return __retVal; + } + + /// + /// Sets the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be set. + /// The new angular rotation to set for the entity. + internal static delegate* SetEntityAbsAngles = &___SetEntityAbsAngles; + internal static delegate* unmanaged[Cdecl] __SetEntityAbsAngles; + private static void ___SetEntityAbsAngles(int entityHandle, Vector3 angle) + { + __SetEntityAbsAngles(entityHandle, &angle); + } + + /// + /// Retrieves the local origin of an entity. + /// + /// The handle of the entity whose local origin is to be retrieved. + /// A vector where the local origin will be stored. + internal static delegate* GetEntityLocalOrigin = &___GetEntityLocalOrigin; + internal static delegate* unmanaged[Cdecl] __GetEntityLocalOrigin; + private static Vector3 ___GetEntityLocalOrigin(int entityHandle) + { + Vector3 __retVal = __GetEntityLocalOrigin(entityHandle); + return __retVal; + } + + /// + /// Sets the local origin of an entity. + /// + /// The handle of the entity whose local origin is to be set. + /// The new local origin to set for the entity. + internal static delegate* SetEntityLocalOrigin = &___SetEntityLocalOrigin; + internal static delegate* unmanaged[Cdecl] __SetEntityLocalOrigin; + private static void ___SetEntityLocalOrigin(int entityHandle, Vector3 origin) + { + __SetEntityLocalOrigin(entityHandle, &origin); + } + + /// + /// Retrieves the local scale of an entity. + /// + /// The handle of the entity whose local scale is to be retrieved. + /// A vector where the local scale will be stored. + internal static delegate* GetEntityLocalScale = &___GetEntityLocalScale; + internal static delegate* unmanaged[Cdecl] __GetEntityLocalScale; + private static float ___GetEntityLocalScale(int entityHandle) + { + float __retVal = __GetEntityLocalScale(entityHandle); + return __retVal; + } + + /// + /// Sets the local scale of an entity. + /// + /// The handle of the entity whose local scale is to be set. + /// The new local scale to set for the entity. + internal static delegate* SetEntityLocalScale = &___SetEntityLocalScale; + internal static delegate* unmanaged[Cdecl] __SetEntityLocalScale; + private static void ___SetEntityLocalScale(int entityHandle, float scale) + { + __SetEntityLocalScale(entityHandle, scale); + } + + /// + /// Retrieves the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be retrieved. + /// A QAngle where the angular rotation will be stored. + internal static delegate* GetEntityLocalAngles = &___GetEntityLocalAngles; + internal static delegate* unmanaged[Cdecl] __GetEntityLocalAngles; + private static Vector3 ___GetEntityLocalAngles(int entityHandle) + { + Vector3 __retVal = __GetEntityLocalAngles(entityHandle); + return __retVal; + } + + /// + /// Sets the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be set. + /// The new angular rotation to set for the entity. + internal static delegate* SetEntityLocalAngles = &___SetEntityLocalAngles; + internal static delegate* unmanaged[Cdecl] __SetEntityLocalAngles; + private static void ___SetEntityLocalAngles(int entityHandle, Vector3 angle) + { + __SetEntityLocalAngles(entityHandle, &angle); + } + + /// + /// Retrieves the absolute velocity of an entity. + /// + /// The handle of the entity whose absolute velocity is to be retrieved. + /// A vector where the absolute velocity will be stored. + internal static delegate* GetEntityAbsVelocity = &___GetEntityAbsVelocity; + internal static delegate* unmanaged[Cdecl] __GetEntityAbsVelocity; + private static Vector3 ___GetEntityAbsVelocity(int entityHandle) + { + Vector3 __retVal = __GetEntityAbsVelocity(entityHandle); + return __retVal; + } + + /// + /// Sets the absolute velocity of an entity. + /// + /// The handle of the entity whose absolute velocity is to be set. + /// The new absolute velocity to set for the entity. + internal static delegate* SetEntityAbsVelocity = &___SetEntityAbsVelocity; + internal static delegate* unmanaged[Cdecl] __SetEntityAbsVelocity; + private static void ___SetEntityAbsVelocity(int entityHandle, Vector3 velocity) + { + __SetEntityAbsVelocity(entityHandle, &velocity); + } + + /// + /// Retrieves the base velocity of an entity. + /// + /// The handle of the entity whose base velocity is to be retrieved. + /// A vector where the base velocity will be stored. + internal static delegate* GetEntityBaseVelocity = &___GetEntityBaseVelocity; + internal static delegate* unmanaged[Cdecl] __GetEntityBaseVelocity; + private static Vector3 ___GetEntityBaseVelocity(int entityHandle) + { + Vector3 __retVal = __GetEntityBaseVelocity(entityHandle); + return __retVal; + } + + /// + /// Retrieves the local angular velocity of an entity. + /// + /// The handle of the entity whose local angular velocity is to be retrieved. + /// A vector where the local angular velocity will be stored. + internal static delegate* GetEntityLocalAngVelocity = &___GetEntityLocalAngVelocity; + internal static delegate* unmanaged[Cdecl] __GetEntityLocalAngVelocity; + private static Vector3 ___GetEntityLocalAngVelocity(int entityHandle) + { + Vector3 __retVal = __GetEntityLocalAngVelocity(entityHandle); + return __retVal; + } + + /// + /// Retrieves the angular velocity of an entity. + /// + /// The handle of the entity whose angular velocity is to be retrieved. + /// A vector where the angular velocity will be stored. + internal static delegate* GetEntityAngVelocity = &___GetEntityAngVelocity; + internal static delegate* unmanaged[Cdecl] __GetEntityAngVelocity; + private static Vector3 ___GetEntityAngVelocity(int entityHandle) + { + Vector3 __retVal = __GetEntityAngVelocity(entityHandle); + return __retVal; + } + + /// + /// Sets the angular velocity of an entity. + /// + /// The handle of the entity whose angular velocity is to be set. + /// The new angular velocity to set for the entity. + internal static delegate* SetEntityAngVelocity = &___SetEntityAngVelocity; + internal static delegate* unmanaged[Cdecl] __SetEntityAngVelocity; + private static void ___SetEntityAngVelocity(int entityHandle, Vector3 velocity) + { + __SetEntityAngVelocity(entityHandle, &velocity); + } + + /// + /// Retrieves the local velocity of an entity. + /// + /// The handle of the entity whose local velocity is to be retrieved. + /// A vector where the local velocity will be stored. + internal static delegate* GetEntityLocalVelocity = &___GetEntityLocalVelocity; + internal static delegate* unmanaged[Cdecl] __GetEntityLocalVelocity; + private static Vector3 ___GetEntityLocalVelocity(int entityHandle) + { + Vector3 __retVal = __GetEntityLocalVelocity(entityHandle); + return __retVal; + } + + /// + /// Retrieves the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be retrieved. + /// A vector where the angular rotation will be stored. + internal static delegate* GetEntityAngRotation = &___GetEntityAngRotation; + internal static delegate* unmanaged[Cdecl] __GetEntityAngRotation; + private static Vector3 ___GetEntityAngRotation(int entityHandle) + { + Vector3 __retVal = __GetEntityAngRotation(entityHandle); + return __retVal; + } + + /// + /// Sets the angular rotation of an entity. + /// + /// The handle of the entity whose angular rotation is to be set. + /// The new angular rotation to set for the entity. + internal static delegate* SetEntityAngRotation = &___SetEntityAngRotation; + internal static delegate* unmanaged[Cdecl] __SetEntityAngRotation; + private static void ___SetEntityAngRotation(int entityHandle, Vector3 rotation) + { + __SetEntityAngRotation(entityHandle, &rotation); + } + + /// + /// Returns the input Vector transformed from entity to world space. + /// + /// The handle of the entity + /// Point in entity local space to transform + /// The point transformed to world space coordinates + internal static delegate* TransformPointEntityToWorld = &___TransformPointEntityToWorld; + internal static delegate* unmanaged[Cdecl] __TransformPointEntityToWorld; + private static Vector3 ___TransformPointEntityToWorld(int entityHandle, Vector3 point) + { + Vector3 __retVal = __TransformPointEntityToWorld(entityHandle, &point); + return __retVal; + } + + /// + /// Returns the input Vector transformed from world to entity space. + /// + /// The handle of the entity + /// Point in world space to transform + /// The point transformed to entity local space coordinates + internal static delegate* TransformPointWorldToEntity = &___TransformPointWorldToEntity; + internal static delegate* unmanaged[Cdecl] __TransformPointWorldToEntity; + private static Vector3 ___TransformPointWorldToEntity(int entityHandle, Vector3 point) + { + Vector3 __retVal = __TransformPointWorldToEntity(entityHandle, &point); + return __retVal; + } + + /// + /// Get vector to eye position - absolute coords. + /// + /// The handle of the entity + /// Eye position in absolute/world coordinates + internal static delegate* GetEntityEyePosition = &___GetEntityEyePosition; + internal static delegate* unmanaged[Cdecl] __GetEntityEyePosition; + private static Vector3 ___GetEntityEyePosition(int entityHandle) + { + Vector3 __retVal = __GetEntityEyePosition(entityHandle); + return __retVal; + } + + /// + /// Get the qangles that this entity is looking at. + /// + /// The handle of the entity + /// Eye angles as a vector (pitch, yaw, roll) + internal static delegate* GetEntityEyeAngles = &___GetEntityEyeAngles; + internal static delegate* unmanaged[Cdecl] __GetEntityEyeAngles; + private static Vector3 ___GetEntityEyeAngles(int entityHandle) + { + Vector3 __retVal = __GetEntityEyeAngles(entityHandle); + return __retVal; + } + + /// + /// Sets the forward velocity of an entity. + /// + /// The handle of the entity whose forward velocity is to be set. + /// + internal static delegate* SetEntityForwardVector = &___SetEntityForwardVector; + internal static delegate* unmanaged[Cdecl] __SetEntityForwardVector; + private static void ___SetEntityForwardVector(int entityHandle, Vector3 forward) + { + __SetEntityForwardVector(entityHandle, &forward); + } + + /// + /// Get the forward vector of the entity. + /// + /// The handle of the entity to query + /// Forward-facing direction vector of the entity + internal static delegate* GetEntityForwardVector = &___GetEntityForwardVector; + internal static delegate* unmanaged[Cdecl] __GetEntityForwardVector; + private static Vector3 ___GetEntityForwardVector(int entityHandle) + { + Vector3 __retVal = __GetEntityForwardVector(entityHandle); + return __retVal; + } + + /// + /// Get the left vector of the entity. + /// + /// The handle of the entity to query + /// Left-facing direction vector of the entity (aligned with the y axis) + internal static delegate* GetEntityLeftVector = &___GetEntityLeftVector; + internal static delegate* unmanaged[Cdecl] __GetEntityLeftVector; + private static Vector3 ___GetEntityLeftVector(int entityHandle) + { + Vector3 __retVal = __GetEntityLeftVector(entityHandle); + return __retVal; + } + + /// + /// Get the right vector of the entity. + /// + /// The handle of the entity to query + /// Right-facing direction vector of the entity + internal static delegate* GetEntityRightVector = &___GetEntityRightVector; + internal static delegate* unmanaged[Cdecl] __GetEntityRightVector; + private static Vector3 ___GetEntityRightVector(int entityHandle) + { + Vector3 __retVal = __GetEntityRightVector(entityHandle); + return __retVal; + } + + /// + /// Get the up vector of the entity. + /// + /// The handle of the entity to query + /// Up-facing direction vector of the entity + internal static delegate* GetEntityUpVector = &___GetEntityUpVector; + internal static delegate* unmanaged[Cdecl] __GetEntityUpVector; + private static Vector3 ___GetEntityUpVector(int entityHandle) + { + Vector3 __retVal = __GetEntityUpVector(entityHandle); + return __retVal; + } + + /// + /// Get the entity-to-world transformation matrix. + /// + /// The handle of the entity to query + /// 4x4 transformation matrix representing entity's position, rotation, and scale in world space + internal static delegate* GetEntityTransform = &___GetEntityTransform; + internal static delegate* unmanaged[Cdecl] __GetEntityTransform; + private static Matrix4x4 ___GetEntityTransform(int entityHandle) + { + Matrix4x4 __retVal = __GetEntityTransform(entityHandle); + return __retVal; + } + + /// + /// Retrieves the model name of an entity. + /// + /// The handle of the entity whose model name is to be retrieved. + /// A string where the model name will be stored. + internal static delegate* GetEntityModel = &___GetEntityModel; + internal static delegate* unmanaged[Cdecl] __GetEntityModel; + private static string ___GetEntityModel(int entityHandle) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEntityModel(entityHandle); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the model name of an entity. + /// + /// The handle of the entity whose model name is to be set. + /// The new model name to set for the entity. + internal static delegate* SetEntityModel = &___SetEntityModel; + internal static delegate* unmanaged[Cdecl] __SetEntityModel; + private static void ___SetEntityModel(int entityHandle, string model) + { + var __model = NativeMethods.ConstructString(model); + try { + __SetEntityModel(entityHandle, &__model); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__model); + } + } + + /// + /// Retrieves the water level of an entity. + /// + /// The handle of the entity whose water level is to be retrieved. + /// The water level of the entity, or 0.0f if the entity is invalid. + internal static delegate* GetEntityWaterLevel = &___GetEntityWaterLevel; + internal static delegate* unmanaged[Cdecl] __GetEntityWaterLevel; + private static float ___GetEntityWaterLevel(int entityHandle) + { + float __retVal = __GetEntityWaterLevel(entityHandle); + return __retVal; + } + + /// + /// Retrieves the ground entity of an entity. + /// + /// The handle of the entity whose ground entity is to be retrieved. + /// The handle of the ground entity, or INVALID_EHANDLE_INDEX if the entity is invalid. + internal static delegate* GetEntityGroundEntity = &___GetEntityGroundEntity; + internal static delegate* unmanaged[Cdecl] __GetEntityGroundEntity; + private static int ___GetEntityGroundEntity(int entityHandle) + { + int __retVal = __GetEntityGroundEntity(entityHandle); + return __retVal; + } + + /// + /// Retrieves the effects of an entity. + /// + /// The handle of the entity whose effects are to be retrieved. + /// The effect flags of the entity, or 0 if the entity is invalid. + internal static delegate* GetEntityEffects = &___GetEntityEffects; + internal static delegate* unmanaged[Cdecl] __GetEntityEffects; + private static int ___GetEntityEffects(int entityHandle) + { + int __retVal = __GetEntityEffects(entityHandle); + return __retVal; + } + + /// + /// Adds the render effect flag to an entity. + /// + /// The handle of the entity to modify + /// Render effect flags to add + internal static delegate* AddEntityEffects = &___AddEntityEffects; + internal static delegate* unmanaged[Cdecl] __AddEntityEffects; + private static void ___AddEntityEffects(int entityHandle, int effects) + { + __AddEntityEffects(entityHandle, effects); + } + + /// + /// Removes the render effect flag from an entity. + /// + /// The handle of the entity to modify + /// Render effect flags to remove + internal static delegate* RemoveEntityEffects = &___RemoveEntityEffects; + internal static delegate* unmanaged[Cdecl] __RemoveEntityEffects; + private static void ___RemoveEntityEffects(int entityHandle, int effects) + { + __RemoveEntityEffects(entityHandle, effects); + } + + /// + /// Get a vector containing max bounds, centered on object. + /// + /// The handle of the entity to query + /// Vector containing the maximum bounds of the entity's bounding box + internal static delegate* GetEntityBoundingMaxs = &___GetEntityBoundingMaxs; + internal static delegate* unmanaged[Cdecl] __GetEntityBoundingMaxs; + private static Vector3 ___GetEntityBoundingMaxs(int entityHandle) + { + Vector3 __retVal = __GetEntityBoundingMaxs(entityHandle); + return __retVal; + } + + /// + /// Get a vector containing min bounds, centered on object. + /// + /// The handle of the entity to query + /// Vector containing the minimum bounds of the entity's bounding box + internal static delegate* GetEntityBoundingMins = &___GetEntityBoundingMins; + internal static delegate* unmanaged[Cdecl] __GetEntityBoundingMins; + private static Vector3 ___GetEntityBoundingMins(int entityHandle) + { + Vector3 __retVal = __GetEntityBoundingMins(entityHandle); + return __retVal; + } + + /// + /// Get vector to center of object - absolute coords. + /// + /// The handle of the entity to query + /// Vector pointing to the center of the entity in absolute/world coordinates + internal static delegate* GetEntityCenter = &___GetEntityCenter; + internal static delegate* unmanaged[Cdecl] __GetEntityCenter; + private static Vector3 ___GetEntityCenter(int entityHandle) + { + Vector3 __retVal = __GetEntityCenter(entityHandle); + return __retVal; + } + + /// + /// Teleports an entity to a specified location and orientation. + /// + /// The handle of the entity to teleport. + /// A pointer to a Vector representing the new absolute position. Use nan vector to not set. + /// A pointer to a QAngle representing the new orientation. Use nan vector to not set. + /// A pointer to a Vector representing the new velocity. Use nan vector to not set. + internal static delegate* TeleportEntity = &___TeleportEntity; + internal static delegate* unmanaged[Cdecl] __TeleportEntity; + private static void ___TeleportEntity(int entityHandle, Vector3 origin, Vector3 angles, Vector3 velocity) + { + __TeleportEntity(entityHandle, &origin, &angles, &velocity); + } + + /// + /// Apply an absolute velocity impulse to an entity. + /// + /// The handle of the entity to apply impulse to + /// Velocity impulse vector to apply + internal static delegate* ApplyAbsVelocityImpulseToEntity = &___ApplyAbsVelocityImpulseToEntity; + internal static delegate* unmanaged[Cdecl] __ApplyAbsVelocityImpulseToEntity; + private static void ___ApplyAbsVelocityImpulseToEntity(int entityHandle, Vector3 vecImpulse) + { + __ApplyAbsVelocityImpulseToEntity(entityHandle, &vecImpulse); + } + + /// + /// Apply a local angular velocity impulse to an entity. + /// + /// The handle of the entity to apply impulse to + /// Angular velocity impulse vector to apply + internal static delegate* ApplyLocalAngularVelocityImpulseToEntity = &___ApplyLocalAngularVelocityImpulseToEntity; + internal static delegate* unmanaged[Cdecl] __ApplyLocalAngularVelocityImpulseToEntity; + private static void ___ApplyLocalAngularVelocityImpulseToEntity(int entityHandle, Vector3 angImpulse) + { + __ApplyLocalAngularVelocityImpulseToEntity(entityHandle, &angImpulse); + } + + /// + /// Invokes a named input method on a specified entity. + /// + /// The handle of the target entity that will receive the input. + /// The name of the input action to invoke. + /// The handle of the entity that initiated the sequence of actions. + /// The handle of the entity sending this event. + /// The value associated with the input action. + /// The type or classification of the value. + /// An identifier for tracking the output of this operation. + internal static delegate* AcceptEntityInput = &___AcceptEntityInput; + internal static delegate* unmanaged[Cdecl] __AcceptEntityInput; + private static void ___AcceptEntityInput(int entityHandle, string inputName, int activatorHandle, int callerHandle, object value, FieldType type, int outputId) + { + var __inputName = NativeMethods.ConstructString(inputName); + var __value = NativeMethods.ConstructVariant(value); + try { + __AcceptEntityInput(entityHandle, &__inputName, activatorHandle, callerHandle, &__value, type, outputId); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__inputName); + NativeMethods.DestroyVariant(&__value); + } + } + + /// + /// Connects a script function to an entity output. + /// + /// The handle of the entity. + /// The name of the output to connect to. + /// The name of the script function to call. + internal static delegate* ConnectEntityOutput = &___ConnectEntityOutput; + internal static delegate* unmanaged[Cdecl] __ConnectEntityOutput; + private static void ___ConnectEntityOutput(int entityHandle, string output, string functionName) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __ConnectEntityOutput(entityHandle, &__output, &__functionName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Disconnects a script function from an entity output. + /// + /// The handle of the entity. + /// The name of the output. + /// The name of the script function to disconnect. + internal static delegate* DisconnectEntityOutput = &___DisconnectEntityOutput; + internal static delegate* unmanaged[Cdecl] __DisconnectEntityOutput; + private static void ___DisconnectEntityOutput(int entityHandle, string output, string functionName) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __DisconnectEntityOutput(entityHandle, &__output, &__functionName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Disconnects a script function from an I/O event on a different entity. + /// + /// The handle of the calling entity. + /// The name of the output. + /// The function name to disconnect. + /// The handle of the entity whose output is being disconnected. + internal static delegate* DisconnectEntityRedirectedOutput = &___DisconnectEntityRedirectedOutput; + internal static delegate* unmanaged[Cdecl] __DisconnectEntityRedirectedOutput; + private static void ___DisconnectEntityRedirectedOutput(int entityHandle, string output, string functionName, int targetHandle) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __DisconnectEntityRedirectedOutput(entityHandle, &__output, &__functionName, targetHandle); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Fires an entity output. + /// + /// The handle of the entity firing the output. + /// The name of the output to fire. + /// The entity activating the output. + /// The entity that called the output. + /// The value associated with the input action. + /// The type or classification of the value. + /// Delay in seconds before firing the output. + internal static delegate* FireEntityOutput = &___FireEntityOutput; + internal static delegate* unmanaged[Cdecl] __FireEntityOutput; + private static void ___FireEntityOutput(int entityHandle, string outputName, int activatorHandle, int callerHandle, object value, FieldType type, float delay) + { + var __outputName = NativeMethods.ConstructString(outputName); + var __value = NativeMethods.ConstructVariant(value); + try { + __FireEntityOutput(entityHandle, &__outputName, activatorHandle, callerHandle, &__value, type, delay); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__outputName); + NativeMethods.DestroyVariant(&__value); + } + } + + /// + /// Redirects an entity output to call a function on another entity. + /// + /// The handle of the entity whose output is being redirected. + /// The name of the output to redirect. + /// The function name to call on the target entity. + /// The handle of the entity that will receive the output call. + internal static delegate* RedirectEntityOutput = &___RedirectEntityOutput; + internal static delegate* unmanaged[Cdecl] __RedirectEntityOutput; + private static void ___RedirectEntityOutput(int entityHandle, string output, string functionName, int targetHandle) + { + var __output = NativeMethods.ConstructString(output); + var __functionName = NativeMethods.ConstructString(functionName); + try { + __RedirectEntityOutput(entityHandle, &__output, &__functionName, targetHandle); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__output); + NativeMethods.DestroyString(&__functionName); + } + } + + /// + /// Makes an entity follow another entity with optional bone merging. + /// + /// The handle of the entity that will follow + /// The handle of the entity to follow + /// If true, bones will be merged between entities + internal static delegate* FollowEntity = &___FollowEntity; + internal static delegate* unmanaged[Cdecl] __FollowEntity; + private static void ___FollowEntity(int entityHandle, int attachmentHandle, Bool8 boneMerge) + { + __FollowEntity(entityHandle, attachmentHandle, boneMerge); + } + + /// + /// Makes an entity follow another entity and merge with a specific bone or attachment. + /// + /// The handle of the entity that will follow + /// The handle of the entity to follow + /// Name of the bone or attachment point to merge with + internal static delegate* FollowEntityMerge = &___FollowEntityMerge; + internal static delegate* unmanaged[Cdecl] __FollowEntityMerge; + private static void ___FollowEntityMerge(int entityHandle, int attachmentHandle, string boneOrAttachName) + { + var __boneOrAttachName = NativeMethods.ConstructString(boneOrAttachName); + try { + __FollowEntityMerge(entityHandle, attachmentHandle, &__boneOrAttachName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__boneOrAttachName); + } + } + + /// + /// Apply damage to an entity. + /// + /// The handle of the entity receiving damage + /// The handle of the entity inflicting damage (e.g., projectile) + /// The handle of the attacking entity + /// Direction and magnitude of force to apply + /// Position where the damage hit occurred + /// Amount of damage to apply + /// Bitfield of damage type flags + /// Amount of damage actually applied to the entity + internal static delegate* TakeEntityDamage = &___TakeEntityDamage; + internal static delegate* unmanaged[Cdecl] __TakeEntityDamage; + private static int ___TakeEntityDamage(int entityHandle, int inflictorHandle, int attackerHandle, Vector3 force, Vector3 hitPos, float damage, DamageTypes damageTypes) + { + int __retVal = __TakeEntityDamage(entityHandle, inflictorHandle, attackerHandle, &force, &hitPos, damage, damageTypes); + return __retVal; + } + + /// + /// Retrieves a float attribute value from an entity. + /// + /// The handle of the entity. + /// The name of the attribute. + /// The default value to return if the attribute does not exist. + /// The float value of the attribute, or the default value if missing or invalid. + internal static delegate* GetEntityAttributeFloatValue = &___GetEntityAttributeFloatValue; + internal static delegate* unmanaged[Cdecl] __GetEntityAttributeFloatValue; + private static float ___GetEntityAttributeFloatValue(int entityHandle, string name, float defaultValue) + { + float __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetEntityAttributeFloatValue(entityHandle, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves an integer attribute value from an entity. + /// + /// The handle of the entity. + /// The name of the attribute. + /// The default value to return if the attribute does not exist. + /// The integer value of the attribute, or the default value if missing or invalid. + internal static delegate* GetEntityAttributeIntValue = &___GetEntityAttributeIntValue; + internal static delegate* unmanaged[Cdecl] __GetEntityAttributeIntValue; + private static int ___GetEntityAttributeIntValue(int entityHandle, string name, int defaultValue) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetEntityAttributeIntValue(entityHandle, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Sets a float attribute value on an entity. + /// + /// The handle of the entity. + /// The name of the attribute. + /// The float value to assign to the attribute. + internal static delegate* SetEntityAttributeFloatValue = &___SetEntityAttributeFloatValue; + internal static delegate* unmanaged[Cdecl] __SetEntityAttributeFloatValue; + private static void ___SetEntityAttributeFloatValue(int entityHandle, string name, float value) + { + var __name = NativeMethods.ConstructString(name); + try { + __SetEntityAttributeFloatValue(entityHandle, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets an integer attribute value on an entity. + /// + /// The handle of the entity. + /// The name of the attribute. + /// The integer value to assign to the attribute. + internal static delegate* SetEntityAttributeIntValue = &___SetEntityAttributeIntValue; + internal static delegate* unmanaged[Cdecl] __SetEntityAttributeIntValue; + private static void ___SetEntityAttributeIntValue(int entityHandle, string name, int value) + { + var __name = NativeMethods.ConstructString(name); + try { + __SetEntityAttributeIntValue(entityHandle, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Deletes an attribute from an entity. + /// + /// The handle of the entity. + /// The name of the attribute to delete. + internal static delegate* DeleteEntityAttribute = &___DeleteEntityAttribute; + internal static delegate* unmanaged[Cdecl] __DeleteEntityAttribute; + private static void ___DeleteEntityAttribute(int entityHandle, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __DeleteEntityAttribute(entityHandle, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Checks if an entity has a specific attribute. + /// + /// The handle of the entity. + /// The name of the attribute to check. + /// True if the attribute exists, false otherwise. + internal static delegate* HasEntityAttribute = &___HasEntityAttribute; + internal static delegate* unmanaged[Cdecl] __HasEntityAttribute; + private static Bool8 ___HasEntityAttribute(int entityHandle, string name) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __HasEntityAttribute(entityHandle, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/enums.cs b/PlugifyProfiler/imported/s2sdk/enums.cs new file mode 100644 index 0000000..7289bde --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/enums.cs @@ -0,0 +1,1167 @@ +using System; + +// Generated from s2sdk.pplugin + +namespace s2sdk { +#pragma warning disable CS0649 + + /// + /// Enum representing various movement types for entities. + /// + + [Flags] public enum MoveType : int + { + /// + /// Never moves. + /// + None = 0, + /// + /// Previously isometric movement type. + /// + Isometric = 1, + /// + /// Player only - moving on the ground. + /// + Walk = 2, + /// + /// No gravity, but still collides with stuff. + /// + Fly = 3, + /// + /// Flies through the air and is affected by gravity. + /// + Flygravity = 4, + /// + /// Uses VPHYSICS for simulation. + /// + Vphysics = 5, + /// + /// No clip to world, push and crush. + /// + Push = 6, + /// + /// No gravity, no collisions, still has velocity/avelocity. + /// + Noclip = 7, + /// + /// Used by players only when going onto a ladder. + /// + Ladder = 8, + /// + /// Observer movement, depends on player's observer mode. + /// + Observer = 9, + /// + /// Allows the entity to describe its own physics. + /// + Custom = 10 + } + + /// + /// Enum representing rendering modes for materials. + /// + + [Flags] public enum RenderMode : byte + { + /// + /// Standard rendering mode (src). + /// + Normal = 0, + /// + /// Composite: c*a + dest*(1-a). + /// + TransColor = 1, + /// + /// Composite: src*a + dest*(1-a). + /// + TransTexture = 2, + /// + /// Composite: src*a + dest -- No Z buffer checks -- Fixed size in screen space. + /// + Glow = 3, + /// + /// Composite: src*srca + dest*(1-srca). + /// + TransAlpha = 4, + /// + /// Composite: src*a + dest. + /// + TransAdd = 5, + /// + /// Not drawn, used for environmental effects. + /// + Environmental = 6, + /// + /// Uses a fractional frame value to blend between animation frames. + /// + TransAddFrameBlend = 7, + /// + /// Composite: src + dest*(1-a). + /// + TransAlphaAdd = 8, + /// + /// Same as Glow but not fixed size in screen space. + /// + WorldGlow = 9, + /// + /// No rendering. + /// + None = 10, + /// + /// Developer visualizer rendering mode. + /// + DevVisualizer = 11 + } + + /// + /// Enum representing the possible teams in Counter-Strike. + /// + + [Flags] public enum CSTeam : int + { + /// + /// No team. + /// + None = 0, + /// + /// Spectator team. + /// + Spectator = 1, + /// + /// Terrorist team. + /// + T = 2, + /// + /// Counter-Terrorist team. + /// + CT = 3 + } + + /// + /// Represents the possible types of data that can be passed as a value in input actions. + /// + + [Flags] public enum FieldType : int + { + /// + /// Automatically detect the type of the value. + /// + Auto = 0, + /// + /// A 32-bit floating-point number. + /// + Float32 = 1, + /// + /// A 64-bit floating-point number. + /// + Float64 = 2, + /// + /// A 32-bit signed integer. + /// + Int32 = 3, + /// + /// A 32-bit unsigned integer. + /// + UInt32 = 4, + /// + /// A 64-bit signed integer. + /// + Int64 = 5, + /// + /// A 64-bit unsigned integer. + /// + UInt64 = 6, + /// + /// A boolean value (true or false). + /// + Boolean = 7, + /// + /// A single character. + /// + Character = 8, + /// + /// A managed string object. + /// + String = 9, + /// + /// A null-terminated C-style string. + /// + CString = 10, + /// + /// A script handle, typically for scripting integration. + /// + HScript = 11, + /// + /// An entity handle, used to reference an entity within the system. + /// + EHandle = 12, + /// + /// A resource handle, such as a file or asset reference. + /// + Resource = 13, + /// + /// A 3D vector, typically representing position or direction. + /// + Vector3d = 14, + /// + /// A 2D vector, for planar data or coordinates. + /// + Vector2d = 15, + /// + /// A 4D vector, often used for advanced mathematical representations. + /// + Vector4d = 16, + /// + /// A 32-bit color value (RGBA). + /// + Color32 = 17, + /// + /// A quaternion-based angle representation. + /// + QAngle = 18, + /// + /// A quaternion, used for rotation and orientation calculations. + /// + Quaternion = 19 + } + + /// + /// Enum representing various damage types. + /// + + [Flags] public enum DamageTypes : int + { + /// + /// Generic damage. + /// + DMG_GENERIC = 0, + /// + /// Crush damage. + /// + DMG_CRUSH = 1, + /// + /// Bullet damage. + /// + DMG_BULLET = 2, + /// + /// Slash damage. + /// + DMG_SLASH = 4, + /// + /// Burn damage. + /// + DMG_BURN = 8, + /// + /// Vehicle damage. + /// + DMG_VEHICLE = 16, + /// + /// Fall damage. + /// + DMG_FALL = 32, + /// + /// Blast damage. + /// + DMG_BLAST = 64, + /// + /// Club damage. + /// + DMG_CLUB = 128, + /// + /// Shock damage. + /// + DMG_SHOCK = 256, + /// + /// Sonic damage. + /// + DMG_SONIC = 512, + /// + /// Energy beam damage. + /// + DMG_ENERGYBEAM = 1024, + /// + /// Drowning damage. + /// + DMG_DROWN = 16384, + /// + /// Poison damage. + /// + DMG_POISON = 32768, + /// + /// Radiation damage. + /// + DMG_RADIATION = 65536, + /// + /// Recovering from drowning damage. + /// + DMG_DROWNRECOVER = 131072, + /// + /// Acid damage. + /// + DMG_ACID = 262144, + /// + /// Physgun damage. + /// + DMG_PHYSGUN = 1048576, + /// + /// Dissolve damage. + /// + DMG_DISSOLVE = 2097152, + /// + /// Surface blast damage. + /// + DMG_BLAST_SURFACE = 4194304, + /// + /// Buckshot damage. + /// + DMG_BUCKSHOT = 16777216, + /// + /// Last generic flag damage. + /// + DMG_LASTGENERICFLAG = 16777216, + /// + /// Headshot damage. + /// + DMG_HEADSHOT = 33554432, + /// + /// Danger zone damage. + /// + DMG_DANGERZONE = 67108864 + } + + /// + /// Enum representing various flags for ConVars and ConCommands. + /// + + [Flags] public enum ConVarFlag : long + { + /// + /// The default, no flags at all. + /// + None = 0, + /// + /// Linked to a ConCommand. + /// + LinkedConcommand = 1, + /// + /// Hidden in released products. Automatically removed if ALLOW_DEVELOPMENT_CVARS is defined. + /// + DevelopmentOnly = 2, + /// + /// Defined by the game DLL. + /// + GameDll = 4, + /// + /// Defined by the client DLL. + /// + ClientDll = 8, + /// + /// Hidden. Doesn't appear in find or auto-complete. Like DEVELOPMENTONLY but cannot be compiled out. + /// + Hidden = 16, + /// + /// Server cvar; data is not sent since it's sensitive (e.g., passwords). + /// + Protected = 32, + /// + /// This cvar cannot be changed by clients connected to a multiplayer server. + /// + SpOnly = 64, + /// + /// Saved to vars.rc. + /// + Archive = 128, + /// + /// Notifies players when changed. + /// + Notify = 256, + /// + /// Changes the client's info string. + /// + UserInfo = 512, + /// + /// Hides the cvar from lookups. + /// + Missing0 = 1024, + /// + /// If this is a server cvar, changes are not logged to the file or console. + /// + Unlogged = 2048, + /// + /// Hides the cvar from lookups. + /// + Missing1 = 4096, + /// + /// Server-enforced setting on clients. + /// + Replicated = 8192, + /// + /// Only usable in singleplayer/debug or multiplayer with sv_cheats. + /// + Cheat = 16384, + /// + /// Causes auto-generated varnameN for splitscreen slots. + /// + PerUser = 32768, + /// + /// Records this cvar when starting a demo file. + /// + Demo = 65536, + /// + /// Excluded from demo files. + /// + DontRecord = 131072, + /// + /// Reserved for future use. + /// + Missing2 = 262144, + /// + /// Cvars tagged with this are available to customers. + /// + Release = 524288, + /// + /// Marks the cvar as a menu bar item. + /// + MenuBarItem = 1048576, + /// + /// Reserved for future use. + /// + Missing3 = 2097152, + /// + /// Cannot be changed by a client connected to a server. + /// + NotConnected = 4194304, + /// + /// Enables fuzzy matching for vconsole. + /// + VconsoleFuzzyMatching = 8388608, + /// + /// The server can execute this command on clients. + /// + ServerCanExecute = 16777216, + /// + /// Allows clients to execute this command. + /// + ClientCanExecute = 33554432, + /// + /// The server cannot query this cvar's value. + /// + ServerCannotQuery = 67108864, + /// + /// Sets focus in the vconsole. + /// + VconsoleSetFocus = 134217728, + /// + /// IVEngineClient::ClientCmd can execute this command. + /// + ClientCmdCanExecute = 268435456, + /// + /// Executes the cvar every tick. + /// + ExecutePerTick = 536870912 + } + + /// + /// Enum representing the possible results of an operation. + /// + + [Flags] public enum ResultType : int + { + /// + /// The action continues to be processed without interruption. + /// + Continue = 0, + /// + /// Indicates that the action has altered the state or behavior during execution. + /// + Changed = 1, + /// + /// The action has been successfully handled, and no further action is required. + /// + Handled = 2, + /// + /// The action processing is halted, and no further steps will be executed. + /// + Stop = 3 + } + + /// + /// The command execution context. + /// + + [Flags] public enum CommandCallingContext : int + { + /// + /// The command execute from the client's console. + /// + Console = 0, + /// + /// The command execute from the client's chat. + /// + Chat = 1 + } + + /// + /// Enum representing the type of callback. + /// + + [Flags] public enum HookMode : byte + { + /// + /// Callback will be executed before the original function + /// + Pre = 0, + /// + /// Callback will be executed after the original function + /// + Post = 1 + } + + + [Flags] public enum ConVarType : short + { + /// + /// Invalid type + /// + Invalid = -1, + /// + /// Boolean type + /// + Bool = 0, + /// + /// 16-bit signed integer + /// + Int16 = 1, + /// + /// 16-bit unsigned integer + /// + UInt16 = 2, + /// + /// 32-bit signed integer + /// + Int32 = 3, + /// + /// 32-bit unsigned integer + /// + UInt32 = 4, + /// + /// 64-bit signed integer + /// + Int64 = 5, + /// + /// 64-bit unsigned integer + /// + UInt64 = 6, + /// + /// 32-bit floating point + /// + Float32 = 7, + /// + /// 64-bit floating point (double) + /// + Float64 = 8, + /// + /// String type + /// + String = 9, + /// + /// Color type + /// + Color = 10, + /// + /// 2D vector + /// + Vector2 = 11, + /// + /// 3D vector + /// + Vector3 = 12, + /// + /// 4D vector + /// + Vector4 = 13, + /// + /// Quaternion angle + /// + Qangle = 14, + /// + /// Maximum value (used for bounds checking) + /// + Max = 15 + } + + /// + /// Enum representing various flags for ConVars and ConCommands. + /// + + [Flags] public enum CvarValueStatus : int + { + /// + /// It got the value fine. + /// + ValueIntact = 0, + /// + /// It did not found the value. + /// + CvarNotFound = 1, + /// + /// There's a ConCommand, but it's not a ConVar. + /// + NotACvar = 2, + /// + /// The cvar was marked with FCVAR_SERVER_CAN_NOT_QUERY, so the server is not allowed to have its value. + /// + CvarProtected = 3 + } + + /// + /// Enum representing the type of callback. + /// + + [Flags] public enum EventHookError : int + { + /// + /// Indicates that the event hook was successfully created. + /// + Okay = 0, + /// + /// Indicates that the event name provided is invalid or does not exist. + /// + InvalidEvent = 1, + /// + /// Indicates that the event system is not currently active or initialized. + /// + NotActive = 2, + /// + /// Indicates that the callback function provided is invalid or not compatible with the event system. + /// + InvalidCallback = 3 + } + + /// + /// Enum representing the possible verbosity of a logger. + /// + + [Flags] public enum LoggingVerbosity : int + { + /// + /// Turns off all spew. + /// + Off = 0, + /// + /// Turns on vital logs. + /// + Essential = 1, + /// + /// Turns on most messages. + /// + Default = 2, + /// + /// Allows for walls of text that are usually useful. + /// + Detailed = 3, + /// + /// Allows everything. + /// + Max = 4 + } + + /// + /// Enum representing the possible verbosity of a logger. + /// + + [Flags] public enum LoggingSeverity : int + { + /// + /// Turns off all spew. + /// + Off = 0, + /// + /// A debug message. + /// + Detailed = 1, + /// + /// An informative logging message. + /// + Message = 2, + /// + /// A warning, typically non-fatal. + /// + Warning = 3, + /// + /// A message caused by an Assert**() operation. + /// + Assert = 4, + /// + /// An error, typically fatal/unrecoverable. + /// + Error = 5 + } + + /// + /// Logging channel behavior flags, set on channel creation. + /// + + [Flags] public enum LoggingChannelFlags : int + { + /// + /// Indicates that the spew is only relevant to interactive consoles. + /// + ConsoleOnly = 1, + /// + /// Indicates that spew should not be echoed to any output devices. + /// + DoNotEcho = 2 + } + + /// + /// Enum representing the possible reasons a vote creation or processing has failed. + /// + + [Flags] public enum VoteCreateFailed : int + { + /// + /// Generic vote failure. + /// + Generic = 0, + /// + /// Vote failed due to players transitioning. + /// + TransitioningPlayers = 1, + /// + /// Vote failed because vote rate limit was exceeded. + /// + RateExceeded = 2, + /// + /// Vote failed because Yes votes must exceed No votes. + /// + YesMustExceedNo = 3, + /// + /// Vote failed due to quorum not being met. + /// + QuorumFailure = 4, + /// + /// Vote failed because the issue is disabled. + /// + IssueDisabled = 5, + /// + /// Vote failed because the map was not found. + /// + MapNotFound = 6, + /// + /// Vote failed because map name is required. + /// + MapNameRequired = 7, + /// + /// Vote failed because a similar vote failed recently. + /// + FailedRecently = 8, + /// + /// Vote to kick failed recently. + /// + FailedRecentKick = 9, + /// + /// Vote to change map failed recently. + /// + FailedRecentChangeMap = 10, + /// + /// Vote to swap teams failed recently. + /// + FailedRecentSwapTeams = 11, + /// + /// Vote to scramble teams failed recently. + /// + FailedRecentScrambleTeams = 12, + /// + /// Vote to restart failed recently. + /// + FailedRecentRestart = 13, + /// + /// Team is not allowed to call vote. + /// + TeamCantCall = 14, + /// + /// Vote failed because game is waiting for players. + /// + WaitingForPlayers = 15, + /// + /// Target player was not found. + /// + PlayerNotFound = 16, + /// + /// Cannot kick an admin. + /// + CannotKickAdmin = 17, + /// + /// Scramble is currently in progress. + /// + ScrambleInProgress = 18, + /// + /// Swap is currently in progress. + /// + SwapInProgress = 19, + /// + /// Spectators are not allowed to vote. + /// + Spectator = 20, + /// + /// Voting is disabled. + /// + Disabled = 21, + /// + /// Next level is already set. + /// + NextLevelSet = 22, + /// + /// Rematch vote failed. + /// + Rematch = 23, + /// + /// Vote to surrender failed due to being too early. + /// + TooEarlySurrender = 24, + /// + /// Vote to continue failed. + /// + Continue = 25, + /// + /// Vote failed because match is already paused. + /// + MatchPaused = 26, + /// + /// Vote failed because match is not paused. + /// + MatchNotPaused = 27, + /// + /// Vote failed because game is not in warmup. + /// + NotInWarmup = 28, + /// + /// Vote failed because there are not 10 players. + /// + Not10Players = 29, + /// + /// Vote failed due to an active timeout. + /// + TimeoutActive = 30, + /// + /// Vote failed because timeout is inactive. + /// + TimeoutInactive = 31, + /// + /// Vote failed because timeout has been exhausted. + /// + TimeoutExhausted = 32, + /// + /// Vote failed because the round can't end now. + /// + CantRoundEnd = 33, + /// + /// Sentinel value. Not a real failure reason. + /// + Max = 34 + } + + /// + /// Enum representing the possible types of a vote actions. + /// + + [Flags] public enum VoteAction : int + { + /// + /// Triggered when the vote begins. No additional parameters are used. + /// + Start = 0, + /// + /// Triggered when a player casts a vote. 'clientSlot' holds the voter's slot and 'choice' is the selected option (e.g., VOTE_OPTION1 for yes, VOTE_OPTION2 for no). + /// + Vote = 1, + /// + /// Triggered when the vote concludes. 'clientSlot' is typically -1. 'choice' contains the reason the vote ended (from YesNoVoteEndReason). + /// + End = 2 + } + + /// + /// Enum representing the possible types of a vote. + /// + + [Flags] public enum VoteEndReason : int + { + /// + /// All possible votes were cast. + /// + AllVotes = 0, + /// + /// Time ran out. + /// + TimeUp = 1, + /// + /// The vote got cancelled. + /// + Cancelled = 2 + } + + /// + /// Enum representing the possible flags of a timer. + /// + + [Flags] public enum TimerFlag : int + { + /// + /// Timer with no unique properties. + /// + Default = 0, + /// + /// Timer will repeat until stopped. + /// + Repeat = 1, + /// + /// Timer will not carry over mapchanges. + /// + NoMapChange = 2 + } + + /// + /// Enum representing the possible reasons for a round ending in Counter-Strike. + /// + + [Flags] public enum CSRoundEndReason : int + { + /// + /// Target successfully bombed. + /// + TargetBombed = 1, + /// + /// The VIP has escaped (not present in CS:GO). + /// + VIPEscaped = 2, + /// + /// VIP has been assassinated (not present in CS:GO). + /// + VIPKilled = 3, + /// + /// The terrorists have escaped. + /// + TerroristsEscaped = 4, + /// + /// The CTs have prevented most of the terrorists from escaping. + /// + CTStoppedEscape = 5, + /// + /// Escaping terrorists have all been neutralized. + /// + TerroristsStopped = 6, + /// + /// The bomb has been defused. + /// + BombDefused = 7, + /// + /// Counter-Terrorists win. + /// + CTWin = 8, + /// + /// Terrorists win. + /// + TerroristWin = 9, + /// + /// Round draw. + /// + Draw = 10, + /// + /// All hostages have been rescued. + /// + HostagesRescued = 11, + /// + /// Target has been saved. + /// + TargetSaved = 12, + /// + /// Hostages have not been rescued. + /// + HostagesNotRescued = 13, + /// + /// Terrorists have not escaped. + /// + TerroristsNotEscaped = 14, + /// + /// VIP has not escaped (not present in CS:GO). + /// + VIPNotEscaped = 15, + /// + /// Game commencing. + /// + GameStart = 16, + /// + /// Terrorists surrender. + /// + TerroristsSurrender = 17, + /// + /// CTs surrender. + /// + CTSurrender = 18, + /// + /// Terrorists planted the bomb. + /// + TerroristsPlanted = 19, + /// + /// CTs reached the hostage. + /// + CTsReachedHostage = 20, + /// + /// Survival mode win. + /// + SurvivalWin = 21, + /// + /// Survival mode draw. + /// + SurvivalDraw = 22 + } + + /// + /// Enum representing different weapon types. + /// + + [Flags] public enum CSWeaponType : uint + { + Knife = 0, + Pistol = 1, + SubmachineGun = 2, + Rifle = 3, + Shotgun = 4, + SniperRifle = 5, + MachineGun = 6, + C4 = 7, + Taser = 8, + Grenade = 9, + Equipment = 10, + StackableItem = 11, + Unknown = 12 + } + + /// + /// Enum representing different weapon categories. + /// + + [Flags] public enum CSWeaponCategory : uint + { + Other = 0, + Melee = 1, + Secondary = 2, + SMG = 3, + Rifle = 4, + Heavy = 5, + Count = 6 + } + + /// + /// Enum representing different gear slots. + /// + + [Flags] public enum GearSlot : uint + { + Invalid = 4294967295, + Rifle = 0, + Pistol = 1, + Knife = 2, + Grenades = 3, + C4 = 4, + ReservedSlot6 = 5, + ReservedSlot7 = 6, + ReservedSlot8 = 7, + ReservedSlot9 = 8, + ReservedSlot10 = 9, + ReservedSlot11 = 10, + Boosts = 11, + Utility = 12, + Count = 13, + First = 0, + Last = 12 + } + + /// + /// Enum representing different weapon definition indices. + /// + + [Flags] public enum WeaponDefIndex : ushort + { + Invalid = 0, + Deagle = 1, + Elite = 2, + FiveSeven = 3, + Glock = 4, + AK47 = 7, + AUG = 8, + AWP = 9, + FAMAS = 10, + G3SG1 = 11, + GalilAR = 13, + M249 = 14, + M4A1 = 16, + MAC10 = 17, + P90 = 19, + MP5SD = 23, + UMP45 = 24, + XM1014 = 25, + Bizon = 26, + MAG7 = 27, + Negev = 28, + SawedOff = 29, + Tec9 = 30, + Taser = 31, + HKP2000 = 32, + MP7 = 33, + MP9 = 34, + Nova = 35, + P250 = 36, + SCAR20 = 38, + SG556 = 39, + SSG08 = 40, + KnifeGG = 41, + Knife = 42, + Flashbang = 43, + HEGrenade = 44, + SmokeGrenade = 45, + Molotov = 46, + Decoy = 47, + IncGrenade = 48, + C4 = 49, + Kevlar = 50, + AssaultSuit = 51, + HeavyAssaultSuit = 52, + Defuser = 55, + KnifeT = 59, + M4A1Silencer = 60, + USPSilencer = 61, + CZ75A = 63, + Revolver = 64, + Bayonet = 500, + KnifeCSS = 503, + KnifeFlip = 505, + KnifeGut = 506, + KnifeKarambit = 507, + KnifeM9Bayonet = 508, + KnifeTactical = 509, + KnifeFalchion = 512, + KnifeBowie = 514, + KnifeButterfly = 515, + KnifePush = 516, + KnifeCord = 517, + KnifeCanis = 518, + KnifeUrsus = 519, + KnifeGypsyJackknife = 520, + KnifeOutdoor = 521, + KnifeStiletto = 522, + KnifeWidowmaker = 523, + KnifeSkeleton = 525, + KnifeKukri = 526 + } + + + /// + /// Ownership type for RAII wrappers + /// + internal enum Ownership { Borrowed, Owned } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/events.cs b/PlugifyProfiler/imported/s2sdk/events.cs new file mode 100644 index 0000000..f5f3033 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/events.cs @@ -0,0 +1,1029 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: events) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a hook for when a game event is fired. + /// + /// The name of the event to hook. + /// The callback function to call when the event is fired. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// An integer indicating the result of the hook operation. + internal static delegate* HookEvent = &___HookEvent; + internal static delegate* unmanaged[Cdecl] __HookEvent; + private static EventHookError ___HookEvent(string name, EventCallback callback, HookMode type) + { + EventHookError __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __HookEvent(&__name, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Removes a hook for when a game event is fired. + /// + /// The name of the event to unhook. + /// The callback function to remove. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// An integer indicating the result of the unhook operation. + internal static delegate* UnhookEvent = &___UnhookEvent; + internal static delegate* unmanaged[Cdecl] __UnhookEvent; + private static EventHookError ___UnhookEvent(string name, EventCallback callback, HookMode type) + { + EventHookError __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __UnhookEvent(&__name, Marshalling.GetFunctionPointerForDelegate(callback), type); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Creates a game event to be fired later. + /// + /// The name of the event to create. + /// A boolean indicating whether to force the creation of the event. + /// A pointer to the created IGameEvent object. + internal static delegate* CreateEvent = &___CreateEvent; + internal static delegate* unmanaged[Cdecl] __CreateEvent; + private static nint ___CreateEvent(string name, Bool8 force) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __CreateEvent(&__name, force); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Fires a game event. + /// + /// A pointer to the IGameEvent object containing event data. + /// A boolean indicating whether to broadcast the event. + internal static delegate* FireEvent = &___FireEvent; + internal static delegate* unmanaged[Cdecl] __FireEvent; + private static void ___FireEvent(nint event_, Bool8 dontBroadcast) + { + __FireEvent(event_, dontBroadcast); + } + + /// + /// Fires a game event to a specific client. + /// + /// A pointer to the IGameEvent object containing event data. + /// The index of the client to fire the event to. + internal static delegate* FireEventToClient = &___FireEventToClient; + internal static delegate* unmanaged[Cdecl] __FireEventToClient; + private static void ___FireEventToClient(nint event_, int playerSlot) + { + __FireEventToClient(event_, playerSlot); + } + + /// + /// Cancels a previously created game event that has not been fired. + /// + /// A pointer to the IGameEvent object of the event to cancel. + internal static delegate* CancelCreatedEvent = &___CancelCreatedEvent; + internal static delegate* unmanaged[Cdecl] __CancelCreatedEvent; + private static void ___CancelCreatedEvent(nint event_) + { + __CancelCreatedEvent(event_); + } + + /// + /// Retrieves the boolean value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the boolean value. + /// The boolean value associated with the key. + internal static delegate* GetEventBool = &___GetEventBool; + internal static delegate* unmanaged[Cdecl] __GetEventBool; + private static Bool8 ___GetEventBool(nint event_, string key) + { + Bool8 __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventBool(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the float value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the float value. + /// The float value associated with the key. + internal static delegate* GetEventFloat = &___GetEventFloat; + internal static delegate* unmanaged[Cdecl] __GetEventFloat; + private static float ___GetEventFloat(nint event_, string key) + { + float __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventFloat(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the integer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the integer value. + /// The integer value associated with the key. + internal static delegate* GetEventInt = &___GetEventInt; + internal static delegate* unmanaged[Cdecl] __GetEventInt; + private static int ___GetEventInt(nint event_, string key) + { + int __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventInt(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the long integer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the long integer value. + /// The long integer value associated with the key. + internal static delegate* GetEventUInt64 = &___GetEventUInt64; + internal static delegate* unmanaged[Cdecl] __GetEventUInt64; + private static ulong ___GetEventUInt64(nint event_, string key) + { + ulong __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventUInt64(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the string value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the string value. + /// A string where the result will be stored. + internal static delegate* GetEventString = &___GetEventString; + internal static delegate* unmanaged[Cdecl] __GetEventString; + private static string ___GetEventString(nint event_, string key) + { + string __retVal; + String192 __retVal_native; + var __key = NativeMethods.ConstructString(key); + try { + __retVal_native = __GetEventString(event_, &__key); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the pointer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the pointer value. + /// The pointer value associated with the key. + internal static delegate* GetEventPtr = &___GetEventPtr; + internal static delegate* unmanaged[Cdecl] __GetEventPtr; + private static nint ___GetEventPtr(nint event_, string key) + { + nint __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventPtr(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the player controller address of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the player controller address. + /// A pointer to the player controller associated with the key. + internal static delegate* GetEventPlayerController = &___GetEventPlayerController; + internal static delegate* unmanaged[Cdecl] __GetEventPlayerController; + private static nint ___GetEventPlayerController(nint event_, string key) + { + nint __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventPlayerController(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the player index of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the player index. + /// The player index associated with the key. + internal static delegate* GetEventPlayerIndex = &___GetEventPlayerIndex; + internal static delegate* unmanaged[Cdecl] __GetEventPlayerIndex; + private static int ___GetEventPlayerIndex(nint event_, string key) + { + int __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventPlayerIndex(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the player pawn address of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the player pawn address. + /// A pointer to the player pawn associated with the key. + internal static delegate* GetEventPlayerPawn = &___GetEventPlayerPawn; + internal static delegate* unmanaged[Cdecl] __GetEventPlayerPawn; + private static nint ___GetEventPlayerPawn(nint event_, string key) + { + nint __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventPlayerPawn(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the entity address of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the entity address. + /// A pointer to the entity associated with the key. + internal static delegate* GetEventEntity = &___GetEventEntity; + internal static delegate* unmanaged[Cdecl] __GetEventEntity; + private static nint ___GetEventEntity(nint event_, string key) + { + nint __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventEntity(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the entity index of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the entity index. + /// The entity index associated with the key. + internal static delegate* GetEventEntityIndex = &___GetEventEntityIndex; + internal static delegate* unmanaged[Cdecl] __GetEventEntityIndex; + private static int ___GetEventEntityIndex(nint event_, string key) + { + int __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventEntityIndex(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the entity handle of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to retrieve the entity handle. + /// The entity handle associated with the key. + internal static delegate* GetEventEntityHandle = &___GetEventEntityHandle; + internal static delegate* unmanaged[Cdecl] __GetEventEntityHandle; + private static int ___GetEventEntityHandle(nint event_, string key) + { + int __retVal; + var __key = NativeMethods.ConstructString(key); + try { + __retVal = __GetEventEntityHandle(event_, &__key); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + return __retVal; + } + + /// + /// Retrieves the name of a game event. + /// + /// A pointer to the IGameEvent object containing event data. + /// A string where the result will be stored. + internal static delegate* GetEventName = &___GetEventName; + internal static delegate* unmanaged[Cdecl] __GetEventName; + private static string ___GetEventName(nint event_) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEventName(event_); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the boolean value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the boolean value. + /// The boolean value to set. + internal static delegate* SetEventBool = &___SetEventBool; + internal static delegate* unmanaged[Cdecl] __SetEventBool; + private static void ___SetEventBool(nint event_, string key, Bool8 value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventBool(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the floating point value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the float value. + /// The float value to set. + internal static delegate* SetEventFloat = &___SetEventFloat; + internal static delegate* unmanaged[Cdecl] __SetEventFloat; + private static void ___SetEventFloat(nint event_, string key, float value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventFloat(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the integer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the integer value. + /// The integer value to set. + internal static delegate* SetEventInt = &___SetEventInt; + internal static delegate* unmanaged[Cdecl] __SetEventInt; + private static void ___SetEventInt(nint event_, string key, int value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventInt(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the long integer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the long integer value. + /// The long integer value to set. + internal static delegate* SetEventUInt64 = &___SetEventUInt64; + internal static delegate* unmanaged[Cdecl] __SetEventUInt64; + private static void ___SetEventUInt64(nint event_, string key, ulong value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventUInt64(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the string value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the string value. + /// The string value to set. + internal static delegate* SetEventString = &___SetEventString; + internal static delegate* unmanaged[Cdecl] __SetEventString; + private static void ___SetEventString(nint event_, string key, string value) + { + var __key = NativeMethods.ConstructString(key); + var __value = NativeMethods.ConstructString(value); + try { + __SetEventString(event_, &__key, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Sets the pointer value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the pointer value. + /// The pointer value to set. + internal static delegate* SetEventPtr = &___SetEventPtr; + internal static delegate* unmanaged[Cdecl] __SetEventPtr; + private static void ___SetEventPtr(nint event_, string key, nint value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventPtr(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the player controller address of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the player controller address. + /// A pointer to the player controller to set. + internal static delegate* SetEventPlayerController = &___SetEventPlayerController; + internal static delegate* unmanaged[Cdecl] __SetEventPlayerController; + private static void ___SetEventPlayerController(nint event_, string key, nint value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventPlayerController(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the player index value of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the player index value. + /// The player index value to set. + internal static delegate* SetEventPlayerIndex = &___SetEventPlayerIndex; + internal static delegate* unmanaged[Cdecl] __SetEventPlayerIndex; + private static void ___SetEventPlayerIndex(nint event_, string key, int value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventPlayerIndex(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the entity address of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the entity address. + /// A pointer to the entity to set. + internal static delegate* SetEventEntity = &___SetEventEntity; + internal static delegate* unmanaged[Cdecl] __SetEventEntity; + private static void ___SetEventEntity(nint event_, string key, nint value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventEntity(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the entity index of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the entity index. + /// The entity index value to set. + internal static delegate* SetEventEntityIndex = &___SetEventEntityIndex; + internal static delegate* unmanaged[Cdecl] __SetEventEntityIndex; + private static void ___SetEventEntityIndex(nint event_, string key, int value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventEntityIndex(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets the entity handle of a game event's key. + /// + /// A pointer to the IGameEvent object containing event data. + /// The key for which to set the entity handle. + /// The entity handle value to set. + internal static delegate* SetEventEntityHandle = &___SetEventEntityHandle; + internal static delegate* unmanaged[Cdecl] __SetEventEntityHandle; + private static void ___SetEventEntityHandle(nint event_, string key, int value) + { + var __key = NativeMethods.ConstructString(key); + try { + __SetEventEntityHandle(event_, &__key, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__key); + } + } + + /// + /// Sets whether an event's broadcasting will be disabled or not. + /// + /// A pointer to the IGameEvent object containing event data. + /// A boolean indicating whether to disable broadcasting. + internal static delegate* SetEventBroadcast = &___SetEventBroadcast; + internal static delegate* unmanaged[Cdecl] __SetEventBroadcast; + private static void ___SetEventBroadcast(nint event_, Bool8 dontBroadcast) + { + __SetEventBroadcast(event_, dontBroadcast); + } + + /// + /// Load game event descriptions from a file (e.g., "resource/gameevents.res"). + /// + /// The path to the file containing event descriptions. + /// A boolean indicating whether to search all paths for the file. + /// An integer indicating the result of the loading operation. + internal static delegate* LoadEventsFromFile = &___LoadEventsFromFile; + internal static delegate* unmanaged[Cdecl] __LoadEventsFromFile; + private static int ___LoadEventsFromFile(string path, Bool8 searchAll) + { + int __retVal; + var __path = NativeMethods.ConstructString(path); + try { + __retVal = __LoadEventsFromFile(&__path, searchAll); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__path); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for EventInfo pointer. + /// + internal sealed unsafe class EventInfo + { + private nint handle; + + /// + /// Creates a game event to be fired later. + /// + /// The name of the event to create. + /// A boolean indicating whether to force the creation of the event. + public EventInfo(string name, Bool8 force) + { + this.handle = s2sdk.CreateEvent(name, force); + } + + /// + /// Internal constructor for creating EventInfo from existing handle + /// + public EventInfo(nint handle, Ownership ownership = Ownership.Borrowed) + { + this.handle = handle; + } + + /// + /// Gets the underlying handle + /// + public nint Handle => handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + handle = nint.Zero; + return h; + } + + /// + /// Resets the handle to invalid + /// + public void Reset() + { + handle = nint.Zero; + } + + /// + /// Fires a game event. + /// + /// A boolean indicating whether to broadcast the event. + public void Fire(Bool8 dontBroadcast) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.FireEvent(handle, dontBroadcast); + } + + /// + /// Fires a game event to a specific client. + /// + /// The index of the client to fire the event to. + public void FireToClient(int playerSlot) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.FireEventToClient(handle, playerSlot); + } + + /// + /// Cancels a previously created game event that has not been fired. + /// + public void Cancel() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.CancelCreatedEvent(handle); + } + + /// + /// Retrieves the boolean value of a game event's key. + /// + /// The key for which to retrieve the boolean value. + /// The boolean value associated with the key. + public Bool8 GetBool(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventBool(handle, key); + } + + /// + /// Retrieves the float value of a game event's key. + /// + /// The key for which to retrieve the float value. + /// The float value associated with the key. + public float GetFloat(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventFloat(handle, key); + } + + /// + /// Retrieves the integer value of a game event's key. + /// + /// The key for which to retrieve the integer value. + /// The integer value associated with the key. + public int GetInt(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventInt(handle, key); + } + + /// + /// Retrieves the long integer value of a game event's key. + /// + /// The key for which to retrieve the long integer value. + /// The long integer value associated with the key. + public ulong GetUInt64(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventUInt64(handle, key); + } + + /// + /// Retrieves the string value of a game event's key. + /// + /// The key for which to retrieve the string value. + /// A string where the result will be stored. + public string GetString(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventString(handle, key); + } + + /// + /// Retrieves the pointer value of a game event's key. + /// + /// The key for which to retrieve the pointer value. + /// The pointer value associated with the key. + public nint GetPtr(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventPtr(handle, key); + } + + /// + /// Retrieves the player controller address of a game event's key. + /// + /// The key for which to retrieve the player controller address. + /// A pointer to the player controller associated with the key. + public nint GetPlayerController(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventPlayerController(handle, key); + } + + /// + /// Retrieves the player index of a game event's key. + /// + /// The key for which to retrieve the player index. + /// The player index associated with the key. + public int GetPlayerIndex(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventPlayerIndex(handle, key); + } + + /// + /// Retrieves the player pawn address of a game event's key. + /// + /// The key for which to retrieve the player pawn address. + /// A pointer to the player pawn associated with the key. + public nint GetPlayerPawn(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventPlayerPawn(handle, key); + } + + /// + /// Retrieves the entity address of a game event's key. + /// + /// The key for which to retrieve the entity address. + /// A pointer to the entity associated with the key. + public nint GetEntity(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventEntity(handle, key); + } + + /// + /// Retrieves the entity index of a game event's key. + /// + /// The key for which to retrieve the entity index. + /// The entity index associated with the key. + public int GetEntityIndex(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventEntityIndex(handle, key); + } + + /// + /// Retrieves the entity handle of a game event's key. + /// + /// The key for which to retrieve the entity handle. + /// The entity handle associated with the key. + public int GetEntityHandle(string key) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventEntityHandle(handle, key); + } + + /// + /// Retrieves the name of a game event. + /// + /// A string where the result will be stored. + public string GetName() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetEventName(handle); + } + + /// + /// Sets the boolean value of a game event's key. + /// + /// The key for which to set the boolean value. + /// The boolean value to set. + public void SetBool(string key, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventBool(handle, key, value); + } + + /// + /// Sets the floating point value of a game event's key. + /// + /// The key for which to set the float value. + /// The float value to set. + public void SetFloat(string key, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventFloat(handle, key, value); + } + + /// + /// Sets the integer value of a game event's key. + /// + /// The key for which to set the integer value. + /// The integer value to set. + public void SetInt(string key, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventInt(handle, key, value); + } + + /// + /// Sets the long integer value of a game event's key. + /// + /// The key for which to set the long integer value. + /// The long integer value to set. + public void SetUInt64(string key, ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventUInt64(handle, key, value); + } + + /// + /// Sets the string value of a game event's key. + /// + /// The key for which to set the string value. + /// The string value to set. + public void SetString(string key, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventString(handle, key, value); + } + + /// + /// Sets the pointer value of a game event's key. + /// + /// The key for which to set the pointer value. + /// The pointer value to set. + public void SetPtr(string key, nint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventPtr(handle, key, value); + } + + /// + /// Sets the player controller address of a game event's key. + /// + /// The key for which to set the player controller address. + /// A pointer to the player controller to set. + public void SetPlayerController(string key, nint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventPlayerController(handle, key, value); + } + + /// + /// Sets the player index value of a game event's key. + /// + /// The key for which to set the player index value. + /// The player index value to set. + public void SetPlayerIndex(string key, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventPlayerIndex(handle, key, value); + } + + /// + /// Sets the entity address of a game event's key. + /// + /// The key for which to set the entity address. + /// A pointer to the entity to set. + public void SetEntity(string key, nint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventEntity(handle, key, value); + } + + /// + /// Sets the entity index of a game event's key. + /// + /// The key for which to set the entity index. + /// The entity index value to set. + public void SetEntityIndex(string key, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventEntityIndex(handle, key, value); + } + + /// + /// Sets the entity handle of a game event's key. + /// + /// The key for which to set the entity handle. + /// The entity handle value to set. + public void SetEntityHandle(string key, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventEntityHandle(handle, key, value); + } + + /// + /// Sets whether an event's broadcasting will be disabled or not. + /// + /// A boolean indicating whether to disable broadcasting. + public void SetBroadcast(Bool8 dontBroadcast) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetEventBroadcast(handle, dontBroadcast); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/gameconfig.cs b/PlugifyProfiler/imported/s2sdk/gameconfig.cs new file mode 100644 index 0000000..69f45eb --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/gameconfig.cs @@ -0,0 +1,332 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: gameconfig) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Closes a game configuration file. + /// + /// An id to the game configuration to be closed. + internal static delegate* CloseGameConfigFile = &___CloseGameConfigFile; + internal static delegate* unmanaged[Cdecl] __CloseGameConfigFile; + private static void ___CloseGameConfigFile(uint id) + { + __CloseGameConfigFile(id); + } + + /// + /// Loads a game configuration file. + /// + /// The paths to the game configuration file to be loaded. + /// A id to the loaded game configuration object, or -1 if loading fails. + internal static delegate* LoadGameConfigFile = &___LoadGameConfigFile; + internal static delegate* unmanaged[Cdecl] __LoadGameConfigFile; + private static uint ___LoadGameConfigFile(string[] paths) + { + uint __retVal; + var __paths = NativeMethods.ConstructVectorString(paths, paths.Length); + try { + __retVal = __LoadGameConfigFile(&__paths); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorString(&__paths); + } + return __retVal; + } + + /// + /// Retrieves a patch associated with the game configuration. + /// + /// An id to the game configuration from which to retrieve the patch. + /// The name of the patch to be retrieved. + /// A string where the patch will be stored. + internal static delegate* GetGameConfigPatch = &___GetGameConfigPatch; + internal static delegate* unmanaged[Cdecl] __GetGameConfigPatch; + private static string ___GetGameConfigPatch(uint id, string name) + { + string __retVal; + String192 __retVal_native; + var __name = NativeMethods.ConstructString(name); + try { + __retVal_native = __GetGameConfigPatch(id, &__name); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves the offset associated with a name from the game configuration. + /// + /// An id to the game configuration from which to retrieve the offset. + /// The name whose offset is to be retrieved. + /// The offset associated with the specified name. + internal static delegate* GetGameConfigOffset = &___GetGameConfigOffset; + internal static delegate* unmanaged[Cdecl] __GetGameConfigOffset; + private static int ___GetGameConfigOffset(uint id, string name) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetGameConfigOffset(id, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves the address associated with a name from the game configuration. + /// + /// An id to the game configuration from which to retrieve the address. + /// The name whose address is to be retrieved. + /// A pointer to the address associated with the specified name. + internal static delegate* GetGameConfigAddress = &___GetGameConfigAddress; + internal static delegate* unmanaged[Cdecl] __GetGameConfigAddress; + private static nint ___GetGameConfigAddress(uint id, string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetGameConfigAddress(id, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves a vtable associated with the game configuration. + /// + /// An id to the game configuration from which to retrieve the vtable. + /// The name of the vtable to be retrieved. + /// A pointer to the vtable associated with the specified name + internal static delegate* GetGameConfigVTable = &___GetGameConfigVTable; + internal static delegate* unmanaged[Cdecl] __GetGameConfigVTable; + private static nint ___GetGameConfigVTable(uint id, string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetGameConfigVTable(id, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves the signature associated with a name from the game configuration. + /// + /// An id to the game configuration from which to retrieve the signature. + /// The name whose signature is to be resolved and retrieved. + /// A pointer to the signature associated with the specified name. + internal static delegate* GetGameConfigSignature = &___GetGameConfigSignature; + internal static delegate* unmanaged[Cdecl] __GetGameConfigSignature; + private static nint ___GetGameConfigSignature(uint id, string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetGameConfigSignature(id, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for GameConfig handle. + /// + internal sealed unsafe class GameConfig : SafeHandle + { + /// + /// Loads a game configuration file. + /// + /// The paths to the game configuration file to be loaded. + public GameConfig(string[] paths) : this(s2sdk.LoadGameConfigFile(paths), Ownership.Owned) + { + } + + /// + /// Internal constructor for creating GameConfig from existing handle + /// + public GameConfig(uint handle, Ownership ownership = Ownership.Borrowed) : base((nint)handle, ownsHandle: ownership == Ownership.Owned) + { + } + + /// + /// Releases the handle (called automatically by SafeHandle) + /// + protected override bool ReleaseHandle() + { + s2sdk.CloseGameConfigFile((uint)handle); + return true; + } + + /// + /// Checks if the GameConfig has a valid handle + /// + public override bool IsInvalid => handle == 0; + + /// + /// Gets the underlying handle + /// + public uint Handle => (uint)handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != 0; + + /// + /// Gets the underlying handle + /// + public uint Get() => (uint)handle; + + /// + /// Releases ownership of the handle and returns it + /// + public uint Release() + { + var h = handle; + SetHandleAsInvalid(); + return (uint)h; + } + + /// + /// Disposes the handle + /// + public void Reset() + { + Dispose(); + } + + /// + /// Retrieves a patch associated with the game configuration. + /// + /// The name of the patch to be retrieved. + /// A string where the patch will be stored. + public string GetPatch(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.GetGameConfigPatch(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Retrieves the offset associated with a name from the game configuration. + /// + /// The name whose offset is to be retrieved. + /// The offset associated with the specified name. + public int GetOffset(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.GetGameConfigOffset(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Retrieves the address associated with a name from the game configuration. + /// + /// The name whose address is to be retrieved. + /// A pointer to the address associated with the specified name. + public nint GetAddress(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.GetGameConfigAddress(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Retrieves a vtable associated with the game configuration. + /// + /// The name of the vtable to be retrieved. + /// A pointer to the vtable associated with the specified name + public nint GetVTable(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.GetGameConfigVTable(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Retrieves the signature associated with a name from the game configuration. + /// + /// The name whose signature is to be resolved and retrieved. + /// A pointer to the signature associated with the specified name. + public nint GetSignature(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.GetGameConfigSignature(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/gamerules.cs b/PlugifyProfiler/imported/s2sdk/gamerules.cs new file mode 100644 index 0000000..aebb2ca --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/gamerules.cs @@ -0,0 +1,104 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: gamerules) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Retrieves the pointer to the current game rules proxy instance. + /// + /// A pointer to the game rules entity instance. + internal static delegate* GetGameRulesProxy = &___GetGameRulesProxy; + internal static delegate* unmanaged[Cdecl] __GetGameRulesProxy; + private static nint ___GetGameRulesProxy() + { + nint __retVal = __GetGameRulesProxy(); + return __retVal; + } + + /// + /// Retrieves the pointer to the current game rules instance. + /// + /// A pointer to the game rules object. + internal static delegate* GetGameRules = &___GetGameRules; + internal static delegate* unmanaged[Cdecl] __GetGameRules; + private static nint ___GetGameRules() + { + nint __retVal = __GetGameRules(); + return __retVal; + } + + /// + /// Retrieves the team manager instance for a specified team. + /// + /// The numeric identifier of the team. + /// A pointer to the corresponding CTeam instance, or nullptr if the team was not found. + internal static delegate* GetGameTeamManager = &___GetGameTeamManager; + internal static delegate* unmanaged[Cdecl] __GetGameTeamManager; + private static nint ___GetGameTeamManager(int team) + { + nint __retVal = __GetGameTeamManager(team); + return __retVal; + } + + /// + /// Retrieves the current score of a specified team. + /// + /// The numeric identifier of the team. + /// The current score of the team, or -1 if the team could not be found. + internal static delegate* GetGameTeamScore = &___GetGameTeamScore; + internal static delegate* unmanaged[Cdecl] __GetGameTeamScore; + private static int ___GetGameTeamScore(int team) + { + int __retVal = __GetGameTeamScore(team); + return __retVal; + } + + /// + /// Retrieves the number of players on a specified team. + /// + /// The numeric identifier of the team (e.g., CS_TEAM_T, CS_TEAM_CT, CS_TEAM_SPECTATOR). + /// The number of players on the team, or -1 if game rules are unavailable. + internal static delegate* GetGamePlayerCount = &___GetGamePlayerCount; + internal static delegate* unmanaged[Cdecl] __GetGamePlayerCount; + private static int ___GetGamePlayerCount(int team) + { + int __retVal = __GetGamePlayerCount(team); + return __retVal; + } + + /// + /// Returns the total number of rounds played in the current match. + /// + /// The total number of rounds played, or -1 if the game rules are unavailable. + internal static delegate* GetGameTotalRoundsPlayed = &___GetGameTotalRoundsPlayed; + internal static delegate* unmanaged[Cdecl] __GetGameTotalRoundsPlayed; + private static int ___GetGameTotalRoundsPlayed() + { + int __retVal = __GetGameTotalRoundsPlayed(); + return __retVal; + } + + /// + /// Forces the round to end with a specified reason and delay. + /// + /// Time (in seconds) to delay before the next round starts. + /// The reason for ending the round, defined by the CSRoundEndReason enum. + internal static delegate* TerminateRound = &___TerminateRound; + internal static delegate* unmanaged[Cdecl] __TerminateRound; + private static void ___TerminateRound(float delay, CSRoundEndReason reason) + { + __TerminateRound(delay, reason); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/keyvalues.cs b/PlugifyProfiler/imported/s2sdk/keyvalues.cs new file mode 100644 index 0000000..db5f4f8 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/keyvalues.cs @@ -0,0 +1,1055 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: keyvalues) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a new KeyValues instance + /// + /// The name to assign to this KeyValues instance + /// Pointer to the newly created KeyValues object + internal static delegate* Kv1Create = &___Kv1Create; + internal static delegate* unmanaged[Cdecl] __Kv1Create; + private static nint ___Kv1Create(string setName) + { + nint __retVal; + var __setName = NativeMethods.ConstructString(setName); + try { + __retVal = __Kv1Create(&__setName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__setName); + } + return __retVal; + } + + /// + /// Destroys a KeyValues instance + /// + /// Pointer to the KeyValues object to destroy + internal static delegate* Kv1Destroy = &___Kv1Destroy; + internal static delegate* unmanaged[Cdecl] __Kv1Destroy; + private static void ___Kv1Destroy(nint kv) + { + __Kv1Destroy(kv); + } + + /// + /// Gets the section name of a KeyValues instance + /// + /// Pointer to the KeyValues object + /// The name of the KeyValues section + internal static delegate* Kv1GetName = &___Kv1GetName; + internal static delegate* unmanaged[Cdecl] __Kv1GetName; + private static string ___Kv1GetName(nint kv) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __Kv1GetName(kv); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Sets the section name of a KeyValues instance + /// + /// Pointer to the KeyValues object + /// The new name to assign to this KeyValues section + internal static delegate* Kv1SetName = &___Kv1SetName; + internal static delegate* unmanaged[Cdecl] __Kv1SetName; + private static void ___Kv1SetName(nint kv, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv1SetName(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Finds a key by name + /// + /// Pointer to the KeyValues object to search in + /// The name of the key to find + /// Pointer to the found KeyValues subkey, or NULL if not found + internal static delegate* Kv1FindKey = &___Kv1FindKey; + internal static delegate* unmanaged[Cdecl] __Kv1FindKey; + private static nint ___Kv1FindKey(nint kv, string keyName) + { + nint __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1FindKey(kv, &__keyName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Finds a key by name or creates it if it doesn't exist + /// + /// Pointer to the KeyValues object to search in + /// The name of the key to find or create + /// Pointer to the found or newly created KeyValues subkey (never NULL) + internal static delegate* Kv1FindOrCreateKey = &___Kv1FindOrCreateKey; + internal static delegate* unmanaged[Cdecl] __Kv1FindOrCreateKey; + private static nint ___Kv1FindOrCreateKey(nint kv, string keyName) + { + nint __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1FindOrCreateKey(kv, &__keyName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Creates a new subkey with the specified name + /// + /// Pointer to the parent KeyValues object + /// The name for the new key + /// Pointer to the newly created KeyValues subkey + internal static delegate* Kv1CreateKey = &___Kv1CreateKey; + internal static delegate* unmanaged[Cdecl] __Kv1CreateKey; + private static nint ___Kv1CreateKey(nint kv, string keyName) + { + nint __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1CreateKey(kv, &__keyName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Creates a new subkey with an autogenerated name + /// + /// Pointer to the parent KeyValues object + /// Pointer to the newly created KeyValues subkey + internal static delegate* Kv1CreateNewKey = &___Kv1CreateNewKey; + internal static delegate* unmanaged[Cdecl] __Kv1CreateNewKey; + private static nint ___Kv1CreateNewKey(nint kv) + { + nint __retVal = __Kv1CreateNewKey(kv); + return __retVal; + } + + /// + /// Adds a subkey to this KeyValues instance + /// + /// Pointer to the parent KeyValues object + /// Pointer to the KeyValues object to add as a child + internal static delegate* Kv1AddSubKey = &___Kv1AddSubKey; + internal static delegate* unmanaged[Cdecl] __Kv1AddSubKey; + private static void ___Kv1AddSubKey(nint kv, nint subKey) + { + __Kv1AddSubKey(kv, subKey); + } + + /// + /// Gets the first subkey in the list + /// + /// Pointer to the parent KeyValues object + /// Pointer to the first subkey, or NULL if there are no children + internal static delegate* Kv1GetFirstSubKey = &___Kv1GetFirstSubKey; + internal static delegate* unmanaged[Cdecl] __Kv1GetFirstSubKey; + private static nint ___Kv1GetFirstSubKey(nint kv) + { + nint __retVal = __Kv1GetFirstSubKey(kv); + return __retVal; + } + + /// + /// Gets the next sibling key in the list + /// + /// Pointer to the current KeyValues object + /// Pointer to the next sibling key, or NULL if this is the last sibling + internal static delegate* Kv1GetNextKey = &___Kv1GetNextKey; + internal static delegate* unmanaged[Cdecl] __Kv1GetNextKey; + private static nint ___Kv1GetNextKey(nint kv) + { + nint __retVal = __Kv1GetNextKey(kv); + return __retVal; + } + + /// + /// Gets a color value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the color from + /// The default color value to return if the key is not found + /// The color value as a 32-bit integer (RGBA) + internal static delegate* Kv1GetColor = &___Kv1GetColor; + internal static delegate* unmanaged[Cdecl] __Kv1GetColor; + private static int ___Kv1GetColor(nint kv, string keyName, int defaultValue) + { + int __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1GetColor(kv, &__keyName, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Sets a color value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the color for + /// The color value as a 32-bit integer (RGBA) + internal static delegate* Kv1SetColor = &___Kv1SetColor; + internal static delegate* unmanaged[Cdecl] __Kv1SetColor; + private static void ___Kv1SetColor(nint kv, string keyName, int value) + { + var __keyName = NativeMethods.ConstructString(keyName); + try { + __Kv1SetColor(kv, &__keyName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + } + + /// + /// Gets an integer value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the integer from + /// The default value to return if the key is not found + /// The integer value associated with the key, or defaultValue if not found + internal static delegate* Kv1GetInt = &___Kv1GetInt; + internal static delegate* unmanaged[Cdecl] __Kv1GetInt; + private static int ___Kv1GetInt(nint kv, string keyName, int defaultValue) + { + int __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1GetInt(kv, &__keyName, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Sets an integer value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the integer for + /// The integer value to set + internal static delegate* Kv1SetInt = &___Kv1SetInt; + internal static delegate* unmanaged[Cdecl] __Kv1SetInt; + private static void ___Kv1SetInt(nint kv, string keyName, int value) + { + var __keyName = NativeMethods.ConstructString(keyName); + try { + __Kv1SetInt(kv, &__keyName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + } + + /// + /// Gets a float value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the float from + /// The default value to return if the key is not found + /// The float value associated with the key, or defaultValue if not found + internal static delegate* Kv1GetFloat = &___Kv1GetFloat; + internal static delegate* unmanaged[Cdecl] __Kv1GetFloat; + private static float ___Kv1GetFloat(nint kv, string keyName, float defaultValue) + { + float __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1GetFloat(kv, &__keyName, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Sets a float value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the float for + /// The float value to set + internal static delegate* Kv1SetFloat = &___Kv1SetFloat; + internal static delegate* unmanaged[Cdecl] __Kv1SetFloat; + private static void ___Kv1SetFloat(nint kv, string keyName, float value) + { + var __keyName = NativeMethods.ConstructString(keyName); + try { + __Kv1SetFloat(kv, &__keyName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + } + + /// + /// Gets a string value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the string from + /// The default string to return if the key is not found + /// The string value associated with the key, or defaultValue if not found + internal static delegate* Kv1GetString = &___Kv1GetString; + internal static delegate* unmanaged[Cdecl] __Kv1GetString; + private static string ___Kv1GetString(nint kv, string keyName, string defaultValue) + { + string __retVal; + String192 __retVal_native; + var __keyName = NativeMethods.ConstructString(keyName); + var __defaultValue = NativeMethods.ConstructString(defaultValue); + try { + __retVal_native = __Kv1GetString(kv, &__keyName, &__defaultValue); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__keyName); + NativeMethods.DestroyString(&__defaultValue); + } + return __retVal; + } + + /// + /// Sets a string value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the string for + /// The string value to set + internal static delegate* Kv1SetString = &___Kv1SetString; + internal static delegate* unmanaged[Cdecl] __Kv1SetString; + private static void ___Kv1SetString(nint kv, string keyName, string value) + { + var __keyName = NativeMethods.ConstructString(keyName); + var __value = NativeMethods.ConstructString(value); + try { + __Kv1SetString(kv, &__keyName, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Gets a pointer value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the pointer from + /// The default pointer to return if the key is not found + /// The pointer value associated with the key, or defaultValue if not found + internal static delegate* Kv1GetPtr = &___Kv1GetPtr; + internal static delegate* unmanaged[Cdecl] __Kv1GetPtr; + private static nint ___Kv1GetPtr(nint kv, string keyName, nint defaultValue) + { + nint __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1GetPtr(kv, &__keyName, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Sets a pointer value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the pointer for + /// The pointer value to set + internal static delegate* Kv1SetPtr = &___Kv1SetPtr; + internal static delegate* unmanaged[Cdecl] __Kv1SetPtr; + private static void ___Kv1SetPtr(nint kv, string keyName, nint value) + { + var __keyName = NativeMethods.ConstructString(keyName); + try { + __Kv1SetPtr(kv, &__keyName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + } + + /// + /// Gets a boolean value from a key + /// + /// Pointer to the KeyValues object + /// The name of the key to retrieve the boolean from + /// The default value to return if the key is not found + /// The boolean value associated with the key, or defaultValue if not found + internal static delegate* Kv1GetBool = &___Kv1GetBool; + internal static delegate* unmanaged[Cdecl] __Kv1GetBool; + private static Bool8 ___Kv1GetBool(nint kv, string keyName, Bool8 defaultValue) + { + Bool8 __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1GetBool(kv, &__keyName, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + /// + /// Sets a boolean value for a key + /// + /// Pointer to the KeyValues object + /// The name of the key to set the boolean for + /// The boolean value to set + internal static delegate* Kv1SetBool = &___Kv1SetBool; + internal static delegate* unmanaged[Cdecl] __Kv1SetBool; + private static void ___Kv1SetBool(nint kv, string keyName, Bool8 value) + { + var __keyName = NativeMethods.ConstructString(keyName); + try { + __Kv1SetBool(kv, &__keyName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + } + + /// + /// Makes a deep copy of a KeyValues tree + /// + /// Pointer to the KeyValues object to copy + /// Pointer to the newly allocated copy of the KeyValues tree + internal static delegate* Kv1MakeCopy = &___Kv1MakeCopy; + internal static delegate* unmanaged[Cdecl] __Kv1MakeCopy; + private static nint ___Kv1MakeCopy(nint kv) + { + nint __retVal = __Kv1MakeCopy(kv); + return __retVal; + } + + /// + /// Clears all subkeys and the current value + /// + /// Pointer to the KeyValues object to clear + internal static delegate* Kv1Clear = &___Kv1Clear; + internal static delegate* unmanaged[Cdecl] __Kv1Clear; + private static void ___Kv1Clear(nint kv) + { + __Kv1Clear(kv); + } + + /// + /// Checks if a key exists and has no value or subkeys + /// + /// Pointer to the KeyValues object + /// The name of the key to check + /// true if the key exists and is empty, false otherwise + internal static delegate* Kv1IsEmpty = &___Kv1IsEmpty; + internal static delegate* unmanaged[Cdecl] __Kv1IsEmpty; + private static Bool8 ___Kv1IsEmpty(nint kv, string keyName) + { + Bool8 __retVal; + var __keyName = NativeMethods.ConstructString(keyName); + try { + __retVal = __Kv1IsEmpty(kv, &__keyName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__keyName); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for KeyValues pointer. + /// + internal sealed unsafe class KeyValues1 : SafeHandle + { + /// + /// Creates a new KeyValues instance + /// + /// The name to assign to this KeyValues instance + public KeyValues1(string setName) : this(s2sdk.Kv1Create(setName), Ownership.Owned) + { + } + + /// + /// Makes a deep copy of a KeyValues tree + /// + /// Pointer to the KeyValues object to copy + public KeyValues1(nint kv) : this(s2sdk.Kv1MakeCopy(kv), Ownership.Owned) + { + } + + /// + /// Internal constructor for creating KeyValues1 from existing handle + /// + public KeyValues1(nint handle, Ownership ownership) : base((nint)handle, ownsHandle: ownership == Ownership.Owned) + { + } + + /// + /// Releases the handle (called automatically by SafeHandle) + /// + protected override bool ReleaseHandle() + { + s2sdk.Kv1Destroy((nint)handle); + return true; + } + + /// + /// Checks if the KeyValues1 has a valid handle + /// + public override bool IsInvalid => handle == nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Handle => (nint)handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => (nint)handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + SetHandleAsInvalid(); + return (nint)h; + } + + /// + /// Disposes the handle + /// + public void Reset() + { + Dispose(); + } + + /// + /// Gets the section name of a KeyValues instance + /// + /// The name of the KeyValues section + public string GetName() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetName(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the section name of a KeyValues instance + /// + /// The new name to assign to this KeyValues section + public void SetName(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetName(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a key by name + /// + /// The name of the key to find + /// Pointer to the found KeyValues subkey, or NULL if not found + public KeyValues1 FindKey(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1FindKey(Handle, keyName), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a key by name or creates it if it doesn't exist + /// + /// The name of the key to find or create + /// Pointer to the found or newly created KeyValues subkey (never NULL) + public KeyValues1 FindOrCreateKey(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1FindOrCreateKey(Handle, keyName), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Creates a new subkey with the specified name + /// + /// The name for the new key + /// Pointer to the newly created KeyValues subkey + public KeyValues1 CreateKey(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1CreateKey(Handle, keyName), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Creates a new subkey with an autogenerated name + /// + /// Pointer to the newly created KeyValues subkey + public KeyValues1 CreateNewKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1CreateNewKey(Handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a subkey to this KeyValues instance + /// + /// Pointer to the KeyValues object to add as a child + public void AddSubKey(KeyValues1 subKey) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1AddSubKey(Handle, subKey.Get()); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the first subkey in the list + /// + /// Pointer to the first subkey, or NULL if there are no children + public KeyValues1 GetFirstSubKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1GetFirstSubKey(Handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the next sibling key in the list + /// + /// Pointer to the next sibling key, or NULL if this is the last sibling + public KeyValues1 GetNextKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues1(s2sdk.Kv1GetNextKey(Handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a color value from a key + /// + /// The name of the key to retrieve the color from + /// The default color value to return if the key is not found + /// The color value as a 32-bit integer (RGBA) + public int GetColor(string keyName, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetColor(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a color value for a key + /// + /// The name of the key to set the color for + /// The color value as a 32-bit integer (RGBA) + public void SetColor(string keyName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetColor(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an integer value from a key + /// + /// The name of the key to retrieve the integer from + /// The default value to return if the key is not found + /// The integer value associated with the key, or defaultValue if not found + public int GetInt(string keyName, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetInt(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets an integer value for a key + /// + /// The name of the key to set the integer for + /// The integer value to set + public void SetInt(string keyName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetInt(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a float value from a key + /// + /// The name of the key to retrieve the float from + /// The default value to return if the key is not found + /// The float value associated with the key, or defaultValue if not found + public float GetFloat(string keyName, float defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetFloat(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a float value for a key + /// + /// The name of the key to set the float for + /// The float value to set + public void SetFloat(string keyName, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetFloat(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a string value from a key + /// + /// The name of the key to retrieve the string from + /// The default string to return if the key is not found + /// The string value associated with the key, or defaultValue if not found + public string GetString(string keyName, string defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetString(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a string value for a key + /// + /// The name of the key to set the string for + /// The string value to set + public void SetString(string keyName, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetString(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a pointer value from a key + /// + /// The name of the key to retrieve the pointer from + /// The default pointer to return if the key is not found + /// The pointer value associated with the key, or defaultValue if not found + public nint GetPtr(string keyName, nint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetPtr(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a pointer value for a key + /// + /// The name of the key to set the pointer for + /// The pointer value to set + public void SetPtr(string keyName, nint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetPtr(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a boolean value from a key + /// + /// The name of the key to retrieve the boolean from + /// The default value to return if the key is not found + /// The boolean value associated with the key, or defaultValue if not found + public Bool8 GetBool(string keyName, Bool8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetBool(Handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a boolean value for a key + /// + /// The name of the key to set the boolean for + /// The boolean value to set + public void SetBool(string keyName, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetBool(Handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Clears all subkeys and the current value + /// + public void Clear() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1Clear(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if a key exists and has no value or subkeys + /// + /// The name of the key to check + /// true if the key exists and is empty, false otherwise + public Bool8 IsEmpty(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1IsEmpty(Handle, keyName); + } + finally + { + if (success) DangerousRelease(); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/keyvalues3.cs b/PlugifyProfiler/imported/s2sdk/keyvalues3.cs new file mode 100644 index 0000000..9220b1a --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/keyvalues3.cs @@ -0,0 +1,6777 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: keyvalues3) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a new KeyValues3 object with specified type and subtype + /// + /// The KV3 type enumeration value + /// The KV3 subtype enumeration value + /// Pointer to the newly created KeyValues3 object + internal static delegate* Kv3Create = &___Kv3Create; + internal static delegate* unmanaged[Cdecl] __Kv3Create; + private static nint ___Kv3Create(int type, int subtype) + { + nint __retVal = __Kv3Create(type, subtype); + return __retVal; + } + + /// + /// Creates a new KeyValues3 object with cluster element, type, and subtype + /// + /// The cluster element index + /// The KV3 type enumeration value + /// The KV3 subtype enumeration value + /// Pointer to the newly created KeyValues3 object + internal static delegate* Kv3CreateWithCluster = &___Kv3CreateWithCluster; + internal static delegate* unmanaged[Cdecl] __Kv3CreateWithCluster; + private static nint ___Kv3CreateWithCluster(int cluster_elem, int type, int subtype) + { + nint __retVal = __Kv3CreateWithCluster(cluster_elem, type, subtype); + return __retVal; + } + + /// + /// Creates a copy of an existing KeyValues3 object + /// + /// Pointer to the KeyValues3 object to copy + /// Pointer to the newly created copy, or nullptr if other is null + internal static delegate* Kv3CreateCopy = &___Kv3CreateCopy; + internal static delegate* unmanaged[Cdecl] __Kv3CreateCopy; + private static nint ___Kv3CreateCopy(nint other) + { + nint __retVal = __Kv3CreateCopy(other); + return __retVal; + } + + /// + /// Destroys a KeyValues3 object and frees its memory + /// + /// Pointer to the KeyValues3 object to destroy + internal static delegate* Kv3Destroy = &___Kv3Destroy; + internal static delegate* unmanaged[Cdecl] __Kv3Destroy; + private static void ___Kv3Destroy(nint kv) + { + __Kv3Destroy(kv); + } + + /// + /// Copies data from another KeyValues3 object + /// + /// Pointer to the destination KeyValues3 object + /// Pointer to the source KeyValues3 object + internal static delegate* Kv3CopyFrom = &___Kv3CopyFrom; + internal static delegate* unmanaged[Cdecl] __Kv3CopyFrom; + private static void ___Kv3CopyFrom(nint kv, nint other) + { + __Kv3CopyFrom(kv, other); + } + + /// + /// Overlays keys from another KeyValues3 object + /// + /// Pointer to the destination KeyValues3 object + /// Pointer to the source KeyValues3 object + /// Whether to perform a deep overlay + internal static delegate* Kv3OverlayKeysFrom = &___Kv3OverlayKeysFrom; + internal static delegate* unmanaged[Cdecl] __Kv3OverlayKeysFrom; + private static void ___Kv3OverlayKeysFrom(nint kv, nint other, Bool8 depth) + { + __Kv3OverlayKeysFrom(kv, other, depth); + } + + /// + /// Gets the context associated with a KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Pointer to the CKeyValues3Context, or nullptr if kv is null + internal static delegate* Kv3GetContext = &___Kv3GetContext; + internal static delegate* unmanaged[Cdecl] __Kv3GetContext; + private static nint ___Kv3GetContext(nint kv) + { + nint __retVal = __Kv3GetContext(kv); + return __retVal; + } + + /// + /// Gets the metadata associated with a KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Pointer to store the context pointer + /// Pointer to the KV3MetaData_t structure, or nullptr if kv is null + internal static delegate* Kv3GetMetaData = &___Kv3GetMetaData; + internal static delegate* unmanaged[Cdecl] __Kv3GetMetaData; + private static nint ___Kv3GetMetaData(nint kv, nint ppCtx) + { + nint __retVal = __Kv3GetMetaData(kv, ppCtx); + return __retVal; + } + + /// + /// Checks if a specific flag is set + /// + /// Pointer to the KeyValues3 object + /// The flag to check + /// true if the flag is set, false otherwise + internal static delegate* Kv3HasFlag = &___Kv3HasFlag; + internal static delegate* unmanaged[Cdecl] __Kv3HasFlag; + private static Bool8 ___Kv3HasFlag(nint kv, byte flag) + { + Bool8 __retVal = __Kv3HasFlag(kv, flag); + return __retVal; + } + + /// + /// Checks if any flags are set + /// + /// Pointer to the KeyValues3 object + /// true if any flags are set, false otherwise + internal static delegate* Kv3HasAnyFlags = &___Kv3HasAnyFlags; + internal static delegate* unmanaged[Cdecl] __Kv3HasAnyFlags; + private static Bool8 ___Kv3HasAnyFlags(nint kv) + { + Bool8 __retVal = __Kv3HasAnyFlags(kv); + return __retVal; + } + + /// + /// Gets all flags as a bitmask + /// + /// Pointer to the KeyValues3 object + /// Bitmask of all flags, or 0 if kv is null + internal static delegate* Kv3GetAllFlags = &___Kv3GetAllFlags; + internal static delegate* unmanaged[Cdecl] __Kv3GetAllFlags; + private static byte ___Kv3GetAllFlags(nint kv) + { + byte __retVal = __Kv3GetAllFlags(kv); + return __retVal; + } + + /// + /// Sets all flags from a bitmask + /// + /// Pointer to the KeyValues3 object + /// Bitmask of flags to set + internal static delegate* Kv3SetAllFlags = &___Kv3SetAllFlags; + internal static delegate* unmanaged[Cdecl] __Kv3SetAllFlags; + private static void ___Kv3SetAllFlags(nint kv, byte flags) + { + __Kv3SetAllFlags(kv, flags); + } + + /// + /// Sets or clears a specific flag + /// + /// Pointer to the KeyValues3 object + /// The flag to modify + /// true to set the flag, false to clear it + internal static delegate* Kv3SetFlag = &___Kv3SetFlag; + internal static delegate* unmanaged[Cdecl] __Kv3SetFlag; + private static void ___Kv3SetFlag(nint kv, byte flag, Bool8 state) + { + __Kv3SetFlag(kv, flag, state); + } + + /// + /// Gets the basic type of the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// The type enumeration value, or 0 if kv is null + internal static delegate* Kv3GetType = &___Kv3GetType; + internal static delegate* unmanaged[Cdecl] __Kv3GetType; + private static byte ___Kv3GetType(nint kv) + { + byte __retVal = __Kv3GetType(kv); + return __retVal; + } + + /// + /// Gets the extended type of the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// The extended type enumeration value, or 0 if kv is null + internal static delegate* Kv3GetTypeEx = &___Kv3GetTypeEx; + internal static delegate* unmanaged[Cdecl] __Kv3GetTypeEx; + private static byte ___Kv3GetTypeEx(nint kv) + { + byte __retVal = __Kv3GetTypeEx(kv); + return __retVal; + } + + /// + /// Gets the subtype of the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// The subtype enumeration value, or 0 if kv is null + internal static delegate* Kv3GetSubType = &___Kv3GetSubType; + internal static delegate* unmanaged[Cdecl] __Kv3GetSubType; + private static byte ___Kv3GetSubType(nint kv) + { + byte __retVal = __Kv3GetSubType(kv); + return __retVal; + } + + /// + /// Checks if the object has invalid member names + /// + /// Pointer to the KeyValues3 object + /// true if invalid member names exist, false otherwise + internal static delegate* Kv3HasInvalidMemberNames = &___Kv3HasInvalidMemberNames; + internal static delegate* unmanaged[Cdecl] __Kv3HasInvalidMemberNames; + private static Bool8 ___Kv3HasInvalidMemberNames(nint kv) + { + Bool8 __retVal = __Kv3HasInvalidMemberNames(kv); + return __retVal; + } + + /// + /// Sets the invalid member names flag + /// + /// Pointer to the KeyValues3 object + /// true to mark as having invalid member names, false otherwise + internal static delegate* Kv3SetHasInvalidMemberNames = &___Kv3SetHasInvalidMemberNames; + internal static delegate* unmanaged[Cdecl] __Kv3SetHasInvalidMemberNames; + private static void ___Kv3SetHasInvalidMemberNames(nint kv, Bool8 bValue) + { + __Kv3SetHasInvalidMemberNames(kv, bValue); + } + + /// + /// Gets the type as a string representation + /// + /// Pointer to the KeyValues3 object + /// String representation of the type, or empty string if kv is null + internal static delegate* Kv3GetTypeAsString = &___Kv3GetTypeAsString; + internal static delegate* unmanaged[Cdecl] __Kv3GetTypeAsString; + private static string ___Kv3GetTypeAsString(nint kv) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __Kv3GetTypeAsString(kv); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Gets the subtype as a string representation + /// + /// Pointer to the KeyValues3 object + /// String representation of the subtype, or empty string if kv is null + internal static delegate* Kv3GetSubTypeAsString = &___Kv3GetSubTypeAsString; + internal static delegate* unmanaged[Cdecl] __Kv3GetSubTypeAsString; + private static string ___Kv3GetSubTypeAsString(nint kv) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __Kv3GetSubTypeAsString(kv); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Converts the KeyValues3 object to a string representation + /// + /// Pointer to the KeyValues3 object + /// Formatting flags for the string conversion + /// String representation of the object, or empty string if kv is null + internal static delegate* Kv3ToString = &___Kv3ToString; + internal static delegate* unmanaged[Cdecl] __Kv3ToString; + private static string ___Kv3ToString(nint kv, uint flags) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __Kv3ToString(kv, flags); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Checks if the KeyValues3 object is null + /// + /// Pointer to the KeyValues3 object + /// true if the object is null or the pointer is null, false otherwise + internal static delegate* Kv3IsNull = &___Kv3IsNull; + internal static delegate* unmanaged[Cdecl] __Kv3IsNull; + private static Bool8 ___Kv3IsNull(nint kv) + { + Bool8 __retVal = __Kv3IsNull(kv); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to null + /// + /// Pointer to the KeyValues3 object + internal static delegate* Kv3SetToNull = &___Kv3SetToNull; + internal static delegate* unmanaged[Cdecl] __Kv3SetToNull; + private static void ___Kv3SetToNull(nint kv) + { + __Kv3SetToNull(kv); + } + + /// + /// Checks if the KeyValues3 object is an array + /// + /// Pointer to the KeyValues3 object + /// true if the object is an array, false otherwise + internal static delegate* Kv3IsArray = &___Kv3IsArray; + internal static delegate* unmanaged[Cdecl] __Kv3IsArray; + private static Bool8 ___Kv3IsArray(nint kv) + { + Bool8 __retVal = __Kv3IsArray(kv); + return __retVal; + } + + /// + /// Checks if the KeyValues3 object is a KV3 array + /// + /// Pointer to the KeyValues3 object + /// true if the object is a KV3 array, false otherwise + internal static delegate* Kv3IsKV3Array = &___Kv3IsKV3Array; + internal static delegate* unmanaged[Cdecl] __Kv3IsKV3Array; + private static Bool8 ___Kv3IsKV3Array(nint kv) + { + Bool8 __retVal = __Kv3IsKV3Array(kv); + return __retVal; + } + + /// + /// Checks if the KeyValues3 object is a table + /// + /// Pointer to the KeyValues3 object + /// true if the object is a table, false otherwise + internal static delegate* Kv3IsTable = &___Kv3IsTable; + internal static delegate* unmanaged[Cdecl] __Kv3IsTable; + private static Bool8 ___Kv3IsTable(nint kv) + { + Bool8 __retVal = __Kv3IsTable(kv); + return __retVal; + } + + /// + /// Checks if the KeyValues3 object is a string + /// + /// Pointer to the KeyValues3 object + /// true if the object is a string, false otherwise + internal static delegate* Kv3IsString = &___Kv3IsString; + internal static delegate* unmanaged[Cdecl] __Kv3IsString; + private static Bool8 ___Kv3IsString(nint kv) + { + Bool8 __retVal = __Kv3IsString(kv); + return __retVal; + } + + /// + /// Gets the boolean value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// Boolean value or defaultValue + internal static delegate* Kv3GetBool = &___Kv3GetBool; + internal static delegate* unmanaged[Cdecl] __Kv3GetBool; + private static Bool8 ___Kv3GetBool(nint kv, Bool8 defaultValue) + { + Bool8 __retVal = __Kv3GetBool(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the char value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// Char value or defaultValue + internal static delegate* Kv3GetChar = &___Kv3GetChar; + internal static delegate* unmanaged[Cdecl] __Kv3GetChar; + private static Char8 ___Kv3GetChar(nint kv, Char8 defaultValue) + { + Char8 __retVal = __Kv3GetChar(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the 32-bit Unicode character value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// 32-bit Unicode character value or defaultValue + internal static delegate* Kv3GetUChar32 = &___Kv3GetUChar32; + internal static delegate* unmanaged[Cdecl] __Kv3GetUChar32; + private static uint ___Kv3GetUChar32(nint kv, uint defaultValue) + { + uint __retVal = __Kv3GetUChar32(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the signed 8-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// int8_t value or defaultValue + internal static delegate* Kv3GetInt8 = &___Kv3GetInt8; + internal static delegate* unmanaged[Cdecl] __Kv3GetInt8; + private static sbyte ___Kv3GetInt8(nint kv, sbyte defaultValue) + { + sbyte __retVal = __Kv3GetInt8(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the unsigned 8-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// uint8_t value or defaultValue + internal static delegate* Kv3GetUInt8 = &___Kv3GetUInt8; + internal static delegate* unmanaged[Cdecl] __Kv3GetUInt8; + private static byte ___Kv3GetUInt8(nint kv, byte defaultValue) + { + byte __retVal = __Kv3GetUInt8(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the signed 16-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// int16_t value or defaultValue + internal static delegate* Kv3GetShort = &___Kv3GetShort; + internal static delegate* unmanaged[Cdecl] __Kv3GetShort; + private static short ___Kv3GetShort(nint kv, short defaultValue) + { + short __retVal = __Kv3GetShort(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the unsigned 16-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// uint16_t value or defaultValue + internal static delegate* Kv3GetUShort = &___Kv3GetUShort; + internal static delegate* unmanaged[Cdecl] __Kv3GetUShort; + private static ushort ___Kv3GetUShort(nint kv, ushort defaultValue) + { + ushort __retVal = __Kv3GetUShort(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the signed 32-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// int32_t value or defaultValue + internal static delegate* Kv3GetInt = &___Kv3GetInt; + internal static delegate* unmanaged[Cdecl] __Kv3GetInt; + private static int ___Kv3GetInt(nint kv, int defaultValue) + { + int __retVal = __Kv3GetInt(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the unsigned 32-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// uint32_t value or defaultValue + internal static delegate* Kv3GetUInt = &___Kv3GetUInt; + internal static delegate* unmanaged[Cdecl] __Kv3GetUInt; + private static uint ___Kv3GetUInt(nint kv, uint defaultValue) + { + uint __retVal = __Kv3GetUInt(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the signed 64-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// int64_t value or defaultValue + internal static delegate* Kv3GetInt64 = &___Kv3GetInt64; + internal static delegate* unmanaged[Cdecl] __Kv3GetInt64; + private static long ___Kv3GetInt64(nint kv, long defaultValue) + { + long __retVal = __Kv3GetInt64(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the unsigned 64-bit integer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// uint64_t value or defaultValue + internal static delegate* Kv3GetUInt64 = &___Kv3GetUInt64; + internal static delegate* unmanaged[Cdecl] __Kv3GetUInt64; + private static ulong ___Kv3GetUInt64(nint kv, ulong defaultValue) + { + ulong __retVal = __Kv3GetUInt64(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the float value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// Float value or defaultValue + internal static delegate* Kv3GetFloat = &___Kv3GetFloat; + internal static delegate* unmanaged[Cdecl] __Kv3GetFloat; + private static float ___Kv3GetFloat(nint kv, float defaultValue) + { + float __retVal = __Kv3GetFloat(kv, defaultValue); + return __retVal; + } + + /// + /// Gets the double value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null or conversion fails + /// Double value or defaultValue + internal static delegate* Kv3GetDouble = &___Kv3GetDouble; + internal static delegate* unmanaged[Cdecl] __Kv3GetDouble; + private static double ___Kv3GetDouble(nint kv, double defaultValue) + { + double __retVal = __Kv3GetDouble(kv, defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a boolean value + /// + /// Pointer to the KeyValues3 object + /// Boolean value to set + internal static delegate* Kv3SetBool = &___Kv3SetBool; + internal static delegate* unmanaged[Cdecl] __Kv3SetBool; + private static void ___Kv3SetBool(nint kv, Bool8 value) + { + __Kv3SetBool(kv, value); + } + + /// + /// Sets the KeyValues3 object to a char value + /// + /// Pointer to the KeyValues3 object + /// Char value to set + internal static delegate* Kv3SetChar = &___Kv3SetChar; + internal static delegate* unmanaged[Cdecl] __Kv3SetChar; + private static void ___Kv3SetChar(nint kv, Char8 value) + { + __Kv3SetChar(kv, value); + } + + /// + /// Sets the KeyValues3 object to a 32-bit Unicode character value + /// + /// Pointer to the KeyValues3 object + /// 32-bit Unicode character value to set + internal static delegate* Kv3SetUChar32 = &___Kv3SetUChar32; + internal static delegate* unmanaged[Cdecl] __Kv3SetUChar32; + private static void ___Kv3SetUChar32(nint kv, uint value) + { + __Kv3SetUChar32(kv, value); + } + + /// + /// Sets the KeyValues3 object to a signed 8-bit integer value + /// + /// Pointer to the KeyValues3 object + /// int8_t value to set + internal static delegate* Kv3SetInt8 = &___Kv3SetInt8; + internal static delegate* unmanaged[Cdecl] __Kv3SetInt8; + private static void ___Kv3SetInt8(nint kv, sbyte value) + { + __Kv3SetInt8(kv, value); + } + + /// + /// Sets the KeyValues3 object to an unsigned 8-bit integer value + /// + /// Pointer to the KeyValues3 object + /// uint8_t value to set + internal static delegate* Kv3SetUInt8 = &___Kv3SetUInt8; + internal static delegate* unmanaged[Cdecl] __Kv3SetUInt8; + private static void ___Kv3SetUInt8(nint kv, byte value) + { + __Kv3SetUInt8(kv, value); + } + + /// + /// Sets the KeyValues3 object to a signed 16-bit integer value + /// + /// Pointer to the KeyValues3 object + /// int16_t value to set + internal static delegate* Kv3SetShort = &___Kv3SetShort; + internal static delegate* unmanaged[Cdecl] __Kv3SetShort; + private static void ___Kv3SetShort(nint kv, short value) + { + __Kv3SetShort(kv, value); + } + + /// + /// Sets the KeyValues3 object to an unsigned 16-bit integer value + /// + /// Pointer to the KeyValues3 object + /// uint16_t value to set + internal static delegate* Kv3SetUShort = &___Kv3SetUShort; + internal static delegate* unmanaged[Cdecl] __Kv3SetUShort; + private static void ___Kv3SetUShort(nint kv, ushort value) + { + __Kv3SetUShort(kv, value); + } + + /// + /// Sets the KeyValues3 object to a signed 32-bit integer value + /// + /// Pointer to the KeyValues3 object + /// int32_t value to set + internal static delegate* Kv3SetInt = &___Kv3SetInt; + internal static delegate* unmanaged[Cdecl] __Kv3SetInt; + private static void ___Kv3SetInt(nint kv, int value) + { + __Kv3SetInt(kv, value); + } + + /// + /// Sets the KeyValues3 object to an unsigned 32-bit integer value + /// + /// Pointer to the KeyValues3 object + /// uint32_t value to set + internal static delegate* Kv3SetUInt = &___Kv3SetUInt; + internal static delegate* unmanaged[Cdecl] __Kv3SetUInt; + private static void ___Kv3SetUInt(nint kv, uint value) + { + __Kv3SetUInt(kv, value); + } + + /// + /// Sets the KeyValues3 object to a signed 64-bit integer value + /// + /// Pointer to the KeyValues3 object + /// int64_t value to set + internal static delegate* Kv3SetInt64 = &___Kv3SetInt64; + internal static delegate* unmanaged[Cdecl] __Kv3SetInt64; + private static void ___Kv3SetInt64(nint kv, long value) + { + __Kv3SetInt64(kv, value); + } + + /// + /// Sets the KeyValues3 object to an unsigned 64-bit integer value + /// + /// Pointer to the KeyValues3 object + /// uint64_t value to set + internal static delegate* Kv3SetUInt64 = &___Kv3SetUInt64; + internal static delegate* unmanaged[Cdecl] __Kv3SetUInt64; + private static void ___Kv3SetUInt64(nint kv, ulong value) + { + __Kv3SetUInt64(kv, value); + } + + /// + /// Sets the KeyValues3 object to a float value + /// + /// Pointer to the KeyValues3 object + /// Float value to set + internal static delegate* Kv3SetFloat = &___Kv3SetFloat; + internal static delegate* unmanaged[Cdecl] __Kv3SetFloat; + private static void ___Kv3SetFloat(nint kv, float value) + { + __Kv3SetFloat(kv, value); + } + + /// + /// Sets the KeyValues3 object to a double value + /// + /// Pointer to the KeyValues3 object + /// Double value to set + internal static delegate* Kv3SetDouble = &___Kv3SetDouble; + internal static delegate* unmanaged[Cdecl] __Kv3SetDouble; + private static void ___Kv3SetDouble(nint kv, double value) + { + __Kv3SetDouble(kv, value); + } + + /// + /// Gets the pointer value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default value to return if kv is null + /// Pointer value as uintptr_t or defaultValue + internal static delegate* Kv3GetPointer = &___Kv3GetPointer; + internal static delegate* unmanaged[Cdecl] __Kv3GetPointer; + private static nint ___Kv3GetPointer(nint kv, nint defaultValue) + { + nint __retVal = __Kv3GetPointer(kv, defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a pointer value + /// + /// Pointer to the KeyValues3 object + /// Pointer value as uintptr_t to set + internal static delegate* Kv3SetPointer = &___Kv3SetPointer; + internal static delegate* unmanaged[Cdecl] __Kv3SetPointer; + private static void ___Kv3SetPointer(nint kv, nint ptr) + { + __Kv3SetPointer(kv, ptr); + } + + /// + /// Gets the string token value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default token value to return if kv is null + /// String token hash code or defaultValue + internal static delegate* Kv3GetStringToken = &___Kv3GetStringToken; + internal static delegate* unmanaged[Cdecl] __Kv3GetStringToken; + private static uint ___Kv3GetStringToken(nint kv, uint defaultValue) + { + uint __retVal = __Kv3GetStringToken(kv, defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a string token value + /// + /// Pointer to the KeyValues3 object + /// String token hash code to set + internal static delegate* Kv3SetStringToken = &___Kv3SetStringToken; + internal static delegate* unmanaged[Cdecl] __Kv3SetStringToken; + private static void ___Kv3SetStringToken(nint kv, uint token) + { + __Kv3SetStringToken(kv, token); + } + + /// + /// Gets the entity handle value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default entity handle value to return if kv is null + /// Entity handle as int32_t or defaultValue + internal static delegate* Kv3GetEHandle = &___Kv3GetEHandle; + internal static delegate* unmanaged[Cdecl] __Kv3GetEHandle; + private static int ___Kv3GetEHandle(nint kv, int defaultValue) + { + int __retVal = __Kv3GetEHandle(kv, defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to an entity handle value + /// + /// Pointer to the KeyValues3 object + /// Entity handle value to set + internal static delegate* Kv3SetEHandle = &___Kv3SetEHandle; + internal static delegate* unmanaged[Cdecl] __Kv3SetEHandle; + private static void ___Kv3SetEHandle(nint kv, int ehandle) + { + __Kv3SetEHandle(kv, ehandle); + } + + /// + /// Gets the string value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default string to return if kv is null or value is empty + /// String value or defaultValue + internal static delegate* Kv3GetString = &___Kv3GetString; + internal static delegate* unmanaged[Cdecl] __Kv3GetString; + private static string ___Kv3GetString(nint kv, string defaultValue) + { + string __retVal; + String192 __retVal_native; + var __defaultValue = NativeMethods.ConstructString(defaultValue); + try { + __retVal_native = __Kv3GetString(kv, &__defaultValue); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__defaultValue); + } + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a string value (copies the string) + /// + /// Pointer to the KeyValues3 object + /// String value to set + /// String subtype enumeration value + internal static delegate* Kv3SetString = &___Kv3SetString; + internal static delegate* unmanaged[Cdecl] __Kv3SetString; + private static void ___Kv3SetString(nint kv, string str, byte subtype) + { + var __str = NativeMethods.ConstructString(str); + try { + __Kv3SetString(kv, &__str, subtype); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__str); + } + } + + /// + /// Sets the KeyValues3 object to an external string value (does not copy) + /// + /// Pointer to the KeyValues3 object + /// External string value to reference + /// String subtype enumeration value + internal static delegate* Kv3SetStringExternal = &___Kv3SetStringExternal; + internal static delegate* unmanaged[Cdecl] __Kv3SetStringExternal; + private static void ___Kv3SetStringExternal(nint kv, string str, byte subtype) + { + var __str = NativeMethods.ConstructString(str); + try { + __Kv3SetStringExternal(kv, &__str, subtype); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__str); + } + } + + /// + /// Gets the binary blob from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Vector containing the binary blob data, or empty vector if kv is null + internal static delegate* Kv3GetBinaryBlob = &___Kv3GetBinaryBlob; + internal static delegate* unmanaged[Cdecl] __Kv3GetBinaryBlob; + private static byte[] ___Kv3GetBinaryBlob(nint kv) + { + byte[] __retVal; + Vector192 __retVal_native; + try { + __retVal_native = __Kv3GetBinaryBlob(kv); + // Unmarshal - Convert native data to managed data. + __retVal = new byte[NativeMethods.GetVectorSizeUInt8(&__retVal_native)]; + NativeMethods.GetVectorDataUInt8(&__retVal_native, __retVal); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorUInt8(&__retVal_native); + } + return __retVal; + } + + /// + /// Gets the size of the binary blob in the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Size of the binary blob in bytes, or 0 if kv is null + internal static delegate* Kv3GetBinaryBlobSize = &___Kv3GetBinaryBlobSize; + internal static delegate* unmanaged[Cdecl] __Kv3GetBinaryBlobSize; + private static int ___Kv3GetBinaryBlobSize(nint kv) + { + int __retVal = __Kv3GetBinaryBlobSize(kv); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a binary blob (copies the data) + /// + /// Pointer to the KeyValues3 object + /// Vector containing the binary blob data + internal static delegate* Kv3SetToBinaryBlob = &___Kv3SetToBinaryBlob; + internal static delegate* unmanaged[Cdecl] __Kv3SetToBinaryBlob; + private static void ___Kv3SetToBinaryBlob(nint kv, byte[] blob) + { + var __blob = NativeMethods.ConstructVectorUInt8(blob, blob.Length); + try { + __Kv3SetToBinaryBlob(kv, &__blob); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorUInt8(&__blob); + } + } + + /// + /// Sets the KeyValues3 object to an external binary blob (does not copy) + /// + /// Pointer to the KeyValues3 object + /// Vector containing the external binary blob data + /// Whether to free the memory when the object is destroyed + internal static delegate* Kv3SetToBinaryBlobExternal = &___Kv3SetToBinaryBlobExternal; + internal static delegate* unmanaged[Cdecl] __Kv3SetToBinaryBlobExternal; + private static void ___Kv3SetToBinaryBlobExternal(nint kv, byte[] blob, Bool8 free_mem) + { + var __blob = NativeMethods.ConstructVectorUInt8(blob, blob.Length); + try { + __Kv3SetToBinaryBlobExternal(kv, &__blob, free_mem); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorUInt8(&__blob); + } + } + + /// + /// Gets the color value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default color value to return if kv is null + /// Color value as int32_t or defaultValue + internal static delegate* Kv3GetColor = &___Kv3GetColor; + internal static delegate* unmanaged[Cdecl] __Kv3GetColor; + private static int ___Kv3GetColor(nint kv, int defaultValue) + { + int __retVal = __Kv3GetColor(kv, defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a color value + /// + /// Pointer to the KeyValues3 object + /// Color value as int32_t to set + internal static delegate* Kv3SetColor = &___Kv3SetColor; + internal static delegate* unmanaged[Cdecl] __Kv3SetColor; + private static void ___Kv3SetColor(nint kv, int color) + { + __Kv3SetColor(kv, color); + } + + /// + /// Gets the 3D vector value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default vector to return if kv is null + /// 3D vector or defaultValue + internal static delegate* Kv3GetVector = &___Kv3GetVector; + internal static delegate* unmanaged[Cdecl] __Kv3GetVector; + private static Vector3 ___Kv3GetVector(nint kv, Vector3 defaultValue) + { + Vector3 __retVal = __Kv3GetVector(kv, &defaultValue); + return __retVal; + } + + /// + /// Gets the 2D vector value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default 2D vector to return if kv is null + /// 2D vector or defaultValue + internal static delegate* Kv3GetVector2D = &___Kv3GetVector2D; + internal static delegate* unmanaged[Cdecl] __Kv3GetVector2D; + private static Vector2 ___Kv3GetVector2D(nint kv, Vector2 defaultValue) + { + Vector2 __retVal = __Kv3GetVector2D(kv, &defaultValue); + return __retVal; + } + + /// + /// Gets the 4D vector value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default 4D vector to return if kv is null + /// 4D vector or defaultValue + internal static delegate* Kv3GetVector4D = &___Kv3GetVector4D; + internal static delegate* unmanaged[Cdecl] __Kv3GetVector4D; + private static Vector4 ___Kv3GetVector4D(nint kv, Vector4 defaultValue) + { + Vector4 __retVal = __Kv3GetVector4D(kv, &defaultValue); + return __retVal; + } + + /// + /// Gets the quaternion value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default quaternion to return if kv is null + /// Quaternion as vec4 or defaultValue + internal static delegate* Kv3GetQuaternion = &___Kv3GetQuaternion; + internal static delegate* unmanaged[Cdecl] __Kv3GetQuaternion; + private static Vector4 ___Kv3GetQuaternion(nint kv, Vector4 defaultValue) + { + Vector4 __retVal = __Kv3GetQuaternion(kv, &defaultValue); + return __retVal; + } + + /// + /// Gets the angle (QAngle) value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default angle to return if kv is null + /// QAngle as vec3 or defaultValue + internal static delegate* Kv3GetQAngle = &___Kv3GetQAngle; + internal static delegate* unmanaged[Cdecl] __Kv3GetQAngle; + private static Vector3 ___Kv3GetQAngle(nint kv, Vector3 defaultValue) + { + Vector3 __retVal = __Kv3GetQAngle(kv, &defaultValue); + return __retVal; + } + + /// + /// Gets the 3x4 matrix value from the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + /// Default matrix to return if kv is null + /// 3x4 matrix as mat4x4 or defaultValue + internal static delegate* Kv3GetMatrix3x4 = &___Kv3GetMatrix3x4; + internal static delegate* unmanaged[Cdecl] __Kv3GetMatrix3x4; + private static Matrix4x4 ___Kv3GetMatrix3x4(nint kv, Matrix4x4 defaultValue) + { + Matrix4x4 __retVal = __Kv3GetMatrix3x4(kv, &defaultValue); + return __retVal; + } + + /// + /// Sets the KeyValues3 object to a 3D vector value + /// + /// Pointer to the KeyValues3 object + /// 3D vector to set + internal static delegate* Kv3SetVector = &___Kv3SetVector; + internal static delegate* unmanaged[Cdecl] __Kv3SetVector; + private static void ___Kv3SetVector(nint kv, Vector3 vec) + { + __Kv3SetVector(kv, &vec); + } + + /// + /// Sets the KeyValues3 object to a 2D vector value + /// + /// Pointer to the KeyValues3 object + /// 2D vector to set + internal static delegate* Kv3SetVector2D = &___Kv3SetVector2D; + internal static delegate* unmanaged[Cdecl] __Kv3SetVector2D; + private static void ___Kv3SetVector2D(nint kv, Vector2 vec2d) + { + __Kv3SetVector2D(kv, &vec2d); + } + + /// + /// Sets the KeyValues3 object to a 4D vector value + /// + /// Pointer to the KeyValues3 object + /// 4D vector to set + internal static delegate* Kv3SetVector4D = &___Kv3SetVector4D; + internal static delegate* unmanaged[Cdecl] __Kv3SetVector4D; + private static void ___Kv3SetVector4D(nint kv, Vector4 vec4d) + { + __Kv3SetVector4D(kv, &vec4d); + } + + /// + /// Sets the KeyValues3 object to a quaternion value + /// + /// Pointer to the KeyValues3 object + /// Quaternion to set (as vec4) + internal static delegate* Kv3SetQuaternion = &___Kv3SetQuaternion; + internal static delegate* unmanaged[Cdecl] __Kv3SetQuaternion; + private static void ___Kv3SetQuaternion(nint kv, Vector4 quat) + { + __Kv3SetQuaternion(kv, &quat); + } + + /// + /// Sets the KeyValues3 object to an angle (QAngle) value + /// + /// Pointer to the KeyValues3 object + /// QAngle to set (as vec3) + internal static delegate* Kv3SetQAngle = &___Kv3SetQAngle; + internal static delegate* unmanaged[Cdecl] __Kv3SetQAngle; + private static void ___Kv3SetQAngle(nint kv, Vector3 ang) + { + __Kv3SetQAngle(kv, &ang); + } + + /// + /// Sets the KeyValues3 object to a 3x4 matrix value + /// + /// Pointer to the KeyValues3 object + /// 3x4 matrix to set (as mat4x4) + internal static delegate* Kv3SetMatrix3x4 = &___Kv3SetMatrix3x4; + internal static delegate* unmanaged[Cdecl] __Kv3SetMatrix3x4; + private static void ___Kv3SetMatrix3x4(nint kv, Matrix4x4 matrix) + { + __Kv3SetMatrix3x4(kv, &matrix); + } + + /// + /// Gets the number of elements in the array + /// + /// Pointer to the KeyValues3 object + /// Number of array elements, or 0 if kv is null or not an array + internal static delegate* Kv3GetArrayElementCount = &___Kv3GetArrayElementCount; + internal static delegate* unmanaged[Cdecl] __Kv3GetArrayElementCount; + private static int ___Kv3GetArrayElementCount(nint kv) + { + int __retVal = __Kv3GetArrayElementCount(kv); + return __retVal; + } + + /// + /// Sets the number of elements in the array + /// + /// Pointer to the KeyValues3 object + /// Number of elements to set + /// Type of array elements + /// Subtype of array elements + internal static delegate* Kv3SetArrayElementCount = &___Kv3SetArrayElementCount; + internal static delegate* unmanaged[Cdecl] __Kv3SetArrayElementCount; + private static void ___Kv3SetArrayElementCount(nint kv, int count, byte type, byte subtype) + { + __Kv3SetArrayElementCount(kv, count, type, subtype); + } + + /// + /// Sets the KeyValues3 object to an empty KV3 array + /// + /// Pointer to the KeyValues3 object + internal static delegate* Kv3SetToEmptyKV3Array = &___Kv3SetToEmptyKV3Array; + internal static delegate* unmanaged[Cdecl] __Kv3SetToEmptyKV3Array; + private static void ___Kv3SetToEmptyKV3Array(nint kv) + { + __Kv3SetToEmptyKV3Array(kv); + } + + /// + /// Gets an array element at the specified index + /// + /// Pointer to the KeyValues3 object + /// Index of the element to get + /// Pointer to the element KeyValues3 object, or nullptr if invalid + internal static delegate* Kv3GetArrayElement = &___Kv3GetArrayElement; + internal static delegate* unmanaged[Cdecl] __Kv3GetArrayElement; + private static nint ___Kv3GetArrayElement(nint kv, int elem) + { + nint __retVal = __Kv3GetArrayElement(kv, elem); + return __retVal; + } + + /// + /// Inserts a new element before the specified index + /// + /// Pointer to the KeyValues3 object + /// Index before which to insert + /// Pointer to the newly inserted element, or nullptr if invalid + internal static delegate* Kv3ArrayInsertElementBefore = &___Kv3ArrayInsertElementBefore; + internal static delegate* unmanaged[Cdecl] __Kv3ArrayInsertElementBefore; + private static nint ___Kv3ArrayInsertElementBefore(nint kv, int elem) + { + nint __retVal = __Kv3ArrayInsertElementBefore(kv, elem); + return __retVal; + } + + /// + /// Inserts a new element after the specified index + /// + /// Pointer to the KeyValues3 object + /// Index after which to insert + /// Pointer to the newly inserted element, or nullptr if invalid + internal static delegate* Kv3ArrayInsertElementAfter = &___Kv3ArrayInsertElementAfter; + internal static delegate* unmanaged[Cdecl] __Kv3ArrayInsertElementAfter; + private static nint ___Kv3ArrayInsertElementAfter(nint kv, int elem) + { + nint __retVal = __Kv3ArrayInsertElementAfter(kv, elem); + return __retVal; + } + + /// + /// Adds a new element to the end of the array + /// + /// Pointer to the KeyValues3 object + /// Pointer to the newly added element, or nullptr if invalid + internal static delegate* Kv3ArrayAddElementToTail = &___Kv3ArrayAddElementToTail; + internal static delegate* unmanaged[Cdecl] __Kv3ArrayAddElementToTail; + private static nint ___Kv3ArrayAddElementToTail(nint kv) + { + nint __retVal = __Kv3ArrayAddElementToTail(kv); + return __retVal; + } + + /// + /// Swaps two array elements + /// + /// Pointer to the KeyValues3 object + /// Index of the first element + /// Index of the second element + internal static delegate* Kv3ArraySwapItems = &___Kv3ArraySwapItems; + internal static delegate* unmanaged[Cdecl] __Kv3ArraySwapItems; + private static void ___Kv3ArraySwapItems(nint kv, int idx1, int idx2) + { + __Kv3ArraySwapItems(kv, idx1, idx2); + } + + /// + /// Removes an element from the array + /// + /// Pointer to the KeyValues3 object + /// Index of the element to remove + internal static delegate* Kv3ArrayRemoveElement = &___Kv3ArrayRemoveElement; + internal static delegate* unmanaged[Cdecl] __Kv3ArrayRemoveElement; + private static void ___Kv3ArrayRemoveElement(nint kv, int elem) + { + __Kv3ArrayRemoveElement(kv, elem); + } + + /// + /// Sets the KeyValues3 object to an empty table + /// + /// Pointer to the KeyValues3 object + internal static delegate* Kv3SetToEmptyTable = &___Kv3SetToEmptyTable; + internal static delegate* unmanaged[Cdecl] __Kv3SetToEmptyTable; + private static void ___Kv3SetToEmptyTable(nint kv) + { + __Kv3SetToEmptyTable(kv); + } + + /// + /// Gets the number of members in the table + /// + /// Pointer to the KeyValues3 object + /// Number of table members, or 0 if kv is null or not a table + internal static delegate* Kv3GetMemberCount = &___Kv3GetMemberCount; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberCount; + private static int ___Kv3GetMemberCount(nint kv) + { + int __retVal = __Kv3GetMemberCount(kv); + return __retVal; + } + + /// + /// Checks if a member with the specified name exists + /// + /// Pointer to the KeyValues3 object + /// Name of the member to check + /// true if the member exists, false otherwise + internal static delegate* Kv3HasMember = &___Kv3HasMember; + internal static delegate* unmanaged[Cdecl] __Kv3HasMember; + private static Bool8 ___Kv3HasMember(nint kv, string name) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3HasMember(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds a member by name + /// + /// Pointer to the KeyValues3 object + /// Name of the member to find + /// Pointer to the member KeyValues3 object, or nullptr if not found + internal static delegate* Kv3FindMember = &___Kv3FindMember; + internal static delegate* unmanaged[Cdecl] __Kv3FindMember; + private static nint ___Kv3FindMember(nint kv, string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3FindMember(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Finds a member by name, or creates it if it doesn't exist + /// + /// Pointer to the KeyValues3 object + /// Name of the member to find or create + /// Pointer to the member KeyValues3 object, or nullptr if kv is null + internal static delegate* Kv3FindOrCreateMember = &___Kv3FindOrCreateMember; + internal static delegate* unmanaged[Cdecl] __Kv3FindOrCreateMember; + private static nint ___Kv3FindOrCreateMember(nint kv, string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3FindOrCreateMember(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Removes a member from the table + /// + /// Pointer to the KeyValues3 object + /// Name of the member to remove + /// true if the member was removed, false otherwise + internal static delegate* Kv3RemoveMember = &___Kv3RemoveMember; + internal static delegate* unmanaged[Cdecl] __Kv3RemoveMember; + private static Bool8 ___Kv3RemoveMember(nint kv, string name) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3RemoveMember(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets the name of a member at the specified index + /// + /// Pointer to the KeyValues3 object + /// Index of the member + /// Name of the member, or empty string if invalid + internal static delegate* Kv3GetMemberName = &___Kv3GetMemberName; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberName; + private static string ___Kv3GetMemberName(nint kv, int index) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __Kv3GetMemberName(kv, index); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Gets a member by index + /// + /// Pointer to the KeyValues3 object + /// Index of the member to get + /// Pointer to the member KeyValues3 object, or nullptr if invalid + internal static delegate* Kv3GetMemberByIndex = &___Kv3GetMemberByIndex; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberByIndex; + private static nint ___Kv3GetMemberByIndex(nint kv, int index) + { + nint __retVal = __Kv3GetMemberByIndex(kv, index); + return __retVal; + } + + /// + /// Gets a boolean value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// Boolean value or defaultValue + internal static delegate* Kv3GetMemberBool = &___Kv3GetMemberBool; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberBool; + private static Bool8 ___Kv3GetMemberBool(nint kv, string name, Bool8 defaultValue) + { + Bool8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberBool(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a char value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// Char value or defaultValue + internal static delegate* Kv3GetMemberChar = &___Kv3GetMemberChar; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberChar; + private static Char8 ___Kv3GetMemberChar(nint kv, string name, Char8 defaultValue) + { + Char8 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberChar(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a 32-bit Unicode character value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// 32-bit Unicode character value or defaultValue + internal static delegate* Kv3GetMemberUChar32 = &___Kv3GetMemberUChar32; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberUChar32; + private static uint ___Kv3GetMemberUChar32(nint kv, string name, uint defaultValue) + { + uint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberUChar32(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a signed 8-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// int8_t value or defaultValue + internal static delegate* Kv3GetMemberInt8 = &___Kv3GetMemberInt8; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberInt8; + private static sbyte ___Kv3GetMemberInt8(nint kv, string name, sbyte defaultValue) + { + sbyte __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberInt8(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an unsigned 8-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// uint8_t value or defaultValue + internal static delegate* Kv3GetMemberUInt8 = &___Kv3GetMemberUInt8; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberUInt8; + private static byte ___Kv3GetMemberUInt8(nint kv, string name, byte defaultValue) + { + byte __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberUInt8(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a signed 16-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// int16_t value or defaultValue + internal static delegate* Kv3GetMemberShort = &___Kv3GetMemberShort; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberShort; + private static short ___Kv3GetMemberShort(nint kv, string name, short defaultValue) + { + short __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberShort(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an unsigned 16-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// uint16_t value or defaultValue + internal static delegate* Kv3GetMemberUShort = &___Kv3GetMemberUShort; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberUShort; + private static ushort ___Kv3GetMemberUShort(nint kv, string name, ushort defaultValue) + { + ushort __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberUShort(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a signed 32-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// int32_t value or defaultValue + internal static delegate* Kv3GetMemberInt = &___Kv3GetMemberInt; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberInt; + private static int ___Kv3GetMemberInt(nint kv, string name, int defaultValue) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberInt(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an unsigned 32-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// uint32_t value or defaultValue + internal static delegate* Kv3GetMemberUInt = &___Kv3GetMemberUInt; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberUInt; + private static uint ___Kv3GetMemberUInt(nint kv, string name, uint defaultValue) + { + uint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberUInt(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a signed 64-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// int64_t value or defaultValue + internal static delegate* Kv3GetMemberInt64 = &___Kv3GetMemberInt64; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberInt64; + private static long ___Kv3GetMemberInt64(nint kv, string name, long defaultValue) + { + long __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberInt64(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an unsigned 64-bit integer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// uint64_t value or defaultValue + internal static delegate* Kv3GetMemberUInt64 = &___Kv3GetMemberUInt64; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberUInt64; + private static ulong ___Kv3GetMemberUInt64(nint kv, string name, ulong defaultValue) + { + ulong __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberUInt64(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a float value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// Float value or defaultValue + internal static delegate* Kv3GetMemberFloat = &___Kv3GetMemberFloat; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberFloat; + private static float ___Kv3GetMemberFloat(nint kv, string name, float defaultValue) + { + float __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberFloat(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a double value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// Double value or defaultValue + internal static delegate* Kv3GetMemberDouble = &___Kv3GetMemberDouble; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberDouble; + private static double ___Kv3GetMemberDouble(nint kv, string name, double defaultValue) + { + double __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberDouble(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a pointer value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default value to return if member not found + /// Pointer value as uintptr_t or defaultValue + internal static delegate* Kv3GetMemberPointer = &___Kv3GetMemberPointer; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberPointer; + private static nint ___Kv3GetMemberPointer(nint kv, string name, nint defaultValue) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberPointer(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a string token value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default token value to return if member not found + /// String token hash code or defaultValue + internal static delegate* Kv3GetMemberStringToken = &___Kv3GetMemberStringToken; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberStringToken; + private static uint ___Kv3GetMemberStringToken(nint kv, string name, uint defaultValue) + { + uint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberStringToken(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an entity handle value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default entity handle value to return if member not found + /// Entity handle as int32_t or defaultValue + internal static delegate* Kv3GetMemberEHandle = &___Kv3GetMemberEHandle; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberEHandle; + private static int ___Kv3GetMemberEHandle(nint kv, string name, int defaultValue) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberEHandle(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a string value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default string to return if member not found + /// String value or defaultValue + internal static delegate* Kv3GetMemberString = &___Kv3GetMemberString; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberString; + private static string ___Kv3GetMemberString(nint kv, string name, string defaultValue) + { + string __retVal; + String192 __retVal_native; + var __name = NativeMethods.ConstructString(name); + var __defaultValue = NativeMethods.ConstructString(defaultValue); + try { + __retVal_native = __Kv3GetMemberString(kv, &__name, &__defaultValue); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__defaultValue); + } + return __retVal; + } + + /// + /// Gets a color value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default color value to return if member not found + /// Color value as int32_t or defaultValue + internal static delegate* Kv3GetMemberColor = &___Kv3GetMemberColor; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberColor; + private static int ___Kv3GetMemberColor(nint kv, string name, int defaultValue) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberColor(kv, &__name, defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a 3D vector value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default vector to return if member not found + /// 3D vector or defaultValue + internal static delegate* Kv3GetMemberVector = &___Kv3GetMemberVector; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberVector; + private static Vector3 ___Kv3GetMemberVector(nint kv, string name, Vector3 defaultValue) + { + Vector3 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberVector(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a 2D vector value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default 2D vector to return if member not found + /// 2D vector or defaultValue + internal static delegate* Kv3GetMemberVector2D = &___Kv3GetMemberVector2D; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberVector2D; + private static Vector2 ___Kv3GetMemberVector2D(nint kv, string name, Vector2 defaultValue) + { + Vector2 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberVector2D(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a 4D vector value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default 4D vector to return if member not found + /// 4D vector or defaultValue + internal static delegate* Kv3GetMemberVector4D = &___Kv3GetMemberVector4D; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberVector4D; + private static Vector4 ___Kv3GetMemberVector4D(nint kv, string name, Vector4 defaultValue) + { + Vector4 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberVector4D(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a quaternion value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default quaternion to return if member not found + /// Quaternion as vec4 or defaultValue + internal static delegate* Kv3GetMemberQuaternion = &___Kv3GetMemberQuaternion; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberQuaternion; + private static Vector4 ___Kv3GetMemberQuaternion(nint kv, string name, Vector4 defaultValue) + { + Vector4 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberQuaternion(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets an angle (QAngle) value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default angle to return if member not found + /// QAngle as vec3 or defaultValue + internal static delegate* Kv3GetMemberQAngle = &___Kv3GetMemberQAngle; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberQAngle; + private static Vector3 ___Kv3GetMemberQAngle(nint kv, string name, Vector3 defaultValue) + { + Vector3 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberQAngle(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Gets a 3x4 matrix value from a table member + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Default matrix to return if member not found + /// 3x4 matrix as mat4x4 or defaultValue + internal static delegate* Kv3GetMemberMatrix3x4 = &___Kv3GetMemberMatrix3x4; + internal static delegate* unmanaged[Cdecl] __Kv3GetMemberMatrix3x4; + private static Matrix4x4 ___Kv3GetMemberMatrix3x4(nint kv, string name, Matrix4x4 defaultValue) + { + Matrix4x4 __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __Kv3GetMemberMatrix3x4(kv, &__name, &defaultValue); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Sets a table member to null + /// + /// Pointer to the KeyValues3 object + /// Name of the member + internal static delegate* Kv3SetMemberToNull = &___Kv3SetMemberToNull; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToNull; + private static void ___Kv3SetMemberToNull(nint kv, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberToNull(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an empty array + /// + /// Pointer to the KeyValues3 object + /// Name of the member + internal static delegate* Kv3SetMemberToEmptyArray = &___Kv3SetMemberToEmptyArray; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToEmptyArray; + private static void ___Kv3SetMemberToEmptyArray(nint kv, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberToEmptyArray(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an empty table + /// + /// Pointer to the KeyValues3 object + /// Name of the member + internal static delegate* Kv3SetMemberToEmptyTable = &___Kv3SetMemberToEmptyTable; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToEmptyTable; + private static void ___Kv3SetMemberToEmptyTable(nint kv, string name) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberToEmptyTable(kv, &__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a binary blob (copies the data) + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Vector containing the binary blob data + internal static delegate* Kv3SetMemberToBinaryBlob = &___Kv3SetMemberToBinaryBlob; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToBinaryBlob; + private static void ___Kv3SetMemberToBinaryBlob(nint kv, string name, byte[] blob) + { + var __name = NativeMethods.ConstructString(name); + var __blob = NativeMethods.ConstructVectorUInt8(blob, blob.Length); + try { + __Kv3SetMemberToBinaryBlob(kv, &__name, &__blob); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyVectorUInt8(&__blob); + } + } + + /// + /// Sets a table member to an external binary blob (does not copy) + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Vector containing the external binary blob data + /// Whether to free the memory when the object is destroyed + internal static delegate* Kv3SetMemberToBinaryBlobExternal = &___Kv3SetMemberToBinaryBlobExternal; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToBinaryBlobExternal; + private static void ___Kv3SetMemberToBinaryBlobExternal(nint kv, string name, byte[] blob, Bool8 free_mem) + { + var __name = NativeMethods.ConstructString(name); + var __blob = NativeMethods.ConstructVectorUInt8(blob, blob.Length); + try { + __Kv3SetMemberToBinaryBlobExternal(kv, &__name, &__blob, free_mem); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyVectorUInt8(&__blob); + } + } + + /// + /// Sets a table member to a copy of another KeyValues3 value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Pointer to the KeyValues3 object to copy + internal static delegate* Kv3SetMemberToCopyOfValue = &___Kv3SetMemberToCopyOfValue; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberToCopyOfValue; + private static void ___Kv3SetMemberToCopyOfValue(nint kv, string name, nint other) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberToCopyOfValue(kv, &__name, other); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a boolean value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Boolean value to set + internal static delegate* Kv3SetMemberBool = &___Kv3SetMemberBool; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberBool; + private static void ___Kv3SetMemberBool(nint kv, string name, Bool8 value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberBool(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a char value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Char value to set + internal static delegate* Kv3SetMemberChar = &___Kv3SetMemberChar; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberChar; + private static void ___Kv3SetMemberChar(nint kv, string name, Char8 value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberChar(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a 32-bit Unicode character value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// 32-bit Unicode character value to set + internal static delegate* Kv3SetMemberUChar32 = &___Kv3SetMemberUChar32; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberUChar32; + private static void ___Kv3SetMemberUChar32(nint kv, string name, uint value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberUChar32(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a signed 8-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// int8_t value to set + internal static delegate* Kv3SetMemberInt8 = &___Kv3SetMemberInt8; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberInt8; + private static void ___Kv3SetMemberInt8(nint kv, string name, sbyte value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberInt8(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an unsigned 8-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// uint8_t value to set + internal static delegate* Kv3SetMemberUInt8 = &___Kv3SetMemberUInt8; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberUInt8; + private static void ___Kv3SetMemberUInt8(nint kv, string name, byte value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberUInt8(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a signed 16-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// int16_t value to set + internal static delegate* Kv3SetMemberShort = &___Kv3SetMemberShort; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberShort; + private static void ___Kv3SetMemberShort(nint kv, string name, short value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberShort(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an unsigned 16-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// uint16_t value to set + internal static delegate* Kv3SetMemberUShort = &___Kv3SetMemberUShort; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberUShort; + private static void ___Kv3SetMemberUShort(nint kv, string name, ushort value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberUShort(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a signed 32-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// int32_t value to set + internal static delegate* Kv3SetMemberInt = &___Kv3SetMemberInt; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberInt; + private static void ___Kv3SetMemberInt(nint kv, string name, int value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberInt(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an unsigned 32-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// uint32_t value to set + internal static delegate* Kv3SetMemberUInt = &___Kv3SetMemberUInt; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberUInt; + private static void ___Kv3SetMemberUInt(nint kv, string name, uint value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberUInt(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a signed 64-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// int64_t value to set + internal static delegate* Kv3SetMemberInt64 = &___Kv3SetMemberInt64; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberInt64; + private static void ___Kv3SetMemberInt64(nint kv, string name, long value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberInt64(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an unsigned 64-bit integer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// uint64_t value to set + internal static delegate* Kv3SetMemberUInt64 = &___Kv3SetMemberUInt64; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberUInt64; + private static void ___Kv3SetMemberUInt64(nint kv, string name, ulong value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberUInt64(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a float value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Float value to set + internal static delegate* Kv3SetMemberFloat = &___Kv3SetMemberFloat; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberFloat; + private static void ___Kv3SetMemberFloat(nint kv, string name, float value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberFloat(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a double value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Double value to set + internal static delegate* Kv3SetMemberDouble = &___Kv3SetMemberDouble; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberDouble; + private static void ___Kv3SetMemberDouble(nint kv, string name, double value) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberDouble(kv, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a pointer value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Pointer value as uintptr_t to set + internal static delegate* Kv3SetMemberPointer = &___Kv3SetMemberPointer; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberPointer; + private static void ___Kv3SetMemberPointer(nint kv, string name, nint ptr) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberPointer(kv, &__name, ptr); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a string token value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// String token hash code to set + internal static delegate* Kv3SetMemberStringToken = &___Kv3SetMemberStringToken; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberStringToken; + private static void ___Kv3SetMemberStringToken(nint kv, string name, uint token) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberStringToken(kv, &__name, token); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an entity handle value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Entity handle value to set + internal static delegate* Kv3SetMemberEHandle = &___Kv3SetMemberEHandle; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberEHandle; + private static void ___Kv3SetMemberEHandle(nint kv, string name, int ehandle) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberEHandle(kv, &__name, ehandle); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a string value (copies the string) + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// String value to set + /// String subtype enumeration value + internal static delegate* Kv3SetMemberString = &___Kv3SetMemberString; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberString; + private static void ___Kv3SetMemberString(nint kv, string name, string str, byte subtype) + { + var __name = NativeMethods.ConstructString(name); + var __str = NativeMethods.ConstructString(str); + try { + __Kv3SetMemberString(kv, &__name, &__str, subtype); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__str); + } + } + + /// + /// Sets a table member to an external string value (does not copy) + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// External string value to reference + /// String subtype enumeration value + internal static delegate* Kv3SetMemberStringExternal = &___Kv3SetMemberStringExternal; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberStringExternal; + private static void ___Kv3SetMemberStringExternal(nint kv, string name, string str, byte subtype) + { + var __name = NativeMethods.ConstructString(name); + var __str = NativeMethods.ConstructString(str); + try { + __Kv3SetMemberStringExternal(kv, &__name, &__str, subtype); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + NativeMethods.DestroyString(&__str); + } + } + + /// + /// Sets a table member to a color value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Color value as int32_t to set + internal static delegate* Kv3SetMemberColor = &___Kv3SetMemberColor; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberColor; + private static void ___Kv3SetMemberColor(nint kv, string name, int color) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberColor(kv, &__name, color); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a 3D vector value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// 3D vector to set + internal static delegate* Kv3SetMemberVector = &___Kv3SetMemberVector; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberVector; + private static void ___Kv3SetMemberVector(nint kv, string name, Vector3 vec) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberVector(kv, &__name, &vec); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a 2D vector value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// 2D vector to set + internal static delegate* Kv3SetMemberVector2D = &___Kv3SetMemberVector2D; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberVector2D; + private static void ___Kv3SetMemberVector2D(nint kv, string name, Vector2 vec2d) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberVector2D(kv, &__name, &vec2d); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a 4D vector value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// 4D vector to set + internal static delegate* Kv3SetMemberVector4D = &___Kv3SetMemberVector4D; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberVector4D; + private static void ___Kv3SetMemberVector4D(nint kv, string name, Vector4 vec4d) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberVector4D(kv, &__name, &vec4d); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a quaternion value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// Quaternion to set (as vec4) + internal static delegate* Kv3SetMemberQuaternion = &___Kv3SetMemberQuaternion; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberQuaternion; + private static void ___Kv3SetMemberQuaternion(nint kv, string name, Vector4 quat) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberQuaternion(kv, &__name, &quat); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to an angle (QAngle) value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// QAngle to set (as vec3) + internal static delegate* Kv3SetMemberQAngle = &___Kv3SetMemberQAngle; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberQAngle; + private static void ___Kv3SetMemberQAngle(nint kv, string name, Vector3 ang) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberQAngle(kv, &__name, &ang); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets a table member to a 3x4 matrix value + /// + /// Pointer to the KeyValues3 object + /// Name of the member + /// 3x4 matrix to set (as mat4x4) + internal static delegate* Kv3SetMemberMatrix3x4 = &___Kv3SetMemberMatrix3x4; + internal static delegate* unmanaged[Cdecl] __Kv3SetMemberMatrix3x4; + private static void ___Kv3SetMemberMatrix3x4(nint kv, string name, Matrix4x4 matrix) + { + var __name = NativeMethods.ConstructString(name); + try { + __Kv3SetMemberMatrix3x4(kv, &__name, &matrix); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Prints debug information about the KeyValues3 object + /// + /// Pointer to the KeyValues3 object + internal static delegate* Kv3DebugPrint = &___Kv3DebugPrint; + internal static delegate* unmanaged[Cdecl] __Kv3DebugPrint; + private static void ___Kv3DebugPrint(nint kv) + { + __Kv3DebugPrint(kv); + } + + /// + /// Loads KeyValues3 data from a buffer into a context + /// + /// Pointer to the KeyValues3 context + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromBuffer = &___Kv3LoadFromBuffer; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromBuffer; + private static Bool8 ___Kv3LoadFromBuffer(nint context, ref string error, byte[] input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructVectorUInt8(input, input.Length); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromBuffer(context, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3Load = &___Kv3Load; + internal static delegate* unmanaged[Cdecl] __Kv3Load; + private static Bool8 ___Kv3Load(nint kv, ref string error, byte[] input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructVectorUInt8(input, input.Length); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3Load(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a text string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Text string containing KV3 data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromText = &___Kv3LoadFromText; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromText; + private static Bool8 ___Kv3LoadFromText(nint kv, ref string error, string input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructString(input); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromText(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a file into a context + /// + /// Pointer to the KeyValues3 context + /// Output string for error messages + /// Name of the file to load + /// Path to the file + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromFileToContext = &___Kv3LoadFromFileToContext; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromFileToContext; + private static Bool8 ___Kv3LoadFromFileToContext(nint context, ref string error, string filename, string path, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __filename = NativeMethods.ConstructString(filename); + var __path = NativeMethods.ConstructString(path); + try { + __retVal = __Kv3LoadFromFileToContext(context, &__error, &__filename, &__path, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__filename); + NativeMethods.DestroyString(&__path); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a file + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Name of the file to load + /// Path to the file + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromFile = &___Kv3LoadFromFile; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromFile; + private static Bool8 ___Kv3LoadFromFile(nint kv, ref string error, string filename, string path, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __filename = NativeMethods.ConstructString(filename); + var __path = NativeMethods.ConstructString(path); + try { + __retVal = __Kv3LoadFromFile(kv, &__error, &__filename, &__path, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__filename); + NativeMethods.DestroyString(&__path); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a JSON string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// JSON string + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromJSON = &___Kv3LoadFromJSON; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromJSON; + private static Bool8 ___Kv3LoadFromJSON(nint kv, ref string error, string input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructString(input); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromJSON(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a JSON file + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Path to the file + /// Name of the file to load + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromJSONFile = &___Kv3LoadFromJSONFile; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromJSONFile; + private static Bool8 ___Kv3LoadFromJSONFile(nint kv, ref string error, string path, string filename, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __path = NativeMethods.ConstructString(path); + var __filename = NativeMethods.ConstructString(filename); + try { + __retVal = __Kv3LoadFromJSONFile(kv, &__error, &__path, &__filename, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__path); + NativeMethods.DestroyString(&__filename); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a KeyValues1 file + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Path to the file + /// Name of the file to load + /// Escape sequence behavior for KV1 text + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromKV1File = &___Kv3LoadFromKV1File; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromKV1File; + private static Bool8 ___Kv3LoadFromKV1File(nint kv, ref string error, string path, string filename, byte esc_behavior, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __path = NativeMethods.ConstructString(path); + var __filename = NativeMethods.ConstructString(filename); + try { + __retVal = __Kv3LoadFromKV1File(kv, &__error, &__path, &__filename, esc_behavior, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__path); + NativeMethods.DestroyString(&__filename); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a KeyValues1 text string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// KV1 text string + /// Escape sequence behavior for KV1 text + /// Name for the KeyValues3 object + /// Unknown boolean parameter + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromKV1Text = &___Kv3LoadFromKV1Text; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromKV1Text; + private static Bool8 ___Kv3LoadFromKV1Text(nint kv, ref string error, string input, byte esc_behavior, string kv_name, Bool8 unk, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructString(input); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromKV1Text(kv, &__error, &__input, esc_behavior, &__kv_name, unk, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from a KeyValues1 text string with translation + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// KV1 text string + /// Escape sequence behavior for KV1 text + /// Pointer to translation table + /// Unknown integer parameter + /// Name for the KeyValues3 object + /// Unknown boolean parameter + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromKV1TextTranslated = &___Kv3LoadFromKV1TextTranslated; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromKV1TextTranslated; + private static Bool8 ___Kv3LoadFromKV1TextTranslated(nint kv, ref string error, string input, byte esc_behavior, nint translation, int unk1, string kv_name, Bool8 unk2, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructString(input); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromKV1TextTranslated(kv, &__error, &__input, esc_behavior, translation, unk1, &__kv_name, unk2, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads data from a buffer that may be KV3 or KV1 format + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromKV3OrKV1 = &___Kv3LoadFromKV3OrKV1; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromKV3OrKV1; + private static Bool8 ___Kv3LoadFromKV3OrKV1(nint kv, ref string error, byte[] input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructVectorUInt8(input, input.Length); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromKV3OrKV1(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 data from old schema text format + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadFromOldSchemaText = &___Kv3LoadFromOldSchemaText; + internal static delegate* unmanaged[Cdecl] __Kv3LoadFromOldSchemaText; + private static Bool8 ___Kv3LoadFromOldSchemaText(nint kv, ref string error, byte[] input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructVectorUInt8(input, input.Length); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadFromOldSchemaText(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Loads KeyValues3 text without a header + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Text string containing KV3 data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + internal static delegate* Kv3LoadTextNoHeader = &___Kv3LoadTextNoHeader; + internal static delegate* unmanaged[Cdecl] __Kv3LoadTextNoHeader; + private static Bool8 ___Kv3LoadTextNoHeader(nint kv, ref string error, string input, string kv_name, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __input = NativeMethods.ConstructString(input); + var __kv_name = NativeMethods.ConstructString(kv_name); + try { + __retVal = __Kv3LoadTextNoHeader(kv, &__error, &__input, &__kv_name, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__input); + NativeMethods.DestroyString(&__kv_name); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data to a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector to store the output buffer data + /// Saving flags + /// true if successful, false otherwise + internal static delegate* Kv3Save = &___Kv3Save; + internal static delegate* unmanaged[Cdecl] __Kv3Save; + private static Bool8 ___Kv3Save(nint kv, ref string error, ref byte[] output, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructVectorUInt8(output, output.Length); + try { + __retVal = __Kv3Save(kv, &__error, &__output, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + Array.Resize(ref output, NativeMethods.GetVectorSizeUInt8(&__output)); + NativeMethods.GetVectorDataUInt8(&__output, output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data as JSON to a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector to store the output JSON data + /// true if successful, false otherwise + internal static delegate* Kv3SaveAsJSON = &___Kv3SaveAsJSON; + internal static delegate* unmanaged[Cdecl] __Kv3SaveAsJSON; + private static Bool8 ___Kv3SaveAsJSON(nint kv, ref string error, ref byte[] output) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructVectorUInt8(output, output.Length); + try { + __retVal = __Kv3SaveAsJSON(kv, &__error, &__output); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + Array.Resize(ref output, NativeMethods.GetVectorSizeUInt8(&__output)); + NativeMethods.GetVectorDataUInt8(&__output, output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data as a JSON string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// String to store the JSON output + /// true if successful, false otherwise + internal static delegate* Kv3SaveAsJSONString = &___Kv3SaveAsJSONString; + internal static delegate* unmanaged[Cdecl] __Kv3SaveAsJSONString; + private static Bool8 ___Kv3SaveAsJSONString(nint kv, ref string error, ref string output) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructString(output); + try { + __retVal = __Kv3SaveAsJSONString(kv, &__error, &__output); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + output = NativeMethods.GetStringData(&__output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data as KeyValues1 text to a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector to store the output KV1 text data + /// Escape sequence behavior for KV1 text + /// true if successful, false otherwise + internal static delegate* Kv3SaveAsKV1Text = &___Kv3SaveAsKV1Text; + internal static delegate* unmanaged[Cdecl] __Kv3SaveAsKV1Text; + private static Bool8 ___Kv3SaveAsKV1Text(nint kv, ref string error, ref byte[] output, byte esc_behavior) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructVectorUInt8(output, output.Length); + try { + __retVal = __Kv3SaveAsKV1Text(kv, &__error, &__output, esc_behavior); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + Array.Resize(ref output, NativeMethods.GetVectorSizeUInt8(&__output)); + NativeMethods.GetVectorDataUInt8(&__output, output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data as KeyValues1 text with translation to a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector to store the output KV1 text data + /// Escape sequence behavior for KV1 text + /// Pointer to translation table + /// Unknown integer parameter + /// true if successful, false otherwise + internal static delegate* Kv3SaveAsKV1TextTranslated = &___Kv3SaveAsKV1TextTranslated; + internal static delegate* unmanaged[Cdecl] __Kv3SaveAsKV1TextTranslated; + private static Bool8 ___Kv3SaveAsKV1TextTranslated(nint kv, ref string error, ref byte[] output, byte esc_behavior, nint translation, int unk) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructVectorUInt8(output, output.Length); + try { + __retVal = __Kv3SaveAsKV1TextTranslated(kv, &__error, &__output, esc_behavior, translation, unk); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + Array.Resize(ref output, NativeMethods.GetVectorSizeUInt8(&__output)); + NativeMethods.GetVectorDataUInt8(&__output, output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 text without a header to a buffer + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Vector to store the output text data + /// Saving flags + /// true if successful, false otherwise + internal static delegate* Kv3SaveTextNoHeaderToBuffer = &___Kv3SaveTextNoHeaderToBuffer; + internal static delegate* unmanaged[Cdecl] __Kv3SaveTextNoHeaderToBuffer; + private static Bool8 ___Kv3SaveTextNoHeaderToBuffer(nint kv, ref string error, ref byte[] output, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructVectorUInt8(output, output.Length); + try { + __retVal = __Kv3SaveTextNoHeaderToBuffer(kv, &__error, &__output, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + Array.Resize(ref output, NativeMethods.GetVectorSizeUInt8(&__output)); + NativeMethods.GetVectorDataUInt8(&__output, output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyVectorUInt8(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 text without a header to a string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// String to store the text output + /// Saving flags + /// true if successful, false otherwise + internal static delegate* Kv3SaveTextNoHeader = &___Kv3SaveTextNoHeader; + internal static delegate* unmanaged[Cdecl] __Kv3SaveTextNoHeader; + private static Bool8 ___Kv3SaveTextNoHeader(nint kv, ref string error, ref string output, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructString(output); + try { + __retVal = __Kv3SaveTextNoHeader(kv, &__error, &__output, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + output = NativeMethods.GetStringData(&__output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 text to a string + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// String to store the text output + /// Saving flags + /// true if successful, false otherwise + internal static delegate* Kv3SaveTextToString = &___Kv3SaveTextToString; + internal static delegate* unmanaged[Cdecl] __Kv3SaveTextToString; + private static Bool8 ___Kv3SaveTextToString(nint kv, ref string error, ref string output, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __output = NativeMethods.ConstructString(output); + try { + __retVal = __Kv3SaveTextToString(kv, &__error, &__output, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + output = NativeMethods.GetStringData(&__output); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__output); + } + return __retVal; + } + + /// + /// Saves KeyValues3 data to a file + /// + /// Pointer to the KeyValues3 object + /// Output string for error messages + /// Name of the file to save + /// Path to save the file + /// Saving flags + /// true if successful, false otherwise + internal static delegate* Kv3SaveToFile = &___Kv3SaveToFile; + internal static delegate* unmanaged[Cdecl] __Kv3SaveToFile; + private static Bool8 ___Kv3SaveToFile(nint kv, ref string error, string filename, string path, uint flags) + { + Bool8 __retVal; + var __error = NativeMethods.ConstructString(error); + var __filename = NativeMethods.ConstructString(filename); + var __path = NativeMethods.ConstructString(path); + try { + __retVal = __Kv3SaveToFile(kv, &__error, &__filename, &__path, flags); + // Unmarshal - Convert native data to managed data. + error = NativeMethods.GetStringData(&__error); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__error); + NativeMethods.DestroyString(&__filename); + NativeMethods.DestroyString(&__path); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for KeyValues3 handle. + /// + internal sealed unsafe class KeyValues3 : SafeHandle + { + /// + /// Creates a new KeyValues3 object with specified type and subtype + /// + /// The KV3 type enumeration value + /// The KV3 subtype enumeration value + public KeyValues3(int type, int subtype) : this(s2sdk.Kv3Create(type, subtype), Ownership.Owned) + { + } + + /// + /// Creates a new KeyValues3 object with cluster element, type, and subtype + /// + /// The cluster element index + /// The KV3 type enumeration value + /// The KV3 subtype enumeration value + public KeyValues3(int cluster_elem, int type, int subtype) : this(s2sdk.Kv3CreateWithCluster(cluster_elem, type, subtype), Ownership.Owned) + { + } + + /// + /// Creates a copy of an existing KeyValues3 object + /// + /// Pointer to the KeyValues3 object to copy + public KeyValues3(nint other) : this(s2sdk.Kv3CreateCopy(other), Ownership.Owned) + { + } + + /// + /// Internal constructor for creating KeyValues3 from existing handle + /// + public KeyValues3(nint handle, Ownership ownership) : base((nint)handle, ownsHandle: ownership == Ownership.Owned) + { + } + + /// + /// Releases the handle (called automatically by SafeHandle) + /// + protected override bool ReleaseHandle() + { + s2sdk.Kv3Destroy((nint)handle); + return true; + } + + /// + /// Checks if the KeyValues3 has a valid handle + /// + public override bool IsInvalid => handle == nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Handle => (nint)handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => (nint)handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + SetHandleAsInvalid(); + return (nint)h; + } + + /// + /// Disposes the handle + /// + public void Reset() + { + Dispose(); + } + + /// + /// Copies data from another KeyValues3 object + /// + /// Pointer to the source KeyValues3 object + public void CopyFrom(KeyValues3 other) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3CopyFrom(Handle, other.Get()); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Overlays keys from another KeyValues3 object + /// + /// Pointer to the source KeyValues3 object + /// Whether to perform a deep overlay + public void OverlayKeysFrom(KeyValues3 other, Bool8 depth) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3OverlayKeysFrom(Handle, other.Get(), depth); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the context associated with a KeyValues3 object + /// + /// Pointer to the CKeyValues3Context, or nullptr if kv is null + public nint GetContext() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetContext(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the metadata associated with a KeyValues3 object + /// + /// Pointer to store the context pointer + /// Pointer to the KV3MetaData_t structure, or nullptr if kv is null + public nint GetMetaData(nint ppCtx) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMetaData(Handle, ppCtx); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if a specific flag is set + /// + /// The flag to check + /// true if the flag is set, false otherwise + public Bool8 HasFlag(byte flag) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3HasFlag(Handle, flag); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if any flags are set + /// + /// true if any flags are set, false otherwise + public Bool8 HasAnyFlags() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3HasAnyFlags(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets all flags as a bitmask + /// + /// Bitmask of all flags, or 0 if kv is null + public byte GetAllFlags() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetAllFlags(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets all flags from a bitmask + /// + /// Bitmask of flags to set + public void SetAllFlags(byte flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetAllFlags(Handle, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets or clears a specific flag + /// + /// The flag to modify + /// true to set the flag, false to clear it + public void SetFlag(byte flag, Bool8 state) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetFlag(Handle, flag, state); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the basic type of the KeyValues3 object + /// + /// The type enumeration value, or 0 if kv is null + public byte GetType() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetType(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the extended type of the KeyValues3 object + /// + /// The extended type enumeration value, or 0 if kv is null + public byte GetTypeEx() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetTypeEx(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the subtype of the KeyValues3 object + /// + /// The subtype enumeration value, or 0 if kv is null + public byte GetSubType() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetSubType(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the object has invalid member names + /// + /// true if invalid member names exist, false otherwise + public Bool8 HasInvalidMemberNames() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3HasInvalidMemberNames(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the invalid member names flag + /// + /// true to mark as having invalid member names, false otherwise + public void SetHasInvalidMemberNames(Bool8 bValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetHasInvalidMemberNames(Handle, bValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the type as a string representation + /// + /// String representation of the type, or empty string if kv is null + public string GetTypeAsString() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetTypeAsString(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the subtype as a string representation + /// + /// String representation of the subtype, or empty string if kv is null + public string GetSubTypeAsString() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetSubTypeAsString(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Converts the KeyValues3 object to a string representation + /// + /// Formatting flags for the string conversion + /// String representation of the object, or empty string if kv is null + public string ToString(uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3ToString(Handle, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the KeyValues3 object is null + /// + /// true if the object is null or the pointer is null, false otherwise + public Bool8 IsNull() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3IsNull(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to null + /// + public void SetToNull() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetToNull(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the KeyValues3 object is an array + /// + /// true if the object is an array, false otherwise + public Bool8 IsArray() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3IsArray(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the KeyValues3 object is a KV3 array + /// + /// true if the object is a KV3 array, false otherwise + public Bool8 IsKV3Array() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3IsKV3Array(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the KeyValues3 object is a table + /// + /// true if the object is a table, false otherwise + public Bool8 IsTable() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3IsTable(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the KeyValues3 object is a string + /// + /// true if the object is a string, false otherwise + public Bool8 IsString() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3IsString(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the boolean value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// Boolean value or defaultValue + public Bool8 GetBool(Bool8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetBool(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the char value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// Char value or defaultValue + public Char8 GetChar(Char8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetChar(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the 32-bit Unicode character value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// 32-bit Unicode character value or defaultValue + public uint GetUChar32(uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetUChar32(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the signed 8-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// int8_t value or defaultValue + public sbyte GetInt8(sbyte defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetInt8(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the unsigned 8-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// uint8_t value or defaultValue + public byte GetUInt8(byte defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetUInt8(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the signed 16-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// int16_t value or defaultValue + public short GetShort(short defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetShort(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the unsigned 16-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// uint16_t value or defaultValue + public ushort GetUShort(ushort defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetUShort(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the signed 32-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// int32_t value or defaultValue + public int GetInt(int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetInt(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the unsigned 32-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// uint32_t value or defaultValue + public uint GetUInt(uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetUInt(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the signed 64-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// int64_t value or defaultValue + public long GetInt64(long defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetInt64(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the unsigned 64-bit integer value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// uint64_t value or defaultValue + public ulong GetUInt64(ulong defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetUInt64(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the float value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// Float value or defaultValue + public float GetFloat(float defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetFloat(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the double value from the KeyValues3 object + /// + /// Default value to return if kv is null or conversion fails + /// Double value or defaultValue + public double GetDouble(double defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetDouble(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a boolean value + /// + /// Boolean value to set + public void SetBool(Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetBool(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a char value + /// + /// Char value to set + public void SetChar(Char8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetChar(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a 32-bit Unicode character value + /// + /// 32-bit Unicode character value to set + public void SetUChar32(uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetUChar32(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a signed 8-bit integer value + /// + /// int8_t value to set + public void SetInt8(sbyte value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetInt8(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an unsigned 8-bit integer value + /// + /// uint8_t value to set + public void SetUInt8(byte value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetUInt8(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a signed 16-bit integer value + /// + /// int16_t value to set + public void SetShort(short value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetShort(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an unsigned 16-bit integer value + /// + /// uint16_t value to set + public void SetUShort(ushort value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetUShort(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a signed 32-bit integer value + /// + /// int32_t value to set + public void SetInt(int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetInt(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an unsigned 32-bit integer value + /// + /// uint32_t value to set + public void SetUInt(uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetUInt(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a signed 64-bit integer value + /// + /// int64_t value to set + public void SetInt64(long value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetInt64(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an unsigned 64-bit integer value + /// + /// uint64_t value to set + public void SetUInt64(ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetUInt64(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a float value + /// + /// Float value to set + public void SetFloat(float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetFloat(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a double value + /// + /// Double value to set + public void SetDouble(double value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetDouble(Handle, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the pointer value from the KeyValues3 object + /// + /// Default value to return if kv is null + /// Pointer value as uintptr_t or defaultValue + public nint GetPointer(nint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetPointer(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a pointer value + /// + /// Pointer value as uintptr_t to set + public void SetPointer(nint ptr) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetPointer(Handle, ptr); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the string token value from the KeyValues3 object + /// + /// Default token value to return if kv is null + /// String token hash code or defaultValue + public uint GetStringToken(uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetStringToken(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a string token value + /// + /// String token hash code to set + public void SetStringToken(uint token) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetStringToken(Handle, token); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the entity handle value from the KeyValues3 object + /// + /// Default entity handle value to return if kv is null + /// Entity handle as int32_t or defaultValue + public int GetEHandle(int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetEHandle(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an entity handle value + /// + /// Entity handle value to set + public void SetEHandle(int ehandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetEHandle(Handle, ehandle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the string value from the KeyValues3 object + /// + /// Default string to return if kv is null or value is empty + /// String value or defaultValue + public string GetString(string defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetString(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a string value (copies the string) + /// + /// String value to set + /// String subtype enumeration value + public void SetString(string str, byte subtype) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetString(Handle, str, subtype); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an external string value (does not copy) + /// + /// External string value to reference + /// String subtype enumeration value + public void SetStringExternal(string str, byte subtype) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetStringExternal(Handle, str, subtype); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the binary blob from the KeyValues3 object + /// + /// Vector containing the binary blob data, or empty vector if kv is null + public byte[] GetBinaryBlob() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetBinaryBlob(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the size of the binary blob in the KeyValues3 object + /// + /// Size of the binary blob in bytes, or 0 if kv is null + public int GetBinaryBlobSize() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetBinaryBlobSize(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a binary blob (copies the data) + /// + /// Vector containing the binary blob data + public void SetToBinaryBlob(byte[] blob) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetToBinaryBlob(Handle, blob); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an external binary blob (does not copy) + /// + /// Vector containing the external binary blob data + /// Whether to free the memory when the object is destroyed + public void SetToBinaryBlobExternal(byte[] blob, Bool8 free_mem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetToBinaryBlobExternal(Handle, blob, free_mem); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the color value from the KeyValues3 object + /// + /// Default color value to return if kv is null + /// Color value as int32_t or defaultValue + public int GetColor(int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetColor(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a color value + /// + /// Color value as int32_t to set + public void SetColor(int color) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetColor(Handle, color); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the 3D vector value from the KeyValues3 object + /// + /// Default vector to return if kv is null + /// 3D vector or defaultValue + public Vector3 GetVector(Vector3 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetVector(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the 2D vector value from the KeyValues3 object + /// + /// Default 2D vector to return if kv is null + /// 2D vector or defaultValue + public Vector2 GetVector2D(Vector2 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetVector2D(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the 4D vector value from the KeyValues3 object + /// + /// Default 4D vector to return if kv is null + /// 4D vector or defaultValue + public Vector4 GetVector4D(Vector4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetVector4D(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the quaternion value from the KeyValues3 object + /// + /// Default quaternion to return if kv is null + /// Quaternion as vec4 or defaultValue + public Vector4 GetQuaternion(Vector4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetQuaternion(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the angle (QAngle) value from the KeyValues3 object + /// + /// Default angle to return if kv is null + /// QAngle as vec3 or defaultValue + public Vector3 GetQAngle(Vector3 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetQAngle(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the 3x4 matrix value from the KeyValues3 object + /// + /// Default matrix to return if kv is null + /// 3x4 matrix as mat4x4 or defaultValue + public Matrix4x4 GetMatrix3x4(Matrix4x4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMatrix3x4(Handle, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a 3D vector value + /// + /// 3D vector to set + public void SetVector(Vector3 vec) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetVector(Handle, vec); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a 2D vector value + /// + /// 2D vector to set + public void SetVector2D(Vector2 vec2d) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetVector2D(Handle, vec2d); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a 4D vector value + /// + /// 4D vector to set + public void SetVector4D(Vector4 vec4d) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetVector4D(Handle, vec4d); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a quaternion value + /// + /// Quaternion to set (as vec4) + public void SetQuaternion(Vector4 quat) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetQuaternion(Handle, quat); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an angle (QAngle) value + /// + /// QAngle to set (as vec3) + public void SetQAngle(Vector3 ang) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetQAngle(Handle, ang); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to a 3x4 matrix value + /// + /// 3x4 matrix to set (as mat4x4) + public void SetMatrix3x4(Matrix4x4 matrix) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMatrix3x4(Handle, matrix); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the number of elements in the array + /// + /// Number of array elements, or 0 if kv is null or not an array + public int GetArrayElementCount() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetArrayElementCount(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the number of elements in the array + /// + /// Number of elements to set + /// Type of array elements + /// Subtype of array elements + public void SetArrayElementCount(int count, byte type, byte subtype) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetArrayElementCount(Handle, count, type, subtype); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an empty KV3 array + /// + public void SetToEmptyKV3Array() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetToEmptyKV3Array(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an array element at the specified index + /// + /// Index of the element to get + /// Pointer to the element KeyValues3 object, or nullptr if invalid + public KeyValues3 GetArrayElement(int elem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3GetArrayElement(Handle, elem), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Inserts a new element before the specified index + /// + /// Index before which to insert + /// Pointer to the newly inserted element, or nullptr if invalid + public KeyValues3 ArrayInsertElementBefore(int elem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3ArrayInsertElementBefore(Handle, elem), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Inserts a new element after the specified index + /// + /// Index after which to insert + /// Pointer to the newly inserted element, or nullptr if invalid + public KeyValues3 ArrayInsertElementAfter(int elem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3ArrayInsertElementAfter(Handle, elem), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a new element to the end of the array + /// + /// Pointer to the newly added element, or nullptr if invalid + public KeyValues3 ArrayAddElementToTail() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3ArrayAddElementToTail(Handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Swaps two array elements + /// + /// Index of the first element + /// Index of the second element + public void ArraySwapItems(int idx1, int idx2) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3ArraySwapItems(Handle, idx1, idx2); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Removes an element from the array + /// + /// Index of the element to remove + public void ArrayRemoveElement(int elem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3ArrayRemoveElement(Handle, elem); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the KeyValues3 object to an empty table + /// + public void SetToEmptyTable() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetToEmptyTable(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the number of members in the table + /// + /// Number of table members, or 0 if kv is null or not a table + public int GetMemberCount() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberCount(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if a member with the specified name exists + /// + /// Name of the member to check + /// true if the member exists, false otherwise + public Bool8 HasMember(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3HasMember(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a member by name + /// + /// Name of the member to find + /// Pointer to the member KeyValues3 object, or nullptr if not found + public KeyValues3 FindMember(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3FindMember(Handle, name), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a member by name, or creates it if it doesn't exist + /// + /// Name of the member to find or create + /// Pointer to the member KeyValues3 object, or nullptr if kv is null + public KeyValues3 FindOrCreateMember(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3FindOrCreateMember(Handle, name), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Removes a member from the table + /// + /// Name of the member to remove + /// true if the member was removed, false otherwise + public Bool8 RemoveMember(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3RemoveMember(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the name of a member at the specified index + /// + /// Index of the member + /// Name of the member, or empty string if invalid + public string GetMemberName(int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberName(Handle, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a member by index + /// + /// Index of the member to get + /// Pointer to the member KeyValues3 object, or nullptr if invalid + public KeyValues3 GetMemberByIndex(int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues3(s2sdk.Kv3GetMemberByIndex(Handle, index), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a boolean value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// Boolean value or defaultValue + public Bool8 GetMemberBool(string name, Bool8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberBool(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a char value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// Char value or defaultValue + public Char8 GetMemberChar(string name, Char8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberChar(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 32-bit Unicode character value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// 32-bit Unicode character value or defaultValue + public uint GetMemberUChar32(string name, uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberUChar32(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a signed 8-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// int8_t value or defaultValue + public sbyte GetMemberInt8(string name, sbyte defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberInt8(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 8-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// uint8_t value or defaultValue + public byte GetMemberUInt8(string name, byte defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberUInt8(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a signed 16-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// int16_t value or defaultValue + public short GetMemberShort(string name, short defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberShort(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 16-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// uint16_t value or defaultValue + public ushort GetMemberUShort(string name, ushort defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberUShort(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a signed 32-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// int32_t value or defaultValue + public int GetMemberInt(string name, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberInt(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 32-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// uint32_t value or defaultValue + public uint GetMemberUInt(string name, uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberUInt(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a signed 64-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// int64_t value or defaultValue + public long GetMemberInt64(string name, long defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberInt64(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 64-bit integer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// uint64_t value or defaultValue + public ulong GetMemberUInt64(string name, ulong defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberUInt64(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a float value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// Float value or defaultValue + public float GetMemberFloat(string name, float defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberFloat(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a double value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// Double value or defaultValue + public double GetMemberDouble(string name, double defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberDouble(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a pointer value from a table member + /// + /// Name of the member + /// Default value to return if member not found + /// Pointer value as uintptr_t or defaultValue + public nint GetMemberPointer(string name, nint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberPointer(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a string token value from a table member + /// + /// Name of the member + /// Default token value to return if member not found + /// String token hash code or defaultValue + public uint GetMemberStringToken(string name, uint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberStringToken(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an entity handle value from a table member + /// + /// Name of the member + /// Default entity handle value to return if member not found + /// Entity handle as int32_t or defaultValue + public int GetMemberEHandle(string name, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberEHandle(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a string value from a table member + /// + /// Name of the member + /// Default string to return if member not found + /// String value or defaultValue + public string GetMemberString(string name, string defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberString(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a color value from a table member + /// + /// Name of the member + /// Default color value to return if member not found + /// Color value as int32_t or defaultValue + public int GetMemberColor(string name, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberColor(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 3D vector value from a table member + /// + /// Name of the member + /// Default vector to return if member not found + /// 3D vector or defaultValue + public Vector3 GetMemberVector(string name, Vector3 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberVector(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 2D vector value from a table member + /// + /// Name of the member + /// Default 2D vector to return if member not found + /// 2D vector or defaultValue + public Vector2 GetMemberVector2D(string name, Vector2 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberVector2D(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 4D vector value from a table member + /// + /// Name of the member + /// Default 4D vector to return if member not found + /// 4D vector or defaultValue + public Vector4 GetMemberVector4D(string name, Vector4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberVector4D(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a quaternion value from a table member + /// + /// Name of the member + /// Default quaternion to return if member not found + /// Quaternion as vec4 or defaultValue + public Vector4 GetMemberQuaternion(string name, Vector4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberQuaternion(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an angle (QAngle) value from a table member + /// + /// Name of the member + /// Default angle to return if member not found + /// QAngle as vec3 or defaultValue + public Vector3 GetMemberQAngle(string name, Vector3 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberQAngle(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 3x4 matrix value from a table member + /// + /// Name of the member + /// Default matrix to return if member not found + /// 3x4 matrix as mat4x4 or defaultValue + public Matrix4x4 GetMemberMatrix3x4(string name, Matrix4x4 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3GetMemberMatrix3x4(Handle, name, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to null + /// + /// Name of the member + public void SetMemberToNull(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToNull(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an empty array + /// + /// Name of the member + public void SetMemberToEmptyArray(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToEmptyArray(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an empty table + /// + /// Name of the member + public void SetMemberToEmptyTable(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToEmptyTable(Handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a binary blob (copies the data) + /// + /// Name of the member + /// Vector containing the binary blob data + public void SetMemberToBinaryBlob(string name, byte[] blob) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToBinaryBlob(Handle, name, blob); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an external binary blob (does not copy) + /// + /// Name of the member + /// Vector containing the external binary blob data + /// Whether to free the memory when the object is destroyed + public void SetMemberToBinaryBlobExternal(string name, byte[] blob, Bool8 free_mem) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToBinaryBlobExternal(Handle, name, blob, free_mem); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a copy of another KeyValues3 value + /// + /// Name of the member + /// Pointer to the KeyValues3 object to copy + public void SetMemberToCopyOfValue(string name, nint other) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberToCopyOfValue(Handle, name, other); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a boolean value + /// + /// Name of the member + /// Boolean value to set + public void SetMemberBool(string name, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberBool(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a char value + /// + /// Name of the member + /// Char value to set + public void SetMemberChar(string name, Char8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberChar(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a 32-bit Unicode character value + /// + /// Name of the member + /// 32-bit Unicode character value to set + public void SetMemberUChar32(string name, uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberUChar32(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a signed 8-bit integer value + /// + /// Name of the member + /// int8_t value to set + public void SetMemberInt8(string name, sbyte value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberInt8(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an unsigned 8-bit integer value + /// + /// Name of the member + /// uint8_t value to set + public void SetMemberUInt8(string name, byte value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberUInt8(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a signed 16-bit integer value + /// + /// Name of the member + /// int16_t value to set + public void SetMemberShort(string name, short value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberShort(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an unsigned 16-bit integer value + /// + /// Name of the member + /// uint16_t value to set + public void SetMemberUShort(string name, ushort value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberUShort(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a signed 32-bit integer value + /// + /// Name of the member + /// int32_t value to set + public void SetMemberInt(string name, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberInt(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an unsigned 32-bit integer value + /// + /// Name of the member + /// uint32_t value to set + public void SetMemberUInt(string name, uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberUInt(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a signed 64-bit integer value + /// + /// Name of the member + /// int64_t value to set + public void SetMemberInt64(string name, long value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberInt64(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an unsigned 64-bit integer value + /// + /// Name of the member + /// uint64_t value to set + public void SetMemberUInt64(string name, ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberUInt64(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a float value + /// + /// Name of the member + /// Float value to set + public void SetMemberFloat(string name, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberFloat(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a double value + /// + /// Name of the member + /// Double value to set + public void SetMemberDouble(string name, double value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberDouble(Handle, name, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a pointer value + /// + /// Name of the member + /// Pointer value as uintptr_t to set + public void SetMemberPointer(string name, nint ptr) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberPointer(Handle, name, ptr); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a string token value + /// + /// Name of the member + /// String token hash code to set + public void SetMemberStringToken(string name, uint token) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberStringToken(Handle, name, token); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an entity handle value + /// + /// Name of the member + /// Entity handle value to set + public void SetMemberEHandle(string name, int ehandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberEHandle(Handle, name, ehandle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a string value (copies the string) + /// + /// Name of the member + /// String value to set + /// String subtype enumeration value + public void SetMemberString(string name, string str, byte subtype) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberString(Handle, name, str, subtype); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an external string value (does not copy) + /// + /// Name of the member + /// External string value to reference + /// String subtype enumeration value + public void SetMemberStringExternal(string name, string str, byte subtype) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberStringExternal(Handle, name, str, subtype); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a color value + /// + /// Name of the member + /// Color value as int32_t to set + public void SetMemberColor(string name, int color) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberColor(Handle, name, color); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a 3D vector value + /// + /// Name of the member + /// 3D vector to set + public void SetMemberVector(string name, Vector3 vec) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberVector(Handle, name, vec); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a 2D vector value + /// + /// Name of the member + /// 2D vector to set + public void SetMemberVector2D(string name, Vector2 vec2d) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberVector2D(Handle, name, vec2d); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a 4D vector value + /// + /// Name of the member + /// 4D vector to set + public void SetMemberVector4D(string name, Vector4 vec4d) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberVector4D(Handle, name, vec4d); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a quaternion value + /// + /// Name of the member + /// Quaternion to set (as vec4) + public void SetMemberQuaternion(string name, Vector4 quat) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberQuaternion(Handle, name, quat); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to an angle (QAngle) value + /// + /// Name of the member + /// QAngle to set (as vec3) + public void SetMemberQAngle(string name, Vector3 ang) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberQAngle(Handle, name, ang); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a table member to a 3x4 matrix value + /// + /// Name of the member + /// 3x4 matrix to set (as mat4x4) + public void SetMemberMatrix3x4(string name, Matrix4x4 matrix) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3SetMemberMatrix3x4(Handle, name, matrix); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Prints debug information about the KeyValues3 object + /// + public void DebugPrint() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv3DebugPrint(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a buffer + /// + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 Load(ref string error, byte[] input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3Load(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a text string + /// + /// Output string for error messages + /// Text string containing KV3 data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromText(ref string error, string input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromText(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a file + /// + /// Output string for error messages + /// Name of the file to load + /// Path to the file + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromFile(ref string error, string filename, string path, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromFile(Handle, ref error, filename, path, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a JSON string + /// + /// Output string for error messages + /// JSON string + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromJSON(ref string error, string input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromJSON(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a JSON file + /// + /// Output string for error messages + /// Path to the file + /// Name of the file to load + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromJSONFile(ref string error, string path, string filename, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromJSONFile(Handle, ref error, path, filename, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a KeyValues1 file + /// + /// Output string for error messages + /// Path to the file + /// Name of the file to load + /// Escape sequence behavior for KV1 text + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromKV1File(ref string error, string path, string filename, byte esc_behavior, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromKV1File(Handle, ref error, path, filename, esc_behavior, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a KeyValues1 text string + /// + /// Output string for error messages + /// KV1 text string + /// Escape sequence behavior for KV1 text + /// Name for the KeyValues3 object + /// Unknown boolean parameter + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromKV1Text(ref string error, string input, byte esc_behavior, string kv_name, Bool8 unk, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromKV1Text(Handle, ref error, input, esc_behavior, kv_name, unk, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from a KeyValues1 text string with translation + /// + /// Output string for error messages + /// KV1 text string + /// Escape sequence behavior for KV1 text + /// Pointer to translation table + /// Unknown integer parameter + /// Name for the KeyValues3 object + /// Unknown boolean parameter + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromKV1TextTranslated(ref string error, string input, byte esc_behavior, nint translation, int unk1, string kv_name, Bool8 unk2, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromKV1TextTranslated(Handle, ref error, input, esc_behavior, translation, unk1, kv_name, unk2, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads data from a buffer that may be KV3 or KV1 format + /// + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromKV3OrKV1(ref string error, byte[] input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromKV3OrKV1(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 data from old schema text format + /// + /// Output string for error messages + /// Vector containing the input buffer data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadFromOldSchemaText(ref string error, byte[] input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadFromOldSchemaText(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Loads KeyValues3 text without a header + /// + /// Output string for error messages + /// Text string containing KV3 data + /// Name for the KeyValues3 object + /// Loading flags + /// true if successful, false otherwise + public Bool8 LoadTextNoHeader(ref string error, string input, string kv_name, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3LoadTextNoHeader(Handle, ref error, input, kv_name, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data to a buffer + /// + /// Output string for error messages + /// Vector to store the output buffer data + /// Saving flags + /// true if successful, false otherwise + public Bool8 Save(ref string error, ref byte[] output, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3Save(Handle, ref error, ref output, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data as JSON to a buffer + /// + /// Output string for error messages + /// Vector to store the output JSON data + /// true if successful, false otherwise + public Bool8 SaveAsJSON(ref string error, ref byte[] output) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveAsJSON(Handle, ref error, ref output); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data as a JSON string + /// + /// Output string for error messages + /// String to store the JSON output + /// true if successful, false otherwise + public Bool8 SaveAsJSONString(ref string error, ref string output) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveAsJSONString(Handle, ref error, ref output); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data as KeyValues1 text to a buffer + /// + /// Output string for error messages + /// Vector to store the output KV1 text data + /// Escape sequence behavior for KV1 text + /// true if successful, false otherwise + public Bool8 SaveAsKV1Text(ref string error, ref byte[] output, byte esc_behavior) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveAsKV1Text(Handle, ref error, ref output, esc_behavior); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data as KeyValues1 text with translation to a buffer + /// + /// Output string for error messages + /// Vector to store the output KV1 text data + /// Escape sequence behavior for KV1 text + /// Pointer to translation table + /// Unknown integer parameter + /// true if successful, false otherwise + public Bool8 SaveAsKV1TextTranslated(ref string error, ref byte[] output, byte esc_behavior, nint translation, int unk) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveAsKV1TextTranslated(Handle, ref error, ref output, esc_behavior, translation, unk); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 text without a header to a buffer + /// + /// Output string for error messages + /// Vector to store the output text data + /// Saving flags + /// true if successful, false otherwise + public Bool8 SaveTextNoHeaderToBuffer(ref string error, ref byte[] output, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveTextNoHeaderToBuffer(Handle, ref error, ref output, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 text without a header to a string + /// + /// Output string for error messages + /// String to store the text output + /// Saving flags + /// true if successful, false otherwise + public Bool8 SaveTextNoHeader(ref string error, ref string output, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveTextNoHeader(Handle, ref error, ref output, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 text to a string + /// + /// Output string for error messages + /// String to store the text output + /// Saving flags + /// true if successful, false otherwise + public Bool8 SaveTextToString(ref string error, ref string output, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveTextToString(Handle, ref error, ref output, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Saves KeyValues3 data to a file + /// + /// Output string for error messages + /// Name of the file to save + /// Path to save the file + /// Saving flags + /// true if successful, false otherwise + public Bool8 SaveToFile(ref string error, string filename, string path, uint flags) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv3SaveToFile(Handle, ref error, filename, path, flags); + } + finally + { + if (success) DangerousRelease(); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/listeners.cs b/PlugifyProfiler/imported/s2sdk/listeners.cs new file mode 100644 index 0000000..ab981ba --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/listeners.cs @@ -0,0 +1,545 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: listeners) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnect_Register = &___OnClientConnect_Register; + internal static delegate* unmanaged[Cdecl] __OnClientConnect_Register; + private static void ___OnClientConnect_Register(OnClientConnectCallback callback) + { + __OnClientConnect_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnect_Unregister = &___OnClientConnect_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientConnect_Unregister; + private static void ___OnClientConnect_Unregister(OnClientConnectCallback callback) + { + __OnClientConnect_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnect_Post_Register = &___OnClientConnect_Post_Register; + internal static delegate* unmanaged[Cdecl] __OnClientConnect_Post_Register; + private static void ___OnClientConnect_Post_Register(OnClientConnect_PostCallback callback) + { + __OnClientConnect_Post_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnect_Post_Unregister = &___OnClientConnect_Post_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientConnect_Post_Unregister; + private static void ___OnClientConnect_Post_Unregister(OnClientConnect_PostCallback callback) + { + __OnClientConnect_Post_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnected_Register = &___OnClientConnected_Register; + internal static delegate* unmanaged[Cdecl] __OnClientConnected_Register; + private static void ___OnClientConnected_Register(OnClientConnectedCallback callback) + { + __OnClientConnected_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientConnected_Unregister = &___OnClientConnected_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientConnected_Unregister; + private static void ___OnClientConnected_Unregister(OnClientConnectedCallback callback) + { + __OnClientConnected_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientPutInServer_Register = &___OnClientPutInServer_Register; + internal static delegate* unmanaged[Cdecl] __OnClientPutInServer_Register; + private static void ___OnClientPutInServer_Register(OnClientPutInServerCallback callback) + { + __OnClientPutInServer_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientPutInServer_Unregister = &___OnClientPutInServer_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientPutInServer_Unregister; + private static void ___OnClientPutInServer_Unregister(OnClientPutInServerCallback callback) + { + __OnClientPutInServer_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientDisconnect_Register = &___OnClientDisconnect_Register; + internal static delegate* unmanaged[Cdecl] __OnClientDisconnect_Register; + private static void ___OnClientDisconnect_Register(OnClientDisconnectCallback callback) + { + __OnClientDisconnect_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientDisconnect_Unregister = &___OnClientDisconnect_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientDisconnect_Unregister; + private static void ___OnClientDisconnect_Unregister(OnClientDisconnectCallback callback) + { + __OnClientDisconnect_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientDisconnect_Post_Register = &___OnClientDisconnect_Post_Register; + internal static delegate* unmanaged[Cdecl] __OnClientDisconnect_Post_Register; + private static void ___OnClientDisconnect_Post_Register(OnClientDisconnect_PostCallback callback) + { + __OnClientDisconnect_Post_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientDisconnect_Post_Unregister = &___OnClientDisconnect_Post_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientDisconnect_Post_Unregister; + private static void ___OnClientDisconnect_Post_Unregister(OnClientDisconnect_PostCallback callback) + { + __OnClientDisconnect_Post_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientActive_Register = &___OnClientActive_Register; + internal static delegate* unmanaged[Cdecl] __OnClientActive_Register; + private static void ___OnClientActive_Register(OnClientActiveCallback callback) + { + __OnClientActive_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientActive_Unregister = &___OnClientActive_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientActive_Unregister; + private static void ___OnClientActive_Unregister(OnClientActiveCallback callback) + { + __OnClientActive_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientFullyConnect_Register = &___OnClientFullyConnect_Register; + internal static delegate* unmanaged[Cdecl] __OnClientFullyConnect_Register; + private static void ___OnClientFullyConnect_Register(OnClientFullyConnectCallback callback) + { + __OnClientFullyConnect_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientFullyConnect_Unregister = &___OnClientFullyConnect_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientFullyConnect_Unregister; + private static void ___OnClientFullyConnect_Unregister(OnClientFullyConnectCallback callback) + { + __OnClientFullyConnect_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientSettingsChanged_Register = &___OnClientSettingsChanged_Register; + internal static delegate* unmanaged[Cdecl] __OnClientSettingsChanged_Register; + private static void ___OnClientSettingsChanged_Register(OnClientSettingsChangedCallback callback) + { + __OnClientSettingsChanged_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientSettingsChanged_Unregister = &___OnClientSettingsChanged_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientSettingsChanged_Unregister; + private static void ___OnClientSettingsChanged_Unregister(OnClientSettingsChangedCallback callback) + { + __OnClientSettingsChanged_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnClientAuthenticated_Register = &___OnClientAuthenticated_Register; + internal static delegate* unmanaged[Cdecl] __OnClientAuthenticated_Register; + private static void ___OnClientAuthenticated_Register(OnClientAuthenticatedCallback callback) + { + __OnClientAuthenticated_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnClientAuthenticated_Unregister = &___OnClientAuthenticated_Unregister; + internal static delegate* unmanaged[Cdecl] __OnClientAuthenticated_Unregister; + private static void ___OnClientAuthenticated_Unregister(OnClientAuthenticatedCallback callback) + { + __OnClientAuthenticated_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnRoundTerminated_Register = &___OnRoundTerminated_Register; + internal static delegate* unmanaged[Cdecl] __OnRoundTerminated_Register; + private static void ___OnRoundTerminated_Register(OnRoundTerminatedCallback callback) + { + __OnRoundTerminated_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnRoundTerminated_Unregister = &___OnRoundTerminated_Unregister; + internal static delegate* unmanaged[Cdecl] __OnRoundTerminated_Unregister; + private static void ___OnRoundTerminated_Unregister(OnRoundTerminatedCallback callback) + { + __OnRoundTerminated_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnEntityCreated_Register = &___OnEntityCreated_Register; + internal static delegate* unmanaged[Cdecl] __OnEntityCreated_Register; + private static void ___OnEntityCreated_Register(OnEntityCreatedCallback callback) + { + __OnEntityCreated_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnEntityCreated_Unregister = &___OnEntityCreated_Unregister; + internal static delegate* unmanaged[Cdecl] __OnEntityCreated_Unregister; + private static void ___OnEntityCreated_Unregister(OnEntityCreatedCallback callback) + { + __OnEntityCreated_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnEntityDeleted_Register = &___OnEntityDeleted_Register; + internal static delegate* unmanaged[Cdecl] __OnEntityDeleted_Register; + private static void ___OnEntityDeleted_Register(OnEntityDeletedCallback callback) + { + __OnEntityDeleted_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnEntityDeleted_Unregister = &___OnEntityDeleted_Unregister; + internal static delegate* unmanaged[Cdecl] __OnEntityDeleted_Unregister; + private static void ___OnEntityDeleted_Unregister(OnEntityDeletedCallback callback) + { + __OnEntityDeleted_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnEntityParentChanged_Register = &___OnEntityParentChanged_Register; + internal static delegate* unmanaged[Cdecl] __OnEntityParentChanged_Register; + private static void ___OnEntityParentChanged_Register(OnEntityParentChangedCallback callback) + { + __OnEntityParentChanged_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnEntityParentChanged_Unregister = &___OnEntityParentChanged_Unregister; + internal static delegate* unmanaged[Cdecl] __OnEntityParentChanged_Unregister; + private static void ___OnEntityParentChanged_Unregister(OnEntityParentChangedCallback callback) + { + __OnEntityParentChanged_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnServerCheckTransmit_Register = &___OnServerCheckTransmit_Register; + internal static delegate* unmanaged[Cdecl] __OnServerCheckTransmit_Register; + private static void ___OnServerCheckTransmit_Register(OnServerCheckTransmitCallback callback) + { + __OnServerCheckTransmit_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnServerCheckTransmit_Unregister = &___OnServerCheckTransmit_Unregister; + internal static delegate* unmanaged[Cdecl] __OnServerCheckTransmit_Unregister; + private static void ___OnServerCheckTransmit_Unregister(OnServerCheckTransmitCallback callback) + { + __OnServerCheckTransmit_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnServerStartup_Register = &___OnServerStartup_Register; + internal static delegate* unmanaged[Cdecl] __OnServerStartup_Register; + private static void ___OnServerStartup_Register(OnServerStartupCallback callback) + { + __OnServerStartup_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnServerStartup_Unregister = &___OnServerStartup_Unregister; + internal static delegate* unmanaged[Cdecl] __OnServerStartup_Unregister; + private static void ___OnServerStartup_Unregister(OnServerStartupCallback callback) + { + __OnServerStartup_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnServerActivate_Register = &___OnServerActivate_Register; + internal static delegate* unmanaged[Cdecl] __OnServerActivate_Register; + private static void ___OnServerActivate_Register(OnServerActivateCallback callback) + { + __OnServerActivate_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnServerActivate_Unregister = &___OnServerActivate_Unregister; + internal static delegate* unmanaged[Cdecl] __OnServerActivate_Unregister; + private static void ___OnServerActivate_Unregister(OnServerActivateCallback callback) + { + __OnServerActivate_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnServerSpawn_Register = &___OnServerSpawn_Register; + internal static delegate* unmanaged[Cdecl] __OnServerSpawn_Register; + private static void ___OnServerSpawn_Register(OnServerSpawnCallback callback) + { + __OnServerSpawn_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnServerSpawn_Unregister = &___OnServerSpawn_Unregister; + internal static delegate* unmanaged[Cdecl] __OnServerSpawn_Unregister; + private static void ___OnServerSpawn_Unregister(OnServerSpawnCallback callback) + { + __OnServerSpawn_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnServerStarted_Register = &___OnServerStarted_Register; + internal static delegate* unmanaged[Cdecl] __OnServerStarted_Register; + private static void ___OnServerStarted_Register(OnServerStartedCallback callback) + { + __OnServerStarted_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnServerStarted_Unregister = &___OnServerStarted_Unregister; + internal static delegate* unmanaged[Cdecl] __OnServerStarted_Unregister; + private static void ___OnServerStarted_Unregister(OnServerStartedCallback callback) + { + __OnServerStarted_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnMapStart_Register = &___OnMapStart_Register; + internal static delegate* unmanaged[Cdecl] __OnMapStart_Register; + private static void ___OnMapStart_Register(OnMapStartCallback callback) + { + __OnMapStart_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnMapStart_Unregister = &___OnMapStart_Unregister; + internal static delegate* unmanaged[Cdecl] __OnMapStart_Unregister; + private static void ___OnMapStart_Unregister(OnMapStartCallback callback) + { + __OnMapStart_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnMapEnd_Register = &___OnMapEnd_Register; + internal static delegate* unmanaged[Cdecl] __OnMapEnd_Register; + private static void ___OnMapEnd_Register(OnMapEndCallback callback) + { + __OnMapEnd_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnMapEnd_Unregister = &___OnMapEnd_Unregister; + internal static delegate* unmanaged[Cdecl] __OnMapEnd_Unregister; + private static void ___OnMapEnd_Unregister(OnMapEndCallback callback) + { + __OnMapEnd_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnGameFrame_Register = &___OnGameFrame_Register; + internal static delegate* unmanaged[Cdecl] __OnGameFrame_Register; + private static void ___OnGameFrame_Register(OnGameFrameCallback callback) + { + __OnGameFrame_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnGameFrame_Unregister = &___OnGameFrame_Unregister; + internal static delegate* unmanaged[Cdecl] __OnGameFrame_Unregister; + private static void ___OnGameFrame_Unregister(OnGameFrameCallback callback) + { + __OnGameFrame_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnUpdateWhenNotInGame_Register = &___OnUpdateWhenNotInGame_Register; + internal static delegate* unmanaged[Cdecl] __OnUpdateWhenNotInGame_Register; + private static void ___OnUpdateWhenNotInGame_Register(OnUpdateWhenNotInGameCallback callback) + { + __OnUpdateWhenNotInGame_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnUpdateWhenNotInGame_Unregister = &___OnUpdateWhenNotInGame_Unregister; + internal static delegate* unmanaged[Cdecl] __OnUpdateWhenNotInGame_Unregister; + private static void ___OnUpdateWhenNotInGame_Unregister(OnUpdateWhenNotInGameCallback callback) + { + __OnUpdateWhenNotInGame_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Register callback to event. + /// + /// Function callback. + internal static delegate* OnPreWorldUpdate_Register = &___OnPreWorldUpdate_Register; + internal static delegate* unmanaged[Cdecl] __OnPreWorldUpdate_Register; + private static void ___OnPreWorldUpdate_Register(OnPreWorldUpdateCallback callback) + { + __OnPreWorldUpdate_Register(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + /// + /// Unregister callback to event. + /// + /// Function callback. + internal static delegate* OnPreWorldUpdate_Unregister = &___OnPreWorldUpdate_Unregister; + internal static delegate* unmanaged[Cdecl] __OnPreWorldUpdate_Unregister; + private static void ___OnPreWorldUpdate_Unregister(OnPreWorldUpdateCallback callback) + { + __OnPreWorldUpdate_Unregister(Marshalling.GetFunctionPointerForDelegate(callback)); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/logger.cs b/PlugifyProfiler/imported/s2sdk/logger.cs new file mode 100644 index 0000000..c1253ee --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/logger.cs @@ -0,0 +1,333 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: logger) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Registers a new logging channel with specified properties. + /// + /// The name of the logging channel. + /// Flags associated with the logging channel. + /// The verbosity level for the logging channel. + /// The color for messages logged to this channel. + /// The ID of the newly created logging channel. + internal static delegate* RegisterLoggingChannel = &___RegisterLoggingChannel; + internal static delegate* unmanaged[Cdecl] __RegisterLoggingChannel; + private static int ___RegisterLoggingChannel(string name, int iFlags, LoggingVerbosity verbosity, int color) + { + int __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __RegisterLoggingChannel(&__name, iFlags, verbosity, color); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Adds a tag to a specified logging channel. + /// + /// The ID of the logging channel to which the tag will be added. + /// The name of the tag to add to the channel. + internal static delegate* AddLoggerTagToChannel = &___AddLoggerTagToChannel; + internal static delegate* unmanaged[Cdecl] __AddLoggerTagToChannel; + private static void ___AddLoggerTagToChannel(int channelID, string tagName) + { + var __tagName = NativeMethods.ConstructString(tagName); + try { + __AddLoggerTagToChannel(channelID, &__tagName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__tagName); + } + } + + /// + /// Checks if a specified tag exists in a logging channel. + /// + /// The ID of the logging channel. + /// The name of the tag to check for. + /// True if the tag exists in the channel, otherwise false. + internal static delegate* HasLoggerTag = &___HasLoggerTag; + internal static delegate* unmanaged[Cdecl] __HasLoggerTag; + private static Bool8 ___HasLoggerTag(int channelID, string tag) + { + Bool8 __retVal; + var __tag = NativeMethods.ConstructString(tag); + try { + __retVal = __HasLoggerTag(channelID, &__tag); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__tag); + } + return __retVal; + } + + /// + /// Checks if a logging channel is enabled based on severity. + /// + /// The ID of the logging channel. + /// The severity of a logging operation. + /// True if the channel is enabled for the specified severity, otherwise false. + internal static delegate* IsLoggerChannelEnabledBySeverity = &___IsLoggerChannelEnabledBySeverity; + internal static delegate* unmanaged[Cdecl] __IsLoggerChannelEnabledBySeverity; + private static Bool8 ___IsLoggerChannelEnabledBySeverity(int channelID, LoggingSeverity severity) + { + Bool8 __retVal = __IsLoggerChannelEnabledBySeverity(channelID, severity); + return __retVal; + } + + /// + /// Checks if a logging channel is enabled based on verbosity. + /// + /// The ID of the logging channel. + /// The verbosity level to check. + /// True if the channel is enabled for the specified verbosity, otherwise false. + internal static delegate* IsLoggerChannelEnabledByVerbosity = &___IsLoggerChannelEnabledByVerbosity; + internal static delegate* unmanaged[Cdecl] __IsLoggerChannelEnabledByVerbosity; + private static Bool8 ___IsLoggerChannelEnabledByVerbosity(int channelID, LoggingVerbosity verbosity) + { + Bool8 __retVal = __IsLoggerChannelEnabledByVerbosity(channelID, verbosity); + return __retVal; + } + + /// + /// Retrieves the verbosity level of a logging channel. + /// + /// The ID of the logging channel. + /// The verbosity level of the specified logging channel. + internal static delegate* GetLoggerChannelVerbosity = &___GetLoggerChannelVerbosity; + internal static delegate* unmanaged[Cdecl] __GetLoggerChannelVerbosity; + private static int ___GetLoggerChannelVerbosity(int channelID) + { + int __retVal = __GetLoggerChannelVerbosity(channelID); + return __retVal; + } + + /// + /// Sets the verbosity level of a logging channel. + /// + /// The ID of the logging channel. + /// The new verbosity level to set. + internal static delegate* SetLoggerChannelVerbosity = &___SetLoggerChannelVerbosity; + internal static delegate* unmanaged[Cdecl] __SetLoggerChannelVerbosity; + private static void ___SetLoggerChannelVerbosity(int channelID, LoggingVerbosity verbosity) + { + __SetLoggerChannelVerbosity(channelID, verbosity); + } + + /// + /// Sets the verbosity level of a logging channel by name. + /// + /// The ID of the logging channel. + /// The name of the logging channel. + /// The new verbosity level to set. + internal static delegate* SetLoggerChannelVerbosityByName = &___SetLoggerChannelVerbosityByName; + internal static delegate* unmanaged[Cdecl] __SetLoggerChannelVerbosityByName; + private static void ___SetLoggerChannelVerbosityByName(int channelID, string name, LoggingVerbosity verbosity) + { + var __name = NativeMethods.ConstructString(name); + try { + __SetLoggerChannelVerbosityByName(channelID, &__name, verbosity); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets the verbosity level of a logging channel by tag. + /// + /// The ID of the logging channel. + /// The name of the tag. + /// The new verbosity level to set. + internal static delegate* SetLoggerChannelVerbosityByTag = &___SetLoggerChannelVerbosityByTag; + internal static delegate* unmanaged[Cdecl] __SetLoggerChannelVerbosityByTag; + private static void ___SetLoggerChannelVerbosityByTag(int channelID, string tag, LoggingVerbosity verbosity) + { + var __tag = NativeMethods.ConstructString(tag); + try { + __SetLoggerChannelVerbosityByTag(channelID, &__tag, verbosity); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__tag); + } + } + + /// + /// Retrieves the color setting of a logging channel. + /// + /// The ID of the logging channel. + /// The color value of the specified logging channel. + internal static delegate* GetLoggerChannelColor = &___GetLoggerChannelColor; + internal static delegate* unmanaged[Cdecl] __GetLoggerChannelColor; + private static int ___GetLoggerChannelColor(int channelID) + { + int __retVal = __GetLoggerChannelColor(channelID); + return __retVal; + } + + /// + /// Sets the color setting of a logging channel. + /// + /// The ID of the logging channel. + /// The new color value to set for the channel. + internal static delegate* SetLoggerChannelColor = &___SetLoggerChannelColor; + internal static delegate* unmanaged[Cdecl] __SetLoggerChannelColor; + private static void ___SetLoggerChannelColor(int channelID, int color) + { + __SetLoggerChannelColor(channelID, color); + } + + /// + /// Retrieves the flags of a logging channel. + /// + /// The ID of the logging channel. + /// The flags of the specified logging channel. + internal static delegate* GetLoggerChannelFlags = &___GetLoggerChannelFlags; + internal static delegate* unmanaged[Cdecl] __GetLoggerChannelFlags; + private static int ___GetLoggerChannelFlags(int channelID) + { + int __retVal = __GetLoggerChannelFlags(channelID); + return __retVal; + } + + /// + /// Sets the flags of a logging channel. + /// + /// The ID of the logging channel. + /// The new flags to set for the channel. + internal static delegate* SetLoggerChannelFlags = &___SetLoggerChannelFlags; + internal static delegate* unmanaged[Cdecl] __SetLoggerChannelFlags; + private static void ___SetLoggerChannelFlags(int channelID, LoggingChannelFlags eFlags) + { + __SetLoggerChannelFlags(channelID, eFlags); + } + + /// + /// Logs a message to a specified channel with a severity level. + /// + /// The ID of the logging channel. + /// The severity level for the log message. + /// The message to log. + /// An integer indicating the result of the logging operation. + internal static delegate* Log = &___Log; + internal static delegate* unmanaged[Cdecl] __Log; + private static int ___Log(int channelID, LoggingSeverity severity, string message) + { + int __retVal; + var __message = NativeMethods.ConstructString(message); + try { + __retVal = __Log(channelID, severity, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + return __retVal; + } + + /// + /// Logs a colored message to a specified channel with a severity level. + /// + /// The ID of the logging channel. + /// The severity level for the log message. + /// The color for the log message. + /// The message to log. + /// An integer indicating the result of the logging operation. + internal static delegate* LogColored = &___LogColored; + internal static delegate* unmanaged[Cdecl] __LogColored; + private static int ___LogColored(int channelID, LoggingSeverity severity, int color, string message) + { + int __retVal; + var __message = NativeMethods.ConstructString(message); + try { + __retVal = __LogColored(channelID, severity, color, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__message); + } + return __retVal; + } + + /// + /// Logs a detailed message to a specified channel, including source code info. + /// + /// The ID of the logging channel. + /// The severity level for the log message. + /// The file name where the log call occurred. + /// The line number where the log call occurred. + /// The name of the function where the log call occurred. + /// The message to log. + /// An integer indicating the result of the logging operation. + internal static delegate* LogFull = &___LogFull; + internal static delegate* unmanaged[Cdecl] __LogFull; + private static int ___LogFull(int channelID, LoggingSeverity severity, string file, int line, string function, string message) + { + int __retVal; + var __file = NativeMethods.ConstructString(file); + var __function = NativeMethods.ConstructString(function); + var __message = NativeMethods.ConstructString(message); + try { + __retVal = __LogFull(channelID, severity, &__file, line, &__function, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__file); + NativeMethods.DestroyString(&__function); + NativeMethods.DestroyString(&__message); + } + return __retVal; + } + + /// + /// Logs a detailed colored message to a specified channel, including source code info. + /// + /// The ID of the logging channel. + /// The severity level for the log message. + /// The file name where the log call occurred. + /// The line number where the log call occurred. + /// The name of the function where the log call occurred. + /// The color for the log message. + /// The message to log. + /// An integer indicating the result of the logging operation. + internal static delegate* LogFullColored = &___LogFullColored; + internal static delegate* unmanaged[Cdecl] __LogFullColored; + private static int ___LogFullColored(int channelID, LoggingSeverity severity, string file, int line, string function, int color, string message) + { + int __retVal; + var __file = NativeMethods.ConstructString(file); + var __function = NativeMethods.ConstructString(function); + var __message = NativeMethods.ConstructString(message); + try { + __retVal = __LogFullColored(channelID, severity, &__file, line, &__function, color, &__message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__file); + NativeMethods.DestroyString(&__function); + NativeMethods.DestroyString(&__message); + } + return __retVal; + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/main.cs b/PlugifyProfiler/imported/s2sdk/main.cs new file mode 100644 index 0000000..c9c79bc --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/main.cs @@ -0,0 +1,559 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: main) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + } + + /// + /// Static utility class for MEthodsUtils + /// + internal static unsafe class MEthodsUtils + { + /// + /// Returns the maximum number of clients that can connect to the server. + /// + /// The maximum client count, or -1 if global variables are not initialized. + public static int GetMaxClients() + { + return s2sdk.GetMaxClients(); + } + + } + + /// + /// RAII wrapper for KeyValues handle. + /// + internal sealed unsafe class KeyValues : SafeHandle + { + /// + /// Creates a new KeyValues instance + /// + /// The name to assign to this KeyValues instance + public KeyValues(string setName) : this(s2sdk.Kv1Create(setName), Ownership.Owned) + { + } + + /// + /// Internal constructor for creating KeyValues from existing handle + /// + private KeyValues(nint handle, Ownership ownership) : base(handle, ownsHandle: ownership == Ownership.Owned) + { + } + + /// + /// Releases the handle (called automatically by SafeHandle) + /// + protected override bool ReleaseHandle() + { + s2sdk.Kv1Destroy(handle); + return true; + } + + /// + /// Checks if the KeyValues has a valid handle + /// + public override bool IsInvalid => handle == nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Handle => (nint)handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => (nint)handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + SetHandleAsInvalid(); + return h; + } + + /// + /// Disposes the handle + /// + public void Reset() + { + Dispose(); + } + + /// + /// Gets the section name of a KeyValues instance + /// + /// The name of the KeyValues section + public string GetName() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetName(handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the section name of a KeyValues instance + /// + /// The new name to assign to this KeyValues section + public void SetName(string name) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetName(handle, name); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a key by name + /// + /// The name of the key to find + /// Pointer to the found KeyValues subkey, or NULL if not found + public KeyValues FindKey(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1FindKey(handle, keyName), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Creates a new subkey with the specified name + /// + /// The name for the new key + /// Pointer to the newly created KeyValues subkey + public KeyValues CreateKey(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1CreateKey(handle, keyName), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Creates a new subkey with an autogenerated name + /// + /// Pointer to the newly created KeyValues subkey + public KeyValues CreateNewKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1CreateNewKey(handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a subkey to this KeyValues instance + /// + /// Pointer to the KeyValues object to add as a child + public void AddSubKey(KeyValues subKey) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1AddSubKey(handle, subKey.Release()); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the first subkey in the list + /// + /// Pointer to the first subkey, or NULL if there are no children + public KeyValues GetFirstSubKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1GetFirstSubKey(handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the next sibling key in the list + /// + /// Pointer to the next sibling key, or NULL if this is the last sibling + public KeyValues GetNextKey() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1GetNextKey(handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a color value from a key + /// + /// The name of the key to retrieve the color from + /// The default color value to return if the key is not found + /// The color value as a 32-bit integer (RGBA) + public int GetColor(string keyName, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetColor(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a color value for a key + /// + /// The name of the key to set the color for + /// The color value as a 32-bit integer (RGBA) + public void SetColor(string keyName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetColor(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an integer value from a key + /// + /// The name of the key to retrieve the integer from + /// The default value to return if the key is not found + /// The integer value associated with the key, or defaultValue if not found + public int GetInt(string keyName, int defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetInt(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets an integer value for a key + /// + /// The name of the key to set the integer for + /// The integer value to set + public void SetInt(string keyName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetInt(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a float value from a key + /// + /// The name of the key to retrieve the float from + /// The default value to return if the key is not found + /// The float value associated with the key, or defaultValue if not found + public float GetFloat(string keyName, float defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetFloat(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a float value for a key + /// + /// The name of the key to set the float for + /// The float value to set + public void SetFloat(string keyName, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetFloat(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a string value from a key + /// + /// The name of the key to retrieve the string from + /// The default string to return if the key is not found + /// The string value associated with the key, or defaultValue if not found + public string GetString(string keyName, string defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetString(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a string value for a key + /// + /// The name of the key to set the string for + /// The string value to set + public void SetString(string keyName, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetString(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a pointer value from a key + /// + /// The name of the key to retrieve the pointer from + /// The default pointer to return if the key is not found + /// The pointer value associated with the key, or defaultValue if not found + public nint GetPtr(string keyName, nint defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetPtr(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a pointer value for a key + /// + /// The name of the key to set the pointer for + /// The pointer value to set + public void SetPtr(string keyName, nint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetPtr(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a boolean value from a key + /// + /// The name of the key to retrieve the boolean from + /// The default value to return if the key is not found + /// The boolean value associated with the key, or defaultValue if not found + public Bool8 GetBool(string keyName, Bool8 defaultValue) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1GetBool(handle, keyName, defaultValue); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a boolean value for a key + /// + /// The name of the key to set the boolean for + /// The boolean value to set + public void SetBool(string keyName, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1SetBool(handle, keyName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Makes a deep copy of a KeyValues tree + /// + /// Pointer to the newly allocated copy of the KeyValues tree + public KeyValues MakeCopy() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return new KeyValues(s2sdk.Kv1MakeCopy(handle), Ownership.Borrowed); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Clears all subkeys and the current value + /// + public void Clear() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.Kv1Clear(handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if a key exists and has no value or subkeys + /// + /// The name of the key to check + /// true if the key exists and is empty, false otherwise + public Bool8 IsEmpty(string keyName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.Kv1IsEmpty(handle, keyName); + } + finally + { + if (success) DangerousRelease(); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/math.cs b/PlugifyProfiler/imported/s2sdk/math.cs new file mode 100644 index 0000000..35e7c5b --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/math.cs @@ -0,0 +1,303 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: math) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Returns angular difference in degrees + /// + /// First angle in degrees + /// Second angle in degrees + /// Angular difference in degrees + internal static delegate* AnglesDiff = &___AnglesDiff; + internal static delegate* unmanaged[Cdecl] __AnglesDiff; + private static float ___AnglesDiff(float angle1, float angle2) + { + float __retVal = __AnglesDiff(angle1, angle2); + return __retVal; + } + + /// + /// Converts QAngle to directional Vector + /// + /// The QAngle to convert + /// Directional vector + internal static delegate* AnglesToVector = &___AnglesToVector; + internal static delegate* unmanaged[Cdecl] __AnglesToVector; + private static Vector3 ___AnglesToVector(Vector3 angles) + { + Vector3 __retVal = __AnglesToVector(&angles); + return __retVal; + } + + /// + /// Converts axis-angle representation to quaternion + /// + /// Rotation axis (should be normalized) + /// Rotation angle in radians + /// Resulting quaternion + internal static delegate* AxisAngleToQuaternion = &___AxisAngleToQuaternion; + internal static delegate* unmanaged[Cdecl] __AxisAngleToQuaternion; + private static Vector4 ___AxisAngleToQuaternion(Vector3 axis, float angle) + { + Vector4 __retVal = __AxisAngleToQuaternion(&axis, angle); + return __retVal; + } + + /// + /// Computes closest point on an entity's oriented bounding box (OBB) + /// + /// Handle of the entity + /// Position to find closest point from + /// Closest point on the entity's OBB, or vec3_origin if entity is invalid + internal static delegate* CalcClosestPointOnEntityOBB = &___CalcClosestPointOnEntityOBB; + internal static delegate* unmanaged[Cdecl] __CalcClosestPointOnEntityOBB; + private static Vector3 ___CalcClosestPointOnEntityOBB(int entityHandle, Vector3 position) + { + Vector3 __retVal = __CalcClosestPointOnEntityOBB(entityHandle, &position); + return __retVal; + } + + /// + /// Computes distance between two entities' oriented bounding boxes (OBBs) + /// + /// Handle of the first entity + /// Handle of the second entity + /// Distance between OBBs, or -1.0f if either entity is invalid + internal static delegate* CalcDistanceBetweenEntityOBB = &___CalcDistanceBetweenEntityOBB; + internal static delegate* unmanaged[Cdecl] __CalcDistanceBetweenEntityOBB; + private static float ___CalcDistanceBetweenEntityOBB(int entityHandle1, int entityHandle2) + { + float __retVal = __CalcDistanceBetweenEntityOBB(entityHandle1, entityHandle2); + return __retVal; + } + + /// + /// Computes shortest 2D distance from a point to a line segment + /// + /// The point + /// First endpoint of the line segment + /// Second endpoint of the line segment + /// Shortest 2D distance + internal static delegate* CalcDistanceToLineSegment2D = &___CalcDistanceToLineSegment2D; + internal static delegate* unmanaged[Cdecl] __CalcDistanceToLineSegment2D; + private static float ___CalcDistanceToLineSegment2D(Vector3 p, Vector3 vLineA, Vector3 vLineB) + { + float __retVal = __CalcDistanceToLineSegment2D(&p, &vLineA, &vLineB); + return __retVal; + } + + /// + /// Computes cross product of two vectors + /// + /// First vector + /// Second vector + /// Cross product vector (v1 × v2) + internal static delegate* CrossVectors = &___CrossVectors; + internal static delegate* unmanaged[Cdecl] __CrossVectors; + private static Vector3 ___CrossVectors(Vector3 v1, Vector3 v2) + { + Vector3 __retVal = __CrossVectors(&v1, &v2); + return __retVal; + } + + /// + /// Smooth exponential decay function + /// + /// Target value to decay towards + /// Time constant for decay + /// Delta time + /// Decay factor + internal static delegate* ExponentDecay = &___ExponentDecay; + internal static delegate* unmanaged[Cdecl] __ExponentDecay; + private static float ___ExponentDecay(float decayTo, float decayTime, float dt) + { + float __retVal = __ExponentDecay(decayTo, decayTime, dt); + return __retVal; + } + + /// + /// Linear interpolation between two vectors + /// + /// Starting vector + /// Ending vector + /// Interpolation factor (0.0 to 1.0) + /// Interpolated vector + internal static delegate* LerpVectors = &___LerpVectors; + internal static delegate* unmanaged[Cdecl] __LerpVectors; + private static Vector3 ___LerpVectors(Vector3 start, Vector3 end, float factor) + { + Vector3 __retVal = __LerpVectors(&start, &end, factor); + return __retVal; + } + + /// + /// Quaternion spherical linear interpolation for angles + /// + /// Starting angle + /// Ending angle + /// Interpolation time (0.0 to 1.0) + /// Interpolated angle + internal static delegate* QSlerp = &___QSlerp; + internal static delegate* unmanaged[Cdecl] __QSlerp; + private static Vector3 ___QSlerp(Vector3 fromAngle, Vector3 toAngle, float time) + { + Vector3 __retVal = __QSlerp(&fromAngle, &toAngle, time); + return __retVal; + } + + /// + /// Rotate one QAngle by another + /// + /// Base orientation + /// Rotation to apply + /// Rotated orientation + internal static delegate* RotateOrientation = &___RotateOrientation; + internal static delegate* unmanaged[Cdecl] __RotateOrientation; + private static Vector3 ___RotateOrientation(Vector3 a1, Vector3 a2) + { + Vector3 __retVal = __RotateOrientation(&a1, &a2); + return __retVal; + } + + /// + /// Rotate a vector around a point by specified angle + /// + /// Origin point of rotation + /// Angle to rotate by + /// Vector to be rotated + /// Rotated vector + internal static delegate* RotatePosition = &___RotatePosition; + internal static delegate* unmanaged[Cdecl] __RotatePosition; + private static Vector3 ___RotatePosition(Vector3 rotationOrigin, Vector3 rotationAngle, Vector3 vectorToRotate) + { + Vector3 __retVal = __RotatePosition(&rotationOrigin, &rotationAngle, &vectorToRotate); + return __retVal; + } + + /// + /// Rotates quaternion by axis-angle representation + /// + /// Quaternion to rotate + /// Rotation axis + /// Rotation angle in radians + /// Rotated quaternion + internal static delegate* RotateQuaternionByAxisAngle = &___RotateQuaternionByAxisAngle; + internal static delegate* unmanaged[Cdecl] __RotateQuaternionByAxisAngle; + private static Vector4 ___RotateQuaternionByAxisAngle(Vector4 q, Vector3 axis, float angle) + { + Vector4 __retVal = __RotateQuaternionByAxisAngle(&q, &axis, angle); + return __retVal; + } + + /// + /// Finds angular delta between two QAngles + /// + /// Source angle + /// Destination angle + /// Delta angle from src to dest + internal static delegate* RotationDelta = &___RotationDelta; + internal static delegate* unmanaged[Cdecl] __RotationDelta; + private static Vector3 ___RotationDelta(Vector3 src, Vector3 dest) + { + Vector3 __retVal = __RotationDelta(&src, &dest); + return __retVal; + } + + /// + /// Converts delta QAngle to angular velocity vector + /// + /// First angle + /// Second angle + /// Angular velocity vector + internal static delegate* RotationDeltaAsAngularVelocity = &___RotationDeltaAsAngularVelocity; + internal static delegate* unmanaged[Cdecl] __RotationDeltaAsAngularVelocity; + private static Vector3 ___RotationDeltaAsAngularVelocity(Vector3 a1, Vector3 a2) + { + Vector3 __retVal = __RotationDeltaAsAngularVelocity(&a1, &a2); + return __retVal; + } + + /// + /// Interpolates between two quaternions using spline + /// + /// Starting quaternion + /// Ending quaternion + /// Interpolation parameter (0.0 to 1.0) + /// Interpolated quaternion + internal static delegate* SplineQuaternions = &___SplineQuaternions; + internal static delegate* unmanaged[Cdecl] __SplineQuaternions; + private static Vector4 ___SplineQuaternions(Vector4 q0, Vector4 q1, float t) + { + Vector4 __retVal = __SplineQuaternions(&q0, &q1, t); + return __retVal; + } + + /// + /// Interpolates between two vectors using spline + /// + /// Starting vector + /// Ending vector + /// Interpolation parameter (0.0 to 1.0) + /// Interpolated vector + internal static delegate* SplineVectors = &___SplineVectors; + internal static delegate* unmanaged[Cdecl] __SplineVectors; + private static Vector3 ___SplineVectors(Vector3 v0, Vector3 v1, float t) + { + Vector3 __retVal = __SplineVectors(&v0, &v1, t); + return __retVal; + } + + /// + /// Converts directional vector to QAngle (no roll) + /// + /// Direction vector + /// Angle representation with pitch and yaw (roll is 0) + internal static delegate* VectorToAngles = &___VectorToAngles; + internal static delegate* unmanaged[Cdecl] __VectorToAngles; + private static Vector3 ___VectorToAngles(Vector3 input) + { + Vector3 __retVal = __VectorToAngles(&input); + return __retVal; + } + + /// + /// Returns random float between min and max + /// + /// Minimum value (inclusive) + /// Maximum value (inclusive) + /// Random float in range [min, max] + internal static delegate* RandomFlt = &___RandomFlt; + internal static delegate* unmanaged[Cdecl] __RandomFlt; + private static float ___RandomFlt(float min, float max) + { + float __retVal = __RandomFlt(min, max); + return __retVal; + } + + /// + /// Returns random integer between min and max (inclusive) + /// + /// Minimum value (inclusive) + /// Maximum value (inclusive) + /// Random integer in range [min, max] + internal static delegate* RandomInt = &___RandomInt; + internal static delegate* unmanaged[Cdecl] __RandomInt; + private static int ___RandomInt(int min, int max) + { + int __retVal = __RandomInt(min, max); + return __retVal; + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/models.cs b/PlugifyProfiler/imported/s2sdk/models.cs new file mode 100644 index 0000000..24dfb74 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/models.cs @@ -0,0 +1,335 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: models) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Retrieves the attachment angles of an entity. + /// + /// The handle of the entity whose attachment angles are to be retrieved. + /// The attachment index. + /// A vector representing the attachment angles (pitch, yaw, roll). + internal static delegate* GetEntityAttachmentAngles = &___GetEntityAttachmentAngles; + internal static delegate* unmanaged[Cdecl] __GetEntityAttachmentAngles; + private static Vector3 ___GetEntityAttachmentAngles(int entityHandle, int attachmentIndex) + { + Vector3 __retVal = __GetEntityAttachmentAngles(entityHandle, attachmentIndex); + return __retVal; + } + + /// + /// Retrieves the forward vector of an entity's attachment. + /// + /// The handle of the entity whose attachment forward vector is to be retrieved. + /// The attachment index. + /// A vector representing the forward direction of the attachment. + internal static delegate* GetEntityAttachmentForward = &___GetEntityAttachmentForward; + internal static delegate* unmanaged[Cdecl] __GetEntityAttachmentForward; + private static Vector3 ___GetEntityAttachmentForward(int entityHandle, int attachmentIndex) + { + Vector3 __retVal = __GetEntityAttachmentForward(entityHandle, attachmentIndex); + return __retVal; + } + + /// + /// Retrieves the origin vector of an entity's attachment. + /// + /// The handle of the entity whose attachment origin is to be retrieved. + /// The attachment index. + /// A vector representing the origin of the attachment. + internal static delegate* GetEntityAttachmentOrigin = &___GetEntityAttachmentOrigin; + internal static delegate* unmanaged[Cdecl] __GetEntityAttachmentOrigin; + private static Vector3 ___GetEntityAttachmentOrigin(int entityHandle, int attachmentIndex) + { + Vector3 __retVal = __GetEntityAttachmentOrigin(entityHandle, attachmentIndex); + return __retVal; + } + + /// + /// Retrieves the material group hash of an entity. + /// + /// The handle of the entity. + /// The material group hash. + internal static delegate* GetEntityMaterialGroupHash = &___GetEntityMaterialGroupHash; + internal static delegate* unmanaged[Cdecl] __GetEntityMaterialGroupHash; + private static uint ___GetEntityMaterialGroupHash(int entityHandle) + { + uint __retVal = __GetEntityMaterialGroupHash(entityHandle); + return __retVal; + } + + /// + /// Retrieves the material group mask of an entity. + /// + /// The handle of the entity. + /// The mesh group mask. + internal static delegate* GetEntityMaterialGroupMask = &___GetEntityMaterialGroupMask; + internal static delegate* unmanaged[Cdecl] __GetEntityMaterialGroupMask; + private static ulong ___GetEntityMaterialGroupMask(int entityHandle) + { + ulong __retVal = __GetEntityMaterialGroupMask(entityHandle); + return __retVal; + } + + /// + /// Retrieves the model scale of an entity. + /// + /// The handle of the entity. + /// The model scale factor. + internal static delegate* GetEntityModelScale = &___GetEntityModelScale; + internal static delegate* unmanaged[Cdecl] __GetEntityModelScale; + private static float ___GetEntityModelScale(int entityHandle) + { + float __retVal = __GetEntityModelScale(entityHandle); + return __retVal; + } + + /// + /// Retrieves the render alpha of an entity. + /// + /// The handle of the entity. + /// The alpha modulation value. + internal static delegate* GetEntityRenderAlpha = &___GetEntityRenderAlpha; + internal static delegate* unmanaged[Cdecl] __GetEntityRenderAlpha; + private static int ___GetEntityRenderAlpha(int entityHandle) + { + int __retVal = __GetEntityRenderAlpha(entityHandle); + return __retVal; + } + + /// + /// Retrieves the render color of an entity. + /// + /// The handle of the entity. + /// A vector representing the render color (R, G, B). + internal static delegate* GetEntityRenderColor2 = &___GetEntityRenderColor2; + internal static delegate* unmanaged[Cdecl] __GetEntityRenderColor2; + private static Vector3 ___GetEntityRenderColor2(int entityHandle) + { + Vector3 __retVal = __GetEntityRenderColor2(entityHandle); + return __retVal; + } + + /// + /// Retrieves an attachment index by name. + /// + /// The handle of the entity. + /// The name of the attachment. + /// The attachment index, or -1 if not found. + internal static delegate* ScriptLookupAttachment = &___ScriptLookupAttachment; + internal static delegate* unmanaged[Cdecl] __ScriptLookupAttachment; + private static int ___ScriptLookupAttachment(int entityHandle, string attachmentName) + { + int __retVal; + var __attachmentName = NativeMethods.ConstructString(attachmentName); + try { + __retVal = __ScriptLookupAttachment(entityHandle, &__attachmentName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__attachmentName); + } + return __retVal; + } + + /// + /// Sets a bodygroup value by index. + /// + /// The handle of the entity. + /// The bodygroup index. + /// The new value to set for the bodygroup. + internal static delegate* SetEntityBodygroup = &___SetEntityBodygroup; + internal static delegate* unmanaged[Cdecl] __SetEntityBodygroup; + private static void ___SetEntityBodygroup(int entityHandle, int group, int value) + { + __SetEntityBodygroup(entityHandle, group, value); + } + + /// + /// Sets a bodygroup value by name. + /// + /// The handle of the entity. + /// The bodygroup name. + /// The new value to set for the bodygroup. + internal static delegate* SetEntityBodygroupByName = &___SetEntityBodygroupByName; + internal static delegate* unmanaged[Cdecl] __SetEntityBodygroupByName; + private static void ___SetEntityBodygroupByName(int entityHandle, string name, int value) + { + var __name = NativeMethods.ConstructString(name); + try { + __SetEntityBodygroupByName(entityHandle, &__name, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + } + + /// + /// Sets the light group of an entity. + /// + /// The handle of the entity. + /// The light group name. + internal static delegate* SetEntityLightGroup = &___SetEntityLightGroup; + internal static delegate* unmanaged[Cdecl] __SetEntityLightGroup; + private static void ___SetEntityLightGroup(int entityHandle, string lightGroup) + { + var __lightGroup = NativeMethods.ConstructString(lightGroup); + try { + __SetEntityLightGroup(entityHandle, &__lightGroup); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__lightGroup); + } + } + + /// + /// Sets the material group of an entity. + /// + /// The handle of the entity. + /// The material group name. + internal static delegate* SetEntityMaterialGroup = &___SetEntityMaterialGroup; + internal static delegate* unmanaged[Cdecl] __SetEntityMaterialGroup; + private static void ___SetEntityMaterialGroup(int entityHandle, string materialGroup) + { + var __materialGroup = NativeMethods.ConstructString(materialGroup); + try { + __SetEntityMaterialGroup(entityHandle, &__materialGroup); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__materialGroup); + } + } + + /// + /// Sets the material group hash of an entity. + /// + /// The handle of the entity. + /// The new material group hash to set. + internal static delegate* SetEntityMaterialGroupHash = &___SetEntityMaterialGroupHash; + internal static delegate* unmanaged[Cdecl] __SetEntityMaterialGroupHash; + private static void ___SetEntityMaterialGroupHash(int entityHandle, uint hash) + { + __SetEntityMaterialGroupHash(entityHandle, hash); + } + + /// + /// Sets the material group mask of an entity. + /// + /// The handle of the entity. + /// The new mesh group mask to set. + internal static delegate* SetEntityMaterialGroupMask = &___SetEntityMaterialGroupMask; + internal static delegate* unmanaged[Cdecl] __SetEntityMaterialGroupMask; + private static void ___SetEntityMaterialGroupMask(int entityHandle, ulong mask) + { + __SetEntityMaterialGroupMask(entityHandle, mask); + } + + /// + /// Sets the model scale of an entity. + /// + /// The handle of the entity. + /// The new scale factor. + internal static delegate* SetEntityModelScale = &___SetEntityModelScale; + internal static delegate* unmanaged[Cdecl] __SetEntityModelScale; + private static void ___SetEntityModelScale(int entityHandle, float scale) + { + __SetEntityModelScale(entityHandle, scale); + } + + /// + /// Sets the render alpha of an entity. + /// + /// The handle of the entity. + /// The new alpha value (0–255). + internal static delegate* SetEntityRenderAlpha = &___SetEntityRenderAlpha; + internal static delegate* unmanaged[Cdecl] __SetEntityRenderAlpha; + private static void ___SetEntityRenderAlpha(int entityHandle, int alpha) + { + __SetEntityRenderAlpha(entityHandle, alpha); + } + + /// + /// Sets the render color of an entity. + /// + /// The handle of the entity. + /// The red component (0–255). + /// The green component (0–255). + /// The blue component (0–255). + internal static delegate* SetEntityRenderColor2 = &___SetEntityRenderColor2; + internal static delegate* unmanaged[Cdecl] __SetEntityRenderColor2; + private static void ___SetEntityRenderColor2(int entityHandle, int r, int g, int b) + { + __SetEntityRenderColor2(entityHandle, r, g, b); + } + + /// + /// Sets the render mode of an entity. + /// + /// The handle of the entity. + /// The new render mode value. + internal static delegate* SetEntityRenderMode2 = &___SetEntityRenderMode2; + internal static delegate* unmanaged[Cdecl] __SetEntityRenderMode2; + private static void ___SetEntityRenderMode2(int entityHandle, int mode) + { + __SetEntityRenderMode2(entityHandle, mode); + } + + /// + /// Sets a single mesh group for an entity. + /// + /// The handle of the entity. + /// The name of the mesh group. + internal static delegate* SetEntitySingleMeshGroup = &___SetEntitySingleMeshGroup; + internal static delegate* unmanaged[Cdecl] __SetEntitySingleMeshGroup; + private static void ___SetEntitySingleMeshGroup(int entityHandle, string meshGroupName) + { + var __meshGroupName = NativeMethods.ConstructString(meshGroupName); + try { + __SetEntitySingleMeshGroup(entityHandle, &__meshGroupName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__meshGroupName); + } + } + + /// + /// Sets the size (bounding box) of an entity. + /// + /// The handle of the entity. + /// The minimum bounding box vector. + /// The maximum bounding box vector. + internal static delegate* SetEntitySize = &___SetEntitySize; + internal static delegate* unmanaged[Cdecl] __SetEntitySize; + private static void ___SetEntitySize(int entityHandle, Vector3 mins, Vector3 maxs) + { + __SetEntitySize(entityHandle, &mins, &maxs); + } + + /// + /// Sets the skin of an entity. + /// + /// The handle of the entity. + /// The new skin index. + internal static delegate* SetEntitySkin = &___SetEntitySkin; + internal static delegate* unmanaged[Cdecl] __SetEntitySkin; + private static void ___SetEntitySkin(int entityHandle, int skin) + { + __SetEntitySkin(entityHandle, skin); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/panorama.cs b/PlugifyProfiler/imported/s2sdk/panorama.cs new file mode 100644 index 0000000..7726e6d --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/panorama.cs @@ -0,0 +1,146 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: panorama) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Start a new Yes/No vote + /// + /// Maximum time to leave vote active for + /// Player slot of the vote caller. Use VOTE_CALLER_SERVER for 'Server'. + /// Translation string to use as the vote message. (Only '#SFUI_vote' or '#Panorama_vote' strings) + /// Extra string used in some vote translation strings. + /// Translation string to use as the vote message. (Only '#SFUI_vote' or '#Panorama_vote' strings) + /// Extra string used in some vote translation strings when the vote passes. + /// Reason for the vote to fail, used in some translation strings. + /// Recipient filter with all the clients who are allowed to participate in the vote. + /// Called when a menu action is completed. + /// Called when the vote has finished. + internal static delegate* PanoramaSendYesNoVote = &___PanoramaSendYesNoVote; + internal static delegate* unmanaged[Cdecl] __PanoramaSendYesNoVote; + private static Bool8 ___PanoramaSendYesNoVote(double duration, int caller, string voteTitle, string detailStr, string votePassTitle, string detailPassStr, VoteCreateFailed failReason, ulong filter, YesNoVoteResult result, YesNoVoteHandler handler) + { + Bool8 __retVal; + var __voteTitle = NativeMethods.ConstructString(voteTitle); + var __detailStr = NativeMethods.ConstructString(detailStr); + var __votePassTitle = NativeMethods.ConstructString(votePassTitle); + var __detailPassStr = NativeMethods.ConstructString(detailPassStr); + try { + __retVal = __PanoramaSendYesNoVote(duration, caller, &__voteTitle, &__detailStr, &__votePassTitle, &__detailPassStr, failReason, filter, Marshalling.GetFunctionPointerForDelegate(result), Marshalling.GetFunctionPointerForDelegate(handler)); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__voteTitle); + NativeMethods.DestroyString(&__detailStr); + NativeMethods.DestroyString(&__votePassTitle); + NativeMethods.DestroyString(&__detailPassStr); + } + return __retVal; + } + + /// + /// Start a new Yes/No vote with all players included + /// + /// Maximum time to leave vote active for + /// Player slot of the vote caller. Use VOTE_CALLER_SERVER for 'Server'. + /// Translation string to use as the vote message. (Only '#SFUI_vote' or '#Panorama_vote' strings) + /// Extra string used in some vote translation strings. + /// Translation string to use as the vote message. (Only '#SFUI_vote' or '#Panorama_vote' strings) + /// Extra string used in some vote translation strings when the vote passes. + /// Reason for the vote to fail, used in some translation strings. + /// Called when a menu action is completed. + /// Called when the vote has finished. + internal static delegate* PanoramaSendYesNoVoteToAll = &___PanoramaSendYesNoVoteToAll; + internal static delegate* unmanaged[Cdecl] __PanoramaSendYesNoVoteToAll; + private static Bool8 ___PanoramaSendYesNoVoteToAll(double duration, int caller, string voteTitle, string detailStr, string votePassTitle, string detailPassStr, VoteCreateFailed failReason, YesNoVoteResult result, YesNoVoteHandler handler) + { + Bool8 __retVal; + var __voteTitle = NativeMethods.ConstructString(voteTitle); + var __detailStr = NativeMethods.ConstructString(detailStr); + var __votePassTitle = NativeMethods.ConstructString(votePassTitle); + var __detailPassStr = NativeMethods.ConstructString(detailPassStr); + try { + __retVal = __PanoramaSendYesNoVoteToAll(duration, caller, &__voteTitle, &__detailStr, &__votePassTitle, &__detailPassStr, failReason, Marshalling.GetFunctionPointerForDelegate(result), Marshalling.GetFunctionPointerForDelegate(handler)); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__voteTitle); + NativeMethods.DestroyString(&__detailStr); + NativeMethods.DestroyString(&__votePassTitle); + NativeMethods.DestroyString(&__detailPassStr); + } + return __retVal; + } + + /// + /// Removes a player from the current vote. + /// + /// The slot/index of the player to remove from the vote. + internal static delegate* PanoramaRemovePlayerFromVote = &___PanoramaRemovePlayerFromVote; + internal static delegate* unmanaged[Cdecl] __PanoramaRemovePlayerFromVote; + private static void ___PanoramaRemovePlayerFromVote(int playerSlot) + { + __PanoramaRemovePlayerFromVote(playerSlot); + } + + /// + /// Checks if a player is in the vote pool. + /// + /// The slot/index of the player to check. + /// true if the player is in the vote pool, false otherwise. + internal static delegate* PanoramaIsPlayerInVotePool = &___PanoramaIsPlayerInVotePool; + internal static delegate* unmanaged[Cdecl] __PanoramaIsPlayerInVotePool; + private static Bool8 ___PanoramaIsPlayerInVotePool(int playerSlot) + { + Bool8 __retVal = __PanoramaIsPlayerInVotePool(playerSlot); + return __retVal; + } + + /// + /// Redraws the vote UI to a specific player client. + /// + /// The slot/index of the player to update. + /// true if the vote UI was successfully redrawn, false otherwise. + internal static delegate* PanoramaRedrawVoteToClient = &___PanoramaRedrawVoteToClient; + internal static delegate* unmanaged[Cdecl] __PanoramaRedrawVoteToClient; + private static Bool8 ___PanoramaRedrawVoteToClient(int playerSlot) + { + Bool8 __retVal = __PanoramaRedrawVoteToClient(playerSlot); + return __retVal; + } + + /// + /// Checks if a vote is currently in progress. + /// + /// true if a vote is active, false otherwise. + internal static delegate* PanoramaIsVoteInProgress = &___PanoramaIsVoteInProgress; + internal static delegate* unmanaged[Cdecl] __PanoramaIsVoteInProgress; + private static Bool8 ___PanoramaIsVoteInProgress() + { + Bool8 __retVal = __PanoramaIsVoteInProgress(); + return __retVal; + } + + /// + /// Ends the current vote with a specified reason. + /// + /// The reason for ending the vote. + internal static delegate* PanoramaEndVote = &___PanoramaEndVote; + internal static delegate* unmanaged[Cdecl] __PanoramaEndVote; + private static void ___PanoramaEndVote(VoteEndReason reason) + { + __PanoramaEndVote(reason); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/protobuf.cs b/PlugifyProfiler/imported/s2sdk/protobuf.cs new file mode 100644 index 0000000..fc65646 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/protobuf.cs @@ -0,0 +1,4321 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: protobuf) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Hooks a user message with a callback. + /// + /// The ID of the message to hook. + /// The callback function to invoke when the message is received. + /// Whether to hook the message in the post mode (after processing) or pre mode (before processing). + /// True if the hook was successfully added, false otherwise. + internal static delegate* HookUserMessage = &___HookUserMessage; + internal static delegate* unmanaged[Cdecl] __HookUserMessage; + private static Bool8 ___HookUserMessage(short messageId, UserMessageCallback callback, HookMode mode) + { + Bool8 __retVal = __HookUserMessage(messageId, Marshalling.GetFunctionPointerForDelegate(callback), mode); + return __retVal; + } + + /// + /// Unhooks a previously hooked user message. + /// + /// The ID of the message to unhook. + /// The callback function to remove. + /// Whether the hook was in post mode (after processing) or pre mode (before processing). + /// True if the hook was successfully removed, false otherwise. + internal static delegate* UnhookUserMessage = &___UnhookUserMessage; + internal static delegate* unmanaged[Cdecl] __UnhookUserMessage; + private static Bool8 ___UnhookUserMessage(short messageId, UserMessageCallback callback, HookMode mode) + { + Bool8 __retVal = __UnhookUserMessage(messageId, Marshalling.GetFunctionPointerForDelegate(callback), mode); + return __retVal; + } + + /// + /// Creates a UserMessage from a serializable message. + /// + /// The serializable message. + /// The network message. + /// The recipient mask. + /// A pointer to the newly created UserMessage. + internal static delegate* UserMessageCreateFromSerializable = &___UserMessageCreateFromSerializable; + internal static delegate* unmanaged[Cdecl] __UserMessageCreateFromSerializable; + private static nint ___UserMessageCreateFromSerializable(nint msgSerializable, nint message, ulong recipientMask) + { + nint __retVal = __UserMessageCreateFromSerializable(msgSerializable, message, recipientMask); + return __retVal; + } + + /// + /// Creates a UserMessage from a message name. + /// + /// The name of the message. + /// A pointer to the newly created UserMessage. + internal static delegate* UserMessageCreateFromName = &___UserMessageCreateFromName; + internal static delegate* unmanaged[Cdecl] __UserMessageCreateFromName; + private static nint ___UserMessageCreateFromName(string messageName) + { + nint __retVal; + var __messageName = NativeMethods.ConstructString(messageName); + try { + __retVal = __UserMessageCreateFromName(&__messageName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__messageName); + } + return __retVal; + } + + /// + /// Creates a UserMessage from a message ID. + /// + /// The ID of the message. + /// A pointer to the newly created UserMessage. + internal static delegate* UserMessageCreateFromId = &___UserMessageCreateFromId; + internal static delegate* unmanaged[Cdecl] __UserMessageCreateFromId; + private static nint ___UserMessageCreateFromId(short messageId) + { + nint __retVal = __UserMessageCreateFromId(messageId); + return __retVal; + } + + /// + /// Destroys a UserMessage and frees its memory. + /// + /// The UserMessage to destroy. + internal static delegate* UserMessageDestroy = &___UserMessageDestroy; + internal static delegate* unmanaged[Cdecl] __UserMessageDestroy; + private static void ___UserMessageDestroy(nint userMessage) + { + __UserMessageDestroy(userMessage); + } + + /// + /// Sends a UserMessage to the specified recipients. + /// + /// The UserMessage to send. + internal static delegate* UserMessageSend = &___UserMessageSend; + internal static delegate* unmanaged[Cdecl] __UserMessageSend; + private static void ___UserMessageSend(nint userMessage) + { + __UserMessageSend(userMessage); + } + + /// + /// Gets the name of the message. + /// + /// The UserMessage instance. + /// The name of the message as a string. + internal static delegate* UserMessageGetMessageName = &___UserMessageGetMessageName; + internal static delegate* unmanaged[Cdecl] __UserMessageGetMessageName; + private static string ___UserMessageGetMessageName(nint userMessage) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __UserMessageGetMessageName(userMessage); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Gets the ID of the message. + /// + /// The UserMessage instance. + /// The ID of the message. + internal static delegate* UserMessageGetMessageID = &___UserMessageGetMessageID; + internal static delegate* unmanaged[Cdecl] __UserMessageGetMessageID; + private static short ___UserMessageGetMessageID(nint userMessage) + { + short __retVal = __UserMessageGetMessageID(userMessage); + return __retVal; + } + + /// + /// Checks if the message has a specific field. + /// + /// The UserMessage instance. + /// The name of the field to check. + /// True if the field exists, false otherwise. + internal static delegate* UserMessageHasField = &___UserMessageHasField; + internal static delegate* unmanaged[Cdecl] __UserMessageHasField; + private static Bool8 ___UserMessageHasField(nint userMessage, string fieldName) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageHasField(userMessage, &__fieldName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets the protobuf message associated with the UserMessage. + /// + /// The UserMessage instance. + /// A pointer to the protobuf message. + internal static delegate* UserMessageGetProtobufMessage = &___UserMessageGetProtobufMessage; + internal static delegate* unmanaged[Cdecl] __UserMessageGetProtobufMessage; + private static nint ___UserMessageGetProtobufMessage(nint userMessage) + { + nint __retVal = __UserMessageGetProtobufMessage(userMessage); + return __retVal; + } + + /// + /// Gets the serializable message associated with the UserMessage. + /// + /// The UserMessage instance. + /// A pointer to the serializable message. + internal static delegate* UserMessageGetSerializableMessage = &___UserMessageGetSerializableMessage; + internal static delegate* unmanaged[Cdecl] __UserMessageGetSerializableMessage; + private static nint ___UserMessageGetSerializableMessage(nint userMessage) + { + nint __retVal = __UserMessageGetSerializableMessage(userMessage); + return __retVal; + } + + /// + /// Finds a message ID by its name. + /// + /// The name of the message. + /// The ID of the message, or 0 if the message was not found. + internal static delegate* UserMessageFindMessageIdByName = &___UserMessageFindMessageIdByName; + internal static delegate* unmanaged[Cdecl] __UserMessageFindMessageIdByName; + private static short ___UserMessageFindMessageIdByName(string messageName) + { + short __retVal; + var __messageName = NativeMethods.ConstructString(messageName); + try { + __retVal = __UserMessageFindMessageIdByName(&__messageName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__messageName); + } + return __retVal; + } + + /// + /// Gets the recipient mask for the UserMessage. + /// + /// The UserMessage instance. + /// The recipient mask. + internal static delegate* UserMessageGetRecipientMask = &___UserMessageGetRecipientMask; + internal static delegate* unmanaged[Cdecl] __UserMessageGetRecipientMask; + private static ulong ___UserMessageGetRecipientMask(nint userMessage) + { + ulong __retVal = __UserMessageGetRecipientMask(userMessage); + return __retVal; + } + + /// + /// Adds a single recipient (player) to the UserMessage. + /// + /// The UserMessage instance. + /// The slot index of the player to add as a recipient. + internal static delegate* UserMessageAddRecipient = &___UserMessageAddRecipient; + internal static delegate* unmanaged[Cdecl] __UserMessageAddRecipient; + private static void ___UserMessageAddRecipient(nint userMessage, int playerSlot) + { + __UserMessageAddRecipient(userMessage, playerSlot); + } + + /// + /// Adds all connected players as recipients to the UserMessage. + /// + /// The UserMessage instance. + internal static delegate* UserMessageAddAllPlayers = &___UserMessageAddAllPlayers; + internal static delegate* unmanaged[Cdecl] __UserMessageAddAllPlayers; + private static void ___UserMessageAddAllPlayers(nint userMessage) + { + __UserMessageAddAllPlayers(userMessage); + } + + /// + /// Sets the recipient mask for the UserMessage. + /// + /// The UserMessage instance. + /// The recipient mask to set. + internal static delegate* UserMessageSetRecipientMask = &___UserMessageSetRecipientMask; + internal static delegate* unmanaged[Cdecl] __UserMessageSetRecipientMask; + private static void ___UserMessageSetRecipientMask(nint userMessage, ulong mask) + { + __UserMessageSetRecipientMask(userMessage, mask); + } + + /// + /// Gets a nested message from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// A pointer to store the retrieved message. + /// True if the message was successfully retrieved, false otherwise. + internal static delegate* UserMessageGetMessage = &___UserMessageGetMessage; + internal static delegate* unmanaged[Cdecl] __UserMessageGetMessage; + private static Bool8 ___UserMessageGetMessage(nint userMessage, string fieldName, nint message) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageGetMessage(userMessage, &__fieldName, message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated nested message from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// A pointer to store the retrieved message. + /// True if the message was successfully retrieved, false otherwise. + internal static delegate* UserMessageGetRepeatedMessage = &___UserMessageGetRepeatedMessage; + internal static delegate* unmanaged[Cdecl] __UserMessageGetRepeatedMessage; + private static Bool8 ___UserMessageGetRepeatedMessage(nint userMessage, string fieldName, int index, nint message) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageGetRepeatedMessage(userMessage, &__fieldName, index, message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a nested message to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// A pointer to the message to add. + /// True if the message was successfully added, false otherwise. + internal static delegate* UserMessageAddMessage = &___UserMessageAddMessage; + internal static delegate* unmanaged[Cdecl] __UserMessageAddMessage; + private static Bool8 ___UserMessageAddMessage(nint userMessage, string fieldName, nint message) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageAddMessage(userMessage, &__fieldName, message); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets the count of repeated fields in a field of the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The count of repeated fields, or -1 if the field is not repeated or does not exist. + internal static delegate* UserMessageGetRepeatedFieldCount = &___UserMessageGetRepeatedFieldCount; + internal static delegate* unmanaged[Cdecl] __UserMessageGetRepeatedFieldCount; + private static int ___UserMessageGetRepeatedFieldCount(nint userMessage, string fieldName) + { + int __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageGetRepeatedFieldCount(userMessage, &__fieldName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Removes a value from a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the value to remove. + /// True if the value was successfully removed, false otherwise. + internal static delegate* UserMessageRemoveRepeatedFieldValue = &___UserMessageRemoveRepeatedFieldValue; + internal static delegate* unmanaged[Cdecl] __UserMessageRemoveRepeatedFieldValue; + private static Bool8 ___UserMessageRemoveRepeatedFieldValue(nint userMessage, string fieldName, int index) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __UserMessageRemoveRepeatedFieldValue(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets the debug string representation of the UserMessage. + /// + /// The UserMessage instance. + /// The debug string as a string. + internal static delegate* UserMessageGetDebugString = &___UserMessageGetDebugString; + internal static delegate* unmanaged[Cdecl] __UserMessageGetDebugString; + private static string ___UserMessageGetDebugString(nint userMessage) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __UserMessageGetDebugString(userMessage); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Reads an enum value from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The integer representation of the enum value, or 0 if invalid. + internal static delegate* PbReadEnum = &___PbReadEnum; + internal static delegate* unmanaged[Cdecl] __PbReadEnum; + private static int ___PbReadEnum(nint userMessage, string fieldName, int index) + { + int __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadEnum(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a 32-bit integer from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The int32_t value read, or 0 if invalid. + internal static delegate* PbReadInt32 = &___PbReadInt32; + internal static delegate* unmanaged[Cdecl] __PbReadInt32; + private static int ___PbReadInt32(nint userMessage, string fieldName, int index) + { + int __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadInt32(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a 64-bit integer from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The int64_t value read, or 0 if invalid. + internal static delegate* PbReadInt64 = &___PbReadInt64; + internal static delegate* unmanaged[Cdecl] __PbReadInt64; + private static long ___PbReadInt64(nint userMessage, string fieldName, int index) + { + long __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadInt64(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads an unsigned 32-bit integer from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The uint32_t value read, or 0 if invalid. + internal static delegate* PbReadUInt32 = &___PbReadUInt32; + internal static delegate* unmanaged[Cdecl] __PbReadUInt32; + private static uint ___PbReadUInt32(nint userMessage, string fieldName, int index) + { + uint __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadUInt32(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads an unsigned 64-bit integer from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The uint64_t value read, or 0 if invalid. + internal static delegate* PbReadUInt64 = &___PbReadUInt64; + internal static delegate* unmanaged[Cdecl] __PbReadUInt64; + private static ulong ___PbReadUInt64(nint userMessage, string fieldName, int index) + { + ulong __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadUInt64(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a floating-point value from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The float value read, or 0.0 if invalid. + internal static delegate* PbReadFloat = &___PbReadFloat; + internal static delegate* unmanaged[Cdecl] __PbReadFloat; + private static float ___PbReadFloat(nint userMessage, string fieldName, int index) + { + float __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadFloat(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a double-precision floating-point value from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The double value read, or 0.0 if invalid. + internal static delegate* PbReadDouble = &___PbReadDouble; + internal static delegate* unmanaged[Cdecl] __PbReadDouble; + private static double ___PbReadDouble(nint userMessage, string fieldName, int index) + { + double __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadDouble(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a boolean value from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The boolean value read, or false if invalid. + internal static delegate* PbReadBool = &___PbReadBool; + internal static delegate* unmanaged[Cdecl] __PbReadBool; + private static Bool8 ___PbReadBool(nint userMessage, string fieldName, int index) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadBool(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a string from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The string value read, or an empty string if invalid. + internal static delegate* PbReadString = &___PbReadString; + internal static delegate* unmanaged[Cdecl] __PbReadString; + private static string ___PbReadString(nint userMessage, string fieldName, int index) + { + string __retVal; + String192 __retVal_native; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal_native = __PbReadString(userMessage, &__fieldName, index); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a color value from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The color value read, or an empty value if invalid. + internal static delegate* PbReadColor = &___PbReadColor; + internal static delegate* unmanaged[Cdecl] __PbReadColor; + private static int ___PbReadColor(nint userMessage, string fieldName, int index) + { + int __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadColor(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a 2D vector from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The 2D vector value read, or an empty value if invalid. + internal static delegate* PbReadVector2 = &___PbReadVector2; + internal static delegate* unmanaged[Cdecl] __PbReadVector2; + private static Vector2 ___PbReadVector2(nint userMessage, string fieldName, int index) + { + Vector2 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadVector2(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a 3D vector from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The 3D vector value read, or an empty value if invalid. + internal static delegate* PbReadVector3 = &___PbReadVector3; + internal static delegate* unmanaged[Cdecl] __PbReadVector3; + private static Vector3 ___PbReadVector3(nint userMessage, string fieldName, int index) + { + Vector3 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadVector3(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Reads a QAngle (rotation vector) from a UserMessage. + /// + /// Pointer to the UserMessage object. + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The QAngle value read, or an empty value if invalid. + internal static delegate* PbReadQAngle = &___PbReadQAngle; + internal static delegate* unmanaged[Cdecl] __PbReadQAngle; + private static Vector3 ___PbReadQAngle(nint userMessage, string fieldName, int index) + { + Vector3 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbReadQAngle(userMessage, &__fieldName, index); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a enum value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetEnum = &___PbGetEnum; + internal static delegate* unmanaged[Cdecl] __PbGetEnum; + private static Bool8 ___PbGetEnum(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetEnum(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a enum value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetEnum = &___PbSetEnum; + internal static delegate* unmanaged[Cdecl] __PbSetEnum; + private static Bool8 ___PbSetEnum(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetEnum(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a 32-bit integer value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetInt32 = &___PbGetInt32; + internal static delegate* unmanaged[Cdecl] __PbGetInt32; + private static Bool8 ___PbGetInt32(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetInt32(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a 32-bit integer value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetInt32 = &___PbSetInt32; + internal static delegate* unmanaged[Cdecl] __PbSetInt32; + private static Bool8 ___PbSetInt32(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetInt32(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a 64-bit integer value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetInt64 = &___PbGetInt64; + internal static delegate* unmanaged[Cdecl] __PbGetInt64; + private static Bool8 ___PbGetInt64(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetInt64(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a 64-bit integer value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetInt64 = &___PbSetInt64; + internal static delegate* unmanaged[Cdecl] __PbSetInt64; + private static Bool8 ___PbSetInt64(nint userMessage, string fieldName, long value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetInt64(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets an unsigned 32-bit integer value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetUInt32 = &___PbGetUInt32; + internal static delegate* unmanaged[Cdecl] __PbGetUInt32; + private static Bool8 ___PbGetUInt32(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetUInt32(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets an unsigned 32-bit integer value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetUInt32 = &___PbSetUInt32; + internal static delegate* unmanaged[Cdecl] __PbSetUInt32; + private static Bool8 ___PbSetUInt32(nint userMessage, string fieldName, uint value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetUInt32(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets an unsigned 64-bit integer value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetUInt64 = &___PbGetUInt64; + internal static delegate* unmanaged[Cdecl] __PbGetUInt64; + private static Bool8 ___PbGetUInt64(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetUInt64(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets an unsigned 64-bit integer value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetUInt64 = &___PbSetUInt64; + internal static delegate* unmanaged[Cdecl] __PbSetUInt64; + private static Bool8 ___PbSetUInt64(nint userMessage, string fieldName, ulong value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetUInt64(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a bool value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetBool = &___PbGetBool; + internal static delegate* unmanaged[Cdecl] __PbGetBool; + private static Bool8 ___PbGetBool(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetBool(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a bool value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetBool = &___PbSetBool; + internal static delegate* unmanaged[Cdecl] __PbSetBool; + private static Bool8 ___PbSetBool(nint userMessage, string fieldName, Bool8 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetBool(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a float value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetFloat = &___PbGetFloat; + internal static delegate* unmanaged[Cdecl] __PbGetFloat; + private static Bool8 ___PbGetFloat(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetFloat(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a float value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetFloat = &___PbSetFloat; + internal static delegate* unmanaged[Cdecl] __PbSetFloat; + private static Bool8 ___PbSetFloat(nint userMessage, string fieldName, float value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetFloat(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a double value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetDouble = &___PbGetDouble; + internal static delegate* unmanaged[Cdecl] __PbGetDouble; + private static Bool8 ___PbGetDouble(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetDouble(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a double value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetDouble = &___PbSetDouble; + internal static delegate* unmanaged[Cdecl] __PbSetDouble; + private static Bool8 ___PbSetDouble(nint userMessage, string fieldName, double value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetDouble(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a string value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetString = &___PbGetString; + internal static delegate* unmanaged[Cdecl] __PbGetString; + private static Bool8 ___PbGetString(nint userMessage, string fieldName, ref string out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + var __out_ = NativeMethods.ConstructString(out_); + try { + __retVal = __PbGetString(userMessage, &__fieldName, &__out_); + // Unmarshal - Convert native data to managed data. + out_ = NativeMethods.GetStringData(&__out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + NativeMethods.DestroyString(&__out_); + } + return __retVal; + } + + /// + /// Sets a string value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetString = &___PbSetString; + internal static delegate* unmanaged[Cdecl] __PbSetString; + private static Bool8 ___PbSetString(nint userMessage, string fieldName, string value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + var __value = NativeMethods.ConstructString(value); + try { + __retVal = __PbSetString(userMessage, &__fieldName, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + NativeMethods.DestroyString(&__value); + } + return __retVal; + } + + /// + /// Gets a color value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetColor = &___PbGetColor; + internal static delegate* unmanaged[Cdecl] __PbGetColor; + private static Bool8 ___PbGetColor(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetColor(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a color value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetColor = &___PbSetColor; + internal static delegate* unmanaged[Cdecl] __PbSetColor; + private static Bool8 ___PbSetColor(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetColor(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a Vector2 value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetVector2 = &___PbGetVector2; + internal static delegate* unmanaged[Cdecl] __PbGetVector2; + private static Bool8 ___PbGetVector2(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetVector2(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a Vector2 value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetVector2 = &___PbSetVector2; + internal static delegate* unmanaged[Cdecl] __PbSetVector2; + private static Bool8 ___PbSetVector2(nint userMessage, string fieldName, Vector2 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetVector2(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a Vector3 value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetVector3 = &___PbGetVector3; + internal static delegate* unmanaged[Cdecl] __PbGetVector3; + private static Bool8 ___PbGetVector3(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetVector3(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a Vector3 value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetVector3 = &___PbSetVector3; + internal static delegate* unmanaged[Cdecl] __PbSetVector3; + private static Bool8 ___PbSetVector3(nint userMessage, string fieldName, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetVector3(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a QAngle value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetQAngle = &___PbGetQAngle; + internal static delegate* unmanaged[Cdecl] __PbGetQAngle; + private static Bool8 ___PbGetQAngle(nint userMessage, string fieldName, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetQAngle(userMessage, &__fieldName, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a QAngle value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetQAngle = &___PbSetQAngle; + internal static delegate* unmanaged[Cdecl] __PbSetQAngle; + private static Bool8 ___PbSetQAngle(nint userMessage, string fieldName, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetQAngle(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated enum value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedEnum = &___PbGetRepeatedEnum; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedEnum; + private static Bool8 ___PbGetRepeatedEnum(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedEnum(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated enum value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedEnum = &___PbSetRepeatedEnum; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedEnum; + private static Bool8 ___PbSetRepeatedEnum(nint userMessage, string fieldName, int index, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedEnum(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a enum value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddEnum = &___PbAddEnum; + internal static delegate* unmanaged[Cdecl] __PbAddEnum; + private static Bool8 ___PbAddEnum(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddEnum(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated int32_t value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedInt32 = &___PbGetRepeatedInt32; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedInt32; + private static Bool8 ___PbGetRepeatedInt32(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedInt32(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated int32_t value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedInt32 = &___PbSetRepeatedInt32; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedInt32; + private static Bool8 ___PbSetRepeatedInt32(nint userMessage, string fieldName, int index, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedInt32(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a 32-bit integer value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddInt32 = &___PbAddInt32; + internal static delegate* unmanaged[Cdecl] __PbAddInt32; + private static Bool8 ___PbAddInt32(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddInt32(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated int64_t value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedInt64 = &___PbGetRepeatedInt64; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedInt64; + private static Bool8 ___PbGetRepeatedInt64(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedInt64(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated int64_t value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedInt64 = &___PbSetRepeatedInt64; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedInt64; + private static Bool8 ___PbSetRepeatedInt64(nint userMessage, string fieldName, int index, long value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedInt64(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a 64-bit integer value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddInt64 = &___PbAddInt64; + internal static delegate* unmanaged[Cdecl] __PbAddInt64; + private static Bool8 ___PbAddInt64(nint userMessage, string fieldName, long value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddInt64(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated uint32_t value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedUInt32 = &___PbGetRepeatedUInt32; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedUInt32; + private static Bool8 ___PbGetRepeatedUInt32(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedUInt32(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated uint32_t value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedUInt32 = &___PbSetRepeatedUInt32; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedUInt32; + private static Bool8 ___PbSetRepeatedUInt32(nint userMessage, string fieldName, int index, uint value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedUInt32(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds an unsigned 32-bit integer value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddUInt32 = &___PbAddUInt32; + internal static delegate* unmanaged[Cdecl] __PbAddUInt32; + private static Bool8 ___PbAddUInt32(nint userMessage, string fieldName, uint value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddUInt32(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated uint64_t value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedUInt64 = &___PbGetRepeatedUInt64; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedUInt64; + private static Bool8 ___PbGetRepeatedUInt64(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedUInt64(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated uint64_t value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedUInt64 = &___PbSetRepeatedUInt64; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedUInt64; + private static Bool8 ___PbSetRepeatedUInt64(nint userMessage, string fieldName, int index, ulong value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedUInt64(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds an unsigned 64-bit integer value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddUInt64 = &___PbAddUInt64; + internal static delegate* unmanaged[Cdecl] __PbAddUInt64; + private static Bool8 ___PbAddUInt64(nint userMessage, string fieldName, ulong value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddUInt64(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated bool value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedBool = &___PbGetRepeatedBool; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedBool; + private static Bool8 ___PbGetRepeatedBool(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedBool(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated bool value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedBool = &___PbSetRepeatedBool; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedBool; + private static Bool8 ___PbSetRepeatedBool(nint userMessage, string fieldName, int index, Bool8 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedBool(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a bool value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddBool = &___PbAddBool; + internal static delegate* unmanaged[Cdecl] __PbAddBool; + private static Bool8 ___PbAddBool(nint userMessage, string fieldName, Bool8 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddBool(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated float value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedFloat = &___PbGetRepeatedFloat; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedFloat; + private static Bool8 ___PbGetRepeatedFloat(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedFloat(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated float value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedFloat = &___PbSetRepeatedFloat; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedFloat; + private static Bool8 ___PbSetRepeatedFloat(nint userMessage, string fieldName, int index, float value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedFloat(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a float value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddFloat = &___PbAddFloat; + internal static delegate* unmanaged[Cdecl] __PbAddFloat; + private static Bool8 ___PbAddFloat(nint userMessage, string fieldName, float value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddFloat(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated double value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedDouble = &___PbGetRepeatedDouble; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedDouble; + private static Bool8 ___PbGetRepeatedDouble(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedDouble(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated double value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedDouble = &___PbSetRepeatedDouble; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedDouble; + private static Bool8 ___PbSetRepeatedDouble(nint userMessage, string fieldName, int index, double value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedDouble(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a double value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddDouble = &___PbAddDouble; + internal static delegate* unmanaged[Cdecl] __PbAddDouble; + private static Bool8 ___PbAddDouble(nint userMessage, string fieldName, double value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddDouble(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated string value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedString = &___PbGetRepeatedString; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedString; + private static Bool8 ___PbGetRepeatedString(nint userMessage, string fieldName, int index, ref string out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + var __out_ = NativeMethods.ConstructString(out_); + try { + __retVal = __PbGetRepeatedString(userMessage, &__fieldName, index, &__out_); + // Unmarshal - Convert native data to managed data. + out_ = NativeMethods.GetStringData(&__out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + NativeMethods.DestroyString(&__out_); + } + return __retVal; + } + + /// + /// Sets a repeated string value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedString = &___PbSetRepeatedString; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedString; + private static Bool8 ___PbSetRepeatedString(nint userMessage, string fieldName, int index, string value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + var __value = NativeMethods.ConstructString(value); + try { + __retVal = __PbSetRepeatedString(userMessage, &__fieldName, index, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + NativeMethods.DestroyString(&__value); + } + return __retVal; + } + + /// + /// Adds a string value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddString = &___PbAddString; + internal static delegate* unmanaged[Cdecl] __PbAddString; + private static Bool8 ___PbAddString(nint userMessage, string fieldName, string value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + var __value = NativeMethods.ConstructString(value); + try { + __retVal = __PbAddString(userMessage, &__fieldName, &__value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + NativeMethods.DestroyString(&__value); + } + return __retVal; + } + + /// + /// Gets a repeated color value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output color. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedColor = &___PbGetRepeatedColor; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedColor; + private static Bool8 ___PbGetRepeatedColor(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedColor(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated color value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedColor = &___PbSetRepeatedColor; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedColor; + private static Bool8 ___PbSetRepeatedColor(nint userMessage, string fieldName, int index, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedColor(userMessage, &__fieldName, index, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a color value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddColor = &___PbAddColor; + internal static delegate* unmanaged[Cdecl] __PbAddColor; + private static Bool8 ___PbAddColor(nint userMessage, string fieldName, int value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddColor(userMessage, &__fieldName, value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated Vector2 value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedVector2 = &___PbGetRepeatedVector2; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedVector2; + private static Bool8 ___PbGetRepeatedVector2(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedVector2(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated Vector2 value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedVector2 = &___PbSetRepeatedVector2; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedVector2; + private static Bool8 ___PbSetRepeatedVector2(nint userMessage, string fieldName, int index, Vector2 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedVector2(userMessage, &__fieldName, index, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a Vector2 value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddVector2 = &___PbAddVector2; + internal static delegate* unmanaged[Cdecl] __PbAddVector2; + private static Bool8 ___PbAddVector2(nint userMessage, string fieldName, Vector2 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddVector2(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated Vector3 value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedVector3 = &___PbGetRepeatedVector3; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedVector3; + private static Bool8 ___PbGetRepeatedVector3(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedVector3(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated Vector3 value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedVector3 = &___PbSetRepeatedVector3; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedVector3; + private static Bool8 ___PbSetRepeatedVector3(nint userMessage, string fieldName, int index, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedVector3(userMessage, &__fieldName, index, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a Vector3 value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddVector3 = &___PbAddVector3; + internal static delegate* unmanaged[Cdecl] __PbAddVector3; + private static Bool8 ___PbAddVector3(nint userMessage, string fieldName, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddVector3(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Gets a repeated QAngle value from a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + internal static delegate* PbGetRepeatedQAngle = &___PbGetRepeatedQAngle; + internal static delegate* unmanaged[Cdecl] __PbGetRepeatedQAngle; + private static Bool8 ___PbGetRepeatedQAngle(nint userMessage, string fieldName, int index, nint out_) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbGetRepeatedQAngle(userMessage, &__fieldName, index, out_); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Sets a repeated QAngle value for a field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + internal static delegate* PbSetRepeatedQAngle = &___PbSetRepeatedQAngle; + internal static delegate* unmanaged[Cdecl] __PbSetRepeatedQAngle; + private static Bool8 ___PbSetRepeatedQAngle(nint userMessage, string fieldName, int index, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbSetRepeatedQAngle(userMessage, &__fieldName, index, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + /// + /// Adds a QAngle value to a repeated field in the UserMessage. + /// + /// The UserMessage instance. + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + internal static delegate* PbAddQAngle = &___PbAddQAngle; + internal static delegate* unmanaged[Cdecl] __PbAddQAngle; + private static Bool8 ___PbAddQAngle(nint userMessage, string fieldName, Vector3 value) + { + Bool8 __retVal; + var __fieldName = NativeMethods.ConstructString(fieldName); + try { + __retVal = __PbAddQAngle(userMessage, &__fieldName, &value); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__fieldName); + } + return __retVal; + } + + } + + /// + /// RAII wrapper for UserMessage pointer. + /// + internal sealed unsafe class UserMessage : SafeHandle + { + /// + /// Creates a UserMessage from a serializable message. + /// + /// The serializable message. + /// The network message. + /// The recipient mask. + public UserMessage(nint msgSerializable, nint message, ulong recipientMask) : this(s2sdk.UserMessageCreateFromSerializable(msgSerializable, message, recipientMask), Ownership.Owned) + { + } + + /// + /// Creates a UserMessage from a message name. + /// + /// The name of the message. + public UserMessage(string messageName) : this(s2sdk.UserMessageCreateFromName(messageName), Ownership.Owned) + { + } + + /// + /// Creates a UserMessage from a message ID. + /// + /// The ID of the message. + public UserMessage(short messageId) : this(s2sdk.UserMessageCreateFromId(messageId), Ownership.Owned) + { + } + + /// + /// Internal constructor for creating UserMessage from existing handle + /// + public UserMessage(nint handle, Ownership ownership = Ownership.Borrowed) : base((nint)handle, ownsHandle: ownership == Ownership.Owned) + { + } + + /// + /// Releases the handle (called automatically by SafeHandle) + /// + protected override bool ReleaseHandle() + { + s2sdk.UserMessageDestroy((nint)handle); + return true; + } + + /// + /// Checks if the UserMessage has a valid handle + /// + public override bool IsInvalid => handle == nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Handle => (nint)handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => (nint)handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + SetHandleAsInvalid(); + return (nint)h; + } + + /// + /// Disposes the handle + /// + public void Reset() + { + Dispose(); + } + + /// + /// Sends a UserMessage to the specified recipients. + /// + public void Send() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.UserMessageSend(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the name of the message. + /// + /// The name of the message as a string. + public string GetMessageName() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetMessageName(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the ID of the message. + /// + /// The ID of the message. + public short GetMessageID() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetMessageID(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Checks if the message has a specific field. + /// + /// The name of the field to check. + /// True if the field exists, false otherwise. + public Bool8 HasField(string fieldName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageHasField(Handle, fieldName); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the protobuf message associated with the UserMessage. + /// + /// A pointer to the protobuf message. + public nint GetProtobufMessage() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetProtobufMessage(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the serializable message associated with the UserMessage. + /// + /// A pointer to the serializable message. + public nint GetSerializableMessage() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetSerializableMessage(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Finds a message ID by its name. + /// + /// The name of the message. + /// The ID of the message, or 0 if the message was not found. + public static short FindMessageIdByName(string messageName) + { + return s2sdk.UserMessageFindMessageIdByName(messageName); + } + + /// + /// Gets the recipient mask for the UserMessage. + /// + /// The recipient mask. + public ulong GetRecipientMask() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetRecipientMask(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a single recipient (player) to the UserMessage. + /// + /// The slot index of the player to add as a recipient. + public void AddRecipient(int playerSlot) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.UserMessageAddRecipient(Handle, playerSlot); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds all connected players as recipients to the UserMessage. + /// + public void AddAllPlayers() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.UserMessageAddAllPlayers(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets the recipient mask for the UserMessage. + /// + /// The recipient mask to set. + public void SetRecipientMask(ulong mask) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + s2sdk.UserMessageSetRecipientMask(Handle, mask); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a nested message from a field in the UserMessage. + /// + /// The name of the field. + /// A pointer to store the retrieved message. + /// True if the message was successfully retrieved, false otherwise. + public Bool8 GetMessage(string fieldName, nint message) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetMessage(Handle, fieldName, message); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated nested message from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// A pointer to store the retrieved message. + /// True if the message was successfully retrieved, false otherwise. + public Bool8 GetRepeatedMessage(string fieldName, int index, nint message) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetRepeatedMessage(Handle, fieldName, index, message); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a nested message to a repeated field in the UserMessage. + /// + /// The name of the field. + /// A pointer to the message to add. + /// True if the message was successfully added, false otherwise. + public Bool8 AddMessage(string fieldName, nint message) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageAddMessage(Handle, fieldName, message); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the count of repeated fields in a field of the UserMessage. + /// + /// The name of the field. + /// The count of repeated fields, or -1 if the field is not repeated or does not exist. + public int GetRepeatedFieldCount(string fieldName) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetRepeatedFieldCount(Handle, fieldName); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Removes a value from a repeated field in the UserMessage. + /// + /// The name of the field. + /// The index of the value to remove. + /// True if the value was successfully removed, false otherwise. + public Bool8 RemoveRepeatedFieldValue(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageRemoveRepeatedFieldValue(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets the debug string representation of the UserMessage. + /// + /// The debug string as a string. + public string GetDebugString() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.UserMessageGetDebugString(Handle); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads an enum value from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The integer representation of the enum value, or 0 if invalid. + public int ReadEnum(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadEnum(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a 32-bit integer from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The int32_t value read, or 0 if invalid. + public int ReadInt32(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadInt32(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a 64-bit integer from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The int64_t value read, or 0 if invalid. + public long ReadInt64(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadInt64(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads an unsigned 32-bit integer from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The uint32_t value read, or 0 if invalid. + public uint ReadUInt32(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadUInt32(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads an unsigned 64-bit integer from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The uint64_t value read, or 0 if invalid. + public ulong ReadUInt64(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadUInt64(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a floating-point value from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The float value read, or 0.0 if invalid. + public float ReadFloat(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadFloat(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a double-precision floating-point value from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The double value read, or 0.0 if invalid. + public double ReadDouble(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadDouble(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a boolean value from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The boolean value read, or false if invalid. + public Bool8 ReadBool(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadBool(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a string from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The string value read, or an empty string if invalid. + public string ReadString(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadString(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a color value from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The color value read, or an empty value if invalid. + public int ReadColor(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadColor(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a 2D vector from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The 2D vector value read, or an empty value if invalid. + public Vector2 ReadVector2(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadVector2(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a 3D vector from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The 3D vector value read, or an empty value if invalid. + public Vector3 ReadVector3(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadVector3(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Reads a QAngle (rotation vector) from a UserMessage. + /// + /// Name of the field to read. + /// Index of the repeated field (use -1 for non-repeated fields). + /// The QAngle value read, or an empty value if invalid. + public Vector3 ReadQAngle(string fieldName, int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbReadQAngle(Handle, fieldName, index); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a enum value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetEnum(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetEnum(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a enum value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetEnum(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetEnum(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 32-bit integer value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetInt32(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetInt32(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a 32-bit integer value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetInt32(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetInt32(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a 64-bit integer value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetInt64(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetInt64(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a 64-bit integer value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetInt64(string fieldName, long value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetInt64(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 32-bit integer value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetUInt32(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetUInt32(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets an unsigned 32-bit integer value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetUInt32(string fieldName, uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetUInt32(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets an unsigned 64-bit integer value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetUInt64(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetUInt64(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets an unsigned 64-bit integer value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetUInt64(string fieldName, ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetUInt64(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a bool value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetBool(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetBool(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a bool value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetBool(string fieldName, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetBool(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a float value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetFloat(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetFloat(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a float value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetFloat(string fieldName, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetFloat(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a double value from a field in the UserMessage. + /// + /// The name of the field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetDouble(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetDouble(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a double value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetDouble(string fieldName, double value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetDouble(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a string value from a field in the UserMessage. + /// + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetString(string fieldName, ref string out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetString(Handle, fieldName, ref out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a string value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetString(string fieldName, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetString(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a color value from a field in the UserMessage. + /// + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetColor(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetColor(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a color value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetColor(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetColor(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a Vector2 value from a field in the UserMessage. + /// + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetVector2(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetVector2(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a Vector2 value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetVector2(string fieldName, Vector2 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetVector2(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a Vector3 value from a field in the UserMessage. + /// + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetVector3(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetVector3(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a Vector3 value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetVector3(string fieldName, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetVector3(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a QAngle value from a field in the UserMessage. + /// + /// The name of the field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetQAngle(string fieldName, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetQAngle(Handle, fieldName, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a QAngle value for a field in the UserMessage. + /// + /// The name of the field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetQAngle(string fieldName, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetQAngle(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated enum value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedEnum(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedEnum(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated enum value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedEnum(string fieldName, int index, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedEnum(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a enum value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddEnum(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddEnum(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated int32_t value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedInt32(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedInt32(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated int32_t value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedInt32(string fieldName, int index, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedInt32(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a 32-bit integer value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddInt32(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddInt32(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated int64_t value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedInt64(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedInt64(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated int64_t value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedInt64(string fieldName, int index, long value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedInt64(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a 64-bit integer value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddInt64(string fieldName, long value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddInt64(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated uint32_t value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedUInt32(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedUInt32(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated uint32_t value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedUInt32(string fieldName, int index, uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedUInt32(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds an unsigned 32-bit integer value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddUInt32(string fieldName, uint value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddUInt32(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated uint64_t value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedUInt64(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedUInt64(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated uint64_t value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedUInt64(string fieldName, int index, ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedUInt64(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds an unsigned 64-bit integer value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddUInt64(string fieldName, ulong value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddUInt64(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated bool value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedBool(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedBool(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated bool value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedBool(string fieldName, int index, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedBool(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a bool value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddBool(string fieldName, Bool8 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddBool(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated float value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedFloat(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedFloat(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated float value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedFloat(string fieldName, int index, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedFloat(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a float value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddFloat(string fieldName, float value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddFloat(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated double value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output value. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedDouble(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedDouble(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated double value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedDouble(string fieldName, int index, double value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedDouble(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a double value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddDouble(string fieldName, double value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddDouble(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated string value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output string. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedString(string fieldName, int index, ref string out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedString(Handle, fieldName, index, ref out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated string value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedString(string fieldName, int index, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedString(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a string value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddString(string fieldName, string value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddString(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated color value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output color. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedColor(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedColor(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated color value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedColor(string fieldName, int index, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedColor(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a color value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddColor(string fieldName, int value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddColor(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated Vector2 value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedVector2(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedVector2(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated Vector2 value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedVector2(string fieldName, int index, Vector2 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedVector2(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a Vector2 value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddVector2(string fieldName, Vector2 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddVector2(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated Vector3 value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedVector3(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedVector3(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated Vector3 value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedVector3(string fieldName, int index, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedVector3(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a Vector3 value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddVector3(string fieldName, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddVector3(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Gets a repeated QAngle value from a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The output vector2. + /// True if the field was successfully retrieved, false otherwise. + public Bool8 GetRepeatedQAngle(string fieldName, int index, nint out_) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbGetRepeatedQAngle(Handle, fieldName, index, out_); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Sets a repeated QAngle value for a field in the UserMessage. + /// + /// The name of the field. + /// The index of the repeated field. + /// The value to set. + /// True if the field was successfully set, false otherwise. + public Bool8 SetRepeatedQAngle(string fieldName, int index, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbSetRepeatedQAngle(Handle, fieldName, index, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + /// + /// Adds a QAngle value to a repeated field in the UserMessage. + /// + /// The name of the field. + /// The value to add. + /// True if the value was successfully added, false otherwise. + public Bool8 AddQAngle(string fieldName, Vector3 value) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + bool success = false; + DangerousAddRef(ref success); + try + { + return s2sdk.PbAddQAngle(Handle, fieldName, value); + } + finally + { + if (success) DangerousRelease(); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/schema.cs b/PlugifyProfiler/imported/s2sdk/schema.cs new file mode 100644 index 0000000..54bfae8 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/schema.cs @@ -0,0 +1,1285 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: schema) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Get the offset of a member in a given schema class. + /// + /// The name of the class. + /// The name of the member whose offset is to be retrieved. + /// The offset of the member in the class. + internal static delegate* GetSchemaOffset = &___GetSchemaOffset; + internal static delegate* unmanaged[Cdecl] __GetSchemaOffset; + private static int ___GetSchemaOffset(string className, string memberName) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetSchemaOffset(&__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Get the offset of a chain in a given schema class. + /// + /// The name of the class. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* GetSchemaChainOffset = &___GetSchemaChainOffset; + internal static delegate* unmanaged[Cdecl] __GetSchemaChainOffset; + private static int ___GetSchemaChainOffset(string className) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + try { + __retVal = __GetSchemaChainOffset(&__className); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + } + return __retVal; + } + + /// + /// Check if a schema field is networked. + /// + /// The name of the class. + /// The name of the member to check. + /// True if the member is networked, false otherwise. + internal static delegate* IsSchemaFieldNetworked = &___IsSchemaFieldNetworked; + internal static delegate* unmanaged[Cdecl] __IsSchemaFieldNetworked; + private static Bool8 ___IsSchemaFieldNetworked(string className, string memberName) + { + Bool8 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __IsSchemaFieldNetworked(&__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Get the size of a schema class. + /// + /// The name of the class. + /// The size of the class in bytes, or -1 if the class is not found. + internal static delegate* GetSchemaClassSize = &___GetSchemaClassSize; + internal static delegate* unmanaged[Cdecl] __GetSchemaClassSize; + private static int ___GetSchemaClassSize(string className) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + try { + __retVal = __GetSchemaClassSize(&__className); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + } + return __retVal; + } + + /// + /// Peeks into an entity's object schema and retrieves the integer value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// The integer value at the given memory location. + internal static delegate* GetEntData2 = &___GetEntData2; + internal static delegate* unmanaged[Cdecl] __GetEntData2; + private static long ___GetEntData2(nint entity, int offset, int size) + { + long __retVal = __GetEntData2(entity, offset, size); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the integer value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The integer value to set. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntData2 = &___SetEntData2; + internal static delegate* unmanaged[Cdecl] __SetEntData2; + private static void ___SetEntData2(nint entity, int offset, long value, int size, Bool8 changeState, int chainOffset) + { + __SetEntData2(entity, offset, value, size, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object schema and retrieves the float value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// The float value at the given memory location. + internal static delegate* GetEntDataFloat2 = &___GetEntDataFloat2; + internal static delegate* unmanaged[Cdecl] __GetEntDataFloat2; + private static double ___GetEntDataFloat2(nint entity, int offset, int size) + { + double __retVal = __GetEntDataFloat2(entity, offset, size); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the float value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The float value to set. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataFloat2 = &___SetEntDataFloat2; + internal static delegate* unmanaged[Cdecl] __SetEntDataFloat2; + private static void ___SetEntDataFloat2(nint entity, int offset, double value, int size, Bool8 changeState, int chainOffset) + { + __SetEntDataFloat2(entity, offset, value, size, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object schema and retrieves the string value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The string value at the given memory location. + internal static delegate* GetEntDataString2 = &___GetEntDataString2; + internal static delegate* unmanaged[Cdecl] __GetEntDataString2; + private static string ___GetEntDataString2(nint entity, int offset) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEntDataString2(entity, offset); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the string at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The string value to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataString2 = &___SetEntDataString2; + internal static delegate* unmanaged[Cdecl] __SetEntDataString2; + private static void ___SetEntDataString2(nint entity, int offset, string value, Bool8 changeState, int chainOffset) + { + var __value = NativeMethods.ConstructString(value); + try { + __SetEntDataString2(entity, offset, &__value, changeState, chainOffset); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Peeks into an entity's object schema and retrieves the vector value at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The vector value at the given memory location. + internal static delegate* GetEntDataVector2 = &___GetEntDataVector2; + internal static delegate* unmanaged[Cdecl] __GetEntDataVector2; + private static Vector3 ___GetEntDataVector2(nint entity, int offset) + { + Vector3 __retVal = __GetEntDataVector2(entity, offset); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the vector at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The vector value to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataVector2 = &___SetEntDataVector2; + internal static delegate* unmanaged[Cdecl] __SetEntDataVector2; + private static void ___SetEntDataVector2(nint entity, int offset, Vector3 value, Bool8 changeState, int chainOffset) + { + __SetEntDataVector2(entity, offset, &value, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object data and retrieves the entity handle at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The entity handle at the given memory location. + internal static delegate* GetEntDataEnt2 = &___GetEntDataEnt2; + internal static delegate* unmanaged[Cdecl] __GetEntDataEnt2; + private static int ___GetEntDataEnt2(nint entity, int offset) + { + int __retVal = __GetEntDataEnt2(entity, offset); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the entity handle at the given offset. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The entity handle to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataEnt2 = &___SetEntDataEnt2; + internal static delegate* unmanaged[Cdecl] __SetEntDataEnt2; + private static void ___SetEntDataEnt2(nint entity, int offset, int value, Bool8 changeState, int chainOffset) + { + __SetEntDataEnt2(entity, offset, value, changeState, chainOffset); + } + + /// + /// Updates the networked state of a schema field for a given entity pointer. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The offset of the schema to use. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* ChangeEntityState2 = &___ChangeEntityState2; + internal static delegate* unmanaged[Cdecl] __ChangeEntityState2; + private static void ___ChangeEntityState2(nint entity, int offset, int chainOffset) + { + __ChangeEntityState2(entity, offset, chainOffset); + } + + /// + /// Peeks into an entity's object schema and retrieves the integer value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// The integer value at the given memory location. + internal static delegate* GetEntData = &___GetEntData; + internal static delegate* unmanaged[Cdecl] __GetEntData; + private static long ___GetEntData(int entityHandle, int offset, int size) + { + long __retVal = __GetEntData(entityHandle, offset, size); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the integer value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The integer value to set. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntData = &___SetEntData; + internal static delegate* unmanaged[Cdecl] __SetEntData; + private static void ___SetEntData(int entityHandle, int offset, long value, int size, Bool8 changeState, int chainOffset) + { + __SetEntData(entityHandle, offset, value, size, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object schema and retrieves the float value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// The float value at the given memory location. + internal static delegate* GetEntDataFloat = &___GetEntDataFloat; + internal static delegate* unmanaged[Cdecl] __GetEntDataFloat; + private static double ___GetEntDataFloat(int entityHandle, int offset, int size) + { + double __retVal = __GetEntDataFloat(entityHandle, offset, size); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the float value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The float value to set. + /// Number of bytes to write (valid values are 1, 2, 4 or 8). + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataFloat = &___SetEntDataFloat; + internal static delegate* unmanaged[Cdecl] __SetEntDataFloat; + private static void ___SetEntDataFloat(int entityHandle, int offset, double value, int size, Bool8 changeState, int chainOffset) + { + __SetEntDataFloat(entityHandle, offset, value, size, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object schema and retrieves the string value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The string value at the given memory location. + internal static delegate* GetEntDataString = &___GetEntDataString; + internal static delegate* unmanaged[Cdecl] __GetEntDataString; + private static string ___GetEntDataString(int entityHandle, int offset) + { + string __retVal; + String192 __retVal_native; + try { + __retVal_native = __GetEntDataString(entityHandle, offset); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + } + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the string at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The string value to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataString = &___SetEntDataString; + internal static delegate* unmanaged[Cdecl] __SetEntDataString; + private static void ___SetEntDataString(int entityHandle, int offset, string value, Bool8 changeState, int chainOffset) + { + var __value = NativeMethods.ConstructString(value); + try { + __SetEntDataString(entityHandle, offset, &__value, changeState, chainOffset); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Peeks into an entity's object schema and retrieves the vector value at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The vector value at the given memory location. + internal static delegate* GetEntDataVector = &___GetEntDataVector; + internal static delegate* unmanaged[Cdecl] __GetEntDataVector; + private static Vector3 ___GetEntDataVector(int entityHandle, int offset) + { + Vector3 __retVal = __GetEntDataVector(entityHandle, offset); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the vector at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The vector value to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataVector = &___SetEntDataVector; + internal static delegate* unmanaged[Cdecl] __SetEntDataVector; + private static void ___SetEntDataVector(int entityHandle, int offset, Vector3 value, Bool8 changeState, int chainOffset) + { + __SetEntDataVector(entityHandle, offset, &value, changeState, chainOffset); + } + + /// + /// Peeks into an entity's object data and retrieves the entity handle at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The entity handle at the given memory location. + internal static delegate* GetEntDataEnt = &___GetEntDataEnt; + internal static delegate* unmanaged[Cdecl] __GetEntDataEnt; + private static int ___GetEntDataEnt(int entityHandle, int offset) + { + int __retVal = __GetEntDataEnt(entityHandle, offset); + return __retVal; + } + + /// + /// Peeks into an entity's object data and sets the entity handle at the given offset. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The entity handle to set. + /// If true, change will be sent over the network. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* SetEntDataEnt = &___SetEntDataEnt; + internal static delegate* unmanaged[Cdecl] __SetEntDataEnt; + private static void ___SetEntDataEnt(int entityHandle, int offset, int value, Bool8 changeState, int chainOffset) + { + __SetEntDataEnt(entityHandle, offset, value, changeState, chainOffset); + } + + /// + /// Updates the networked state of a schema field for a given entity handle. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The offset of the schema to use. + /// The offset of the chain entity in the class (-1 for non-entity classes). + internal static delegate* ChangeEntityState = &___ChangeEntityState; + internal static delegate* unmanaged[Cdecl] __ChangeEntityState; + private static void ___ChangeEntityState(int entityHandle, int offset, int chainOffset) + { + __ChangeEntityState(entityHandle, offset, chainOffset); + } + + /// + /// Retrieves the count of values that an entity schema's array can store. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Size of array (in elements) or 0 if schema is not an array. + internal static delegate* GetEntSchemaArraySize2 = &___GetEntSchemaArraySize2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaArraySize2; + private static int ___GetEntSchemaArraySize2(nint entity, string className, string memberName) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaArraySize2(entity, &__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Retrieves an integer value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// An integer value at the given schema offset. + internal static delegate* GetEntSchema2 = &___GetEntSchema2; + internal static delegate* unmanaged[Cdecl] __GetEntSchema2; + private static long ___GetEntSchema2(nint entity, string className, string memberName, int element) + { + long __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchema2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets an integer value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The integer value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchema2 = &___SetEntSchema2; + internal static delegate* unmanaged[Cdecl] __SetEntSchema2; + private static void ___SetEntSchema2(nint entity, string className, string memberName, long value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchema2(entity, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a float value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A float value at the given schema offset. + internal static delegate* GetEntSchemaFloat2 = &___GetEntSchemaFloat2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaFloat2; + private static double ___GetEntSchemaFloat2(nint entity, string className, string memberName, int element) + { + double __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaFloat2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a float value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The float value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaFloat2 = &___SetEntSchemaFloat2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaFloat2; + private static void ___SetEntSchemaFloat2(nint entity, string className, string memberName, double value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaFloat2(entity, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a string value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaString2 = &___GetEntSchemaString2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaString2; + private static string ___GetEntSchemaString2(nint entity, string className, string memberName, int element) + { + string __retVal; + String192 __retVal_native; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal_native = __GetEntSchemaString2(entity, &__className, &__memberName, element); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a string value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The string value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaString2 = &___SetEntSchemaString2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaString2; + private static void ___SetEntSchemaString2(nint entity, string className, string memberName, string value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + var __value = NativeMethods.ConstructString(value); + try { + __SetEntSchemaString2(entity, &__className, &__memberName, &__value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A vector value at the given schema offset. + internal static delegate* GetEntSchemaVector3D2 = &___GetEntSchemaVector3D2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector3D2; + private static Vector3 ___GetEntSchemaVector3D2(nint entity, string className, string memberName, int element) + { + Vector3 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector3D2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector3D2 = &___SetEntSchemaVector3D2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector3D2; + private static void ___SetEntSchemaVector3D2(nint entity, string className, string memberName, Vector3 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector3D2(entity, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A vector value at the given schema offset. + internal static delegate* GetEntSchemaVector2D2 = &___GetEntSchemaVector2D2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector2D2; + private static Vector2 ___GetEntSchemaVector2D2(nint entity, string className, string memberName, int element) + { + Vector2 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector2D2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector2D2 = &___SetEntSchemaVector2D2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector2D2; + private static void ___SetEntSchemaVector2D2(nint entity, string className, string memberName, Vector2 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector2D2(entity, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A vector value at the given schema offset. + internal static delegate* GetEntSchemaVector4D2 = &___GetEntSchemaVector4D2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector4D2; + private static Vector4 ___GetEntSchemaVector4D2(nint entity, string className, string memberName, int element) + { + Vector4 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector4D2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector4D2 = &___SetEntSchemaVector4D2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector4D2; + private static void ___SetEntSchemaVector4D2(nint entity, string className, string memberName, Vector4 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector4D2(entity, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves an entity handle from an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaEnt2 = &___GetEntSchemaEnt2; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaEnt2; + private static int ___GetEntSchemaEnt2(nint entity, string className, string memberName, int element) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaEnt2(entity, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets an entity handle in an entity's schema. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class. + /// The name of the schema member. + /// The entity handle to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaEnt2 = &___SetEntSchemaEnt2; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaEnt2; + private static void ___SetEntSchemaEnt2(nint entity, string className, string memberName, int value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaEnt2(entity, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Updates the networked state of a schema field for a given entity pointer. + /// + /// Pointer to the instance of the class where the value is to be set. + /// The name of the class that contains the member. + /// The name of the member to be set. + internal static delegate* NetworkStateChanged2 = &___NetworkStateChanged2; + internal static delegate* unmanaged[Cdecl] __NetworkStateChanged2; + private static void ___NetworkStateChanged2(nint entity, string className, string memberName) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __NetworkStateChanged2(entity, &__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves the count of values that an entity schema's array can store. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Size of array (in elements) or 0 if schema is not an array. + internal static delegate* GetEntSchemaArraySize = &___GetEntSchemaArraySize; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaArraySize; + private static int ___GetEntSchemaArraySize(int entityHandle, string className, string memberName) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaArraySize(entityHandle, &__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Retrieves an integer value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// An integer value at the given schema offset. + internal static delegate* GetEntSchema = &___GetEntSchema; + internal static delegate* unmanaged[Cdecl] __GetEntSchema; + private static long ___GetEntSchema(int entityHandle, string className, string memberName, int element) + { + long __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchema(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets an integer value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The integer value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchema = &___SetEntSchema; + internal static delegate* unmanaged[Cdecl] __SetEntSchema; + private static void ___SetEntSchema(int entityHandle, string className, string memberName, long value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchema(entityHandle, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a float value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A float value at the given schema offset. + internal static delegate* GetEntSchemaFloat = &___GetEntSchemaFloat; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaFloat; + private static double ___GetEntSchemaFloat(int entityHandle, string className, string memberName, int element) + { + double __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaFloat(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a float value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The float value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaFloat = &___SetEntSchemaFloat; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaFloat; + private static void ___SetEntSchemaFloat(int entityHandle, string className, string memberName, double value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaFloat(entityHandle, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a string value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaString = &___GetEntSchemaString; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaString; + private static string ___GetEntSchemaString(int entityHandle, string className, string memberName, int element) + { + string __retVal; + String192 __retVal_native; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal_native = __GetEntSchemaString(entityHandle, &__className, &__memberName, element); + // Unmarshal - Convert native data to managed data. + __retVal = NativeMethods.GetStringData(&__retVal_native); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__retVal_native); + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a string value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The string value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaString = &___SetEntSchemaString; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaString; + private static void ___SetEntSchemaString(int entityHandle, string className, string memberName, string value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + var __value = NativeMethods.ConstructString(value); + try { + __SetEntSchemaString(entityHandle, &__className, &__memberName, &__value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + NativeMethods.DestroyString(&__value); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaVector3D = &___GetEntSchemaVector3D; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector3D; + private static Vector3 ___GetEntSchemaVector3D(int entityHandle, string className, string memberName, int element) + { + Vector3 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector3D(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector3D = &___SetEntSchemaVector3D; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector3D; + private static void ___SetEntSchemaVector3D(int entityHandle, string className, string memberName, Vector3 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector3D(entityHandle, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaVector2D = &___GetEntSchemaVector2D; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector2D; + private static Vector2 ___GetEntSchemaVector2D(int entityHandle, string className, string memberName, int element) + { + Vector2 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector2D(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector2D = &___SetEntSchemaVector2D; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector2D; + private static void ___SetEntSchemaVector2D(int entityHandle, string className, string memberName, Vector2 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector2D(entityHandle, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves a vector value from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaVector4D = &___GetEntSchemaVector4D; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaVector4D; + private static Vector4 ___GetEntSchemaVector4D(int entityHandle, string className, string memberName, int element) + { + Vector4 __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaVector4D(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets a vector value in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The vector value to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaVector4D = &___SetEntSchemaVector4D; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaVector4D; + private static void ___SetEntSchemaVector4D(int entityHandle, string className, string memberName, Vector4 value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaVector4D(entityHandle, &__className, &__memberName, &value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Retrieves an entity handle from an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// Element # (starting from 0) if schema is an array. + /// A string value at the given schema offset. + internal static delegate* GetEntSchemaEnt = &___GetEntSchemaEnt; + internal static delegate* unmanaged[Cdecl] __GetEntSchemaEnt; + private static int ___GetEntSchemaEnt(int entityHandle, string className, string memberName, int element) + { + int __retVal; + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __retVal = __GetEntSchemaEnt(entityHandle, &__className, &__memberName, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + return __retVal; + } + + /// + /// Sets an entity handle in an entity's schema. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class. + /// The name of the schema member. + /// The entity handle to set. + /// If true, change will be sent over the network. + /// Element # (starting from 0) if schema is an array. + internal static delegate* SetEntSchemaEnt = &___SetEntSchemaEnt; + internal static delegate* unmanaged[Cdecl] __SetEntSchemaEnt; + private static void ___SetEntSchemaEnt(int entityHandle, string className, string memberName, int value, Bool8 changeState, int element) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __SetEntSchemaEnt(entityHandle, &__className, &__memberName, value, changeState, element); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + /// + /// Updates the networked state of a schema field for a given entity handle. + /// + /// The handle of the entity from which the value is to be retrieved. + /// The name of the class that contains the member. + /// The name of the member to be set. + internal static delegate* NetworkStateChanged = &___NetworkStateChanged; + internal static delegate* unmanaged[Cdecl] __NetworkStateChanged; + private static void ___NetworkStateChanged(int entityHandle, string className, string memberName) + { + var __className = NativeMethods.ConstructString(className); + var __memberName = NativeMethods.ConstructString(memberName); + try { + __NetworkStateChanged(entityHandle, &__className, &__memberName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__className); + NativeMethods.DestroyString(&__memberName); + } + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/timers.cs b/PlugifyProfiler/imported/s2sdk/timers.cs new file mode 100644 index 0000000..6f69de5 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/timers.cs @@ -0,0 +1,88 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: timers) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Creates a new timer that executes a callback function at specified delays. + /// + /// The time delay in seconds between each callback execution. + /// The function to be called when the timer expires. + /// Flags that modify the behavior of the timer (e.g., no-map change, repeating). + /// An array intended to hold user-related data, allowing for elements of any type. + /// A id to the newly created Timer object, or -1 if the timer could not be created. + internal static delegate* CreateTimer = &___CreateTimer; + internal static delegate* unmanaged[Cdecl] __CreateTimer; + private static uint ___CreateTimer(double delay, TimerCallback callback, TimerFlag flags, object[] userData) + { + uint __retVal; + var __userData = NativeMethods.ConstructVectorVariant(userData, userData.Length); + try { + __retVal = __CreateTimer(delay, Marshalling.GetFunctionPointerForDelegate(callback), flags, &__userData); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorVariant(&__userData); + } + return __retVal; + } + + /// + /// Stops and removes an existing timer. + /// + /// A id of the Timer object to be stopped and removed. + internal static delegate* KillsTimer = &___KillsTimer; + internal static delegate* unmanaged[Cdecl] __KillsTimer; + private static void ___KillsTimer(uint timer) + { + __KillsTimer(timer); + } + + /// + /// Reschedules an existing timer with a new delay. + /// + /// A id of the Timer object to be stopped and removed. + /// The new delay in seconds between each callback execution. + internal static delegate* RescheduleTimer = &___RescheduleTimer; + internal static delegate* unmanaged[Cdecl] __RescheduleTimer; + private static void ___RescheduleTimer(uint timer, double newDaly) + { + __RescheduleTimer(timer, newDaly); + } + + /// + /// Returns the number of seconds in between game server ticks. + /// + /// The tick interval value. + internal static delegate* GetTickInterval = &___GetTickInterval; + internal static delegate* unmanaged[Cdecl] __GetTickInterval; + private static double ___GetTickInterval() + { + double __retVal = __GetTickInterval(); + return __retVal; + } + + /// + /// Returns the simulated game time. + /// + /// The ticked time value. + internal static delegate* GetTickedTime = &___GetTickedTime; + internal static delegate* unmanaged[Cdecl] __GetTickedTime; + private static double ___GetTickedTime() + { + double __retVal = __GetTickedTime(); + return __retVal; + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/trace.cs b/PlugifyProfiler/imported/s2sdk/trace.cs new file mode 100644 index 0000000..7858638 --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/trace.cs @@ -0,0 +1,147 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: trace) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Performs a collideable trace using the VScript-compatible table call, exposing it through C++ exports. + /// + /// Trace start position (world space) + /// Trace end position (world space) + /// Entity handle of the collideable + /// Output: position of impact + /// Output: fraction of trace completed + /// Output: whether a hit occurred + /// Output: whether trace started inside solid + /// Output: surface normal at impact + /// True if trace hit something, false otherwise + internal static delegate* TraceCollideable = &___TraceCollideable; + internal static delegate* unmanaged[Cdecl] __TraceCollideable; + private static Bool8 ___TraceCollideable(Vector3 start, Vector3 end, int entityHandle, ref Vector3 outPos, ref double outFraction, ref Bool8 outHit, ref Bool8 outStartSolid, ref Vector3 outNormal) + { + Bool8 __retVal; + fixed(Vector3* __outPos = &outPos) { + fixed(double* __outFraction = &outFraction) { + fixed(Bool8* __outHit = &outHit) { + fixed(Bool8* __outStartSolid = &outStartSolid) { + fixed(Vector3* __outNormal = &outNormal) { + __retVal = __TraceCollideable(&start, &end, entityHandle, __outPos, __outFraction, __outHit, __outStartSolid, __outNormal); + } + } + } + } + } + return __retVal; + } + + /// + /// Performs a collideable trace using the VScript-compatible table call, exposing it through C++ exports. + /// + /// Trace start position (world space) + /// Trace end position (world space) + /// Entity handle of the collideable + /// Bounding box minimums + /// Bounding box maximums + /// Output: position of impact + /// Output: fraction of trace completed + /// Output: whether a hit occurred + /// Output: whether trace started inside solid + /// Output: surface normal at impact + /// True if trace hit something, false otherwise + internal static delegate* TraceCollideable2 = &___TraceCollideable2; + internal static delegate* unmanaged[Cdecl] __TraceCollideable2; + private static Bool8 ___TraceCollideable2(Vector3 start, Vector3 end, int entityHandle, nint mins, nint maxs, ref Vector3 outPos, ref double outFraction, ref Bool8 outHit, ref Bool8 outStartSolid, ref Vector3 outNormal) + { + Bool8 __retVal; + fixed(Vector3* __outPos = &outPos) { + fixed(double* __outFraction = &outFraction) { + fixed(Bool8* __outHit = &outHit) { + fixed(Bool8* __outStartSolid = &outStartSolid) { + fixed(Vector3* __outNormal = &outNormal) { + __retVal = __TraceCollideable2(&start, &end, entityHandle, mins, maxs, __outPos, __outFraction, __outHit, __outStartSolid, __outNormal); + } + } + } + } + } + return __retVal; + } + + /// + /// Performs a hull trace with specified dimensions and mask. + /// + /// Trace start position + /// Trace end position + /// Local bounding box minimums + /// Local bounding box maximums + /// Trace mask + /// Entity handle to ignore during trace + /// Output: position of impact + /// Output: fraction of trace completed + /// Output: whether a hit occurred + /// Output: handle of entity hit + /// Output: whether trace started inside solid + /// True if trace hit something, false otherwise + internal static delegate* TraceHull = &___TraceHull; + internal static delegate* unmanaged[Cdecl] __TraceHull; + private static Bool8 ___TraceHull(Vector3 start, Vector3 end, Vector3 min, Vector3 max, int mask, int ignoreHandle, ref Vector3 outPos, ref double outFraction, ref Bool8 outHit, ref int outEntHit, ref Bool8 outStartSolid) + { + Bool8 __retVal; + fixed(Vector3* __outPos = &outPos) { + fixed(double* __outFraction = &outFraction) { + fixed(Bool8* __outHit = &outHit) { + fixed(int* __outEntHit = &outEntHit) { + fixed(Bool8* __outStartSolid = &outStartSolid) { + __retVal = __TraceHull(&start, &end, &min, &max, mask, ignoreHandle, __outPos, __outFraction, __outHit, __outEntHit, __outStartSolid); + } + } + } + } + } + return __retVal; + } + + /// + /// Performs a line trace between two points. + /// + /// Trace start position + /// Trace end position + /// Trace mask + /// Entity handle to ignore during trace + /// Output: position of impact + /// Output: fraction of trace completed + /// Output: whether a hit occurred + /// Output: handle of entity hit + /// Output: whether trace started inside solid + /// True if trace hit something, false otherwise + internal static delegate* TraceLine = &___TraceLine; + internal static delegate* unmanaged[Cdecl] __TraceLine; + private static Bool8 ___TraceLine(Vector3 startPos, Vector3 endPos, int mask, int ignoreHandle, ref Vector3 outPos, ref double outFraction, ref Bool8 outHit, ref int outEntHit, ref Bool8 outStartSolid) + { + Bool8 __retVal; + fixed(Vector3* __outPos = &outPos) { + fixed(double* __outFraction = &outFraction) { + fixed(Bool8* __outHit = &outHit) { + fixed(int* __outEntHit = &outEntHit) { + fixed(Bool8* __outStartSolid = &outStartSolid) { + __retVal = __TraceLine(&startPos, &endPos, mask, ignoreHandle, __outPos, __outFraction, __outHit, __outEntHit, __outStartSolid); + } + } + } + } + } + return __retVal; + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/transmit.cs b/PlugifyProfiler/imported/s2sdk/transmit.cs new file mode 100644 index 0000000..29e2e9f --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/transmit.cs @@ -0,0 +1,630 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: transmit) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Sets a bit in the TransmitEntity bitvec, marking an entity as transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to mark as transmittable. + internal static delegate* SetTransmitInfoEntity = &___SetTransmitInfoEntity; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoEntity; + private static void ___SetTransmitInfoEntity(nint info, int entityHandle) + { + __SetTransmitInfoEntity(info, entityHandle); + } + + /// + /// Clears a bit in the TransmitEntity bitvec, marking an entity as not transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to mark as not transmittable. + internal static delegate* ClearTransmitInfoEntity = &___ClearTransmitInfoEntity; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoEntity; + private static void ___ClearTransmitInfoEntity(nint info, int entityHandle) + { + __ClearTransmitInfoEntity(info, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitEntity bitvec. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to check. + /// True if the entity is marked as transmittable, false otherwise. + internal static delegate* IsTransmitInfoEntitySet = &___IsTransmitInfoEntitySet; + internal static delegate* unmanaged[Cdecl] __IsTransmitInfoEntitySet; + private static Bool8 ___IsTransmitInfoEntitySet(nint info, int entityHandle) + { + Bool8 __retVal = __IsTransmitInfoEntitySet(info, entityHandle); + return __retVal; + } + + /// + /// Sets all bits in the TransmitEntity bitvec, marking all entities as transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* SetTransmitInfoEntityAll = &___SetTransmitInfoEntityAll; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoEntityAll; + private static void ___SetTransmitInfoEntityAll(nint info) + { + __SetTransmitInfoEntityAll(info); + } + + /// + /// Clears all bits in the TransmitEntity bitvec, marking all entities as not transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* ClearTransmitInfoEntityAll = &___ClearTransmitInfoEntityAll; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoEntityAll; + private static void ___ClearTransmitInfoEntityAll(nint info) + { + __ClearTransmitInfoEntityAll(info); + } + + /// + /// Sets a bit in the TransmitNonPlayers bitvec, marking a non-player entity as transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The index of the non-player entity to mark as transmittable. + internal static delegate* SetTransmitInfoNonPlayer = &___SetTransmitInfoNonPlayer; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoNonPlayer; + private static void ___SetTransmitInfoNonPlayer(nint info, int entityHandle) + { + __SetTransmitInfoNonPlayer(info, entityHandle); + } + + /// + /// Clears a bit in the TransmitNonPlayers bitvec, marking a non-player entity as not transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The index of the non-player entity to mark as not transmittable. + internal static delegate* ClearTransmitInfoNonPlayer = &___ClearTransmitInfoNonPlayer; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoNonPlayer; + private static void ___ClearTransmitInfoNonPlayer(nint info, int entityHandle) + { + __ClearTransmitInfoNonPlayer(info, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitNonPlayers bitvec. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The index of the non-player entity to check. + /// True if the entity is marked as transmittable, false otherwise. + internal static delegate* IsTransmitInfoNonPlayerSet = &___IsTransmitInfoNonPlayerSet; + internal static delegate* unmanaged[Cdecl] __IsTransmitInfoNonPlayerSet; + private static Bool8 ___IsTransmitInfoNonPlayerSet(nint info, int entityHandle) + { + Bool8 __retVal = __IsTransmitInfoNonPlayerSet(info, entityHandle); + return __retVal; + } + + /// + /// Sets all bits in the TransmitNonPlayers bitvec, marking all non-player entities as transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* SetTransmitInfoNonPlayerAll = &___SetTransmitInfoNonPlayerAll; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoNonPlayerAll; + private static void ___SetTransmitInfoNonPlayerAll(nint info) + { + __SetTransmitInfoNonPlayerAll(info); + } + + /// + /// Clears all bits in the TransmitNonPlayers bitvec, marking all non-player entities as not transmittable. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* ClearTransmitInfoNonPlayerAll = &___ClearTransmitInfoNonPlayerAll; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoNonPlayerAll; + private static void ___ClearTransmitInfoNonPlayerAll(nint info) + { + __ClearTransmitInfoNonPlayerAll(info); + } + + /// + /// Sets a bit in the TransmitAlways bitvec, marking an entity to always transmit. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to mark as always transmittable. + internal static delegate* SetTransmitInfoAlways = &___SetTransmitInfoAlways; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoAlways; + private static void ___SetTransmitInfoAlways(nint info, int entityHandle) + { + __SetTransmitInfoAlways(info, entityHandle); + } + + /// + /// Clears a bit in the TransmitAlways bitvec, unmarking an entity from always transmit. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to unmark from always transmit. + internal static delegate* ClearTransmitInfoAlways = &___ClearTransmitInfoAlways; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoAlways; + private static void ___ClearTransmitInfoAlways(nint info, int entityHandle) + { + __ClearTransmitInfoAlways(info, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitAlways bitvec. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The handle of the entity to check. + /// True if the entity is marked to always transmit, false otherwise. + internal static delegate* IsTransmitInfoAlwaysSet = &___IsTransmitInfoAlwaysSet; + internal static delegate* unmanaged[Cdecl] __IsTransmitInfoAlwaysSet; + private static Bool8 ___IsTransmitInfoAlwaysSet(nint info, int entityHandle) + { + Bool8 __retVal = __IsTransmitInfoAlwaysSet(info, entityHandle); + return __retVal; + } + + /// + /// Sets all bits in the TransmitAlways bitvec, marking all entities to always transmit. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* SetTransmitInfoAlwaysAll = &___SetTransmitInfoAlwaysAll; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoAlwaysAll; + private static void ___SetTransmitInfoAlwaysAll(nint info) + { + __SetTransmitInfoAlwaysAll(info); + } + + /// + /// Clears all bits in the TransmitAlways bitvec, unmarking all entities from always transmit. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* ClearTransmitInfoAlwaysAll = &___ClearTransmitInfoAlwaysAll; + internal static delegate* unmanaged[Cdecl] __ClearTransmitInfoAlwaysAll; + private static void ___ClearTransmitInfoAlwaysAll(nint info) + { + __ClearTransmitInfoAlwaysAll(info); + } + + /// + /// Gets the count of target player slots. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The number of target player slots, or 0 if the info pointer is null. + internal static delegate* GetTransmitInfoTargetSlotsCount = &___GetTransmitInfoTargetSlotsCount; + internal static delegate* unmanaged[Cdecl] __GetTransmitInfoTargetSlotsCount; + private static int ___GetTransmitInfoTargetSlotsCount(nint info) + { + int __retVal = __GetTransmitInfoTargetSlotsCount(info); + return __retVal; + } + + /// + /// Gets a player slot value at a specific index in the target slots vector. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The index in the target slots vector. + /// The player slot value, or -1 if the index is invalid or info is null. + internal static delegate* GetTransmitInfoTargetSlot = &___GetTransmitInfoTargetSlot; + internal static delegate* unmanaged[Cdecl] __GetTransmitInfoTargetSlot; + private static int ___GetTransmitInfoTargetSlot(nint info, int index) + { + int __retVal = __GetTransmitInfoTargetSlot(info, index); + return __retVal; + } + + /// + /// Adds a player slot to the target slots vector. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The player slot value to add. + internal static delegate* AddTransmitInfoTargetSlot = &___AddTransmitInfoTargetSlot; + internal static delegate* unmanaged[Cdecl] __AddTransmitInfoTargetSlot; + private static void ___AddTransmitInfoTargetSlot(nint info, int playerSlot) + { + __AddTransmitInfoTargetSlot(info, playerSlot); + } + + /// + /// Removes a player slot from the target slots vector. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// Index within the target slots vector to remove. + internal static delegate* RemoveTransmitInfoTargetSlot = &___RemoveTransmitInfoTargetSlot; + internal static delegate* unmanaged[Cdecl] __RemoveTransmitInfoTargetSlot; + private static void ___RemoveTransmitInfoTargetSlot(nint info, int index) + { + __RemoveTransmitInfoTargetSlot(info, index); + } + + /// + /// Gets the target slots vector. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The player slots array. + internal static delegate* GetTransmitInfoTargetSlotsAll = &___GetTransmitInfoTargetSlotsAll; + internal static delegate* unmanaged[Cdecl] __GetTransmitInfoTargetSlotsAll; + private static int[] ___GetTransmitInfoTargetSlotsAll(nint info) + { + int[] __retVal; + Vector192 __retVal_native; + try { + __retVal_native = __GetTransmitInfoTargetSlotsAll(info); + // Unmarshal - Convert native data to managed data. + __retVal = new int[NativeMethods.GetVectorSizeInt32(&__retVal_native)]; + NativeMethods.GetVectorDataInt32(&__retVal_native, __retVal); + } + finally { + // Perform cleanup. + NativeMethods.DestroyVectorInt32(&__retVal_native); + } + return __retVal; + } + + /// + /// Clears all target player slots from the vector. + /// + /// Pointer to the CCheckTransmitInfo structure. + internal static delegate* RemoveTransmitInfoTargetSlotsAll = &___RemoveTransmitInfoTargetSlotsAll; + internal static delegate* unmanaged[Cdecl] __RemoveTransmitInfoTargetSlotsAll; + private static void ___RemoveTransmitInfoTargetSlotsAll(nint info) + { + __RemoveTransmitInfoTargetSlotsAll(info); + } + + /// + /// Gets the player slot value from the CCheckTransmitInfo. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The player slot value, or -1 if info is null. + internal static delegate* GetTransmitInfoPlayerSlot = &___GetTransmitInfoPlayerSlot; + internal static delegate* unmanaged[Cdecl] __GetTransmitInfoPlayerSlot; + private static int ___GetTransmitInfoPlayerSlot(nint info) + { + int __retVal = __GetTransmitInfoPlayerSlot(info); + return __retVal; + } + + /// + /// Sets the player slot value in the CCheckTransmitInfo. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The player slot value to set. + internal static delegate* SetTransmitInfoPlayerSlot = &___SetTransmitInfoPlayerSlot; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoPlayerSlot; + private static void ___SetTransmitInfoPlayerSlot(nint info, int playerSlot) + { + __SetTransmitInfoPlayerSlot(info, playerSlot); + } + + /// + /// Gets the full update flag from the CCheckTransmitInfo. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// True if full update is enabled, false otherwise. + internal static delegate* GetTransmitInfoFullUpdate = &___GetTransmitInfoFullUpdate; + internal static delegate* unmanaged[Cdecl] __GetTransmitInfoFullUpdate; + private static Bool8 ___GetTransmitInfoFullUpdate(nint info) + { + Bool8 __retVal = __GetTransmitInfoFullUpdate(info); + return __retVal; + } + + /// + /// Sets the full update flag in the CCheckTransmitInfo. + /// + /// Pointer to the CCheckTransmitInfo structure. + /// The full update flag value to set. + internal static delegate* SetTransmitInfoFullUpdate = &___SetTransmitInfoFullUpdate; + internal static delegate* unmanaged[Cdecl] __SetTransmitInfoFullUpdate; + private static void ___SetTransmitInfoFullUpdate(nint info, Bool8 fullUpdate) + { + __SetTransmitInfoFullUpdate(info, fullUpdate); + } + + } + + /// + /// RAII wrapper for CheckTransmitInfo pointer. + /// + internal sealed unsafe class CheckTransmitInfo + { + private nint handle; + + /// + /// Internal constructor for creating CheckTransmitInfo from existing handle + /// + public CheckTransmitInfo(nint handle) + { + this.handle = handle; + } + + /// + /// Gets the underlying handle + /// + public nint Handle => handle; + + /// + /// Checks if the handle is valid + /// + public bool IsValid => handle != nint.Zero; + + /// + /// Gets the underlying handle + /// + public nint Get() => handle; + + /// + /// Releases ownership of the handle and returns it + /// + public nint Release() + { + var h = handle; + handle = nint.Zero; + return h; + } + + /// + /// Resets the handle to invalid + /// + public void Reset() + { + handle = nint.Zero; + } + + /// + /// Sets a bit in the TransmitEntity bitvec, marking an entity as transmittable. + /// + /// The handle of the entity to mark as transmittable. + public void SetEntity(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoEntity(handle, entityHandle); + } + + /// + /// Clears a bit in the TransmitEntity bitvec, marking an entity as not transmittable. + /// + /// The handle of the entity to mark as not transmittable. + public void ClearEntity(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoEntity(handle, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitEntity bitvec. + /// + /// The handle of the entity to check. + /// True if the entity is marked as transmittable, false otherwise. + public Bool8 IsEntitySet(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.IsTransmitInfoEntitySet(handle, entityHandle); + } + + /// + /// Sets all bits in the TransmitEntity bitvec, marking all entities as transmittable. + /// + public void SetEntityAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoEntityAll(handle); + } + + /// + /// Clears all bits in the TransmitEntity bitvec, marking all entities as not transmittable. + /// + public void ClearEntityAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoEntityAll(handle); + } + + /// + /// Sets a bit in the TransmitNonPlayers bitvec, marking a non-player entity as transmittable. + /// + /// The index of the non-player entity to mark as transmittable. + public void SetNonPlayer(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoNonPlayer(handle, entityHandle); + } + + /// + /// Clears a bit in the TransmitNonPlayers bitvec, marking a non-player entity as not transmittable. + /// + /// The index of the non-player entity to mark as not transmittable. + public void ClearNonPlayer(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoNonPlayer(handle, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitNonPlayers bitvec. + /// + /// The index of the non-player entity to check. + /// True if the entity is marked as transmittable, false otherwise. + public Bool8 IsNonPlayerSet(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.IsTransmitInfoNonPlayerSet(handle, entityHandle); + } + + /// + /// Sets all bits in the TransmitNonPlayers bitvec, marking all non-player entities as transmittable. + /// + public void SetNonPlayerAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoNonPlayerAll(handle); + } + + /// + /// Clears all bits in the TransmitNonPlayers bitvec, marking all non-player entities as not transmittable. + /// + public void ClearNonPlayerAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoNonPlayerAll(handle); + } + + /// + /// Sets a bit in the TransmitAlways bitvec, marking an entity to always transmit. + /// + /// The handle of the entity to mark as always transmittable. + public void SetAlways(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoAlways(handle, entityHandle); + } + + /// + /// Clears a bit in the TransmitAlways bitvec, unmarking an entity from always transmit. + /// + /// The handle of the entity to unmark from always transmit. + public void ClearAlways(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoAlways(handle, entityHandle); + } + + /// + /// Checks if a bit is set in the TransmitAlways bitvec. + /// + /// The handle of the entity to check. + /// True if the entity is marked to always transmit, false otherwise. + public Bool8 IsAlwaysSet(int entityHandle) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.IsTransmitInfoAlwaysSet(handle, entityHandle); + } + + /// + /// Sets all bits in the TransmitAlways bitvec, marking all entities to always transmit. + /// + public void SetAlwaysAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoAlwaysAll(handle); + } + + /// + /// Clears all bits in the TransmitAlways bitvec, unmarking all entities from always transmit. + /// + public void ClearAlwaysAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.ClearTransmitInfoAlwaysAll(handle); + } + + /// + /// Gets the count of target player slots. + /// + /// The number of target player slots, or 0 if the info pointer is null. + public int GetTargetSlotsCount() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetTransmitInfoTargetSlotsCount(handle); + } + + /// + /// Gets a player slot value at a specific index in the target slots vector. + /// + /// The index in the target slots vector. + /// The player slot value, or -1 if the index is invalid or info is null. + public int GetTargetSlot(int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetTransmitInfoTargetSlot(handle, index); + } + + /// + /// Adds a player slot to the target slots vector. + /// + /// The player slot value to add. + public void AddTargetSlot(int playerSlot) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.AddTransmitInfoTargetSlot(handle, playerSlot); + } + + /// + /// Removes a player slot from the target slots vector. + /// + /// Index within the target slots vector to remove. + public void RemoveTargetSlot(int index) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.RemoveTransmitInfoTargetSlot(handle, index); + } + + /// + /// Gets the target slots vector. + /// + /// The player slots array. + public int[] GetTargetSlotsAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetTransmitInfoTargetSlotsAll(handle); + } + + /// + /// Clears all target player slots from the vector. + /// + public void RemoveTargetSlotsAll() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.RemoveTransmitInfoTargetSlotsAll(handle); + } + + /// + /// Gets the player slot value from the CCheckTransmitInfo. + /// + /// The player slot value, or -1 if info is null. + public int GetPlayerSlot() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetTransmitInfoPlayerSlot(handle); + } + + /// + /// Sets the player slot value in the CCheckTransmitInfo. + /// + /// The player slot value to set. + public void SetPlayerSlot(int playerSlot) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoPlayerSlot(handle, playerSlot); + } + + /// + /// Gets the full update flag from the CCheckTransmitInfo. + /// + /// True if full update is enabled, false otherwise. + public Bool8 GetFullUpdate() + { + ObjectDisposedException.ThrowIf(!IsValid, this); + return s2sdk.GetTransmitInfoFullUpdate(handle); + } + + /// + /// Sets the full update flag in the CCheckTransmitInfo. + /// + /// The full update flag value to set. + public void SetFullUpdate(Bool8 fullUpdate) + { + ObjectDisposedException.ThrowIf(!IsValid, this); + s2sdk.SetTransmitInfoFullUpdate(handle, fullUpdate); + } + + } + +#pragma warning restore CS0649 +} diff --git a/PlugifyProfiler/imported/s2sdk/weapons.cs b/PlugifyProfiler/imported/s2sdk/weapons.cs new file mode 100644 index 0000000..79cba8a --- /dev/null +++ b/PlugifyProfiler/imported/s2sdk/weapons.cs @@ -0,0 +1,124 @@ +using System; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Plugify; + +// Generated from s2sdk.pplugin (group: weapons) + +namespace s2sdk { +#pragma warning disable CS0649 + + internal static unsafe partial class s2sdk { + + /// + /// Retrieves the weapon VData for a given weapon name. + /// + /// The name of the weapon. + /// A pointer to the `CCSWeaponBaseVData` if the entity handle is valid and represents a player weapon; otherwise, nullptr. + internal static delegate* GetWeaponVDataFromKey = &___GetWeaponVDataFromKey; + internal static delegate* unmanaged[Cdecl] __GetWeaponVDataFromKey; + private static nint ___GetWeaponVDataFromKey(string name) + { + nint __retVal; + var __name = NativeMethods.ConstructString(name); + try { + __retVal = __GetWeaponVDataFromKey(&__name); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__name); + } + return __retVal; + } + + /// + /// Retrieves the weapon VData for a given weapon. + /// + /// The handle of the entity from which to retrieve the weapon VData. + /// A pointer to the `CCSWeaponBaseVData` if the entity handle is valid and represents a player weapon; otherwise, nullptr. + internal static delegate* GetWeaponVData = &___GetWeaponVData; + internal static delegate* unmanaged[Cdecl] __GetWeaponVData; + private static nint ___GetWeaponVData(int entityHandle) + { + nint __retVal = __GetWeaponVData(entityHandle); + return __retVal; + } + + /// + /// Retrieves the weapon type of a given entity. + /// + /// The handle of the entity (weapon). + /// The type of the weapon, or WEAPONTYPE_UNKNOWN if the entity is invalid. + internal static delegate* GetWeaponType = &___GetWeaponType; + internal static delegate* unmanaged[Cdecl] __GetWeaponType; + private static CSWeaponType ___GetWeaponType(int entityHandle) + { + CSWeaponType __retVal = __GetWeaponType(entityHandle); + return __retVal; + } + + /// + /// Retrieves the weapon category of a given entity. + /// + /// The handle of the entity (weapon). + /// The category of the weapon, or WEAPONCATEGORY_OTHER if the entity is invalid. + internal static delegate* GetWeaponCategory = &___GetWeaponCategory; + internal static delegate* unmanaged[Cdecl] __GetWeaponCategory; + private static CSWeaponCategory ___GetWeaponCategory(int entityHandle) + { + CSWeaponCategory __retVal = __GetWeaponCategory(entityHandle); + return __retVal; + } + + /// + /// Retrieves the gear slot of a given weapon entity. + /// + /// The handle of the entity (weapon). + /// The gear slot of the weapon, or GEAR_SLOT_INVALID if the entity is invalid. + internal static delegate* GetWeaponGearSlot = &___GetWeaponGearSlot; + internal static delegate* unmanaged[Cdecl] __GetWeaponGearSlot; + private static GearSlot ___GetWeaponGearSlot(int entityHandle) + { + GearSlot __retVal = __GetWeaponGearSlot(entityHandle); + return __retVal; + } + + /// + /// Retrieves the weapon definition index for a given entity handle. + /// + /// The handle of the entity from which to retrieve the weapon def index. + /// The weapon definition index as a `uint16_t`, or 0 if the entity handle is invalid. + internal static delegate* GetWeaponItemDefinition = &___GetWeaponItemDefinition; + internal static delegate* unmanaged[Cdecl] __GetWeaponItemDefinition; + private static WeaponDefIndex ___GetWeaponItemDefinition(int entityHandle) + { + WeaponDefIndex __retVal = __GetWeaponItemDefinition(entityHandle); + return __retVal; + } + + /// + /// Retrieves the item definition index associated with a given item name. + /// + /// The name of the item. + /// The weapon definition index as a `uint16_t`, or 0 if the entity handle is invalid. + internal static delegate* GetWeaponItemDefinitionByName = &___GetWeaponItemDefinitionByName; + internal static delegate* unmanaged[Cdecl] __GetWeaponItemDefinitionByName; + private static WeaponDefIndex ___GetWeaponItemDefinitionByName(string itemName) + { + WeaponDefIndex __retVal; + var __itemName = NativeMethods.ConstructString(itemName); + try { + __retVal = __GetWeaponItemDefinitionByName(&__itemName); + } + finally { + // Perform cleanup. + NativeMethods.DestroyString(&__itemName); + } + return __retVal; + } + + } + +#pragma warning restore CS0649 +}