示例#1
0
        protected List <IResourceConnection> SlurpAllRKs()
        {
            List <IResourceConnection> results = new List <IResourceConnection>();
            string rootStr = this.GetContentPathRootName();

            if (!RKContainer.IsLegalFieldName(rootStr))
            {
                Diagnostics.Log("Illegal Root Field Name for "
                                + ResourceGraph.PrintRK(base.originalKey) + ":" + rootStr);
                rootStr = "root";
            }
            if (base.resource is GenericRCOLResource)
            {
                Diagnostics.Log("Slurping RCOL Resource RKs for "
                                + rootStr + ":" + ResourceGraph.PrintRK(base.originalKey));
                GenericRCOLResource rcol = base.resource as GenericRCOLResource;
                TGIBlock            tgiBlock;
                int i, count = rcol.Resources.Count;
                for (i = 0; i < count; i++)
                {
                    tgiBlock = rcol.Resources[i];
                    if (includeDDSes || !ResourceGraph.IsDDS(tgiBlock.ResourceType))
                    {
                        results.Add(new DefaultConnection(tgiBlock, tgiBlock,
                                                          ResourceDataActions.FindWrite, rootStr + ".Resources[" + i + "]"));
                    }
                }
                Diagnostics.Log("Slurping RCOL ChunkEntry RKs for "
                                + rootStr + ":" + ResourceGraph.PrintRK(base.originalKey));
                string absolutePath;
                GenericRCOLResource.ChunkEntry chunk;
                count = rcol.ChunkEntries.Count;
                for (i = 0; i < count; i++)
                {
                    absolutePath = rootStr + ".ChunkEntries[" + i + "].RCOLBlock";
                    chunk        = rcol.ChunkEntries[i];
                    tgiBlock     = chunk.TGIBlock;
                    switch (GetChunkType(tgiBlock))
                    {
                    case ChunkEntryType.Kindred:
                        this.kindredRCOLChunkKeys.Add(tgiBlock);
                        results.AddRange(RKContainer.SlurpRKsFromField(absolutePath,
                                                                       chunk.RCOLBlock, this.rkContainers, this.ICanSlurpRK));
                        break;

                    case ChunkEntryType.Internal:
                        results.AddRange(RKContainer.SlurpRKsFromField(absolutePath,
                                                                       chunk.RCOLBlock, this.rkContainers, this.ICanSlurpRK));
                        break;

                    case ChunkEntryType.Unique:
                        results.Add(new DefaultConnection(tgiBlock,
                                                          chunk.RCOLBlock, ResourceDataActions.None, absolutePath));
                        break;
                    }
                }
            }
            else if (base.resource is AApiVersionedFields)
            {
                Diagnostics.Log("Slurping RKs for "
                                + rootStr + ":" + ResourceGraph.PrintRK(base.originalKey));
                results.AddRange(RKContainer.SlurpRKsFromField(rootStr,
                                                               base.resource as AApiVersionedFields,
                                                               this.rkContainers, this.ICanSlurpRK));
            }
            return(results);
        }