public static Substitution DecodeSubstitution(byte[] data, BigEndianBitConverter converter, int offset = 0) { short subId = converter.ToInt16(data, offset); if (subId == 0) { DataString dataString = new DataString(); string text = (string)dataString.decode(data, converter, offset + 2); return(new StringSubstitution(text)); } else if (subId == 2) { DataItem dataItem = new DataItem(); Item item = (Item)dataItem.decode(data, converter, offset + 2); return(new ItemSubstitution(item)); } else { return(new StringSubstitution("")); } }