本文整理汇总了C#中System.Version.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Version.Parse方法的具体用法?C# Version.Parse怎么用?C# Version.Parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Version
的用法示例。
在下文中一共展示了Version.Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateInfo
public UpdateDetails UpdateInfo()
{
lock (this)
{
Version = null;
InstallUrl = null;
this.LastCheckTime = DateTime.Now;
IsFaulted = true;
var url = AppConfig.UpdateInfoPath;
try
{
var wr = WebRequest.Create(url);
wr.Timeout = 15000;
var resp = wr.GetResponse();
var rgrp = resp.GetResponseStream();
if (rgrp != null)
{
using (var reader = XmlReader.Create(rgrp))
{
while (reader.Read())
{
if (!reader.IsStartElement()) continue;
if (reader.IsEmptyElement) continue;
switch (reader.Name.ToLowerInvariant())
{
case "version":
if (reader.Read())
{
Version = Version.Parse(reader.Value);
}
break;
case "installpath":
if (reader.Read())
{
#if(Release_Test)
InstallUrl = "https://s3.amazonaws.com/octgn/releases/test/" + reader.Value.Replace("downloadtest/", "");
#else
InstallUrl = "https://s3.amazonaws.com/octgn/releases/live/" + reader.Value.Replace("download/", "");
#endif
}
break;
}
}
}
}
if (!String.IsNullOrWhiteSpace(InstallUrl) && Version != null)
{
IsFaulted = false;
}
}
catch (WebException e)
{
Log.Warn("", e);
IsFaulted = true;
}
catch (Exception e)
{
Log.Warn("", e);
IsFaulted = true;
}
return this;
}
}
示例2: UpdateInfo
public UpdateDetails UpdateInfo()
{
lock (this)
{
Version = null;
InstallUrl = null;
this.LastCheckTime = DateTime.Now;
IsFaulted = true;
var url = AppConfig.UpdateInfoPath;
try
{
var c = new Octgn.Site.Api.ApiClient();
var info = c.GetReleaseInfo();
if (Program.IsReleaseTest == false)
{
Version = Version.Parse(info.LiveVersion);
this.InstallUrl = info.LiveVersionDownloadLocation;
}
else
{
Version = Version.Parse(info.TestVersion);
this.InstallUrl = info.TestVersionDownloadLocation;
}
if (!String.IsNullOrWhiteSpace(InstallUrl) && Version != null)
{
IsFaulted = false;
}
}
catch (WebException e)
{
Log.Warn("", e);
IsFaulted = true;
}
catch (Exception e)
{
Log.Warn("", e);
IsFaulted = true;
}
return this;
}
}