Esempio n. 1
0
 public static Entry CreateEntry(CalithaBinReader reader)
 {
     Entry entry = null;
     byte entryType = reader.ReadByte();
     switch (entryType)
     {
         case 69: // 'E'
             entry = new EmptyEntry();
             break;
         case 98: // 'b'
             entry = new ByteEntry(reader);
             break;
         case 66: // 'B'
             entry = new BooleanEntry(reader);
             break;
         case 73: // 'I'
             entry = new IntegerEntry(reader);
             break;
         case 83: // 'S'
             entry = new StringEntry(reader);
             break;
         default: //Unknown
             throw new CGTStructureException("Unknown entry type");
     }
     return entry;
 }
        public static Entry CreateEntry(CalithaBinReader reader)
        {
            Entry entry     = null;
            byte  entryType = reader.ReadByte();

            switch (entryType)
            {
            case 69:     // 'E'
                entry = new EmptyEntry();
                break;

            case 98:     // 'b'
                entry = new ByteEntry(reader);
                break;

            case 66:     // 'B'
                entry = new BooleanEntry(reader);
                break;

            case 73:     // 'I'
                entry = new IntegerEntry(reader);
                break;

            case 83:     // 'S'
                entry = new StringEntry(reader);
                break;

            default:     //Unknown
                throw new CGTStructureException("Unknown entry type");
            }
            return(entry);
        }
Esempio n. 3
0
        public int ToIntValue()
        {
            IntegerEntry entry = this as IntegerEntry;

            if (entry == null)
            {
                throw new CGTContentException("Entry is not an integer");
            }
            return(entry.Value);
        }