Bloom.Collection.BloomPack.BloomPackInstallDialog.GetRootFolderName C# (CSharp) Method

GetRootFolderName() private method

private GetRootFolderName ( ) : string
return string
        private string GetRootFolderName()
        {
            string rootDirectory = null;
            ZipFile zip = null;
            try
            {
                zip = new ZipFile(_path);
                foreach (ZipEntry zipEntry in zip)
                {
                    var parts = zipEntry.Name.Split(new[] { '/', '\\' });
                    if (rootDirectory != null && rootDirectory != parts[0])
                    {
                        if (InvokeRequired)
                            Invoke(new ReportBadBloomPack(ReportInvalidBloomPack));
                        else
                            ReportInvalidBloomPack();
                        return null;
                    }
                    rootDirectory = parts[0];
                }
            }
            catch (Exception ex)
            {
                // Report a corrupt file instead of crashing.  See http://issues.bloomlibrary.org/youtrack/issue/BL-2485.
                if (InvokeRequired)
                    Invoke(new ReportBadBloomPack(ReportErrorUnzippingBloomPack));
                else
                    ReportErrorUnzippingBloomPack();
                return null;
            }
            finally
            {
                if (zip != null)
                    zip.Close();
            }
            return rootDirectory;
        }