Exemplo n.º 1
0
        /// <summary>
        /// Compresses the local Gatekeeper directory into a new pack file.
        /// </summary>
        /// <returns></returns>
        public async Task <bool> PackGKDir()
        {
            try
            {
                Progress = new ProgressCounter();
                var gzip = new GZipCompress(Progress);
                if (!Directory.Exists(Paths.GKPackFileFDir))
                {
                    Directory.CreateDirectory(Paths.GKPackFileFDir);
                }

                if (File.Exists(Paths.GKPackFileFullPath))
                {
                    File.Delete(Paths.GKPackFileFullPath);
                }
                await Task.Run(() => { gzip.CompressDirectory(Paths.GKLocalInstallDir, Paths.GKPackFileFullPath); });

                return(true);
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Decompresses the pack file into a local working directory.
        /// </summary>
        /// <returns></returns>
        private async Task <bool> UnPackGKDir()
        {
            try
            {
                OnStatusMessage("Unpacking....");
                Progress = new ProgressCounter();
                var gzip = new GZipCompress(Progress);
                await Task.Run(() => { gzip.DecompressToDirectory(Paths.GKPackFileFullPath, Paths.GKExtractDir); });

                return(true);
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                return(false);
            }
        }