예제 #1
0
 /// <summary>
 /// Initializes <see cref="otherMethods"/>, <see cref="getMethods"/>,
 /// and <see cref="setMethods"/>.
 /// </summary>
 protected virtual void InitializePropertyMethods_NoLock()
 {
     getMethods = ThreadSafeListCreator.Create<MethodDef>();
     setMethods = ThreadSafeListCreator.Create<MethodDef>();
     otherMethods = ThreadSafeListCreator.Create<MethodDef>();
 }
예제 #2
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="local1">Local type #1</param>
		/// <param name="local2">Local type #2</param>
		/// <param name="local3">Local type #3</param>
		public LocalSig(TypeSig local1, TypeSig local2, TypeSig local3) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.Create<TypeSig>(local1, local2, local3);
		}
예제 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="flags">Flags</param>
 public VTable(VTableFlags flags)
 {
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>();
 }
예제 #4
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArgs">Generic arguments</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, IList<TypeSig> genArgs) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(genArgs);
		}
예제 #5
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="callingConvention">Calling convention (must have GenericInst set)</param>
		/// <param name="size">Number of generic args</param>
		internal GenericInstMethodSig(CallingConvention callingConvention, uint size) {
			this.callingConvention = callingConvention;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>((int)size);
		}
예제 #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ctor">Custom attribute constructor</param>
 /// <param name="arguments">Constructor arguments. The list is now owned by this instance.</param>
 /// <param name="namedArguments">Named arguments. The list is now owned by this instance.</param>
 /// <param name="blobReader">A reader that returns the original custom attribute blob data</param>
 internal CustomAttribute(ICustomAttributeType ctor, List<CAArgument> arguments, List<CANamedArgument> namedArguments, IBinaryReader blobReader)
 {
     this.ctor = ctor;
     this.arguments = arguments == null ? ThreadSafeListCreator.Create<CAArgument>() : ThreadSafeListCreator.MakeThreadSafe(arguments);
     this.namedArguments = namedArguments == null ? ThreadSafeListCreator.Create<CANamedArgument>() : ThreadSafeListCreator.MakeThreadSafe(namedArguments);
     this.blobReader = blobReader;
 }
예제 #7
0
파일: EventDef.cs 프로젝트: n017/dnlib
 /// <summary>Reset <see cref="AddMethod"/>, <see cref="InvokeMethod"/>, <see cref="RemoveMethod"/>, <see cref="OtherMethods"/></summary>
 protected void ResetMethods()
 {
     otherMethods = null;
 }
예제 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="UsingCounts"/></param>
 public PdbUsingGroupsCustomDebugInfo(int capacity)
 {
     usingCounts = ThreadSafeListCreator.Create <ushort>(capacity);
 }
예제 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Scopes"/></param>
 public PdbStateMachineHoistedLocalScopesCustomDebugInfo(int capacity)
 {
     scopes = ThreadSafeListCreator.Create <StateMachineHoistedLocalScope>(capacity);
 }
예제 #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="stepInfosCapacity">Default capacity for <see cref="StepInfos"/></param>
 public PdbAsyncMethodCustomDebugInfo(int stepInfosCapacity)
 {
     asyncStepInfos = ThreadSafeListCreator.Create <PdbAsyncStepInfo>(stepInfosCapacity);
 }
예제 #11
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbUsingGroupsCustomDebugInfo()
 {
     usingCounts = ThreadSafeListCreator.Create <ushort>();
 }
예제 #12
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public VTableFixups()
 {
     this.vtables = ThreadSafeListCreator.Create <VTable>();
 }
예제 #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rva">RVA of this vtable</param>
 /// <param name="flags">Flgas</param>
 /// <param name="methods">Vtable methods</param>
 public VTable(RVA rva, VTableFlags flags, IEnumerable <IMethod> methods)
 {
     this.rva     = rva;
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>(methods);
 }
예제 #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="rva">RVA of this vtable</param>
 /// <param name="flags">Flgas</param>
 /// <param name="numSlots">Number of methods in vtable</param>
 public VTable(RVA rva, VTableFlags flags, int numSlots)
 {
     this.rva     = rva;
     this.flags   = flags;
     this.methods = ThreadSafeListCreator.Create <IMethod>(numSlots);
 }
예제 #15
0
		void InitializePropertyMethods_NoLock() {
			if (otherMethods != null)
				return;
#if THREAD_SAFE
			theLock.EnterWriteLock(); try {
			if (otherMethods != null) return;
#endif
			ThreadSafe.IList<MethodDef> newOtherMethods;
			var dt = DeclaringType2_NoLock as TypeDefMD;
			if (dt == null)
				newOtherMethods = ThreadSafeListCreator.Create<MethodDef>();
			else
				dt.InitializeProperty(this, out getMethod, out setMethod, out newOtherMethods);
			otherMethods = newOtherMethods;
#if THREAD_SAFE
			} finally { theLock.ExitWriteLock(); }
#endif
		}
예제 #16
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbDynamicLocalsCustomDebugInfo()
 {
     locals = ThreadSafeListCreator.Create <PdbDynamicLocal>();
 }
예제 #17
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="initLocals">Init locals flag</param>
		/// <param name="instructions">All instructions. This instance will own the list.</param>
		/// <param name="exceptionHandlers">All exception handlers. This instance will own the list.</param>
		/// <param name="locals">All locals. This instance will own the locals in the list.</param>
		public CilBody(bool initLocals, IList<Instruction> instructions, IList<ExceptionHandler> exceptionHandlers, IList<Local> locals) {
			this.initLocals = initLocals;
			this.instructions = ThreadSafeListCreator.MakeThreadSafe(instructions);
			this.exceptionHandlers = ThreadSafeListCreator.MakeThreadSafe(exceptionHandlers);
			this.localList = new LocalList(locals);
		}
예제 #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Locals"/></param>
 public PdbDynamicLocalsCustomDebugInfo(int capacity)
 {
     locals = ThreadSafeListCreator.Create <PdbDynamicLocal>(capacity);
 }
예제 #19
0
파일: MetaData.cs 프로젝트: NSentinel/dnlib
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="peImage">The PE image</param>
 /// <param name="cor20Header">The .NET header</param>
 /// <param name="mdHeader">The MD header</param>
 protected MetaData(IPEImage peImage, ImageCor20Header cor20Header, MetaDataHeader mdHeader)
 {
     try {
         this.allStreams = ThreadSafeListCreator.Create<DotNetStream>();
         this.peImage = peImage;
         this.cor20Header = cor20Header;
         this.mdHeader = mdHeader;
     }
     catch {
         if (peImage != null)
             peImage.Dispose();
         throw;
     }
 }
예제 #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbDynamicLocal()
 {
     flags = ThreadSafeListCreator.Create <byte>();
 }
예제 #21
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArgCount">Number of generic arguments</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, uint genArgCount) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>((int)genArgCount);
		}
예제 #22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Flags"/></param>
 public PdbDynamicLocal(int capacity)
 {
     flags = ThreadSafeListCreator.Create <byte>(capacity);
 }
예제 #23
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		/// <param name="sizes">Sizes list. <c>This instance will be the owner of this list.</c></param>
		/// <param name="lowerBounds">Lower bounds list. <c>This instance will be the owner of this list.</c></param>
		public ArraySig(TypeSig arrayType, uint rank, IEnumerable<uint> sizes, IEnumerable<int> lowerBounds)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.Create<uint>(sizes);
			this.lowerBounds = ThreadSafeListCreator.Create<int>(lowerBounds);
		}
예제 #24
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbTupleElementNamesCustomDebugInfo()
 {
     names = ThreadSafeListCreator.Create <PdbTupleElementNames>();
 }
예제 #25
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="args">Generic args</param>
		public GenericInstMethodSig(IList<TypeSig> args) {
			this.callingConvention = CallingConvention.GenericInst;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(args);
		}
예제 #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Names"/></param>
 public PdbTupleElementNamesCustomDebugInfo(int capacity)
 {
     names = ThreadSafeListCreator.Create <PdbTupleElementNames>(capacity);
 }
예제 #27
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="locals">All locals (this instance now owns it)</param>
		/// <param name="dummy">Dummy</param>
		internal LocalSig(IList<TypeSig> locals, bool dummy) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.MakeThreadSafe(locals);
		}
예제 #28
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbTupleElementNames()
 {
     tupleElementNames = ThreadSafeListCreator.Create <string>();
 }
예제 #29
0
        internal void InitializeProperty(CorPropertyDef prop, out ThreadSafe.IList <MethodDef> getMethods, out ThreadSafe.IList <MethodDef> setMethods, out ThreadSafe.IList <MethodDef> otherMethods)
        {
            getMethods   = ThreadSafeListCreator.Create <MethodDef>();
            setMethods   = ThreadSafeListCreator.Create <MethodDef>();
            otherMethods = ThreadSafeListCreator.Create <MethodDef>();
            if (prop == null)
            {
                return;
            }

            var  mdi   = readerModule.MetaDataImport;
            uint token = prop.OriginalToken.Raw;

            uint getToken, setToken;

            MDAPI.GetPropertyGetterSetter(mdi, token, out getToken, out setToken);
            var otherTokens = MDAPI.GetPropertyOtherMethodTokens(mdi, token);

            var dict = CreateMethodDict();

            Add(dict, getMethods, getToken);
            Add(dict, setMethods, setToken);
            foreach (uint otherToken in otherTokens)
            {
                Add(dict, otherMethods, otherToken);
            }
        }
예제 #30
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="TupleElementNames"/></param>
 public PdbTupleElementNames(int capacity)
 {
     tupleElementNames = ThreadSafeListCreator.Create <string>(capacity);
 }
예제 #31
0
파일: DeclSecurity.cs 프로젝트: visi/dnlib
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="action">The security action</param>
 /// <param name="securityAttrs">The security attributes (now owned by this)</param>
 public DeclSecurityUser(SecurityAction action, IList<SecurityAttribute> securityAttrs)
 {
     this.action = action;
     this.securityAttrs = ThreadSafeListCreator.MakeThreadSafe(securityAttrs);
 }
예제 #32
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="capacity">Initial capacity of <see cref="Names"/></param>
 public PortablePdbTupleElementNamesCustomDebugInfo(int capacity)
 {
     names = ThreadSafeListCreator.Create <string>(capacity);
 }
예제 #33
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public CilBody() {
			this.initLocals = true;
			this.instructions = ThreadSafeListCreator.Create<Instruction>();
			this.exceptionHandlers = ThreadSafeListCreator.Create<ExceptionHandler>();
			this.localList = new LocalList();
		}
예제 #34
0
 /// <summary>
 /// Constructor
 /// </summary>
 public PdbAsyncMethodSteppingInformationCustomDebugInfo()
 {
     asyncStepInfos = ThreadSafeListCreator.Create <PdbAsyncStepInfo>();
 }
예제 #35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ctor">Custom attribute constructor</param>
 /// <param name="arguments">Constructor arguments or <c>null</c> if none</param>
 /// <param name="namedArguments">Named arguments or <c>null</c> if none</param>
 /// <param name="blobReader">A reader that returns the original custom attribute blob data</param>
 public CustomAttribute(ICustomAttributeType ctor, IEnumerable<CAArgument> arguments, IEnumerable<CANamedArgument> namedArguments, IBinaryReader blobReader)
 {
     this.ctor = ctor;
     this.arguments = arguments == null ? ThreadSafeListCreator.Create<CAArgument>() : ThreadSafeListCreator.Create<CAArgument>(arguments);
     this.namedArguments = namedArguments == null ? ThreadSafeListCreator.Create<CANamedArgument>() : ThreadSafeListCreator.Create<CANamedArgument>(namedArguments);
     this.blobReader = blobReader;
 }
예제 #36
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="local1">Local type #1</param>
 /// <param name="local2">Local type #2</param>
 /// <param name="local3">Local type #3</param>
 public LocalSig(TypeSig local1, TypeSig local2, TypeSig local3)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>(local1, local2, local3);
 }
예제 #37
0
파일: MetaData.cs 프로젝트: NSentinel/dnlib
 /// <summary>
 /// Dispose method
 /// </summary>
 /// <param name="disposing"><c>true</c> if called by <see cref="Dispose()"/></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!disposing)
         return;
     Dispose(peImage);
     Dispose(stringsStream);
     Dispose(usStream);
     Dispose(blobStream);
     Dispose(guidStream);
     Dispose(tablesStream);
     var as2 = allStreams;
     if (as2 != null) {
         foreach (var stream in as2.GetSafeEnumerable())
             Dispose(stream);
     }
     peImage = null;
     cor20Header = null;
     mdHeader = null;
     stringsStream = null;
     usStream = null;
     blobStream = null;
     guidStream = null;
     tablesStream = null;
     allStreams = null;
     fieldRidToTypeDefRid = null;
     methodRidToTypeDefRid = null;
     typeDefRidToNestedClasses = null;
 }
예제 #38
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="locals">All locals</param>
 public LocalSig(params TypeSig[] locals)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>(locals);
 }
예제 #39
0
파일: EventDef.cs 프로젝트: n017/dnlib
 /// <summary>
 /// Initializes <see cref="otherMethods"/>, <see cref="addMethod"/>,
 /// <see cref="invokeMethod"/> and <see cref="removeMethod"/>.
 /// </summary>
 protected virtual void InitializeEventMethods_NoLock()
 {
     otherMethods = ThreadSafeListCreator.Create<MethodDef>();
 }
예제 #40
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="locals">All locals (this instance now owns it)</param>
 /// <param name="dummy">Dummy</param>
 internal LocalSig(IList <TypeSig> locals, bool dummy)
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.MakeThreadSafe(locals);
 }
예제 #41
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Default constructor
		/// </summary>
		public GenericInstSig() {
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>();
		}
예제 #42
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="callingConvention">Calling convention (must have GenericInst set)</param>
 /// <param name="size">Number of generic args</param>
 internal GenericInstMethodSig(CallingConvention callingConvention, uint size)
 {
     this.callingConvention = callingConvention;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>((int)size);
 }
예제 #43
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="genericType">The generic type</param>
		/// <param name="genArg1">Generic argument #1</param>
		/// <param name="genArg2">Generic argument #2</param>
		/// <param name="genArg3">Generic argument #3</param>
		public GenericInstSig(ClassOrValueTypeSig genericType, TypeSig genArg1, TypeSig genArg2, TypeSig genArg3) {
			this.genericType = genericType;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(genArg1, genArg2, genArg3);
		}
예제 #44
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="arg1">Generic arg #1</param>
 /// <param name="arg2">Generic arg #2</param>
 /// <param name="arg3">Generic arg #3</param>
 public GenericInstMethodSig(TypeSig arg1, TypeSig arg2, TypeSig arg3)
 {
     this.callingConvention = CallingConvention.GenericInst;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>(arg1, arg2, arg3);
 }
예제 #45
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		public ArraySig(TypeSig arrayType, uint rank)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.Create<uint>();
			this.lowerBounds = ThreadSafeListCreator.Create<int>();
		}
예제 #46
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="args">Generic args</param>
 public GenericInstMethodSig(IList <TypeSig> args)
 {
     this.callingConvention = CallingConvention.GenericInst;
     this.genericArgs       = ThreadSafeListCreator.Create <TypeSig>(args);
 }
예제 #47
0
파일: TypeSig.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arrayType">Array type</param>
		/// <param name="rank">Array rank</param>
		/// <param name="sizes">Sizes list. <c>This instance will be the owner of this list.</c></param>
		/// <param name="lowerBounds">Lower bounds list. <c>This instance will be the owner of this list.</c></param>
		internal ArraySig(TypeSig arrayType, uint rank, IList<uint> sizes, IList<int> lowerBounds)
			: base(arrayType) {
			this.rank = rank;
			this.sizes = ThreadSafeListCreator.MakeThreadSafe(sizes);
			this.lowerBounds = ThreadSafeListCreator.MakeThreadSafe(lowerBounds);
		}
예제 #48
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public LocalSig()
 {
     this.callingConvention = CallingConvention.LocalSig;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>();
 }
예제 #49
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="arg1">Generic arg #1</param>
		/// <param name="arg2">Generic arg #2</param>
		/// <param name="arg3">Generic arg #3</param>
		public GenericInstMethodSig(TypeSig arg1, TypeSig arg2, TypeSig arg3) {
			this.callingConvention = CallingConvention.GenericInst;
			this.genericArgs = ThreadSafeListCreator.Create<TypeSig>(arg1, arg2, arg3);
		}
예제 #50
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="callingConvention">Calling convention (must have LocalSig set)</param>
 /// <param name="count">Number of locals</param>
 internal LocalSig(CallingConvention callingConvention, uint count)
 {
     this.callingConvention = callingConvention;
     this.locals            = ThreadSafeListCreator.Create <TypeSig>((int)count);
 }
예제 #51
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="callingConvention">Calling convention (must have LocalSig set)</param>
		/// <param name="count">Number of locals</param>
		internal LocalSig(CallingConvention callingConvention, uint count) {
			this.callingConvention = callingConvention;
			this.locals = ThreadSafeListCreator.Create<TypeSig>((int)count);
		}
예제 #52
0
 /// <summary>Reset <see cref="GetMethods"/>, <see cref="SetMethods"/>, <see cref="OtherMethods"/></summary>
 protected void ResetMethods()
 {
     otherMethods = null;
 }
예제 #53
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="locals">All locals</param>
		public LocalSig(IList<TypeSig> locals) {
			this.callingConvention = CallingConvention.LocalSig;
			this.locals = ThreadSafeListCreator.Create<TypeSig>(locals);
		}
예제 #54
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attrType">Attribute type</param>
 /// <param name="namedArguments">Named arguments that will be owned by this instance</param>
 public SecurityAttribute(ITypeDefOrRef attrType, IList <CANamedArgument> namedArguments)
 {
     this.attrType       = attrType;
     this.namedArguments = ThreadSafeListCreator.MakeThreadSafe(namedArguments ?? new List <CANamedArgument>());
 }
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="attrType">Attribute type</param>
		/// <param name="namedArguments">Named arguments that will be owned by this instance</param>
		public SecurityAttribute(ITypeDefOrRef attrType, IList<CANamedArgument> namedArguments) {
			this.attrType = attrType;
			this.namedArguments = ThreadSafeListCreator.MakeThreadSafe(namedArguments ?? new List<CANamedArgument>());
		}
예제 #56
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public VTable()
 {
     this.methods = ThreadSafeListCreator.Create <IMethod>();
 }