private VirtualButton CreateNewVirtualButtonInNative(string name, RectangleData rectangleData)
        {
            if (this.ImageTargetType != ImageTargetType.PREDEFINED)
            {
                Debug.LogError("DataSet.RegisterVirtualButton: virtual button '" + name + "' cannot be registered for a user defined target.");
                return(null);
            }
            IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RectangleData)));

            Marshal.StructureToPtr(rectangleData, intPtr, false);
            bool          arg_63_0      = VuforiaWrapper.Instance.ImageTargetCreateVirtualButton(this.mDataSet.DataSetPtr, base.Name, name, intPtr) != 0;
            VirtualButton virtualButton = null;

            if (arg_63_0)
            {
                int num = VuforiaWrapper.Instance.VirtualButtonGetId(this.mDataSet.DataSetPtr, base.Name, name);
                if (!this.mVirtualButtons.ContainsKey(num))
                {
                    virtualButton = new VirtualButtonImpl(name, num, rectangleData, this, this.mDataSet);
                    this.mVirtualButtons.Add(num, virtualButton);
                }
                else
                {
                    virtualButton = this.mVirtualButtons[num];
                }
            }
            return(virtualButton);
        }
        private void CreateVirtualButtonsFromNative()
        {
            int num = VuforiaWrapper.Instance.ImageTargetGetNumVirtualButtons(this.mDataSet.DataSetPtr, base.Name);

            if (num > 0)
            {
                IntPtr intPtr  = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(VuforiaManagerImpl.VirtualButtonData)) * num);
                IntPtr intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RectangleData)) * num);
                VuforiaWrapper.Instance.ImageTargetGetVirtualButtons(intPtr, intPtr2, num, this.mDataSet.DataSetPtr, base.Name);
                for (int i = 0; i < num; i++)
                {
                    VuforiaManagerImpl.VirtualButtonData virtualButtonData = (VuforiaManagerImpl.VirtualButtonData)Marshal.PtrToStructure(new IntPtr(intPtr.ToInt64() + (long)(i * Marshal.SizeOf(typeof(VuforiaManagerImpl.VirtualButtonData)))), typeof(VuforiaManagerImpl.VirtualButtonData));
                    if (!this.mVirtualButtons.ContainsKey(virtualButtonData.id))
                    {
                        RectangleData area          = (RectangleData)Marshal.PtrToStructure(new IntPtr(intPtr2.ToInt64() + (long)(i * Marshal.SizeOf(typeof(RectangleData)))), typeof(RectangleData));
                        int           num2          = 128;
                        StringBuilder stringBuilder = new StringBuilder(num2);
                        if (VuforiaWrapper.Instance.ImageTargetGetVirtualButtonName(this.mDataSet.DataSetPtr, base.Name, i, stringBuilder, num2) == 0)
                        {
                            Debug.LogError("Failed to get virtual button name.");
                        }
                        else
                        {
                            VirtualButton value = new VirtualButtonImpl(stringBuilder.ToString(), virtualButtonData.id, area, this, this.mDataSet);
                            this.mVirtualButtons.Add(virtualButtonData.id, value);
                        }
                    }
                }
                Marshal.FreeHGlobal(intPtr);
                Marshal.FreeHGlobal(intPtr2);
            }
        }