ALFA.Shared.CampaignDatabase.CampaignDatabaseHook.AddBinaryDataHook C# (CSharp) Метод

AddBinaryDataHook() приватный Метод

StoreCampaignObject hook. Called when the server script function StoreCampaignObject is called by any script.
private AddBinaryDataHook ( IntPtr CodeBaseObject, IntPtr CampaignName, IntPtr VarName, IntPtr PlayerName, Byte Cls, IntPtr Data, UInt32 Size ) : Int32
CodeBaseObject System.IntPtr Supplies the code base this /// pointer.
CampaignName System.IntPtr Supplies the campaign name.
VarName System.IntPtr Supplies the variable name.
PlayerName System.IntPtr Supplies the player name.
Cls Byte Always supplies the value 'O'.
Data System.IntPtr Supplies the raw GFF buffer.
Size System.UInt32 Supplies the count of raw GFF bytes in the /// data buffer.
Результат System.Int32
            private Int32 AddBinaryDataHook(IntPtr CodeBaseObject, IntPtr CampaignName, IntPtr VarName, IntPtr PlayerName, Byte Cls, IntPtr Data, UInt32 Size)
            {
                string CampaignNameStr = ServerInterop.ReadCExoString(CampaignName);

                //
                // If the campaign is the virtual database, call registered
                // event handlers.
                //

                if (CampaignNameStr.StartsWith("VDB_"))
                {
                    try
                    {
                        StoreCampaignDatabaseEventArgs EventArgs;
                        string VarNameStr = ServerInterop.ReadCExoString(VarName);
                        string PlayerNameStr = ServerInterop.ReadCExoString(PlayerName);
                        byte[] GFF = new byte[(int)Size];

                        Marshal.Copy(Data, GFF, 0, (int)Size);

                        EventArgs = new StoreCampaignDatabaseEventArgs(CampaignNameStr.Substring(4), VarNameStr, PlayerNameStr, GFF);
                        CampaignDatabase.StoreCampaignDatabaseEvent(null, EventArgs);

                        return EventArgs.Handled ? 1 : 0;
                    }
                    catch (Exception e)
                    {
                        Logger.Log("CampaignDatabaseHook.AddBinaryDataHook: Exception: {0}", e);
                        return 0;
                    }
                }

                //
                // Pass through to the original server implementation that uses
                // the standard campaign database.
                //

                return CCodeBase_AddBinaryData_OriginalDelegate(CodeBaseObject, CampaignName, VarName, PlayerName, Cls, Data, Size);
            }