public ParameterDefinition BuildParameterDefinition(string name, int sequence,
                                                            ParamAttributes attrs, Param psig, GenericContext context)
        {
            ParameterDefinition ret       = new ParameterDefinition(name, sequence, attrs, null);
            TypeReference       paramType = null;

            if (psig.ByRef)
            {
                paramType = new ReferenceType(GetTypeRefFromSig(psig.Type, context));
            }
            else if (psig.TypedByRef)
            {
                paramType = SearchCoreType(Constants.TypedReference);
            }
            else
            {
                paramType = GetTypeRefFromSig(psig.Type, context);
            }

            if (psig.CustomMods.Length > 0)
            {
                paramType = GetModifierType(psig.CustomMods, paramType);
            }

            ret.ParameterType = paramType;

            return(ret);
        }
예제 #2
0
 public MDParamInfo(string name, uint token, uint seq, ParamAttributes flags)
 {
     this.Name     = name;
     this.Token    = token;
     this.Sequence = seq;
     this.Flags    = flags;
 }
예제 #3
0
 public MDParamInfo(string name, uint token, uint seq, ParamAttributes flags)
 {
     this.Name = name;
     this.Token = token;
     this.Sequence = seq;
     this.Flags = flags;
 }
예제 #4
0
        /// <summary>
        /// Set or clear flags in <see cref="attributes"/>
        /// </summary>
        /// <param name="set"><c>true</c> if flags should be set, <c>false</c> if flags should
        /// be cleared</param>
        /// <param name="flags">Flags to set or clear</param>
        void ModifyAttributes(bool set, ParamAttributes flags)
        {
#if THREAD_SAFE
            int origVal, newVal;
            do
            {
                origVal = attributes;
                if (set)
                {
                    newVal = origVal | (int)flags;
                }
                else
                {
                    newVal = origVal & ~(int)flags;
                }
            } while (Interlocked.CompareExchange(ref attributes, newVal, origVal) != origVal);
#else
            if (set)
            {
                attributes |= (int)flags;
            }
            else
            {
                attributes &= ~(int)flags;
            }
#endif
        }
예제 #5
0
 public MDParamInfo(string name, uint token, uint seq, ParamAttributes flags)
 {
     Name     = name;
     Token    = token;
     Sequence = seq;
     Flags    = flags;
 }
예제 #6
0
 public ParameterDefinition(string name, int seq, ParamAttributes attrs, TypeReference paramType)
 {
     m_name = name;
     m_sequence = seq;
     m_attributes = attrs;
     m_paramType = paramType;
 }
 public ParameterDefinition(string name, int seq, ParamAttributes attrs, TypeReference paramType)
 {
     m_name       = name;
     m_sequence   = seq;
     m_attributes = attrs;
     m_paramType  = paramType;
 }
예제 #8
0
		public ParamDefOptions(ParamDef pd) {
			Name = pd.Name;
			Sequence = pd.Sequence;
			Attributes = pd.Attributes;
			Constant = pd.Constant;
			MarshalType = pd.MarshalType;
			CustomAttributes.AddRange(pd.CustomAttributes);
		}
예제 #9
0
 public ParameterImpl(AssemblyLoader loader, MetadataRow row, int index)
     : base(loader, TableId.Param, index)
 {
     _flags = ((ParamAttributes)row[Schema.Param.Flags].Value);
     Index  = ((int)row[Schema.Param.Sequence].Value);
     Name   = row[Schema.Param.Name].String;
     Value  = Loader.Const[MetadataToken];
 }
예제 #10
0
 public ParamDefOptions(ParamDef pd)
 {
     this.Name        = pd.Name;
     this.Sequence    = pd.Sequence;
     this.Attributes  = pd.Attributes;
     this.Constant    = pd.Constant;
     this.MarshalType = pd.MarshalType;
     this.CustomAttributes.AddRange(pd.CustomAttributes);
 }
        public ParamRow CreateParamRow(ParamAttributes _flags, ushort _sequence, uint _name)
        {
            ParamRow row = new ParamRow();

            row.Flags    = _flags;
            row.Sequence = _sequence;
            row.Name     = _name;
            return(row);
        }
예제 #12
0
 void SetFlagValue(ParamAttributes flag, bool value)
 {
     if (value)
     {
         Attributes |= flag;
     }
     else
     {
         Attributes &= ~flag;
     }
 }
예제 #13
0
        public static void MakeAccessible(this ParamDef parameter, AccessMode mode)
        {
            if (parameter.IsAccessible(mode))
            {
                return;
            }
            ParamAttributes attributes = parameter.Attributes;

            if (mode.HasFlag(AccessMode.Read))
            {
                attributes &= ~ParamAttributes.Out;
            }
            if (mode.HasFlag(AccessMode.Write))
            {
                attributes &= ~ParamAttributes.In;
            }
            parameter.Attributes = attributes;
        }
예제 #14
0
        private void PrintHelpMsg()
        {
            string processName = Process.GetCurrentProcess().ProcessName + ".exe";

            ColorWriteLine(HelpColor, "Usage of " + processName + ":");
            string usageLine = string.Format("    {0} [{1}] (parameter list)",
                                             processName,
                                             string.Join("|", OptionDescriptions.Keys));

            ColorWriteLine(HelpColor, usageLine);
            ColorWriteLine(HelpColor, "    ** parameter format: /PARAMNAME:PARAMVALUE");
            ColorWriteLine(HelpColor, "    ** for bool type, /PARAMNAME /PARAMNAME:1 /PARAMNAME:true are all 'true'");
            Console.WriteLine();

            // if option is correct, only print attr associate with this option
            if (!string.IsNullOrEmpty(SelectedOptionName) && ParamAttributes.ContainsKey(SelectedOptionName))
            {
                ColorWriteLine(HelpColor, "Parameter usage of selected option name '{0}' :", SelectedOptionName);
                ColorWriteLine(HelpColor, "  Option: {0}  ({1})",
                               SelectedOptionName, OptionDescriptions[SelectedOptionName]);
                foreach (var attr in ParamAttributes[SelectedOptionName].Values)
                {
                    ColorWriteLine(HelpColor, GetArgumentParameterUsage(attr));
                }
                return; // no further help msg
            }

            foreach (var optionDesc in OptionDescriptions)
            {
                ColorWriteLine(HelpColor, "  Option: {0}  ({1})", optionDesc.Key, optionDesc.Value);
                if (ParamAttributes.ContainsKey(optionDesc.Key))
                {
                    foreach (var attr in ParamAttributes[optionDesc.Key].Values)
                    {
                        ColorWriteLine(HelpColor, GetArgumentParameterUsage(attr));
                    }
                }
                Console.WriteLine();
            }
        }
예제 #15
0
 public extern static ReactElement Param(ParamAttributes properties, params ReactElementOrText[] children);
예제 #16
0
파일: MDAPI.cs 프로젝트: arkanoid1/dnSpy
		public unsafe static bool GetParamSeqAndAttrs(IMetaDataImport mdi, uint token, out uint seq, out ParamAttributes attrs) {
			seq = uint.MaxValue;
			attrs = 0;
			if (mdi == null)
				return false;

			uint ulSequence, dwAttr;
			int hr = mdi.GetParamProps(token, IntPtr.Zero, new IntPtr(&ulSequence), IntPtr.Zero, 0, IntPtr.Zero, new IntPtr(&dwAttr), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
			if (hr != 0)
				return false;

			seq = ulSequence;
			attrs = (ParamAttributes)dwAttr;
			return true;
		}
예제 #17
0
 private void Add(ParamAttributes a)
 {
 }
예제 #18
0
		bool GetFlagValue(ParamAttributes flag) {
			return (Attributes & flag) != 0;
		}
예제 #19
0
		void SetFlagValue(ParamAttributes flag, bool value) {
			if (value)
				Attributes |= flag;
			else
				Attributes &= ~flag;
		}
예제 #20
0
파일: ParamDef.cs 프로젝트: visi/dnlib
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="sequence">Sequence</param>
 /// <param name="flags">Flags</param>
 public ParamDefUser(UTF8String name, ushort sequence, ParamAttributes flags)
 {
     this.name = name;
     this.sequence = sequence;
     this.flags = flags;
 }
예제 #21
0
		public MDParamInfo(string name, uint token, uint seq, ParamAttributes flags) {
			Name = name;
			Token = token;
			Sequence = seq;
			Flags = flags;
		}
예제 #22
0
		private void LoadData(CLIFile pFile)
		{
			Flags = (ParamAttributes)pFile.ReadUInt16();
			Sequence = pFile.ReadUInt16();
			Name = pFile.ReadStringHeap(pFile.ReadHeapIndex(HeapOffsetSizes.Strings32Bit));
		}
예제 #23
0
 bool GetFlagValue(ParamAttributes flag)
 {
     return((Attributes & flag) != 0);
 }
예제 #24
0
 bool GetFlagValue(ParamAttributes flag) => (Attributes & flag) != 0;
예제 #25
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="sequence">Sequence</param>
 /// <param name="flags">Flags</param>
 public ParamDefUser(UTF8String name, ushort sequence, ParamAttributes flags)
 {
     this.name       = name;
     this.sequence   = sequence;
     this.attributes = (int)flags;
 }
예제 #26
0
 public ParamRow CreateParamRow(ParamAttributes _flags, ushort _sequence, uint _name)
 {
     ParamRow row = new ParamRow ();
     row.Flags = _flags;
     row.Sequence = _sequence;
     row.Name = _name;
     return row;
 }
예제 #27
0
 void Add(ParamAttributes a)
 {
 }
예제 #28
0
		bool GetFlagValue(ParamAttributes flag) => (Attributes & flag) != 0;
예제 #29
0
파일: ParamDef.cs 프로젝트: EmilZhou/dnlib
		/// <summary>
		/// Set or clear flags in <see cref="attributes"/>
		/// </summary>
		/// <param name="set"><c>true</c> if flags should be set, <c>false</c> if flags should
		/// be cleared</param>
		/// <param name="flags">Flags to set or clear</param>
		void ModifyAttributes(bool set, ParamAttributes flags) {
#if THREAD_SAFE
			int origVal, newVal;
			do {
				origVal = attributes;
				if (set)
					newVal = origVal | (int)flags;
				else
					newVal = origVal & ~(int)flags;
			} while (Interlocked.CompareExchange(ref attributes, newVal, origVal) != origVal);
#else
			if (set)
				attributes |= (int)flags;
			else
				attributes &= ~(int)flags;
#endif
		}