Created
October 30, 2019 08:58
-
-
Save kurokuru/b89366e2f98532c8501ebc7a8da8eff4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace UnityEngine.ResourceManagement.Util | |
{ | |
// Token: 0x02000016 RID: 22 | |
internal static class CustomResourceManagerConfig | |
{ | |
// Token: 0x060000A4 RID: 164 RVA: 0x000045C8 File Offset: 0x000027C8 | |
internal static bool IsPathRemote(string path) | |
{ | |
return path != null && path.StartsWith("http"); | |
} | |
// Token: 0x060000A5 RID: 165 RVA: 0x000045EC File Offset: 0x000027EC | |
internal static bool ShouldPathUseWebRequest(string path) | |
{ | |
return path != null && path.Contains("://"); | |
} | |
// Token: 0x060000A6 RID: 166 RVA: 0x00004610 File Offset: 0x00002810 | |
public static Array CreateArrayResult(Type type, Object[] allAssets) | |
{ | |
Type elementType = type.GetElementType(); | |
bool flag = elementType == null; | |
Array result; | |
if (flag) | |
{ | |
result = null; | |
} | |
else | |
{ | |
int length = 0; | |
foreach (Object asset in allAssets) | |
{ | |
bool flag2 = asset.GetType() == elementType; | |
if (flag2) | |
{ | |
length++; | |
} | |
} | |
Array array = Array.CreateInstance(elementType, length); | |
int index = 0; | |
foreach (Object asset2 in allAssets) | |
{ | |
bool flag3 = elementType.IsAssignableFrom(asset2.GetType()); | |
if (flag3) | |
{ | |
array.SetValue(asset2, index++); | |
} | |
} | |
result = array; | |
} | |
return result; | |
} | |
// Token: 0x060000A7 RID: 167 RVA: 0x000046C8 File Offset: 0x000028C8 | |
public static TObject CreateArrayResult<TObject>(Object[] allAssets) where TObject : class | |
{ | |
return CustomResourceManagerConfig.CreateArrayResult(typeof(TObject), allAssets) as TObject; | |
} | |
// Token: 0x060000A8 RID: 168 RVA: 0x000046F4 File Offset: 0x000028F4 | |
public static IList CreateListResult(Type type, Object[] allAssets) | |
{ | |
Type[] genArgs = type.GetGenericArguments(); | |
Type listType = typeof(List<>).MakeGenericType(genArgs); | |
IList list = Activator.CreateInstance(listType) as IList; | |
Type elementType = genArgs[0]; | |
bool flag = list == null; | |
IList result; | |
if (flag) | |
{ | |
result = null; | |
} | |
else | |
{ | |
foreach (Object a in allAssets) | |
{ | |
bool flag2 = elementType.IsAssignableFrom(a.GetType()); | |
if (flag2) | |
{ | |
list.Add(a); | |
} | |
} | |
result = list; | |
} | |
return result; | |
} | |
// Token: 0x060000A9 RID: 169 RVA: 0x0000477C File Offset: 0x0000297C | |
public static TObject CreateListResult<TObject>(Object[] allAssets) | |
{ | |
return (TObject)((object)CustomResourceManagerConfig.CreateListResult(typeof(TObject), allAssets)); | |
} | |
// Token: 0x060000AA RID: 170 RVA: 0x000047A4 File Offset: 0x000029A4 | |
public static bool IsInstance<T1, T2>() | |
{ | |
Type tA = typeof(T1); | |
Type tB = typeof(T2); | |
return tB.IsAssignableFrom(tA); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment