Exemplo n.º 1
0
        public IEnumerable <IFile> GetChildren()
        {
            if (!IsContainer)
            {
                return(new List <IFile>());
            }
            LoadPackages();
            var children = _packages.SelectMany(x => x.GetChildren()).ToList();
            var dirs     = DirectoryInfo.GetDirectories().Select <DirectoryInfo, IFile>(x =>
            {
                var nf   = new NativeFile(x);
                var paks = children.Where(p => String.Equals(x.Name, p.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();
                if (paks.Any())
                {
                    paks.Insert(0, nf);
                    return(new CompositeFile(this, paks));
                }
                return(nf);
            }).ToList();

            foreach (var d in children)
            {
                if (!dirs.Any(x => String.Equals(x.Name, d.Name, StringComparison.CurrentCultureIgnoreCase)))
                {
                    dirs.Add(d);
                }
            }
            return(dirs);
        }
Exemplo n.º 2
0
 public void TestLoadVtfImage()
 {
     //var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\mudground001_height-ssbump.vtf");
     //var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\dirtroad001a.vtf");
     //var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\rockground001.vtf");
     //var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\class_demo_dudv.vtf");
     var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\cubemap_gold001.hdr.vtf");
     //var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\800corner.vtf");
     var image = VtfProvider.GetImage(file);
     image.Save(@"D:\Github\sledge\_Resources\VTF\_test2.png");
 }
Exemplo n.º 3
0
        public static void Start()
        {
            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new VmfProvider());
            GameDataProvider.Register(new FgdProvider());
            TextureProvider.Register(new WadProvider());

               // var editor = new Editor.Editor();
               // editor.Load += (sender, e) => PostStart(sender as Editor.Editor);
               // Application.Run(editor);
               // var settings = Context.DBContext.GetAllSettings().ToDictionary(x => x.Key, x => x.Value);
               // Serialise.DeserialiseSettings(settings);
               // var settingsform = new Editor.Settings.SettingsForm();
               // Application.Run(settingsform);

               // var map = MapProvider.GetMapFromFile(MapFile);
               // Document.Game = Game;
               // Document.Map = map;
               // Document.GameData = GameDataProvider.GetGameDataFromFiles(Game.Fgds.Select(f => f.Path));
               // var entity = new EntityEditor();
               // entity.Objects.AddRange(map.WorldSpawn.Children.OfType<Entity>().Take(1));
               // Application.Run(entity);

            /*
            var nat = new NativeFile(new DirectoryInfo(@"F:\Steam\steamapps\common\Half-Life"));
            var gcf1 = new GcfFile(@"F:\Steam\steamapps\half-life.gcf");
            var gcf2 = new GcfFile(@"F:\Steam\steamapps\half-life engine.gcf");
            //var gcf3 = new GcfFile(@"F:\Steam\steamapps\half-life base content.gcf");
            var gcf4 = new GcfFile(@"F:\Steam\steamapps\platform.gcf");
            var com = new CompositeFile(null, new IFile[] { nat, gcf1, gcf2, gcf4 });
            */
            var nat = new NativeFile(new DirectoryInfo(@"F:\Half-Life WON"));
            var com = new CompositeFile(null, new[]
            {
                new NativeFile(new DirectoryInfo(@"F:\Half-Life WON\valve")),
                new NativeFile(new DirectoryInfo(@"F:\Half-Life WON\tfc")),
            });
            //var pak = new PakFile(@"F:\Half-Life WON\valve\pak0.pak");
               // var vir = new VirtualFile(null, "valve", new[] {pak});
            //var com = new CompositeFile(null, new IFile[] { nat, vir });
            var fsb = new FileSystemBrowserControl {Dock = DockStyle.Fill, File = com};//, FilterText = "WAD Files", Filter = "*.wad"};
            var form = new Form {Controls = {fsb}, Width = 500, Height = 500};
            Application.Run(form);
        }
Exemplo n.º 4
0
 public IEnumerable<IFile> GetChildren()
 {
     if (!IsContainer) return new List<IFile>();
     LoadPakFiles();
     var children = _pakFiles.SelectMany(x => x.GetChildren()).ToList();
     var dirs = DirectoryInfo.GetDirectories().Select<DirectoryInfo, IFile>(x =>
     {
         var nf = new NativeFile(x);
         var paks = children.Where(p => String.Equals(x.Name, p.Name, StringComparison.CurrentCultureIgnoreCase)).ToList();
         if (paks.Any())
         {
             paks.Insert(0, nf);
             return new CompositeFile(this, paks);
         }
         return nf;
     }).ToList();
     foreach (var d in children)
     {
         if (!dirs.Any(x => String.Equals(x.Name, d.Name, StringComparison.CurrentCultureIgnoreCase)))
         {
             dirs.Add(d);
         }
     }
     return dirs;
 }
Exemplo n.º 5
0
 public void TestLoadVtfSize()
 {
     var file = new NativeFile(@"D:\Github\sledge\_Resources\VTF\rockground001.vtf");
     var size = VtfProvider.GetSize(file);
 }
Exemplo n.º 6
0
 private IFile CreateChild(DirectoryInfo dir)
 {
     var nf = new NativeFile(dir);
     var paks = dir.GetFiles("*.pak");
     if (paks.Any())
     {
         var list = paks.Select(x => new PakFile(x.FullName)).OfType<IFile>().ToList();
         list.Insert(0, nf);
         return new CompositeFile(this, list);
     }
     return nf;
 }