Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

Creating New Format

Data Inspector allows you to define your own formats in addition to standard ones. Structure Viewer language definition format is used to define the format.

Edit Type Definition

Use the following steps to define a new format:

  1. Use Tools » Data Inspector » Add New Type… command to open the Type Definition window.
  2. Enter the new type's name. 3, Enter the new type's definition. Definition must be a Structure Viewer's public user-defined type with optional display attribute.

If data modification is required, the defined public type must also have a special “member” function called assign. This function takes a single parameter and must convert it and assign to defined type's field(s).

The following example defines new Data Inspector type which displays an IP address.

// display attribute allows IP address formatting
[display(format("{0}.{1}.{2}.{3}", a, b, c, d))]  
public struct IP 
  // Little-endian IP address encoding 
  unsigned char d, c, b, a; 
  // assign function allows data modification through the user interface 
  function assign(value) 
    var na_end = int(find(value, ".")); 
    var nb_end = int(find(value, ".", na_end + 1)); 
    var nc_end = int(find(value, ".", nb_end + 1)); 
    a = int(substring(value, 0, na_end)); 
    b = int(substring(value, na_end + 1, nb_end - na_end - 1)); 
    c = int(substring(value, nb_end + 1, nc_end - nb_end - 1)); 
    d = int(substring(value, nc_end + 1));