本文整理汇总了C#中Version类的典型用法代码示例。如果您正苦于以下问题:C# Version类的具体用法?C# Version怎么用?C# Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于命名空间,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetItem
protected override Item GetItem(ID itemId, Language language, Version version, Database database)
{
Assert.ArgumentNotNull(itemId, "itemId");
Assert.ArgumentNotNull(language, "language");
Assert.ArgumentNotNull(version, "version");
Assert.ArgumentNotNull(database, "database");
if (Switcher<bool, IntegrationDisabler>.CurrentValue) return base.GetItem(itemId, language, version, database);
if (Context.Site == null || !Context.Site.Name.Equals("shell") || Config.ContentDatabase == null)
return base.GetItem(itemId, language, version, database);
// checking for the database validity. we don't want to run this for core db for ex.
if (!Config.SupportedDatabases.Any(d => d.Equals(database.Name)))
return base.GetItem(itemId, language, version, database);
var item = base.GetItem(itemId, language, version, database);
// checking if the item implements IRepository
bool isRepository = item.IsRepository();
if (item == null || !isRepository || item.Name.Equals(Constants.StandardValuesItemName))
{
//if we are not a repository, then leave
return item;
}
var args = new GenericItemProviderArgs(item);
CorePipeline.Run("genericItemProvider", args);
return args.RootItem;
}
开发者ID:JasonBunting,项目名称:SitecoreSuperchargers.GenericItemProvider,代码行数:32,代码来源:GenericItemProvider.cs
示例2: ParseRustcOutput
public static Version ParseRustcOutput(String output)
{
var outputParts = output.Split(' ');
if (outputParts.Length != 4)
return null;
var releaseParts = outputParts[1].Split('.', '-');
if (releaseParts.Length != 4)
return null;
var result = new Version();
try
{
result.VersionMajor = Convert.ToUInt32(releaseParts[0]);
result.VersionMinor = Convert.ToUInt32(releaseParts[1]);
result.VersionPatch = Convert.ToUInt32(releaseParts[2]);
result.VersionVariant = releaseParts[3].Trim().ToLowerInvariant();
}
catch (Exception ex)
{
return null;
}
return result;
}
开发者ID:Boddlnagg,项目名称:VisualRust,代码行数:25,代码来源:Version.cs
示例3: Update
internal void Update(Stream stream)
{
using (var binReader = new BinaryReader(stream))
{
binReader.ReadByte();
Version = binReader.ReadByte();
Model = binReader.ReadByte();
Id = Encoding.UTF8.GetString(binReader.ReadBytes(2), 0, 2);
BootloaderVersion = new Version(
binReader.ReadByte(),
binReader.ReadByte(),
binReader.ReadByte(),
binReader.ReadByte()
);
FirmwareVersion = new Version(
binReader.ReadByte(),
binReader.ReadByte(),
binReader.ReadByte(),
default(byte)
);
var macBuilder = new StringBuilder();
macBuilder.Append(Convert.ToString(binReader.ReadByte(), 16));
for (var i = 0; i < 5; i++)
macBuilder.Append("-").Append(Convert.ToString(binReader.ReadByte(), 16));
MacAddress = macBuilder.ToString();
var ssidLength = binReader.ReadByte();
Ssid = Encoding.UTF8.GetString(binReader.ReadBytes(ssidLength), 0, ssidLength);
}
}
开发者ID:Hansi1904,项目名称:GoPro.Hero,代码行数:32,代码来源:BacpacInformation.cs
示例4: VersionLabel
/// <summary>
/// Constructor for the <c>VersionLabel</c> object. This is
/// used to create a label that can convert from a double to an
/// XML attribute and vice versa. This requires the annotation and
/// contact extracted from the XML schema class.
/// </summary>
/// <param name="contact">
/// this is the field from the XML schema class
/// </param>
/// <param name="label">
/// represents the annotation for the field
/// </param>
public VersionLabel(Contact contact, Version label) {
this.detail = new Signature(contact, this);
this.decorator = new Qualifier(contact);
this.type = contact.Type;
this.name = label.name();
this.label = label;
}
开发者ID:ngallagher,项目名称:simplexml,代码行数:19,代码来源:VersionLabel.cs
示例5: Update
public void Update(Version message)
{
ServerOS = message.os;
ServerOSVersion = message.os;
ServerRelease = message.release;
ServerVersion = message.version;
}
开发者ID:FreeApophis,项目名称:Mumble.net,代码行数:7,代码来源:MumbleClient.cs
示例6: GetUpdateInformation
public static string GetUpdateInformation(string UserAgent, Version version)
{
if (UserAgent.Contains("Mac"))
{
return "It looks like you're running a Mac. There's no .NET Framework download from Microsoft for the Mac, but you might check out either <a href=\"http://www.microsoft.com/silverlight/resources/install.aspx\">Silverlight</a> which is a browser plugin that includes a small version of the .NET Framework. You could also check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on a Mac.";
}
if (UserAgent.Contains("nix"))
{
return "It looks like you're running a Unix machine. There's no .NET Framework download from Microsoft for Unix, but you might check out <a href=\"http://www.go-mono.com/mono-downloads/download.html\">Mono</a>, which is an Open Source platform that can run .NET code on Unix.";
}
if (UserAgent.Contains("fox"))
{
return MessageForBrowser("Firefox");
}
else if (UserAgent.Contains("Chrome"))
{
return MessageForBrowser("Chrome");
}
else if (UserAgent.Contains("Safari")) // Chrome also uses safari in the user agent so this check must come after
{
return MessageForBrowser("Safari");
}
else if(!UserAgent.Contains("MSIE"))
{
return UnknownBrowserMessage();
}
var windowsFactory = new WindowsVersionFactory();
var latest = windowsFactory.GetLatestWindows();
return latest.CheckOs(UserAgent);
}
开发者ID:Lethrir,项目名称:SmallestDotNet,代码行数:33,代码来源:Helpers.cs
示例7: TupleSpace
public TupleSpace(String host, int port, String userName, String password, String[] spaces)
{
try
{
server = new TcpClient(host, port);
writer = new StreamWriter(server.GetStream());
writer.AutoFlush = true;
responseThread = new ResponseThread(new StreamReader(server.GetStream()));
Thread rThread = new Thread(new ThreadStart(responseThread.run));
rThread.IsBackground = true;
rThread.Start();
ConnectCommand cc = new ConnectCommand(userName, password, spaces);
TSResponse response = SendReceive(cc);
Tuple[] tuples = response.Tuples;
this.spaces = new Space[tuples.Length];
for (int i = 0; i < tuples.Length; i++)
{
Field[] f = tuples[i].Fields;
Version v = new Version((int) f[2].Value, (int) f[3].Value,
(int) f[4].Value, (int) f[5].Value, (string) f[6].Value,
(int) f[7].Value);
int spaceId = (int) f[1].Value;
string spaceName = f[0].Value.ToString();
this.spaces[i] = new Space(spaceName, spaceId, v);
}
}
catch (Exception e)
{
throw new TupleSpaceException(e.Message);
}
}
开发者ID:pepipe,项目名称:ISEL,代码行数:32,代码来源:TupleSpace.cs
示例8: IsUpdateAvailable2
public UpdatePresentResult2 IsUpdateAvailable2(
UpdateCheckInfo2 info )
{
try
{
CheckThrowApiKey(info.ApiKey);
var v1 = new Version(info.VersionNumber);
var v2 = availableVersion;
var url = v1 >= v2 ? string.Empty : ConfigurationManager.AppSettings[@"updateChecker.downloadUrl"];
var web = v1 >= v2 ? string.Empty : ConfigurationManager.AppSettings[@"updateChecker.websiteUrl"];
var result =
new UpdatePresentResult2
{
IsPresent = v1 < v2,
DownloadWebsiteUrl = web
};
LogCentral.Current.LogInfo(string.Format(@"Returning download URL '{0}'.", url));
return result;
}
catch (Exception x)
{
LogCentral.Current.LogError(@"Error checking whether an update is available.", x);
throw;
}
}
开发者ID:iraychen,项目名称:ZetaResourceEditor,代码行数:29,代码来源:UpdateCheckerService.cs
示例9: PosTest2
public bool PosTest2()
{
bool retVal = true;
// Add your scenario description here
TestLibrary.TestFramework.BeginScenario("PosTest2: Verify property Build with args ctor.");
try
{
int intMajor = TestLibrary.Generator.GetInt32(-55);
int intMinor = TestLibrary.Generator.GetInt32(-55);
int intBuild = TestLibrary.Generator.GetInt32(-55);
int intRevision = TestLibrary.Generator.GetInt32(-55);
Version version = new Version(intMajor, intMinor, intBuild, intRevision);
if (version.Build != intBuild)
{
Console.WriteLine("excepted value is :" + version.Build);
Console.WriteLine("actual value is :" + intBuild);
TestLibrary.TestFramework.LogError("002.1", "Property Build Err !");
retVal = false;
return retVal;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:34,代码来源:versionbuild.cs
示例10: Parse
public Version Parse(string version)
{
if (string.IsNullOrEmpty(version))
new System.ArgumentNullException("version", "Version was null or empty.");
Version v = new Version();
version = version.Trim();
string[] parts = version.Split(' ');
string versionInfo = parts[0];
for (int i = 1; i < parts.Length; i++)
{
v.Description += parts[i] + " ";
}
if (v.Description != null) v.Description = v.Description.Trim();
string[] vParts = versionInfo.Split('.');
if (vParts.Length > 0) v.Major = ParsingTools.ParseIndex(vParts, 0);
if (vParts.Length > 1) v.Minor = ParsingTools.ParseIndex(vParts, 1);
if (vParts.Length > 2) v.Build = ParsingTools.ParseIndex(vParts, 2);
int year = 0;
if (vParts.Length > 3) year = ParsingTools.ParseIndex(vParts, 3);
int month = 0;
if (vParts.Length > 4) month = ParsingTools.ParseIndex(vParts, 4);
int day = 0;
if (vParts.Length > 5) day = ParsingTools.ParseIndex(vParts, 5);
if (year > 0 && month > 0 && day > 0 && month < 13 && day < 32) v.DateTime = new DateTime(year, month, day);
return v;
}
开发者ID:oo00spy00oo,项目名称:SharedTerminals,代码行数:30,代码来源:VersionDateParser.cs
示例11: GetFrameworkVersion
void GetFrameworkVersion(XDocument xDocument)
{
FrameworkVersionAsString = xDocument.Descendants("TargetFrameworkVersion")
.Select(c => c.Value)
.First();
FrameworkVersionAsNumber = Version.Parse(FrameworkVersionAsString.Remove(0, 1));
}
开发者ID:Fody,项目名称:PropertyChanged,代码行数:7,代码来源:VersionReader.cs
示例12: PosTest2
public bool PosTest2()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("PosTest2: Ensure Equals(System.Object) return false when the current Version object and obj are both Version objects but not every component of the current Version object matches the corresponding component of obj.");
try
{
Version TestVersion1 = new Version("2.3.4.5");
Object TestObject1 = (Object)TestVersion1;
Version TestVersion2 = new Version("1.2.3.4");
if (TestVersion2.Equals(TestObject1))
{
TestLibrary.TestFramework.LogError("P02.1", "Equals(System.Object) failed when the current Version object and obj are both Version objects but not every component of the current Version object matches the corresponding component of obj!");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("P02.2", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:25,代码来源:versionequals1.cs
示例13: CommitVersion
public static void CommitVersion(Version version)
{
Log.Info(string.Format("Committing version #{0}", version.version));
RunCommand("add", version.date, "--all", ".");
List<string> commit_args = new List<string>();
if (!string.IsNullOrWhiteSpace(version.comment))
{
commit_args.Add("-m");
commit_args.Add("\"" + version.comment.Replace("\\", "\\\\") + "\"");
}
commit_args.Add("-m");
commit_args.Add(string.Format(
"\"Original Vault Commit: version {0} on {1:yyyy-MM-dd HH:mm:ss} by {2}\"",
version.version,
version.date,
version.user));
commit_args.Add(string.Format("--date=\"{0:yyyy-MM-ddTHH:mm:ss}\"", version.date));
if (version.GitAuthor != null)
{
commit_args.Add(string.Format("--author=\"{0}\"", version.GitAuthor));
}
commit_args.Add("-a");
RunCommand("commit", version.date, commit_args.ToArray());
commit_count++;
if (commit_count % 50 == 0)
{
RunCommand("gc", null);
}
}
开发者ID:EDCScott,项目名称:vault2git,代码行数:33,代码来源:Git.cs
示例14: StartCore
// Adds Parameter for unit tests
internal static bool StartCore(Version testVersion = null) {
var version = testVersion ?? WebPagesDeployment.GetVersion(HttpRuntime.AppDomainAppPath, WebConfigurationManager.AppSettings);
bool loaded = false;
if (version == AssemblyUtils.ThisAssemblyName.Version) {
Debug.WriteLine("WebPages Bootstrapper v{0}: loading WebPages", AssemblyUtils.ThisAssemblyName.Version);
loaded = true;
if (testVersion == null) {
LoadWebPages();
}
}
else if (version == null) {
Debug.WriteLine("WebPages Bootstrapper v{0}: WebPages not enabled, registering for change notifications", AssemblyUtils.ThisAssemblyName.Version);
// Register for change notifications under the application root
// but do not register if webPages:Enabled has been explicitly set to false (Dev10 bug 913600)
if (testVersion == null && !WebPagesDeployment.IsExplicitlyDisabled(WebConfigurationManager.AppSettings)) {
RegisterForChangeNotifications();
}
}
else {
Debug.WriteLine("WebPages Bootstrapper v{0}: site version is {1}, not loading WebPages", AssemblyUtils.ThisAssemblyName.Version, version);
}
return loaded;
}
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:27,代码来源:PreApplicationStartCode.cs
示例15: NegTest1
public bool NegTest1()
{
bool retVal = true;
TestLibrary.TestFramework.BeginScenario("NegTest1: ArgumentException is not thrown.");
try
{
Version version = new Version(1, 3, 5);
string str = version.ToString(4);
TestLibrary.TestFramework.LogError("101.1", " ArgumentException is not thrown.");
retVal = false;
}
catch (ArgumentException)
{ }
catch (Exception e)
{
TestLibrary.TestFramework.LogError("101.2", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
开发者ID:l1183479157,项目名称:coreclr,代码行数:25,代码来源:versiontostring2.cs
示例16: HttpListenerRequest
internal HttpListenerRequest (HttpListenerContext context)
{
this.context = context;
headers = new WebHeaderCollection ();
input_stream = Stream.Null;
version = HttpVersion.Version10;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:HttpListenerRequest.cs
示例17: NGramTokenFilter
/// <summary>
/// Creates NGramTokenFilter with given min and max n-grams. </summary>
/// <param name="version"> Lucene version to enable correct position increments.
/// See <a href="#version">above</a> for details. </param>
/// <param name="input"> <seealso cref="TokenStream"/> holding the input to be tokenized </param>
/// <param name="minGram"> the smallest n-gram to generate </param>
/// <param name="maxGram"> the largest n-gram to generate </param>
public NGramTokenFilter(Version version, TokenStream input, int minGram, int maxGram) : base(new CodepointCountFilter(version, input, minGram, int.MaxValue))
{
this.version = version;
this.charUtils = version.onOrAfter(Version.LUCENE_44) ? CharacterUtils.getInstance(version) : CharacterUtils.Java4Instance;
if (minGram < 1)
{
throw new System.ArgumentException("minGram must be greater than zero");
}
if (minGram > maxGram)
{
throw new System.ArgumentException("minGram must not be greater than maxGram");
}
this.minGram = minGram;
this.maxGram = maxGram;
if (version.onOrAfter(Version.LUCENE_44))
{
posIncAtt = addAttribute(typeof(PositionIncrementAttribute));
posLenAtt = addAttribute(typeof(PositionLengthAttribute));
}
else
{
posIncAtt = new PositionIncrementAttributeAnonymousInnerClassHelper(this);
posLenAtt = new PositionLengthAttributeAnonymousInnerClassHelper(this);
}
}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:32,代码来源:NGramTokenFilter.cs
示例18: OperatingSystem
public OperatingSystem(PlatformID platformID, Version version) {
if (version == null) {
throw new ArgumentNullException("version");
}
this.platformID = platformID;
this.version = version;
}
开发者ID:bradparks,项目名称:DotNetAnywhere,代码行数:7,代码来源:OperatingSystem.cs
示例19: DatabaseVersion
public DatabaseVersion(Version version)
{
Major = version.Major;
Minor = version.Minor;
Build = version.Build;
Revision = version.Revision;
}
开发者ID:apalmer,项目名称:DatabaseUtility,代码行数:7,代码来源:DatabaseVersion.cs
示例20: CreatePSNegotiationData
internal static CimInstance CreatePSNegotiationData(Version powerShellVersion)
{
CimInstance c = InternalMISerializer.CreateCimInstance("PS_NegotiationData");
CimProperty versionproperty = InternalMISerializer.CreateCimProperty("PSVersion", powerShellVersion.ToString(), Microsoft.Management.Infrastructure.CimType.String);
c.CimInstanceProperties.Add(versionproperty);
return c;
}
开发者ID:40a,项目名称:PowerShell,代码行数:7,代码来源:PSNegotiationData.cs
注:本文中的Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论