Ejemplo n.º 1
0
        public void SaveValue(EndianIO IO, int parentOffset)
        {
            //Go to the required offset
            IO.Out.BaseStream.Position = (parentOffset + IdentData.Offset) - 12;

            //Get new ident-tag index
            if (cmbxName.Text != "<<null>>")
            {
                //Get the index using the tagname and class
                int index = HMap.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text);
                //If the index is null...
                if (index == -1)
                {
                    goto WriteNullIdent;
                }
                //Write the tagref
                IO.Out.WriteAsciiString(HMap.IndexItems[index].Class, 4);
                //Skip the 8 byte gap.
                IO.Out.BaseStream.Position += 8;
                //Write the ident
                IO.Out.Write(HMap.IndexItems[index].Ident);
                //Returned
                return;
            }
            //Otherwise...

WriteNullIdent:
            ;
            //Jump to the ident offset
            IO.Out.BaseStream.Position += 12;
            //Write the ident
            IO.Out.Write(-1);
        }
Ejemplo n.º 2
0
 public RTHData.RTHDataBlock ReturnRTHDataBlock(int parentMemoryOffset)
 {
     //Initialize our RTH Data Block
     RTHData.RTHDataBlock RTH_Data_Block = new RTHData.RTHDataBlock();
     //Set our memory offset
     RTH_Data_Block.Memory_Offset = (uint)(parentMemoryOffset + IdentData.Offset) - 12;
     //Get our class data
     byte[] classData = ExtraFunctions.StringToBytes(cmbxClass.Text);
     //Get our blank data
     byte[] blankData = new byte[8];
     //Create our identData array
     byte[] identData = null;
     //If the value isn't null
     if (cmbxName.Text != "<<null>>")
     {
         //Assign our ident
         identData =
             ExtraFunctions.HexStringToBytes(
                 HMap.IndexItems[HMap.GetTagIndexByClassAndName(cmbxClass.Text, cmbxName.Text)].Ident.ToString("X"));
     }
     else
     {
         //Otherwise, if it is, we assign a null value
         identData = new byte[4] {
             0xFF, 0xFF, 0xFF, 0xFF
         };
     }
     RTH_Data_Block.Data_Block =
         ExtraFunctions.HexStringToBytes(ExtraFunctions.BytesToHexString(classData) +
                                         ExtraFunctions.BytesToHexString(blankData) +
                                         ExtraFunctions.BytesToHexString(identData));
     //Set our block size
     RTH_Data_Block.Block_Size = 16;
     //Return the RTH Data Block instance
     return(RTH_Data_Block);
 }