Ejemplo n.º 1
0
        protected override string HitsToHtml(ArrayList hits)
        {
            StringWriter sw = new StringWriter();
            XmlWriter    xw = new XmlTextWriter(sw);

            xw.WriteStartElement("div");                // Start the File results block

            xw.WriteStartElement("table");
            xw.WriteAttributeString("border", "0");
            xw.WriteAttributeString("width", "100%");
            xw.WriteStartElement("tr");
            xw.WriteStartElement("td");
            xw.WriteAttributeString("bgcolor", "#fffa6e");
            xw.WriteAttributeString("nowrap", "1");
            xw.WriteStartElement("font");
            xw.WriteAttributeString("size", "+2");
            xw.WriteString("Your Files");
            xw.WriteEndElement();               // font
            xw.WriteEndElement();               // td
            xw.WriteEndElement();               // tr
            xw.WriteEndElement();               // table

            xw.WriteStartElement("table");      // Start the results table
            xw.WriteAttributeString("border", "0");
            xw.WriteAttributeString("width", "100%");
            xw.WriteAttributeString("cellpadding", "0");
            xw.WriteAttributeString("cellspacing", "0");

            // Sort results by score
            IComparer filescorecomparer = new FileScoreComparer();

            hits.Sort(filescorecomparer);

            bool color_band = true;

            foreach (Hit hit in hits)
            {
                HTMLRenderSingleFile(hit, color_band, xw);
                color_band = !color_band;
            }

            xw.WriteEndElement();               // End results table
            xw.WriteEndElement();               // End File results block

            xw.Close();

            //Console.WriteLine ("-- File Renderer ----------------------------------------------------");
            //Console.WriteLine (sw.ToString ());
            //Console.WriteLine ("---------------------------------------------------------------------\n\n");

            return(sw.ToString());
        }
Ejemplo n.º 2
0
		protected override string HitsToHtml (ArrayList hits)
		{
			StringWriter sw = new StringWriter ();
			XmlWriter xw = new XmlTextWriter (sw);

			xw.WriteStartElement ("div");	// Start the File results block

			xw.WriteStartElement ("table");
			xw.WriteAttributeString ("border", "0");
			xw.WriteAttributeString ("width", "100%");
			xw.WriteStartElement ("tr");
			xw.WriteStartElement ("td");
			xw.WriteAttributeString ("bgcolor", "#fffa6e");
			xw.WriteAttributeString ("nowrap", "1");
			xw.WriteStartElement ("font");
			xw.WriteAttributeString ("size", "+2");
			xw.WriteString ("Your Files");
			xw.WriteEndElement ();	// font
			xw.WriteEndElement ();	// td
			xw.WriteEndElement ();	// tr
			xw.WriteEndElement ();	// table

			xw.WriteStartElement ("table");	// Start the results table
			xw.WriteAttributeString ("border", "0");
			xw.WriteAttributeString ("width", "100%");
			xw.WriteAttributeString ("cellpadding", "0");
			xw.WriteAttributeString ("cellspacing", "0");

			// Sort results by score
			IComparer filescorecomparer = new FileScoreComparer ();
			hits.Sort (filescorecomparer);
			
			bool color_band = true;
			foreach (Hit hit in hits) {
				HTMLRenderSingleFile (hit, color_band, xw);
				color_band = !color_band;
			}

			xw.WriteEndElement ();	// End results table
			xw.WriteEndElement ();	// End File results block

			xw.Close ();

			//Console.WriteLine ("-- File Renderer ----------------------------------------------------");
			//Console.WriteLine (sw.ToString ());
			//Console.WriteLine ("---------------------------------------------------------------------\n\n");

			return sw.ToString ();
		}