Exemple #1
0
        /// This method is used to deserialize the Root File Node List from the specified byte array and start index.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="reference">Specify the reference of Root File Node List.</param>
        public void DoDeserializeFromByteArray(byte[] byteArray, FileNodeChunkReference reference)
        {
            FileNodeListFragment fragment = new FileNodeListFragment(reference.CbValue);

            fragment.DoDeserializeFromByteArray(byteArray, (int)reference.StpValue);
            this.FileNodeListFragments.Add(fragment);
            this.FileNodeSequence.AddRange(fragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            FileChunkReference64x32 nextFragmentRef = fragment.nextFragment;

            while (nextFragmentRef.IsfcrNil() == false && nextFragmentRef.IsfcrZero() == false)
            {
                FileNodeListFragment nextFragment = new FileNodeListFragment(nextFragmentRef.Cb);
                nextFragment.DoDeserializeFromByteArray(byteArray, (int)nextFragmentRef.Stp);
                nextFragmentRef = nextFragment.nextFragment;
                this.FileNodeListFragments.Add(nextFragment);
                this.FileNodeSequence.AddRange(nextFragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            }

            FileNode[] objectSpaceManifestListStartArray = this.FileNodeSequence.Where(obj => obj.FileNodeID == FileNodeIDValues.ObjectSpaceManifestListStartFND).ToArray();
            if (objectSpaceManifestListStartArray.Length == 1)
            {
                this.ObjectSpaceManifestListStart = objectSpaceManifestListStartArray[0];
            }
            FileNode[] revisionManifestListRefArray = this.FileNodeSequence.Where(obj => obj.FileNodeID == FileNodeIDValues.RevisionManifestListReferenceFND).ToArray();
            foreach (FileNode revisionManifestListNode in revisionManifestListRefArray)
            {
                RevisionManifestListReferenceFND revisionManifestListReferenceFND = revisionManifestListNode.fnd as RevisionManifestListReferenceFND;
                RevisionManifestList             revisionManifestList             = new MS_ONESTORE.RevisionManifestList();
                revisionManifestList.DoDeserializeFromByteArray(byteArray, revisionManifestListReferenceFND.refField);
                this.RevisionManifestList.Add(revisionManifestList);
            }
        }
        /// This method is used to deserialize the Object Group from the specified byte array and start index.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="reference">Specify the reference of Object Group.</param>
        public void DoDeserializeFromByteArray(byte[] byteArray, FileNodeChunkReference reference)
        {
            FileNodeListFragment fragment = new FileNodeListFragment(reference.CbValue);

            fragment.DoDeserializeFromByteArray(byteArray, (int)reference.StpValue);
            this.FileNodeListFragments.Add(fragment);
            this.FileNodeSequence.AddRange(fragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            FileChunkReference64x32 nextFragmentRef = fragment.nextFragment;

            while (nextFragmentRef.IsfcrNil() == false && nextFragmentRef.IsfcrZero() == false)
            {
                FileNodeListFragment nextFragment = new FileNodeListFragment(nextFragmentRef.Cb);
                nextFragment.DoDeserializeFromByteArray(byteArray, (int)nextFragmentRef.Stp);
                nextFragmentRef = nextFragment.nextFragment;
                this.FileNodeListFragments.Add(nextFragment);
                this.FileNodeSequence.AddRange(nextFragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            }
        }
        /// This method is used to deserialize the Revision Manifest List from the specified byte array and start index.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="reference">Specify the reference of Revision Manifest List.</param>
        public void DoDeserializeFromByteArray(byte[] byteArray, FileNodeChunkReference reference)
        {
            FileNodeListFragment fragment = new FileNodeListFragment(reference.CbValue);

            fragment.DoDeserializeFromByteArray(byteArray, (int)reference.StpValue);
            this.FileNodeListFragments.Add(fragment);
            this.FileNodeSequence.AddRange(fragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            FileChunkReference64x32 nextFragmentRef = fragment.nextFragment;

            while (nextFragmentRef.IsfcrNil() == false && nextFragmentRef.IsfcrZero() == false)
            {
                FileNodeListFragment nextFragment = new FileNodeListFragment(nextFragmentRef.Cb);
                nextFragment.DoDeserializeFromByteArray(byteArray, (int)nextFragmentRef.Stp);
                nextFragmentRef = nextFragment.nextFragment;
                this.FileNodeListFragments.Add(nextFragment);
                this.FileNodeSequence.AddRange(nextFragment.rgFileNodes.Where(f => f.FileNodeID != FileNodeIDValues.ChunkTerminatorFND).ToArray());
            }

            RevisionManifest revisionManifest = null;

            foreach (FileNode fileNode in this.FileNodeSequence)
            {
                if (fileNode.FileNodeID == FileNodeIDValues.RevisionRoleDeclarationFND)
                {
                    this.RevisionRoleDeclaration.Add(fileNode);
                    continue;
                }
                if (fileNode.FileNodeID == FileNodeIDValues.RevisionRoleAndContextDeclarationFND)
                {
                    this.RevisionRoleAndContextDeclaration.Add(fileNode);
                    continue;
                }
                if (fileNode.FileNodeID == FileNodeIDValues.RevisionManifestStart6FND ||
                    fileNode.FileNodeID == FileNodeIDValues.RevisionManifestStart7FND ||
                    fileNode.FileNodeID == FileNodeIDValues.RevisionManifestStart4FND)
                {
                    revisionManifest = new RevisionManifest();
                    revisionManifest.FileNodeSequence.Add(fileNode);
                }
                else if (fileNode.FileNodeID == FileNodeIDValues.RevisionManifestEndFND)
                {
                    revisionManifest.FileNodeSequence.Add(fileNode);
                    this.RevisionManifests.Add(revisionManifest);
                    revisionManifest = new RevisionManifest();
                }
                else if (fileNode.FileNodeID != FileNodeIDValues.ChunkTerminatorFND &&
                         fileNode.FileNodeID != FileNodeIDValues.RevisionManifestListStartFND)
                {
                    if (fileNode.FileNodeID == FileNodeIDValues.ObjectDataEncryptionKeyV2FNDX)
                    {
                        OneNoteRevisionStoreFile.IsEncryption = true;
                    }

                    revisionManifest.FileNodeSequence.Add(fileNode);
                    if (fileNode.FileNodeID == FileNodeIDValues.ObjectGroupListReferenceFND)
                    {
                        ObjectGroupListReferenceFND objectGroupListRef = fileNode.fnd as ObjectGroupListReferenceFND;
                        ObjectGroupList             objectGroupList    = new ObjectGroupList();
                        objectGroupList.DoDeserializeFromByteArray(byteArray, objectGroupListRef.Ref);
                        this.ObjectGroupList.Add(objectGroupList);
                    }
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// This method is used to deserialize the RevisionManifestListReferenceFND object from the specified byte array and start index.
        /// </summary>
        /// <param name="byteArray">Specify the byte array.</param>
        /// <param name="startIndex">Specify the start index from the byte array.</param>
        /// <returns>Return the length in byte of the RevisionManifestListReferenceFND object.</returns>
        public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            this.refField = new FileNodeChunkReference(this.stpFormat, this.cbFormat);

            return(this.refField.DoDeserializeFromByteArray(byteArray, startIndex));
        }