示例#1
0
        public static async Task Compile(string Code, JSObject compileLog, JSObject outputLog)
        {
            try
            {
                service.CompileLog = new List <string>();
                var type = await service.CompileSourceCode(Code);

                if (type != null)
                {
                    service.CompileLog.Add($"Exported type returned from assembly: {type}");
                }
                else
                {
                    service.CompileLog.Add("No exported types were found.");
                }
            }
            catch (Exception e)
            {
                service.CompileLog.Add(e.Message);
                service.CompileLog.Add(e.StackTrace);
                throw;
            }
            finally
            {
                compileLog.SetObjectProperty("innerText", string.Join("\r\n", service.CompileLog));
            }
        }
示例#2
0
        public static async Task Compile(JSObject app, string code)
        {
            try
            {
                service.CompileLog = new List <string>();
                var type = await service.CompileSourceCode(code);

                if (type != null)
                {
                    service.CompileLog.Add($"Exported type returned from assembly: {type}");
                }
                else
                {
                    service.CompileLog.Add("No exported types were found.");
                }
            }
            catch (Exception e)
            {
                service.CompileLog.Add(e.Message);
                service.CompileLog.Add(e.StackTrace);
                throw;
            }
            finally
            {
                app.Invoke("setCompileLog", new object[] { string.Join("\r\n", service.CompileLog) });
            }
        }