コード例 #1
0
ファイル: DirectoryEntry.cs プロジェクト: ipbi/sones
        private object Deserialize(ref SerializationReader mySerializationReader, DirectoryEntry myDirectoryEntry)
        {
            try
            {

                #region Read the Inlinedata

                myDirectoryEntry._InlineData = mySerializationReader.ReadByteArray();

                #endregion

                #region Read the INodePositions

                var _NumOfINodePositions = mySerializationReader.ReadUInt32();

                if (_NumOfINodePositions > 0)
                {
                    for (var j = 0UL; j < _NumOfINodePositions; j++)
                    {
                        StorageUUID ID = new StorageUUID();
                        ID.Deserialize(ref mySerializationReader);
                        myDirectoryEntry._INodePositions.Add(new ExtendedPosition(ID, mySerializationReader.ReadUInt64()));
                    }
                }

                #endregion

                #region Read the ObjectStreamsList

                var _NumberOfObjectStreamTypes = mySerializationReader.ReadUInt32();

                if (_NumberOfObjectStreamTypes > 0)
                {
                    for (var j = 0UL; j < _NumberOfObjectStreamTypes; j++)
                        myDirectoryEntry._ObjectStreamsList.Add(mySerializationReader.ReadString());
                }

                #endregion

            }

            catch (GraphFSException e)
            {
                throw new GraphFSException("DirectoryEntry could not be deserialized!\n\n" + e);
            }

            myDirectoryEntry.isDirty = true;

            return myDirectoryEntry;
        }
コード例 #2
0
ファイル: DirectoryEntry.cs プロジェクト: TheByte/sones
        private object Deserialize(ref SerializationReader mySerializationReader, DirectoryEntry myDirectoryEntry)
        {
            try
            {

                #region Read the Inlinedata

                myDirectoryEntry._InlineData = mySerializationReader.ReadByteArray();

                #region Estimated Size

                if (myDirectoryEntry._InlineData != null)
                {
                    myDirectoryEntry._estimatedSize += Convert.ToUInt64(myDirectoryEntry._InlineData.Length) * EstimatedSizeConstants.Byte;
                }

                #endregion

                #endregion

                #region Read the INodePositions

                #region Estimated Size

                myDirectoryEntry._estimatedSize += EstimatedSizeConstants.HashSet;

                #endregion

                var _NumOfINodePositions = mySerializationReader.ReadUInt32();

                if (_NumOfINodePositions > 0)
                {
                    for (var j = 0UL; j < _NumOfINodePositions; j++)
                    {
                        StorageUUID ID = new StorageUUID();
                        ID.Deserialize(ref mySerializationReader);
                        myDirectoryEntry._INodePositions.Add(new ExtendedPosition(ID, mySerializationReader.ReadUInt64()));

                        #region Estimated Size

                        myDirectoryEntry._estimatedSize += EstimatedSizeConstants.ExtendedPosition;

                        #endregion

                    }
                }

                #endregion

                #region Read the ObjectStreamsList

                #region Estimated Size

                myDirectoryEntry._estimatedSize += EstimatedSizeConstants.HashSet;

                #endregion

                var _NumberOfObjectStreamTypes = mySerializationReader.ReadUInt32();

                if (_NumberOfObjectStreamTypes > 0)
                {
                    for (var j = 0UL; j < _NumberOfObjectStreamTypes; j++)
                    {
                        myDirectoryEntry._ObjectStreamsList.Add(mySerializationReader.ReadString());

                        #region Estimated Size

                        myDirectoryEntry._estimatedSize += EstimatedSizeConstants.Char * EstimatedSizeConstants.EstimatedObjectStreamNameLength;

                        #endregion

                    }
                }

                #endregion

            }

            catch (GraphFSException e)
            {
                throw new GraphFSException("DirectoryEntry could not be deserialized!\n\n" + e);
            }

            myDirectoryEntry.isDirty = true;

            return myDirectoryEntry;
        }