internal static SavedHexTabState FromXmlInternal(XElement child) { var savedState = new SavedHexTabState(); savedState.BytesGroupCount = (int?)child.Attribute("BytesGroupCount"); savedState.BytesPerLine = (int?)child.Attribute("BytesPerLine"); savedState.UseHexPrefix = (bool?)child.Attribute("UseHexPrefix"); savedState.ShowAscii = (bool?)child.Attribute("ShowAscii"); savedState.LowerCaseHex = (bool?)child.Attribute("LowerCaseHex"); savedState.AsciiEncoding = (AsciiEncoding?)(int?)child.Attribute("AsciiEncoding"); savedState.HexOffsetSize = (int)child.Attribute("HexOffsetSize"); savedState.UseRelativeOffsets = (bool)child.Attribute("UseRelativeOffsets"); savedState.BaseOffset = (ulong)child.Attribute("BaseOffset"); savedState.FileName = SessionSettings.Unescape((string)child.Attribute("FileName")); savedState.HexBoxState.TopOffset = (ulong)child.Attribute("HexBoxState-TopOffset"); savedState.HexBoxState.Column = (int)child.Attribute("HexBoxState-Column"); savedState.HexBoxState.StartOffset = (ulong)child.Attribute("HexBoxState-StartOffset"); savedState.HexBoxState.EndOffset = (ulong)child.Attribute("HexBoxState-EndOffset"); savedState.HexBoxState.CaretPosition.Offset = (ulong)child.Attribute("HexBoxState-HexBoxPosition-Offset"); savedState.HexBoxState.CaretPosition.Kind = (HexBoxPositionKind)(int)child.Attribute("HexBoxState-HexBoxPosition-Kind"); savedState.HexBoxState.CaretPosition.KindPosition = (byte)(int)child.Attribute("HexBoxState-HexBoxPosition-KindPosition"); var from = child.Attribute("HexBoxState-Selection-From"); var to = child.Attribute("HexBoxState-Selection-To"); if (from != null && to != null) { savedState.HexBoxState.Selection = new HexSelection((ulong)from, (ulong)to); } return(savedState); }
public static SavedTabState FromXml(XElement child) { var type = (string)child.Attribute("tab-type"); //TODO: Remove the null check after some time after this commit. Only here so older files can be loaded. if (type == null || type == SavedDecompileTabState.TYPE) { return(SavedDecompileTabState.FromXmlInternal(child)); } if (type == SavedHexTabState.TYPE) { return(SavedHexTabState.FromXmlInternal(child)); } Debug.Fail(string.Format("Unknown type: {0}", type)); return(null); }
public override SavedTabState CreateSavedTabState() { var state = new SavedHexTabState(); state.BytesGroupCount = BytesGroupCount; state.BytesPerLine = BytesPerLine; state.UseHexPrefix = UseHexPrefix; state.ShowAscii = ShowAscii; state.LowerCaseHex = LowerCaseHex; state.AsciiEncoding = AsciiEncoding; state.HexOffsetSize = HexBox.HexOffsetSize; state.UseRelativeOffsets = HexBox.UseRelativeOffsets; state.BaseOffset = HexBox.BaseOffset; state.HexBoxState = HexBox.State; state.FileName = HexBox.Document == null ? string.Empty : HexBox.Document.Name; return(state); }
public void Restore(SavedHexTabState state) { BytesGroupCount = state.BytesGroupCount; BytesPerLine = state.BytesPerLine; UseHexPrefix = state.UseHexPrefix; ShowAscii = state.ShowAscii; LowerCaseHex = state.LowerCaseHex; AsciiEncoding = state.AsciiEncoding; HexBox.HexOffsetSize = state.HexOffsetSize; HexBox.UseRelativeOffsets = state.UseRelativeOffsets; HexBox.BaseOffset = state.BaseOffset; if (HexBox.IsLoaded) { HexBox.State = state.HexBoxState; } else { new StateRestorer(HexBox, state.HexBoxState); } }
HexTabState CreateHexTabState(HexTabState tabState, SavedHexTabState savedHexTabState) { tabState.Restore(savedHexTabState); return InitializeHexDocument(tabState, savedHexTabState.FileName); }
HexTabState CreateHexTabState(SavedHexTabState savedState) { if (!File.Exists(savedState.FileName)) return null; var tabState = CreateNewHexTabState(tabGroupsManager.ActiveTabGroup); return CreateHexTabState(tabState, savedState); }
public void Restore(SavedHexTabState state) { BytesGroupCount = state.BytesGroupCount; BytesPerLine = state.BytesPerLine; UseHexPrefix = state.UseHexPrefix; ShowAscii = state.ShowAscii; LowerCaseHex = state.LowerCaseHex; AsciiEncoding = state.AsciiEncoding; HexBox.HexOffsetSize = state.HexOffsetSize; HexBox.UseRelativeOffsets = state.UseRelativeOffsets; HexBox.BaseOffset = state.BaseOffset; if (HexBox.IsLoaded) HexBox.State = state.HexBoxState; else new StateRestorer(HexBox, state.HexBoxState); }
public override SavedTabState CreateSavedTabState() { var state = new SavedHexTabState(); state.BytesGroupCount = BytesGroupCount; state.BytesPerLine = BytesPerLine; state.UseHexPrefix = UseHexPrefix; state.ShowAscii = ShowAscii; state.LowerCaseHex = LowerCaseHex; state.AsciiEncoding = AsciiEncoding; state.HexOffsetSize = HexBox.HexOffsetSize; state.UseRelativeOffsets = HexBox.UseRelativeOffsets; state.BaseOffset = HexBox.BaseOffset; state.HexBoxState = HexBox.State; state.FileName = HexBox.Document == null ? string.Empty : HexBox.Document.Name; return state; }
internal static SavedHexTabState FromXmlInternal(XElement child) { var savedState = new SavedHexTabState(); savedState.BytesGroupCount = (int?)child.Attribute("BytesGroupCount"); savedState.BytesPerLine = (int?)child.Attribute("BytesPerLine"); savedState.UseHexPrefix = (bool?)child.Attribute("UseHexPrefix"); savedState.ShowAscii = (bool?)child.Attribute("ShowAscii"); savedState.LowerCaseHex = (bool?)child.Attribute("LowerCaseHex"); savedState.AsciiEncoding = (AsciiEncoding?)(int?)child.Attribute("AsciiEncoding"); savedState.HexOffsetSize = (int)child.Attribute("HexOffsetSize"); savedState.UseRelativeOffsets = (bool)child.Attribute("UseRelativeOffsets"); savedState.BaseOffset = (ulong)child.Attribute("BaseOffset"); savedState.FileName = SessionSettings.Unescape((string)child.Attribute("FileName")); savedState.HexBoxState.TopOffset = (ulong)child.Attribute("HexBoxState-TopOffset"); savedState.HexBoxState.Column = (int)child.Attribute("HexBoxState-Column"); savedState.HexBoxState.StartOffset = (ulong)child.Attribute("HexBoxState-StartOffset"); savedState.HexBoxState.EndOffset = (ulong)child.Attribute("HexBoxState-EndOffset"); savedState.HexBoxState.CaretPosition.Offset = (ulong)child.Attribute("HexBoxState-HexBoxPosition-Offset"); savedState.HexBoxState.CaretPosition.Kind = (HexBoxPositionKind)(int)child.Attribute("HexBoxState-HexBoxPosition-Kind"); savedState.HexBoxState.CaretPosition.KindPosition = (byte)(int)child.Attribute("HexBoxState-HexBoxPosition-KindPosition"); var from = child.Attribute("HexBoxState-Selection-From"); var to = child.Attribute("HexBoxState-Selection-To"); if (from != null && to != null) savedState.HexBoxState.Selection = new HexSelection((ulong)from, (ulong)to); return savedState; }
HexTabState CreateHexTabState(SavedHexTabState savedState) { var tabState = CreateNewHexTabState(tabGroupsManager.ActiveTabGroup); return CreateHexTabState(tabState, savedState); }