Ejemplo n.º 1
0
        /// <summary>
        /// Opens an FnPak
        /// </summary>
        /// <param name="fnPak">FnPak</param>
        /// <param name="subDir">SubDir</param>
        /// <returns></returns>
        public DataTypes.FnPak OpenFnPak(string fnPak, string subDir)
        {
            var unpackPath = CheckSubPathString(TempDir) + CheckSubPathString(subDir) +
                             CheckSubPathString(Guid.NewGuid().ToString());

            DirectoryTools.CreateHiddenDirectory(TempDir);
            Directory.CreateDirectory(unpackPath);
            var pak = UnpackFnPak(ZipFile.Open(fnPak, ZipArchiveMode.Read), unpackPath);

            _pakDictionary.Add(fnPak, pak);
            return(pak);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens an FnPak
        /// </summary>
        /// <param name="fnPak">fnPak</param>
        /// <param name="subDir">subDir</param>
        /// <param name="password">password</param>
        /// <returns></returns>
        public DataTypes.FnPak OpenFnPak(string fnPak, string subDir, string password)
        {
            var unpackPath = CheckSubPathString(TempDir) + CheckSubPathString(subDir) +
                             CheckSubPathString(Guid.NewGuid().ToString());

            DirectoryTools.CreateHiddenDirectory(TempDir);
            Directory.CreateDirectory(unpackPath);
            var memStream = Encryption.DecryptFileToMemory(fnPak, password);
            var pak       = UnpackFnPak(new ZipArchive(memStream), unpackPath);

            _pakDictionary.Add(fnPak, pak);
            return(pak);
        }