Пример #1
0
        /*
         *  Reads the type data prefixed to this key.
         *  If ignore is true, it will return null to save the computation of converting
         *  the string to a Type.
         */
        protected override Type ReadKeyPrefix(bool ignoreType = false)
        {
            Read7BitEncodedInt(); // Read length because at this point we no longer need it.

            StartReadObject();

            Type dataType = null;

            string propertyName = ReadPropertyName();

            if (propertyName == ES3Type.typeFieldName)
            {
                Read7BitEncodedInt();  // Read length because at this point we no longer need it.
                baseReader.ReadByte(); // Read the Type byte as we won't need this.
                string typeString = baseReader.ReadString();
                dataType     = ignoreType ? null : ES3Reflection.GetType(typeString);
                propertyName = ReadPropertyName();
            }

            if (propertyName != "value")
            {
                throw new FormatException("This data is not Easy Save Key Value data. Expected property name \"value\", found \"" + propertyName + "\".");
            }

            return(dataType);
        }
Пример #2
0
        /*
         *  Reads the type data prefixed to this key.
         *  If ignore is true, it will return null to save the computation of converting
         *  the string to a Type.
         */
        protected override Type ReadKeyPrefix(bool ignoreType = false)
        {
            StartReadObject();

            Type dataType = null;

            string propertyName = ReadPropertyName();

            if (propertyName == ES3Type.typeFieldName)
            {
                string typeString = Read_string();
                dataType     = ignoreType ? null : ES3Reflection.GetType(typeString);
                propertyName = ReadPropertyName();
            }

            if (propertyName != "value")
            {
                throw new FormatException("This data is not Easy Save Key Value data. Expected property name \"value\", found \"" + propertyName + "\".");
            }

            return(dataType);
        }