public void UpdateSource() { _codeType = null; _codeInstance = null; if (Source == null) return; var provider = new CSharpCodeProvider(); var options = new CompilerParameters { GenerateInMemory = true }; string qn = typeof(Point3D).Assembly.Location; options.ReferencedAssemblies.Add("System.dll"); options.ReferencedAssemblies.Add(qn); string src = template.Replace("#code#", Source); CompilerResults compilerResults = provider.CompileAssemblyFromSource(options, src); if (!compilerResults.Errors.HasErrors) { Errors = null; var assembly = compilerResults.CompiledAssembly; _codeInstance = assembly.CreateInstance("MyNamespace.MyEvaluator"); _codeType = _codeInstance.GetType(); } else { // correct line numbers Errors = compilerResults.Errors; for (int i = 0; i < Errors.Count; i++) Errors[i].Line -= 17; } _w = ParameterW; UpdateModel(); }
private static void TraceErrors(CompilerErrorCollection errors) { foreach (var error in errors) { Trace.WriteLine(error); } }
private void HandleException(Exception ex, ProjectFile file, SingleFileCustomToolResult result) { if (ex is SpecFlowParserException) { SpecFlowParserException sfpex = (SpecFlowParserException) ex; if (sfpex.ErrorDetails == null || sfpex.ErrorDetails.Count == 0) { result.UnhandledException = ex; } else { var compilerErrors = new CompilerErrorCollection(); foreach (var errorDetail in sfpex.ErrorDetails) { var compilerError = new CompilerError(file.Name, errorDetail.ForcedLine, errorDetail.ForcedColumn, "0", errorDetail.Message); compilerErrors.Add(compilerError); } result.Errors.AddRange(compilerErrors); } } else { result.UnhandledException = ex; } }
/// <summary> /// Compiles a method body of C# script, wrapped in a basic void-returning method. /// </summary> /// <param name="methodText">The text of the script to place inside a method.</param> /// <param name="errors">The compiler errors and warnings from compilation.</param> /// <param name="methodIfSucceeded">The compiled method if compilation succeeded.</param> /// <returns>True if compilation was a success, false otherwise.</returns> public static bool CompileCSharpImmediateSnippet(string methodText, out CompilerErrorCollection errors, out MethodInfo methodIfSucceeded) { // Wrapper text so we can compile a full type when given just the body of a method string methodScriptWrapper = @" using UnityEngine; using UnityEditor; using System.Collections; using System.Collections.Generic; using System.Text; using System.Xml; using System.Linq; public static class CodeSnippetWrapper {{ public static void PerformAction() {{ {0}; }} }}"; // Default method to null methodIfSucceeded = null; // Compile the full script Assembly assembly; if (CompileCSharpScript(string.Format(methodScriptWrapper, methodText), out errors, out assembly)) { // If compilation succeeded, we can use reflection to get the method and pass that back to the user methodIfSucceeded = assembly.GetType("CodeSnippetWrapper").GetMethod("PerformAction", BindingFlags.Static | BindingFlags.Public); return true; } // Compilation failed, caller has the errors, return false return false; }
/// <summary> /// Creates a new instance of the Brainfuck assembly generator. /// </summary> public AssemblyGenerator() { Debug = false; Name = DefaultName; Errors = new CompilerErrorCollection(); Cells = 1024; }
public void FillErrorList( CompilerErrorCollection errors ) { _listErrors.Items.Clear( ); _listWarnings.Items.Clear( ); if( errors != null && errors.Count > 0 ) { int errorNum = 0; foreach( CompilerError error in errors ) { ListViewItem item = new ListViewItem( ); //Error Number errorNum++; item.SubItems.Add( new ListViewItem.ListViewSubItem( item, errorNum.ToString( ) ) ); //Error Message item.SubItems.Add( new ListViewItem.ListViewSubItem( item, error.ErrorText ) ); //Filename item.SubItems.Add( new ListViewItem.ListViewSubItem( item, System.IO.Path.GetFileName( error.FileName ) ) ); //Line item.SubItems.Add( new ListViewItem.ListViewSubItem( item, error.Line.ToString( ) ) ); //Column item.SubItems.Add( new ListViewItem.ListViewSubItem( item, error.Column.ToString( ) ) ); if( error.IsWarning ) _listWarnings.Items.Add( item ); else _listErrors.Items.Add( item ); } } }
public static void Main() { var engine = new ScriptEngine(); CompilerErrorCollection err = new CompilerErrorCollection(); engine.Run("Console.WriteLine(\"Hello, Script!\");", out err); }
static void HandleErrors(CompilerErrorCollection cr) { for(var i = 0; i < cr.Count; i++) Tracer.Line(cr[i].ToString()); throw new CSharpCompilerErrorException(cr); }
public override CompilerResults CompileAssemblyFromFile(CompilerParameters options, params string[] fileNames) { var units = new CodeCompileUnit[fileNames.Length]; var errors = new CompilerErrorCollection(); var syntax = new Parser(options); for (int i = 0; i < fileNames.Length; i++) { try { units[i] = syntax.Parse(new StreamReader(fileNames[i]), fileNames[i]); } #if !DEBUG catch (ParseException e) { errors.Add(new CompilerError(e.Source, e.Line, 0, e.Message.GetHashCode().ToString(), e.Message)); } catch (Exception e) { errors.Add(new CompilerError { ErrorText = e.Message }); } #endif finally { } } var results = CompileAssemblyFromDom(options, units); results.Errors.AddRange(errors); return results; }
/// <summary> /// Compiles a C# script as if it were a file in your project. /// </summary> /// <param name="scriptText">The text of the script.</param> /// <param name="errors">The compiler errors and warnings from compilation.</param> /// <param name="assemblyIfSucceeded">The compiled assembly if compilation succeeded.</param> /// <returns>True if compilation was a success, false otherwise.</returns> public static bool CompileCSharpScript(string scriptText, out CompilerErrorCollection errors, out Assembly assemblyIfSucceeded) { var codeProvider = new CSharpCodeProvider(); var compilerOptions = new CompilerParameters(); // We want a DLL and we want it in memory compilerOptions.GenerateExecutable = false; compilerOptions.GenerateInMemory = true; // Add references for UnityEngine and UnityEditor DLLs compilerOptions.ReferencedAssemblies.Add(typeof(Vector2).Assembly.Location); compilerOptions.ReferencedAssemblies.Add(typeof(EditorApplication).Assembly.Location); // Default to null output parameters errors = null; assemblyIfSucceeded = null; // Compile the assembly from the source script text CompilerResults result = codeProvider.CompileAssemblyFromSource(compilerOptions, scriptText); // Store the errors for the caller. even on successful compilation, we may have warnings. errors = result.Errors; // See if any errors are actually errors. if so return false foreach (CompilerError e in errors) { if (!e.IsWarning) { return false; } } // Otherwise we pass back the compiled assembly and return true assemblyIfSucceeded = result.CompiledAssembly; return true; }
public override void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors) { base.StartProcessingRun (languageProvider, templateContents, errors); provider = languageProvider; postStatements.Clear (); members.Clear (); }
public void Emit(CompilerErrorCollection errors, MethodBuilder m) { //Set the parameters //ParameterBuilder[] parms = new ParameterInfo[args.Length]; for(int i = 0; i < args.Length; i++) m.DefineParameter(i + 1, ParameterAttributes.None, args[i].Name); ILGenerator gen = m.GetILGenerator(); //Define the IT variable LocalRef it = locals["IT"] as LocalRef; DefineLocal(gen, it); statements.Process(this, errors, gen); statements.Emit(this, gen); //Cast the IT variable to our return type and return it if (m.ReturnType != typeof(void)) { gen.Emit(OpCodes.Ldloc, it.Local); Expression.EmitCast(gen, it.Type, m.ReturnType); } gen.Emit(OpCodes.Ret); }
/// <summary> /// Creates a new instance with serialized data. /// </summary> /// <param name="info">The object that holds the serialized /// object data.</param> /// <param name="context">The contextual information about /// the source or destination.</param> protected TemplateCompilationException(SerializationInfo info, StreamingContext context) : base(info, context) { this.errors = (CompilerErrorCollection) info.GetValue( ErrorCollection, typeof(CompilerErrorCollection)); }
public override bool Execute() { Errors = new CompilerErrorCollection(); try { AddAssemblyLoadEvent(); DoExecute(); } catch (Exception ex) { RecordException(ex); } // handle errors if (Errors.Count > 0) { bool hasErrors = false; foreach (CompilerError error in Errors) { if (error.IsWarning) OutputWarning(error.ToString(), error.ErrorText, error.FileName, error.Line, error.Column); else { OutputError(error.ToString(), error.ErrorText, error.FileName, error.Line, error.Column); hasErrors = true; } } return !hasErrors; } return true; }
/// <summary> /// Initialises a new instance of <see cref="TemplateCompilationException"/>. /// </summary> /// <param name="errors">The set of compiler errors.</param> /// <param name="sourceCode">The source code that wasn't compiled.</param> /// <param name="template">The source template that wasn't compiled.</param> internal TemplateCompilationException(CompilerErrorCollection errors, string sourceCode, string template) : base("Unable to compile template. " + errors[0].ErrorText + "\n\nOther compilation errors may have occurred. Check the Errors property for more information.") { var list = errors.Cast<CompilerError>().ToList(); Errors = new ReadOnlyCollection<CompilerError>(list); SourceCode = sourceCode; Template = template; }
public void ShowErrors(CompilerErrorCollection errors) { TaskService.ClearExceptCommentTasks(); foreach (CompilerError error in errors) { TaskService.Add(new CompilerErrorTask(error)); } SD.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront(); }
// logged the errors' text to our logging utility public void LogErrors(System.CodeDom.Compiler.CompilerErrorCollection errors) { //SUtil.LogErr(errors.ToString()); foreach (System.CodeDom.Compiler.CompilerError e in errors) { //SUtil.LogErr(e.ToString()); } return; }
/// <summary> /// Generates an Assembly from a script filename /// </summary> /// <param name="filename">The filename of the script</param> /// <param name="references">Assembly references for the script</param> /// <returns>The generated assembly</returns> public Assembly CreateAssembly(string filename, IList references) { // ensure that compilerErrors is null compilerErrors = null; string extension = Path.GetExtension(filename); // Select the correct CodeDomProvider based on script file extension CodeDomProvider codeProvider = null; switch (extension) { case ".cs": codeProvider = new Microsoft.CSharp.CSharpCodeProvider(); break; case ".vb": codeProvider = new Microsoft.CSharp.CSharpCodeProvider(); break; default: throw new InvalidOperationException("Script files must have a .cs or .vb."); } // Set compiler parameters CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:library /optimize"; compilerParams.GenerateExecutable = false; compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("mscorlib.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); // Add custom references foreach (string reference in references) { if (!compilerParams.ReferencedAssemblies.Contains(reference)) { compilerParams.ReferencedAssemblies.Add(reference); } } // Do the compilation CompilerResults results = codeProvider.CompileAssemblyFromFile(compilerParams, filename); //Do we have any compiler errors if (results.Errors.Count > 0) { compilerErrors = results.Errors; throw new Exception( "Compiler error(s) encountered and saved to AssemblyFactory.CompilerErrors"); } Assembly createdAssembly = results.CompiledAssembly; return createdAssembly; }
public void HandleErrors_is_noop_when_no_errors() { var errors = new CompilerErrorCollection { new CompilerError { IsWarning = true } }; errors.HandleErrors("Not used"); }
public Assembly CreateAssembly(string filename, IList references) { compilerErrors = null; string extension = Path.GetExtension(filename); CodeDomProvider codeProvider = null; switch (extension) { case ".cs": codeProvider = new Microsoft.CSharp.CSharpCodeProvider(); break; case ".vb": codeProvider = new Microsoft.CSharp.CSharpCodeProvider(); break; default: throw new InvalidOperationException("Script files must have a .cs or .vb."); } CompilerParameters compilerParams = new CompilerParameters(); compilerParams.CompilerOptions = "/target:library /optimize"; compilerParams.GenerateExecutable = false; compilerParams.GenerateInMemory = true; compilerParams.IncludeDebugInformation = false; compilerParams.ReferencedAssemblies.Add("mscorlib.dll"); compilerParams.ReferencedAssemblies.Add("System.dll"); foreach (string reference in references) { if (!compilerParams.ReferencedAssemblies.Contains(reference)) { compilerParams.ReferencedAssemblies.Add(reference); } } CompilerResults results = codeProvider.CompileAssemblyFromFile(compilerParams, filename); if (results.Errors.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (CompilerError item in results.Errors) { sb.AppendFormat("{0} line:{1} {2}\r\n", item.FileName, item.Line, item.ErrorText); } compilerErrors = results.Errors; throw new Exception( "Compiler error(s)\r\n" + sb.ToString()); } Assembly createdAssembly = results.CompiledAssembly; return createdAssembly; }
public override void StartProcessingRun(System.CodeDom.Compiler.CodeDomProvider languageProvider, string templateContents, System.CodeDom.Compiler.CompilerErrorCollection errors) { AssertNotProcessing(); isInProcessingRun = true; base.StartProcessingRun(languageProvider, templateContents, errors); throw new NotImplementedException(); }
/// <summary> /// Errors the collection to string array. /// </summary> /// <param name="errorCollection">The error collection.</param> /// <returns>List<System.String>.</returns> private static List<string> ErrorCollectionToStringArray(CompilerErrorCollection errorCollection) { List<string> errors = new List<string>(); foreach (CompilerError one in errorCollection) { errors.Add(one.ErrorText); } return errors; }
CompilationException (SerializationInfo info, StreamingContext context) : base (info, context) { filename = info.GetString ("filename"); errors = info.GetValue ("errors", typeof (CompilerErrorCollection)) as CompilerErrorCollection; results = info.GetValue ("results", typeof (CompilerResults)) as CompilerResults; fileText = info.GetString ("fileText"); errmsg = info.GetString ("errmsg"); errorLines = info.GetValue ("errorLines", typeof (int[])) as int[]; }
/// <summary> /// Initialises a new instance of <see cref="TemplateException"/> /// </summary> /// <param name="errors">The collection of compilation errors.</param> internal TemplateException(CompilerErrorCollection errors) : base("Unable to compile template.") { var list = new List<CompilerError>(); foreach (CompilerError error in errors) { list.Add(error); } Errors = new ReadOnlyCollection<CompilerError>(list); }
public override void Done(CompilerErrorCollection result) { if (!FileSystemHelper.FileCompare(TempFilePath, FilePath)) { string message = String.Format("Error during file generation. The target file '{0}' is read-only, but different from the transformation result. This problem can be a sign of an inconsistent source code package. Compile and check-in the current version of the file from the development environment or remove the read-only flag from the generation result. To compile a solution that contains messaging project on a build server, you can also exclude the messaging project from the build-server solution or set the <OverwriteReadOnlyFiles> msbuild project parameter to 'true' in the messaging project file.", Path.GetFullPath(FilePath)); result.Add(new CompilerError(String.Empty, 0, 0, null, message)); } base.Done(result); }
private static string BuildCompileErrorMessage(CompilerErrorCollection errors) { var stringBuilder = new StringBuilder(); foreach (CompilerError error in errors) { stringBuilder.AppendLine(error.ToString()); } return stringBuilder.ToString(); }
public CodeCompilerException( string message, CodeCompileUnit[] codeCompileUnits, CompilerErrorCollection errors, CodeDomProvider codeDomProvider ) : base(message) { CodeCompileUnit = codeCompileUnits; CompilerErros = errors; }
private CompilerResults GetCompiledAssembly(string Filename, string ReferenceRoot) { CompilerResults cr = Compile(CSharpSource(false), Filename, ReferenceRoot); System.CodeDom.Compiler.CompilerErrorCollection ces = cr.Errors; if (ces.Count > 0) { throw new FormulaErrorException(this, ces); } return(cr); }
private static Boolean ContainsErrors(CompilerErrorCollection errors) { foreach (CompilerError error in errors) { if (!error.IsWarning) { return true; } } return false; }
public static void ThrowCompileException(System.CodeDom.Compiler.CompilerErrorCollection ces) { if (ces.Count > 0) { string msg = "CompilerError :\n"; foreach (System.CodeDom.Compiler.CompilerError ce in ces) { msg += String.Format("line:{0} column:{1} error:{2} '{3}'\n", ce.Line, ce.Column, ce.ErrorNumber, ce.ErrorText); } throw new InvalidProgramException(msg); } }
public void AddRange(CompilerErrorCollection value) { if (value == null) { throw new ArgumentNullException("value"); } int count = value.Count; for (int i = 0; i < count; i++) { this.Add(value[i]); } }
public CompilerException(System.CodeDom.Compiler.CompilerErrorCollection compilerErrorCollection) { // TODO: Complete member initialization this.compilerErrorCollection = compilerErrorCollection; string message = string.Empty; foreach (var o in compilerErrorCollection) { message += o.ToString() + Environment.NewLine; } throw new Exception("CompilationError: " + message.TrimEnd()); }
/// <summary> /// Initializes a new instance of the <see cref="AssemblyResults"/> class. /// </summary> /// <param name="fullResults"> /// The results of the programmatically-accessed compilation. /// </param> /// <param name="resultSource"> /// The source that the compiler attempted to compile. /// </param> protected internal AssemblyResults(CompilerResults fullResults, string resultSource) { if(fullResults.Errors.HasErrors) { throw new CompilationException(fullResults.Errors, resultSource); } else { assembly = fullResults.CompiledAssembly; warnings = fullResults.Errors; } }
public override void StartProcessingRun (CodeDomProvider languageProvider, string templateContents, CompilerErrorCollection errors) { base.StartProcessingRun (languageProvider, templateContents, errors); this.provider = languageProvider; //HACK: Mono as of 2.10.2 doesn't implement GenerateCodeFromMember if (Type.GetType ("Mono.Runtime") != null) useMonoHack = true; if (languageProvider is Microsoft.CSharp.CSharpCodeProvider) isCSharp = true; postStatements.Clear (); members.Clear (); }
public static void ShowTemplateHostErrors (CompilerErrorCollection errors) { if (errors.Count == 0) return; TaskService.Errors.Clear (); foreach (CompilerError err in errors) { TaskService.Errors.Add (new Task (err.FileName, err.ErrorText, err.Column, err.Line, err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error)); } TaskService.ShowErrors (); }
internal static void LogicalSetData(string name, object value, System.CodeDom.Compiler.CompilerErrorCollection errors) { if (warningLogged) { return; } //FIXME: CallContext.LogicalSetData not implemented in Mono try { System.Runtime.Remoting.Messaging.CallContext.LogicalSetData(name, value); } catch (NotImplementedException) { LoggingService.LogWarning("T4: CallContext.LogicalSetData not implemented in this Mono version"); warningLogged = true; } }
internal static void LogicalSetData(string name, object value, System.CodeDom.Compiler.CompilerErrorCollection errors) { //FIXME: CallContext.LogicalSetData not implemented in Mono try { System.Runtime.Remoting.Messaging.CallContext.LogicalSetData(name, value); } catch (NotImplementedException) { errors.Add(new System.CodeDom.Compiler.CompilerError( null, -1, -1, null, "Could not set " + name + " - CallContext.LogicalSetData not implemented in this Mono version" ) { IsWarning = true }); } }
public CompileException(System.Collections.Specialized.StringCollection output, System.CodeDom.Compiler.CompilerErrorCollection errors) : base("Compile exception") { Output = output; Errors = errors; }
public CompilerErrorCollection(CompilerErrorCollection value) { AddRange(value); }
/// <summary> /// Initializes a new instance of the <see cref="CompilerErrorEventArgs"/> class. /// </summary> /// <param name="_compilerErrorCollection">The compiler error collection.</param> /// <param name="source">The s source.</param> public CompilerErrorEventArgs(System.CodeDom.Compiler.CompilerErrorCollection _compilerErrorCollection, string source) : this(_compilerErrorCollection) { this._source = source; }
/// <summary> /// Initializes a new instance of the <see cref="CompilerErrorEventArgs"/> class. /// </summary> /// <param name="compilerErrorCollection">The compiler error collection.</param> public CompilerErrorEventArgs(System.CodeDom.Compiler.CompilerErrorCollection compilerErrorCollection) { this._compilerErrorCollection = null; this._source = string.Empty; this._compilerErrorCollection = compilerErrorCollection; }
public void LoadComileErrors(System.CodeDom.Compiler.CompilerErrorCollection Errors) { _winErrorList.ComilerErrors(null, Errors); }
public CompilerErrorCollection(CompilerErrorCollection value) { return(default(CompilerErrorCollection)); }
public void AddRange(CompilerErrorCollection !value) { Contract.Requires(value != null); }
public void AddRange(CompilerErrorCollection value) { throw new NotImplementedException(); }
public override void StartProcessingRun(CodeDomProvider languageProvider, string templateContents, System.CodeDom.Compiler.CompilerErrorCollection errors) { callContextMembersWriter = new StringWriter(); fieldWriter = new StringWriter(); this.languageProvider = languageProvider; base.StartProcessingRun(languageProvider, templateContents, errors); }
/// <summary> /// Initializes a new instance of the <see cref="CompilerErrorEventArgs"/> class. /// </summary> public CompilerErrorEventArgs() { this._compilerErrorCollection = null; this._source = string.Empty; }
public FormulaErrorException(FormulaSpace fms, System.CodeDom.Compiler.CompilerErrorCollection ces) { this.fms = fms; this.ces = ces; }
/// <summary> /// 记录错误信息 /// The engine calls this method when it is done processing a text template to pass any errors that occurred to the host. The host can decide how to display them. /// 该引擎调用完成时,处理文本模板通过任何错误发生的主机此方法。主机可以决定如何显示它们。 /// </summary> /// <param name="errors"></param> public void LogErrors(System.CodeDom.Compiler.CompilerErrorCollection errors) { _ErrorCollection = errors; }
public override void onPageLoad() { if (Utilities.GET("Compile") == "true") { echo("<h1>Welcome " + LoggedInMember.Nickname + "</h1>"); echo("<h3 style='margin-left:10px;'>There is currently " + Log.TotalVisitors() + " users viewing this website and " + Log.TotalMembers() + " registered members.</h3><br />"); echo("<div style='float: right;'><a href='/Admin/Pages/'>Back</a></div><br /><br />"); int PageID = Convert.ToInt32(Utilities.GET("ID")); Page EditPage = new Page(PageID, SqlConnection); System.CodeDom.Compiler.CompilerErrorCollection Errors = EditPage.Compile(); if (Errors != null) { foreach (System.CodeDom.Compiler.CompilerError Error in Errors) { if (Error.IsWarning) { echo("<span style='color:yellow'>" + Error.ErrorText + "</span><br />"); } else { echo("<span style='color:red'>" + Error.ErrorText + " on line " + Error.Line + "</span><br />"); } } } else { echo("<span style='color:green'>Compiled Successfully!</span>"); } } else if (Utilities.GET("NewPage") == "true") { echo(string.Format(@"<div class='boxcontainer'> <span class='header'>Welcome, {0}</span> <span class='links'> <a href='#' onclick='setFullScreen(editor, true);return false;'>Fullscreen</a> <a href='#' onclick='CreatePage(); return false;'>Create</a> <a href='/Admin/Pages/'>Quit</a> </span> <br /> <br /> There is currently {1} users viewing the website and {2} registered members. </div>", LoggedInMember.Nickname, Log.TotalVisitors(), Log.TotalMembers())); echo("<div class='boxcontainer'>"); echo("<a href='#' onclick='$(\".PageSettings\").animate({ height: \"toggle\" }); return false;'>Edit Settings</a><br /><span class='PageSettings'>"); echo("Page Url:<br /><input style='width:150px;' class='txtbar' type='text' id='Url' onkeypress='Edited();' onchange='Edited();' value='' /><br />"); echo("Page Domain:<br /><input style='width:150px;' class='txtbar' type='text' id='Domain' onkeypress='Edited();' onchange='Edited();' value='blaze-games.com' /><br />"); echo("Page References:<br /><input style='width:150px;' class='txtbar' type='text' id='new_reference' /> <a href='#' onclick='AddReference();return false;' title='Add Reference'>+</a> | <a href='#' onclick='RemoveReference();return false;' title='Remove Reference'>x</a><br />"); echo("<select style='width:200px;' multiple='multiple' class='dropdown' id='References'>"); echo("<option value='System.dll'>System.dll</option>"); echo("<option value='System.dll'>System.Core.dll</option>"); echo("<option value='System.Web.dll'>System.Web.dll</option>"); echo("<option value='System.Data.dll'>System.Data.dll</option>"); echo("<option value='mysql.data.dll'>mysql.data.dll</option>"); echo("<option value='BlazeGames.Web.dll'>BlazeGames.Web.dll</option>"); echo("</select><br />"); echo("Page Authorization:<br /><input style='width:20px;' class='txtbar' type='text' id='MinimumAuthorization' onkeypress='Edited();' onchange='Edited();' value='0' /><br />"); echo("RequireSecure:<br /><select style='width:75px;' class='dropdown' id='RequireSecure' onchange='Edited();'>"); echo("<option value='False'>False</option><option value='True'>True</option>"); echo("</select><br /><br />"); //echo("HtmlPage: <input style='width:200px;' class='txtbar' type='text' name='' value='" + EditPage.HtmlPage + "' /><br />"); echo("Page Code:<br /></span>"); echo(Utilities.CodeMirror("maincode", Page.DefaultCode, "text/x-csharp", true, "ambiance")); echo("Page CSS:<br />"); echo(Utilities.CodeMirror("csscode", Page.DefaultCSS, "text/css", false, "ambiance")); echo("Page Javascript:<br />"); echo(Utilities.CodeMirror("jscode", Page.DefaultJS, "text/javascript", false, "ambiance")); echo("Page Html:<br />"); echo(Utilities.CodeMirror("htmlcode", Page.DefaultHTML, "text/html", false, "ambiance")); echo("</div>"); } else if (Utilities.GET("EditPage") == "true" && Utilities.GET("ID") != "") { int PageID = Convert.ToInt32(Utilities.GET("ID")); Page EditPage = new Page(PageID, SqlConnection); if (EditPage.IsEditing == 0) { EditPage.IsEditing = LoggedInMember.ID; EditPage.Save(); } echo(string.Format(@"<div class='boxcontainer'> <span class='header'>Welcome, {0}</span> <span class='links'> <a href='#' onclick='setFullScreen(editor, true);return false;'>Fullscreen</a> <a href='#' onclick='UnlockPageNoRedirect({3}); return false;'>Unlock</a> <a href='#' onclick='DeletePage({3}); return false;'>Delete</a> <a href='#' onclick='CompilePage(false); return false;'>Compile</a> <a href='#' onclick='CompilePage(true); return false;'>Compile And Quit</a> <a href='/Admin/Pages/'>Quit</a> </span> <br /> <br /> There is currently {1} users viewing the website and {2} registered members. </div>", LoggedInMember.Nickname, Log.TotalVisitors(), Log.TotalMembers(), EditPage.ID)); if (EditPage.Exists) { echo("<div class='boxcontainer'>"); echo("<a href='#' onclick='$(\".PageSettings\").animate({ height: \"toggle\" }); return false;'>Edit Settings</a><br /><span class='PageSettings'>"); echo("<span style='display:none;' id='ID'>" + EditPage.ID + "</span>"); echo("Page Url:<br /><input style='width:150px;' class='txtbar' type='text' id='Url' onkeypress='Edited();' onchange='Edited();' value='" + EditPage.Url + "' /><br />"); echo("Page Domain:<br /><input style='width:150px;' class='txtbar' type='text' id='Domain' onkeypress='Edited();' onchange='Edited();' value='" + EditPage.Domain + "' /><br />"); echo("Page References:<br /><input style='width:150px;' class='txtbar' type='text' id='new_reference' /> <a href='#' onclick='AddReference();return false;' title='Add Reference'>+</a> | <a href='#' onclick='RemoveReference();return false;' title='Remove Reference'>x</a><br />"); echo("<select style='width:200px;' multiple='multiple' class='dropdown' id='References'>"); foreach (string Reference in EditPage.References) { echo("<option value='" + Reference + "'>" + Reference + "</option>"); } echo("</select><br />"); echo("Page Authorization:<br /><input style='width:20px;' class='txtbar' type='text' id='MinimumAuthorization' onkeypress='Edited();' onchange='Edited();' value='" + EditPage.MinimumAuthorization + "' /><br />"); echo("RequireSecure:<br /><select style='width:75px;' class='dropdown' id='RequireSecure' onchange='Edited();'>"); echo("<option value='" + EditPage.RequireSecure + "'>" + EditPage.RequireSecure + "</option><option value='" + (!EditPage.RequireSecure) + "'>" + (!EditPage.RequireSecure) + "</option>"); echo("</select><br /><br />"); //echo("HtmlPage: <input style='width:200px;' class='txtbar' type='text' name='' value='" + EditPage.HtmlPage + "' /><br />"); echo("Page Code:<br /></span>"); echo(Utilities.CodeMirror("maincode", EditPage.Code, "text/x-csharp", true, "ambiance")); echo("Page CSS:<br />"); echo(Utilities.CodeMirror("csscode", EditPage.PageCSS, "text/css", false, "ambiance")); echo("Page Javascript:<br />"); echo(Utilities.CodeMirror("jscode", EditPage.PageJS, "text/javascript", false, "ambiance")); echo("Page Html:<br />"); echo(Utilities.CodeMirror("htmlcode", EditPage.PageHTML, "text/html", false, "ambiance")); echo("</form><script>$('.PageSettings').animate({ height: 'toggle' });</script>"); echo("</div>"); } else { echo("<div class='boxcontainer'>Unable to find the page you want to edit.</div>"); } } else { echo(string.Format(@"<div class='boxcontainer'> <span class='header'>Welcome, {0}</span> <span class='links'> <a href='/Admin/'>Admin Home</a> <a href='/Admin/Pages/NewPage/'>New Page</a> <a href='#' onclick='CompileAll(); return false;'>Compile All Pages</a> </span> <br /> <br /> There is currently {1} users viewing the website and {2} registered members. </div>", LoggedInMember.Nickname, Log.TotalVisitors(), Log.TotalMembers())); MySqlCommand PageFetchQuery = new MySqlCommand("SELECT * FROM pages ORDER BY LastUpdate DESC", SqlConnection); MySqlDataReader PageFetchReader = PageFetchQuery.ExecuteReader(); List <object[]> Pages = new List <object[]>(); while (PageFetchReader.Read()) { int ID = PageFetchReader.GetInt32("ID"); string Url = PageFetchReader.GetString("Url"); string Domain = PageFetchReader.GetString("Domain"); DateTime Updated = PageFetchReader.GetDateTime("LastUpdate"); TimeSpan LastUpdate = DateTime.Now - Updated; int MinimumAuthorization = PageFetchReader.GetInt32("MinimumAuthorization"); int PageVersion = PageFetchReader.GetInt32("PageVersion"); int IsEditing = PageFetchReader.GetInt32("IsEditing"); Pages.Add(new object[] { ID, Url, Domain, Updated, MinimumAuthorization, PageVersion, IsEditing }); } PageFetchReader.Close(); echo("<style type='text/css'>.table_row:hover{ background-color:#CCCCCC; }</style>"); echo("<div class='boxcontainer'><br /><br /><table style='width:100%;' class='display pagelist'><thead><tr><th>ID</th><th>Domain</th><th>Url</th><th>Last Update</th><th>Update Sort</th><th>Auth</th><th>Locked To</th></tr></thead><tbody>"); foreach (object[] PageObj in Pages) { int ID = Convert.ToInt32(PageObj[0]); string Url = PageObj[1] as string; string Domain = PageObj[2] as string; DateTime Updated = Convert.ToDateTime(PageObj[3]); TimeSpan LastUpdate = DateTime.Now - Updated; int MinimumAuthorization = Convert.ToInt32(PageObj[4]); int PageVersion = Convert.ToInt32(PageObj[5]); int IsEditing = Convert.ToInt32(PageObj[6]); string LockedBy = "Unlocked"; if (IsEditing > 0) { Member LockedByMember = new Member(IsEditing, SqlConnection); LockedBy = LockedByMember.FirstName + " " + LockedByMember.LastName; } string RowStyle = ""; if (IsEditing > 0) { RowStyle = "background-color:#DCECF2;"; } else if (PageVersion != Page.CurrentPageVersion) { RowStyle = "background-color:#EAE7D3;"; } if (IsEditing != 0 && IsEditing != LoggedInMember.ID) { echo("<tr class='table_row' pageid='" + ID + "' style='" + RowStyle + "'><td>" + ID + "</td><td>" + Domain + "</td><td>" + Url + "</td><td>" + Utilities.GetTimeSpan(LastUpdate) + "</td><td>" + Utilities.GetSortableDate(Updated) + "</td><td>" + MinimumAuthorization + "</td><td>" + LockedBy + "</td></tr>"); } else { echo("<tr class='table_row' pageid='" + ID + "' style='cursor:pointer;" + RowStyle + "'><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + ID + "</td><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + Domain + "</td><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + Url + "</td><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + Utilities.GetTimeSpan(LastUpdate) + "</td><td>" + Utilities.GetSortableDate(Updated) + "</td><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + MinimumAuthorization + "</td><td onclick=\"window.location='./EditPage/ID-" + ID + "/';\">" + LockedBy + "</td></tr>"); } } echo("</tbody></table></div>"); } }
public void AddRange(CompilerErrorCollection value) { InnerList.AddRange(value.InnerList); }
public CompilerErrorCollection(CompilerErrorCollection value) { throw new NotImplementedException(); }