2007-11-10 23:31:01 +00:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
|
|
|
* See license.txt for license info
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace Examples
|
|
|
|
|
{
|
|
|
|
|
[AttributeUsage(AttributeTargets.Class)]
|
|
|
|
|
public class ExampleAttribute : System.Attribute
|
|
|
|
|
{
|
2008-01-17 14:06:14 +00:00
|
|
|
|
string title;
|
|
|
|
|
public string Title { get { return title; } internal set { title = value; } }
|
2007-11-10 23:31:01 +00:00
|
|
|
|
public readonly ExampleCategory Category;
|
2007-11-11 18:44:10 +00:00
|
|
|
|
public readonly int Difficulty;
|
|
|
|
|
public readonly bool Visible = true;
|
2007-11-10 23:31:01 +00:00
|
|
|
|
|
2008-01-18 13:59:26 +00:00
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category)
|
|
|
|
|
: this(title, category, 0, true) { }
|
|
|
|
|
|
2007-11-11 18:44:10 +00:00
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category, int difficulty)
|
2008-01-18 13:59:26 +00:00
|
|
|
|
: this(title, category, difficulty, true) { }
|
2007-11-11 18:44:10 +00:00
|
|
|
|
|
|
|
|
|
public ExampleAttribute(string title, ExampleCategory category, int difficulty, bool visible)
|
|
|
|
|
{
|
|
|
|
|
this.Title = title;
|
|
|
|
|
this.Category = category;
|
|
|
|
|
this.Difficulty = difficulty;
|
|
|
|
|
this.Visible = visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2008-01-18 13:59:26 +00:00
|
|
|
|
if (Difficulty != 0)
|
|
|
|
|
return String.Format("{0} {1}: {2}", Category, Difficulty, Title);
|
|
|
|
|
return String.Format("{0}: {1}", Category, Title);
|
2007-11-10 23:31:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ExampleCategory
|
|
|
|
|
{
|
2008-01-18 13:59:26 +00:00
|
|
|
|
OpenGL = 0,
|
2007-11-10 23:31:01 +00:00
|
|
|
|
OpenAL,
|
2007-11-11 18:44:10 +00:00
|
|
|
|
Tutorial,
|
2007-11-10 23:31:01 +00:00
|
|
|
|
GLSL,
|
|
|
|
|
WinForms,
|
|
|
|
|
Test,
|
2008-01-18 13:59:26 +00:00
|
|
|
|
Last
|
2007-11-10 23:31:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|