Exemplo n.º 1
0
        internal IList <PackageIndexError> AddPackageInternal(string nupkgFilePath, bool force = false)
        {
            if (string.IsNullOrEmpty(nupkgFilePath))
            {
                return(null);
            }

            if (!File.Exists(nupkgFilePath))
            {
                return(null);
            }

            ZipPackage package = null;

            try
            {
                using (var fs = File.OpenRead(nupkgFilePath))
                {
                    package = new ZipPackage(fs);
                }
            }
            catch (Exception e)
            {
                _logger.WriteError(string.Format("Failed to open package file '{0}'. Message: '{1}'", nupkgFilePath, e.Message));
            }

            return(_index.AddPackage(package, force));
        }