public static CreateChunkingInstance ( |
||
nodeObject | Specify the root node object. | |
Résultat |
/// <summary> /// This method is used to build a root node object from a byte array. /// </summary> /// <param name="fileContent">Specify the byte array.</param> /// <returns>Return a root node object build from the byte array.</returns> public IntermediateNodeObject Build(byte[] fileContent) { IntermediateNodeObject rootNode = new IntermediateNodeObject(); rootNode.Signature = new SignatureObject(); rootNode.DataSize = new DataSizeObject(); rootNode.DataSize.DataSize = (ulong)fileContent.Length; rootNode.ExGuid = new ExGuid(SequenceNumberGenerator.GetCurrentSerialNumber(), Guid.NewGuid()); rootNode.IntermediateNodeObjectList = ChunkingFactory.CreateChunkingInstance(fileContent).Chunking(); return(rootNode); }
/// <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); }