本文整理汇总了C#中ServiceClient.GetVersions方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient.GetVersions方法的具体用法?C# ServiceClient.GetVersions怎么用?C# ServiceClient.GetVersions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceClient
的用法示例。
在下文中一共展示了ServiceClient.GetVersions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVersion
private static IVersion GetVersion([NotNull] string versionName)
{
Assert.ArgumentNotNull(versionName, "versionName");
var client = new ServiceClient();
var versions = client.GetVersions("Sitecore CMS").ToArray();
IVersion version = null;
while (version == null && versionName.Length > 1)
{
version = versions.FirstOrDefault(x => x.Name == versionName);
versionName = versionName.Substring(0, versionName.Length - 2);
}
Assert.IsNotNull(version, "version");
return version;
}
示例2: ProcessFolder
private static void ProcessFolder(string directory, string outputFolderPath)
{
var client = new ServiceClient();
foreach (var productName in client.GetProductNames())
{
var filePrefix = PackageGenerator.GetFilePrefix(productName);
var prefix = PackageGenerator.GetAbbr(productName);
if (string.IsNullOrEmpty(prefix))
{
continue;
}
foreach (var version in client.GetVersions(productName))
{
var majorMinor = PackageGenerator.GetMajorMinor(version);
foreach (var release in version.Releases)
{
var revision = release.Revision;
var pattern = filePrefix + " " + majorMinor + "* rev. " + revision + ".zip";
var zipfiles = Directory.GetFiles(directory, pattern, SearchOption.AllDirectories);
if (zipfiles.Length <= 0)
{
continue;
}
var releaseVersion = PackageGenerator.GetReleaseVersion(majorMinor, revision);
var file = zipfiles.First();
try
{
// Create nupkg file
new PackageGenerator().Generate(prefix, productName, file, releaseVersion, outputFolderPath);
}
catch (Exception ex)
{
Log.Error("Error processing file " + file + ". " + ex.Message + Environment.NewLine + "Stack trace:" + Environment.NewLine + ex.StackTrace);
}
}
}
}
}