コード例 #1
0
ファイル: CustomAttribute.cs プロジェクト: dbremner/perwapi
        /*-------------------- Constructors ---------------------------------*/

        internal CustomAttribute(MetaDataElement paren, Method constrType,
            Constant[] val)
        {
            Contract.Requires(constrType != null);
            parent = paren;
            type = constrType;
            argVals = val;
            changed = true;
            tabIx = MDTable.CustomAttribute;
        }
コード例 #2
0
ファイル: MDFieldElems.cs プロジェクト: dbremner/perwapi
 /// <summary>
 /// Remove the initial value from this field
 /// </summary>
 public void RemoveValue()
 {
     constVal = null;
     flags &= NoDefault;
 }
コード例 #3
0
ファイル: MDFieldElems.cs プロジェクト: dbremner/perwapi
 /// <summary>
 /// Add a value for this field
 /// </summary>
 /// <param name="val">the value for the field</param>
 public void AddValue(Constant val)
 {
     flags |= HasDefault;
     constVal = val;
 }
コード例 #4
0
ファイル: MDFeatureElems.cs プロジェクト: dbremner/perwapi
 public void RemoveInitValue()
 {
     constVal = null;
 }
コード例 #5
0
ファイル: MDFeatureElems.cs プロジェクト: dbremner/perwapi
 /// <summary>
 /// Add an initial value for this property
 /// </summary>
 /// <param name="constVal">the initial value for this property</param>
 public void AddInitValue(Constant constVal)
 {
     this.constVal = constVal;
 }
コード例 #6
0
ファイル: PEFile.cs プロジェクト: dbremner/perwapi
 /// <summary>
 /// Makes the assembly debuggable by attaching the DebuggableAttribute
 /// to the Assembly. Call immediately before calling WritePEFile.
 /// </summary>
 /// <param name="allowDebug">set true to enable debugging, false otherwise</param>
 /// <param name="suppressOpt">set true to disable optimizations that affect debugging</param>
 public void MakeDebuggable(bool allowDebug, bool suppressOpt)
 {
     Type[] twoBools = new Type[] { PrimitiveType.Boolean, PrimitiveType.Boolean };
     ClassRef debugRef = MSCorLib.mscorlib.GetClass("System.Diagnostics", "DebuggableAttribute");
     if (debugRef == null)
         debugRef = MSCorLib.mscorlib.AddClass("System.Diagnostics", "DebuggableAttribute");
     MethodRef dCtor = debugRef.GetMethod(".ctor", twoBools);
     if (dCtor == null)
     {
         dCtor = debugRef.AddMethod(".ctor", PrimitiveType.Void, twoBools);
         dCtor.AddCallConv(CallConv.Instance);
     }
     Constant[] dbgArgs = new Constant[] { new BoolConst(allowDebug), new BoolConst(suppressOpt) };
     thisAssembly.AddCustomAttribute(dCtor, dbgArgs);
 }
コード例 #7
0
ファイル: Constants.cs プロジェクト: dbremner/perwapi
 /*-------------------- Constructors ---------------------------------*/
 public ArrayConst(Constant[] elems)
 {
     Contract.Requires(elems != null);
     type = ElementType.SZArray;
     size = 5;  // one byte for SZARRAY, 4 bytes for length
     elements = elems;
     foreach (Constant elem in elements)
     {
         size += elem.GetSize();
     }
 }