예제 #1
0
        public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize)
        {
            this.origOptions    = options;
            this.canDeserialize = canDeserialize;

            this.booleanVM             = new BooleanVM(a => HasErrorUpdated());
            this.charVM                = new CharVM(a => HasErrorUpdated());
            this.byteVM                = new ByteVM(a => HasErrorUpdated());
            this.sbyteVM               = new SByteVM(a => HasErrorUpdated());
            this.int16VM               = new Int16VM(a => HasErrorUpdated());
            this.uint16VM              = new UInt16VM(a => HasErrorUpdated());
            this.int32VM               = new Int32VM(a => HasErrorUpdated());
            this.uint32VM              = new UInt32VM(a => HasErrorUpdated());
            this.int64VM               = new Int64VM(a => HasErrorUpdated());
            this.uint64VM              = new UInt64VM(a => HasErrorUpdated());
            this.singleVM              = new SingleVM(a => HasErrorUpdated());
            this.doubleVM              = new DoubleVM(a => HasErrorUpdated());
            this.decimalVM             = new DecimalVM(a => HasErrorUpdated());
            this.dateTimeVM            = new DateTimeVM(a => HasErrorUpdated());
            this.timeSpanVM            = new TimeSpanVM(a => HasErrorUpdated());
            this.userTypeVM            = new UserTypeVM(ownerModule, canDeserialize);
            this.resourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged());

            this.UserTypeVM.PropertyChanged += (s, e) => {
                if (e.PropertyName == "HasError")
                {
                    HasErrorUpdated();
                }
            };

            Reinitialize();
        }
예제 #2
0
        protected GeneralAppSettingsPageBase(CommonEditorOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            this.options       = options;
            GroupSizeInBytesVM = new Int32VM(a => { }, useDecimal: true)
            {
                Min = 0, Max = int.MaxValue
            };
            HexOffsetFormatVM = new EnumListVM(hexOffsetFormatList);
            EncodingInfoVM    = new EnumListVM(Encoding.GetEncodings().OrderBy(a => a.DisplayName, StringComparer.CurrentCultureIgnoreCase).Select(a => new EnumVM(a, a.DisplayName)).ToArray());

            EnableHighlightCurrentLine         = options.EnableHighlightCurrentLine;
            HighlightCurrentValue              = options.HighlightCurrentValue;
            HighlightStructureUnderMouseCursor = options.HighlightStructureUnderMouseCursor;
            HighlightActiveColumn              = options.HighlightActiveColumn;
            ValuesLowerCaseHex       = options.ValuesLowerCaseHex;
            OffsetLowerCaseHex       = options.OffsetLowerCaseHex;
            EnableColorization       = options.EnableColorization;
            GroupSizeInBytesVM.Value = options.GroupSizeInBytes;
            HexOffsetFormat          = options.HexOffsetFormat;
            EncodingInfo             = GetEncodingInfo(options.EncodingCodePage) ?? GetEncodingInfo(Encoding.UTF8.CodePage) ?? (EncodingInfo)EncodingInfoVM.Items.FirstOrDefault()?.Value;
        }
예제 #3
0
        public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize)
        {
            origOptions         = options;
            this.canDeserialize = canDeserialize;

            BooleanVM             = new BooleanVM(a => HasErrorUpdated());
            CharVM                = new CharVM(a => HasErrorUpdated());
            ByteVM                = new ByteVM(a => HasErrorUpdated());
            SByteVM               = new SByteVM(a => HasErrorUpdated());
            Int16VM               = new Int16VM(a => HasErrorUpdated());
            UInt16VM              = new UInt16VM(a => HasErrorUpdated());
            Int32VM               = new Int32VM(a => HasErrorUpdated());
            UInt32VM              = new UInt32VM(a => HasErrorUpdated());
            Int64VM               = new Int64VM(a => HasErrorUpdated());
            UInt64VM              = new UInt64VM(a => HasErrorUpdated());
            SingleVM              = new SingleVM(a => HasErrorUpdated());
            DoubleVM              = new DoubleVM(a => HasErrorUpdated());
            DecimalVM             = new DecimalVM(a => HasErrorUpdated());
            DateTimeVM            = new DateTimeVM(a => HasErrorUpdated());
            TimeSpanVM            = new TimeSpanVM(a => HasErrorUpdated());
            UserTypeVM            = new UserTypeVM(ownerModule, canDeserialize);
            ResourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged());

            UserTypeVM.PropertyChanged += (s, e) => {
                if (e.PropertyName == nameof(UserTypeVM.HasError))
                {
                    HasErrorUpdated();
                }
            };

            Reinitialize();
        }
예제 #4
0
        public void Int32VM_EditValueProvider_HexNumber_FF()
        {
            var vm = new Int32VM();

            vm.Value = 1;
            vm.EditValueProvider.HexNumber.Value = "FF";
            Assert.AreEqual((int)255, vm.Value);
        }
예제 #5
0
		public TabsAppSettingsPage(IOutputWindowOptions options) {
			if (options == null)
				throw new ArgumentNullException(nameof(options));
			this.options = options;
			TabSizeVM = new Int32VM(options.TabSize, a => { }, true) { Min = OptionsHelpers.MinimumTabSize, Max = OptionsHelpers.MaximumTabSize };
			IndentSizeVM = new Int32VM(options.IndentSize, a => { }, true) { Min = OptionsHelpers.MinimumIndentSize, Max = OptionsHelpers.MaximumIndentSize };
			ConvertTabsToSpaces = options.ConvertTabsToSpaces;
		}
        public void Int32VM_EditValueProvider_String()
        {
            var vm = new Int32VM();

            vm.Value = 1;
            vm.EditValueProvider.String = "2";
            Assert.AreEqual((int)2, vm.Value);
        }
예제 #7
0
        public void Int32VM_EditValueProvider_HexNumber_10()
        {
            var vm = new Int32VM();

            vm.Value = 1;
            vm.EditValueProvider.HexNumber.Value = "10";
            Assert.AreEqual((int)16, vm.Value);
        }
예제 #8
0
		protected TabsAppSettingsPageBase(ICommonEditorOptions options) {
			if (options == null)
				throw new ArgumentNullException(nameof(options));
			this.options = options;
			TabSizeVM = new Int32VM(options.TabSize, a => { }, true) { Min = OptionsHelpers.MinimumTabSize, Max = OptionsHelpers.MaximumTabSize };
			IndentSizeVM = new Int32VM(options.IndentSize, a => { }, true) { Min = OptionsHelpers.MinimumIndentSize, Max = OptionsHelpers.MaximumIndentSize };
			ConvertTabsToSpaces = options.ConvertTabsToSpaces;
		}
예제 #9
0
 public HexSettings()
 {
     this.bytesGroupCountVM = new Int32VM(a => { HasErrorUpdated(); OnPropertyChanged("BytesGroupCount"); });
     this.bytesPerLineVM = new Int32VM(a => { HasErrorUpdated(); OnPropertyChanged("BytesPerLine"); }) {
         Min = 0,
         Max = MAX_BYTES_PER_LINE,
     };
 }
예제 #10
0
        public void Int32VM()
        {
            var vm = new Int32VM();

            Assert.AreEqual(0, vm.Value);

            vm.Value = 1;
            Assert.AreEqual(1, vm.Value);

            vm.EditValueProvider.String = "2";
            Assert.AreEqual(2, vm.Value);
        }
예제 #11
0
 public InstructionOperandVM()
 {
     SByte         = new SByteVM(a => FieldUpdated());
     Byte          = new ByteVM(a => FieldUpdated());
     Int32         = new Int32VM(a => FieldUpdated());
     Int64         = new Int64VM(a => FieldUpdated());
     Single        = new SingleVM(a => FieldUpdated());
     Double        = new DoubleVM(a => FieldUpdated());
     String        = new StringVM(a => FieldUpdated());
     OperandListVM = new ListVM <object>((a, b) => FieldUpdated());
     OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
예제 #12
0
 public InstructionOperandVM()
 {
     this.@sbyte        = new SByteVM(a => FieldUpdated());
     this.@byte         = new ByteVM(a => FieldUpdated());
     this.int32         = new Int32VM(a => FieldUpdated());
     this.int64         = new Int64VM(a => FieldUpdated());
     this.single        = new SingleVM(a => FieldUpdated());
     this.@double       = new DoubleVM(a => FieldUpdated());
     this.@string       = new StringVM(a => FieldUpdated());
     this.operandListVM = new ListVM <object>((a, b) => FieldUpdated());
     this.OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
예제 #13
0
 public InstructionOperandVM()
 {
     this.@sbyte = new SByteVM(a => FieldUpdated());
     this.@byte = new ByteVM(a => FieldUpdated());
     this.int32 = new Int32VM(a => FieldUpdated());
     this.int64 = new Int64VM(a => FieldUpdated());
     this.single = new SingleVM(a => FieldUpdated());
     this.@double = new DoubleVM(a => FieldUpdated());
     this.@string = new StringVM(a => FieldUpdated());
     this.operandListVM = new ListVM<object>((a, b) => FieldUpdated());
     this.OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
예제 #14
0
		public void RegisterAndRelease() {
			var count = 0;
			var vm = new Int32VM();
			vm.ValueChangedEvent.Register(this,"{D9FCCC5F-79B6-4DC2-B4EC-EC734EA2EC11}",delegate(object sender, ValueChangedEventArgs args) { count++; });
			vm.Value = 1;
			Assert.AreEqual(1,count);

			vm.ValueChangedEvent.Release(this,"{D9FCCC5F-79B6-4DC2-B4EC-EC734EA2EC11}");
			count = 0;
			vm.Value = 2;
			Assert.AreEqual(0,count);
		}
예제 #15
0
 protected TabsAppSettingsPageBase(ICommonEditorOptions options)
 {
     this.options = options ?? throw new ArgumentNullException(nameof(options));
     TabSizeVM    = new Int32VM(options.TabSize, a => { }, true)
     {
         Min = OptionsHelpers.MinimumTabSize, Max = OptionsHelpers.MaximumTabSize
     };
     IndentSizeVM = new Int32VM(options.IndentSize, a => { }, true)
     {
         Min = OptionsHelpers.MinimumIndentSize, Max = OptionsHelpers.MaximumIndentSize
     };
     ConvertTabsToSpaces = options.ConvertTabsToSpaces;
 }
예제 #16
0
		public ImageListVM(ImageListOptions options) {
			origOptions = options;

			ImageListStreamerVM = new ImageListStreamerVM();
			ImageListStreamerVM.Collection.CollectionChanged += (s, e) => HasErrorUpdated();
			WidthVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = 1,
				Max = 256,
			};
			HeightVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = 1,
				Max = 256,
			};
			TransparentColorVM = new DefaultConverterVM<Color>(a => HasErrorUpdated());

			Reinitialize();
		}
예제 #17
0
 public TabsAppSettingsPage(IReplOptions options, Guid guid)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     this.options = options;
     Guid         = guid;
     TabSizeVM    = new Int32VM(options.TabSize, a => { }, true)
     {
         Min = OptionsHelpers.MinimumTabSize, Max = OptionsHelpers.MaximumTabSize
     };
     IndentSizeVM = new Int32VM(options.IndentSize, a => { }, true)
     {
         Min = OptionsHelpers.MinimumIndentSize, Max = OptionsHelpers.MaximumIndentSize
     };
     ConvertTabsToSpaces = options.ConvertTabsToSpaces;
 }
예제 #18
0
        public void Common()
        {
            var bm = new Int32BM {
                Metadata = new BusinessValueMetadata {
                    DataProvider = new LocalDataProvider(), Settings = new ValueSettings <Int32>()
                }
            };

            Assert.IsNotNull(bm.Settings);
            var vm = new Int32VM {
                MemberName = "Int32", Metadata = new BusinessValueMetadata <Int32>()
            };

            Assert.IsInstanceOf <BusinessValueErrorProvider>(vm.Metadata.ErrorProvider);
            ((IBusinessValueDataProvider)vm.Metadata.DataProvider).BusinessValue = bm;
            Assert.IsInstanceOf <BusinessValueErrorProvider>(vm.Metadata.ErrorProvider);
            bm.Metadata.Settings.Maximum = 100;
        }
예제 #19
0
        public LocalSettingsVM(LocalHexSettings options)
        {
            this.origOptions = options;
            this.bytesGroupCountVM = new NullableInt32VM(a => HasErrorUpdated());
            this.bytesPerLineVM = new NullableInt32VM(a => HasErrorUpdated(), true) {
                Min = 0,
                Max = HexEditorSettings.MAX_BYTES_PER_LINE,
            };
            this.hexOffsetSizeVM = new Int32VM(a => HasErrorUpdated(), true) {
                Min = 0,
                Max = 64,
            };
            this.baseOffsetVM = new UInt64VM(a => HasErrorUpdated());
            this.startOffsetVM = new NullableUInt64VM(a => HasErrorUpdated());
            this.endOffsetVM = new NullableUInt64VM(a => HasErrorUpdated());
            this.asciiEncodingVM = new EnumListVM(asciiEncodingList);

            Reinitialize();
        }
예제 #20
0
        public ImageListVM(ImageListOptions options)
        {
            this.origOptions = options;

            this.imageListStreamerVM = new ImageListStreamerVM();
            ImageListStreamerVM.Collection.CollectionChanged += (s, e) => HasErrorUpdated();
            this.widthVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = 1,
                Max = 256,
            };
            this.heightVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = 1,
                Max = 256,
            };
            this.transparentColorVM = new DefaultConverterVM <Color>(a => HasErrorUpdated());

            Reinitialize();
        }
예제 #21
0
        public ImageListVM(ImageListOptions options)
        {
            this.origOptions = options;

            this.imageListStreamerVM = new ImageListStreamerVM();
            ImageListStreamerVM.Collection.CollectionChanged += (s, e) => HasErrorUpdated();
            this.widthVM = new Int32VM(a => HasErrorUpdated()) {
                Min = 1,
                Max = 256,
                UseDecimal = true,
            };
            this.heightVM = new Int32VM(a => HasErrorUpdated()) {
                Min = 1,
                Max = 256,
                UseDecimal = true,
            };
            this.transparentColorVM = new DefaultConverterVM<Color>(a => HasErrorUpdated());

            Reinitialize();
        }
예제 #22
0
        public LocalSettingsVM(LocalGroupOptions options, LocalGroupOptions defaultOptions)
        {
            origOptions         = options;
            this.defaultOptions = defaultOptions;
            BytesPerLineVM      = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = HexBufferLineFormatterOptions.MinBytesPerLine,
                Max = HexBufferLineFormatterOptions.MaxBytesPerLine,
            };
            OffsetBitSizeVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = HexBufferLineFormatterOptions.MinOffsetBitSize,
                Max = HexBufferLineFormatterOptions.MaxOffsetBitSize,
            };
            BasePositionVM           = new UInt64VM(a => HasErrorUpdated());
            StartPositionVM          = new UInt64VM(a => HasErrorUpdated());
            EndPositionVM            = new UInt64VM(a => HasErrorUpdated());
            HexValuesDisplayFormatVM = new EnumListVM(hexValuesDisplayFormatList);

            Reinitialize();
        }
예제 #23
0
        public LocalSettingsVM(LocalHexSettings options)
        {
            this.origOptions       = options;
            this.bytesGroupCountVM = new NullableInt32VM(a => HasErrorUpdated());
            this.bytesPerLineVM    = new NullableInt32VM(a => HasErrorUpdated(), true)
            {
                Min = 0,
                Max = HexSettings.MAX_BYTES_PER_LINE,
            };
            this.hexOffsetSizeVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = 0,
                Max = 64,
            };
            this.baseOffsetVM    = new UInt64VM(a => HasErrorUpdated());
            this.startOffsetVM   = new NullableUInt64VM(a => HasErrorUpdated());
            this.endOffsetVM     = new NullableUInt64VM(a => HasErrorUpdated());
            this.asciiEncodingVM = new EnumListVM(asciiEncodingList);

            Reinitialize();
        }
예제 #24
0
 public HexEditorAppSettingsVM(HexEditorSettings hexEditorSettings)
 {
     this.hexEditorSettings = hexEditorSettings;
     this.asciiEncodingVM   = new EnumListVM(asciiEncodingList, (a, b) => hexEditorSettings.AsciiEncoding = (AsciiEncoding)AsciiEncodingVM.SelectedItem);
     this.bytesGroupCountVM = new Int32VM(a => { HasErrorUpdated(); hexEditorSettings.BytesGroupCount = BytesGroupCountVM.Value; });
     this.bytesPerLineVM    = new Int32VM(a => { HasErrorUpdated(); hexEditorSettings.BytesPerLine = BytesPerLineVM.Value; })
     {
         Min = 0,
         Max = HexEditorSettings.MAX_BYTES_PER_LINE,
     };
     AsciiEncodingVM.SelectedItem = hexEditorSettings.AsciiEncoding;
     BytesGroupCountVM.Value      = hexEditorSettings.BytesGroupCount;
     BytesPerLineVM.Value         = hexEditorSettings.BytesPerLine;
     FontFamily = hexEditorSettings.FontFamily;
     Task.Factory.StartNew(() => FontUtils.GetMonospacedFonts())
     .ContinueWith(t => {
         var ex = t.Exception;
         if (!t.IsCanceled && !t.IsFaulted)
         {
             FontFamilies = t.Result;
         }
     }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
 }
예제 #25
0
파일: HexField.cs 프로젝트: 4058665/dnSpy
 public Int32HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false)
     : base(doc, parentName, name, start, 4)
 {
     this.data = new Int32VM(doc.ReadInt32(start), a => UpdateValue(), useDecimal);
 }
예제 #26
0
        public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize)
        {
            this.origOptions = options;
            this.canDeserialize = canDeserialize;

            this.booleanVM = new BooleanVM(a => HasErrorUpdated());
            this.charVM = new CharVM(a => HasErrorUpdated());
            this.byteVM = new ByteVM(a => HasErrorUpdated());
            this.sbyteVM = new SByteVM(a => HasErrorUpdated());
            this.int16VM = new Int16VM(a => HasErrorUpdated());
            this.uint16VM = new UInt16VM(a => HasErrorUpdated());
            this.int32VM = new Int32VM(a => HasErrorUpdated());
            this.uint32VM = new UInt32VM(a => HasErrorUpdated());
            this.int64VM = new Int64VM(a => HasErrorUpdated());
            this.uint64VM = new UInt64VM(a => HasErrorUpdated());
            this.singleVM = new SingleVM(a => HasErrorUpdated());
            this.doubleVM = new DoubleVM(a => HasErrorUpdated());
            this.decimalVM = new DecimalVM(a => HasErrorUpdated());
            this.dateTimeVM = new DateTimeVM(a => HasErrorUpdated());
            this.timeSpanVM = new TimeSpanVM(a => HasErrorUpdated());
            this.userTypeVM = new UserTypeVM(ownerModule, canDeserialize);
            this.resourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged());

            this.UserTypeVM.PropertyChanged += (s, e) => {
                if (e.PropertyName == "HasError")
                    HasErrorUpdated();
            };

            Reinitialize();
        }
예제 #27
0
파일: HexField.cs 프로젝트: pashav15/pashav
 public Int32HexField(StructField <Int32Data> field, bool useDecimal = false)
     : base(field)
 {
     data = new Int32VM(buffer.ReadInt32(Span.Start), a => UpdateValue(), useDecimal);
 }
예제 #28
0
		public LocalSettingsVM(LocalGroupOptions options, LocalGroupOptions defaultOptions) {
			origOptions = options;
			this.defaultOptions = defaultOptions;
			BytesPerLineVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = HexBufferLineProviderOptions.MinBytesPerLine,
				Max = HexBufferLineProviderOptions.MaxBytesPerLine,
			};
			OffsetBitSizeVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = HexBufferLineProviderOptions.MinOffsetBitSize,
				Max = HexBufferLineProviderOptions.MaxOffsetBitSize,
			};
			BasePositionVM = new UInt64VM(a => HasErrorUpdated());
			StartPositionVM = new UInt64VM(a => HasErrorUpdated());
			EndPositionVM = new UInt64VM(a => HasErrorUpdated());
			HexValuesDisplayFormatVM = new EnumListVM(hexValuesDisplayFormatList);

			Reinitialize();
		}
예제 #29
0
		public InstructionOperandVM() {
			SByte = new SByteVM(a => FieldUpdated());
			Byte = new ByteVM(a => FieldUpdated());
			Int32 = new Int32VM(a => FieldUpdated());
			Int64 = new Int64VM(a => FieldUpdated());
			Single = new SingleVM(a => FieldUpdated());
			Double = new DoubleVM(a => FieldUpdated());
			String = new StringVM(a => FieldUpdated());
			OperandListVM = new ListVM<object>((a, b) => FieldUpdated());
			OperandListVM.DataErrorInfoDelegate = VerifyOperand;
		}
예제 #30
0
파일: HexField.cs 프로젝트: pashav15/pashav
 public Int32HexField(HexBuffer buffer, string parentName, string name, HexPosition start, bool useDecimal = false)
     : base(buffer, parentName, name, start, 4)
 {
     data = new Int32VM(buffer.ReadInt32(start), a => UpdateValue(), useDecimal);
 }
예제 #31
0
 public HexEditorAppSettingsVM(HexEditorSettings hexEditorSettings)
 {
     this.hexEditorSettings = hexEditorSettings;
     this.asciiEncodingVM = new EnumListVM(asciiEncodingList, (a, b) => hexEditorSettings.AsciiEncoding = (AsciiEncoding)AsciiEncodingVM.SelectedItem);
     this.bytesGroupCountVM = new Int32VM(a => { HasErrorUpdated(); hexEditorSettings.BytesGroupCount = BytesGroupCountVM.Value; });
     this.bytesPerLineVM = new Int32VM(a => { HasErrorUpdated(); hexEditorSettings.BytesPerLine = BytesPerLineVM.Value; }) {
         Min = 0,
         Max = HexEditorSettings.MAX_BYTES_PER_LINE,
     };
     AsciiEncodingVM.SelectedItem = hexEditorSettings.AsciiEncoding;
     BytesGroupCountVM.Value = hexEditorSettings.BytesGroupCount;
     BytesPerLineVM.Value = hexEditorSettings.BytesPerLine;
     FontFamily = hexEditorSettings.FontFamily;
     Task.Factory.StartNew(() => {
         AppCulture.InitializeCulture();
         return FontUtils.GetMonospacedFonts();
     })
     .ContinueWith(t => {
         var ex = t.Exception;
         if (!t.IsCanceled && !t.IsFaulted)
             FontFamilies = t.Result;
     }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());
 }
예제 #32
0
		public ResourceElementVM(ResourceElementOptions options, ModuleDef ownerModule, bool canDeserialize) {
			origOptions = options;
			this.canDeserialize = canDeserialize;

			BooleanVM = new BooleanVM(a => HasErrorUpdated());
			CharVM = new CharVM(a => HasErrorUpdated());
			ByteVM = new ByteVM(a => HasErrorUpdated());
			SByteVM = new SByteVM(a => HasErrorUpdated());
			Int16VM = new Int16VM(a => HasErrorUpdated());
			UInt16VM = new UInt16VM(a => HasErrorUpdated());
			Int32VM = new Int32VM(a => HasErrorUpdated());
			UInt32VM = new UInt32VM(a => HasErrorUpdated());
			Int64VM = new Int64VM(a => HasErrorUpdated());
			UInt64VM = new UInt64VM(a => HasErrorUpdated());
			SingleVM = new SingleVM(a => HasErrorUpdated());
			DoubleVM = new DoubleVM(a => HasErrorUpdated());
			DecimalVM = new DecimalVM(a => HasErrorUpdated());
			DateTimeVM = new DateTimeVM(a => HasErrorUpdated());
			TimeSpanVM = new TimeSpanVM(a => HasErrorUpdated());
			UserTypeVM = new UserTypeVM(ownerModule, canDeserialize);
			ResourceElementTypeVM = new EnumListVM(resourceElementTypeList, (a, b) => OnResourceElementTypeChanged());

			UserTypeVM.PropertyChanged += (s, e) => {
				if (e.PropertyName == nameof(UserTypeVM.HasError))
					HasErrorUpdated();
			};

			Reinitialize();
		}
예제 #33
0
        public void Int32VM_InitValueMustBe_0()
        {
            var vm = new Int32VM();

            Assert.AreEqual((int)0, vm.Value);
        }
예제 #34
0
		public ConstantTypeVM(ModuleDef ownerModule, object value, ConstantType[] validConstants, bool allowNullString, bool arraysCanBeNull, TypeSigCreatorOptions options = null) {
			if (options == null) {
				IList<ConstantType> clist = validConstants;
				if (clist.IndexOf(ConstantType.Type) >= 0 ||
					clist.IndexOf(ConstantType.TypeArray) >= 0 ||
					clist.IndexOf(ConstantType.ObjectArray) >= 0) {
					throw new ArgumentNullException();
				}
			}
			this.arraysCanBeNull = arraysCanBeNull;
			var list = validConstants.Select(a => typeToEnumVM[a]);
			this.constantTypeEnumListVM = new EnumListVM(list, (a, b) => OnConstantChanged());
			this.boolean = new BooleanVM(a => FieldUpdated());
			this.@char = new CharVM(a => FieldUpdated());
			this.@sbyte = new SByteVM(a => FieldUpdated());
			this.@byte = new ByteVM(a => FieldUpdated());
			this.int16 = new Int16VM(a => FieldUpdated());
			this.uint16 = new UInt16VM(a => FieldUpdated());
			this.int32 = new Int32VM(a => FieldUpdated());
			this.uint32 = new UInt32VM(a => FieldUpdated());
			this.int64 = new Int64VM(a => FieldUpdated());
			this.uint64 = new UInt64VM(a => FieldUpdated());
			this.single = new SingleVM(a => FieldUpdated());
			this.@double = new DoubleVM(a => FieldUpdated());
			this.@string = new StringVM(a => FieldUpdated(), allowNullString);
			this.@enum = new EnumDataFieldVM(ownerModule, a => FieldUpdated());
			this.type = new TypeSigVM(a => FieldUpdated(), options);
			this.objectArray = new ObjectListDataFieldVM(ownerModule, a => FieldUpdated(), options);
			this.booleanArray = new BooleanListDataFieldVM(a => FieldUpdated());
			this.charArray = new CharListDataFieldVM(a => FieldUpdated());
			this.sbyteArray = new SByteListDataFieldVM(a => FieldUpdated());
			this.byteArray = new ByteListDataFieldVM(a => FieldUpdated());
			this.int16Array = new Int16ListDataFieldVM(a => FieldUpdated());
			this.uint16Array = new UInt16ListDataFieldVM(a => FieldUpdated());
			this.int32Array = new Int32ListDataFieldVM(a => FieldUpdated());
			this.uint32Array = new UInt32ListDataFieldVM(a => FieldUpdated());
			this.int64Array = new Int64ListDataFieldVM(a => FieldUpdated());
			this.uint64Array = new UInt64ListDataFieldVM(a => FieldUpdated());
			this.singleArray = new SingleListDataFieldVM(a => FieldUpdated());
			this.doubleArray = new DoubleListDataFieldVM(a => FieldUpdated());
			this.stringArray = new StringListDataFieldVM(a => FieldUpdated());
			this.enumArray = new EnumListDataFieldVM(ownerModule, a => FieldUpdated());
			this.typeArray = new TypeSigListDataFieldVM(a => FieldUpdated(), options);
			this.Value = value;
		}
예제 #35
0
파일: HexField.cs 프로젝트: 0xd4d/dnSpy
		public Int32HexField(HexBuffer buffer, string parentName, string name, HexPosition start, bool useDecimal = false)
			: base(buffer, parentName, name, start, 4) {
			data = new Int32VM(buffer.ReadInt32(start), a => UpdateValue(), useDecimal);
		}
예제 #36
0
 public Int32HexField(HexDocument doc, string parentName, string name, ulong start, bool useDecimal = false)
     : base(doc, parentName, name, start, 4)
 {
     this.data = new Int32VM(doc.ReadInt32(start), a => UpdateValue(), useDecimal);
 }
		protected GeneralAppSettingsPageBase(CommonEditorOptions options) {
			if (options == null)
				throw new ArgumentNullException(nameof(options));
			this.options = options;
			GroupSizeInBytesVM = new Int32VM(a => { }, useDecimal: true) { Min = 0, Max = int.MaxValue };
			HexOffsetFormatVM = new EnumListVM(hexOffsetFormatList);
			EncodingInfoVM = new EnumListVM(Encoding.GetEncodings().OrderBy(a => a.DisplayName, StringComparer.CurrentCultureIgnoreCase).Select(a => new EnumVM(a, a.DisplayName)).ToArray());

			EnableHighlightCurrentLine = options.EnableHighlightCurrentLine;
			HighlightCurrentValue = options.HighlightCurrentValue;
			HighlightActiveColumn = options.HighlightActiveColumn;
			ValuesLowerCaseHex = options.ValuesLowerCaseHex;
			OffsetLowerCaseHex = options.OffsetLowerCaseHex;
			EnableColorization = options.EnableColorization;
			GroupSizeInBytesVM.Value = options.GroupSizeInBytes;
			HexOffsetFormat = options.HexOffsetFormat;
			EncodingInfo = GetEncodingInfo(options.EncodingCodePage) ?? GetEncodingInfo(Encoding.UTF8.CodePage) ?? (EncodingInfo)EncodingInfoVM.Items.FirstOrDefault()?.Value;
		}