/// <summary> /// Attempts to compile the specified C# source content. /// </summary> /// <param name="sourceContent">The string source content array containing the C# source code</param> /// <param name="extraReferences">Any additional assembly reference names</param> /// <returns>True if the compile was successful or false if there were one or more errors</returns> public bool CompileSources(string[] sourceContent, params string[] extraReferences) { // Set the compiling flag isCompiling = true; ResetCompiler(); ScriptCompilerError[] compileResult = null; lock (compilerLock) { // Register references compiler.AddReferences(extraReferences); // Invoke the compiler compileResult = compiler.CompileSource(sourceContent); // Get assembly data assemblyData = compiler.AssemblyData; symbolsData = compiler.SymbolsData; } // Success flag bool successful = true; foreach (ScriptCompilerError err in compileResult) { if (err.isWarning == true) { // Generate a warning AddWarning(err.errorCode, err.errorText, err.fileName, err.line, err.column); } else { // Set flag successful = false; // Generate an error AddError(err.errorCode, err.errorText, err.fileName, err.line, err.column); } } // Check for success if (successful == false) { assemblyData = null; symbolsData = null; } // Set the compiling flag isCompiling = false; // Check for success return(successful); }