Storage Index data element
Inheritance: DataElementData
        /// <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);
        }
        /// <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 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 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);
        }