Esempio n. 1
0
 public static void Pack(PackVerbs packVerbs)
 {
     if (packVerbs.OutputPath.ToLower().EndsWith("gpb"))
     {
         var gpb = new GpbData3();
         gpb.AddFilesFromFolder(packVerbs.InputPath);
         gpb.Pack(packVerbs.OutputPath, !packVerbs.LittleEndian);
     }
     else if (packVerbs.OutputPath.EndsWith("mpackage"))
     {
         AdhocPackage.PackFromFolder(packVerbs.InputPath, packVerbs.OutputPath);
     }
     else
     {
         Console.WriteLine("Found nothing to pack - ensure the provided output path has the proper file extension (gpb/mpackage)");
     }
 }
Esempio n. 2
0
        public static void Unpack(UnpackVerbs unpackVerbs)
        {
            if (unpackVerbs.InputPath.ToLower().EndsWith("gpb"))
            {
                Console.WriteLine("Assuming input is GPB");
                var gpb = GpbBase.ReadFile(unpackVerbs.InputPath);
                if (gpb is null)
                {
                    Console.WriteLine("Could not parse GPB Header.");
                    return;
                }

                gpb.Unpack(Path.GetFileNameWithoutExtension(unpackVerbs.InputPath), unpackVerbs.OutputPath);
            }
            else if (unpackVerbs.InputPath.EndsWith("mpackage"))
            {
                Console.WriteLine("Assuming input is MPackage");
                AdhocPackage.ExtractPackage(unpackVerbs.InputPath);
            }
            else
            {
                Console.WriteLine("Found nothing to unpack - ensure the provided input file has the proper file extension (gpb/mpackage)");
            }
        }