Beispiel #1
0
        public static void ExtractPKG(string filePath)
        {
            // Directory
            string dirPath = Path.GetFileNameWithoutExtension(filePath);

            dirPath = Path.Combine(Path.GetDirectoryName(filePath), dirPath);
            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }

            var archive = new PKGArchive();

            // Loads the archive
            Print("Loading...");
            archive.Load(filePath);

            // Extract the archive
            Print("Extracting...");
            // Extracts all the files with percent output
            for (int i = 0; i < archive.Data.Count; ++i)
            {
                var data = archive.Data[i];
                data.Extract(Path.Combine(dirPath, data.Name));
                int percent = (int)(((float)i / archive.Data.Count) * 100f);
                Print($"{percent}%\r", false);
            }

            Print("Done!");
        }
Beispiel #2
0
        public static void RepackPKG(string dirPath)
        {
            // Archive
            var archive = new PKGArchive();

            // Adds Files
            Print("Adding Files...");
            archive.AddDirectory(dirPath, false);
            // Saving Archive
            Print("Saving...");
            archive.Save(dirPath + ".pkg");

            Print("Done!");
        }