private SD_Assembly(Assembly assembly) { this.assembly = assembly; switch (assembly.GetName().Name.ToLower()) { case "assembly-csharp-firstpass": assemblyId = UnityAssembly.CSharpFirstPass; break; case "assembly-unityscript-firstpass": assemblyId = UnityAssembly.UnityScriptFirstPass; break; case "assembly-boo-firstpass": assemblyId = UnityAssembly.BooFirstPass; break; case "assembly-csharp-editor-firstpass": assemblyId = UnityAssembly.CSharpEditorFirstPass; break; case "assembly-unityscript-editor-firstpass": assemblyId = UnityAssembly.UnityScriptEditorFirstPass; break; case "assembly-boo-editor-firstpass": assemblyId = UnityAssembly.BooEditorFirstPass; break; case "assembly-csharp": assemblyId = UnityAssembly.CSharp; break; case "assembly-unityscript": assemblyId = UnityAssembly.UnityScript; break; case "assembly-boo": assemblyId = UnityAssembly.Boo; break; case "assembly-csharp-editor": assemblyId = UnityAssembly.CSharpEditor; break; case "assembly-unityscript-editor": assemblyId = UnityAssembly.UnityScriptEditor; break; case "assembly-boo-editor": assemblyId = UnityAssembly.BooEditor; break; default: assemblyId = UnityAssembly.None; break; } }
public static SD_Assembly FromId(UnityAssembly assemblyId) { if (assemblyId == UnityAssembly.None) { return(null); } var index = ((int)assemblyId) - 1; if (unityAssemblies[index] == null) { var assemblyName = unityAssemblyNames[index]; unityAssemblies[index] = FromName(assemblyName) ?? new SD_Assembly(assemblyId); } return(unityAssemblies[index]); }
public static Scope_CompilationUnit GetCompilationUnitScope(UnityAssembly type, string sName, bool forceCreateNew = false) { var assembly = FromId(type); return(GetCompilationUnitScope(assembly, sName, forceCreateNew)); }
private SD_Assembly(UnityAssembly id) { assemblyId = id; }
public static UnityAssembly AssemblyIdFromAssetPath(string pathName) { var ext = (System.IO.Path.GetExtension(pathName) ?? string.Empty).ToLower(); var isCSharp = ext == ".cs"; var isUnityScript = ext == ".js"; var isBoo = ext == ".boo"; var isDll = ext == ".dll"; if (!isCSharp && !isUnityScript && !isBoo && !isDll) { return(UnityAssembly.None); } var path = (System.IO.Path.GetDirectoryName(pathName) ?? string.Empty).ToLowerInvariant() + "/"; var isIgnoredScript = path.StartsWith("assets/webplayertemplates/", StringComparison.Ordinal); if (isIgnoredScript) { return(UnityAssembly.None); } bool isUnity_5_2_1p4_orNewer = true; #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 isUnity_5_2_1p4_orNewer = UnityEngine.Application.unityVersion.StartsWith("5.2.1p") && int.Parse(UnityEngine.Application.unityVersion.Substring("5.2.1p".Length)) >= 4; #endif var isPlugins = path.StartsWith("assets/plugins/", StringComparison.Ordinal); var isStandardAssets = path.StartsWith("assets/standard assets/", StringComparison.Ordinal) || path.StartsWith("assets/pro standard assets/", StringComparison.Ordinal); var isFirstPass = isPlugins || isStandardAssets; bool isEditor; if (isFirstPass && !isUnity_5_2_1p4_orNewer) { isEditor = isPlugins && path.StartsWith("assets/plugins/editor/", StringComparison.Ordinal) || isStandardAssets && path.StartsWith("assets/pro standard assets/editor/", StringComparison.Ordinal) || isStandardAssets && path.StartsWith("assets/standard assets/editor/", StringComparison.Ordinal); } else { isEditor = path.Contains("/editor/"); } UnityAssembly assemblyId; if (isFirstPass && isEditor) { assemblyId = isCSharp ? UnityAssembly.CSharpEditorFirstPass : isBoo ? UnityAssembly.BooEditorFirstPass : isUnityScript ? UnityAssembly.UnityScriptEditorFirstPass : UnityAssembly.DllEditorFirstPass; } else if (isEditor) { assemblyId = isCSharp ? UnityAssembly.CSharpEditor : isBoo ? UnityAssembly.BooEditor : isUnityScript ? UnityAssembly.UnityScriptEditor : UnityAssembly.DllEditor; } else if (isFirstPass) { assemblyId = isCSharp ? UnityAssembly.CSharpFirstPass : isBoo ? UnityAssembly.BooFirstPass : isUnityScript ? UnityAssembly.UnityScriptFirstPass : UnityAssembly.DllFirstPass; } else { assemblyId = isCSharp ? UnityAssembly.CSharp : isBoo ? UnityAssembly.Boo : isUnityScript ? UnityAssembly.UnityScript : UnityAssembly.Dll; } return(assemblyId); }