public ExtensionInstance?LoadExtension(string path)
        {
            if (!File.Exists(path))
            {
                return(null);
            }

            if (Path.GetExtension(path).Equals(".zip", StringComparison.OrdinalIgnoreCase))
            {
                var provider = new ZipFileProvider(path);

                try
                {
                    return(_factory.Create(provider, path));
                }

                // If the manifest file couldn't be found, let's try looking at one layer deep with the name
                // of the file as the first folder. This is what happens when you create a zip file from a folder
                // with Windows or 7-zip
                catch (UpgradeException ex) when(ex.InnerException is FileNotFoundException)
                {
                    var subpath     = Path.GetFileNameWithoutExtension(path);
                    var subprovider = new SubFileProvider(provider, subpath);

                    return(_factory.Create(subprovider, path));
                }
            }

            return(null);
        }
        public void Configure(ICollection <TTo> options)
        {
            foreach (var other in _options.Value)
            {
                foreach (var path in _factory(other.Value))
                {
                    foreach (var match in other.Files.GetFiles(path))
                    {
                        var fileInfo        = other.Files.GetFileInfo(match.Path);
                        var directory       = Path.GetDirectoryName(match.Path) !;
                        var newFileProvider = new SubFileProvider(other.Files, directory);

                        foreach (var obj in ReadAll(fileInfo))
                        {
                            if (obj is IFileOption fileOption)
                            {
                                fileOption.Files = newFileProvider;
                            }

                            options.Add(obj);
                        }
                    }
                }
            }
        }