当前位置: 首页>>代码示例>>C#>>正文


C# Usage.AddVersionCategory方法代码示例

本文整理汇总了C#中Usage.AddVersionCategory方法的典型用法代码示例。如果您正苦于以下问题:C# Usage.AddVersionCategory方法的具体用法?C# Usage.AddVersionCategory怎么用?C# Usage.AddVersionCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Usage的用法示例。


在下文中一共展示了Usage.AddVersionCategory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckGL3

        private static void CheckGL3()
        {
            Thread.Sleep(1000);

            Console.Out.Flush();
            Console.WriteLine();
            Console.WriteLine();

            var att = typeof (AutoGeneratedAttribute);
            var type = typeof (OpenTK.Graphics.OpenGL.GL);
            var methods = new List<Tuple<string, string, string>>();
            foreach (var method in type.GetMethods())
            {
                var data = method.GetCustomAttributes(att, false);
                if (data.Length > 0)
                {
                    var ag = (AutoGeneratedAttribute) data[0];
                    //Console.WriteLine(method.Name + " = " + ag.Version + " (" + ag.Category + ")");
                    methods.Add(Tuple.Create(method.Name, ag.Version, ag.Category));
                }
            }
            var loc = new FileInfo(Assembly.GetExecutingAssembly().Location);
            var dir = loc.Directory;
            while (dir != null && dir.GetFiles("Sledge.sln").Length == 0) dir = dir.Parent;
            if (dir == null) return;

            var files = dir.EnumerateFiles("*.cs", SearchOption.AllDirectories);
            var regex = new Regex(@"GL\.([^(]*)\(", RegexOptions.Compiled);

            var usages = new List<Usage>();

            foreach (var f in files)
            {
                try
                {
                    var text = File.ReadAllText(f.FullName);
                    foreach (Match match in regex.Matches(text))
                    {
                        var method = match.Groups[1].Value;
                        var usage = new Usage(f, method);
                        foreach (var mtd in methods.Where(x => x.Item1 == method))
                        {
                            usage.AddVersionCategory(mtd.Item2, mtd.Item3);
                        }
                        usages.Add(usage);
                    }
                }
                catch
                {
                    Console.WriteLine("Failed to read: " + f.FullName);
                }
            }

            var ok = new string[] { "Enable", "Disable", "Uniform1", "Uniform4" };
            foreach (var kv in usages)
            {
                if (!ok.Contains(kv.Method) && kv.VersionCategories.Any(x => float.Parse(x.Item1) > 2.0))
                {
                    Console.Write(kv.File.FullName + " - " + kv.Method + ":");
                    foreach (var vc in kv.VersionCategories)
                    {
                        Console.Write(" -> " + vc.Item1 + " (" + vc.Item2 + ")");
                    }
                    Console.WriteLine();
                }
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.Out.Flush();

            Thread.Sleep(1000);
        }
开发者ID:silky,项目名称:sledge,代码行数:73,代码来源:Program.cs


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