예제 #1
0
        // create
        public virtual EsfNode CreateValueNode(EsfType typeCode, bool optimize = true)
        {
            EsfNode result = null;

            switch (typeCode)
            {
            case EsfType.BOOL:
                result = new BoolNode();
                break;

            case EsfType.INT8:
                result = new SByteNode();
                break;

            case EsfType.INT16:
                result = new ShortNode();
                break;

            case EsfType.INT32:
                result = new IntNode();
                break;

            case EsfType.INT64:
                result = new LongNode();
                break;

            case EsfType.UINT8:
                result = new ByteNode();
                break;

            case EsfType.UINT16:
                result = new UShortNode();
                break;

            case EsfType.UINT32:
                result = new UIntNode();
                break;

            case EsfType.UINT64:
                result = new ULongNode();
                break;

            case EsfType.SINGLE:
                result = new FloatNode();
                break;

            case EsfType.DOUBLE:
                result = new DoubleNode();
                break;

            case EsfType.COORD2D:
                result = new Coordinate2DNode();
                break;

            case EsfType.COORD3D:
                result = new Coordinates3DNode();
                break;

            case EsfType.UTF16:
                result = new StringNode(ReadUtf16, WriteUtf16);
                break;

            case EsfType.ASCII:
                result = new StringNode(ReadAscii, WriteUtf16);
                break;

            case EsfType.ANGLE:
                result = new UShortNode();
                break;

            default:
                throw new InvalidDataException(string.Format("Invalid type code {0:x}", typeCode));
            }
            result.TypeCode = typeCode;
            return(result);
        }
예제 #2
0
        public virtual EsfNode CreateValueNode(EsfType typeCode, bool optimize = true)
        {
            EsfNode esfNode = null;

            switch (typeCode)
            {
            case EsfType.BOOL:
                esfNode = new BoolNode();
                break;

            case EsfType.INT8:
                esfNode = new SByteNode();
                break;

            case EsfType.INT16:
                esfNode = new ShortNode();
                break;

            case EsfType.INT32:
                esfNode = new IntNode();
                break;

            case EsfType.INT64:
                esfNode = new LongNode();
                break;

            case EsfType.UINT8:
                esfNode = new ByteNode();
                break;

            case EsfType.UINT16:
                esfNode = new UShortNode();
                break;

            case EsfType.UINT32:
                esfNode = new UIntNode();
                break;

            case EsfType.UINT64:
                esfNode = new ULongNode();
                break;

            case EsfType.SINGLE:
                esfNode = new FloatNode();
                break;

            case EsfType.DOUBLE:
                esfNode = new DoubleNode();
                break;

            case EsfType.COORD2D:
                esfNode = new Coordinate2DNode();
                break;

            case EsfType.COORD3D:
                esfNode = new Coordinates3DNode();
                break;

            case EsfType.UTF16:
                esfNode = new StringNode(ReadUtf16, WriteUtf16);
                break;

            case EsfType.ASCII:
                esfNode = new StringNode(ReadAscii, WriteAscii);
                break;

            case EsfType.ANGLE:
                esfNode = new UShortNode();
                break;

            default:
                esfNode = new BoolNode();
                break;
            }

            esfNode.TypeCode = typeCode;
            return(esfNode);
        }