<commit_before>﻿using System;
using System.Runtime.InteropServices;

namespace Urho3D
{
    internal delegate void EventHandler(IntPtr gcHandle, uint type, IntPtr args);

    public partial class Object
    {
        public void SubscribeToEvent(StringHash eventType, Action<StringHash, VariantMap> function)
        {
            if (!ReferenceEquals(this, function.Target))
                throw new ArgumentException("Callback target object must be object on which SubscribeEvent() was " +
                                            "called.");
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<StringHash, VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(StringHash.__FromPInvoke(type), VariantMap.__FromPInvoke(args));
                }, IntPtr.Zero);
        }

        public void SubscribeToEvent(StringHash eventType, Action<VariantMap> function)
        {
            if (!ReferenceEquals(this, function.Target))
                throw new ArgumentException("Callback target object must be object on which SubscribeEvent() was " +
                                            "called.");
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(VariantMap.__FromPInvoke(args));
                }, IntPtr.Zero);
        }

        public void SubscribeToEvent(Object sender, StringHash eventType, Action<StringHash, VariantMap> function)
        {
            if (!ReferenceEquals(this, function.Target))
                throw new ArgumentException("Callback target object must be object on which SubscribeEvent() was " +
                                            "called.");
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<StringHash, VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(StringHash.__FromPInvoke(type), VariantMap.__FromPInvoke(args));
                }, __ToPInvoke(sender));
        }

        public void SubscribeToEvent(Object sender, StringHash eventType, Action<VariantMap> function)
        {
            if (!ReferenceEquals(this, function.Target))
                throw new ArgumentException("Callback target object must be object on which SubscribeEvent() was " +
                                            "called.");
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(VariantMap.__FromPInvoke(args));
                }, __ToPInvoke(sender));
        }

        [DllImport("Urho3DCSharp", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void Urho3D_Object_SubscribeToEvent(IntPtr receiver, IntPtr gcHandle, uint eventType,
            EventHandler function, IntPtr sender);
    }
}<commit_msg>Remove check as it was broken with lambdas.<commit_after>﻿using System;
using System.Runtime.InteropServices;

namespace Urho3D
{
    internal delegate void EventHandler(IntPtr gcHandle, uint type, IntPtr args);

    public partial class Object
    {
        public void SubscribeToEvent(StringHash eventType, Action<StringHash, VariantMap> function)
        {
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<StringHash, VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(StringHash.__FromPInvoke(type), VariantMap.__FromPInvoke(args));
                }, IntPtr.Zero);
        }

        public void SubscribeToEvent(StringHash eventType, Action<VariantMap> function)
        {
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(VariantMap.__FromPInvoke(args));
                }, IntPtr.Zero);
        }

        public void SubscribeToEvent(Object sender, StringHash eventType, Action<StringHash, VariantMap> function)
        {
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<StringHash, VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(StringHash.__FromPInvoke(type), VariantMap.__FromPInvoke(args));
                }, __ToPInvoke(sender));
        }

        public void SubscribeToEvent(Object sender, StringHash eventType, Action<VariantMap> function)
        {
            Urho3D_Object_SubscribeToEvent(__ToPInvoke(this), GCHandle.ToIntPtr(GCHandle.Alloc(function)),
                eventType.Hash, (gcHandle, type, args) =>
                {
                    var callback = (Action<VariantMap>) GCHandle.FromIntPtr(gcHandle).Target;
                    callback.Invoke(VariantMap.__FromPInvoke(args));
                }, __ToPInvoke(sender));
        }

        [DllImport("Urho3DCSharp", CallingConvention = CallingConvention.Cdecl)]
        internal static extern void Urho3D_Object_SubscribeToEvent(IntPtr receiver, IntPtr gcHandle, uint eventType,
            EventHandler function, IntPtr sender);
    }
}
{'fraction_non_alphanumeric': 0.0919333768778576, 'fraction_numerical': 0.0022860875244937948, 'mean_word_length': 2.3451665756417257, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5251917', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1569, 'n_words': 307}