void InitializeFrom(DeclSecurityOptions options) { SecurityActionEnumList.SelectedItem = (SecAc)options.Action; CustomAttributesVM.InitializeFrom(options.CustomAttributes); SecurityAttributesVM.Collection.Clear(); SecurityAttributesVM.Collection.AddRange(options.SecurityAttributes.Select(a => new SecurityAttributeVM(a, ownerModule, language, ownerType, ownerMethod))); V1XMLString = options.V1XMLString; DeclSecVerEnumList.SelectedItem = options.V1XMLString == null ? DeclSecVer.V2 : DeclSecVer.V1; }
DeclSecurityOptions CopyTo(DeclSecurityOptions options) { options.Action = (SecurityAction)(SecAc)SecurityActionEnumList.SelectedItem; options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); options.SecurityAttributes.Clear(); options.SecurityAttributes.AddRange(SecurityAttributesVM.Collection.Select(a => a.CreateSecurityAttribute())); options.V1XMLString = IsV1 ? V1XMLString : null; return(options); }
public DeclSecurityVM(DeclSecurityOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.ownerModule = ownerModule; this.language = language; this.ownerType = ownerType; this.ownerMethod = ownerMethod; this.origOptions = options; this.customAttributesVM = new CustomAttributesVM(ownerModule, language); CustomAttributesVM.PropertyChanged += CustomAttributesVM_PropertyChanged; this.declSecVerEnumListVM = new EnumListVM(declSecVerList, (a, b) => OnDeclSecVerChanged()); this.securityActionEnumListVM = new EnumListVM(secActList, (a, b) => OnSecurityActionChanged()); this.securityAttributesVM = new SecurityAttributesVM(ownerModule, language, ownerType, ownerMethod); this.SecurityAttributesVM.Collection.CollectionChanged += SecurityAttributesVM_CollectionChanged; Reinitialize(); }
DeclSecurityOptions CopyTo(DeclSecurityOptions options) { options.Action = (SecurityAction)(SecAc)SecurityActionEnumList.SelectedItem; options.CustomAttributes.Clear(); options.CustomAttributes.AddRange(CustomAttributesVM.Collection.Select(a => a.CreateCustomAttributeOptions().Create())); options.SecurityAttributes.Clear(); options.SecurityAttributes.AddRange(SecurityAttributesVM.Collection.Select(a => a.CreateSecurityAttribute())); options.V1XMLString = IsV1 ? V1XMLString : null; return options; }