mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
* list: Modified file. * System.Web/HttpRuntime.cs: avoid nulls and exception when getting resource format strings. * System.Web/StaticFileHandler.cs: added file name to error message. * System.Web.Compilation/AspElements.cs: new method Tag.GetElements used to parse the inner contents of a tag looking for data binding or code render tags. New property HtmlControlTag.ParseChildren allows differentiation of a couple of HtmlControls that has children as properties (namely HtmlTable and HtmlTableRow). * System.Web.Compilation/AspGenerator.cs: fixed container semantics to match BindingContainer one. Implemented Inherits attribute for page and control. Support HtmlControls that has ChildrenAsProperties. Generate code for data binding functions that matches the semantic of Container. Handle data bound and code render attribute values. Set proper value return for TemplateSourceDirectory. Should be relative to appPath. * System.Web.Compilation/BaseCompiler.cs: moved CompilerOptions and References handling here. * System.Web.Compilation/CachingCompiler.cs: copy result of compilation. * System.Web.Compilation/CompilationException.cs: simple ToString () implementation. * System.Web.Compilation/CompilationResult.cs: implemented CopyFrom and ToString. * System.Web.Compilation/GlobalAsaxCompiler.cs: * System.Web.Compilation/PageCompiler.cs: * System.Web.Compilation/UserControlCompiler.cs: removed CompilerOptions as it's now handled in the base class. Get all the types in the generated assembly and look for one that derives from the correct Type. * System.Web.UI/Control.cs: implemented TemplateSourceDirectory. * System.Web.UI/TemplateControl.cs: implemented LoadControl and LoadTemplate. * System.Web.Util/PathUtil.cs: some path handling methods that are not available in Path. svn path=/trunk/mcs/; revision=9583
115 lines
2.4 KiB
C#
115 lines
2.4 KiB
C#
//
|
|
// System.Web.Compilation.BaseCompiler
|
|
//
|
|
// Authors:
|
|
// Gonzalo Paniagua Javier ([email protected])
|
|
//
|
|
// (C) 2002 Ximian, Inc (http://www.ximian.com)
|
|
//
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace System.Web.Compilation
|
|
{
|
|
abstract class BaseCompiler
|
|
{
|
|
//FIXME: configurable?
|
|
static string default_assemblies = "System.Web.dll, System.Data.dll, System.Drawing.dll";
|
|
static Random rnd = new Random ((int) DateTime.Now.Ticks);
|
|
string randomName;
|
|
protected Hashtable options;
|
|
|
|
protected BaseCompiler ()
|
|
{
|
|
}
|
|
|
|
public virtual Type GetCompiledType ()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public virtual string Key {
|
|
get {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public virtual string SourceFile {
|
|
get {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public virtual string [] Dependencies {
|
|
get {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public virtual string CompilerOptions {
|
|
get {
|
|
string assemblies = default_assemblies;
|
|
string privatePath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
|
|
//FIXME: remove the next line once multiple appdomains can work together
|
|
if (privatePath == null) privatePath = "bin";
|
|
//
|
|
if (privatePath != null && Directory.Exists (privatePath)) {
|
|
StringBuilder sb = new StringBuilder (assemblies);
|
|
foreach (string fileName in Directory.GetFiles (privatePath, "*.dll"))
|
|
sb.AppendFormat (", {0}", fileName);
|
|
assemblies = sb.ToString ();
|
|
sb = null;
|
|
}
|
|
|
|
string [] split = assemblies.Split (',');
|
|
StringBuilder result = new StringBuilder ();
|
|
foreach (string assembly in split)
|
|
result.AppendFormat ("/r:{0} ", assembly.TrimStart ());
|
|
|
|
if (options == null)
|
|
return result.ToString ();
|
|
|
|
string compilerOptions = options ["CompilerOptions"] as string;
|
|
if (compilerOptions != null) {
|
|
result.Append (' ');
|
|
result.Append (compilerOptions);
|
|
}
|
|
|
|
string references = options ["References"] as string;
|
|
if (references == null)
|
|
return result.ToString ();
|
|
|
|
split = references.Split (' ');
|
|
foreach (string s in split)
|
|
result.AppendFormat (" /r:{0}", s);
|
|
|
|
return result.ToString ();
|
|
}
|
|
}
|
|
|
|
static string GetRandomFileName ()
|
|
{
|
|
string output;
|
|
|
|
do {
|
|
output = "tmp" + rnd.Next () + ".dll";
|
|
} while (File.Exists (output));
|
|
|
|
return output;
|
|
}
|
|
|
|
public virtual string TargetFile {
|
|
get {
|
|
if (randomName == null)
|
|
randomName = GetRandomFileName ();
|
|
|
|
return randomName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|