Beispiel #1
0
        /// <summary>
        /// Creates a new SDK info for a type.
        /// </summary>
        /// <typeparam name="BaseType">The SDK base type. Must be a subclass of <see cref="SDK_Base"/>.</typeparam>
        /// <typeparam name="FallbackType">The SDK type to fall back on if problems occur. Must be a subclass of <typeparamref name="BaseType"/>.</typeparam>
        /// <param name="actualType">The SDK type to use. Must be a subclass of <typeparamref name="BaseType"/>.</param>
        /// <returns>A newly created instance.</returns>
        public static VRTK_SDKInfo Create<BaseType, FallbackType>(Type actualType) where BaseType : SDK_Base where FallbackType : BaseType
        {
            var sdkInfo = new VRTK_SDKInfo();
            sdkInfo.SetUp(typeof(BaseType), typeof(FallbackType), actualType.FullName);

            return sdkInfo;
        }
Beispiel #2
0
        // Token: 0x06001B1F RID: 6943 RVA: 0x0008DF58 File Offset: 0x0008C158
        public static VRTK_SDKInfo[] Create <BaseType, FallbackType>(Type actualType) where BaseType : SDK_Base where FallbackType : BaseType
        {
            string fullName = actualType.FullName;

            SDK_DescriptionAttribute[] descriptions = SDK_DescriptionAttribute.GetDescriptions(actualType);
            if (descriptions.Length == 0)
            {
                VRTK_Logger.Fatal(string.Format("'{0}' doesn't specify any SDK descriptions via '{1}'.", fullName, typeof(SDK_DescriptionAttribute).Name));
                return(new VRTK_SDKInfo[0]);
            }
            List <VRTK_SDKInfo> list = new List <VRTK_SDKInfo>(descriptions.Length);

            foreach (SDK_DescriptionAttribute sdk_DescriptionAttribute in descriptions)
            {
                VRTK_SDKInfo vrtk_SDKInfo = new VRTK_SDKInfo();
                vrtk_SDKInfo.SetUp(typeof(BaseType), typeof(FallbackType), fullName, sdk_DescriptionAttribute.index);
                list.Add(vrtk_SDKInfo);
            }
            return(list.ToArray());
        }
Beispiel #3
0
        /// <summary>
        /// Creates new SDK infos for a type.
        /// </summary>
        /// <typeparam name="BaseType">The SDK base type. Must be a subclass of SDK_Base.</typeparam>
        /// <typeparam name="FallbackType">The SDK type to fall back on if problems occur. Must be a subclass of `BaseType.</typeparam>
        /// <param name="actualType">The SDK type to use. Must be a subclass of `BaseType.</param>
        /// <returns>Multiple newly created instances.</returns>
        public static VRTK_SDKInfo[] Create <BaseType, FallbackType>(Type actualType) where BaseType : SDK_Base where FallbackType : BaseType
        {
            string actualTypeName = actualType.FullName;

            SDK_DescriptionAttribute[] descriptions = SDK_DescriptionAttribute.GetDescriptions(actualType);
            if (descriptions.Length == 0)
            {
                VRTK_Logger.Fatal(string.Format("'{0}' doesn't specify any SDK descriptions via '{1}'.", actualTypeName, typeof(SDK_DescriptionAttribute).Name));
                return(new VRTK_SDKInfo[0]);
            }

            HashSet <VRTK_SDKInfo> sdkInfos = new HashSet <VRTK_SDKInfo>();

            foreach (SDK_DescriptionAttribute description in descriptions)
            {
                VRTK_SDKInfo sdkInfo = new VRTK_SDKInfo();
                sdkInfo.SetUp(typeof(BaseType), typeof(FallbackType), actualTypeName, description.index);
                sdkInfos.Add(sdkInfo);
            }

            return(sdkInfos.ToArray());
        }