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


C# AssemblyDefinition.Write方法代码示例

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


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

示例1: OutputAssembly

		void OutputAssembly (AssemblyDefinition assembly)
		{
			string directory = Context.OutputDirectory;

			CopyConfigFileIfNeeded (assembly, directory);

			switch (Annotations.GetAction (assembly)) {
			case AssemblyAction.Link:
				assembly.Write (GetAssemblyFileName (assembly, directory), SaveSymbols (assembly));
				break;
			case AssemblyAction.Copy:
				CloseSymbols (assembly);
				CopyAssembly (GetOriginalAssemblyFileInfo (assembly), directory, Context.LinkSymbols);
				break;
			case AssemblyAction.Delete:
				CloseSymbols (assembly);
				var target = GetAssemblyFileName (assembly, directory);
				if (File.Exists (target))
					File.Delete (target);
				break;
			default:
				CloseSymbols (assembly);
				break;
			}
		}
开发者ID:nzaugg,项目名称:mono,代码行数:25,代码来源:OutputStep.cs

示例2: VerifyIL

        private void VerifyIL(AssemblyDefinition assembly) {
            string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ar_test.exe");
            assembly.Write(path);

            string peverify = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
                @"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\PEVerify.exe"
            );

            var process = Process.Start(new ProcessStartInfo {
                FileName = peverify,
                Arguments = $"\"{path}\"",
                CreateNoWindow = true,
                UseShellExecute = false,
                RedirectStandardOutput = true
            });

            string output = process.StandardOutput.ReadToEnd();

            process.WaitForExit();

            if(process.ExitCode != 0) {
                throw new VerifyFailedException(process.ExitCode, output);
            }
        }
开发者ID:MI3Guy,项目名称:argon,代码行数:25,代码来源:CLRCompilerTestHelper.cs

示例3: WriteAssembly

        static void WriteAssembly( AssemblyDefinition assembly, string targetPath, StrongNameKeyPair snk )
        {
            WriterParameters wp = new WriterParameters()
            {
                WriteSymbols = true,
                StrongNameKeyPair = snk
            };

            assembly.Write( targetPath, wp );
        }
开发者ID:InishTech,项目名称:ExtensionAttributeStripper,代码行数:10,代码来源:Program.cs

示例4: ExecuteModifiedAssembly

        private void ExecuteModifiedAssembly(AssemblyDefinition greeterAssembly)
        {
            var memoryStream = new MemoryStream();
            greeterAssembly.Write(memoryStream);

            // Convert the modified assembly into
            // an assembly that will be loaded by System.Reflection
            var bytes = memoryStream.GetBuffer();
            var assembly = Assembly.Load(bytes);
            var modifiedGreeterType = assembly.GetTypes()[0];
            var greeter = (IGreeter)Activator.CreateInstance(modifiedGreeterType);
            greeter.Greet("NDC");
        }
开发者ID:philiplaureano,项目名称:ILRewritingTalk,代码行数:13,代码来源:SampleRunner.cs

示例5: ExecuteModifiedAssembly

        private void ExecuteModifiedAssembly(AssemblyDefinition targetAssembly)
        {
            var memoryStream = new MemoryStream();
            targetAssembly.Write(memoryStream);

            // Convert the modified assembly into
            // an assembly that will be loaded by System.Reflection
            var bytes = memoryStream.GetBuffer();
            var assembly = Assembly.Load(bytes);
            var modifiedGreeterType = assembly.GetTypes()[0];
            var printer = (IPrinter)Activator.CreateInstance(modifiedGreeterType);
            
            for(var i = 0; i < 100; i++)
            {
                printer.Print(i);
            }
        }
开发者ID:philiplaureano,项目名称:Cecil.Tutorials,代码行数:17,代码来源:BaseFizzBuzzModificationFixture.cs

示例6: VerifyAssembly

		/// <summary>
		/// Verify an assembly with peverify
		/// </summary>
		/// <param name="adef">Assembly definition</param>
		public static void VerifyAssembly(AssemblyDefinition adef)
		{
			if (adef != null)
			{
				var originalLocation = adef.MainModule.Image.FileName;

				if (PEVerifyUtility.PEVerifyToolPresent)
				{
					// We must create a temporary filename in the same path, so PEVerify can resolve dependencies
					var tempDirectory = Path.GetDirectoryName(originalLocation) ?? string.Empty;
					var tempFilename = Path.Combine(tempDirectory, Path.GetRandomFileName());
					try
					{
						adef.Write(tempFilename);
						AssemblyVerification.Verify(tempFilename);
						MessageBox.Show(@"All Classes and Methods Verified.");
					}
					catch (VerificationException ex)
					{
						using (var form = new VerifierForm())
							form.ShowDialog(ex.Errors);
					}
					catch (Exception ex)
					{
						MessageBox.Show(String.Format("Reflexil is unable to verify this assembly: {0}", ex.Message));
					}
					finally
					{
						File.Delete(tempFilename);
					}
				}
				else
				{
					MessageBox.Show(
						@"Warning, PEVerify Utility (peverify.exe) not found. Update your PATH environment variable or install .NET SDK");
				}
			}
			else
			{
				MessageBox.Show(@"Assembly definition is not loaded (not a CLI image?)");
			}
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:46,代码来源:AssemblyHelper.cs

示例7: SaveAssembly

        /// <summary>
        /// Save an assembly
        /// </summary>
        /// <param name="adef">Assembly definition</param>
        /// <param name="originalLocation">Original location</param>
        public static void SaveAssembly(AssemblyDefinition adef, string originalLocation)
        {
            if (adef != null)
            {
                using (var dialog = new SaveFileDialog())
                {
                    dialog.Filter = @"Assembly files (*.exe, *.dll)|*.exe;*.dll";
                    dialog.InitialDirectory = Path.GetDirectoryName(originalLocation);
                    dialog.FileName = Path.GetFileNameWithoutExtension(originalLocation) + ".Patched" + Path.GetExtension(originalLocation);
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            adef.Write(dialog.FileName);

                            if (!adef.Name.HasPublicKey)
                                return;

                            // Reload the assembly to have a proper Image.Filename
                            var plugin = PluginFactory.GetInstance() as BasePlugin;
                            if (plugin != null)
                                adef = plugin.LoadAssembly(dialog.FileName, false);

                            using (var snform = new StrongNameForm())
                            {
                                snform.AssemblyDefinition = adef;
                                snform.DelaySignedFileName = dialog.FileName;
                                snform.ShowDialog();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(String.Format("Reflexil is unable to save this assembly: {0}", ex.Message));
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(@"Assembly definition is not loaded (not a CLI image?)");
            }
        }
开发者ID:T0T4R4,项目名称:Reflexil,代码行数:47,代码来源:AssemblyHelper.cs

示例8: Start

        internal static void Start()
        {
            asm = AssemblyDefinition.ReadAssembly("Terraria.exe");
            mod = asm.MainModule;
            HookKeys();
            HookMain();
            HookNetMessage();
            HookMessageBuffer();
            GameHooks.OnHook();
            MemoryStream ms = new MemoryStream();
            asm.Write(ms);
            #if DEBUG
            File.WriteAllBytes("debug.exe", ms.GetBuffer());
            #endif
            Assembly terraria = Assembly.Load(ms.GetBuffer());

            Item.instance = new Item() { type = terraria.GetType("Terraria.Item") };
            Lighting.instance = new Lighting() { type = terraria.GetType("Terraria.Lighting") };
            NPC.instance = new NPC() { type = terraria.GetType("Terraria.NPC") };
            NetMessage.instance = new NetMessage() { type = terraria.GetType("Terraria.NetMessage") };
            Netplay.instance = new Netplay() { type = terraria.GetType("Terraria.Netplay") };
            Player.instance = new Player() { type = terraria.GetType("Terraria.Player") };
            Projectile.instance = new Projectile() { type = terraria.GetType("Terraria.Projectile") };
            Tile.instance = new Tile() { type = terraria.GetType("Terraria.Tile") };
            WorldGen.instance = new WorldGen() { type = terraria.GetType("Terraria.WorldGen") };

            Main.instance = new Main(terraria.GetType("Terraria.Main").GetConstructor(new Type[] { }).Invoke(null));
            Locked = false;
            try
            {
                Main.Run();
            }
            finally
            {
                Main.Dispose();
            }
        }
开发者ID:edaniels,项目名称:TerrariAPI,代码行数:37,代码来源:Hooks.cs

示例9: SaveAssemblyInPlace

 /// <summary>
 /// Save an assembly in place
 /// </summary>
 /// <param name="adef">Assembly definition</param>
 /// <param name="assemblyLocation">Original location</param>
 public static void SaveAssemblyInPlace(AssemblyDefinition adef, string assemblyLocation)
 {
     if (adef != null)
     {
         string fileName = assemblyLocation;
         try
         {
             adef.Write(fileName, new WriterParameters());
             if (!adef.Name.HasPublicKey)
             {
                 // No StrongNameKey, we're done here.
                 return;
             }
             else
             {
                 // Show the user the StrongNameKey removal dialog
                 using (var snform = new StrongNameForm())
                 {
                     snform.AssemblyDefinition = adef;
                     snform.DelaySignedFileName = fileName;
                     snform.ShowDialog();
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(String.Format("Reflexil is unable to save this assembly: {0}", ex.Message));
             throw;
         }
     }
     else
     {
         MessageBox.Show(@"Assembly definition is not loaded (not a CLI image?)");
     }
 }
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:40,代码来源:AssemblyHelper.cs

示例10: ConvertAssemblyToByteArray

 public byte[] ConvertAssemblyToByteArray(AssemblyDefinition assembly) {
     using(var stream = new MemoryStream()) {
         assembly.Write(stream);
         return stream.ToArray();
     }
 }
开发者ID:MI3Guy,项目名称:argon,代码行数:6,代码来源:CLRCompilerTestHelper.cs

示例11: PrepareTests

 /// <summary>
 /// Moves the original assembly aside, and writes the mutated copy in
 /// its place before returning the test meta data  to allow the test
 /// suite to be run.
 /// </summary>
 /// <param name="assembly">
 /// An <see cref="AssemblyDefinition" /> for the containing assembly.
 /// </param>
 /// <param name="method"> </param>
 /// <param name="fileName">
 /// The path to the assembly file, so that the turtle can overwrite it
 /// with mutated versions.
 /// </param>
 /// <param name="output">
 /// The string describing the mutation, returned to calling code with
 /// <c>yield return</c>.
 /// </param>
 /// <returns>
 /// A <see cref="MutationTestMetaData" /> instance.
 /// </returns>
 protected MutationTestMetaData PrepareTests(AssemblyDefinition assembly, MethodDefinition method, string fileName, string output)
 {
     string sourceFolder = Path.GetDirectoryName(fileName);
     string targetFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));
     CopyDirectory(sourceFolder, targetFolder);
     string targetFileName = Path.Combine(targetFolder, Path.GetFileName(fileName));
     assembly.Write(targetFileName);
     var metaData = new MutationTestMetaData
                      {
                          TestFolder = targetFolder,
                          Description = output,
                          DiffRepresentation = ConstructEstimateCodeDiff(method)
                      };
     Monitor.Exit(method);
     return metaData;
 }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:36,代码来源:MethodTurtle.cs

示例12: PatchFile

        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";
            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return false;
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var writerParameters = new WriterParameters();
            var pdbName = Path.ChangeExtension(file, "pdb");
            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols = true;
                writerParameters.WriteSymbols = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory(Path.GetDirectoryName(file));

            foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
            {
                if (assemblyNameReference.Name.ToLower() == "mscorlib")
                {
                    mscorlibAssembly =  assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                    break;
                }                
            }

            // TODO: Temporary patch to handle correctly 4.5 Core profile
            if (mscorlibAssembly == null)
            {
                foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
                {
                    if (assemblyNameReference.Name == "System.Runtime")
                    {
                        ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory( Path.Combine(ProgramFilesx86(),@"Reference Assemblies\Microsoft\Framework\.NETCore\v4.5"));
                        mscorlibAssembly = assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                        break;
                    }
                }
            }

            if (mscorlibAssembly == null)
            {
                LogError("Missing mscorlib.dll from assembly {0}", file);
                throw new InvalidOperationException("Missing mscorlib.dll from assembly");
            }

            // Import void* and int32 from assembly using mscorlib specific version (2.0 or 4.0 depending on assembly)
            voidType = mscorlibAssembly.MainModule.GetType("System.Void");
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType = assembly.MainModule.Import( mscorlibAssembly.MainModule.GetType("System.Int32"));

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
                PatchType(type);

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
                assembly.MainModule.Types.Remove(type);

            var outputFilePath = file;
            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);
                                
            Log("SharpDX patch done for assembly [{0}]", file);
            return true;
        }
开发者ID:numo16,项目名称:SharpDX,代码行数:98,代码来源:InteropApp.cs

示例13: PatchFile

        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            file = Path.Combine(Environment.CurrentDirectory, file);

            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";
            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return false;
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var resolver = new DefaultAssemblyResolver();
            readerParameters.AssemblyResolver = resolver;
            var writerParameters = new WriterParameters();
            var pdbName = Path.ChangeExtension(file, "pdb");
            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols = true;
                writerParameters.WriteSymbols = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            resolver.AddSearchDirectory(Path.GetDirectoryName(file));

            // Query the target framework in order to resolve correct assemblies and type forwarding
            var targetFrameworkAttr = assembly.CustomAttributes.FirstOrDefault(
                attribute => attribute.Constructor.FullName.Contains("System.Runtime.Versioning.TargetFrameworkAttribute"));
            if(targetFrameworkAttr != null && targetFrameworkAttr.ConstructorArguments.Count > 0 &&
                targetFrameworkAttr.ConstructorArguments[0].Value != null)
            {
                var targetFramework = new FrameworkName(targetFrameworkAttr.ConstructorArguments[0].Value.ToString());

                var netcoreAssemblyPath = string.Format(@"Reference Assemblies\Microsoft\Framework\{0}\v{1}",
                    targetFramework.Identifier,
                    targetFramework.Version);
                netcoreAssemblyPath = Path.Combine(ProgramFilesx86(), netcoreAssemblyPath);
                if(Directory.Exists(netcoreAssemblyPath))
                {
                    resolver.AddSearchDirectory(netcoreAssemblyPath);
                }
            }

            // Import void* and int32 
            voidType = assembly.MainModule.TypeSystem.Void.Resolve();
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType = assembly.MainModule.Import( assembly.MainModule.TypeSystem.Int32.Resolve());

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
                PatchType(type);

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
                assembly.MainModule.Types.Remove(type);

            var outputFilePath = file;
            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);
                                
            Log("SharpDX patch done for assembly [{0}]", file);
            return true;
        }
开发者ID:RecursiveCall,项目名称:SharpDX,代码行数:91,代码来源:InteropApp.cs

示例14: Main

        static void Main()
        {
            Console.WriteLine("RowPatcher " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            Console.WriteLine("Need to patch client or server?\n1. Legacy client\n2. Legacy server");
            int mode = 0;
            string answer = Console.ReadLine();

            if (!int.TryParse(answer, out mode))
            {
                Console.Clear();
                Main();
            }

            try
            {
                rustAssembly = AssemblyDefinition.ReadAssembly("Assembly-CSharp.dll");

                if (mode == 1)
                {
                    rowacAssembly = AssemblyDefinition.ReadAssembly("RGuard.dll");
                    ClientBootstrapAttachPatch();
                    Console.WriteLine("Client patched");
                }
                else if (mode == 2)
                {
                    rowacAssembly = AssemblyDefinition.ReadAssembly("RowAC.dll");
                    hooksType = rowacAssembly.MainModule.GetType("RowAC", "Hooks");

                    BootstrapAttachPatch();
                    //PlayerSpawnHookPatch();
                    Console.WriteLine("Server patched");
                }
                rustAssembly.Write("Assembly-CSharp.dll");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            Console.WriteLine("END");
            Console.ReadLine();
        }
开发者ID:Riketta,项目名称:rust-anticheat,代码行数:41,代码来源:Program.cs

示例15: Run

        public bool Run(ref AssemblyDefinition assemblyDefinition, ref bool readWriteSymbols, out bool modified)
        {
            modified = false;

            try
            {
                var assemblyResolver = (CustomAssemblyResolver)assemblyDefinition.MainModule.AssemblyResolver;

                var processors = new List<IAssemblyDefinitionProcessor>();

                // We are no longer using it so we are deactivating it for now to avoid processing
                //if (AutoNotifyProperty)
                //{
                //    processors.Add(new NotifyPropertyProcessor());
                //}

                if (ParameterKey)
                {
                    processors.Add(new ParameterKeyProcessor());
                }

                if (NewAssemblyName != null)
                {
                    processors.Add(new RenameAssemblyProcessor(NewAssemblyName));
                }

                //processors.Add(new AsyncBridgeProcessor());

                // Always applies the interop processor
                processors.Add(new InteropProcessor());

                processors.Add(new AssemblyVersionProcessor());

                if (SerializationAssembly)
                {
                    processors.Add(new SerializationProcessor(SignKeyFile, SerializationProjectReferences));
                }

                if (GenerateUserDocumentation)
                {
                    processors.Add(new GenerateUserDocumentationProcessor(assemblyDefinition.MainModule.FullyQualifiedName));
                }

                if (ModuleInitializer)
                {
                    processors.Add(new ModuleInitializerProcessor());
                }

                processors.Add(new OpenSourceSignProcessor());

                // Check if pdb was actually read
                readWriteSymbols = assemblyDefinition.MainModule.HasDebugHeader;

                // Check if there is already a AssemblyProcessedAttribute (in which case we can skip processing, it has already been done).
                // Note that we should probably also match the command line as well so that we throw an error if processing is different (need to rebuild).
                if (assemblyDefinition.CustomAttributes.Any(x => x.AttributeType.FullName == "SiliconStudio.Core.AssemblyProcessedAttribute"))
                {
                    OnInfoAction("Assembly has already been processed, skip it.");
                    return true;
                }

                var targetFrameworkAttribute = assemblyDefinition.CustomAttributes
                    .FirstOrDefault(x => x.AttributeType.FullName == typeof(TargetFrameworkAttribute).FullName);
                var targetFramework = targetFrameworkAttribute != null ? (string)targetFrameworkAttribute.ConstructorArguments[0].Value : null;

                // Special handling for MonoAndroid
                // Default frameworkFolder
                var frameworkFolder = Path.Combine(CecilExtensions.ProgramFilesx86(), @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\");

                switch (Platform)
                {
                    case PlatformType.Android:
                    {
                        if (string.IsNullOrEmpty(TargetFramework))
                        {
                            throw new InvalidOperationException("Expecting option target framework for Android");
                        }

                        var monoAndroidPath = Path.Combine(CecilExtensions.ProgramFilesx86(), @"Reference Assemblies\Microsoft\Framework\MonoAndroid");
                        frameworkFolder = Path.Combine(monoAndroidPath, "v1.0");
                        var additionalFrameworkFolder = Path.Combine(monoAndroidPath, TargetFramework);
                        assemblyResolver.AddSearchDirectory(additionalFrameworkFolder);
                        assemblyResolver.AddSearchDirectory(frameworkFolder);
                        break;
                    }

                    case PlatformType.iOS:
                    {
                        if (string.IsNullOrEmpty(TargetFramework))
                        {
                            throw new InvalidOperationException("Expecting option target framework for iOS");
                        }

                        var monoTouchPath = Path.Combine(CecilExtensions.ProgramFilesx86(), @"Reference Assemblies\Microsoft\Framework\Xamarin.iOS");
                        frameworkFolder = Path.Combine(monoTouchPath, "v1.0");
                        var additionalFrameworkFolder = Path.Combine(monoTouchPath, TargetFramework);
                        assemblyResolver.AddSearchDirectory(additionalFrameworkFolder);
                        assemblyResolver.AddSearchDirectory(frameworkFolder);

                        break;
//.........这里部分代码省略.........
开发者ID:ItayGal2,项目名称:paradox,代码行数:101,代码来源:AssemblyProcessorApp.cs


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