/// <summary>
        /// This method is used to deserialize the ObjectSpaceManifestRootFND 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 ObjectSpaceManifestRootFND object.</returns>
        public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.gosidRoot = new ExtendedGUID();
            int len = this.gosidRoot.DoDeserializeFromByteArray(byteArray, index);

            index += len;
            return(index - startIndex);
        }
        /// <summary>
        /// This method is used to deserialize the ObjectSpaceManifestListReferenceFND 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 ObjectSpaceManifestListReferenceFND object.</returns>
        public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.refField = new FileNodeChunkReference(this.stpFormat, this.cbFormat);
            int len = this.refField.DoDeserializeFromByteArray(byteArray, index);

            index     += len;
            this.gosid = new ExtendedGUID();
            len        = this.gosid.DoDeserializeFromByteArray(byteArray, index);
            index     += len;
            return(index - startIndex);
        }
Example #3
0
        /// <summary>
        /// This method is used to deserialize the RevisionRoleAndContextDeclarationFND 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 RevisionRoleAndContextDeclarationFND object.</returns>
        public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.Base = new RevisionRoleDeclarationFND();
            int len = this.Base.DoDeserializeFromByteArray(byteArray, index);

            index      += len;
            this.gctxid = new ExtendedGUID();
            len         = this.gctxid.DoDeserializeFromByteArray(byteArray, index);
            index      += len;

            return(index - startIndex);
        }
Example #4
0
        /// <summary>
        /// XOR two ExtendedGUID instances.
        /// </summary>
        /// <param name="exGuid1">The first ExtendedGUID instance.</param>
        /// <param name="exGuid2">The second ExtendedGUID instance.</param>
        /// <returns>Returns the result of XOR two ExtendedGUID instances.</returns>
        public static ExtendedGUID XORExtendedGUID(ExtendedGUID exGuid1, ExtendedGUID exGuid2)
        {
            byte[] exGuid1Buffer = exGuid1.SerializeToByteList().ToArray();
            byte[] exGuid2Buffer = exGuid2.SerializeToByteList().ToArray();
            byte[] resultBuffer  = new byte[exGuid1Buffer.Length];

            for (int i = 0; i < exGuid1Buffer.Length; i++)
            {
                resultBuffer[i] = (byte)(exGuid1Buffer[i] ^ exGuid2Buffer[2]);
            }
            ExtendedGUID resultExGuid = new ExtendedGUID();

            resultExGuid.DoDeserializeFromByteArray(resultBuffer, 0);
            return(resultExGuid);
        }
        public void MSONESTORE_S02_TC01_LoadOneNoteFileWithFileData()
        {
            string fileName = Common.GetConfigurationPropertyValue("OneFileWithFileData", Site);

            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(fileName);

            for (int i = 0; i <= file.RootFileNodeList.FileNodeListFragments.Count - 1; i++)
            {
                bool isDifferent = file.RootFileNodeList.FileNodeListFragments[i].Header.FileNodeListID != file.RootFileNodeList.FileNodeListFragments[i].Header.nFragmentSequence;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R3911
                Site.CaptureRequirementIfIsTrue(
                    isDifferent,
                    3911,
                    @"[In FileNodeListHeader] The pair of FileNodeListID and nFragmentSequence field in FileNodeListFragment structures in the file, is different.");
            }

            List <RevisionManifest> revisManifestList = new List <RevisionManifest>();

            foreach (ObjectSpaceManifestList objSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revManifestList in objSpaceManifestList.RevisionManifestList)
                {
                    revisManifestList.AddRange(revManifestList.RevisionManifests);
                }
            }

            List <ExtendedGUID> ridRevisionManifestStart6FND          = new List <ExtendedGUID>();
            List <ExtendedGUID> ridDependentRevisionManifestStart6FND = new List <ExtendedGUID>();
            List <ExtendedGUID> ridRevisionManifestStart7FND          = new List <ExtendedGUID>();
            List <ExtendedGUID> ridDependentRevisionManifestStart7FND = new List <ExtendedGUID>();
            List <uint>         odcsDefault = new List <uint>();

            for (int i = 0; i < revisManifestList.Count; i++)
            {
                for (int j = 0; j < revisManifestList[i].FileNodeSequence.Count; j++)
                {
                    FileNode revision = revisManifestList[i].FileNodeSequence[j];

                    if (revision.FileNodeID == FileNodeIDValues.RevisionManifestStart6FND)
                    {
                        RevisionManifestStart6FND fnd = revision.fnd as RevisionManifestStart6FND;
                        ridRevisionManifestStart6FND.Add(((RevisionManifestStart6FND)revision.fnd).rid);
                        ridDependentRevisionManifestStart6FND.Add(((RevisionManifestStart6FND)revision.fnd).ridDependent);
                        odcsDefault.Add(((RevisionManifestStart6FND)revision.fnd).odcsDefault);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.RevisionManifestStart7FND)
                    {
                        RevisionManifestStart7FND fnd = revision.fnd as RevisionManifestStart7FND;
                        ridRevisionManifestStart7FND.Add(((RevisionManifestStart7FND)revision.fnd).Base.rid);
                        ridDependentRevisionManifestStart7FND.Add(((RevisionManifestStart7FND)revision.fnd).Base.ridDependent);
                    }
                }
            }

            for (int i = 0; i < odcsDefault.Count - 1; i++)
            {
                // Verify MS-ONESTORE requirement: MS-ONESTORE_R535
                Site.CaptureRequirementIfAreEqual <uint>(
                    odcsDefault[i],
                    odcsDefault[i + 1],
                    535,
                    @"[In RevisionManifestStart6FND] [odcsDefault] MUST specify the same type of data encoding as used in the dependency revision (section 2.1.8), if one was specified in the ridDependent field.");
            }

            ExtendedGUID zeroExtendGuid = new ExtendedGUID();

            zeroExtendGuid.Guid = Guid.Empty;
            zeroExtendGuid.N    = 0;

            for (int i = 0; i < ridRevisionManifestStart6FND.Count - 1; i++)
            {
                for (int j = i + 1; j < ridRevisionManifestStart6FND.Count; j++)
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52501
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        ridRevisionManifestStart6FND[i],
                        ridRevisionManifestStart6FND[j],
                        52501,
                        @"[In RevisionManifestStart6FND] The rid of two RevisionManifestStart6FND in revision manifest list is different.");
                }

                if (ridDependentRevisionManifestStart6FND[i].Equals(zeroExtendGuid))
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R527
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        zeroExtendGuid,
                        ridRevisionManifestStart6FND[i],
                        527,
                        @"[In RevisionManifestStart6FND] [ridDependent] If the value is ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                "", then this revision manifest has no dependency revision. ");
                }
                else
                {
                    if (!ridDependentRevisionManifestStart6FND[i + 1].Equals(zeroExtendGuid))
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R528
                        Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                            ridRevisionManifestStart6FND[i],
                            ridDependentRevisionManifestStart6FND[i + 1],
                            528,
                            @"[In RevisionManifestStart6FND] [ridDependent] Otherwise[If the value is not ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                    ""], this value MUST be equal to the RevisionManifestStart6FND.rid field [or the RevisionManifestStart7FND.base.rid field] of a previous revision manifest within this revision manifest list.");
                    }
                }
            }

            for (int i = 0; i < ridRevisionManifestStart7FND.Count - 1; i++)
            {
                for (int j = i + 1; j < ridRevisionManifestStart7FND.Count; j++)
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52502
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        ridRevisionManifestStart7FND[i],
                        ridRevisionManifestStart7FND[i + 1],
                        52502,
                        @"[In RevisionManifestStart6FND] The rid of two RevisionManifestStart7FND in revision manifest list is different.");
                }

                if (!ridDependentRevisionManifestStart7FND[i].Equals(zeroExtendGuid) && !ridDependentRevisionManifestStart7FND[i + 1].Equals(zeroExtendGuid))
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52801
                    Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                        ridRevisionManifestStart7FND[i],
                        ridDependentRevisionManifestStart7FND[i + 1],
                        52801,
                        @"[In RevisionManifestStart6FND] [ridDependent] Otherwise[If the value is not ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                    ""], this value MUST be equal to [the RevisionManifestStart6FND.rid field or] the RevisionManifestStart7FND.base.rid field of a previous revision manifest within this revision manifest list.");
                }
            }
            foreach (ObjectSpaceManifestList objectSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revisionManifestList in objectSpaceManifestList.RevisionManifestList)
                {
                    if (revisionManifestList.FileNodeListFragments.Count > 1)
                    {
                        for (int i = 0; i < revisionManifestList.FileNodeListFragments.Count - 1; i++)
                        {
                            for (int j = i + 1; j < revisionManifestList.FileNodeListFragments.Count; j++)
                            {
                                // Verify MS-ONESTORE requirement: MS-ONESTORE_R366
                                Site.CaptureRequirementIfAreEqual <uint>(
                                    revisionManifestList.FileNodeListFragments[i].Header.FileNodeListID,
                                    revisionManifestList.FileNodeListFragments[j].Header.FileNodeListID,
                                    366,
                                    @"[In FileNodeListFragment] All fragments in the same file node list MUST have the same FileNodeListFragment.header.FileNodeListID field.");
                            }
                        }
                    }

                    foreach (FileNodeListFragment fileNodeListFragment in revisionManifestList.FileNodeListFragments)
                    {
                        FileChunkReference64x32 nextFragment = fileNodeListFragment.nextFragment;
                        if ((uint)fileNodeListFragment.rgFileNodes[fileNodeListFragment.rgFileNodes.Count - 1].FileNodeID == 0xFF)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R373
                            Site.CaptureRequirementIfIsInstanceOfType(
                                nextFragment,
                                typeof(FileChunkReference64x32),
                                373,
                                @"[In FileNodeListFragment] [rgFileNodes If a ChunkTerminatorFND structure is present, the value of the nextFragment field MUST be a valid FileChunkReference64x32 structure (section 2.2.4.4) to the next FileNodeListFragment structure.");
                        }

                        if (nextFragment == revisionManifestList.FileNodeListFragments[revisionManifestList.FileNodeListFragments.Count - 1].nextFragment)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R379
                            Site.CaptureRequirementIfIsTrue(
                                nextFragment.IsfcrNil(),
                                379,
                                @"[In FileNodeListFragment] If this is the last fragment, the value of the nextFragment field MUST be ""fcrNil"" (see section 2.2.4). ");
                        }
                        else
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R380
                            Site.CaptureRequirementIfIsFalse(
                                nextFragment.IsfcrZero() || nextFragment.IsfcrNil(),
                                380,
                                @"[In FileNodeListFragment] Otherwise [If this is not the last fragment] the value of the nextFragment.stp field MUST specify the location of a valid FileNodeListFragment structure, and the value of the nextFragment.cb field MUST be equal to the size of the referenced fragment including the FileNodeListFragment.header field and the FileNodeListFragment.footer field.");
                        }
                    }
                }
            }

            bool isFileNode = false;

            foreach (FileNode fileDataStoreList in file.RootFileNodeList.FileDataStoreListReference)
            {
                FileDataStoreListReferenceFND fnd = fileDataStoreList.fnd as FileDataStoreListReferenceFND;

                for (int i = 0; i < fnd.fileNodeListFragment.rgFileNodes.Count - 1; i++)
                {
                    for (int j = i + 1; j < fnd.fileNodeListFragment.rgFileNodes.Count; j++)
                    {
                        FileDataStoreObjectReferenceFND objfnd1 = fnd.fileNodeListFragment.rgFileNodes[i].fnd as FileDataStoreObjectReferenceFND;
                        FileDataStoreObjectReferenceFND objfnd2 = fnd.fileNodeListFragment.rgFileNodes[j].fnd as FileDataStoreObjectReferenceFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R63701
                        Site.CaptureRequirementIfAreNotEqual <Guid>(
                            objfnd1.guidReference,
                            objfnd2.guidReference,
                            63701,
                            @"[In FileDataStoreObjectReferenceFND] The guidReference is different for two FileDataStoreObjectReferenceFND structures.");
                    }
                }

                isFileNode = true;

                for (int k = 0; k < fnd.fileNodeListFragment.rgFileNodes.Count; k++)
                {
                    FileNode fileNode = fnd.fileNodeListFragment.rgFileNodes[k];
                    if ((uint)fileNode.FileNodeID != 0x094)
                    {
                        isFileNode = false;
                        break;
                    }

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R628
                    Site.CaptureRequirementIfIsTrue(
                        isFileNode,
                        628,
                        @"[In FileDataStoreListReferenceFND] The referenced file node list MUST contain only FileNode structures with a FileNodeID field value equal to 00x094 (FileDataStoreObjectReferenceFND structure). ");

                    //If MS-ONESTORE_R628 is verified successfully and according to the definition of FileDataStoreObjectReferenceFND, MS-ONESTORE_R33 can be verified directlly.
                    //Verify MS-ONESTORE requirement: MS-ONESTORE_R633
                    Site.CaptureRequirement(
                        633,
                        @"[[In FileDataStoreObjectReferenceFND] All such FileNode structures MUST be contained in the file node list (section 2.4) specified by a FileDataStoreListReferenceFND structure (section 2.5.21).");
                }
            }

            int objectSpaceCount = file.RootFileNodeList.ObjectSpaceManifestList.Count;

            for (int i = 0; i < file.RootFileNodeList.ObjectSpaceManifestList.Count; i++)
            {
                ObjectSpaceManifestList objectSpace = file.RootFileNodeList.ObjectSpaceManifestList[i];

                for (int j = 0; j < objectSpace.RevisionManifestList[0].ObjectGroupList.Count; j++)
                {
                    ObjectGroupList objectGroupList = objectSpace.RevisionManifestList[0].ObjectGroupList[j];
                    FileNode[]      fileNodes       = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ReadOnlyObjectDeclaration2RefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ReadOnlyObjectDeclaration2RefCountFND fnd = node.fnd as ReadOnlyObjectDeclaration2RefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R68
                        Site.CaptureRequirementIfIsTrue(
                            (uint)node.FileNodeID == 0x0C4 && fnd.Base.body.jcid.IsReadOnly == 1,
                            68,
                            @"[In Object Space Object] If the value of the JCID.IsReadOnly field is ""true"" then the value of the FileNode.FileNodeID field MUST be 0x0C4 (ReadOnlyObjectDeclaration2RefCountFND structure, section 2.5.29) [or 0x0C5 (ReadOnlyObjectDeclaration2LargeRefCountFND structure, section 2.5.30).]");

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R703
                        Site.CaptureRequirementIfIsNotNull(
                            fnd.Base,
                            703,
                            @"[In ReadOnlyObjectDeclaration2RefCountFND] If this object is revised, all declarations of this object MUST specify identical data. ");
                    }

                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ObjectDeclarationFileData3RefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ObjectDeclarationFileData3RefCountFND fnd = node.fnd as ObjectDeclarationFileData3RefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R71
                        Site.CaptureRequirementIfIsTrue(
                            (uint)node.FileNodeID == 0x072 && fnd.jcid.IsFileData == 1,
                            71,
                            @"[In Object Space Object]If the value of the JCID.IsFileData field is ""true"" then the value of the FileNode.FileNodeID field MUST be 0x072 (ObjectDeclarationFileData3RefCountFND structure, section 2.5.27) [or 0x073 (ObjectDeclarationFileData3LargeRefCountFND structure, section 2.5.28). ]");
                    }

                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ReadOnlyObjectDeclaration2LargeRefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ReadOnlyObjectDeclaration2LargeRefCountFND fnd = node.fnd as ReadOnlyObjectDeclaration2LargeRefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R710
                        Site.CaptureRequirementIfIsNotNull(
                            fnd.Base,
                            710,
                            @"[In ReadOnlyObjectDeclaration2LargeRefCountFND] If this object is revised, all declarations of this object MUST specify identical data. ");
                    }
                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.DataSignatureGroupDefinitionFND).ToArray();

                    List <ExtendedGUID> dataSignatureGroupdefinitionFND = new List <ExtendedGUID>();

                    for (int k = 0; k < fileNodes.Length - 1; k++)
                    {
                        DataSignatureGroupDefinitionFND fnd = fileNodes[k].fnd as DataSignatureGroupDefinitionFND;
                        if (!fnd.DataSignatureGroup.Equals(zeroExtendGuid))
                        {
                            dataSignatureGroupdefinitionFND.Add(fnd.DataSignatureGroup);
                        }
                    }

                    for (int k = 0; k < dataSignatureGroupdefinitionFND.Count - 1; k++)
                    {
                        for (int h = k + 1; h < dataSignatureGroupdefinitionFND.Count; h++)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R72701
                            Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                                dataSignatureGroupdefinitionFND[k],
                                dataSignatureGroupdefinitionFND[h],
                                72701,
                                @"[In DataSignatureGroupDefinitionFND] DataSignatureGroup (20 bytes):All declarations of an object (section 2.1.5) with the same identity and the same DataSignatureGroup field not equal to {{00000000-0000-0000-0000-000000000000}, 0} MUST have the same data.");
                        }
                    }
                }
            }
        }
        public void MSONESTORE_S02_TC02_LoadOnetocFile()
        {
            string fileName = Common.GetConfigurationPropertyValue("OnetocFileLocal", Site);

            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(fileName);

            List <RevisionManifest> revisionManifestList = new List <RevisionManifest>();

            foreach (ObjectSpaceManifestList objSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revManifestList in objSpaceManifestList.RevisionManifestList)
                {
                    revisionManifestList.AddRange(revManifestList.RevisionManifests);
                }
            }

            List <ExtendedGUID> ridRevisionManifestStart4FND          = new List <ExtendedGUID>();
            List <ExtendedGUID> ridDependentRevisionManifestStart4FND = new List <ExtendedGUID>();

            for (int i = 0; i < revisionManifestList.Count; i++)
            {
                List <uint> ridGlobalIdTableEntryFNDX  = new List <uint>();
                List <uint> ridGlobalIdTableEntry2FNDX = new List <uint>();
                List <uint> ridGlobalIdTableEntry3FNDX = new List <uint>();

                for (int j = 0; j < revisionManifestList[i].FileNodeSequence.Count; j++)
                {
                    FileNode revision = revisionManifestList[i].FileNodeSequence[j];

                    if (revision.FileNodeID == FileNodeIDValues.RevisionManifestStart4FND)
                    {
                        RevisionManifestStart4FND fnd = revision.fnd as RevisionManifestStart4FND;

                        ridRevisionManifestStart4FND.Add(((RevisionManifestStart4FND)revision.fnd).rid);
                        ridDependentRevisionManifestStart4FND.Add(((RevisionManifestStart4FND)revision.fnd).ridDependent);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.GlobalIdTableEntryFNDX)
                    {
                        GlobalIdTableEntryFNDX fnd = revision.fnd as GlobalIdTableEntryFNDX;
                        ridGlobalIdTableEntryFNDX.Add(((GlobalIdTableEntryFNDX)revision.fnd).index);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.GlobalIdTableEntry2FNDX)
                    {
                        GlobalIdTableEntry2FNDX fnd = revision.fnd as GlobalIdTableEntry2FNDX;
                        ridGlobalIdTableEntry2FNDX.Add(((GlobalIdTableEntry2FNDX)revision.fnd).iIndexMapTo);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.GlobalIdTableEntry3FNDX)
                    {
                        GlobalIdTableEntry3FNDX fnd = revision.fnd as GlobalIdTableEntry3FNDX;
                        ridGlobalIdTableEntry3FNDX.Add(((GlobalIdTableEntry3FNDX)revision.fnd).iIndexCopyToStart);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.ObjectInfoDependencyOverridesFND)
                    {
                        ObjectInfoDependencyOverridesFND fnd = revision.fnd as ObjectInfoDependencyOverridesFND;

                        if (fnd.Ref.IsfcrNil())
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R620
                            Site.CaptureRequirementIfIsNotNull(
                                fnd.data,
                                620,
                                @"[In ObjectInfoDependencyOverridesFND] otherwise [if the value of the ref field is ""fcrNil""], the override data is specified by the data field. ");
                        }
                    }
                }

                for (int j = 0; j < ridGlobalIdTableEntryFNDX.Count - 1; j++)
                {
                    for (int k = j + 1; k < ridGlobalIdTableEntryFNDX.Count; k++)
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R54901
                        Site.CaptureRequirementIfAreNotEqual <uint>(
                            ridGlobalIdTableEntryFNDX[j],
                            ridGlobalIdTableEntryFNDX[k],
                            54901,
                            @"[In GlobalIdTableEntryFNDX]  The indexes in two global identification table specified by FileNode structures with the values of the FileNode.FileNodeID fields equal to 0x024 (GlobalIdTableEntryFNDX structure), 0x25 (GlobalIdTableEntry2FNDX structure), and 0x26 (GlobalIdTableEntry3FNDX structure) are different.");
                    }
                }

                for (int j = 0; j < ridGlobalIdTableEntry2FNDX.Count - 1; j++)
                {
                    for (int k = j + 1; k < ridGlobalIdTableEntry2FNDX.Count; k++)
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R55901
                        Site.CaptureRequirementIfAreNotEqual <uint>(
                            ridGlobalIdTableEntry2FNDX[j],
                            ridGlobalIdTableEntry2FNDX[k],
                            55901,
                            @"[In GlobalIdTableEntry2FNDX] The iIndexMapTo is defferent in two global identification table specified by FileNode structures with the value of the FileNode.FileNodeID field equal to 0x024 (GlobalIdTableEntryFNDX structure), 0x25 (GlobalIdTableEntry2FNDX structure), and 0x26 (GlobalIdTableEntry3FNDX structure).");
                    }
                }

                for (int j = 0; j < ridGlobalIdTableEntry3FNDX.Count - 1; j++)
                {
                    for (int k = j + 1; k < ridGlobalIdTableEntry3FNDX.Count; k++)
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R57001
                        Site.CaptureRequirementIfAreNotEqual <uint>(
                            ridGlobalIdTableEntry3FNDX[j],
                            ridGlobalIdTableEntry3FNDX[k],
                            57001,
                            @"[In GlobalIdTableEntry3FNDX] The indices from the value of iIndexCopyToStart to the value of (iIndexCopyToStart + cEntriesToCopy – 1) are different in two global identification table specified by FileNode structures with the values of the FileNode.FileNodeID field equal to 0x024 (GlobalIdTableEntryFNDX structure), 0x025 (GlobalIdTableEntry2FNDX structure), and 0x026 (GlobalIdTableEntry3FNDX structure).");
                    }
                }
            }

            for (int i = 0; i < ridRevisionManifestStart4FND.Count - 1; i++)
            {
                for (int j = i + 1; j < ridRevisionManifestStart4FND.Count; j++)
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R51401
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        ridRevisionManifestStart4FND[i],
                        ridRevisionManifestStart4FND[j],
                        51401,
                        @"[In RevisionManifestStart4FND] The rid of two RevisionManifestStart4FND in revision manifest list is different");
                }

                ExtendedGUID zeroExtendGuid = new ExtendedGUID();
                zeroExtendGuid.Guid = Guid.Empty;
                zeroExtendGuid.N    = 0;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R516
                Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                    zeroExtendGuid,
                    ridRevisionManifestStart4FND[i],
                    516,
                    @"[In RevisionManifestStart4FND] [ridDependent] If the value is ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                    "", then this revision manifest has no dependency revision. ");

                if (!ridDependentRevisionManifestStart4FND[i].Equals(zeroExtendGuid))
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R517
                    Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                        ridRevisionManifestStart4FND[i - 1],
                        ridDependentRevisionManifestStart4FND[i],
                        517,
                        @"[In RevisionManifestStart4FND]  [ridDependent] Otherwise [If the value is not ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                ""], this value MUST be equal to the RevisionManifestStart4FND.rid field of a previous revision manifest within this (section 2.1.9) revision manifest list.");
                }
            }
        }
Example #7
0
 /// <summary>
 /// This method is used to deserialize the ObjectGroupStartFND 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 ObjectGroupStartFND object.</returns>
 public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
 {
     this.oid = new ExtendedGUID();
     return(this.oid.DoDeserializeFromByteArray(byteArray, startIndex));
 }
Example #8
0
 /// <summary>
 /// This method is used to deserialize the DataSignatureGroupDefinitionFND 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 DataSignatureGroupDefinitionFND object.</returns>
 public override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
 {
     this.DataSignatureGroup = new ExtendedGUID();
     return(this.DataSignatureGroup.DoDeserializeFromByteArray(byteArray, startIndex));
 }
Example #9
0
        public void MSONESTORE_S01_TC03_QueryOneFileWithoutFileData()
        {
            // Get the resource url that contains the file data.
            string resourceName = Common.GetConfigurationPropertyValue("OneFileWithoutFileData", Site);
            string url          = this.GetResourceUrl(resourceName);

            this.InitializeContext(url, this.UserName, this.Password, this.Domain);

            // Call QueryChange to get the data that is specified by above step.
            CellSubRequestType  cellSubRequest      = this.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentSerialNumber());
            CellStorageResponse cellStorageResponse = this.SharedAdapter.CellStorageRequest(url, new SubRequestType[] { cellSubRequest });
            MSOneStorePackage   package             = this.ConvertOneStorePackage(cellStorageResponse);

            // Call adapter to load same file in local.
            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(resourceName);

            #region Capture code for Header Cell
            for (int i = 0; i < package.HeaderCell.ObjectData.Body.RgPrids.Length; i++)
            {
                PropertyID propId = package.HeaderCell.ObjectData.Body.RgPrids[i];
                if (propId.Value == 0x14001D93)
                {
                    FourBytesOfData crcData = package.HeaderCell.ObjectData.Body.RgData[i] as FourBytesOfData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R917
                    Site.CaptureRequirementIfAreEqual <uint>(
                        file.Header.crcName,
                        BitConverter.ToUInt32(crcData.Data, 0),
                        917,
                        @"[In Header Cell] FileNameCRC's PropertyID 0x14001D93 with value: MUST be the Header.crcName field.");
                }
                else if (propId.Value == 0x1C001D94)
                {
                    PrtFourBytesOfLengthFollowedByData guidFileData = package.HeaderCell.ObjectData.Body.RgData[i] as PrtFourBytesOfLengthFollowedByData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R912
                    Site.CaptureRequirementIfAreEqual <Guid>(
                        file.Header.guidFile,
                        new Guid(guidFileData.Data),
                        912,
                        @"[In Header Cell] [FileIdentityGuid] MUST be the value specified by the Header.guidFile field.");
                }
                else if (propId.Value == 0x1C001D95)
                {
                    PrtFourBytesOfLengthFollowedByData guidAncestorData = package.HeaderCell.ObjectData.Body.RgData[i] as PrtFourBytesOfLengthFollowedByData;

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R914
                    Site.CaptureRequirementIfAreEqual <Guid>(
                        file.Header.guidAncestor,
                        new Guid(guidAncestorData.Data),
                        914,
                        @"[In Header Cell] [FileAncestorIdentityGuid] MUST be the value specified by the Header.guidAncestor field.");
                }
            }
            #endregion

            #region Capture code for Revision
            List <RevisionManifest> revisionManifestList = new List <RevisionManifest>();

            foreach (ObjectSpaceManifestList objSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revManifestList in objSpaceManifestList.RevisionManifestList)
                {
                    revisionManifestList.AddRange(revManifestList.RevisionManifests);
                }
            }

            foreach (RevisionManifestDataElementData revisionManifestData in package.RevisionManifests)
            {
                ExGuid revisionId     = revisionManifestData.RevisionManifest.RevisionID;
                ExGuid baseRevisionId = revisionManifestData.RevisionManifest.BaseRevisionID;

                ExtendedGUID rid          = null;
                ExtendedGUID ridDependent = null;
                bool         isFound      = false;
                for (int i = 0; i < revisionManifestList.Count; i++)
                {
                    FileNode revisionStart = revisionManifestList[i].FileNodeSequence[0];
                    if (revisionStart.FileNodeID == FileNodeIDValues.RevisionManifestStart6FND)
                    {
                        rid          = ((RevisionManifestStart6FND)revisionStart.fnd).rid;
                        ridDependent = ((RevisionManifestStart6FND)revisionStart.fnd).ridDependent;
                    }
                    else if (revisionStart.FileNodeID == FileNodeIDValues.RevisionManifestStart7FND)
                    {
                        rid          = ((RevisionManifestStart7FND)revisionStart.fnd).Base.rid;
                        ridDependent = ((RevisionManifestStart7FND)revisionStart.fnd).Base.ridDependent;
                    }

                    if (rid.Guid == revisionId.GUID && rid.N == revisionId.Value)
                    {
                        isFound = true;
                        break;
                    }
                }

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R925
                Site.CaptureRequirementIfIsTrue(
                    isFound,
                    925,
                    @"[In Revisions] § Revision ID: MUST be equal to the revision store file revision identifier (section 2.1.8).");

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R926
                Site.CaptureRequirementIfIsTrue(
                    baseRevisionId.GUID == ridDependent.Guid && baseRevisionId.Value == ridDependent.N,
                    926,
                    @"[In Revisions] § Base Revision ID: MUST be equal to the revision store file dependency revision identifier (section 2.1.9).");

                ExGuid objectGroupId      = revisionManifestData.RevisionManifestObjectGroupReferencesList[0].ObjectGroupExtendedGUID;
                bool   isFoundObjectGroup = false;

                isFoundObjectGroup = package.DataRoot.Where(o => o.ObjectGroupID == objectGroupId).ToArray().Length > 0 ||
                                     package.OtherFileNodeList.Where(o => o.ObjectGroupID == objectGroupId).ToArray().Length > 0;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R935
                Site.CaptureRequirementIfIsTrue(
                    isFoundObjectGroup,
                    935,
                    @"[In Object Groups] The Revision Manifest Data Element structure, as specified in [MS-FSSHTTPB] section 2.2.1.12.5, that references an object group MUST specify the object group extended GUID to be equal to the revision store object group identifier.");
            }
            #endregion
        }
 /// <summary>
 /// This method is used to convert the element of ObjectSpaceManifestRootFND object into a byte List.
 /// </summary>
 /// <returns>Return the byte list which store the byte information of ObjectSpaceManifestRootFND.</returns>
 public override List <byte> SerializeToByteList()
 {
     this.gosidRoot = new ExtendedGUID();
     return(this.gosidRoot.SerializeToByteList());
 }