/// <summary> /// Return the Platform code from the PlatformID. /// </summary> /// <returns>The code.</returns> /// <param name="p">P.</param> public static Platforms ToCode(PlatformID p) { int i = 1 << (int)CurrentPlatformID; Akira.Platforms ret = (Akira.Platforms)i; return(ret); }
/// <summary> /// Clone this instance. /// </summary> /// <returns> /// <c><see cref="Akira.CatalogData`1"/></c></returns> public virtual CatalogData <T> Clone() { Platforms p = this.platform; Dictionary <Platforms, T> dic = new Dictionary <Platforms, T> (); this.platform = Platforms.Default; T rtd = this; dic.Add(Platforms.Default, rtd); int i; int d = 1; for (i = 0; i < 10; i++) { this.platform = (Platforms)(d << i); T rt = this; if (!(rt as object).Equals(rtd as object)) { dic.Add((Platforms)(d << i), rt); } } CatalogData <T> rct = new CatalogData <T> (dic); this.platform = p; return(rct); }
/// <summary> /// Initializes a new instance of the <see cref="Akira.CatalogData`1"/> class. /// </summary> /// <param name="data">The data set of platform and value.</param> public CatalogData(Dictionary <Akira.Platforms, T> data) { obj = new Dictionary <Platforms, T> (); foreach (KeyValuePair <Platforms, T> kvp in data) { obj.Add(kvp.Key, kvp.Value); } platform = PlatformInfo.CurrentPlatform; }
/// <summary> /// Initializes a new instance of the <see cref="Akira.CatalogData`1"/> class. /// </summary> /// <param name="platforms">All platforms to set in this class.</param> /// <param name="default_obj">Default object if not any correct platforms found.</param> /// <param name="objs">Objects for each platforms.</param> public CatalogData(Platforms platforms, T default_obj, params T[] objs) { obj = new Dictionary <Platforms, T> (); obj.Add(Platforms.Default, default_obj); int i, j; j = 0; Platforms p = (Platforms)1; for (i = 0; i < 10; i++) { if (((int)platforms & (int)p << i) != 0) { obj.Add((Platforms)((int)p << i), objs [j]); j++; } } platform = PlatformInfo.CurrentPlatform; }
private CatalogData(T type_obj) { obj = new Dictionary <Platforms, T> (); obj.Add(this.platform, type_obj); platform = PlatformInfo.CurrentPlatform; }