예제 #1
0
        public void ShouldConfigMapping()
        {
            ExtensionList extensions = new ExtensionList();

            FluentConfig.Configure(extensions)
            .MapingFromAssemblyOf <FluentConfigTest>();

            Assert.IsTrue(extensions.ContainsKey(typeof(Dbo1).FullName), "Not mapping");
            Assert.IsFalse(extensions.ContainsKey(typeof(Dbo2).FullName), "Fail mapping for abstract");
            Assert.IsFalse(extensions.ContainsKey(typeof(Dbo3).FullName), "Fail mapping for generic");
        }
예제 #2
0
        private void ReadFiles(string fileName, FileReader reader)
        {
            string name = System.IO.Path.GetFileNameWithoutExtension(fileName);

            ResourceType type           = (ResourceType)reader.ReadUInt32();
            uint         size           = reader.ReadUInt32();
            uint         nextFileOffset = reader.ReadUInt32();

            reader.Seek(20); //padding

            if (size == 0)
            {
                return;
            }

            string extension = $"_{type}.bin";

            if (ExtensionList.ContainsKey(type))
            {
                extension = ExtensionList[type];
            }

            byte[] data = reader.ReadBytes((int)size);

            //File data right after
            var file = new FileEntry()
            {
                Type     = type,
                FileName = $"Root/RawFiles/{name}_File{Files.Count}{extension}",
            };

            file.SetData(data);
            Files.Add(file);
            if (nextFileOffset != 0)
            {
                reader.SeekBegin(nextFileOffset);
                ReadFiles(fileName, reader);
            }
        }
예제 #3
0
        private ObjectTreeNode LoadChunkTabe()
        {
            ObjectTreeNode root = new ObjectTreeNode();

            Dictionary <ChunkFileType, ObjectTreeNode> FileContainers = new Dictionary <ChunkFileType, ObjectTreeNode>();
            Dictionary <uint, DATA_Parser.FileEntry>   animationFiles = new Dictionary <uint, DATA_Parser.FileEntry>();

            foreach (var file in DataFile.Files)
            {
                if (!animationFiles.ContainsKey(file.Hash))
                {
                    animationFiles.Add(file.Hash, file);
                }
                if (!GlobalFileList.ContainsKey(file.Hash))
                {
                    GlobalFileList.Add(file.Hash, file);
                }
            }

            Dictionary <string, ObjectTreeNode> fileGrouper = new Dictionary <string, ObjectTreeNode>();

            foreach (var file in DataFile.Files)
            {
                ChunkFileType type = file.ChunkEntry.ChunkType;
                if (!FileContainers.ContainsKey(type))
                {
                    FileContainers.Add(type, new ObjectTreeNode(type.ToString() + $"_{type.ToString("X")}"));
                    root.AddChild(FileContainers[type]);
                }

                var folder   = FileContainers[file.ChunkEntry.ChunkType];
                var fileNode = new ObjectTreeNode(file.Hash.ToString());
                fileNode.Tag = file.ChunkEntry.Data;

                if (type == ChunkFileType.Model)
                {
                    fileNode = new ModelWrapper(file, DataFile);
                }
                if (type == ChunkFileType.AnimationData)
                {
                    fileNode = new AnimationWrapper(file, DataFile);
                }
                if (type == ChunkFileType.Texture)
                {
                    fileNode = new TextureWrapper(file, DataFile);
                }
                if (type == ChunkFileType.Skeleton)
                {
                    fileNode = new SkeletonWrapper(file, DataFile);
                }
                if (type == ChunkFileType.Script)
                {
                    fileNode = new ScriptWrapper(file, DataFile);
                }
                if (type == ChunkFileType.AnimationBundles)
                {
                    fileNode = new AnimationBundleWrapper(file, DataFile, animationFiles);
                }

                //Attempt to group common hashes
                if (type == ChunkFileType.Model)
                {
                    fileGrouper.Add(fileNode.Label, fileNode);
                }

                if (type != ChunkFileType.Model && fileGrouper.ContainsKey(fileNode.Label))
                {
                    ObjectTreeNode tfolder = new ObjectTreeNode(type.ToString());
                    tfolder.AddChild(fileNode);
                    fileGrouper[fileNode.Label].AddChild(tfolder);
                }
                else
                {
                    folder.AddChild(fileNode);
                }

                if (type == ChunkFileType.Model)
                {
                    ObjectTreeNode chunkList = new ObjectTreeNode("Chunks");
                    fileNode.AddChild(chunkList);

                    foreach (var child in file.ChunkEntry.SubData)
                    {
                        chunkList.AddChild(ReadChunk(child));
                    }
                }
                else
                {
                    foreach (var child in file.ChunkEntry.SubData)
                    {
                        fileNode.AddChild(ReadChunk(child));
                    }
                }

                fileNode.Label += $"_({folder.ChildCount})";
                if (ExtensionList.ContainsKey(file.ChunkEntry.ChunkType))
                {
                    fileNode.Label += ExtensionList[file.ChunkEntry.ChunkType];
                }

                if (Hashing.HashNames.ContainsKey(file.Hash))
                {
                    fileNode.Label = Hashing.HashNames[file.Hash];
                }
            }
            return(root);
        }