void InitializeFrom(LocalHexSettings options) { BytesGroupCountVM.Value = options.BytesGroupCount; BytesPerLineVM.Value = options.BytesPerLine; UseHexPrefix = options.UseHexPrefix; ShowAscii = options.ShowAscii; LowerCaseHex = options.LowerCaseHex; AsciiEncodingVM.SelectedItem = options.AsciiEncoding ?? AsciiEncoding_DEFAULT; HexOffsetSizeVM.Value = options.HexOffsetSize; UseRelativeOffsets = options.UseRelativeOffsets; BaseOffsetVM.Value = options.BaseOffset; StartOffsetVM.Value = options.StartOffset; EndOffsetVM.Value = options.EndOffset; }
LocalHexSettings CopyTo(LocalHexSettings options) { options.BytesGroupCount = BytesGroupCountVM.Value; options.BytesPerLine = BytesPerLineVM.Value; options.UseHexPrefix = UseHexPrefix; options.ShowAscii = ShowAscii; options.LowerCaseHex = LowerCaseHex; var val = (AsciiEncoding)AsciiEncodingVM.SelectedItem; options.AsciiEncoding = val == AsciiEncoding_DEFAULT ? (AsciiEncoding?)null : val; options.HexOffsetSize = HexOffsetSizeVM.Value; options.UseRelativeOffsets = UseRelativeOffsets; options.BaseOffset = BaseOffsetVM.Value; options.StartOffset = StartOffsetVM.Value; options.EndOffset = EndOffsetVM.Value; return options; }
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(); }