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

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

            index           += len;
            this.PropertySet = new ObjectSpaceObjectPropSet();
            this.PropertySet.DoDeserializeFromByteArray(byteArray, (int)this.Ref.StpValue);
            this.oid = new CompactID();
            len      = this.oid.DoDeserializeFromByteArray(byteArray, index);
            index   += len;
            using (BitReader bitReader = new BitReader(byteArray, index))
            {
                this.fHasOidReferences  = bitReader.ReadInt32(1);
                this.fHasOsidReferences = bitReader.ReadInt32(1);
                this.Reserved           = bitReader.ReadInt32(30);
            }
            index    += 4;
            this.cRef = BitConverter.ToUInt32(byteArray, index);
            index    += 4;

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

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

            index    += len;
            this.body = new ObjectDeclaration2Body();
            len       = this.body.DoDeserializeFromByteArray(byteArray, index);
            index    += len;
            this.cRef = byteArray[index];
            index    += 1;

            if (OneNoteRevisionStoreFile.IsEncryption == false)
            {
                this.PropertySet = new ObjectSpaceObjectPropSet();
                this.PropertySet.DoDeserializeFromByteArray(byteArray, (int)this.BlobRef.StpValue);
            }
            return(index - startIndex);
        }
Esempio n. 3
0
        public void MSONESTORE_S01_TC05_TestObjectSpaceObjectPropSet()
        {
            // 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);

            #region Capture code for ObjectSpaceObjectPropSet
            foreach (RevisionStoreObjectGroup objGroup in package.DataRoot)
            {
                foreach (RevisionStoreObject obj in objGroup.Objects)
                {
                    ObjectSpaceObjectPropSet objectPropSet = obj.PropertySet.ObjectSpaceObjectPropSet;
                    int OIDsLen  = objectPropSet.OIDs.SerializeToByteList().Count;
                    int OSIDsLen = 0;
                    if (objectPropSet.OSIDs != null)
                    {
                        OSIDsLen = objectPropSet.OSIDs.SerializeToByteList().Count;
                    }
                    int contextLen = 0;
                    if (objectPropSet.ContextIDs != null)
                    {
                        contextLen = objectPropSet.ContextIDs.SerializeToByteList().Count;
                    }
                    int bodyLen = 0;
                    if (objectPropSet.Body != null)
                    {
                        bodyLen = objectPropSet.Body.SerializeToByteList().Count;
                    }

                    if ((OIDsLen + OSIDsLen + contextLen + bodyLen) % 8 == 0)
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R749
                        Site.CaptureRequirementIfIsNull(
                            objectPropSet.Padding,
                            749,
                            @"[In ObjectSpaceObjectPropSet] If the sum of the sizes of the OIDs, OSIDs, ContextIDs, and body fields is a multiple of 8, then the padding field is not present.");
                    }
                    else
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R747
                        Site.CaptureRequirementIfAreEqual <int>(
                            0,
                            (OIDsLen + OSIDsLen + contextLen + bodyLen + objectPropSet.Padding.Length) % 8,
                            747,
                            @"[In ObjectSpaceObjectPropSet] [padding] The total size, in bytes, of an ObjectSpaceObjectPropSet structure MUST be a multiple of 8; the size of the padding field is the number of bytes necessary to ensure the total size of ObjectSpaceObjectPropSet structure is a multiple of 8. ");
                    }
                }
            }

            foreach (RevisionStoreObjectGroup objGoup in package.OtherFileNodeList)
            {
                foreach (RevisionStoreObject obj in objGoup.Objects)
                {
                    ObjectSpaceObjectPropSet objPropSet = obj.PropertySet.ObjectSpaceObjectPropSet;
                    if (objPropSet.OIDs.Header.Count > 0)
                    {
                        int number = this.GetNumberOfSpecificProperty(0x08, 0x09, objPropSet.Body);
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R730
                        Site.CaptureRequirementIfAreEqual <uint>(
                            objPropSet.OIDs.Header.Count,
                            (uint)number,
                            730,
                            @"[In ObjectSpaceObjectPropSet] [OIDs] The count of referenced objects is calculated as the number of properties specified by the body field, with PropertyID equal to 0x8 plus the number of referenced objects specified by properties with PropertyID equal to 0x9, 0x10, and 0x11. ");
                    }
                    if (objPropSet.OSIDs != null)
                    {
                        int number = this.GetNumberOfSpecificProperty(0x0A, 0x0B, objPropSet.Body);
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R736
                        Site.CaptureRequirementIfAreEqual <uint>(
                            objPropSet.OSIDs.Header.Count,
                            (uint)number,
                            736,
                            @"[In ObjectSpaceObjectPropSet] [OSIDs] The count of referenced object spaces is calculated as the number of properties specified by the body field with PropertyID equal to 0xA plus the number of referenced object spaces specified by properties with PropertyID equal to 0xB, 0x10, and 0x11.");
                    }
                    if (objPropSet.ContextIDs != null)
                    {
                        int number = this.GetNumberOfSpecificProperty(0x0C, 0x0D, objPropSet.Body);
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R742
                        Site.CaptureRequirementIfAreEqual <uint>(
                            objPropSet.ContextIDs.Header.Count,
                            (uint)number,
                            742,
                            @"[In ObjectSpaceObjectPropSet] [ContextIDs] The count of referenced contexts is calculated as the number of properties specified by the body field with PropertyID equal to 0xC plus the number of referenced contexts specified by properties with PropertyID equal to 0xD, 0x10, and 0x11.");
                    }
                }
            }
            #endregion
        }