Example #1
0
        AssemblySettingsCommand(AssemblyTreeNode asmNode, AssemblyOptions newOptions)
        {
            this.asmNode = asmNode;
            this.newOptions = newOptions;
            this.origOptions = new AssemblyOptions(asmNode.LoadedAssembly.AssemblyDefinition);

            if (newOptions.Name != origOptions.Name)
                this.assemblyRefInfos = RefFinder.FindAssemblyRefsToThisModule(asmNode.LoadedAssembly.ModuleDefinition).Where(a => AssemblyNameComparer.NameAndPublicKeyTokenOnly.Equals(a, asmNode.LoadedAssembly.AssemblyDefinition)).Select(a => new AssemblyRefInfo(a)).ToArray();
        }
Example #2
0
 AssemblyOptions CopyTo(AssemblyOptions options)
 {
     options.HashAlgorithm = (AssemblyHashAlgorithm)HashAlgorithm.SelectedItem;
     options.Version       = new Version(VersionMajor.Value, VersionMinor.Value, VersionBuild.Value, VersionRevision.Value);
     options.Attributes    = Flags;
     options.PublicKey     = new PublicKey(PublicKey.Value.ToArray());
     options.Name          = Name;
     options.Culture       = Culture;
     options.ClrVersion    = (Module.ClrVersion)ClrVersion.SelectedItem;
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     options.DeclSecurities.Clear();
     options.DeclSecurities.AddRange(DeclSecuritiesVM.Collection.Select(a => a.CreateDeclSecurityOptions().Create(ownerModule)));
     return(options);
 }
Example #3
0
 void InitializeFrom(AssemblyOptions options)
 {
     PublicKey.Value            = options.PublicKey.Data;
     HashAlgorithm.SelectedItem = options.HashAlgorithm;
     VersionMajor.Value         = checked ((ushort)options.Version.Major);
     VersionMinor.Value         = checked ((ushort)options.Version.Minor);
     VersionBuild.Value         = checked ((ushort)options.Version.Build);
     VersionRevision.Value      = checked ((ushort)options.Version.Revision);
     Flags = options.Attributes;
     ProcessArchitecture.SelectedItem = (AsmProcArch)((uint)(options.Attributes & AssemblyAttributes.PA_Mask) >> (int)AssemblyAttributes.PA_Shift);
     ContentType.SelectedItem         = (AsmContType)((uint)(options.Attributes & AssemblyAttributes.ContentType_Mask) >> 9);
     Name    = options.Name;
     Culture = options.Culture;
     ClrVersion.SelectedItem = options.ClrVersion;
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
     DeclSecuritiesVM.InitializeFrom(options.DeclSecurities);
 }
Example #4
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
            {
                return;
            }

            var newModule = new ModuleDefUser();

            var data = new AssemblyOptionsVM(AssemblyOptions.Create("MyAssembly"), newModule, MainWindow.Instance.CurrentLanguage);

            data.CanShowClrVersion = true;
            var win = new AssemblyOptionsDlg();

            win.Title       = "Create Assembly";
            win.DataContext = data;
            win.Owner       = MainWindow.Instance;
            if (win.ShowDialog() != true)
            {
                return;
            }

            UndoCommandManager.Instance.Add(new CreateAssemblyCommand(newModule, data.CreateAssemblyOptions()));
        }
Example #5
0
 AssemblySettingsCommand(AssemblyTreeNode asmNode, AssemblyOptions newOptions)
 {
     this.asmNode     = asmNode;
     this.newOptions  = newOptions;
     this.origOptions = new AssemblyOptions(asmNode.LoadedAssembly.AssemblyDefinition);
 }
Example #6
0
 public AssemblyOptionsVM(AssemblyOptions options, ModuleDef ownerModule, Language language)
 {
     this.ownerModule = ownerModule;
     this.origOptions = options;
     this.hashAlgorithmVM = new EnumListVM(hashAlgorithmList, (a, b) => OnPropertyChanged("AssemblyFullName"));
     this.contentTypeVM = new EnumListVM(contentTypeList, (a, b) => OnPropertyChanged("AssemblyFullName"));
     this.versionMajor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true };
     this.versionMinor = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true };
     this.versionBuild = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true };
     this.versionRevision = new UInt16VM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); }) { UseDecimal = true };
     this.publicKey = new HexStringVM(a => { HasErrorUpdated(); OnPropertyChanged("AssemblyFullName"); UpdatePublicKeyFlag(); }) { UpperCaseHex = false };
     this.customAttributesVM = new CustomAttributesVM(ownerModule, language);
     this.declSecuritiesVM = new DeclSecuritiesVM(ownerModule, language, null, null);
     Reinitialize();
 }
Example #7
0
 void InitializeFrom(AssemblyOptions options)
 {
     PublicKey.Value = options.PublicKey.Data;
     HashAlgorithm.SelectedItem = options.HashAlgorithm;
     VersionMajor.Value = checked((ushort)options.Version.Major);
     VersionMinor.Value = checked((ushort)options.Version.Minor);
     VersionBuild.Value = checked((ushort)options.Version.Build);
     VersionRevision.Value = checked((ushort)options.Version.Revision);
     Flags = options.Attributes;
     ProcessArchitecture.SelectedItem = (AsmProcArch)((uint)(options.Attributes & AssemblyAttributes.PA_Mask) >> (int)AssemblyAttributes.PA_Shift);
     ContentType.SelectedItem = (AsmContType)((uint)(options.Attributes & AssemblyAttributes.ContentType_Mask) >> 9);
     Name = options.Name;
     Culture = options.Culture;
     ClrVersion.SelectedItem = options.ClrVersion;
     CustomAttributesVM.InitializeFrom(options.CustomAttributes);
     DeclSecuritiesVM.InitializeFrom(options.DeclSecurities);
 }
Example #8
0
 AssemblyOptions CopyTo(AssemblyOptions options)
 {
     options.HashAlgorithm = (AssemblyHashAlgorithm)HashAlgorithm.SelectedItem;
     options.Version = new Version(VersionMajor.Value, VersionMinor.Value, VersionBuild.Value, VersionRevision.Value);
     options.Attributes = Flags;
     options.PublicKey = new PublicKey(PublicKey.Value.ToArray());
     options.Name = Name;
     options.Culture = Culture;
     options.ClrVersion = (Module.ClrVersion)ClrVersion.SelectedItem;
     options.CustomAttributes.Clear();
     options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create()));
     options.DeclSecurities.Clear();
     options.DeclSecurities.AddRange(DeclSecuritiesVM.Collection.Select(a => a.CreateDeclSecurityOptions().Create(ownerModule)));
     return options;
 }
Example #9
0
		CreateAssemblyCommand(ModuleDef newModule, AssemblyOptions options)
		{
			var module = Module.ModuleUtils.CreateModule(options.Name, Guid.NewGuid(), options.ClrVersion, ModuleKind.Dll, newModule);
			options.CreateAssemblyDef(module).Modules.Add(module);
			this.asmNodeCreator = new AssemblyTreeNodeCreator(new LoadedAssembly(MainWindow.Instance.CurrentAssemblyList, module));
		}
Example #10
0
		AssemblySettingsCommand(AssemblyTreeNode asmNode, AssemblyOptions newOptions)
		{
			this.asmNode = asmNode;
			this.newOptions = newOptions;
			this.origOptions = new AssemblyOptions(asmNode.LoadedAssembly.AssemblyDefinition);
		}