示例#1
0
        /// <summary>
        /// Populates the lists of available and installed SDK infos for a specific SDK base type.
        /// </summary>
        /// <typeparam name="BaseType">The SDK base type of which to populate the lists for. 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="availableSDKInfos">The list of available SDK infos to populate.</param>
        /// <param name="installedSDKInfos">The list of installed SDK infos to populate.</param>
        /// <param name="symbolsOfInstalledSDKs">The list of symbols of all the installed SDKs.</param>
        private static void PopulateAvailableAndInstalledSDKInfos <BaseType, FallbackType>(List <VRTK_SDKInfo> availableSDKInfos, List <VRTK_SDKInfo> installedSDKInfos, ICollection <string> symbolsOfInstalledSDKs) where BaseType : SDK_Base where FallbackType : BaseType
        {
            Type baseType     = typeof(BaseType);
            Type fallbackType = SDKFallbackTypesByBaseType[baseType];

            availableSDKInfos.Add(VRTK_SDKInfo.Create <BaseType, FallbackType, FallbackType>());
#if NETFX_CORE
            availableSDKInfos.AddRange(baseType.GetTypeInfo().Assembly.GetExportedTypes()
                                       .Where(type => type.GetTypeInfo().IsSubclassOf(baseType) && type != fallbackType && !type.GetTypeInfo().IsAbstract)
                                       .Select <Type, VRTK_SDKInfo>(VRTK_SDKInfo.Create <BaseType, FallbackType>));
#else
            availableSDKInfos.AddRange(baseType.Assembly.GetExportedTypes()
                                       .Where(type => type.IsSubclassOf(baseType) && type != fallbackType && !type.IsAbstract)
                                       .Select <Type, VRTK_SDKInfo>(VRTK_SDKInfo.Create <BaseType, FallbackType>));
#endif
            availableSDKInfos.Sort((x, y) => x.description.prettyName == "Fallback"
                ? -1 //the fallback SDK should always be the first SDK in the list
                : string.Compare(x.description.prettyName, y.description.prettyName, StringComparison.Ordinal));

            installedSDKInfos.AddRange(availableSDKInfos.Where(info =>
            {
                string symbol = info.description.symbol;
                return(string.IsNullOrEmpty(symbol) || symbolsOfInstalledSDKs.Contains(symbol));
            }));
        }
示例#2
0
        // Token: 0x06001B51 RID: 6993 RVA: 0x0008ECE8 File Offset: 0x0008CEE8
        private static void PopulateAvailableAndInstalledSDKInfos <BaseType, FallbackType>(List <VRTK_SDKInfo> availableSDKInfos, List <VRTK_SDKInfo> installedSDKInfos, ICollection <string> symbolsOfInstalledSDKs) where BaseType : SDK_Base where FallbackType : BaseType
        {
            Type baseType     = typeof(BaseType);
            Type fallbackType = VRTK_SDKManager.SDKFallbackTypesByBaseType[baseType];

            availableSDKInfos.AddRange(VRTK_SDKInfo.Create <BaseType, FallbackType, FallbackType>());
            availableSDKInfos.AddRange((from type in baseType.Assembly.GetExportedTypes()
                                        where type.IsSubclassOf(baseType) && type != fallbackType && !type.IsAbstract
                                        select type).SelectMany(new Func <Type, IEnumerable <VRTK_SDKInfo> >(VRTK_SDKInfo.Create <BaseType, FallbackType>)));
            availableSDKInfos.Sort(delegate(VRTK_SDKInfo x, VRTK_SDKInfo y)
            {
                if (!x.description.describesFallbackSDK)
                {
                    return(string.Compare(x.description.prettyName, y.description.prettyName, StringComparison.Ordinal));
                }
                return(-1);
            });
            installedSDKInfos.AddRange(availableSDKInfos.Where(delegate(VRTK_SDKInfo info)
            {
                string symbol = info.description.symbol;
                return(string.IsNullOrEmpty(symbol) || symbolsOfInstalledSDKs.Contains(symbol));
            }));
        }
示例#3
0
 // Token: 0x06001B1E RID: 6942 RVA: 0x0008DF46 File Offset: 0x0008C146
 public static VRTK_SDKInfo[] Create <BaseType, FallbackType, ActualType>() where BaseType : SDK_Base where FallbackType : BaseType where ActualType : BaseType
 {
     return(VRTK_SDKInfo.Create <BaseType, FallbackType>(typeof(ActualType)));
 }