Beispiel #1
0
        private static object ReadAConstantValue(ILittleEndianInput in1)
        {
            byte grbit = (byte)in1.ReadByte();

            switch (grbit)
            {
            case TYPE_EMPTY:
                in1.ReadLong();     // 8 byte 'not used' field
                return(EMPTY_REPRESENTATION);

            case TYPE_NUMBER:
                return(in1.ReadDouble());

            case TYPE_STRING:
                return(StringUtil.ReadUnicodeString(in1));

            case TYPE_BOOLEAN:
                return(ReadBoolean(in1));

            case TYPE_ERROR_CODE:
                int errCode = in1.ReadUShort();
                // next 6 bytes are Unused
                in1.ReadUShort();
                in1.ReadInt();
                return(ErrorConstant.ValueOf(errCode));
            }
            throw new Exception("Unknown grbit value (" + grbit + ")");
        }
Beispiel #2
0
        public ColorGradientFormatting(ILittleEndianInput in1)
        {
            in1.ReadShort(); // Ignored
            in1.ReadByte();  // Reserved
            int numI = in1.ReadByte();
            int numG = in1.ReadByte();

            if (numI != numG)
            {
                //log.Log(POILogger.WARN, "Inconsistent Color Gradient defintion, found " + numI + " vs " + numG + " entries");
            }
            options = (byte)in1.ReadByte();

            thresholds = new ColorGradientThreshold[numI];
            for (int i = 0; i < thresholds.Length; i++)
            {
                thresholds[i] = new ColorGradientThreshold(in1);
            }
            colors = new ExtendedColor[numG];
            for (int i = 0; i < colors.Length; i++)
            {
                in1.ReadDouble(); // Slightly pointless step counter
                colors[i] = new ExtendedColor(in1);
            }
        }
Beispiel #3
0
        /** Creates new Threshold */
        protected Threshold(ILittleEndianInput in1)
        {
            type = (byte)in1.ReadByte();
            short formulaLen = in1.ReadShort();

            if (formulaLen > 0)
            {
                formula = Formula.Read(formulaLen, in1);
            }
            else
            {
                formula = Formula.Create(null);
            }
            // Value is only there for non-formula, non min/max thresholds
            if (formulaLen == 0 && type != RangeType.MIN.id &&
                type != RangeType.MAX.id)
            {
                value = in1.ReadDouble();
            }
        }
Beispiel #4
0
 private static object ReadAConstantValue(ILittleEndianInput in1)
 {
     byte grbit = (byte)in1.ReadByte();
     switch (grbit)
     {
         case TYPE_EMPTY:
             in1.ReadLong(); // 8 byte 'not used' field
             return EMPTY_REPRESENTATION;
         case TYPE_NUMBER:
             return in1.ReadDouble();
         case TYPE_STRING:
             return StringUtil.ReadUnicodeString(in1);
         case TYPE_BOOLEAN:
             return ReadBoolean(in1);
         case TYPE_ERROR_CODE:
             int errCode = in1.ReadUShort();
             // next 6 bytes are Unused
             in1.ReadUShort();
             in1.ReadInt();
             return ErrorConstant.ValueOf(errCode);
     }
     throw new Exception("Unknown grbit value (" + grbit + ")");
 }
Beispiel #5
0
 public ExtendedColor(ILittleEndianInput in1)
 {
     type = in1.ReadInt();
     if (type == TYPE_INDEXED)
     {
         colorIndex = in1.ReadInt();
     }
     else if (type == TYPE_RGB)
     {
         rgba = new byte[4];
         in1.ReadFully(rgba);
     }
     else if (type == TYPE_THEMED)
     {
         themeIndex = in1.ReadInt();
     }
     else
     {
         // Ignored
         in1.ReadInt();
     }
     tint = in1.ReadDouble();
 }
Beispiel #6
0
 /** Create a NumberPtg from a byte array Read from disk */
 public NumberPtg(ILittleEndianInput in1)
 {
     field_1_value = in1.ReadDouble();
 }
Beispiel #7
0
 /** Create a NumberPtg from a byte array Read from disk */
 public NumberPtg(ILittleEndianInput in1)
 {
     field_1_value = in1.ReadDouble();
 }
Beispiel #8
0
 /** Creates new Color Gradient Threshold */
 public ColorGradientThreshold(ILittleEndianInput in1) : base(in1)
 {
     position = in1.ReadDouble();
 }