Inheritance: IFolder, IDisposable
        void IUtilityCommand.Run(Utility utility, string[] args)
        {
            var filename = Path.GetFileName(args[1]);
            var path = Path.GetDirectoryName(args[1]);

            var fs = new FileSystem.FileSystem(utility.Mods);

            // Needed to access the global mix database
            fs.LoadFromManifest(utility.ModData.Manifest);

            fs.Mount(path, "parent");
            var package = new MixFile(fs, "parent|" + filename);

            foreach (var kv in package.Index.OrderBy(kv => kv.Value.Offset))
            {
                Console.WriteLine("{0}:", kv.Key);
                Console.WriteLine("\tOffset: {0}", kv.Value.Offset);
                Console.WriteLine("\tLength: {0}", kv.Value.Length);
            }
        }
Exemple #2
0
        bool IPackageLoader.TryParsePackage(Stream s, string filename, FileSystem context, out IReadOnlyPackage package)
        {
            if (!filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
            {
                package = null;
                return(false);
            }

            // Load the global mix database
            Stream mixDatabase;
            var    allPossibleFilenames = new HashSet <string>();

            if (context.TryOpen("global mix database.dat", out mixDatabase))
            {
                using (var db = new XccGlobalDatabase(mixDatabase))
                    foreach (var e in db.Entries)
                    {
                        allPossibleFilenames.Add(e);
                    }
            }

            package = new MixFile(s, filename, allPossibleFilenames);
            return(true);
        }