當前位置: 首頁>>代碼示例>>C#>>正文


C# ZipPackage.GetFullName方法代碼示例

本文整理匯總了C#中NuGet.ZipPackage.GetFullName方法的典型用法代碼示例。如果您正苦於以下問題:C# ZipPackage.GetFullName方法的具體用法?C# ZipPackage.GetFullName怎麽用?C# ZipPackage.GetFullName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NuGet.ZipPackage的用法示例。


在下文中一共展示了ZipPackage.GetFullName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FindPackage

        private IPackage FindPackage(out string path)
        {
            path = null;
            var dir = CommonHelper.MapPath(UpdatePackagePath, false);

            if (!Directory.Exists(dir))
                return null;

            var files = Directory.GetFiles(dir, "SmartStore.*.nupkg", SearchOption.TopDirectoryOnly);

            // TODO: allow more than one package in folder and return newest
            if (files == null || files.Length == 0 || files.Length > 1)
                return null;

            IPackage package = null;

            try
            {
                path = files[0];
                package = new ZipPackage(files[0]);
                _logger = CreateLogger(package);
                _logger.Information("Found update package '{0}'".FormatInvariant(package.GetFullName()));
                return package;
            }
            catch { }

            return null;
        }
開發者ID:omidghorbani,項目名稱:SmartStoreNET,代碼行數:28,代碼來源:AppUpdater.cs

示例2: DoConfigure

        private string DoConfigure(string packagePath, Environment env, string outputPath)
        {
            _logger.InfoFormat("Configuring package {0} for {1}", new FileInfo(packagePath).Name, env.Name.ToUpper());
            var workingDir = _fileSystem.CreateTempWorkingDir();

            _logger.DebugFormat("Create temp work dir {0}", workingDir);

            // read nupkg metadata
            var nupkg = new ZipPackage(packagePath);
            _logger.DebugFormat("Unzipping {0} to {1}", nupkg.GetFullName(), workingDir);

            using (var zip = new ZipFile(packagePath))
            {
                zip.ExtractAll(workingDir);
            }

            _templateEngine.TransformDirectory(workingDir, env);
            var packageName = nupkg.Id + "_v" + nupkg.Version + "_" + env.Name.ToUpper(CultureInfo.InvariantCulture) + ".nupkg";
            var packageOutputPath = Path.Combine(outputPath, packageName);

            _fileSystem.DeleteFile(packageOutputPath);

            using (var zip = new ZipFile(packageOutputPath))
            {
                zip.AddDirectory(workingDir);
                zip.Save();
            }

            _fileSystem.DeleteDirectory(workingDir);

            return packageOutputPath;
        }
開發者ID:tobiaszuercher,項目名稱:PowerDeploy,代碼行數:32,代碼來源:PackageManager.cs


注:本文中的NuGet.ZipPackage.GetFullName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。