Jypeli  9
The simple game programming library
AdvBrowsableOrderAttribute.cs
Siirry tämän tiedoston dokumentaatioon.
1 #region MIT License
2 /*
3  * Copyright (c) 2005-2008 Jonathan Mark Porter. http://physics2d.googlepages.com/
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17  * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 #endregion
23 using System;
24 
25 namespace AdvanceMath.Design
26 {
27  [global::System.AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
28  public sealed class AdvBrowsableOrderAttribute : Attribute
29  {
30  string[] order;
31 
37  {
38  this.order = order.Split(',');
39  }
40 
41  public string[] Order
42  {
43  get { return order; }
44  }
45 
46  public static string[] GetOrder(Type type)
47  {
48 #if !WINDOWS_STOREAPP
49  object[] arr = type.GetCustomAttributes(typeof(AdvBrowsableOrderAttribute), false);
50  if (arr.Length > 0)
51  {
52  return ((AdvBrowsableOrderAttribute)arr[0]).Order;
53  }
54 #else
55  IEnumerable<Attribute> attr = type.GetTypeInfo().GetCustomAttributes(typeof(AdvBrowsableOrderAttribute), false);
56  IEnumerator<Attribute> e = attr.GetEnumerator();
57  if ( e.MoveNext() )
58  {
59  return ((AdvBrowsableOrderAttribute)e.Current).Order;
60  }
61 #endif
62 
63  return null;
64  }
65  }
66 }
AdvanceMath.Design.AdvBrowsableOrderAttribute.AdvBrowsableOrderAttribute
AdvBrowsableOrderAttribute(string order)
Definition: AdvBrowsableOrderAttribute.cs:36
AdvanceMath.Design.AdvBrowsableOrderAttribute.Order
string[] Order
Definition: AdvBrowsableOrderAttribute.cs:42
AdvanceMath.Design.AdvBrowsableOrderAttribute.order
string[] order
Definition: AdvBrowsableOrderAttribute.cs:30
AdvanceMath.Design.AdvBrowsableOrderAttribute
Definition: AdvBrowsableOrderAttribute.cs:29
AdvanceMath.Design.AdvBrowsableOrderAttribute.GetOrder
static string[] GetOrder(Type type)
Definition: AdvBrowsableOrderAttribute.cs:46
System
Definition: CFFauxAttributes.cs:29
AdvanceMath.Design
Definition: AdvBrowsableAttribute.cs:29