// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
//     <version>$Revision$</version>
// </file>

// This file is automatically generated - any changes will be lost

#pragma warning disable 1591

namespace Debugger.Wrappers.CorDebug
{
	using System;
	
	
	public partial class ICorDebugProcess2
	{
		
		private Debugger.Interop.CorDebug.ICorDebugProcess2 wrappedObject;
		
		internal Debugger.Interop.CorDebug.ICorDebugProcess2 WrappedObject
		{
			get
			{
				return this.wrappedObject;
			}
		}
		
		public ICorDebugProcess2(Debugger.Interop.CorDebug.ICorDebugProcess2 wrappedObject)
		{
			this.wrappedObject = wrappedObject;
			ResourceManager.TrackCOMObject(wrappedObject, typeof(ICorDebugProcess2));
		}
		
		public static ICorDebugProcess2 Wrap(Debugger.Interop.CorDebug.ICorDebugProcess2 objectToWrap)
		{
			if ((objectToWrap != null))
			{
				return new ICorDebugProcess2(objectToWrap);
			} else
			{
				return null;
			}
		}
		
		~ICorDebugProcess2()
		{
			object o = wrappedObject;
			wrappedObject = null;
			ResourceManager.ReleaseCOMObject(o, typeof(ICorDebugProcess2));
		}
		
		public bool Is<T>() where T: class
		{
			System.Reflection.ConstructorInfo ctor = typeof(T).GetConstructors()[0];
			System.Type paramType = ctor.GetParameters()[0].ParameterType;
			return paramType.IsInstanceOfType(this.WrappedObject);
		}
		
		public T As<T>() where T: class
		{
			try {
				return CastTo<T>();
			} catch {
				return null;
			}
		}
		
		public T CastTo<T>() where T: class
		{
			return (T)Activator.CreateInstance(typeof(T), this.WrappedObject);
		}
		
		public static bool operator ==(ICorDebugProcess2 o1, ICorDebugProcess2 o2)
		{
			return ((object)o1 == null && (object)o2 == null) ||
			       ((object)o1 != null && (object)o2 != null && o1.WrappedObject == o2.WrappedObject);
		}
		
		public static bool operator !=(ICorDebugProcess2 o1, ICorDebugProcess2 o2)
		{
			return !(o1 == o2);
		}
		
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}
		
		public override bool Equals(object o)
		{
			ICorDebugProcess2 casted = o as ICorDebugProcess2;
			return (casted != null) && (casted.WrappedObject == wrappedObject);
		}
		
		
		public ICorDebugThread2 GetThreadForTaskID(ulong taskid)
		{
			ICorDebugThread2 ppThread;
			Debugger.Interop.CorDebug.ICorDebugThread2 out_ppThread;
			this.WrappedObject.GetThreadForTaskID(taskid, out out_ppThread);
			ppThread = ICorDebugThread2.Wrap(out_ppThread);
			return ppThread;
		}
		
		public Debugger.Interop.CorDebug._COR_VERSION Version
		{
			get
			{
				Debugger.Interop.CorDebug._COR_VERSION version;
				this.WrappedObject.GetVersion(out version);
				return version;
			}
		}
		
		public uint SetUnmanagedBreakpoint(ulong address, uint bufsize, System.IntPtr buffer)
		{
			uint bufLen;
			this.WrappedObject.SetUnmanagedBreakpoint(address, bufsize, buffer, out bufLen);
			return bufLen;
		}
		
		public void ClearUnmanagedBreakpoint(ulong address)
		{
			this.WrappedObject.ClearUnmanagedBreakpoint(address);
		}
		
		public void SetDesiredNGENCompilerFlags(uint pdwFlags)
		{
			this.WrappedObject.SetDesiredNGENCompilerFlags(pdwFlags);
		}
		
		public uint DesiredNGENCompilerFlags
		{
			get
			{
				uint pdwFlags;
				this.WrappedObject.GetDesiredNGENCompilerFlags(out pdwFlags);
				return pdwFlags;
			}
		}
		
		public ICorDebugReferenceValue GetReferenceValueFromGCHandle(uint handle)
		{
			ICorDebugReferenceValue pOutValue;
			Debugger.Interop.CorDebug.ICorDebugReferenceValue out_pOutValue;
			this.WrappedObject.GetReferenceValueFromGCHandle(handle, out out_pOutValue);
			pOutValue = ICorDebugReferenceValue.Wrap(out_pOutValue);
			return pOutValue;
		}
	}
}

#pragma warning restore 1591
