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


C# OptimizedZipPackage.GetFullName方法代碼示例

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


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

示例1: push_package

        public static void push_package(ChocolateyConfiguration config, string nupkgFilePath)
        {
            var timeout = TimeSpan.FromSeconds(Math.Abs(config.PushCommand.TimeoutInSeconds));
            if (timeout.Seconds <= 0)
            {
                timeout = TimeSpan.FromMinutes(5); // Default to 5 minutes
            }
            const bool disableBuffering = false;

            var packageServer = new PackageServer(config.Sources, ApplicationParameters.UserAgent);
            packageServer.SendingRequest += (sender, e) => { if (config.Verbose) "chocolatey".Log().Info(ChocolateyLoggers.Verbose, "{0} {1}".format_with(e.Request.Method, e.Request.RequestUri)); };

            var package = new OptimizedZipPackage(nupkgFilePath);

            try
            {
                packageServer.PushPackage(
                    config.PushCommand.Key,
                    package,
                    new FileInfo(nupkgFilePath).Length,
                    Convert.ToInt32(timeout.TotalMilliseconds),
                    disableBuffering);
            }
            catch (InvalidOperationException ex)
            {
                var message = ex.Message;
                if (!string.IsNullOrWhiteSpace(message) && message.Contains("(500) Internal Server Error"))
                {
                    throw new ApplicationException("There was an internal server error, which might mean the package already exists on a Simple OData Server.", ex);
                }

                throw;
            }


            "chocolatey".Log().Info(ChocolateyLoggers.Important, () => "{0} was pushed successfully to {1}".format_with(package.GetFullName(), config.Sources));
        }
開發者ID:secretGeek,項目名稱:choco,代碼行數:37,代碼來源:NugetPush.cs


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