static void Main(string[] args) { HexEditor editor = new HexEditor(); var bytes = editor.GetPathBytes(@"C:\Users\hakop\OneDrive\Documents\Visual Studio 2019\Projects\HelloWorld\HelloWorld\Program.fs"); var hex = editor.ConvertToHex(bytes); var chars = editor.GetLettersFromHex(hex); int length = hex.Length; for (int i = 0; i < Math.Ceiling((double)(length) / 16); i++) { var listH = hex.Take(16).ToList(); var listC = chars.Take(16).ToList(); hex = hex.Skip(16).ToArray(); chars = chars.Skip(16).ToArray(); foreach (var h in listH) { Console.Write($"{h} "); } Console.SetCursorPosition(60, Console.CursorTop); foreach (var c in listC) { if (!char.IsControl(c)) { Console.Write($"{c} "); } else { Console.Write(". "); } } Console.WriteLine(); } }
public override void OnClick(TreeView treeview) { string filePath = GetFilePath(); if (!romfs.FileDict.ContainsKey($"/{filePath}")) { return; } var file = romfs.FileDict[$"/{filePath}"]; HexEditor editor = (HexEditor)LibraryGUI.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); LibraryGUI.LoadEditor(editor); } editor.Text = Text; editor.Dock = DockStyle.Fill; using (var stream = romfs.OpenFile(file).AsStream()) { var mem = new MemoryStream(); stream.CopyTo(mem); editor.LoadData(mem.ToArray()); } }
public StringByte(HexEditor parent) : base(parent) { //Default properties Width = 10; #region Binding tooltip LoadDictionary("/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml"); var txtBinding = new Binding { Source = FindResource("ByteToolTip"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.OneWay }; // Load ressources dictionnary void LoadDictionary(string url) { var ttRes = new ResourceDictionary { Source = new Uri(url, UriKind.Relative) }; Resources.MergedDictionaries.Add(ttRes); } SetBinding(ToolTipProperty, txtBinding); #endregion }
private void OnGUI() { prototypeHex = (HexEditor)EditorGUILayout.ObjectField("Hex Prototype ", prototypeHex, typeof(HexEditor), true); GUI.enabled = false; hexContainer = (Transform)EditorGUILayout.ObjectField("Hex Container ", hexContainer, typeof(Transform), true); GUI.enabled = true; genType = (MapGenType)EditorGUILayout.EnumPopup("Generation Type", genType); switch (genType) { case MapGenType.Circle: circleCount = EditorGUILayout.IntSlider("Circle count ", circleCount, 2, 20); break; } if (GUILayout.Button("Generate")) Generate(); if (GUILayout.Button("DestroyAll")) Destroy(); if (!prototypeHex) { prototypeHex = Resources.Load<HexEditor>("Prefabs/Editor/Hex"); } if (!hexContainer) { var go = GameObject.Find("Hex Container"); if (go) { hexContainer = go.transform; } } }
protected BaseByte(HexEditor parent) { //Parent hexeditor _parent = parent ?? throw new ArgumentNullException(nameof(parent)); #region Binding tooltip LoadDictionary("/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml"); var txtBinding = new Binding { Source = FindResource("ByteToolTip"), UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Mode = BindingMode.OneWay }; // Load ressources dictionnary void LoadDictionary(string url) { var ttRes = new ResourceDictionary { Source = new Uri(url, UriKind.Relative) }; Resources.MergedDictionaries.Add(ttRes); } SetBinding(ToolTipProperty, txtBinding); #endregion //Default properties DataContext = this; Focusable = true; }
public void Goto(uint Offset) { //HexEditor.SetPosition(Offset, 0); for (int i = 0; i < Info.Length; i++) { Map_Info Current_Info = Info[i]; uint End = Current_Info.Offset + Current_Info.Size; if (Offset >= Current_Info.Offset && Offset <= End) { var Old_Stream = HexEditor.Stream; Selected_Index = i; currentlyEditing.Text = @"Currently Editing: [" + Current_Info.Section_Name + "] - " + Current_Info.Parent_Name + @"/" + Current_Info.File_Name + " - File Offset: 0x" + Current_Info.Offset.ToString("X"); if (Current_Info.Data == null) { Current_Info.Data = File_Buffer.Skip((int)Current_Info.Offset).Take((int)Current_Info.Size).ToArray(); } HexEditor.Stream = new MemoryStream(Current_Info.Data); // "new MemoryStream(Data)" is probably a memory leak HexEditor.SetPosition(Offset - Current_Info.Offset, 0); Display_Content(); if (Old_Stream != null) { Old_Stream.Dispose(); } return; } } }
public FastTextLine(HexEditor parent) { //Parent hexeditor _parent = parent ?? throw new ArgumentNullException(nameof(parent)); //Default properties DataContext = this; #region Binding tooltip //LoadDictionary("/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml"); //var txtBinding = new Binding //{ // Source = FindResource("ByteToolTip"), // UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, // Mode = BindingMode.OneWay //}; //// Load ressources dictionnary //void LoadDictionary(string url) //{ // var ttRes = new ResourceDictionary { Source = new Uri(url, UriKind.Relative) }; // Resources.MergedDictionaries.Add(ttRes); //} //SetBinding(ToolTipProperty, txtBinding); #endregion }
public FastTextLine(HexEditor parent) { //Parent hexeditor _parent = parent ?? throw new ArgumentNullException(nameof(parent)); //Default properties DataContext = this; }
internal void InternalHandleKeypress (HexEditor editor, Gdk.Key key, uint unicodeChar, Gdk.ModifierType modifier) { this.Editor = editor; HandleKeypress (key, unicodeChar, modifier); //make sure that nothing funny goes on when the mode should have finished this.Editor = null; }
public FindWindow(HexEditor parent) { InitializeComponent(); //Parent hexeditor for "binding" search _parent = parent; InitializeMStream(); }
public MarginMouseEventArgs(HexEditor editor, int button, int x, int y, Gdk.EventType type, Gdk.ModifierType modifierState) { this.Editor = editor; this.Button = button; this.X = x; this.Y = y; this.Type = type; this.ModifierState = modifierState; }
protected BaseByte(HexEditor parent) { //Parent hexeditor _parent = parent ?? throw new ArgumentNullException(nameof(parent)); //Default properties DataContext = this; Focusable = true; }
internal void InternalHandleKeypress(HexEditor editor, Gdk.Key key, uint unicodeChar, Gdk.ModifierType modifier) { this.Editor = editor; HandleKeypress(key, unicodeChar, modifier); //make sure that nothing funny goes on when the mode should have finished this.Editor = null; }
public FindWindow(HexEditor parent, byte[] findData = null) { InitializeComponent(); //Parent hexeditor for "binding" search _parent = parent; InitializeMStream(findData); }
private HexEditor CreateHexEditor(byte[] data, EventHandler <byte[]> saveHandler) { var editor = new HexEditor(); editor.Width = 700; editor.LoadData(data); editor.SaveData += saveHandler; return(editor); }
private void StructListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (StructListView.Items.Count == 0) { return; } var item = (StructListItem)StructListView.Items[StructListView.SelectedIndex]; HexEditor.Select(item.offset, item.typeLength); }
public MapGenerator(HexEditor prototype, int circleCount) { this.prototype = prototype; this.container = new GameObject("Hex Container").transform; this.circleCount = circleCount; r = HexInfo.R; a = HexInfo.A; hexMap = new Dictionary<int, HexEditor>(); }
/// <summary> /// Initialize stream and hexeditor /// </summary> private void InitializeMStream(HexEditor hexeditor, byte[] findData = null) { hexeditor.CloseProvider(); var ms = new MemoryStream(1); if (findData is not null && findData.Length > 0) { foreach (byte b in findData) { ms.WriteByte(b); } }
public override void AddRedraw(HexEditor editor) { Margin margin = editor.Margins.FirstOrDefault(m => m.GetType() == MarginType); if (margin != null) { editor.RepaintMarginArea(margin, margin.XOffset, (int)(Line * editor.LineHeight - editor.HexEditorData.VAdjustment.Value), margin.Width, editor.LineHeight); } }
private void ShowHexView() { HexEditor editor = (HexEditor)LibraryGUI.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); LibraryGUI.LoadEditor(editor); } editor.Text = Text; editor.Dock = DockStyle.Fill; editor.LoadData(Data); }
private void StructListView_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (StructListView.Items.Count == 0) { return; } var item = (StructListItem)StructListView.Items[StructListView.SelectedIndex]; HexEditor.SetPosition(item.offset); HexEditor.SelectionStart = item.offset; HexEditor.SelectionStop = item.offset + item.typeLength; }
private List<HexEditor> BuildAround(HexEditor hex) { List<HexEditor> hexes = new List<HexEditor>(); foreach (var index in HexInfo.GetCircumIndices(hex.Index)) if (!hexMap.ContainsKey(index)) { var builtHex = CreateHex(index); hexes.Add(builtHex); } return hexes; }
public override void OnClick(TreeView treeView) { HexEditor editor = (HexEditor)LibraryGUI.Instance.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); LibraryGUI.Instance.LoadEditor(editor); } editor.Text = Text; editor.Dock = DockStyle.Fill; editor.LoadData(DecompressBlock()); }
private void UpdateEditor() { HexEditor editor = (HexEditor)LibraryGUI.Instance.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); editor.Dock = DockStyle.Fill; LibraryGUI.Instance.LoadEditor(editor); } editor.Text = Text; editor.LoadData(Data); }
public override void OnClick(TreeView treeview) { HexEditor editor = (HexEditor)LibraryGUI.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); LibraryGUI.LoadEditor(editor); } editor.Text = Text; editor.Dock = DockStyle.Fill; editor.LoadData(DecryptedTable); }
/// <summary> /// Test of adding somes byte /// /// IN DEVELOPMENT, NOT WORKING PROPRELY :) /// </summary> private void AddByteButton_Click(object sender, RoutedEventArgs e) => HexEditor.With(c => { c.InsertByte(255, 15); c.InsertByte(255, 16); c.InsertByte(255, 17); c.InsertByte(255, 18); c.InsertByte(255, 19); c.InsertByte(255, 20); c.InsertByte(255, 21); //Actually the visual not show the result. I'm working on this :) c.RefreshView(); });
public override void OnClick(TreeView treeview) { if (UnknownData != null && UnknownData.Length > 0) { HexEditor editor = (HexEditor)LibraryGUI.GetActiveContent(typeof(HexEditor)); if (editor == null) { editor = new HexEditor(); LibraryGUI.LoadEditor(editor); } editor.Text = Text; editor.Dock = DockStyle.Fill; editor.LoadData(UnknownData); editor.SaveData += (object sender, byte[] data) => this.UnknownData = data; } }
private void RelView_Item_Clicked(int Index) { Selected_Index = Index; Map_Info This_Info = Info[Index]; currentlyEditing.Text = @"Currently Editing: [" + This_Info.Section_Name + "] - " + This_Info.Parent_Name + @"/" + This_Info.File_Name + " - File Offset: 0x" + This_Info.Offset.ToString("X"); if (This_Info.Data == null) { This_Info.Data = File_Buffer.Skip((int)This_Info.Offset).Take((int)This_Info.Size).ToArray(); } HexEditor.Stream = new MemoryStream(This_Info.Data); // "new MemoryStream(Data)" is probably a memory leak HexEditor.SetPosition(0, 0); Display_Content(); }
private void AddTab(EFTB.NodeBase node) { var tab = new TabPage(node.Signature); if (node is EFTB.CADP) { tab.Controls.Add(CreateCADPEditor((EFTB.CADP)node)); } else if (node.UnknownData != null && node.UnknownData.Length > 0) { var hexEditor = new HexEditor(); hexEditor.Dock = DockStyle.Fill; hexEditor.LoadData(node.UnknownData); tab.Controls.Add(hexEditor); } stTabControl1.TabPages.Add(tab); }
internal static void ShowHexEditor(Form1 form) { CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(form.pagesTabControl.SelectedTabPage); if (String.IsNullOrEmpty(pageTextBox.Text)) { ShowInfoBox(form, LanguageUtil.GetCurrentLanguageString("TextEmpty", className)); return; } HexEditor hexEditor = new HexEditor { Owner = form }; hexEditor.InitializeForm(); hexEditor.Show(form); }
private void OpenFile(HexEditor hexEditor) { ClearUI(); #region Create file dialog var fileDialog = new OpenFileDialog { Multiselect = true, CheckFileExists = true }; if (fileDialog.ShowDialog() == null || !File.Exists(fileDialog.FileName)) { return; } #endregion hexEditor.FileName = fileDialog.FileName; }
private Control CreateCADPEditor(EFTB.CADP cadp) { var panel = new FlowLayoutPanel(); panel.Dock = DockStyle.Fill; panel.FlowDirection = FlowDirection.TopDown; var label = new Label(); label.Text = "Shape"; panel.Controls.Add(label); foreach (EFTB.CADP.Shape flag in Enum.GetValues(typeof(EFTB.CADP.Shape))) { var checkbox = new CheckBox(); checkbox.Text = Enum.GetName(typeof(EFTB.CADP.Shape), flag); checkbox.Checked = cadp.ShapeFlag.HasFlag(flag); checkbox.CheckedChanged += (object sender, EventArgs e) => { if (checkbox.Checked) { cadp.ShapeFlag |= flag; } else { cadp.ShapeFlag &= ~flag; } }; panel.Controls.Add(checkbox); } var hexEditor = new HexEditor(); hexEditor.Width = 700; // hexEditor.Dock = DockStyle.Fill; hexEditor.LoadData(cadp.UnknownData); hexEditor.SaveData += (object sender, byte[] data) => cadp.UnknownData = data; panel.Controls.Add(hexEditor); return(panel); }
private void DisplayInformation(ManifestChunk chunk) { ByteStartOffsetBox.Text = chunk.Offset.ToString(); ByteEndOffsetBox.Text = chunk.EndOffset.ToString(); ByteSizeBox.Text = chunk.Size.ToString(); AnonByteBox.Text = chunk.Extra.ToString(); NameLabel.Text = chunk.Name; ColorDisplay.Background = FileMapBorders[chunk].Background; OpenChunk = chunk; var path = System.IO.Path.Combine(DestinationBox.Text, chunk.Name); if (File.Exists(path)) { OpenFileButton.IsEnabled = true; HexEditor.FileName = path; } else { OpenFileButton.IsEnabled = false; HexEditor.CloseProvider(); } Title = $"MV - Viewing {chunk.Name}"; }
public DashedLineMargin (HexEditor hexEditor) : base (hexEditor) { }
public GutterMargin (HexEditor hexEditor) : base (hexEditor) { }
public TextEditorMargin (HexEditor hexEditor) : base (hexEditor) { }
public MarginMouseEventArgs (HexEditor editor, Margin margin, ButtonEventArgs args) { this.Editor = editor; this.margin = margin; this.Args = args; }
/* protected Gdk.Cursor cursor = null; public Gdk.Cursor MarginCursor { get { return cursor; } }*/ protected Margin (HexEditor hexEditor) { this.Editor = hexEditor; IsVisible = true; }
public MarginMouseMovedEventArgs (HexEditor editor, Margin margin, MouseMovedEventArgs args) { this.margin = margin; this.Editor = editor; this.Args = args; }
public EmptySpaceMargin (HexEditor hexEditor) : base (hexEditor) { }
public IconMargin (HexEditor hexEditor) : base (hexEditor) { }
public EmptySpaceMargin(HexEditor hexEditor) : base(hexEditor) { }
public MarginMouseEventArgs (HexEditor editor, int button, int x, int y, Gdk.EventType type, Gdk.ModifierType modifierState) { this.Editor = editor; this.Button = button; this.X = x; this.Y = y; this.Type = type; this.ModifierState = modifierState; }