using System; using System.Collections; using System.ComponentModel; using System.Web; using System.Web.SessionState; using System.Xml; using System.IO; namespace PageBox { /// ///

Generated.
/// Methods modified or created:

///

Copyright (c) 2002 Alexis Grandemange
/// Mail: alexis.grandemange@pagebox.net

///
This program is free software; you can redistribute it and/or
	/// modify it under the terms of the GNU Lesser General Public
	/// License as published by the Free Software Foundation; version
	/// 2.1 of the License.
	/// This library is distributed in the hope that it will be useful,
	/// but WITHOUT ANY WARRANTY; without even the implied warranty of
	/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	/// GNU Lesser General Public License for more details.
	/// A copy of the GNU Lesser General Public License lesser.txt should be
	/// included in the distribution.
///
public class Global : System.Web.HttpApplication { /// ///Deployed archive list. /// public static PbArchs pbArchives; /// /// This physical path (where xml files are stored) /// public static string path; /// /// URL of the Deploy Web Service on this PageBox. /// public static string DeployURL; /// /// true if initialized /// static bool isInitialized = false; protected void Application_Start(Object sender, EventArgs e) { } /// /// Restores pbArchives. /// private void restore() { if (File.Exists(path + "\\pbArchives.xml")) { XmlTextReader r = new XmlTextReader(path + "\\pbArchives.xml"); r.WhitespaceHandling = WhitespaceHandling.None; r.Read(); if (r.NodeType == XmlNodeType.XmlDeclaration) pbArchives = new PbArchs(r); else pbArchives = new PbArchs(); r.Close(); } else pbArchives = new PbArchs(); } /// /// Called by PbArchs when pbArchives has been changed. /// Save pbArchives. /// public static void savePbArchives() { lock(typeof(Global)) { XmlTextWriter w = new XmlTextWriter (path + "\\pbArchives.xml", null); w.Formatting = Formatting.Indented; w.WriteStartDocument(); pbArchives.WriteXml(w); w.WriteEndDocument(); w.Close(); } } protected void Session_Start(Object sender, EventArgs e) { } /// /// Restores pbArchives. /// protected void Application_BeginRequest(Object sender, EventArgs e) { lock(typeof(Global)) { if (!isInitialized) { path = Request.ServerVariables["PATH_TRANSLATED"]; int pos = path.LastIndexOf("\\"); path = path.Substring(0, pos); // Repository physical directory restore(); string lpath = Request.ServerVariables["PATH_INFO"]; string host = Request.ServerVariables["HTTP_HOST"]; string port = Request.ServerVariables["SERVER_PORT"]; pos = lpath.LastIndexOf("/"); lpath = lpath.Substring(0, pos + 1) + "Deploy.asmx"; if (port.Equals("80")) DeployURL = host + lpath; else DeployURL = host + ":" + port + lpath; } } } protected void Application_EndRequest(Object sender, EventArgs e) { } protected void Session_End(Object sender, EventArgs e) { } protected void Application_End(Object sender, EventArgs e) { } } }