public static CustomScriptAssembly FromCustomScriptAssemblyData(string path, CustomScriptAssemblyData customScriptAssemblyData) { CustomScriptAssembly result; if (customScriptAssemblyData == null) { result = null; } else { string directoryName = Path.GetDirectoryName(path); CustomScriptAssembly customScriptAssembly = new CustomScriptAssembly(); customScriptAssembly.Name = customScriptAssemblyData.name; customScriptAssembly.References = customScriptAssemblyData.references; customScriptAssembly.FilePath = path; customScriptAssembly.PathPrefix = directoryName; if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0) { customScriptAssembly.IncludePlatforms = (from name in customScriptAssemblyData.includePlatforms select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>(); } if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0) { customScriptAssembly.ExcludePlatforms = (from name in customScriptAssemblyData.excludePlatforms select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>(); } result = customScriptAssembly; } return(result); }
public static CustomScriptAssembly FromCustomScriptAssemblyData(string path, CustomScriptAssemblyData customScriptAssemblyData) { CustomScriptAssembly result; if (customScriptAssemblyData == null) { result = null; } else { string pathPrefix = path.Substring(0, path.Length - AssetPath.GetFileName(path).Length); CustomScriptAssembly customScriptAssembly = new CustomScriptAssembly(); customScriptAssembly.Name = customScriptAssemblyData.name; customScriptAssembly.References = customScriptAssemblyData.references; customScriptAssembly.FilePath = path; customScriptAssembly.PathPrefix = pathPrefix; customScriptAssemblyData.optionalUnityReferences = (customScriptAssemblyData.optionalUnityReferences ?? new string[0]); string[] optionalUnityReferences = customScriptAssemblyData.optionalUnityReferences; for (int i = 0; i < optionalUnityReferences.Length; i++) { string value = optionalUnityReferences[i]; OptionalUnityReferences optionalUnityReferences2 = (OptionalUnityReferences)Enum.Parse(typeof(OptionalUnityReferences), value); customScriptAssembly.OptionalUnityReferences |= optionalUnityReferences2; } if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0) { customScriptAssembly.IncludePlatforms = (from name in customScriptAssemblyData.includePlatforms select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>(); } if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0) { customScriptAssembly.ExcludePlatforms = (from name in customScriptAssemblyData.excludePlatforms select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>(); } result = customScriptAssembly; } return(result); }