예제 #1
0
        private static void SdPrintTest(Options options)
        {
            if (options.Input == null)
            {
                throw new NullReferenceException("No input path was specified.");
            }
            if (options.Output == null)
            {
                throw new NullReferenceException("No output path was specified.");
            }

            IFileSystem fs = new Xb2FileSystem(options.Input);

            File.WriteAllLines(options.Output,
                               fs.EnumerateEntries().Where(x => x.Type == DirectoryEntryType.File).Select(x => x.FullPath));

            var localFs = new LocalFileSystem("output");

            fs.CopyFileSystem(localFs, options.Progress);
        }
예제 #2
0
        private static void GenerateSite(Options options)
        {
            if (options.SdPath == null)
            {
                throw new NullReferenceException("Must specify SD card path.");
            }
            if (options.Output == null)
            {
                throw new NullReferenceException("No output path was specified.");
            }
            if (!Directory.Exists(options.SdPath))
            {
                throw new DirectoryNotFoundException($"{options.SdPath} is not a valid directory.");
            }

            options.Progress.LogMessage("Reading XB2 directories");
            var xb2Fs = new Xb2FileSystem(options.SdPath);

            Website.Generate.GenerateSite(xb2Fs, options.Output, options.Progress);
        }
예제 #3
0
        private static BdatTables ReadBdatTables(Options options, bool readMetadata)
        {
            if (options.Game == Game.XB2 && options.ArdFilename != null)
            {
                using (var headerFile = new LocalFile(options.ArhFilename, OpenMode.Read))
                    using (var dataFile = new LocalFile(options.ArdFilename, OpenMode.Read))
                    {
                        var archive = new ArchiveFileSystem(headerFile, dataFile);
                        return(new BdatTables(archive, readMetadata));
                    }
            }

            if (options.Game == Game.XB2 && options.SdPath != null)
            {
                var archive = new Xb2FileSystem(options.SdPath);
                return(new BdatTables(archive, readMetadata));
            }

            string pattern = options.Filter ?? "*";

            string[] filenames = Directory.GetFiles(options.BdatDir, pattern);
            return(new BdatTables(filenames, options.Game, readMetadata));
        }
예제 #4
0
        private static void ReadGimmick(Options options)
        {
            if (options.SdPath == null)
            {
                throw new NullReferenceException("Must specify SD card path.");
            }
            if (options.Output == null)
            {
                throw new NullReferenceException("No output path was specified.");
            }
            if (!Directory.Exists(options.SdPath))
            {
                throw new DirectoryNotFoundException($"{options.SdPath} is not a valid directory.");
            }

            var xb2Fs = new Xb2FileSystem(options.SdPath);

            BdatCollection tables = GetBdatCollection(xb2Fs, false);

            MapInfo[] gimmicks = ReadGmk.ReadAll(xb2Fs, tables);
            ExportMap.ExportCsv(gimmicks, options.Output);

            ExportMap.Export(xb2Fs, gimmicks, options.Output);
        }