Ejemplo n.º 1
0
        public FilesFinder(string unitName, ModInfo mod)
        {
            this.mod = mod;
            this.unitName = unitName;
            unitFilePath = FixPath(mod.ModFolder + "\\units\\" + unitName + ".lua");
            ProcessUnitFile();
            explosionTextureNames = customExplosions.Where(e => mod.ExplosionTextures.ContainsKey(e)).SelectMany(e => mod.ExplosionTextures[e]).Concat(customTextures).ToArray();
            expTextures = explosionTextureNames.Where(e => mod.ProjectileTextures.ContainsKey(e)).Select(e => mod.ProjectileTextures[e]).Select(FixPath).Distinct().ToArray();

            expFiles = customExplosions.Where(e => mod.ExplosionFiles.ContainsKey(e)).SelectMany(e => mod.ExplosionFiles[e]).Distinct().Select(FixPath).ToArray();

            resourceLines = String.Join("\n",
                                               explosionTextureNames.Where(n => mod.ProjectileTextures.ContainsKey(n)).Select(n => "      " + n + "= \"" +
                                                                            mod.ProjectileTextures[n].Replace(mod.ModFolder + "/bitmaps/", String.Empty) + "\",").
                                               	ToArray());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var ca = new ModInfo(@"c:\work\zk\trunk\mods\zk");
            var units = File.ReadAllLines("unitlist.txt").Where(x => !string.IsNullOrEmpty(x)).ToArray();
            var resources = new List<string>();
            foreach (var unit in units)
            {
                var f = new FilesFinder(unit, ca);
                f.Print();
                resources.Add(f.CopyTo(@"C:\temp\zkfix"));
            }

            foreach (var resource in resources.SelectMany(r => r.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(s => !String.IsNullOrWhiteSpace(s))).Distinct().OrderBy(x=>x))
            {
                Debug.WriteLine(resource);
            }

            Debug.WriteLine("END");
        }