예제 #1
0
        public void TestCreateGP4()
        {
            using (var extractDir = new TempDir())
            {
                Gp4Creator.CreateProjectFromPKG(extractDir.Path, pkgFile.Path);
                using (var f = File.OpenRead(Path.Combine(extractDir.Path, "Project.gp4")))
                {
                    var project = Gp4Project.ReadFrom(f);
                    Assert.AreEqual(props.EntitlementKey, project.volume.Package.EntitlementKey);
                    Assert.AreEqual(props.VolumeType, project.volume.Type);
                    // TODO: Figure out timezone problems
                    //Assert.AreEqual(props.TimeStamp, project.volume.TimeStamp);


                    var file = File.ReadAllBytes(Path.Combine(extractDir.Path, "test.file"));
                    CollectionAssert.AreEqual(TestFile, file);
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            switch (args[0])
            {
            case "makepfs":
            {
                var proj    = args[1];
                var output  = args[2];
                var outFile = File.OpenWrite(output);
                var props   = new LibOrbisPkg.PFS.PfsProperties
                {
                    BlockSize = 65536,
                    output    = outFile,
                    proj      = Gp4Project.ReadFrom(File.OpenRead(proj)),
                    projDir   = Path.GetDirectoryName(proj)
                };
                new PfsBuilder().BuildPfs(props);
                break;
            }

            case "makepkg":
            {
                var proj       = args[1];
                var project    = Gp4Project.ReadFrom(File.OpenRead(proj));
                var outputPath = args[2];

                using (var outFile = File.Open(
                           Path.Combine(
                               outputPath,
                               $"{project.volume.Package.ContentId}.pkg"),
                           FileMode.Create))
                {
                    new PkgBuilder(project, Path.GetDirectoryName(proj)).Write(outFile);
                }
                break;
            }
            }
        }