public void TestFloatingAccesor()
        {
            Assert.AreEqual(17, FloatingAccessor.Create(new Byte[] { 17 }, Schema2.ComponentType.UNSIGNED_BYTE, false)[0]);
            Assert.AreEqual(17, FloatingAccessor.Create(new Byte[] { 17, 0 }, Schema2.ComponentType.UNSIGNED_SHORT, false)[0]);

            Assert.AreEqual(17, FloatingAccessor.Create(new Byte[] { 17 }, Schema2.ComponentType.BYTE, false)[0]);
            Assert.AreEqual(17, FloatingAccessor.Create(new Byte[] { 17, 0 }, Schema2.ComponentType.SHORT, false)[0]);

            Assert.AreEqual(1, FloatingAccessor.Create(new Byte[] { 255 }, Schema2.ComponentType.UNSIGNED_BYTE, true)[0]);
            Assert.AreEqual(1, FloatingAccessor.Create(new Byte[] { 127 }, Schema2.ComponentType.BYTE, true)[0]);
            Assert.AreEqual(-1, FloatingAccessor.Create(new Byte[] { 128 }, Schema2.ComponentType.BYTE, true)[0]);

            Assert.AreEqual(1, FloatingAccessor.Create(new Byte[] { 255, 255 }, Schema2.ComponentType.UNSIGNED_SHORT, true)[0]);
            Assert.AreEqual(1, FloatingAccessor.Create(new Byte[] { 255, 127 }, Schema2.ComponentType.SHORT, true)[0]);
            Assert.AreEqual(-1, FloatingAccessor.Create(new Byte[] { 0, 128 }, Schema2.ComponentType.SHORT, true)[0]);

            Assert.AreEqual(17, FloatingAccessor.Create(new Byte[] { 17, 0, 0, 0 }, Schema2.ComponentType.UNSIGNED_INT, false)[0]);
            Assert.AreEqual(1, FloatingAccessor.Create(new Byte[] { 0, 0, 0x80, 0x3f }, Schema2.ComponentType.FLOAT, false)[0]);
        }
        public static FloatingAccessor Create(BYTES data, Schema2.ComponentType type, Boolean normalized)
        {
            var accessor = new FloatingAccessor {
                _Data = data
            };

            if (type == Schema2.ComponentType.FLOAT)
            {
                accessor._Setter = accessor._SetValue <Single>;
                accessor._Getter = accessor._GetValue <Single>;
                return(accessor);
            }

            if (normalized)
            {
                switch (type)
                {
                case Schema2.ComponentType.BYTE:
                {
                    accessor._Setter = accessor._SetNormalizedS8;
                    accessor._Getter = accessor._GetNormalizedS8;
                    return(accessor);
                }

                case Schema2.ComponentType.UNSIGNED_BYTE:
                {
                    accessor._Setter = accessor._SetNormalizedU8;
                    accessor._Getter = accessor._GetNormalizedU8;
                    return(accessor);
                }

                case Schema2.ComponentType.SHORT:
                {
                    accessor._Setter = accessor._SetNormalizedS16;
                    accessor._Getter = accessor._GetNormalizedS16;
                    return(accessor);
                }

                case Schema2.ComponentType.UNSIGNED_SHORT:
                {
                    accessor._Setter = accessor._SetNormalizedU16;
                    accessor._Getter = accessor._GetNormalizedU16;
                    return(accessor);
                }
                }
            }
            else
            {
                switch (type)
                {
                case Schema2.ComponentType.BYTE:
                {
                    accessor._Setter = accessor._SetValueS8;
                    accessor._Getter = accessor._GetValueS8;
                    return(accessor);
                }

                case Schema2.ComponentType.UNSIGNED_BYTE:
                {
                    accessor._Setter = accessor._SetValueU8;
                    accessor._Getter = accessor._GetValueU8;
                    return(accessor);
                }

                case Schema2.ComponentType.SHORT:
                {
                    accessor._Setter = accessor._SetValueS16;
                    accessor._Getter = accessor._GetValueS16;
                    return(accessor);
                }

                case Schema2.ComponentType.UNSIGNED_SHORT:
                {
                    accessor._Setter = accessor._SetValueU16;
                    accessor._Getter = accessor._GetValueU16;
                    return(accessor);
                }

                case Schema2.ComponentType.UNSIGNED_INT:
                {
                    accessor._Setter = accessor._SetValueU32;
                    accessor._Getter = accessor._GetValueU32;
                    return(accessor);
                }

                case Schema2.ComponentType.FLOAT:
                    break;
                }
            }

            throw new NotSupportedException();
        }