The class is used to specify the ExGuid structure.
Inheritance: BasicObject
        /// <summary>
        /// This method is used to analyze the storage index data element to get all the mappings.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
        /// <param name="manifestMappingGuid">Output parameter to represent the storage manifest mapping GUID.</param>
        /// <param name="cellIDMappings">Output parameter to represent the mapping of cell id.</param>
        /// <param name="revisionIDMappings">Output parameter to represent the revision id.</param>
        /// <returns>Return true if analyze the storage index succeeds, otherwise return false.</returns>
        public static bool AnalyzeStorageIndexDataElement(
            List <DataElement> dataElements,
            ExGuid storageIndexExGuid,
            out ExGuid manifestMappingGuid,
            out Dictionary <CellID, ExGuid> cellIDMappings,
            out Dictionary <ExGuid, ExGuid> revisionIDMappings)
        {
            manifestMappingGuid = null;
            cellIDMappings      = null;
            revisionIDMappings  = null;

            if (storageIndexExGuid == null)
            {
                return(false);
            }

            DataElement storageIndexDataElement          = dataElements.Find(element => element.DataElementExtendedGUID.Equals(storageIndexExGuid));
            StorageIndexDataElementData storageIndexData = storageIndexDataElement.GetData <StorageIndexDataElementData>();

            manifestMappingGuid = storageIndexData.StorageIndexManifestMapping.ManifestMappingExtendedGUID;

            cellIDMappings = new Dictionary <CellID, ExGuid>();
            foreach (StorageIndexCellMapping kv in storageIndexData.StorageIndexCellMappingList)
            {
                cellIDMappings.Add(kv.CellID, kv.CellMappingExtendedGUID);
            }

            revisionIDMappings = new Dictionary <ExGuid, ExGuid>();
            foreach (StorageIndexRevisionMapping kv in storageIndexData.StorageIndexRevisionMappingList)
            {
                revisionIDMappings.Add(kv.RevisionExtendedGUID, kv.RevisionMappingExtendedGUID);
            }

            return(true);
        }
示例#2
0
            /// <summary>
            /// This method is used to build a root node object from an data element list with the specified storage index extended GUID.
            /// </summary>
            /// <param name="dataElements">Specify the data element list.</param>
            /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
            /// <returns>Return a root node object build from the data element list.</returns>
            public IntermediateNodeObject Build(List <DataElement> dataElements, ExGuid storageIndexExGuid)
            {
                if (DataElementUtils.TryAnalyzeWhetherFullDataElementList(dataElements, storageIndexExGuid) &&
                    DataElementUtils.TryAnalyzeWhetherConfirmSchema(dataElements, storageIndexExGuid))
                {
                    ExGuid rootObjectExGUID;
                    List <ObjectGroupDataElementData> objectGroupList = DataElementUtils.GetDataObjectDataElementData(dataElements, storageIndexExGuid, out rootObjectExGUID);

                    // If the root object extend GUID can be found, then the root node can be build.
                    if (rootObjectExGUID != null)
                    {
                        // If can analyze for here, then can directly capture all the GUID values related requirements
                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyDefinedGUID(SharedContext.Current.Site);
                        }

                        return(this.Build(objectGroupList, rootObjectExGUID));
                    }
                    else
                    {
                        throw new InvalidOperationException(string.Format("There is no root extended GUID value {0}", DataElementUtils.RootExGuid.ToString()));
                    }
                }

                return(null);
            }
        /// <summary>
        /// This method is used to create the revision manifest data element.
        /// </summary>
        /// <param name="rootObjectExGuid">Specify the root node object extended GUID.</param>
        /// <param name="baseRevisionID">Specify the base revision Id.</param>
        /// <param name="refferenceObjectDataExGuidList">Specify the reference object data extended list.</param>
        /// <param name="revisionMapping">Input/output parameter to represent the mapping of revision manifest.</param>
        /// <param name="currentRevisionID">Output parameter to represent the revision GUID.</param>
        /// <returns>Return the revision manifest data element.</returns>
        public static DataElement CreateRevisionManifestDataElement(ExGuid rootObjectExGuid, ExGuid baseRevisionID, List <ExGuid> refferenceObjectDataExGuidList, ref Dictionary <ExGuid, ExGuid> revisionMapping, out ExGuid currentRevisionID)
        {
            RevisionManifestDataElementData data = new RevisionManifestDataElementData();

            data.RevisionManifest.RevisionID     = new ExGuid(1u, Guid.NewGuid());
            data.RevisionManifest.BaseRevisionID = new ExGuid(baseRevisionID);

            // Set the root object data ExGuid
            data.RevisionManifestRootDeclareList.Add(new RevisionManifestRootDeclare()
            {
                RootExtendedGUID = new ExGuid(2u, RootExGuid), ObjectExtendedGUID = new ExGuid(rootObjectExGuid)
            });

            // Set all the reference object data
            if (refferenceObjectDataExGuidList != null)
            {
                foreach (ExGuid dataGuid in refferenceObjectDataExGuidList)
                {
                    data.RevisionManifestObjectGroupReferencesList.Add(new RevisionManifestObjectGroupReferences(dataGuid));
                }
            }

            DataElement dataElement = new DataElement(DataElementType.RevisionManifestDataElementData, data);

            revisionMapping.Add(data.RevisionManifest.RevisionID, dataElement.DataElementExtendedGUID);
            currentRevisionID = data.RevisionManifest.RevisionID;
            return(dataElement);
        }
        /// <summary>
        /// This method is used to create the storage index data element.
        /// </summary>
        /// <param name="manifestExGuid">Specify the storage manifest data element extended GUID.</param>
        /// <param name="cellIDMappings">Specify the mapping of cell manifest.</param>
        /// <param name="revisionIDMappings">Specify the mapping of revision manifest.</param>
        /// <returns>Return the storage index data element.</returns>
        public static DataElement CreateStorageIndexDataElement(ExGuid manifestExGuid, Dictionary <CellID, ExGuid> cellIDMappings, Dictionary <ExGuid, ExGuid> revisionIDMappings)
        {
            StorageIndexDataElementData data = new StorageIndexDataElementData();

            data.StorageIndexManifestMapping = new StorageIndexManifestMapping();
            data.StorageIndexManifestMapping.ManifestMappingExtendedGUID = new ExGuid(manifestExGuid);
            data.StorageIndexManifestMapping.ManifestMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());

            foreach (KeyValuePair <CellID, ExGuid> kv in cellIDMappings)
            {
                StorageIndexCellMapping cellMapping = new StorageIndexCellMapping();
                cellMapping.CellID = kv.Key;
                cellMapping.CellMappingExtendedGUID = kv.Value;
                cellMapping.CellMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexCellMappingList.Add(cellMapping);
            }

            foreach (KeyValuePair <ExGuid, ExGuid> kv in revisionIDMappings)
            {
                StorageIndexRevisionMapping revisionMapping = new StorageIndexRevisionMapping();
                revisionMapping.RevisionExtendedGUID        = kv.Key;
                revisionMapping.RevisionMappingExtendedGUID = kv.Value;
                revisionMapping.RevisionMappingSerialNumber = new SerialNumber(Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexRevisionMappingList.Add(revisionMapping);
            }

            return(new DataElement(DataElementType.StorageIndexDataElementData, data));
        }
        /// <summary>
        /// This method is used to get cell manifest data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="manifestDataElementData">Specify the manifest data element.</param>
        /// <param name="cellIDMappings">Specify mapping of cell id.</param>
        /// <returns>Return the cell manifest data element.</returns>
        public static CellManifestDataElementData GetCellManifestDataElementData(List <DataElement> dataElements, StorageManifestDataElementData manifestDataElementData, Dictionary <CellID, ExGuid> cellIDMappings)
        {
            CellID cellID = new CellID(new ExGuid(1u, RootExGuid), new ExGuid(1u, CellSecondExGuid));

            foreach (StorageManifestRootDeclare kv in manifestDataElementData.StorageManifestRootDeclareList)
            {
                if (kv.RootExtendedGUID.Equals(new ExGuid(2u, RootExGuid)) && kv.CellID.Equals(cellID))
                {
                    if (!cellIDMappings.ContainsKey(kv.CellID))
                    {
                        throw new InvalidOperationException(string.Format("Cannot fin the Cell ID {0} in the cell id mapping", cellID.ToString()));
                    }

                    ExGuid cellMappingID = cellIDMappings[kv.CellID];

                    DataElement dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(cellMappingID));
                    if (dataElement == null)
                    {
                        throw new InvalidOperationException("Cannot find the  cell data element with ExGuid " + cellMappingID.GUID.ToString());
                    }

                    return(dataElement.GetData <CellManifestDataElementData>());
                }
            }

            throw new InvalidOperationException("Cannot find the CellManifestDataElement");
        }
示例#6
0
        private HeaderCell ParseHeaderCell(RevisionManifestDataElementData headerCellRevisionManifest)
        {
            ExGuid      rootObjectId = headerCellRevisionManifest.RevisionManifestObjectGroupReferencesList[0].ObjectGroupExtendedGUID;
            DataElement element      = this.objectGroupDataElements
                                       .Where(d => d.DataElementExtendedGUID.Equals(rootObjectId)).SingleOrDefault();

            return(HeaderCell.CreateInstance((ObjectGroupDataElementData)element.Data));
        }
示例#7
0
        /// <summary>
        /// This method is used to deserialize the CellID basic 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 CellID basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.ExtendGUID1 = BasicObject.Parse <ExGuid>(byteArray, ref index);
            this.ExtendGUID2 = BasicObject.Parse <ExGuid>(byteArray, ref index);

            return(index - startIndex);
        }
        /// <summary>
        /// This method is used to find the Storage Index Revision Mapping that matches the Revision Mapping Extended GUID.
        /// </summary>
        /// <param name="revisionExtendedGUID">Specify the Revision Mapping Extended GUID.</param>
        /// <returns>Return the instance of Storage Index Revision Mapping.</returns>
        public StorageIndexRevisionMapping FindStorageIndexRevisionMapping(ExGuid revisionExtendedGUID)
        {
            StorageIndexRevisionMapping instance = null;

            if (this.StorageIndex != null)
            {
                instance = this.StorageIndex.StorageIndexRevisionMappingList.Where(r => r.RevisionExtendedGUID.Equals(revisionExtendedGUID)).SingleOrDefault();
            }

            return(instance);
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;
            this.CellManifestCurrentRevisionExtendedGUID = BasicObject.Parse<ExGuid>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "CellManifestCurrentRevision", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
示例#10
0
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.ObjectGroupExtendedGUID = BasicObject.Parse <ExGuid>(byteArray, ref index);
            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "RevisionManifestObjectGroupReferences", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
 /// <summary>
 /// This method is used to create object group data/blob element list.
 /// </summary>
 /// <param name="fileContent">Specify the file content in byte array format.</param>
 /// <param name="rootNodeExGuid">Output parameter to represent the root node extended GUID.</param>
 /// <param name="objectDataExGuidList">Input/Output parameter to represent the list of extended GUID for the data object data.</param>
 /// <returns>Return the list of data element which will represent the file content.</returns>
 public static List<DataElement> CreateObjectGroupDataElement(byte[] fileContent, out ExGuid rootNodeExGuid, ref List<ExGuid> objectDataExGuidList)
 {
     NodeObject rootNode = new RootNodeObject.RootNodeObjectBuilder().Build(fileContent);
     
     // Storage the root object node ExGuid
     rootNodeExGuid = new ExGuid(rootNode.ExGuid);
     List<DataElement> elements = new ObjectGroupDataElementData.Builder().Build(rootNode);
     objectDataExGuidList.AddRange(
                 elements.Where(element => element.DataElementType == DataElementType.ObjectGroupDataElementData)
                         .Select(element => element.DataElementExtendedGUID)
                         .ToArray());
    
     return elements;
 }
        /// <summary>
        /// This method is used to create object group data/blob element list.
        /// </summary>
        /// <param name="fileContent">Specify the file content in byte array format.</param>
        /// <param name="rootNodeExGuid">Output parameter to represent the root node extended GUID.</param>
        /// <param name="objectDataExGuidList">Input/Output parameter to represent the list of extended GUID for the data object data.</param>
        /// <returns>Return the list of data element which will represent the file content.</returns>
        public static List <DataElement> CreateObjectGroupDataElement(byte[] fileContent, out ExGuid rootNodeExGuid, ref List <ExGuid> objectDataExGuidList)
        {
            NodeObject rootNode = new RootNodeObject.RootNodeObjectBuilder().Build(fileContent);

            // Storage the root object node ExGuid
            rootNodeExGuid = new ExGuid(rootNode.ExGuid);
            List <DataElement> elements = new ObjectGroupDataElementData.Builder().Build(rootNode);

            objectDataExGuidList.AddRange(
                elements.Where(element => element.DataElementType == DataElementType.ObjectGroupDataElementData)
                .Select(element => element.DataElementExtendedGUID)
                .ToArray());

            return(elements);
        }
        /// <summary>
        /// This method is used to create the cell manifest data element.
        /// </summary>
        /// <param name="revisionId">Specify the revision GUID.</param>
        /// <param name="cellIDMapping">Input/output parameter to represent the mapping of cell manifest.</param>
        /// <returns>Return the cell manifest data element.</returns>
        public static DataElement CreateCellMainifestDataElement(ExGuid revisionId, ref Dictionary <CellID, ExGuid> cellIDMapping)
        {
            CellManifestDataElementData data = new CellManifestDataElementData();

            data.CellManifestCurrentRevision = new CellManifestCurrentRevision()
            {
                CellManifestCurrentRevisionExtendedGUID = new ExGuid(revisionId)
            };
            DataElement dataElement = new DataElement(DataElementType.CellManifestDataElementData, data);

            CellID cellID = new CellID(new ExGuid(1u, RootExGuid), new ExGuid(1u, CellSecondExGuid));

            cellIDMapping.Add(cellID, dataElement.DataElementExtendedGUID);
            return(dataElement);
        }
示例#14
0
        /// <summary>
        /// This method is used to deserialize the ExGUIDArray basic 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 ExGUIDArray basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex) // return the length consumed
        {
            int index = startIndex;

            this.Count = BasicObject.Parse <Compact64bitInt>(byteArray, ref index);

            this.Content.Clear();
            for (uint i = 0; i < this.Count.DecodedValue; i++)
            {
                ExGuid temp = BasicObject.Parse <ExGuid>(byteArray, ref index);
                this.Content.Add(temp);
            }

            return(index - startIndex);
        }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;

            this.ObjectExtendedGUIDArray = BasicObject.Parse <ExGUIDArray>(byteArray, ref index);
            this.CellIDArray             = BasicObject.Parse <CellIDArray>(byteArray, ref index);
            this.BLOBExtendedGUID        = BasicObject.Parse <ExGuid>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupObjectDataBLOBReference", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
示例#16
0
        /// <summary>
        /// Override the Equals method.
        /// </summary>
        /// <param name="obj">Specify the object.</param>
        /// <returns>Return true if equals, otherwise return false.</returns>
        public override bool Equals(object obj)
        {
            ExGuid another = obj as ExGuid;

            if (another == null)
            {
                return(false);
            }

            if (this.GUID != null && another.GUID != null)
            {
                return(another.GUID.Equals(this.GUID) && another.Value == this.Value);
            }

            return(false);
        }
        /// <summary>
        /// Initializes a new instance of the PutChangesCellSubRequest class
        /// </summary>
        /// <param name="subRequestID">Specify the sub request id</param>
        /// <param name="storageIndexExGuid">Specify the storage index ExGuid.</param>
        public PutChangesCellSubRequest(ulong subRequestID, ExGuid storageIndexExGuid)
        {
            this.RequestID = subRequestID;
            this.RequestType = Convert.ToUInt64(RequestTypes.PutChanges);
            this.StorageIndexExtendedGUID = storageIndexExGuid;
            this.ExpectedStorageIndexExtendedGUID = new ExGuid();
            this.ImplyNullExpectedIfNoMapping = 0;
            this.Partial = 0;
            this.PartialLast = 0;
            this.FavorCoherencyFailureOverNotFound = 1;
            this.AbortRemainingPutChangesOnFailure = 0;
            this.MultiRequestPutHint = 0;
            this.ReturnCompleteKnowledgeIfPossible = 1;
            this.LastWriterWinsOnNextChange = 0;

            this.IsAdditionalFlagsUsed = false;
            this.IsLockIdUsed = false;
        }
        /// <summary>
        /// Initializes a new instance of the QueryChangesCellSubRequest class
        /// </summary>
        /// <param name="subRequestID">Specify the sub request id</param>
        public QueryChangesCellSubRequest(ulong subRequestID)
        {
            this.RequestID = subRequestID;
            this.RequestType = Convert.ToUInt64(RequestTypes.QueryChanges);
            this.QueryChangesRequest = new StreamObjectHeaderStart32bit(StreamObjectTypeHeaderStart.QueryChangesRequest, 1);
            this.Reserved = 0;
            this.AllowFragments = 0;
            this.Reserved1 = 0;
            this.IncludeStorageManifest = 0;
            this.IncludeCellChanges = 0;
            this.Reserved2 = 0;

            // CellId
            ExGuid extendGuid1 = new ExGuid(0x0, Guid.Empty);
            ExGuid extendGuid2 = new ExGuid(0x0, Guid.Empty);
            this.CellId = new CellID(extendGuid1, extendGuid2);
            this.QueryChangeFilters = new List<Filter>();
        }
示例#19
0
        /// <summary>
        /// Initializes a new instance of the PutChangesCellSubRequest class
        /// </summary>
        /// <param name="subRequestID">Specify the sub request id</param>
        /// <param name="storageIndexExGuid">Specify the storage index ExGuid.</param>
        public PutChangesCellSubRequest(ulong subRequestID, ExGuid storageIndexExGuid)
        {
            this.RequestID   = subRequestID;
            this.RequestType = Convert.ToUInt64(RequestTypes.PutChanges);
            this.StorageIndexExtendedGUID         = storageIndexExGuid;
            this.ExpectedStorageIndexExtendedGUID = new ExGuid();
            this.ImplyNullExpectedIfNoMapping     = 0;
            this.Partial     = 0;
            this.PartialLast = 0;
            this.FavorCoherencyFailureOverNotFound = 1;
            this.AbortRemainingPutChangesOnFailure = 0;
            this.MultiRequestPutHint = 0;
            this.ReturnCompleteKnowledgeIfPossible = 1;
            this.LastWriterWinsOnNextChange        = 0;

            this.IsAdditionalFlagsUsed = false;
            this.IsLockIdUsed          = false;
        }
        /// <summary>
        /// Initializes a new instance of the QueryChangesCellSubRequest class
        /// </summary>
        /// <param name="subRequestID">Specify the sub request id</param>
        public QueryChangesCellSubRequest(ulong subRequestID)
        {
            this.RequestID              = subRequestID;
            this.RequestType            = Convert.ToUInt64(RequestTypes.QueryChanges);
            this.QueryChangesRequest    = new StreamObjectHeaderStart32bit(StreamObjectTypeHeaderStart.QueryChangesRequest, 1);
            this.Reserved               = 0;
            this.AllowFragments         = 0;
            this.Reserved1              = 0;
            this.IncludeStorageManifest = 0;
            this.IncludeCellChanges     = 0;
            this.Reserved2              = 0;

            // CellId
            ExGuid extendGuid1 = new ExGuid(0x0, Guid.Empty);
            ExGuid extendGuid2 = new ExGuid(0x0, Guid.Empty);

            this.CellId             = new CellID(extendGuid1, extendGuid2);
            this.QueryChangeFilters = new List <Filter>();
        }
        /// <summary>
        /// This method is used to get revision manifest data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="cellData">Specify the cell data element.</param>
        /// <param name="revisionIDMappings">Specify mapping of revision id.</param>
        /// <returns>Return the revision manifest data element.</returns>
        public static RevisionManifestDataElementData GetRevisionManifestDataElementData(List <DataElement> dataElements, CellManifestDataElementData cellData, Dictionary <ExGuid, ExGuid> revisionIDMappings)
        {
            ExGuid currentRevisionExGuid = cellData.CellManifestCurrentRevision.CellManifestCurrentRevisionExtendedGUID;

            if (!revisionIDMappings.ContainsKey(currentRevisionExGuid))
            {
                throw new InvalidOperationException(string.Format("Cannot find the revision id {0} in the revisionMapping", currentRevisionExGuid.ToString()));
            }

            ExGuid revisionMapping = revisionIDMappings[currentRevisionExGuid];

            DataElement dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(revisionMapping));

            if (dataElement == null)
            {
                throw new InvalidOperationException("Cannot find the revision data element with ExGuid " + revisionMapping.GUID.ToString());
            }

            return(dataElement.GetData <RevisionManifestDataElementData>());
        }
        /// <summary>
        /// This method is used to build a list of data elements to represent a file.
        /// </summary>
        /// <param name="fileContent">Specify the file content byte array.</param>
        /// <param name="storageIndexExGuid">Output parameter to represent the storage index GUID.</param>
        /// <returns>Return the list of data elements.</returns>
        public static List<DataElement> BuildDataElements(byte[] fileContent, out ExGuid storageIndexExGuid)
        {
            List<DataElement> dataElementList = new List<DataElement>();
            ExGuid rootNodeObjectExGuid;
            List<ExGuid> objectDataExGuidList = new List<ExGuid>();
            dataElementList.AddRange(CreateObjectGroupDataElement(fileContent, out rootNodeObjectExGuid, ref objectDataExGuidList));

            ExGuid baseRevisionID = new ExGuid(0u, Guid.Empty);
            Dictionary<ExGuid, ExGuid> revisionMapping = new Dictionary<ExGuid, ExGuid>();
            ExGuid currentRevisionID;
            dataElementList.Add(CreateRevisionManifestDataElement(rootNodeObjectExGuid, baseRevisionID, objectDataExGuidList, ref revisionMapping, out currentRevisionID));

            Dictionary<CellID, ExGuid> cellIDMapping = new Dictionary<CellID, ExGuid>();
            dataElementList.Add(CreateCellMainifestDataElement(currentRevisionID, ref cellIDMapping));

            dataElementList.Add(CreateStorageManifestDataElement(cellIDMapping));
            dataElementList.Add(CreateStorageIndexDataElement(dataElementList.Last().DataElementExtendedGUID, cellIDMapping, revisionMapping));

            storageIndexExGuid = dataElementList.Last().DataElementExtendedGUID;
            return dataElementList;
        }
        /// <summary>
        /// This method is used to analyze whether the data elements are confirmed to the schema defined in MS-FSSHTTPD.
        /// </summary>
        /// <param name="dataElements">Specify the data elements list.</param>
        /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
        /// <returns>If the data elements confirms to the schema defined in the MS-FSSHTTPD returns true, otherwise false.</returns>
        public static bool TryAnalyzeWhetherConfirmSchema(List <DataElement> dataElements, ExGuid storageIndexExGuid)
        {
            DataElement storageIndexDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(storageIndexExGuid));

            if (storageIndexExGuid == null)
            {
                return(false);
            }

            StorageIndexDataElementData storageIndexData = storageIndexDataElement.GetData <StorageIndexDataElementData>();
            ExGuid manifestMappingGuid = storageIndexData.StorageIndexManifestMapping.ManifestMappingExtendedGUID;

            DataElement storageManifestDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(manifestMappingGuid));

            if (storageManifestDataElement == null)
            {
                return(false);
            }

            return(SchemaGuid.Equals(storageManifestDataElement.GetData <StorageManifestDataElementData>().StorageManifestSchemaGUID.GUID));
        }
        /// <summary>
        /// This method is used to create the revision manifest data element.
        /// </summary>
        /// <param name="rootObjectExGuid">Specify the root node object extended GUID.</param>
        /// <param name="baseRevisionID">Specify the base revision Id.</param>
        /// <param name="refferenceObjectDataExGuidList">Specify the reference object data extended list.</param>
        /// <param name="revisionMapping">Input/output parameter to represent the mapping of revision manifest.</param>
        /// <param name="currentRevisionID">Output parameter to represent the revision GUID.</param>
        /// <returns>Return the revision manifest data element.</returns>
        public static DataElement CreateRevisionManifestDataElement(ExGuid rootObjectExGuid, ExGuid baseRevisionID, List<ExGuid> refferenceObjectDataExGuidList, ref Dictionary<ExGuid, ExGuid> revisionMapping, out ExGuid currentRevisionID)
        {
            RevisionManifestDataElementData data = new RevisionManifestDataElementData();
            data.RevisionManifest.RevisionID = new ExGuid(1u, Guid.NewGuid());
            data.RevisionManifest.BaseRevisionID = new ExGuid(baseRevisionID);

            // Set the root object data ExGuid
            data.RevisionManifestRootDeclareList.Add(new RevisionManifestRootDeclare() { RootExtendedGUID = new ExGuid(2u, RootExGuid), ObjectExtendedGUID = new ExGuid(rootObjectExGuid) });

            // Set all the reference object data
            if (refferenceObjectDataExGuidList != null)
            {
                foreach (ExGuid dataGuid in refferenceObjectDataExGuidList)
                {
                    data.RevisionManifestObjectGroupReferencesList.Add(new RevisionManifestObjectGroupReferences(dataGuid));
                }
            }

            DataElement dataElement = new DataElement(DataElementType.RevisionManifestDataElementData, data);
            revisionMapping.Add(data.RevisionManifest.RevisionID, dataElement.DataElementExtendedGUID);
            currentRevisionID = data.RevisionManifest.RevisionID;
            return dataElement;
        }
        /// <summary>
        /// This method is used to build a list of data elements to represent a file.
        /// </summary>
        /// <param name="fileContent">Specify the file content byte array.</param>
        /// <param name="storageIndexExGuid">Output parameter to represent the storage index GUID.</param>
        /// <returns>Return the list of data elements.</returns>
        public static List <DataElement> BuildDataElements(byte[] fileContent, out ExGuid storageIndexExGuid)
        {
            List <DataElement> dataElementList = new List <DataElement>();
            ExGuid             rootNodeObjectExGuid;
            List <ExGuid>      objectDataExGuidList = new List <ExGuid>();

            dataElementList.AddRange(CreateObjectGroupDataElement(fileContent, out rootNodeObjectExGuid, ref objectDataExGuidList));

            ExGuid baseRevisionID = new ExGuid(0u, Guid.Empty);
            Dictionary <ExGuid, ExGuid> revisionMapping = new Dictionary <ExGuid, ExGuid>();
            ExGuid currentRevisionID;

            dataElementList.Add(CreateRevisionManifestDataElement(rootNodeObjectExGuid, baseRevisionID, objectDataExGuidList, ref revisionMapping, out currentRevisionID));

            Dictionary <CellID, ExGuid> cellIDMapping = new Dictionary <CellID, ExGuid>();

            dataElementList.Add(CreateCellMainifestDataElement(currentRevisionID, ref cellIDMapping));

            dataElementList.Add(CreateStorageManifestDataElement(cellIDMapping));
            dataElementList.Add(CreateStorageIndexDataElement(dataElementList.Last().DataElementExtendedGUID, cellIDMapping, revisionMapping));

            storageIndexExGuid = dataElementList.Last().DataElementExtendedGUID;
            return(dataElementList);
        }
示例#26
0
            /// <summary>
            /// This method is used to build a root node object from an object group data element list with the specified root extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="rootExGuid">Specify the root extended GUID.</param>
            /// <returns>Return a root node object build from the object group data element list.</returns>
            private IntermediateNodeObject Build(List <ObjectGroupDataElementData> objectGroupList, ExGuid rootExGuid)
            {
                ObjectGroupObjectDeclare rootDeclare;
                ObjectGroupObjectData    root = this.FindByExGuid(objectGroupList, rootExGuid, out rootDeclare);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    MsfsshttpdCapture.VerifyObjectCount(root, SharedContext.Current.Site);
                }

                int index = 0;
                IntermediateNodeObject rootNode = null;

                if (StreamObject.TryGetCurrent <IntermediateNodeObject>(root.Data.Content.ToArray(), ref index, out rootNode))
                {
                    rootNode.ExGuid = rootExGuid;

                    foreach (ExGuid extGuid in root.ObjectExGUIDArray.Content)
                    {
                        ObjectGroupObjectDeclare intermediateDeclare;
                        ObjectGroupObjectData    intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                        rootNode.IntermediateNodeObjectList.Add(new LeafNodeObject.IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                        // Capture the intermediate related requirements
                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                            MsfsshttpdCapture.VerifyLeafNodeObject(rootNode.IntermediateNodeObjectList.Last(), SharedContext.Current.Site);
                        }
                    }

                    if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                    {
                        // Capture the root node related requirements.
                        MsfsshttpdCapture.VerifyObjectGroupObjectDataForRootNode(root, rootDeclare, objectGroupList, SharedContext.Current.Site);
                        MsfsshttpdCapture.VerifyIntermediateNodeObject(rootNode, SharedContext.Current.Site);
                    }
                }
                else
                {
                    // If there is only one object in the file, SharePoint Server 2010 does not return the Root Node Object, but an Intermediate Node Object at the beginning.
                    // At this case, we will add the root node object for the further parsing.
                    rootNode        = new IntermediateNodeObject();
                    rootNode.ExGuid = rootExGuid;

                    rootNode.IntermediateNodeObjectList.Add(new LeafNodeObject.IntermediateNodeObjectBuilder().Build(objectGroupList, root, rootExGuid));
                    rootNode.DataSize          = new DataSizeObject();
                    rootNode.DataSize.DataSize = (ulong)rootNode.IntermediateNodeObjectList.Sum(o => (float)o.DataSize.DataSize);
                }

                // Capture all the signature related requirements.
                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    AbstractChunking chunking = ChunkingFactory.CreateChunkingInstance(rootNode);

                    if (chunking != null)
                    {
                        chunking.AnalyzeChunking(rootNode, SharedContext.Current.Site);
                    }
                }

                return(rootNode);
            }
示例#27
0
 /// <summary>
 /// Initializes a new instance of the ExGuid class, this is the copy constructor.
 /// </summary>
 /// <param name="guid2">Specify the ExGuid instance where copies from.</param>
 public ExGuid(ExGuid guid2)
 {
     this.Value = guid2.Value;
     this.GUID = guid2.GUID;
     this.Type = guid2.Type;
 }
示例#28
0
            /// <summary>
            /// This method is used to build a root node object from an data element list with the specified storage index extended GUID.
            /// </summary>
            /// <param name="dataElements">Specify the data element list.</param>
            /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
            /// <returns>Return a root node object build from the data element list.</returns>
            public RootNodeObject Build(List<DataElement> dataElements, ExGuid storageIndexExGuid)
            {
                if (DataElementUtils.TryAnalyzeWhetherFullDataElementList(dataElements, storageIndexExGuid)
                    && DataElementUtils.TryAnalyzeWhetherConfirmSchema(dataElements, storageIndexExGuid))
                {
                    ExGuid rootObjectExGUID;
                    List<ObjectGroupDataElementData> objectGroupList = DataElementUtils.GetDataObjectDataElementData(dataElements, storageIndexExGuid, out rootObjectExGUID);

                    // If the root object extend GUID can be found, then the root node can be build.
                    if (rootObjectExGUID != null)
                    {
                        // If can analyze for here, then can directly capture all the GUID values related requirements
                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyDefinedGUID(SharedContext.Current.Site);
                        }

                        return this.Build(objectGroupList, rootObjectExGUID);
                    }
                    else
                    {
                        throw new InvalidOperationException(string.Format("There is no root extended GUID value {0}", DataElementUtils.RootExGuid.ToString()));
                    }
                }

                return null;
            }
示例#29
0
 /// <summary>
 /// Find the Revision Manifest from Data Elements.
 /// </summary>
 /// <param name="revisionMappingExtendedGUID">The Revision Mapping Extended GUID.</param>
 /// <returns>Returns the instance of RevisionManifestDataElementData</returns>
 private RevisionManifestDataElementData FindRevisionManifestDataElement(ExGuid revisionMappingExtendedGUID)
 {
     return((RevisionManifestDataElementData)revisionManifestDataElements
            .Where(d => d.DataElementExtendedGUID.Equals(revisionMappingExtendedGUID)).SingleOrDefault().Data);
 }
        /// <summary>
        /// This method is used to create the cell manifest data element.
        /// </summary>
        /// <param name="revisionId">Specify the revision GUID.</param>
        /// <param name="cellIDMapping">Input/output parameter to represent the mapping of cell manifest.</param>
        /// <returns>Return the cell manifest data element.</returns>
        public static DataElement CreateCellMainifestDataElement(ExGuid revisionId, ref Dictionary<CellID, ExGuid> cellIDMapping)
        {
            CellManifestDataElementData data = new CellManifestDataElementData();
            data.CellManifestCurrentRevision = new CellManifestCurrentRevision() { CellManifestCurrentRevisionExtendedGUID = new ExGuid(revisionId) };
            DataElement dataElement = new DataElement(DataElementType.CellManifestDataElementData, data);

            CellID cellID = new CellID(new ExGuid(1u, RootExGuid), new ExGuid(1u, CellSecondExGuid));
            cellIDMapping.Add(cellID, dataElement.DataElementExtendedGUID);
            return dataElement;
        }
示例#31
0
            /// <summary>
            /// This method is used to find the object group data element using the specified extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="extendedGuid">Specify the extended GUID.</param>
            /// <param name="declare">Specify the output of ObjectGroupObjectDeclare.</param>
            /// <returns>Return the object group data element if found.</returns>
            /// <exception cref="InvalidOperationException">If not found, throw the InvalidOperationException exception.</exception>
            private ObjectGroupObjectData FindByExGuid(List<ObjectGroupDataElementData> objectGroupList, ExGuid extendedGuid, out ObjectGroupObjectDeclare declare)
            {
                foreach (ObjectGroupDataElementData objectGroup in objectGroupList)
                {
                    int findIndex = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList.FindIndex(objDeclare => objDeclare.ObjectExtendedGUID.Equals(extendedGuid));

                    if (findIndex == -1)
                    {
                        continue;
                    }

                    declare = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList[findIndex];
                    return objectGroup.ObjectGroupData.ObjectGroupObjectDataList[findIndex];
                }

                throw new InvalidOperationException("Cannot find the " + extendedGuid.GUID.ToString());
            }
示例#32
0
            /// <summary>
            /// This method is used to build a root node object from an object group data element list with the specified root extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="rootExGuid">Specify the root extended GUID.</param>
            /// <returns>Return a root node object build from the object group data element list.</returns>
            private RootNodeObject Build(List<ObjectGroupDataElementData> objectGroupList, ExGuid rootExGuid)
            {
                ObjectGroupObjectDeclare rootDeclare;
                ObjectGroupObjectData root = this.FindByExGuid(objectGroupList, rootExGuid, out rootDeclare);

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    MsfsshttpdCapture.VerifyObjectCount(root, SharedContext.Current.Site);
                }

                int index = 0;
                RootNodeObject rootNode = null;

                if (StreamObject.TryGetCurrent<RootNodeObject>(root.Data.Content.ToArray(), ref index, out rootNode))
                {
                    rootNode.ExGuid = rootExGuid;

                    foreach (ExGuid extGuid in root.ObjectExGUIDArray.Content)
                    {
                        ObjectGroupObjectDeclare intermediateDeclare;
                        ObjectGroupObjectData intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                        rootNode.IntermediateNodeObjectList.Add(new IntermediateNodeObject.IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                        // Capture the intermediate related requirements
                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                            MsfsshttpdCapture.VerifyIntermediateNodeObject(rootNode.IntermediateNodeObjectList.Last(), SharedContext.Current.Site);
                        }
                    }

                    if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                    {
                        // Capture the root node related requirements. 
                        MsfsshttpdCapture.VerifyObjectGroupObjectDataForRootNode(root, rootDeclare, objectGroupList, SharedContext.Current.Site);
                        MsfsshttpdCapture.VerifyRootNodeObject(rootNode, SharedContext.Current.Site);
                    }
                }
                else
                {
                    // If there is only one object in the file, SharePoint Server 2010 does not return the Root Node Object, but an Intermediate Node Object at the beginning.
                    // At this case, we will add the root node object for the further parsing.
                    rootNode = new RootNodeObject();
                    rootNode.ExGuid = rootExGuid;
                    
                    rootNode.IntermediateNodeObjectList.Add(new IntermediateNodeObject.IntermediateNodeObjectBuilder().Build(objectGroupList, root, rootExGuid));
                    rootNode.DataSize = new DataSizeObject();
                    rootNode.DataSize.DataSize = (ulong)rootNode.IntermediateNodeObjectList.Sum(o => (float)o.DataSize.DataSize);
                }

                // Capture all the signature related requirements.
                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    AbstractChunking chunking = ChunkingFactory.CreateChunkingInstance(rootNode);

                    if (chunking != null)
                    {
                        chunking.AnalyzeChunking(rootNode, SharedContext.Current.Site);
                    }
                }
                
                return rootNode;
            }
        /// <summary>
        /// This method is used to get storage manifest data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="manifestMapping">Specify the manifest mapping GUID.</param>
        /// <returns>Return the storage manifest data element.</returns>
        public static StorageManifestDataElementData GetStorageManifestDataElementData(List <DataElement> dataElements, ExGuid manifestMapping)
        {
            DataElement storageManifestDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(manifestMapping));

            if (storageManifestDataElement == null)
            {
                return(null);
            }

            return(storageManifestDataElement.GetData <StorageManifestDataElementData>());
        }
        /// <summary>
        /// This method is used to get storage manifest data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="manifestMapping">Specify the manifest mapping GUID.</param>
        /// <returns>Return the storage manifest data element.</returns>
        public static StorageManifestDataElementData GetStorageManifestDataElementData(List<DataElement> dataElements, ExGuid manifestMapping)
        {
            DataElement storageManifestDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(manifestMapping));
            if (storageManifestDataElement == null)
            {
                return null;
            }

            return storageManifestDataElement.GetData<StorageManifestDataElementData>();    
        }
        /// <summary>
        /// This method is used to get a list of object group data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="revisionData">Specify the revision data.</param>
        /// <param name="rootExGuid">Specify the root node object extended GUID.</param>
        /// <returns>Return the list of object group data element.</returns>
        public static List<ObjectGroupDataElementData> GetDataObjectDataElementData(List<DataElement> dataElements, RevisionManifestDataElementData revisionData, out ExGuid rootExGuid)
        {
            rootExGuid = null;

            foreach (RevisionManifestRootDeclare kv in revisionData.RevisionManifestRootDeclareList)
            {
                if (kv.RootExtendedGUID.Equals(new ExGuid(2u, RootExGuid)))
                {
                    rootExGuid = kv.ObjectExtendedGUID;
                    break;
                }
            }

            List<ObjectGroupDataElementData> dataList = new List<ObjectGroupDataElementData>();

            foreach (RevisionManifestObjectGroupReferences kv in revisionData.RevisionManifestObjectGroupReferencesList)
            {
                DataElement dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(kv.ObjectGroupExtendedGUID));
                if (dataElement == null)
                {
                    throw new InvalidOperationException("Cannot find the object group data element with ExGuid " + kv.ObjectGroupExtendedGUID.GUID.ToString());
                }

                dataList.Add(dataElement.GetData<ObjectGroupDataElementData>());
            }

            return dataList;
        }
        /// <summary>
        /// This method is used to create the storage index data element.
        /// </summary>
        /// <param name="manifestExGuid">Specify the storage manifest data element extended GUID.</param>
        /// <param name="cellIDMappings">Specify the mapping of cell manifest.</param>
        /// <param name="revisionIDMappings">Specify the mapping of revision manifest.</param>
        /// <returns>Return the storage index data element.</returns>
        public static DataElement CreateStorageIndexDataElement(ExGuid manifestExGuid, Dictionary<CellID, ExGuid> cellIDMappings, Dictionary<ExGuid, ExGuid> revisionIDMappings)
        {
            StorageIndexDataElementData data = new StorageIndexDataElementData();

            data.StorageIndexManifestMapping = new StorageIndexManifestMapping();
            data.StorageIndexManifestMapping.ManifestMappingExtendedGUID = new ExGuid(manifestExGuid);
            data.StorageIndexManifestMapping.ManifestMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());

            foreach (KeyValuePair<CellID, ExGuid> kv in cellIDMappings)
            {
                StorageIndexCellMapping cellMapping = new StorageIndexCellMapping();
                cellMapping.CellID = kv.Key;
                cellMapping.CellMappingExtendedGUID = kv.Value;
                cellMapping.CellMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexCellMappingList.Add(cellMapping);
            }

            foreach (KeyValuePair<ExGuid, ExGuid> kv in revisionIDMappings)
            {
                StorageIndexRevisionMapping revisionMapping = new StorageIndexRevisionMapping();
                revisionMapping.RevisionExtendedGUID = kv.Key;
                revisionMapping.RevisionMappingExtendedGUID = kv.Value;
                revisionMapping.RevisionMappingSerialNumber = new SerialNumber(Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexRevisionMappingList.Add(revisionMapping);
            }

            return new DataElement(DataElementType.StorageIndexDataElementData, data);
        }
示例#37
0
        /// <summary>
        /// This method is used to deserialize the CellID basic 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 CellID basic object.</returns>
        protected override int DoDeserializeFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            this.ExtendGUID1 = BasicObject.Parse<ExGuid>(byteArray, ref index);
            this.ExtendGUID2 = BasicObject.Parse<ExGuid>(byteArray, ref index);

            return index - startIndex;
        }
示例#38
0
            /// <summary>
            /// This method is used to build intermediate node object from an list of object group data element.
            /// </summary>
            /// <param name="objectGroupList">Specify the list of object group data elements.</param>
            /// <param name="dataObj">Specify the object group object.</param>
            /// <param name="intermediateGuid">Specify the intermediate extended GUID.</param>
            /// <returns>Return the intermediate node object.</returns>
            public IntermediateNodeObject Build(List<ObjectGroupDataElementData> objectGroupList, ObjectGroupObjectData dataObj, ExGuid intermediateGuid)
            {
                IntermediateNodeObject node = null;
                RootNodeObject rootNode = null;

                int index = 0;
                if (StreamObject.TryGetCurrent<IntermediateNodeObject>(dataObj.Data.Content.ToArray(), ref index, out node))
                {
                    if (dataObj.ObjectExGUIDArray == null)
                    {
                        throw new InvalidOperationException("Failed to build intermediate node because the object extend GUID array does not exist.");
                    }

                    node.ExGuid = intermediateGuid;

                    // Contain a single Data Node Object.
                    if (dataObj.ObjectExGUIDArray.Count.DecodedValue == 1u)
                    {
                        ObjectGroupObjectDeclare dataNodeDeclare;
                        ObjectGroupObjectData dataNodeData = this.FindByExGuid(objectGroupList, dataObj.ObjectExGUIDArray.Content[0], out dataNodeDeclare);
                        BinaryItem data = dataNodeData.Data;
                        
                        node.DataNodeObjectData = new DataNodeObjectData(data.Content.ToArray(), 0, (int)data.Length.DecodedValue);
                        node.DataNodeObjectData.ExGuid = dataObj.ObjectExGUIDArray.Content[0];
                        node.IntermediateNodeObjectList = null;

                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForDataNodeObject(dataNodeData, dataNodeDeclare, objectGroupList, SharedContext.Current.Site);
                        }
                    }
                    else
                    {
                        // Contain a list of IntermediateNodeObject
                        node.IntermediateNodeObjectList = new List<IntermediateNodeObject>();
                        node.DataNodeObjectData = null;
                        foreach (ExGuid extGuid in dataObj.ObjectExGUIDArray.Content)
                        {
                            ObjectGroupObjectDeclare intermediateDeclare;
                            ObjectGroupObjectData intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                            node.IntermediateNodeObjectList.Add(new IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                            {
                                MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                            }
                        }
                    }
                }
                else if (StreamObject.TryGetCurrent<RootNodeObject>(dataObj.Data.Content.ToArray(), ref index, out rootNode))
                {
                    // In Sub chunking for larger than 1MB zip file, MOSS2010 could return RootNodeObject.
                    // For easy further process, the rootNode will be replaced by intermediate node instead.
                    node = new IntermediateNodeObject();
                    node.IntermediateNodeObjectList = new List<IntermediateNodeObject>();
                    node.DataSize = rootNode.DataSize;
                    node.ExGuid = rootNode.ExGuid;
                    node.Signature = rootNode.Signature;
                    node.DataNodeObjectData = null;
                    foreach (ExGuid extGuid in dataObj.ObjectExGUIDArray.Content)
                    {
                        ObjectGroupObjectDeclare intermediateDeclare;
                        ObjectGroupObjectData intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                        node.IntermediateNodeObjectList.Add(new IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                        }
                    }
                }
                else
                {
                    throw new InvalidOperationException("In the ObjectGroupDataElement cannot only contain the RootNodeObject or IntermediateNodeOBject.");
                }

                return node;
            }
示例#39
0
            /// <summary>
            /// This method is used to build intermediate node object from an list of object group data element.
            /// </summary>
            /// <param name="objectGroupList">Specify the list of object group data elements.</param>
            /// <param name="dataObj">Specify the object group object.</param>
            /// <param name="intermediateGuid">Specify the intermediate extended GUID.</param>
            /// <returns>Return the intermediate node object.</returns>
            public LeafNodeObject Build(List <ObjectGroupDataElementData> objectGroupList, ObjectGroupObjectData dataObj, ExGuid intermediateGuid)
            {
                LeafNodeObject         node     = null;
                IntermediateNodeObject rootNode = null;

                int index = 0;

                if (StreamObject.TryGetCurrent <LeafNodeObject>(dataObj.Data.Content.ToArray(), ref index, out node))
                {
                    if (dataObj.ObjectExGUIDArray == null)
                    {
                        throw new InvalidOperationException("Failed to build intermediate node because the object extend GUID array does not exist.");
                    }

                    node.ExGuid = intermediateGuid;

                    // Contain a single Data Node Object.
                    if (dataObj.ObjectExGUIDArray.Count.DecodedValue == 1u)
                    {
                        ObjectGroupObjectDeclare dataNodeDeclare;
                        ObjectGroupObjectData    dataNodeData = this.FindByExGuid(objectGroupList, dataObj.ObjectExGUIDArray.Content[0], out dataNodeDeclare);
                        BinaryItem data = dataNodeData.Data;

                        node.DataNodeObjectData         = new DataNodeObjectData(data.Content.ToArray(), 0, (int)data.Length.DecodedValue);
                        node.DataNodeObjectData.ExGuid  = dataObj.ObjectExGUIDArray.Content[0];
                        node.IntermediateNodeObjectList = null;

                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForDataNodeObject(dataNodeData, dataNodeDeclare, objectGroupList, SharedContext.Current.Site);
                        }
                    }
                    else
                    {
                        // Contain a list of LeafNodeObjectData
                        node.IntermediateNodeObjectList = new List <LeafNodeObject>();
                        node.DataNodeObjectData         = null;
                        foreach (ExGuid extGuid in dataObj.ObjectExGUIDArray.Content)
                        {
                            ObjectGroupObjectDeclare intermediateDeclare;
                            ObjectGroupObjectData    intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                            node.IntermediateNodeObjectList.Add(new IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                            {
                                MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                            }
                        }
                    }
                }
                else if (StreamObject.TryGetCurrent <IntermediateNodeObject>(dataObj.Data.Content.ToArray(), ref index, out rootNode))
                {
                    // In Sub chunking for larger than 1MB zip file, MOSS2010 could return IntermediateNodeObject.
                    // For easy further process, the rootNode will be replaced by intermediate node instead.
                    node = new LeafNodeObject();
                    node.IntermediateNodeObjectList = new List <LeafNodeObject>();
                    node.DataSize           = rootNode.DataSize;
                    node.ExGuid             = rootNode.ExGuid;
                    node.Signature          = rootNode.Signature;
                    node.DataNodeObjectData = null;
                    foreach (ExGuid extGuid in dataObj.ObjectExGUIDArray.Content)
                    {
                        ObjectGroupObjectDeclare intermediateDeclare;
                        ObjectGroupObjectData    intermediateData = this.FindByExGuid(objectGroupList, extGuid, out intermediateDeclare);
                        node.IntermediateNodeObjectList.Add(new IntermediateNodeObjectBuilder().Build(objectGroupList, intermediateData, extGuid));

                        if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                        {
                            MsfsshttpdCapture.VerifyObjectGroupObjectDataForIntermediateNode(intermediateData, intermediateDeclare, objectGroupList, SharedContext.Current.Site);
                        }
                    }
                }
                else
                {
                    throw new InvalidOperationException("In the ObjectGroupDataElement cannot only contain the IntermediateNodeObject or IntermediateNodeOBject.");
                }

                return(node);
            }
        public static RevisionStoreObjectGroup CreateInstance(ExGuid objectGroupId, ObjectGroupDataElementData dataObject, bool isEncryption)
        {
            RevisionStoreObjectGroup objectGroup = new RevisionStoreObjectGroup(objectGroupId);
            Dictionary <ExGuid, RevisionStoreObject> objectDict = new Dictionary <ExGuid, RevisionStoreObject>();

            if (isEncryption == false)
            {
                RevisionStoreObject revisionObject = null;
                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectDeclarationList.Count; i++)
                {
                    ObjectGroupObjectDeclare objectDeclaration = dataObject.ObjectGroupDeclarations.ObjectDeclarationList[i];
                    ObjectGroupObjectData    objectData        = dataObject.ObjectGroupData.ObjectGroupObjectDataList[i];

                    if (!objectDict.ContainsKey(objectDeclaration.ObjectExtendedGUID))
                    {
                        revisionObject = new RevisionStoreObject();
                        revisionObject.ObjectGroupID = objectGroupId;
                        revisionObject.ObjectID      = objectDeclaration.ObjectExtendedGUID;
                        objectDict.Add(objectDeclaration.ObjectExtendedGUID, revisionObject);
                    }
                    else
                    {
                        revisionObject = objectDict[objectDeclaration.ObjectExtendedGUID];
                    }
                    if (objectDeclaration.ObjectPartitionID.DecodedValue == 4)
                    {
                        revisionObject.JCID = new JCIDObject(objectDeclaration, objectData);
                    }
                    else if (objectDeclaration.ObjectPartitionID.DecodedValue == 1)
                    {
                        revisionObject.PropertySet = new PropertySetObject(objectDeclaration, objectData);
                        if (Convert.ToBoolean(revisionObject.JCID.JCID.IsFileData) == false)
                        {
                            revisionObject.ReferencedObjectID       = objectData.ObjectExGUIDArray;
                            revisionObject.ReferencedObjectSpacesID = objectData.CellIDArray;
                        }
                    }
                }

                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectGroupObjectBLOBDataDeclarationList.Count; i++)
                {
                    ObjectGroupObjectBLOBDataDeclaration objectGroupObjectBLOBDataDeclaration = dataObject.ObjectGroupDeclarations.ObjectGroupObjectBLOBDataDeclarationList[i];
                    ObjectGroupObjectDataBLOBReference   objectGroupObjectDataBLOBReference   = dataObject.ObjectGroupData.ObjectGroupObjectDataBLOBReferenceList[i];
                    if (!objectDict.ContainsKey(objectGroupObjectBLOBDataDeclaration.ObjectExGUID))
                    {
                        revisionObject = new RevisionStoreObject();
                        objectDict.Add(objectGroupObjectBLOBDataDeclaration.ObjectExGUID, revisionObject);
                    }
                    else
                    {
                        revisionObject = objectDict[objectGroupObjectBLOBDataDeclaration.ObjectExGUID];
                    }
                    if (objectGroupObjectBLOBDataDeclaration.ObjectPartitionID.DecodedValue == 2)
                    {
                        revisionObject.FileDataObject = new FileDataObject();
                        revisionObject.FileDataObject.ObjectDataBLOBDeclaration = objectGroupObjectBLOBDataDeclaration;
                        revisionObject.FileDataObject.ObjectDataBLOBReference   = objectGroupObjectDataBLOBReference;
                    }
                }
                objectGroup.Objects.AddRange(objectDict.Values.ToArray());
            }
            else
            {
                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectDeclarationList.Count; i++)
                {
                    ObjectGroupObjectDeclare objectDeclaration = dataObject.ObjectGroupDeclarations.ObjectDeclarationList[i];
                    ObjectGroupObjectData    objectData        = dataObject.ObjectGroupData.ObjectGroupObjectDataList[i];

                    if (objectDeclaration.ObjectPartitionID.DecodedValue == 1)
                    {
                        EncryptionObject encrypObject = new EncryptionObject();
                        encrypObject.ObjectDeclaration = objectDeclaration;
                        encrypObject.ObjectData        = objectData.Data.Content.ToArray();
                        objectGroup.EncryptionObjects.Add(encrypObject);
                    }
                }
            }

            return(objectGroup);
        }
示例#41
0
            /// <summary>
            /// This method is used to find the object group data element using the specified extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="extendedGuid">Specify the extended GUID.</param>
            /// <param name="declare">Specify the output of ObjectGroupObjectDeclare.</param>
            /// <returns>Return the object group data element if found.</returns>
            /// <exception cref="InvalidOperationException">If not found, throw the InvalidOperationException exception.</exception>
            private ObjectGroupObjectData FindByExGuid(List <ObjectGroupDataElementData> objectGroupList, ExGuid extendedGuid, out ObjectGroupObjectDeclare declare)
            {
                foreach (ObjectGroupDataElementData objectGroup in objectGroupList)
                {
                    int findIndex = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList.FindIndex(objDeclare => objDeclare.ObjectExtendedGUID.Equals(extendedGuid));

                    if (findIndex == -1)
                    {
                        continue;
                    }

                    declare = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList[findIndex];
                    return(objectGroup.ObjectGroupData.ObjectGroupObjectDataList[findIndex]);
                }

                throw new InvalidOperationException("Cannot find the " + extendedGuid.GUID.ToString());
            }
        /// <summary>
        /// Used to de-serialize the element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="currentIndex">Start position</param>
        /// <param name="lengthOfItems">The length of the items</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            int index = currentIndex;
            this.ObjectExtendedGUIDArray = BasicObject.Parse<ExGUIDArray>(byteArray, ref index);
            this.CellIDArray = BasicObject.Parse<CellIDArray>(byteArray, ref index);
            this.BLOBExtendedGUID = BasicObject.Parse<ExGuid>(byteArray, ref index);

            if (index - currentIndex != lengthOfItems)
            {
                throw new StreamObjectParseErrorException(currentIndex, "ObjectGroupObjectDataBLOBReference", "Stream object over-parse error", null);
            }

            currentIndex = index;
        }
 /// <summary>
 /// This method is used to check whether the extended GUID is unique in the object group data element data list.
 /// </summary>
 /// <param name="currentObjectExGuid">Specify the object extended GUID.</param>
 /// <param name="objectGroupList">Specify the object group data element data list. </param>
 /// <returns>Return true if the GUID is unique, otherwise return false.</returns>
 private static bool IsGuidUnique(ExGuid currentObjectExGuid, List<ObjectGroupDataElementData> objectGroupList)
 {
     return objectGroupList.SelectMany(dataEle => dataEle.ObjectGroupDeclarations.ObjectDeclarationList).Where(declare => declare.ObjectExtendedGUID.Equals(currentObjectExGuid)).Count() == 1;
 }
 /// <summary>
 /// This method is used to get the list of object group data element from a list of data element.
 /// </summary>
 /// <param name="dataElements">Specify the data element list.</param>
 /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
 /// <param name="rootExGuid">Output parameter to represent the root node object.</param>
 /// <returns>Return the list of object group data elements.</returns>
 public static List<ObjectGroupDataElementData> GetDataObjectDataElementData(List<DataElement> dataElements, ExGuid storageIndexExGuid, out ExGuid rootExGuid)
 {
     ExGuid manifestMappingGuid;
     Dictionary<CellID, ExGuid> cellIDMappings;
     Dictionary<ExGuid, ExGuid> revisionIDMappings;
     AnalyzeStorageIndexDataElement(dataElements, storageIndexExGuid, out manifestMappingGuid, out cellIDMappings, out revisionIDMappings);
     StorageManifestDataElementData manifestData = GetStorageManifestDataElementData(dataElements, manifestMappingGuid);
     if (manifestData == null)
     {
         throw new InvalidOperationException("Cannot find the storage manifest data element with ExGuid " + manifestMappingGuid.GUID.ToString());
     }
     
     CellManifestDataElementData cellData = GetCellManifestDataElementData(dataElements, manifestData, cellIDMappings);
     RevisionManifestDataElementData revisionData = GetRevisionManifestDataElementData(dataElements, cellData, revisionIDMappings);
     return GetDataObjectDataElementData(dataElements, revisionData, out rootExGuid);
 }
 public RevisionStoreObjectGroup(ExGuid objectGroupId)
 {
     this.Objects           = new List <RevisionStoreObject>();
     this.EncryptionObjects = new List <EncryptionObject>();
     this.ObjectGroupID     = objectGroupId;
 }
        /// <summary>
        /// This method is used to get a list of object group data element from a list of data element.
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="revisionData">Specify the revision data.</param>
        /// <param name="rootExGuid">Specify the root node object extended GUID.</param>
        /// <returns>Return the list of object group data element.</returns>
        public static List <ObjectGroupDataElementData> GetDataObjectDataElementData(List <DataElement> dataElements, RevisionManifestDataElementData revisionData, out ExGuid rootExGuid)
        {
            rootExGuid = null;

            foreach (RevisionManifestRootDeclare kv in revisionData.RevisionManifestRootDeclareList)
            {
                if (kv.RootExtendedGUID.Equals(new ExGuid(2u, RootExGuid)))
                {
                    rootExGuid = kv.ObjectExtendedGUID;
                    break;
                }
            }

            List <ObjectGroupDataElementData> dataList = new List <ObjectGroupDataElementData>();

            foreach (RevisionManifestObjectGroupReferences kv in revisionData.RevisionManifestObjectGroupReferencesList)
            {
                DataElement dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(kv.ObjectGroupExtendedGUID));
                if (dataElement == null)
                {
                    throw new InvalidOperationException("Cannot find the object group data element with ExGuid " + kv.ObjectGroupExtendedGUID.GUID.ToString());
                }

                dataList.Add(dataElement.GetData <ObjectGroupDataElementData>());
            }

            return(dataList);
        }
示例#47
0
 /// <summary>
 /// Initializes a new instance of the CellID class with specified ExGuids.
 /// </summary>
 /// <param name="extendGuid1">Specify the first ExGuid.</param>
 /// <param name="extendGuid2">Specify the second ExGuid.</param>
 public CellID(ExGuid extendGuid1, ExGuid extendGuid2)
 {
     this.ExtendGUID1 = extendGuid1;
     this.ExtendGUID2 = extendGuid2;
 }
 /// <summary>
 /// Initializes a new instance of the RevisionManifestObjectGroupReferences class.
 /// </summary>
 /// <param name="objectGroupExtendedGUID">Extended GUID</param>
 public RevisionManifestObjectGroupReferences(ExGuid objectGroupExtendedGUID)
     : this()
 {
     this.ObjectGroupExtendedGUID = objectGroupExtendedGUID;
 }
        /// <summary>
        /// This method is used to try to analyze the returned whether data elements are complete.
        /// </summary>
        /// <param name="dataElements">Specify the data elements list.</param>
        /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
        /// <returns>If the data elements start with the specified storage index extended GUID are complete, return true. Otherwise return false.</returns>
        public static bool TryAnalyzeWhetherFullDataElementList(List<DataElement> dataElements, ExGuid storageIndexExGuid)
        {
            ExGuid manifestMappingGuid;
            Dictionary<CellID, ExGuid> cellIDMappings;
            Dictionary<ExGuid, ExGuid> revisionIDMappings;
            if (!AnalyzeStorageIndexDataElement(dataElements, storageIndexExGuid, out manifestMappingGuid, out cellIDMappings, out revisionIDMappings))
            {
                return false;
            }

            if (cellIDMappings.Count == 0)
            {
                return false;
            }

            if (revisionIDMappings.Count == 0)
            {
                return false;
            }

            StorageManifestDataElementData manifestData = GetStorageManifestDataElementData(dataElements, manifestMappingGuid);
            if (manifestData == null)
            {
                return false;
            }

            foreach (StorageManifestRootDeclare kv in manifestData.StorageManifestRootDeclareList)
            {
                if (!cellIDMappings.ContainsKey(kv.CellID))
                {
                    throw new InvalidOperationException(string.Format("Cannot fin the Cell ID {0} in the cell id mapping", kv.CellID.ToString()));
                }

                ExGuid cellMappingID = cellIDMappings[kv.CellID];
                DataElement dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(cellMappingID));
                if (dataElement == null)
                {
                    return false;
                }

                CellManifestDataElementData cellData = dataElement.GetData<CellManifestDataElementData>();
                ExGuid currentRevisionExGuid = cellData.CellManifestCurrentRevision.CellManifestCurrentRevisionExtendedGUID;
                if (!revisionIDMappings.ContainsKey(currentRevisionExGuid))
                {
                    throw new InvalidOperationException(string.Format("Cannot find the revision id {0} in the revisionMapping", currentRevisionExGuid.ToString()));
                }

                ExGuid revisionMapping = revisionIDMappings[currentRevisionExGuid];
                dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(revisionMapping));
                if (dataElement == null)
                {
                    return false;
                }

                RevisionManifestDataElementData revisionData = dataElement.GetData<RevisionManifestDataElementData>();
                foreach (RevisionManifestObjectGroupReferences reference in revisionData.RevisionManifestObjectGroupReferencesList)
                {
                    dataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(reference.ObjectGroupExtendedGUID));
                    if (dataElement == null)
                    {
                        return false;
                    }
                }
            }

            return true;
        }
示例#50
0
 /// <summary>
 /// Find the CellManifestDataElementData
 /// </summary>
 /// <param name="cellMappingExtendedGUID">The ExGuid of Cell Mapping Extended GUID.</param>
 /// <returns>Return the CellManifestDataElementData instance.</returns>
 private CellManifestDataElementData FindCellManifest(ExGuid cellMappingExtendedGUID)
 {
     return((CellManifestDataElementData)this.cellManifestDataElements
            .Where(d => d.DataElementExtendedGUID.Equals(cellMappingExtendedGUID)).SingleOrDefault().Data);
 }
示例#51
0
 /// <summary>
 /// Initializes a new instance of the ExGuid class, this is the copy constructor.
 /// </summary>
 /// <param name="guid2">Specify the ExGuid instance where copies from.</param>
 public ExGuid(ExGuid guid2)
 {
     this.Value = guid2.Value;
     this.GUID  = guid2.GUID;
     this.Type  = guid2.Type;
 }
        /// <summary>
        /// This method is used to analyze whether the data elements are confirmed to the schema defined in MS-FSSHTTPD. 
        /// </summary>
        /// <param name="dataElements">Specify the data elements list.</param>
        /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
        /// <returns>If the data elements confirms to the schema defined in the MS-FSSHTTPD returns true, otherwise false.</returns>
        public static bool TryAnalyzeWhetherConfirmSchema(List<DataElement> dataElements, ExGuid storageIndexExGuid)
        {
            DataElement storageIndexDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(storageIndexExGuid));
            if (storageIndexExGuid == null)
            {
                return false;
            }

            StorageIndexDataElementData storageIndexData = storageIndexDataElement.GetData<StorageIndexDataElementData>();
            ExGuid manifestMappingGuid = storageIndexData.StorageIndexManifestMapping.ManifestMappingExtendedGUID;

            DataElement storageManifestDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(manifestMappingGuid));
            if (storageManifestDataElement == null)
            {
                return false;
            }

            return SchemaGuid.Equals(storageManifestDataElement.GetData<StorageManifestDataElementData>().StorageManifestSchemaGUID.GUID);
        }
示例#53
0
 /// <summary>
 /// Initializes a new instance of the CellID class with specified ExGuids.
 /// </summary>
 /// <param name="extendGuid1">Specify the first ExGuid.</param>
 /// <param name="extendGuid2">Specify the second ExGuid.</param>
 public CellID(ExGuid extendGuid1, ExGuid extendGuid2)
 {
     this.ExtendGUID1 = extendGuid1;
     this.ExtendGUID2 = extendGuid2;
 }
        /// <summary>
        /// This method is used to analyze the storage index data element to get all the mappings. 
        /// </summary>
        /// <param name="dataElements">Specify the data element list.</param>
        /// <param name="storageIndexExGuid">Specify the storage index extended GUID.</param>
        /// <param name="manifestMappingGuid">Output parameter to represent the storage manifest mapping GUID.</param>
        /// <param name="cellIDMappings">Output parameter to represent the mapping of cell id.</param>
        /// <param name="revisionIDMappings">Output parameter to represent the revision id.</param>
        /// <returns>Return true if analyze the storage index succeeds, otherwise return false.</returns>
        public static bool AnalyzeStorageIndexDataElement(
                        List<DataElement> dataElements, 
                        ExGuid storageIndexExGuid, 
                        out ExGuid manifestMappingGuid,
                        out Dictionary<CellID, ExGuid> cellIDMappings, 
                        out Dictionary<ExGuid, ExGuid> revisionIDMappings)
        {
            manifestMappingGuid = null;
            cellIDMappings = null;
            revisionIDMappings = null;

            if (storageIndexExGuid == null)
            {
                return false;
            }

            DataElement storageIndexDataElement = dataElements.Find(element => element.DataElementExtendedGUID.Equals(storageIndexExGuid));
            StorageIndexDataElementData storageIndexData = storageIndexDataElement.GetData<StorageIndexDataElementData>();
            manifestMappingGuid = storageIndexData.StorageIndexManifestMapping.ManifestMappingExtendedGUID;

            cellIDMappings = new Dictionary<CellID, ExGuid>();
            foreach (StorageIndexCellMapping kv in storageIndexData.StorageIndexCellMappingList)
            {
                cellIDMappings.Add(kv.CellID, kv.CellMappingExtendedGUID);
            }

            revisionIDMappings = new Dictionary<ExGuid, ExGuid>();
            foreach (StorageIndexRevisionMapping kv in storageIndexData.StorageIndexRevisionMappingList)
            {
                revisionIDMappings.Add(kv.RevisionExtendedGUID, kv.RevisionMappingExtendedGUID);
            }

            return true;
        }