Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1248 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
6 changed files with 127 additions and 11 deletions
@ -0,0 +1,20 @@ |
|||||||
|
// <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>
|
||||||
|
|
||||||
|
namespace Debugger.Interop.CorSym |
||||||
|
{ |
||||||
|
using System; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
[ComImport, InterfaceType((short) 1), Guid("969708D2-05E5-4861-A3B0-96E473CDF63F")] |
||||||
|
public interface ISymUnmanagedDispose |
||||||
|
{ |
||||||
|
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)] |
||||||
|
void Destroy(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,98 @@ |
|||||||
|
// <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
|
||||||
|
|
||||||
|
namespace Debugger.Wrappers.CorSym |
||||||
|
{ |
||||||
|
using System; |
||||||
|
|
||||||
|
|
||||||
|
public partial class ISymUnmanagedDispose |
||||||
|
{ |
||||||
|
|
||||||
|
private Debugger.Interop.CorSym.ISymUnmanagedDispose wrappedObject; |
||||||
|
|
||||||
|
internal Debugger.Interop.CorSym.ISymUnmanagedDispose WrappedObject |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return this.wrappedObject; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ISymUnmanagedDispose(Debugger.Interop.CorSym.ISymUnmanagedDispose wrappedObject) |
||||||
|
{ |
||||||
|
this.wrappedObject = wrappedObject; |
||||||
|
ResourceManager.TrackCOMObject(wrappedObject, typeof(ISymUnmanagedDispose)); |
||||||
|
} |
||||||
|
|
||||||
|
public static ISymUnmanagedDispose Wrap(Debugger.Interop.CorSym.ISymUnmanagedDispose objectToWrap) |
||||||
|
{ |
||||||
|
return new ISymUnmanagedDispose(objectToWrap); |
||||||
|
} |
||||||
|
|
||||||
|
~ISymUnmanagedDispose() |
||||||
|
{ |
||||||
|
object o = wrappedObject; |
||||||
|
wrappedObject = null; |
||||||
|
ResourceManager.ReleaseCOMObject(o, typeof(ISymUnmanagedDispose)); |
||||||
|
} |
||||||
|
|
||||||
|
public bool Is<T>() where T: class |
||||||
|
{ |
||||||
|
try { |
||||||
|
CastTo<T>(); |
||||||
|
return true; |
||||||
|
} catch { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
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 ==(ISymUnmanagedDispose o1, ISymUnmanagedDispose o2) |
||||||
|
{ |
||||||
|
return ((object)o1 == null && (object)o2 == null) || |
||||||
|
((object)o1 != null && (object)o2 != null && o1.WrappedObject == o2.WrappedObject); |
||||||
|
} |
||||||
|
|
||||||
|
public static bool operator !=(ISymUnmanagedDispose o1, ISymUnmanagedDispose o2) |
||||||
|
{ |
||||||
|
return !(o1 == o2); |
||||||
|
} |
||||||
|
|
||||||
|
public override int GetHashCode() |
||||||
|
{ |
||||||
|
return base.GetHashCode(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool Equals(object o) |
||||||
|
{ |
||||||
|
ISymUnmanagedDispose casted = o as ISymUnmanagedDispose; |
||||||
|
return (casted != null) && (casted.WrappedObject == wrappedObject); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void Destroy() |
||||||
|
{ |
||||||
|
this.WrappedObject.Destroy(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue