本文整理汇总了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);
}