using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;

namespace Decal.Interop.Filters;

internal sealed class ICharacterStatsEvents_EventProvider : ICharacterStatsEvents_Event, IDisposable
{
	private IConnectionPointContainer m_ConnectionPointContainer;

	private ArrayList m_aEventSinkHelpers;

	private IConnectionPoint m_ConnectionPoint;

	private void Init()
	{
		IConnectionPoint ppCP = null;
		Guid riid = new Guid(new byte[16]
		{
			135, 241, 96, 11, 205, 19, 53, 78, 184, 162,
			254, 18, 143, 5, 202, 107
		});
		m_ConnectionPointContainer.FindConnectionPoint(ref riid, out ppCP);
		m_ConnectionPoint = ppCP;
		m_aEventSinkHelpers = new ArrayList();
	}

	event ICharacterStatsEvents_LoginEventHandler ICharacterStatsEvents_Event.Login
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_LoginDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_LoginDelegate != null && ((characterStatsEvents_SinkHelper.m_LoginDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_Spellbook_AddEventHandler ICharacterStatsEvents_Event.Spellbook_Add
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_Spellbook_AddDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_Spellbook_AddDelegate != null && ((characterStatsEvents_SinkHelper.m_Spellbook_AddDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_Spellbook_DeleteEventHandler ICharacterStatsEvents_Event.Spellbook_Delete
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_Spellbook_DeleteDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_Spellbook_DeleteDelegate != null && ((characterStatsEvents_SinkHelper.m_Spellbook_DeleteDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_LoginCompleteEventHandler ICharacterStatsEvents_Event.LoginComplete
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_LoginCompleteDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_LoginCompleteDelegate != null && ((characterStatsEvents_SinkHelper.m_LoginCompleteDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ActionCompleteEventHandler ICharacterStatsEvents_Event.ActionComplete
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ActionCompleteDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ActionCompleteDelegate != null && ((characterStatsEvents_SinkHelper.m_ActionCompleteDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_StatusMessageEventHandler ICharacterStatsEvents_Event.StatusMessage
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_StatusMessageDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_StatusMessageDelegate != null && ((characterStatsEvents_SinkHelper.m_StatusMessageDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_DeathEventHandler ICharacterStatsEvents_Event.Death
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_DeathDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_DeathDelegate != null && ((characterStatsEvents_SinkHelper.m_DeathDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangePortalModeEventHandler ICharacterStatsEvents_Event.ChangePortalMode
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangePortalModeDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangePortalModeDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangePortalModeDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeEnchantmentsEventHandler ICharacterStatsEvents_Event.ChangeEnchantments
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeEnchantmentsDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeEnchantmentsDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeEnchantmentsDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangePlayerEventHandler ICharacterStatsEvents_Event.ChangePlayer
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangePlayerDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangePlayerDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangePlayerDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeVitalEventHandler ICharacterStatsEvents_Event.ChangeVital
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeVitalDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeVitalDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeVitalDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeXPSEventHandler ICharacterStatsEvents_Event.ChangeXPS
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeXPSDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeXPSDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeXPSDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeFellowshipEventHandler ICharacterStatsEvents_Event.ChangeFellowship
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeFellowshipDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeFellowshipDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeFellowshipDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_LogoffEventHandler ICharacterStatsEvents_Event.Logoff
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_LogoffDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_LogoffDelegate != null && ((characterStatsEvents_SinkHelper.m_LogoffDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_CastSpellEventHandler ICharacterStatsEvents_Event.CastSpell
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_CastSpellDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_CastSpellDelegate != null && ((characterStatsEvents_SinkHelper.m_CastSpellDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeShortcutEventHandler ICharacterStatsEvents_Event.ChangeShortcut
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeShortcutDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeShortcutDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeShortcutDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeSpellbarEventHandler ICharacterStatsEvents_Event.ChangeSpellbar
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeSpellbarDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeSpellbarDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeSpellbarDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeSettingsEventHandler ICharacterStatsEvents_Event.ChangeSettings
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeSettingsDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeSettingsDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeSettingsDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeSettingFlagsEventHandler ICharacterStatsEvents_Event.ChangeSettingFlags
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeSettingFlagsDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeSettingFlagsDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeSettingFlagsDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	event ICharacterStatsEvents_ChangeOptionEventHandler ICharacterStatsEvents_Event.ChangeOption
	{
		add
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_ConnectionPoint == null)
				{
					Init();
				}
				ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = new ICharacterStatsEvents_SinkHelper();
				int pdwCookie = 0;
				m_ConnectionPoint.Advise(characterStatsEvents_SinkHelper, out pdwCookie);
				characterStatsEvents_SinkHelper.m_dwCookie = pdwCookie;
				characterStatsEvents_SinkHelper.m_ChangeOptionDelegate = value;
				m_aEventSinkHelpers.Add(characterStatsEvents_SinkHelper);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
		remove
		{

			bool lockTaken = default(bool);
			try
			{
				Monitor.Enter(this, ref lockTaken);
				if (m_aEventSinkHelpers == null)
				{
					return;
				}
				int count = m_aEventSinkHelpers.Count;
				int num = 0;
				if (0 >= count)
				{
					return;
				}
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					if (characterStatsEvents_SinkHelper.m_ChangeOptionDelegate != null && ((characterStatsEvents_SinkHelper.m_ChangeOptionDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0)
					{
						m_aEventSinkHelpers.RemoveAt(num);
						m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
						if (count <= 1)
						{
							Marshal.ReleaseComObject(m_ConnectionPoint);
							m_ConnectionPoint = null;
							m_aEventSinkHelpers = null;
						}
						break;
					}
					num++;
				}
				while (num < count);
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(this);
				}
			}
	
		}
	}

	public ICharacterStatsEvents_EventProvider(object P_0)
	{
		//Error decoding local variables: Signature type sequence must have at least one element.
		m_ConnectionPointContainer = (IConnectionPointContainer)P_0;
	}

	public void Finalize()
	{
		bool lockTaken = default(bool);
		try
		{
			Monitor.Enter(this, ref lockTaken);
			if (m_ConnectionPoint == null)
			{
				return;
			}
			int count = m_aEventSinkHelpers.Count;
			int num = 0;
			if (0 < count)
			{
				do
				{
					ICharacterStatsEvents_SinkHelper characterStatsEvents_SinkHelper = (ICharacterStatsEvents_SinkHelper)m_aEventSinkHelpers[num];
					m_ConnectionPoint.Unadvise(characterStatsEvents_SinkHelper.m_dwCookie);
					num++;
				}
				while (num < count);
			}
			Marshal.ReleaseComObject(m_ConnectionPoint);
		}
		catch (Exception)
		{
		}
		finally
		{
			if (lockTaken)
			{
				Monitor.Exit(this);
			}
		}
	}

	public void Dispose()
	{
		//Error decoding local variables: Signature type sequence must have at least one element.
		Finalize();
		GC.SuppressFinalize(this);
	}
}
