当前位置: 首页>>代码示例>>C#>>正文


C# Importer.Import方法代码示例

本文整理汇总了C#中Importer.Import方法的典型用法代码示例。如果您正苦于以下问题:C# Importer.Import方法的具体用法?C# Importer.Import怎么用?C# Importer.Import使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Importer的用法示例。


在下文中一共展示了Importer.Import方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateDevirtualizedAttribute

		/// <summary>
		/// Create the DevirtualizedAttribute TypeDef, with a "default .ctor" that
		/// calls the base type's .ctor (System.Attribute).
		/// </summary>
		/// <returns>TypeDef</returns>
		TypeDef CreateDevirtualizedAttribute()
		{
			var importer = new Importer(this.Module);
			var attributeRef = this.Module.CorLibTypes.GetTypeRef("System", "Attribute");
			var attributeCtorRef = importer.Import(attributeRef.ResolveTypeDefThrow().FindMethod(".ctor"));

			var devirtualizedAttr = new TypeDefUser(
				"eazdevirt.Injected", "DevirtualizedAttribute", attributeRef);
			//devirtualizedAttr.Attributes = TypeAttributes.Public | TypeAttributes.AutoLayout
			//	| TypeAttributes.Class | TypeAttributes.AnsiClass;

			var emptyCtor = new MethodDefUser(".ctor", MethodSig.CreateInstance(this.Module.CorLibTypes.Void),
				MethodImplAttributes.IL | MethodImplAttributes.Managed,
				MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName |
				MethodAttributes.ReuseSlot | MethodAttributes.HideBySig);

			var instructions = new List<Instruction>();
			instructions.Add(OpCodes.Ldarg_0.ToInstruction());
			instructions.Add(OpCodes.Call.ToInstruction(attributeCtorRef)); // Call the constructor .ctor
			instructions.Add(OpCodes.Ret.ToInstruction());
			emptyCtor.Body = new CilBody(false, instructions, new List<ExceptionHandler>(), new List<Local>());

			devirtualizedAttr.Methods.Add(emptyCtor);

			return devirtualizedAttr;
		}
开发者ID:misharcrack,项目名称:eazdevirt,代码行数:31,代码来源:AttributeInjector.cs

示例2: Import

        private Import(string path, Importer importer)
        {
            Importer = importer;
            var regex = new Regex(@"\.(le|c)ss$");

            Path = regex.IsMatch(path) ? path : path + ".less";

            Css = Path.EndsWith("css");

            if(!Css)
                Importer.Import(this);
        }
开发者ID:Tigraine,项目名称:dotless,代码行数:12,代码来源:Import.cs

示例3: Import

        private Import(string path, Importer importer)
        {
            Importer = importer;
            var regex = new Regex(@"\.(le|c)ss$");

            Path = regex.IsMatch(path) ? path : path + ".less";

            Css = Path.EndsWith("css");

            if (Css && Path.StartsWith(FORCE_IMPORT_PREFIX))
            {
                Css = false;
                Path = Path.Substring(FORCE_IMPORT_PREFIX.Length);
            }

            if(!Css)
                Importer.Import(this);
        }
开发者ID:bgrins,项目名称:dotless,代码行数:18,代码来源:Import.cs

示例4: Import

        private Import(string path, Importer importer)
        {
            Importer = importer;
            Path = path;

            if (path.EndsWith(".css"))
            {
                Css = true;
            } else
            {
                Css = !Importer.Import(this); // it is assumed to be css if it cannot be found as less

                if (Css && path.EndsWith(".less"))
                {
                    throw new FileNotFoundException("You are importing a file ending in .less that cannot be found.", path);
                }
            }
        }
开发者ID:rmariuzzo,项目名称:dotless,代码行数:18,代码来源:Import.cs

示例5: GetArrayType

        private TypeDef GetArrayType(long size)
        {
            CreateOurType();

            TypeDef arrayType;
            if (_arrayTypeDictionary.TryGetValue(size, out arrayType))
                return arrayType;

            var importer = new Importer(_module);
            var valueTypeRef = importer.Import(typeof (ValueType));

            arrayType = new TypeDefUser("", $"__StaticArrayInitTypeSize={size}", valueTypeRef);
            _module.UpdateRowId(arrayType);
            arrayType.Attributes = TypeAttributes.NestedPrivate | TypeAttributes.ExplicitLayout |
                                   TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.AnsiClass;
            _ourType.NestedTypes.Add(arrayType);
            _arrayTypeDictionary[size] = arrayType;
            arrayType.ClassLayout = new ClassLayoutUser(1, (uint) size);
            return arrayType;
        }
开发者ID:Virility,项目名称:SplashCreator,代码行数:20,代码来源:InitializedDataCreator.cs

示例6: Import

		public LocalVM Import(TypeSigCreatorOptions typeSigCreatorOptions, ModuleDef ownerModule) {
			var opts = CreateLocalOptions();
			var importer = new Importer(ownerModule, ImporterOptions.TryToUseDefs);
			opts.Type = importer.Import(opts.Type);
			return new LocalVM(typeSigCreatorOptions, opts);
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:6,代码来源:LocalVM.cs

示例7: Import

		object Import(ModuleDef ownerModule, object o) {
			var importer = new Importer(ownerModule, ImporterOptions.TryToUseDefs);

			var tdr = o as ITypeDefOrRef;
			if (tdr != null)
				return importer.Import(tdr);

			var method = o as IMethod;
			if (method != null && method.IsMethod)
				return importer.Import(method);

			var field = o as IField;
			if (field != null && field.IsField)
				return importer.Import(field);

			var msig = o as MethodSig;
			if (msig != null)
				return importer.Import(msig);

			Debug.Assert(o == null);
			return null;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:22,代码来源:InstructionOperandVM.cs

示例8: ImportRows

 protected void ImportRows(string tableName, string[] columnNames, IEnumerable<string[]> dataValues)
 {
     using (var importer = new Importer(SqlConnection, tableName, columnNames))
       {
     importer.Import(dataValues);
       }
 }
开发者ID:GrimaceOfDespair,项目名称:BulkInsert,代码行数:7,代码来源:DatabaseTests.cs


注:本文中的Importer.Import方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。