Пример #1
0
        private void Init()
        {
            var mapParser = new MapParser(this.MapPath);
            var map       = mapParser.Parse();

            this.Sounds.AddRange(map.Sounds);
            this.Models.AddRange(map.Models);

            var allShaders = ShaderParser.ReadShaders(Path.Combine(this.ETMain, "scripts")).ToList();

            var(usedTextures, usedShaderFiles) = ShaderParser.GetRequiredFiles(map, allShaders);

            this.Shaders.AddRange(usedShaderFiles);
            this.Textures.AddRange(usedTextures);

            if (MapscriptParser.HasScript(map))
            {
                var msParser  = new MapscriptParser(map);
                var mapscript = msParser.Parse();
                this.Sounds.AddRange(mapscript.Sounds);
                this.Textures.AddRange(mapscript.Remaps);
                this.MiscFiles.Add(mapscript.FullPath);
            }
            else
            {
                Log.Info($"Mapscript not found '{MapscriptParser.GetScriptPath(map.FullPath)}'");
            }

            if (SpeakerscriptParser.HasSpeakerscript(map))
            {
                var spsParser     = new SpeakerscriptParser(map);
                var speakerscript = spsParser.Parse();
                this.Sounds.AddRange(speakerscript.Sounds);
                this.MiscFiles.Add(speakerscript.FullPath);
            }
            else
            {
                Log.Info($"Speaker script not found" +
                         $" '{SpeakerscriptParser.GetScriptPath(map.FullPath)}'");
            }

            if (SoundscriptParser.HasSoundscript(map))
            {
                var ssparser    = new SoundscriptParser(map);
                var soundscript = ssparser.Parse();
                this.Sounds.AddRange(soundscript.Sounds);
                this.MiscFiles.Add(soundscript.FullPath);
            }
            else
            {
                Log.Info($"Soundscript not found" +
                         $" '{SoundscriptParser.GetScriptPath(map.FullPath)}'");
            }

            // Add lightmaps
            if (Directory.Exists(this.LightmapFolder))
            {
                var lightmaps = Directory.GetFiles(this.LightmapFolder, "lm_????.tga");

                if (!lightmaps.Any())
                {
                    Log.Warn($"Lightmap folder found but " +
                             $"contains no lightmaps ('{this.LightmapFolder}')");
                }

                this.MiscFiles.AddRange(lightmaps);
            }
            else
            {
                Log.Info($"Lightmap folder not found '{this.LightmapFolder}'");
            }

            // Add levelshots, .arena, .objdata, and tracemap
            this.GetMiscFiles();
        }
Пример #2
0
        public void Execute()
        {
            var shaders = ShaderParser.ReadShaders(this.Path);

            ShaderParser.FindDuplicates(shaders);
        }