• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LoadedAssembly类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LoadedAssembly的典型用法代码示例。如果您正苦于以下问题:C# LoadedAssembly类的具体用法?C# LoadedAssembly怎么用?C# LoadedAssembly使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LoadedAssembly类属于命名空间,在下文中一共展示了LoadedAssembly类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetFilterResult

        public override TreeViewNodeFilterResult GetFilterResult(LoadedAssembly asm, AssemblyFilterType type)
        {
            if (type == AssemblyFilterType.NonNetFile)
                return new TreeViewNodeFilterResult(FilterResult.Hidden, false);

            if (type == AssemblyFilterType.Assembly) {
                if (assembly == null || asm.AssemblyDefinition != assembly)
                    return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
                return new TreeViewNodeFilterResult(null, false);
            }

            if (type == AssemblyFilterType.NetModule) {
                if (asm.AssemblyDefinition != assembly)
                    return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
                if (assembly == null || assembly.ManifestModule != module) {
                    if (asm.ModuleDefinition != module)
                        return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
                    return new TreeViewNodeFilterResult(null, false);
                }
                else
                    return new TreeViewNodeFilterResult(null, asm.ModuleDefinition != assembly.ManifestModule);
            }

            Debug.Fail("Invalid AssemblyFilterType value");
            return new TreeViewNodeFilterResult(FilterResult.Hidden, false);
        }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:26,代码来源:EntryPointTreeViewNodeFilter.cs


示例2: FindReferences

		IEnumerable<SharpTreeNode> FindReferences(LoadedAssembly asm, CancellationToken ct)
		{
			string asmName = asm.AssemblyDefinition.Name.Name;
			string name = analyzedMethod.Name;
			string declTypeName = analyzedMethod.DeclaringType.FullName;
			foreach (TypeDefinition type in TreeTraversal.PreOrder(asm.AssemblyDefinition.MainModule.Types, t => t.NestedTypes))
			{
				ct.ThrowIfCancellationRequested();
				SharpTreeNode newNode = null;
				try {
					if (!TypesHierarchyHelpers.IsBaseType(analyzedMethod.DeclaringType, type, resolveTypeArguments: false))
						continue;

					foreach (MethodDefinition method in type.Methods) {
						ct.ThrowIfCancellationRequested();

						if (TypesHierarchyHelpers.IsBaseMethod(analyzedMethod, method)) {
							bool hidesParent = !method.IsVirtual ^ method.IsNewSlot;
							newNode = new AnalyzedMethodTreeNode(method, hidesParent ? "(hides) " : "");
						}
					}
				}
				catch (ReferenceResolvingException) {
					// ignore this type definition. maybe add a notification about such cases.
				}
				if (newNode != null)
					yield return newNode;
			}
		}
开发者ID:tris2481,项目名称:ILSpy,代码行数:29,代码来源:AnalyzerMethodOverridesTreeNode.cs


示例3: FindReferences

		IEnumerable<SharpTreeNode> FindReferences(LoadedAssembly asm, CancellationToken ct)
		{
			string asmName = asm.AssemblyDefinition.Name.Name;
			string name = analyzedProperty.Name;
			string declTypeName = analyzedProperty.DeclaringType.FullName;
			foreach (TypeDefinition type in TreeTraversal.PreOrder(asm.AssemblyDefinition.MainModule.Types, t => t.NestedTypes)) {
				ct.ThrowIfCancellationRequested();

				SharpTreeNode newNode = null;
				try {
					if (!TypesHierarchyHelpers.IsBaseType(analyzedProperty.DeclaringType, type, resolveTypeArguments: false))
						continue;

					foreach (PropertyDefinition property in type.Properties) {
						ct.ThrowIfCancellationRequested();

						if (TypesHierarchyHelpers.IsBaseProperty(analyzedProperty, property)) {
							MethodDefinition anyAccessor = property.GetMethod ?? property.SetMethod;
							bool hidesParent = !anyAccessor.IsVirtual ^ anyAccessor.IsNewSlot;
							newNode = new AnalyzedPropertyTreeNode(property, hidesParent ? "(hides) " : "");
						}
					}
				}
				catch (ReferenceResolvingException) {
					// ignore this type definition.
				}
				if (newNode != null)
					yield return newNode;
			}
		}
开发者ID:ThomasZitzler,项目名称:ILSpy,代码行数:30,代码来源:AnalyzedPropertyOverridesTreeNode.cs


示例4: FindReferences

		IEnumerable<SharpTreeNode> FindReferences(LoadedAssembly asm, CancellationToken ct)
		{
			string name = analyzedField.Name;
			string declTypeName = analyzedField.DeclaringType.FullName;
			foreach (TypeDefinition type in TreeTraversal.PreOrder(asm.AssemblyDefinition.MainModule.Types, t => t.NestedTypes)) {
				ct.ThrowIfCancellationRequested();
				foreach (MethodDefinition method in type.Methods) {
					ct.ThrowIfCancellationRequested();
					bool found = false;
					if (!method.HasBody)
						continue;
					foreach (Instruction instr in method.Body.Instructions) {
						if (CanBeReference(instr.OpCode.Code)) {
							FieldReference fr = instr.Operand as FieldReference;
							if (fr != null && fr.Name == name && fr.DeclaringType.FullName == declTypeName && fr.Resolve() == analyzedField) {
								found = true;
								break;
							}
						}
					}
					if (found)
						yield return new AnalyzedMethodTreeNode(method);
				}
			}
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:25,代码来源:AnalyzedFieldAccessNode.cs


示例5: HandleModelUpdated

		public override bool HandleModelUpdated(LoadedAssembly asm)
		{
			this.LazyLoading = true;
			threading.Cancel();
			this.Children.Clear();
			return true;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:AnalyzerSearchTreeNode.cs


示例6: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
				HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				var files = WriteCodeFilesInProject(assembly.AssemblyDefinition, options, directories).ToList();
				files.AddRange(WriteResourceFilesInProject(assembly, options, directories));
				WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.AssemblyDefinition.MainModule;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				switch (mainModule.Architecture) {
					case TargetArchitecture.I386:
						if ((mainModule.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
							WriteCommentLine(output, "Architecture: x86");
						else
							WriteCommentLine(output, "Architecture: AnyCPU");
						break;
					case TargetArchitecture.AMD64:
						WriteCommentLine(output, "Architecture: x64");
						break;
					case TargetArchitecture.IA64:
						WriteCommentLine(output, "Architecture: Itanium-64");
						break;
				}
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
						WriteCommentLine(output, "Runtime: .NET 4.0");
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);
					codeDomBuilder.AddAssembly(assembly.AssemblyDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options);
				}
			}
			OnDecompilationFinished(null);
		}
开发者ID:itsff,项目名称:ILSpy,代码行数:58,代码来源:VBLanguage.cs


示例7: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {

                //Checks if must create a solution
                if (options.CreateSolution)
                {
                    //Solution directory
                    var solutionDir = options.SaveAsProjectDirectory;

                    //List of the project names and their guid
                    List<Tuple<string, string>> projects = new List<Tuple<string, string>>();

                    //For each module
                    foreach (var module in assembly.AssemblyDefinition.Modules)
                    {
                        //Creates the project and the various files
                        var projectDir = Path.Combine(solutionDir, TextView.DecompilerTextView.CleanUpName(Path.GetFileNameWithoutExtension(module.Name)));
                        Directory.CreateDirectory(projectDir);
                        options.SaveAsProjectDirectory = projectDir;
                        HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
                        var files = WriteCodeFilesInProject(module, options, directories).ToList();
                        files.AddRange(WriteResourceFilesInProject(module, options, directories));
                        using (var writer = new StreamWriter(Path.Combine(projectDir, Path.GetFileName(projectDir) + this.ProjectFileExtension), false, System.Text.Encoding.UTF8))
                            projects.Add(Tuple.Create(
                                Path.GetFileName(projectDir),
                                "{" + WriteProjectFile(writer, files, module, options).ToString().ToUpperInvariant() + "}"
                            ));
                    }

                    //Writes the solution
                    WriteSolutionFile(new TextOutputWriter(output), Enumerable.Reverse(projects));
                }
                else
                {
                    HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
                    var files = assembly.AssemblyDefinition.Modules.SelectMany(m => WriteCodeFilesInProject(m, options, directories)).ToList();
                    files.AddRange(assembly.AssemblyDefinition.Modules.SelectMany(m => WriteResourceFilesInProject(m, options, directories)));
                    WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule, options);
                }

			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
                WriteCommentLine(output, "Main module:");
                WriteModuleAttributes(assembly.AssemblyDefinition.MainModule, output, options);
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);
					codeDomBuilder.AddAssembly(assembly.AssemblyDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.AssemblyDefinition.MainModule);
				}
			}
			OnDecompilationFinished(null);
		}
开发者ID:95ulisse,项目名称:ILEdit,代码行数:57,代码来源:VBLanguage.cs


示例8: AssemblyTreeNode

		public AssemblyTreeNode(LoadedAssembly assembly)
		{
			if (assembly == null)
				throw new ArgumentNullException("assembly");

			this.assembly = assembly;

			assembly.ContinueWhenLoaded(OnAssemblyLoaded, TaskScheduler.FromCurrentSynchronizationContext());

			this.LazyLoading = true;
		}
开发者ID:keremkusmezer,项目名称:ILSpy,代码行数:11,代码来源:AssemblyTreeNode.cs


示例9: HandleModelUpdated

		public override bool HandleModelUpdated(LoadedAssembly asm)
		{
			if (this.Member.Module == null)
				return false; // remove this node
			if ((this.Member is IField || this.Member is IMethod || this.Member is PropertyDef || this.Member is EventDef) &&
				this.Member.DeclaringType == null)
				return false;
			this.Children.RemoveAll(
				delegate(SharpTreeNode n) {
					AnalyzerTreeNode an = n as AnalyzerTreeNode;
					return an == null || !an.HandleModelUpdated(asm);
				});
			return true;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:14,代码来源:AnalyzerEntityTreeNode.cs


示例10: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
                var decompiler = new VBProjectDecompiler();
                decompiler.Decompile(this, assembly, output, options);
			} else {
				base.DecompileAssembly(assembly, output, options);
				output.WriteLine();
				ModuleDefinition mainModule = assembly.ModuleDefinition;
				if (mainModule.EntryPoint != null) {
					output.Write("' Entry point: ");
					output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
					output.WriteLine();
				}
				WriteCommentLine(output, "Architecture: " + CSharpLanguage.GetPlatformDisplayName(mainModule));
				if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
					WriteCommentLine(output, "This assembly contains unmanaged code.");
				}
				switch (mainModule.Runtime) {
					case TargetRuntime.Net_1_0:
						WriteCommentLine(output, "Runtime: .NET 1.0");
						break;
					case TargetRuntime.Net_1_1:
						WriteCommentLine(output, "Runtime: .NET 1.1");
						break;
					case TargetRuntime.Net_2_0:
						WriteCommentLine(output, "Runtime: .NET 2.0");
						break;
					case TargetRuntime.Net_4_0:
                        if (assembly.IsNet45())
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.5");
                        }
                        else
                        {
                            WriteCommentLine(output, "Runtime: .NET 4.0");
                        }
						break;
				}
				output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.ModuleDefinition);
					codeDomBuilder.AddAssembly(assembly.ModuleDefinition, onlyAssemblyLevel: !options.FullDecompilation);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.ModuleDefinition);
				}
			}
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:49,代码来源:VBLanguage.cs


示例11: GetFilterResult

        public override TreeViewNodeFilterResult GetFilterResult(LoadedAssembly asm, AssemblyFilterType type)
        {
            VisibleMembersFlags thisFlag, visibleFlags;
            switch (type) {
            case AssemblyFilterType.Assembly:
                thisFlag = VisibleMembersFlags.AssemblyDef;
                visibleFlags = thisFlag | VisibleMembersFlags.ModuleDef |
                        VisibleMembersFlags.Namespace | VisibleMembersFlags.AnyTypeDef |
                        VisibleMembersFlags.FieldDef | VisibleMembersFlags.MethodDef |
                        VisibleMembersFlags.InstanceConstructor | VisibleMembersFlags.PropertyDef |
                        VisibleMembersFlags.EventDef | VisibleMembersFlags.AssemblyRef |
                        VisibleMembersFlags.BaseTypes | VisibleMembersFlags.DerivedTypes |
                        VisibleMembersFlags.ModuleRef | VisibleMembersFlags.ResourceList |
                        VisibleMembersFlags.MethodBody | VisibleMembersFlags.ParamDefs |
                        VisibleMembersFlags.ParamDef | VisibleMembersFlags.Locals |
                        VisibleMembersFlags.Local | VisibleMembersFlags.Resource |
                        VisibleMembersFlags.ResourceElement;
                break;

            case AssemblyFilterType.NetModule:
                thisFlag = VisibleMembersFlags.ModuleDef;
                visibleFlags = thisFlag |
                        VisibleMembersFlags.Namespace | VisibleMembersFlags.AnyTypeDef |
                        VisibleMembersFlags.FieldDef | VisibleMembersFlags.MethodDef |
                        VisibleMembersFlags.InstanceConstructor | VisibleMembersFlags.PropertyDef |
                        VisibleMembersFlags.EventDef | VisibleMembersFlags.AssemblyRef |
                        VisibleMembersFlags.BaseTypes | VisibleMembersFlags.DerivedTypes |
                        VisibleMembersFlags.ModuleRef | VisibleMembersFlags.ResourceList |
                        VisibleMembersFlags.MethodBody | VisibleMembersFlags.ParamDefs |
                        VisibleMembersFlags.ParamDef | VisibleMembersFlags.Locals |
                        VisibleMembersFlags.Local | VisibleMembersFlags.Resource |
                        VisibleMembersFlags.ResourceElement;
                break;

            case AssemblyFilterType.NonNetFile:
            default:
                thisFlag = VisibleMembersFlags.NonNetFile;
                visibleFlags = thisFlag;
                break;
            }
            bool isMatch = (flags & thisFlag) != 0;
            if ((flags & visibleFlags) == 0)
                return new TreeViewNodeFilterResult(FilterResult.Hidden, isMatch);

            if (isMatch)
                return new TreeViewNodeFilterResult(FilterResult.Match, isMatch);	// Make sure it's not hidden

            return new TreeViewNodeFilterResult(null, isMatch);
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:49,代码来源:FlagsTreeViewNodeFilter.cs


示例12: DecompileAssembly

		public override void DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options, DecompileAssemblyFlags flags = DecompileAssemblyFlags.AssemblyAndModule)
		{
			if (options.FullDecompilation && options.SaveAsProjectDirectory != null) {
				HashSet<string> directories = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
				var files = WriteCodeFilesInProject(assembly.ModuleDefinition, options, directories).ToList();
				files.AddRange(WriteResourceFilesInProject(assembly, options, directories));
				WriteProjectFile(new TextOutputWriter(output), files, assembly, options);
			} else {
				bool decompileAsm = (flags & DecompileAssemblyFlags.Assembly) != 0;
				bool decompileMod = (flags & DecompileAssemblyFlags.Module) != 0;
				base.DecompileAssembly(assembly, output, options, flags);
				output.WriteLine();
				ModuleDef mainModule = assembly.ModuleDefinition;
				if (decompileMod && mainModule.Types.Count > 0) {
					output.Write("' Global type: ", TextTokenType.Comment);
					output.WriteReference(IdentifierEscaper.Escape(mainModule.GlobalType.FullName), mainModule.GlobalType, TextTokenType.Comment);
					output.WriteLine();
				}
				if (decompileMod || decompileAsm)
					PrintEntryPoint(assembly, output);
				if (decompileMod) {
					WriteCommentLine(output, "Architecture: " + CSharpLanguage.GetPlatformDisplayName(mainModule));
					if (!mainModule.IsILOnly) {
						WriteCommentLine(output, "This assembly contains unmanaged code.");
					}
					string runtimeName = ICSharpCode.ILSpy.CSharpLanguage.GetRuntimeDisplayName(mainModule);
					if (runtimeName != null) {
						WriteCommentLine(output, "Runtime: " + runtimeName);
					}
				}
				if (decompileMod || decompileAsm)
					output.WriteLine();
				
				// don't automatically load additional assemblies when an assembly node is selected in the tree view
				using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
					AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.ModuleDefinition);
					codeDomBuilder.AddAssembly(assembly.ModuleDefinition, !options.FullDecompilation, decompileAsm, decompileMod);
					RunTransformsAndGenerateCode(codeDomBuilder, output, options, assembly.ModuleDefinition);
				}
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:41,代码来源:VBLanguage.cs


示例13: FindReferences

		IEnumerable<SharpTreeNode> FindReferences(LoadedAssembly asm, CancellationToken ct)
		{
			string asmName = asm.AssemblyDefinition.Name.Name;
			string name = analyzedEvent.Name;
			string declTypeName = analyzedEvent.DeclaringType.FullName;
			foreach (TypeDefinition type in TreeTraversal.PreOrder(asm.AssemblyDefinition.MainModule.Types, t => t.NestedTypes)) {
				ct.ThrowIfCancellationRequested();

				if (!TypesHierarchyHelpers.IsBaseType(analyzedEvent.DeclaringType, type, resolveTypeArguments: false))
					continue;

				foreach (EventDefinition eventDef in type.Events) {
					ct.ThrowIfCancellationRequested();

					if (TypesHierarchyHelpers.IsBaseEvent(analyzedEvent, eventDef)) {
						MethodDefinition anyAccessor = eventDef.AddMethod ?? eventDef.RemoveMethod;
						bool hidesParent = !anyAccessor.IsVirtual ^ anyAccessor.IsNewSlot;
						yield return new AnalyzedEventTreeNode(eventDef, hidesParent ? "(hides) " : "");
					}
				}
			}
		}
开发者ID:tris2481,项目名称:ILSpy,代码行数:22,代码来源:AnalyzedEventOverridesTreeNode.cs


示例14: FindReferences

		IEnumerable<SharpTreeNode> FindReferences(LoadedAssembly asm, CancellationToken ct)
		{
			string asmName = asm.AssemblyDefinition.Name.Name;
			string name = analyzedMethod.Name;
			string declTypeName = analyzedMethod.DeclaringType.FullName;
			foreach (TypeDefinition type in TreeTraversal.PreOrder(asm.AssemblyDefinition.MainModule.Types, t => t.NestedTypes))
			{
				ct.ThrowIfCancellationRequested();

				if (!IsDerived(type, analyzedMethod.DeclaringType))
					continue;

				foreach (MethodDefinition method in type.Methods)
				{
					ct.ThrowIfCancellationRequested();

					if (HasCompatibleSpecification(method) && !method.IsNewSlot && DoesOverrideCorrectMethod(method))
					{
						yield return new AnalyzedMethodTreeNode(method);
					}
				}
			}
		}
开发者ID:tanujmathur,项目名称:ILSpy,代码行数:23,代码来源:AnalyzerMethodOverridesTreeNode.cs


示例15: AssemblyTreeNodeCreator

 public AssemblyTreeNodeCreator(LoadedAssembly asm)
     : this(asm, null, false)
 {
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:4,代码来源:AssemblyTreeNodeCreator.cs


示例16: MarkAsSaved

 static bool MarkAsSaved(SaveMultiModuleVM vm, LoadedAssembly[] asms)
 {
     bool setNewFileName = false;
     bool allSaved = true;
     foreach (var asm in asms) {
         if (!vm.WasSaved(asm.ModuleDefinition))
             allSaved = false;
         else {
             UndoCommandManager.Instance.MarkAsSaved(asm);
             if (string.IsNullOrEmpty(asm.FileName)) {
                 var filename = vm.GetSavedFileName(asm.ModuleDefinition);
                 if (!string.IsNullOrWhiteSpace(filename)) {
                     asm.ModuleDefinition.Location = filename;
                     asm.FileName = filename;
                     setNewFileName = true;
                     var asmNode = MainWindow.Instance.FindTreeNode(asm.ModuleDefinition) as AssemblyTreeNode;
                     Debug.Assert(asmNode != null);
                     if (asmNode != null) {
                         asmNode.OnFileNameChanged();
                         Utils.NotifyModifiedAssembly(asm);
                     }
                 }
             }
         }
     }
     if (setNewFileName)
         MainWindow.Instance.CurrentAssemblyList.RefreshSave();
     return allSaved;
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:29,代码来源:Saver.cs


示例17: GetFilterResult

 public override TreeViewNodeFilterResult GetFilterResult(string ns, LoadedAssembly owner)
 {
     var visibleFlags = VisibleMembersFlags.Namespace | VisibleMembersFlags.AnyTypeDef |
             VisibleMembersFlags.FieldDef | VisibleMembersFlags.MethodDef |
             VisibleMembersFlags.InstanceConstructor | VisibleMembersFlags.PropertyDef |
             VisibleMembersFlags.EventDef | VisibleMembersFlags.BaseTypes |
             VisibleMembersFlags.DerivedTypes | VisibleMembersFlags.MethodBody |
             VisibleMembersFlags.ParamDefs | VisibleMembersFlags.ParamDef |
             VisibleMembersFlags.Locals | VisibleMembersFlags.Local;
     bool isMatch = (flags & VisibleMembersFlags.Namespace) != 0;
     if ((flags & visibleFlags) == 0)
         return new TreeViewNodeFilterResult(FilterResult.Hidden, isMatch);
     if (isMatch)
         return new TreeViewNodeFilterResult(FilterResult.Match, isMatch);	// Make sure it's not hidden
     return new TreeViewNodeFilterResult(FilterResult.Recurse, isMatch);
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:16,代码来源:FlagsTreeViewNodeFilter.cs


示例18: GetNewSavedCommand

		int GetNewSavedCommand(LoadedAssembly asm)
		{
			for (int i = undoCommands.Count - 1; i >= 0; i--) {
				var group = undoCommands[i];
				if (group.ModifiedAssemblies.Contains(asm))
					return group.CommandCounter;
			}
			if (undoCommands.Count > 0)
				return undoCommands[0].PrevCommandCounter;
			return currentCommandCounter;
		}
开发者ID:lisong521,项目名称:dnSpy,代码行数:11,代码来源:UndoCommandManager.cs


示例19: SaveToCacheAsync

        Task SaveToCacheAsync(string cacheFileName, DateTime lastWriteTime, LoadedAssembly asm)
        {
            if (cacheFileName == null)
                return Task.FromResult<object>(null);

            // Call SaveToCache on a background task:
            var shutdownService = SD.ShutdownService;
            var task = IOTaskScheduler.Factory.StartNew(delegate { SaveToCache(cacheFileName, lastWriteTime, asm); }, shutdownService.ShutdownToken);
            shutdownService.AddBackgroundTask(task);
            return task;
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:11,代码来源:AssemblyParserService.cs


示例20: SaveToCache

 void SaveToCache(string cacheFileName, DateTime lastWriteTime, LoadedAssembly asm)
 {
     if (cacheFileName == null)
         return;
     LoggingService.Debug("Serializing to " + cacheFileName);
     try {
         Directory.CreateDirectory(DomPersistencePath);
         using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
             using (BinaryWriter writer = new BinaryWriterWith7BitEncodedInts(fs)) {
                 writer.Write(lastWriteTime.Ticks);
                 FastSerializer s = new FastSerializer();
                 s.Serialize(writer, asm);
             }
         }
     } catch (IOException ex) {
         LoggingService.Warn(ex);
         // Can happen if two SD instances are trying to access the file at the same time.
         // We'll just let one of them win, and instance that got the exception won't write to the cache at all.
         // Similarly, we also ignore the other kinds of IO exceptions.
     } catch (UnauthorizedAccessException ex) {
         LoggingService.Warn(ex);
     }
 }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:23,代码来源:AssemblyParserService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Loader类代码示例发布时间:2022-05-24
下一篇:
C# LoadType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap