private void FillNETCoreCompilerOptions(WSASDK wsaSDK, List <string> arguments, ref string argsPrefix)
        {
            argsPrefix = "/noconfig ";
            arguments.Add("/nostdlib+");
            if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() != ScriptingImplementation.IL2CPP)
            {
                arguments.Add("/define:NETFX_CORE");
            }
            arguments.Add("/preferreduilang:en-US");
            string platformAssemblyPath = MicrosoftCSharpCompiler.GetPlatformAssemblyPath(wsaSDK);
            string str1;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
                str1 = "8.0";
                break;

            case WSASDK.SDK81:
                str1 = "8.1";
                break;

            case WSASDK.PhoneSDK81:
                str1 = "Phone 8.1";
                break;

            case WSASDK.UWP:
                str1 = "UAP";
                if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() != ScriptingImplementation.IL2CPP)
                {
                    arguments.Add("/define:WINDOWS_UWP");
                    break;
                }
                break;

            default:
                throw new Exception("Unknown Windows SDK: " + EditorUserBuildSettings.wsaSDK.ToString());
            }
            if (!File.Exists(platformAssemblyPath))
            {
                throw new Exception(string.Format("'{0}' not found, do you have Windows {1} SDK installed?", (object)platformAssemblyPath, (object)str1));
            }
            arguments.Add("/reference:\"" + platformAssemblyPath + "\"");
            string[] additionalReferences = MicrosoftCSharpCompiler.GetAdditionalReferences(wsaSDK);
            if (additionalReferences != null)
            {
                foreach (string str2 in additionalReferences)
                {
                    arguments.Add("/reference:\"" + str2 + "\"");
                }
            }
            foreach (string netwsaAssembly in this.GetNETWSAAssemblies(wsaSDK))
            {
                arguments.Add("/reference:\"" + netwsaAssembly + "\"");
            }
            if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() == ScriptingImplementation.IL2CPP)
            {
                return;
            }
            string path;
            string contents;
            string path2;

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
                path     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v4.5.AssemblyAttributes.cs");
                contents = this.GetNetWSAAssemblyInfoWindows80();
                path2    = "Managed\\WinRTLegacy.dll";
                break;

            case WSASDK.SDK81:
                path     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v4.5.1.AssemblyAttributes.cs");
                contents = this.GetNetWSAAssemblyInfoWindows81();
                path2    = "Managed\\WinRTLegacy.dll";
                break;

            case WSASDK.PhoneSDK81:
                path     = Path.Combine(Path.GetTempPath(), "WindowsPhoneApp,Version=v8.1.AssemblyAttributes.cs");
                contents = this.GetNetWSAAssemblyInfoWindowsPhone81();
                path2    = "Managed\\Phone\\WinRTLegacy.dll";
                break;

            case WSASDK.UWP:
                path     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v5.0.AssemblyAttributes.cs");
                contents = this.GetNetWSAAssemblyInfoUWP();
                path2    = "Managed\\UAP\\WinRTLegacy.dll";
                break;

            default:
                throw new Exception("Unknown Windows SDK: " + EditorUserBuildSettings.wsaSDK.ToString());
            }
            string str3 = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(this._island._target, BuildOptions.None), path2);

            arguments.Add("/reference:\"" + str3.Replace('/', '\\') + "\"");
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            File.WriteAllText(path, contents);
            arguments.Add(path);
        }
Ejemplo n.º 2
0
        private void FillNETCoreCompilerOptions(WSASDK wsaSDK, List <string> arguments, ref string argsPrefix)
        {
            argsPrefix = "/noconfig ";
            arguments.Add("/nostdlib+");
            if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() != ScriptingImplementation.IL2CPP)
            {
                arguments.Add("/define:NETFX_CORE");
            }
            arguments.Add("/preferreduilang:en-US");
            string platformAssemblyPath = MicrosoftCSharpCompiler.GetPlatformAssemblyPath(wsaSDK);

            switch (wsaSDK)
            {
            case WSASDK.SDK80:
            {
                string arg = "8.0";
                goto IL_BF;
            }

            case WSASDK.SDK81:
            {
                string arg = "8.1";
                goto IL_BF;
            }

            case WSASDK.PhoneSDK81:
            {
                string arg = "Phone 8.1";
                goto IL_BF;
            }

            case WSASDK.UWP:
            {
                string arg = "UAP";
                if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() != ScriptingImplementation.IL2CPP)
                {
                    arguments.Add("/define:WINDOWS_UWP");
                }
                goto IL_BF;
            }
            }
            throw new Exception("Unknown Windows SDK: " + EditorUserBuildSettings.wsaSDK.ToString());
IL_BF:
            if (!File.Exists(platformAssemblyPath))
            {
                string arg;
                throw new Exception(string.Format("'{0}' not found, do you have Windows {1} SDK installed?", platformAssemblyPath, arg));
            }
            arguments.Add("/reference:\"" + platformAssemblyPath + "\"");
            string[] additionalReferences = MicrosoftCSharpCompiler.GetAdditionalReferences(wsaSDK);
            if (additionalReferences != null)
            {
                string[] array = additionalReferences;
                for (int i = 0; i < array.Length; i++)
                {
                    string str = array[i];
                    arguments.Add("/reference:\"" + str + "\"");
                }
            }
            string[] nETWSAAssemblies = this.GetNETWSAAssemblies(wsaSDK);
            for (int j = 0; j < nETWSAAssemblies.Length; j++)
            {
                string str2 = nETWSAAssemblies[j];
                arguments.Add("/reference:\"" + str2 + "\"");
            }
            if (MicrosoftCSharpCompiler.GetCurrentScriptingBackend() != ScriptingImplementation.IL2CPP)
            {
                string text;
                string contents;
                string text2;
                switch (wsaSDK)
                {
                case WSASDK.SDK80:
                    text     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v4.5.AssemblyAttributes.cs");
                    contents = this.GetNetWSAAssemblyInfoWindows80();
                    text2    = "Managed\\WinRTLegacy.dll";
                    goto IL_263;

                case WSASDK.SDK81:
                    text     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v4.5.1.AssemblyAttributes.cs");
                    contents = this.GetNetWSAAssemblyInfoWindows81();
                    text2    = "Managed\\WinRTLegacy.dll";
                    goto IL_263;

                case WSASDK.PhoneSDK81:
                    text     = Path.Combine(Path.GetTempPath(), "WindowsPhoneApp,Version=v8.1.AssemblyAttributes.cs");
                    contents = this.GetNetWSAAssemblyInfoWindowsPhone81();
                    text2    = "Managed\\Phone\\WinRTLegacy.dll";
                    goto IL_263;

                case WSASDK.UWP:
                    text     = Path.Combine(Path.GetTempPath(), ".NETCore,Version=v5.0.AssemblyAttributes.cs");
                    contents = this.GetNetWSAAssemblyInfoUWP();
                    text2    = "Managed\\UAP\\WinRTLegacy.dll";
                    goto IL_263;
                }
                throw new Exception("Unknown Windows SDK: " + EditorUserBuildSettings.wsaSDK.ToString());
IL_263:
                text2 = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(this._island._target, BuildOptions.None), text2);
                arguments.Add("/reference:\"" + text2.Replace('/', '\\') + "\"");
                if (File.Exists(text))
                {
                    File.Delete(text);
                }
                File.WriteAllText(text, contents);
                arguments.Add(text);
            }
        }