public static void WriteDiagnostics(InternalGlobal g, StringAction Write, InternalWebMethodInfo[] WebMethods) { // should the diagnostics be a separate rich Browser Application? :) var Context = g.InternalApplication.Context; Write("<title>jsc-solutions.net</title>"); Write("<center>"); Write("<div style='background-color: black; color: white; padding: 2em;'>"); Write("« Rotate your device to left to <b>launch</b>"); Write("</div>"); Write("</center>"); Write("<br/><center><a href='/'>Launch Application</a></center><br/>"); //Write("<h1>" + Context.Request.Headers["Host"] + "</h1>"); foreach (var HeaderKey in Context.Request.Headers.AllKeys) { var HeaderValue = Context.Request.Headers[HeaderKey]; Write("<code style='color: gray;'>" + HeaderKey + "</code>:"); Write("<code style='color: green;'>" + HeaderValue + "</code><br />"); } Write("<a href='http://jsc-solutions.net'><img border='0' src='/assets/ScriptCoreLib/jsc.png' /></a>"); #region Special pages Write("<h2>Special pages</h2>"); Write("<br /> " + "special page: " + "<a href='/robots.txt'>/robots.txt</a>"); Write("<br /> " + "special page: " + "<a href='/xml'>/xml</a>"); Write("<br /> " + "special page: " + "<a href='/crossdomain.xml'>/crossdomain.xml</a>"); Write("<br /> " + "special page: " + "<a href='/favicon.ico'>/favicon.ico</a>"); Write("<br /> " + "special page: " + "<a href='/jsc'>/jsc</a>"); #endregion Write("<h2>WebMethods (" + WebMethods.Length + ")</h2>"); foreach (var item in WebMethods) { InternalGlobalExtensions.WriteWebMethodForm(Write, item); } //Write("<br /> Path: '" + Context.Request.Path + "'"); //Write("<br /> HttpMethod: '" + Context.Request.HttpMethod + "'"); Write("<h2>Form</h2>"); foreach (var item in Context.Request.Form.AllKeys) { Write("<br /> " + "<img src='http://i.msdn.microsoft.com/w144atby.pubproperty(en-us,VS.90).gif' /> <code>"); Write(item); Write(" = "); Write(escapeXML(Context.Request.Form[item])); Write("</code>"); } #region QueryString Write("<h2>QueryString</h2>"); foreach (var item in Context.Request.QueryString.AllKeys) { Write("<br /> " + "<img src='http://i.msdn.microsoft.com/w144atby.pubproperty(en-us,VS.90).gif' /> <code>"); Write(item); Write(" = "); Write(escapeXML(Context.Request.QueryString[item])); Write("</code>"); } #endregion Write("<h2>Script Applications</h2>"); foreach (var item in g.GetScriptApplications()) { Write("<br /> " + "script application: " + item.TypeName); foreach (var r in item.References) { Write("<br /> "); Write("<img src='http://i.msdn.microsoft.com/yxcx7skw.pubclass(en-us,VS.90).gif' /> reference: "); Write(r.AssemblyFile); } } Write("<h2>Files</h2>"); foreach (var item in g.GetFiles()) { Write("<br /> " + " file: <a href='" + item.Name + "'>" + item.Name + "</a>"); } }
public static void InternalApplication_BeginRequest(InternalGlobal g) { var that = g.InternalApplication; var Context = that.Context; var Path = Context.Request.Path; var CurrentFile = g.ToCurrentFile(); if (CurrentFile != null) { // http://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/ //// http://www.mombu.com/programming/xbase/t-outputcache-directive-vs-responsecachesetcacheability-624773.html //g.Response.Cache.SetCacheability(System.Web.HttpCacheability.Public); //g.Response.Cache.SetExpires(DateTime.Now.AddMinutes(15)); g.Response.AddHeader("x-handler", "http://jsc-solutions.net"); // to root Context.Response.WriteFile("/" + CurrentFile.Name); that.CompleteRequest(); return; } if (Path == "/favicon.ico") { Context.Response.WriteFile("assets/ScriptCoreLib/jsc.ico"); that.CompleteRequest(); return; } if (Path == "/robots.txt") { Context.Response.StatusCode = 404; that.CompleteRequest(); return; } if (Path == "/crossdomain.xml") { Context.Response.StatusCode = 404; that.CompleteRequest(); return; } StringAction Write = e => { // could we take the method pointer implicitly? Context.Response.Write(e); }; StringAction WriteLine = e => { // could we take the method pointer implicitly? Write(e + Environment.NewLine); }; var WebMethods = g.GetWebMethods(); var IsComplete = false; that.Response.ContentType = "text/html"; WriteDiagnostics(g, Write, WebMethods); IsComplete = true; that.CompleteRequest(); }
public void ReadFromToolExe(BinaryReader br) { short functionCount, globalCount; uint functionTablePointer, globalTablePointer, typeArrayPointer; switch (m_majorVersion) { case GameMajorVersion.Halo1: functionCount = 545; functionTablePointer = 0x002EC220; globalCount = 495; globalTablePointer = 0x00328B00; typeArrayPointer = 0x00722C8C; break; case GameMajorVersion.Halo2: functionCount = 924; functionTablePointer = 0x005ECFE0; globalCount = 704; globalTablePointer = 0x005EDE6C; // this is not the pointer table, fix typeArrayPointer = 0; break; default: throw new Exception("Not a supported version."); } m_functions = new InternalFunction[functionCount]; for (short i = 0; i < functionCount; i++) { br.BaseStream.Position = functionTablePointer + i * 4; br.BaseStream.Position = br.ReadUInt32() - 0x400000; short returnType = br.ReadInt16(); br.BaseStream.Position += 2; uint namePointer = br.ReadUInt32(); br.BaseStream.Position += 8; uint descriptionPointer = br.ReadUInt32(); uint argumentHelpPointer = br.ReadUInt32(); br.BaseStream.Position += 2; short argumentCount = br.ReadInt16(); Argument[] args = new Argument[argumentCount]; for (short j = 0; j < argumentCount; j++) { args[j] = new Argument(String.Empty, br.ReadInt16(), String.Empty); } br.BaseStream.Position = namePointer - 0x400000; string name = StringOps.ReadCString(br); string description = String.Empty; if (descriptionPointer != 0) { br.BaseStream.Position = descriptionPointer - 0x400000; description = StringOps.ReadCString(br); } //unused: string argumentHelp = String.Empty; if (argumentHelpPointer != 0) { br.BaseStream.Position = argumentHelpPointer - 0x400000; //unused: argumentHelp = StringOps.ReadCString(br); } m_functions[i] = new InternalFunction(name, i, returnType, description, args); } m_globals = new InternalGlobal[globalCount]; for (short i = 0; i < globalCount; i++) { br.BaseStream.Position = globalTablePointer + i * 4; br.BaseStream.Position = br.ReadUInt32() - 0x400000; uint namePointer = br.ReadUInt32(); short type = br.ReadInt16(); br.BaseStream.Position = namePointer - 0x400000; string name = StringOps.ReadCString(br); m_globals[i] = new InternalGlobal(name, i, type); } uint typeTablePointer = typeArrayPointer + 4; br.BaseStream.Position = typeArrayPointer; int typeCount = br.ReadInt32() - (int)IntegralValueType.IntegralValueTypeCount; m_types = new ExtendedTypeBase[typeCount]; for (short i = 0; i < typeCount; i++) { short typeIndex = (short)(i + IntegralValueType.IntegralValueTypeCount); br.BaseStream.Position = typeTablePointer + typeIndex * 4; br.BaseStream.Position = br.ReadUInt32() - 0x400000; string name = StringOps.ReadCString(br); Dictionary <string, short> objectReferences = new Dictionary <string, short>(); // f**k, how to handle Hud.Navpoints["red_flag"] with the dot/namespacing dealy switch (name) { case "trigger_volume": m_types[i] = new BlockReferenceType(name, "TriggerVolumes", typeIndex, typeIndex, BlockSourceTag.Scenario); break; case "navpoint": m_types[i] = new BlockReferenceType(name, "Navpoints", typeIndex, typeIndex, BlockSourceTag.HudGlobals); break; default: m_types[i] = new BlockReferenceType(name, ScriptingStringOps.ToPslFormatting(name, null) + 's', typeIndex, typeIndex, BlockSourceTag.Scenario); break; } } // enumerations 0x00656F4C }