Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
THex Editor - ViewStructureForm.vb

ViewStructureForm.vb

Caricato da: Totem
Scarica il programma completo

  1. Public Class ViewStructureForm
  2.  
  3.     Private Current As [Structure]
  4.  
  5.     Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
  6.         If Current Is Nothing Then
  7.             MessageBox.Show("Selezionare una struttura dalla lista prima!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  8.             Exit Sub
  9.         End If
  10.  
  11.         Dim Bytes() As Byte = My.Forms.Form1.hexBytes.SelectedBytes
  12.  
  13.         lstStructure.Items.Clear()
  14.         'Try
  15.         Current.Read(Bytes)
  16.         For Each M As [Structure].StructureMember In Current.Members
  17.             Dim L As New ListViewItem(New String() {M.Name, M.FormattedValue})
  18.             lstStructure.Items.Add(L)
  19.         Next
  20.         'Catch ex As Exception
  21.         '    MessageBox.Show("Errore di lettura! Controllare che la dimensione dell'array di byte selezionato sia coerente con la struttura!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  22.         'End Try
  23.     End Sub
  24.  
  25.     Private Sub ViewStructureForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  26.         For Each File As String In IO.Directory.GetFiles(Application.StartupPath, "*.struct")
  27.             Dim S As [Structure] = [Structure].Load(File)
  28.             If S IsNot Nothing Then
  29.                 cmbStructures.Items.Add(S)
  30.             End If
  31.         Next
  32.     End Sub
  33.  
  34.     Private Sub cmbStructures_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbStructures.SelectedIndexChanged
  35.         If cmbStructures.SelectedIndex < 0 Then
  36.             Exit Sub
  37.         End If
  38.  
  39.         Current = cmbStructures.SelectedItem
  40.     End Sub
  41. End Class