Microsoft.Protocols.TestSuites.SharedAdapter.IntermediateNodeObject.GetContent C# (CSharp) Method

GetContent() public method

Get all the content which is represented by the intermediate node object.
public GetContent ( ) : List
return List
        public override List<byte> GetContent()
        {
            List<byte> content = new List<byte>();

            if (this.DataNodeObjectData != null)
            {
                content.AddRange(this.DataNodeObjectData.ObjectData);
            }
            else if (this.IntermediateNodeObjectList != null)
            {
                foreach (IntermediateNodeObject intermediateNode in this.IntermediateNodeObjectList)
                {
                    content.AddRange(intermediateNode.GetContent());
                }
            }
            else
            {
                throw new InvalidOperationException("The DataNodeObjectData and IntermediateNodeObjectList properties in IntermediateNodeObject cannot be null at the same time.");
            }
            
            return content;
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to create the instance of AbstractChunking.
        /// </summary>
        /// <param name="nodeObject">Specify the root node object.</param>
        /// <returns>The instance of AbstractChunking.</returns>
        public static AbstractChunking CreateChunkingInstance(IntermediateNodeObject nodeObject)
        {
            byte[] fileContent = nodeObject.GetContent().ToArray();

            if (EditorsTableUtils.IsEditorsTableHeader(fileContent))
            {
                return(null);
            }

            if (ZipHeader.IsFileHeader(fileContent, 0))
            {
                return(new ZipFilesChunking(fileContent));
            }
            else
            {
                // For SharePoint Server 2013 compatible SUTs, always using the RDC Chunking method in the current test suite involved file resources.
                if (SharedContext.Current.CellStorageVersionType.MinorVersion >= 2)
                {
                    return(new RDCAnalysisChunking(fileContent));
                }

                // For SharePoint Server 2010 SP2 compatible SUTs, chunking method depends on file content and size. So first try using the simple chunking.
                AbstractChunking returnChunking = new SimpleChunking(fileContent);

                List <LeafNodeObject> nodes = returnChunking.Chunking();
                if (nodeObject.IntermediateNodeObjectList.Count == nodes.Count)
                {
                    bool isDataSizeMatching = true;
                    for (int i = 0; i < nodes.Count; i++)
                    {
                        if (nodeObject.IntermediateNodeObjectList[i].DataSize.DataSize != nodes[i].DataSize.DataSize)
                        {
                            isDataSizeMatching = false;
                            break;
                        }
                    }

                    if (isDataSizeMatching)
                    {
                        return(returnChunking);
                    }
                }

                // If the intermediate count number or data size does not equals, then try to use RDC chunking method.
                return(new RDCAnalysisChunking(fileContent));
            }
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.SharedAdapter.IntermediateNodeObject::GetContent