コード例 #1
0
        private DefaultPortableReader CreateReader(IBufferObjectDataInput input, int factoryId, int classId, int version,
                                                   int portableVersion)
        {
            var effectiveVersion = version;

            if (version < 0)
            {
                effectiveVersion = _context.GetVersion();
            }
            var cd = _context.LookupClassDefinition(factoryId, classId, effectiveVersion);

            if (cd == null)
            {
                var begin = input.Position();
                cd = _context.ReadClassDefinition(input, factoryId, classId, effectiveVersion);
                input.Position(begin);
            }
            DefaultPortableReader reader;

            if (portableVersion == effectiveVersion)
            {
                reader = new DefaultPortableReader(this, input, cd);
            }
            else
            {
                reader = new MorphingPortableReader(this, input, cd);
            }
            return(reader);
        }
コード例 #2
0
        /// <exception cref="System.IO.IOException"/>
        private IPortable Read(IBufferObjectDataInput @in, int factoryId, int classId)
        {
            int                   version         = @in.ReadInt();
            IPortable             portable        = CreateNewPortableInstance(factoryId, classId);
            int                   portableVersion = FindPortableVersion(factoryId, classId, portable);
            DefaultPortableReader reader          = CreateReader(@in, factoryId, classId, version, portableVersion);

            portable.ReadPortable(reader);
            reader.End();
            return(portable);
        }