예제 #1
0
        public ModValidator( Stream stream )
        {
            resources = GameResources.Deserialize( GetResourceManifest() );
            ExpansionResourcesUsed = new GameResources();

            mod = ContentDirectory.Create( stream );
        }
예제 #2
0
        public ModValidator(string path)
        {
            resources = GameResources.Deserialize(GetResourceManifest());
            ExpansionResourcesUsed = new GameResources();

            mod = ContentDirectory.Create(path, false);
        }
예제 #3
0
        public ModValidator( string path )
        {
            resources = GameResources.Deserialize( GetResourceManifest() );
            ExpansionResourcesUsed = new GameResources();

            mod = ContentDirectory.Create( path, false );
        }
예제 #4
0
        public ModValidator(Stream stream)
        {
            resources = GameResources.Deserialize(GetResourceManifest());
            ExpansionResourcesUsed = new GameResources();

            mod = ContentDirectory.Create(stream);
        }
예제 #5
0
 private void AddFileResources(ContentDirectory source, string extension, FileResourceType type)
 {
     foreach (var file in source.EnumerateFiles(String.Format("*.{0}", extension), SearchOption.AllDirectories))
     {
         AddFileResource(source, type, file);
     }
 }
예제 #6
0
        private void PopulateXmlResources(ContentDirectory source)
        {
            var files = source.EnumerateXmlFiles(DredmorInfo.XmlFilesToLoadResources, SearchOption.AllDirectories);

            foreach (var file in files)
            {
                XDocument doc = XDocument.Load(file.OpenRead());

                switch (file.Name.ToLower())
                {
                case "craftdb.xml":
                    PopulateCraftResources(doc, file.ExpansionNumber);
                    break;

                case "itemdb.xml":
                    PopulateItemResources(doc, file.ExpansionNumber);
                    PopulatePowerResources(doc, file.ExpansionNumber);
                    break;

                case "mondb.xml":
                    PopulateMonsterResources(doc, file.ExpansionNumber);
                    PopulateTaxaResources(doc, file.ExpansionNumber);
                    break;

                case "soundfx.xml":
                    PopulateSfxResources(doc, file.ExpansionNumber);
                    break;

                case "spelldb.xml":
                    PopulateSpellResources(doc, file.ExpansionNumber);
                    break;
                }
            }
        }
예제 #7
0
 private void PopulatePhysicalResources(ContentDirectory source)
 {
     AddFileResources(source, "png", FileResourceType.Image);
     AddFileResources(source, "spr", FileResourceType.Sprite);
     AddFileResources(source, "wav", FileResourceType.Wave);
     AddFileResources(source, "pal", FileResourceType.Palette);
     AddXmlSpriteResources(source);
     AddAnimationResources(source);
 }
예제 #8
0
        private void PopulateResources(ContentDirectory source)
        {
            PopulatePhysicalResources(source);
            PopulateXmlResources(source);

            if (source.IsCoreGame)
            {
                AddHardCodedResources();
            }
        }
예제 #9
0
 private void AddFileResource(ContentDirectory source, FileResourceType type, ContentFile file)
 {
     this.Files.Add(
         new FileResource
     {
         Path            = file.SourceRelativePath.ToForwardSlashes(),
         ExpansionNumber = file.ExpansionNumber,
         Type            = type
     }
         );
 }
예제 #10
0
        private void AddXmlSpriteResources(ContentDirectory source)
        {
            //This ignores the "DB" XML files from the search and considers all other XMl files as sprite files.
            var xmlSpriteFiles =
                source.EnumerateFiles("*.xml", SearchOption.AllDirectories)
                .Where(p => !DredmorInfo.AllContentXmlFiles.Any(q => q == p.Name.ToLower()));

            foreach (var file in xmlSpriteFiles)
            {
                AddFileResource(source, FileResourceType.XmlSprite, file);
            }
        }
예제 #11
0
        private void AddAnimationResources(ContentDirectory source)
        {
            var animationFirstFrames =
                source.EnumerateFiles("*0000.png", SearchOption.AllDirectories);

            foreach (var file in animationFirstFrames)
            {
                this.Animations.Add(
                    new AnimationResource
                {
                    Name            = file.SourceRelativePath.Replace("0000.png", String.Empty).ToLower().ToForwardSlashes(),
                    FrameCount      = GetAnimationFrameCount(file),
                    ExpansionNumber = file.ExpansionNumber
                }
                    );
            }
        }
예제 #12
0
 public CoreValidator(string path)
 {
     core = ContentDirectory.Create(path, true);
 }
예제 #13
0
 /// <summary>
 /// Loads all references and resources from the specified source.
 /// </summary>
 /// <param name="source"></param>
 public void LoadResources(ContentDirectory source)
 {
     PopulateResources(source);
 }
예제 #14
0
 public CoreValidator( string path )
 {
     core = ContentDirectory.Create( path, true );
 }