public void SetSharedData(string key, object data) { Contract.NotEmpty(key, nameof(key)); CheckExistence(); using (var converter = new StringConverter()) { var arg = ArgumentConverter.ConvertFromObject(data); Rage.Entity.Entity_SetVariable(NativePointer, converter.StringToPointer(key), ref arg); } }
public void SetSharedData(IDictionary <string, object> data) { Contract.NotNull(data, nameof(data)); CheckExistence(); using (var converter = new StringConverter()) { var keys = new IntPtr[data.Count]; var values = new ArgumentData[data.Count]; var index = 0; foreach (var element in data) { keys[index] = converter.StringToPointer(element.Key); values[index] = ArgumentConverter.ConvertFromObject(element.Value); index++; } Rage.Entity.Entity_SetVariables(NativePointer, keys, values, (ulong)data.Count); } }