• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Version类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Version的典型用法代码示例。如果您正苦于以下问题:C# Version类的具体用法?C# Version怎么用?C# Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Version类属于System命名空间,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Filter

 /// <summary>
 /// Создает на основе типа фильтр
 /// </summary>
 /// <param name="lib"></param>
 /// <param name="type"></param>
 public Filter(string lib, Type type)
 {
     libname = lib;
     if (type.BaseType == typeof(AbstractFilter))
     {
         Exception fullex = new Exception("");
         ConstructorInfo ci = type.GetConstructor(System.Type.EmptyTypes);
         filter = ci.Invoke(null);
         PropertyInfo everyprop;
         everyprop = type.GetProperty("Name");
         name = (string)everyprop.GetValue(filter, null);
         everyprop = type.GetProperty("Author");
         author = (string)everyprop.GetValue(filter, null);
         everyprop = type.GetProperty("Ver");
         version = (Version)everyprop.GetValue(filter, null);
         help = type.GetMethod("Help");
         MethodInfo[] methods = type.GetMethods();
         filtrations = new List<Filtration>();
         foreach (MethodInfo mi in methods)
             if (mi.Name == "Filter")
             {
                 try
                 {
                     filtrations.Add(new Filtration(mi));
                 }
                 catch (TypeLoadException)
                 {
                     //Не добавляем фильтрацию.
                 }
             }
         if (filtrations == null) throw new TypeIncorrectException("Класс " + name + " не содержит ни одной фильтрации");
     }
     else
         throw new TypeLoadException("Класс " + type.Name + " не наследует AbstractFilter");
 }
开发者ID:verygrey,项目名称:ELPTWPF,代码行数:40,代码来源:Filter.cs


示例2: UpdateBarModel

        public UpdateBarModel(Version version, string downloadUri)
        {
            if (version == null || downloadUri == null)
            {
                UpdateAvailable = false;
                return;
            }

            Version = version;
            var currentVersion = typeof(CertInspector).Assembly.GetName().Version;
            var closed = Fiddler.FiddlerApplication.Prefs.GetPref(PreferenceNames.HIDE_UPDATED_PREF, false);
            UpdateAvailable = version > currentVersion && !closed;
            Fiddler.FiddlerApplication.Log.LogString($"FiddlerCert Inspector: Current version is {currentVersion}, latest version is {version}.");
            _downloadCommand = new RelayCommand(_ =>
            {
                var uri = new Uri(downloadUri);
                if (uri?.Scheme == Uri.UriSchemeHttps)
                {
                    Process.Start(uri.AbsoluteUri);
                }
                else
                {
                    Fiddler.FiddlerApplication.Log.LogString("Refusing to open non-HTTPS page.");
                }
            });
            _closeCommand = new RelayCommand(_ =>
            {
                Fiddler.FiddlerApplication.Prefs.SetPref(PreferenceNames.HIDE_UPDATED_PREF, true);
                UpdateAvailable = false;
            });
        }
开发者ID:vcsjones,项目名称:FiddlerCert,代码行数:31,代码来源:UpdateBarModel.cs


示例3: UpdateFiles

        public void UpdateFiles()
        {
            try
            {
                WriteLine("Local version: " + Start.m_Version);

                WebClient wc = new WebClient();
                string versionstr;
                using(System.IO.StreamReader sr = new System.IO.StreamReader(wc.OpenRead(baseurl + "version.txt")))
                {
                    versionstr = sr.ReadLine();
                }
                Version remoteversion = new Version(versionstr);
                WriteLine("Remote version: " + remoteversion);

                if(Start.m_Version < remoteversion)
                {
                    foreach(string str in m_Files)
                    {
                        WriteLine("Updating: " + str);
                        wc.DownloadFile(baseurl + str, str);
                    }
                }
                wc.Dispose();
                WriteLine("Update complete");
            }
            catch(Exception e)
            {
                WriteLine("Update failed:");
                WriteLine(e);
            }
            this.Button_Ok.Enabled = true;
        }
开发者ID:BackupTheBerlios,项目名称:nomp-svn,代码行数:33,代码来源:frmUpdate.cs


示例4: Can_Upgrade_From_470_To_600

        public override void Can_Upgrade_From_470_To_600()
        {
            var configuredVersion = new Version("4.11.0");
            var targetVersion = new Version("6.0.0");
            var provider = GetDatabaseProvider();
            var db = GetConfiguredDatabase();

            var fix = new PublishAfterUpgradeToVersionSixth();

            //Setup the MigrationRunner
            var migrationRunner = new MigrationRunner(configuredVersion, targetVersion, GlobalSettings.UmbracoMigrationName);
            bool upgraded = migrationRunner.Execute(db, provider, true);

            Assert.That(upgraded, Is.True);

            bool hasTabTable = db.TableExist("cmsTab");
            bool hasPropertyTypeGroupTable = db.TableExist("cmsPropertyTypeGroup");
            bool hasAppTreeTable = db.TableExist("umbracoAppTree");

            fix.Unsubscribe();

            Assert.That(hasTabTable, Is.False);
            Assert.That(hasPropertyTypeGroupTable, Is.True);
            Assert.That(hasAppTreeTable, Is.False);
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:25,代码来源:SqlCeDataUpgradeTest.cs


示例5: UserAccountsMigrator_1

        public UserAccountsMigrator_1()
        {
            Version = new Version(0, 0, 1);
            MigrationName = "UserAccounts";

            schema = new List<SchemaDefinition>();

            //Remove the old name
            this.RemoveSchema("UserAccounts");
            //Add the `Name` column
            AddSchema("useraccounts", ColDefs(
                ColDef("PrincipalID", ColumnTypes.Char36),
                ColDef("ScopeID", ColumnTypes.Char36),
                ColDef("FirstName", ColumnTypes.String64),
                ColDef("LastName", ColumnTypes.String64),
                ColDef("Email", ColumnTypes.String64),
                ColDef("ServiceURLs", ColumnTypes.Text),
                ColDef("Created", ColumnTypes.Integer11),
                ColDef("UserLevel", ColumnTypes.Integer11),
                ColDef("UserFlags", ColumnTypes.Integer11),
                ColDef("UserTitle", ColumnTypes.String64),
                ColDef("Name", ColumnTypes.String255)
                                          ), IndexDefs(
                                              IndexDef(new string[1] {"PrincipalID"}, IndexType.Primary)
                                                 ));
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:26,代码来源:UserAccountsMigrator_1.cs


示例6: RetargetWithMetadataConverter

        /// <remarks>Internal for testing.</remarks>
        internal static void RetargetWithMetadataConverter(XDocument xdoc, Version targetSchemaVersion, MetadataConverterDriver converter)
        {
            Debug.Assert(xdoc != null, "xdoc != null");
            Debug.Assert(EntityFrameworkVersion.IsValidVersion(targetSchemaVersion), "invalid target schema version");

            var inputXml = new XmlDocument { PreserveWhitespace = true };
            using (var reader = xdoc.CreateReader())
            {
                inputXml.Load(reader);
            }

            var outputXml = converter.Convert(inputXml, targetSchemaVersion);
            if (outputXml != null)
            {
                // Dev10 Bug 550594: There is a bug in XmlEditor that prevents from deleting the root node
                // unless the root node has previous sibling (like a comment or Xml declaration).
                if (xdoc.Root.PreviousNode == null)
                {
                    xdoc.Root.AddBeforeSelf(new XComment(""));
                }

                // update xml document with new root element
                xdoc.Root.Remove();
                using (var reader = new XmlNodeReader(outputXml))
                {
                    var newDoc = XDocument.Load(reader);
                    xdoc.Add(newDoc.Root);
                }

                // Do not reload artifact here
                // Until the transaction is commited, the XLinq representation of the parsed xml tree hasn't been generated yet.
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:RetargetXmlNamespaceCommand.cs


示例7: GetVersionPresent

 public override Version GetVersionPresent(object feature)
 {
     Version version = null;
     if (feature == LayeredWindows)
     {
         if ((Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.CompareTo(new Version(5, 0, 0, 0)) >= 0))
         {
             version = new Version(0, 0, 0, 0);
         }
         return version;
     }
     if (feature == Themes)
     {
         if (!themeSupportTested)
         {
             try
             {
                 SafeNativeMethods.IsAppThemed();
                 themeSupport = true;
             }
             catch
             {
                 themeSupport = false;
             }
             themeSupportTested = true;
         }
         if (themeSupport)
         {
             version = new Version(0, 0, 0, 0);
         }
     }
     return version;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:OSFeature.cs


示例8: CheckVersion

        public static void CheckVersion()
        {
            try
            {
                var match =
                    new Regex(
                        @"\[assembly\: AssemblyVersion\(""(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})""\)\]")
                        .Match(DownloadServerVersion());

                if (!match.Success) return;
                var gitVersion =
                    new Version(
                        string.Format(
                            "{0}.{1}.{2}.{3}",
                            match.Groups[1],
                            match.Groups[2],
                            match.Groups[3],
                            match.Groups[4]));
                if (gitVersion <= Assembly.GetExecutingAssembly().GetName().Version)
                {
                    ColoredConsoleWrite(ConsoleColor.Green, "Awesome! You have already got the newest version! " + Assembly.GetExecutingAssembly().GetName().Version);
                    return;
                }

                ColoredConsoleWrite(ConsoleColor.Red, "There is a new Version available: " + gitVersion);
                ColoredConsoleWrite(ConsoleColor.Red, "You can find it at https://github.com/DetectiveSquirrel/Pokemon-Go-Rocket-API");
            }
            catch (Exception)
            {
                ColoredConsoleWrite(ConsoleColor.Red, "Unable to check for updates now...");
            }
        }
开发者ID:ChiDragon,项目名称:Pokemon-Go-Rocket-API,代码行数:32,代码来源:Program.cs


示例9: IsSupported

        public bool IsSupported(Version cssVersion, ICssCompletionListEntry entry)
        {
            if (WESettings.GetBoolean(WESettings.Keys.ShowUnsupported))
                return entry.IsSupported(cssVersion);

            return entry.GetAttribute("browsers") != "none" || entry.DisplayText.Contains("gradient");
        }
开发者ID:joeriks,项目名称:WebEssentials2013,代码行数:7,代码来源:HideUnsupportedCompletionListFilter.cs


示例10: WriteSolutionVersionProperties

		public void WriteSolutionVersionProperties(SolutionFormatVersion version, Version currVSVersion, Version minVSVersion)
		{
			if (version >= SolutionFormatVersion.VS2012) {
				writer.WriteLine("VisualStudioVersion = {0}", currVSVersion);
				writer.WriteLine("MinimumVisualStudioVersion = {0}", minVSVersion);
			}
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:7,代码来源:SolutionWriter.cs


示例11: AuthMigrator_3

        public AuthMigrator_3()
        {
            Version = new Version(0, 0, 3);
            MigrationName = "Auth";

            schema = new List<SchemaDefinition>();

            //
            // Change summery:
            //
            //   Make the password hash much longer to accommodate other types of passwords)
            //

            AddSchema("auth", ColDefs(
                ColDef("UUID", ColumnTypes.Char36),
                ColDef("passwordHash", ColumnTypes.String1024),
                ColDef("passwordSalt", ColumnTypes.String1024),
                ColDef("accountType", ColumnTypes.Char32)
            ), IndexDefs(
                IndexDef(new string[2]{ "UUID", "accountType" }, IndexType.Primary)
            ));

            AddSchema("tokens", ColDefs(
                ColDef("UUID", ColumnTypes.Char36),
                ColDef("token", ColumnTypes.String255),
                ColDef("validity", ColumnTypes.Date)
            ), IndexDefs(
                IndexDef(new string[2]{ "UUID", "token" }, IndexType.Primary)
            ));
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:30,代码来源:AuthMigrator_3.cs


示例12: NormalizeVersionValue

 private static Version NormalizeVersionValue(Version version)
 {
     return new Version(version.Major,
                        version.Minor,
                        Math.Max(version.Build, 0),
                        Math.Max(version.Revision, 0));
 }
开发者ID:alt-soft,项目名称:vc-community,代码行数:7,代码来源:SemanticVersion.cs


示例13: CheckVersion

        public void CheckVersion()
        {
            try
            {
                var match =
                    new Regex(
                        @"\[assembly\: AssemblyVersion\(""(\d{1,})\.(\d{1,})\.(\d{1,})\.(\d{1,})""\)\]")
                        .Match(DownloadServerVersion());

                if (!match.Success) return;
                var gitVersion =
                    new Version(
                        string.Format(
                            "{0}.{1}.{2}.{3}",
                            match.Groups[1],
                            match.Groups[2],
                            match.Groups[3],
                            match.Groups[4]));
                // makes sense to display your version and say what the current one is on github
                ColoredConsoleWrite(Color.Green, "Your version is " + Assembly.GetExecutingAssembly().GetName().Version);
                ColoredConsoleWrite(Color.Green, "Github version is " + gitVersion);
                ColoredConsoleWrite(Color.Green, "You can find it at www.GitHub.com/DetectiveSquirrel/Pokemon-Go-Rocket-API");
            }
            catch (Exception)
            {
                ColoredConsoleWrite(Color.Red, "Unable to check for updates now...");
            }
        }
开发者ID:ChiDragon,项目名称:Pokemon-Go-Rocket-API,代码行数:28,代码来源:MainForm.cs


示例14: OnAppStart

		public static void OnAppStart(Version version, LoginType loginType, bool isNew)
		{
			if(!Config.Instance.GoogleAnalytics)
				return;
			Google.TrackPageView($"/app/v{version.ToVersionString()}/{loginType.ToString().ToLower()}{(isNew ? "/new" : "")}", "");
			WritePoint(new InfluxPointBuilder("hdt_app_start").Tag("version", version.ToVersionString()).Tag("login_type", loginType).Tag("new", isNew).Build());
		}
开发者ID:clemgaut,项目名称:Hearthstone-Deck-Tracker,代码行数:7,代码来源:Influx.cs


示例15: SchedulerMigrator_1

        public SchedulerMigrator_1()
        {
            Version = new Version(0, 0, 1);
            MigrationName = "Scheduler";

            schema = new List<Rec<string, ColumnDefinition[]>>();

            AddSchema("scheduler", ColDefs(ColDef("id", ColumnTypes.String36, true),
                                                ColDef("fire_function", ColumnTypes.String128),
                                                ColDef("fire_params", ColumnTypes.String1024),
                                                ColDef("run_once", ColumnTypes.TinyInt1),
                                                ColDef("run_every", ColumnTypes.Integer30),
                                                ColDef("runs_next", ColumnTypes.Integer30, true),
                                                ColDef("keep_history", ColumnTypes.TinyInt1),
                                                ColDef("require_reciept", ColumnTypes.TinyInt1),
                                                ColDef("last_history_id", ColumnTypes.String36),
                                                ColDef("create_time", ColumnTypes.Integer30),
                                                ColDef("enabled", ColumnTypes.TinyInt1, true)
                                            ));

            AddSchema("scheduler_history", ColDefs(ColDef("id", ColumnTypes.String36, true),
                                                ColDef("scheduler_id", ColumnTypes.String36, true),
                                                ColDef("ran_time", ColumnTypes.Integer30),
                                                ColDef("run_time", ColumnTypes.Integer30),
                                                ColDef("reciept", ColumnTypes.String1024),
                                                ColDef("is_complete", ColumnTypes.TinyInt1),
                                                ColDef("complete_time", ColumnTypes.Integer30)
                                            ));
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:29,代码来源:SchedulerMigrator_1.cs


示例16: ReadJson

 /// <summary>
 /// Reads the JSON representation of the object.
 /// </summary>
 /// <param name="reader">The <see cref="JsonReader"/> to read from.</param>
 /// <param name="objectType">Type of the object.</param>
 /// <param name="existingValue">The existing property value of the JSON that is being converted.</param>
 /// <param name="serializer">The calling serializer.</param>
 /// <returns>The object value.</returns>
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     if (reader.TokenType == JsonToken.Null)
     {
         return null;
     }
     else
     {
         if (reader.TokenType == JsonToken.String)
         {
             try
             {
                 Version v = new Version((string)reader.Value);
                 return v;
             }
             catch (Exception ex)
             {
                 throw JsonSerializationException.Create(reader, "Error parsing version string: {0}".FormatWith(CultureInfo.InvariantCulture, reader.Value), ex);
             }
         }
         else
         {
             throw JsonSerializationException.Create(reader, "Unexpected token or value when parsing version. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value));
         }
     }
 }
开发者ID:extesla,项目名称:OpenGamingLibrary,代码行数:34,代码来源:VersionConverter.cs


示例17: TestBuildInfo

 public void TestBuildInfo()
 {
     var versionZero = new Version(0, 0, 0, 0);
     var buildInfo = _server.BuildInfo;
     Assert.IsTrue(buildInfo.Bits == 32 || buildInfo.Bits == 64);
     Assert.AreNotEqual(versionZero, buildInfo.Version);
 }
开发者ID:wireclub,项目名称:mongo-csharp-driver,代码行数:7,代码来源:MongoServerTests.cs


示例18: Xsd

 protected Xsd(Version version)
     : this()
 {
     this.header = ValidHeaders[0];
     this.version = (int)version;
     this.setupLanguages();
 }
开发者ID:hastinbe,项目名称:NineDragons-XSD-Editor,代码行数:7,代码来源:Xsd.cs


示例19: GetAnalyzer

        protected override SymbolAndNodeAnalyzer GetAnalyzer(CompilationStartAnalysisContext context, CompilationSecurityTypes types, Version targetFrameworkVersion)
        {
            SymbolAndNodeAnalyzer analyzer = new SymbolAndNodeAnalyzer(types, CSharpSyntaxNodeHelper.Default, targetFrameworkVersion);
            context.RegisterSyntaxNodeAction(analyzer.AnalyzeNode, SyntaxKind.MethodDeclaration, SyntaxKind.ConstructorDeclaration);

            return analyzer;
        }
开发者ID:bkoelman,项目名称:roslyn-analyzers,代码行数:7,代码来源:CSharpDoNotUseInsecureDtdProcessingInApiDesigner.cs


示例20: IsBeforeDoesNotThrowNullReferenceExceptionWithNullAsAfterValue

        public void IsBeforeDoesNotThrowNullReferenceExceptionWithNullAsAfterValue()
        {
            Version v1 = null;
            Version v2 = new Version(2, 0);

            Check.That(v2).IsBefore(v1);
        }
开发者ID:pirrmann,项目名称:NFluent,代码行数:7,代码来源:ComparableRelatedTests.cs



注:本文中的System.Version类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Video类代码示例发布时间:2022-05-26
下一篇:
C# System.Vector4类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap