예제 #1
0
        int ISerializationContext.RegisterInstanceInfo(SerializeInstanceInfo obj)
        {
            var id = _serializedInstances.Count;

            _serializedInstances.Add(obj);
            return(id);
        }
예제 #2
0
        private SerializeInstanceInfo GetUninitializedTypeInfo(SerializeTypeEnum type)
        {
            SerializeInstanceInfo info = null;

            switch (type)
            {
            case SerializeTypeEnum.Null:
            case SerializeTypeEnum.Byte:
            case SerializeTypeEnum.Bool:
            case SerializeTypeEnum.Int16:
            case SerializeTypeEnum.Int32:
            case SerializeTypeEnum.Int64:
            case SerializeTypeEnum.UInt16:
            case SerializeTypeEnum.UInt32:
            case SerializeTypeEnum.UInt64:
            case SerializeTypeEnum.Float:
            case SerializeTypeEnum.Double:
            case SerializeTypeEnum.String:
            {
                info = new PrimitiveTypeInfo(type, this);
            }
            break;

            case SerializeTypeEnum.Enum:
            {
                info = new EnumInfo();
            }
            break;

            case SerializeTypeEnum.ArrayOfPrimitives:
            {
                info = new ArrayOfPrimitivesInfo(this);
            }
            break;

            case SerializeTypeEnum.ArrayOfByref:
            {
                info = new ArrayOfByRefInfo(this);
            }
            break;

            case SerializeTypeEnum.Custom:
            {
                info = new CustomInfo(this);
            }
            break;

            case SerializeTypeEnum.SerializedYet:
            {
                info = new SerializedYetInfo(-1);
            }
            break;

            default:
                break;
            }
            return(info);
        }