Example #1
0
 public IRWSectionFactory GetFactory(RWSectionHeader header, RWSection parent)
 {
     switch (header.Id)
       {
     case RWSections.RWStruct:
       switch (parent.Header.Id)
       {
     case RWSections.RWTextureDictionary:
       return new RWSectionFactory<TextureDictionaryStructureSection>();
     case RWSections.RWTextureNative:
       return new RWSectionFactory<TextureNativeStructureSection>();
     default:
       return null;
       }
     case RWSections.RWExtension:
       switch (parent.Header.Id)
       {
     default:
       return null;
       }
     case RWSections.RWTextureDictionary:
       return new RWSectionFactory<TextureDictionarySection>();
     case RWSections.RWTextureNative:
       return new RWSectionFactory<TextureNativeSection>();
     default:
       return null;
       }
 }
Example #2
0
 private void BuildTreeNode(RWSection section, TreeNodeCollection parentNodes)
 {
     if (section.Header.Id != RWSections.RWNull) {
         SectionTreeNode node = new SectionTreeNode(section);
         parentNodes.Add(node);
         foreach (RWSection childSeciton in section.Childs) {
             BuildTreeNode(childSeciton, node.Nodes);
         }
     }
 }
 private IRWSectionFactory GetFactory(RWSectionHeader header, RWSection parent)
 {
     IRWSectionFactory factory = null;
       foreach (ISectionLoader loader in loaders)
       {
     factory = loader.GetFactory(header, parent);
     if (factory != null)
       return factory;
       }
       return (new RWSectionLoader() as ISectionLoader).GetFactory(header, parent);
 }
 internal void LoadSections(BinaryReader reader, RWSection parent)
 {
     while (reader.BaseStream.Position < parent.Header.StartPos + parent.Header.Size)
       {
     RWSection section = LoadSection(reader, parent);
     if (section != null)
     {
       section.Parent = parent;
       parent.Childs.Add(section);
     }
       }
 }
Example #5
0
 public IRWSectionFactory GetFactory(RWSectionHeader header, RWSection parent)
 {
     switch (header.Id)
       {
     case RWSections.RWNull:
       return new RWSectionFactory<NullSection>();
     case RWSections.RWExtension:
       return new RWSectionFactory<ExtensionSection>();
     case RWSections.RWStruct:
       return new RWSectionFactory<StructureSection>();
     default:
       return new RWSectionFactory<UnknownSection>();
       }
 }
 private bool IsContainerSection(BinaryReader reader, RWSectionHeader header, RWSection parent)
 {
     reader.BaseStream.Seek(header.StartPos, SeekOrigin.Begin);
       if (header.Size > HeaderSize)
       {
     RWSectionHeader newHeader = new RWSectionHeader();
     newHeader.LoadFromStream(reader);
     if ((newHeader.Version == header.Version) && (newHeader.Size < header.Size))
     {
       reader.BaseStream.Seek(header.StartPos, SeekOrigin.Begin);
       return true;
     }
       }
       reader.BaseStream.Seek(header.StartPos + header.Size, SeekOrigin.Begin);
       return false;
 }
Example #7
0
 private static SectionIndexes GetImageIndexFor(RWSection section)
 {
     if (section is UnknownSection) {
         return SectionIndexes.siUnknown;
     }
     if (section is ExtensionSection) {
         return SectionIndexes.siExtension;
     }
     if (section is DataSection) {
         return SectionIndexes.siData;
     }
     if (section is ContainerSection) {
         return SectionIndexes.siContainer;
     }
     return SectionIndexes.siUnknown;
 }
Example #8
0
 public IRWSectionFactory GetFactory(RWSectionHeader header, RWSection parent)
 {
     switch (header.Id)
       {
     case RWSections.RWExtension:
       switch (parent.Header.Id)
       {
     case RWSections.RWAtomic:
       return new RWSectionFactory<AtomicExtensionSection>();
     case RWSections.RWClump:
       return new RWSectionFactory<ClumpExtensionSection>();
     case RWSections.RWFrameList:
       return new RWSectionFactory<FrameListExtensionSection>();
     case RWSections.RWGeometry:
       return new RWSectionFactory<GeometryExtensionSection>();
     case RWSections.RWMaterial:
       return new RWSectionFactory<MaterialExtensionSection>();
     case RWSections.RWTexture:
       return new RWSectionFactory<TextureExtensionSection>();
     default:
       return null;
       }
     case RWSections.RWStruct:
       switch (parent.Header.Id)
       {
     case RWSections.RWAtomic:
       return new RWSectionFactory<AtomicStructureSection>();
     case RWSections.RWClump:
       return new RWSectionFactory<ClumpStructureSection>();
     case RWSections.RWFrameList:
       return new RWSectionFactory<FrameListStructureSection>();
     case RWSections.RWGeometryList:
       return new RWSectionFactory<GeometryListStructureSection>();
     case RWSections.RWGeometry:
       return new RWSectionFactory<GeometryStructureSection>();
     case RWSections.RWMaterialList:
       return new RWSectionFactory<MaterialListStructureSection>();
     case RWSections.RWMaterial:
       return new RWSectionFactory<MaterialStructureSection>();
     case RWSections.RWTexture:
       return new RWSectionFactory<TextureStructureSection>();
     default:
       return null;
       }
     case RWSections.RWAtomic:
       return new RWSectionFactory<AtomicSection>();
     case RWSections.RWClump:
       return new RWSectionFactory<ClumpSection>();
     case RWSections.RWFrameList:
       return new RWSectionFactory<FrameListSection>();
     case RWSections.RWGeometryList:
       return new RWSectionFactory<GeometryListSection>();
     case RWSections.RWGeometry:
       return new RWSectionFactory<GeometrySection>();
     case RWSections.RWMaterialList:
       return new RWSectionFactory<MaterialListSection>();
     case RWSections.RWMaterial:
       return new RWSectionFactory<MaterialSection>();
     case RWSections.RWTexture:
       return new RWSectionFactory<TextureSection>();
     case RWSections.RWFrame:
       return new RWSectionFactory<FrameSection>();
     case RWSections.RWBinMeshPLG:
       return new RWSectionFactory<BinMeshPLGSection>();
     case RWSections.RWMaterialEffectsPLG:
       return new RWSectionFactory<MaterialEffectsPLGSection>();
     case RWSections.RWReflectionmaterial:
       return new RWSectionFactory<ReflectionMaterialSection>();
     case RWSections.RWSpecularMaterial:
       return new RWSectionFactory<SpecularMaterialSection>();
     case RWSections.RWUVAnimationPLG:
       return new RWSectionFactory<UVAnimationPLGSection>();
     default:
       return null;
       }
 }
Example #9
0
 public SectionTreeNode(RWSection section)
     : base()
 {
     this.Section = section;
     this.Text = section.Header.ToString();
 }
 private RWSection LoadSection(BinaryReader reader, RWSection parentSection)
 {
     RWSectionHeader header = new RWSectionHeader();
       header.LoadFromStream(reader);
       RWSection section = this.GetFactory(header, parentSection).GetSection(reader, header);
       if ((section is UnknownSection) && IsContainerSection(reader, header, parentSection))
     section = (new RWSectionFactory<ContainerSection>() as IRWSectionFactory).GetSection(reader, header);
       return section;
 }
Example #11
0
 private int GetTreeImageIndex(RWSection section)
 {
     return 0;
 }