public void WriteSourceMapLegendFrame(RenderOutputMethod renderOutput) { Stream stream = renderOutput.MakeChildMethod("legends").CreateFile(this.filename, "text/html"); StreamWriter streamWriter = new StreamWriter(stream); streamWriter.WriteLine("<html>"); streamWriter.WriteLine(string.Format("<head><title>{0}</title></head>", this.displayName)); streamWriter.WriteLine("<body>"); streamWriter.WriteLine(string.Format("<h3>{0}</h3>", this.displayName)); ThumbnailRecord thumbnailRecord = this.thumbnailDelegate(); if (thumbnailRecord != null) { streamWriter.WriteLine(thumbnailRecord.WriteImgTag("../")); } if (this.sourceMapInfo.mapFileURL != "") { streamWriter.WriteLine(string.Format("<br>Map URL: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapFileURL)); } if (this.sourceMapInfo.mapHomePage != "") { streamWriter.WriteLine(string.Format("<br>Map Home Page: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapHomePage)); } if (this.sourceMapInfo.mapDescription != "") { streamWriter.WriteLine(string.Format("<p>{0}</p>", this.sourceMapInfo.mapDescription)); } foreach (LegendRecord current in this.legendRecords) { streamWriter.WriteLine(string.Format("<br><img src=\"{0}\" width=\"{1}\" height=\"{2}\">", current.urlSuffix, current.imageDimensions.Width, current.imageDimensions.Height)); } streamWriter.WriteLine("</body>"); streamWriter.WriteLine("</html>"); streamWriter.Close(); }
private void WriteChanges(RenderOutputMethod outputMethod) { Stream w = outputMethod.MakeChildMethod("manifests") .CreateFile(manifestFilename(blockId), "text/xml"); XmlTextWriter xmlTextWriter = new XmlTextWriter(w, Encoding.UTF8); using (xmlTextWriter) { xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(true); xmlTextWriter.WriteStartElement("ManifestBlock"); if (superBlock != null) { superBlock.WriteXML(xmlTextWriter); } foreach (ManifestRecord current in this) { current.WriteXML(xmlTextWriter); } xmlTextWriter.WriteEndElement(); xmlTextWriter.Close(); } }
public ManifestBlock(TellManifestDirty tellManifestDirty, RenderOutputMethod outputMethod, int blockId) { this.tellManifestDirty = tellManifestDirty; this.blockId = blockId; try { Stream input = outputMethod.MakeChildMethod("manifests").ReadFile(manifestFilename(blockId)); XmlTextReader xmlTextReader = new XmlTextReader(input); using (xmlTextReader) { MashupParseContext mashupParseContext = new MashupParseContext(xmlTextReader); while (mashupParseContext.reader.Read()) { if (mashupParseContext.reader.NodeType == XmlNodeType.Element && mashupParseContext.reader.Name == "ManifestBlock") { XMLTagReader xMLTagReader = mashupParseContext.NewTagReader("ManifestBlock"); while (xMLTagReader.FindNextStartTag()) { if (xMLTagReader.TagIs(ManifestRecord.GetXmlTag())) { recordList.Add(new ManifestRecord(mashupParseContext, this)); } else { if (xMLTagReader.TagIs(ManifestSuperBlock.GetXmlTag())) { superBlock = new ManifestSuperBlock(mashupParseContext, new TellManifestDirty(SetDirty)); } } } return; } } throw new InvalidMashupFile(mashupParseContext, "No ManifestBlock tag"); } } catch (Exception) { } finally { if (blockId == 0 && superBlock == null) { superBlock = new ManifestSuperBlock(1, new TellManifestDirty(SetDirty)); } } }
public RenderOutputMethod MakeChildMethod(string subdir) { return(new ManifestOutputMethod(baseMethod.MakeChildMethod(subdir), GetPath(subdir), manifest)); }