本文整理匯總了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));
}