Esempio n. 1
0
        protected void CompressFile(string path, string srcDir, string dstDir, out string newPath, out string itemPath)
        {
            newPath = path.Replace(srcDir, dstDir) + ".gzip";
            string newDir = Path.GetDirectoryName(newPath);

            if (!Directory.Exists(newDir))
            {
                Directory.CreateDirectory(newDir);
            }

            if (newDir.Length <= dstDir.Length)
            {
                itemPath = String.Empty;
            }
            else
            {
                itemPath = newDir.Substring(dstDir.Length + 1, newDir.Length - dstDir.Length - 1);

                if (String.IsNullOrEmpty(itemPath))
                {
                    itemPath = String.Empty;
                }
            }

            GZipCompression.CompressFile(path, newPath);
        }