Example #1
0
        /// <summary>
        /// Method that fetches the users repo, zips it and returns the zip file.
        /// </summary>
        /// <param name="org">The organization for the service.</param>
        /// <param name="service">The name of the service.</param>
        /// <param name="developer">The current developer.</param>
        /// <returns>The zipped file.</returns>
        public FileStream ZipAndReturnFile(string org, string service, string developer)
        {
            CheckAndUpdateWorkflowFile(org, service, developer);
            string startPath = _settings.GetServicePath(org, service, developer);
            string zipPath   = $"{_settings.GetOrgPath(org, developer)}{service}.zip";

            if (File.Exists(zipPath))
            {
                File.Delete(zipPath);
            }

            ZipFile.CreateFromDirectory(startPath, zipPath);
            return(File.Open(zipPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
        }