public static void CopyFile(string sourcePath, RenderOutputMethod renderOutput, string relativeDestPath, string mimeType) { FileIdentification fileIdentificationStatic = FileOutputMethod.GetFileIdentificationStatic(sourcePath); FileIdentification fileIdentification = renderOutput.GetFileIdentification(relativeDestPath); if (fileIdentificationStatic.CompareTo(fileIdentification) == 0) { return; } Stream stream = new FileStream(sourcePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); Stream stream2 = renderOutput.CreateFile(relativeDestPath, mimeType); byte[] buffer = new byte[65536]; while (true) { int num = stream.Read(buffer, 0, 65536); if (num == 0) { break; } stream2.Write(buffer, 0, num); } stream.Close(); stream2.Close(); }
private static void WriteMain(Mashup mashup, RenderOutputMethod renderOutput, string fileName) { TextWriter textWriter = new StreamWriter(renderOutput.CreateFile(fileName, "text/html")); string showDefaultLayerName = ReferenceName(mashup.layerList.First.GetDisplayName()); string text = ""; string arg = " checked"; foreach (Layer current in mashup.layerList) { string arg2 = string.Format( "<input type=\"checkbox\" id=\"checkbox:{0}\" onClick=\"javascript:ToggleLayer('{0}', this.checked);\"{1}>{0}", ReferenceName(current.GetDisplayName()), arg); arg = ""; string arg3 = string.Format( "<a href=\"javascript:crunchedLayerManager.layerList.find('{0}').SetDefaultView(map);\"><font size=\"-1\">center here</font></a>", ReferenceName(current.GetDisplayName())); text += string.Format("{0} {1} |", arg2, arg3); } textWriter.Write(SampleHTMLWriterConstants.Body(showDefaultLayerName, text, CrunchedFile.CrunchedFilename)); textWriter.Close(); }
public static void WriteKey(Mashup mashup, RenderOutputMethod renderOutput, string fileName) { TextWriter textWriter = new StreamWriter(renderOutput.CreateFile(fileName, "text/html")); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(mashup.GetFilename()); textWriter.WriteLine("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); textWriter.WriteLine(string.Format("<html><head><title>{0}</title></head>", fileNameWithoutExtension)); textWriter.WriteLine(string.Format("<body><h1>{0}</h1>", fileNameWithoutExtension)); foreach (Layer current in mashup.layerList) { textWriter.WriteLine(string.Format("<p><h2><a name=\"{0}\">{1}</a></h2>", SampleHTMLWriter.ReferenceName(current.displayName), current.displayName)); foreach (SourceMap current2 in current) { textWriter.WriteLine(string.Format("<p><h3>{0}</h3>", current2.displayName)); if (current2.sourceMapInfo.mapHomePage != "") { textWriter.WriteLine(string.Format("<a href=\"{0}\">Home page</a>", current2.sourceMapInfo.mapHomePage)); } if (current2.sourceMapInfo.mapFileURL != "") { textWriter.WriteLine(string.Format(" <a href=\"{0}\">Map URL</a>", current2.sourceMapInfo.mapFileURL)); } textWriter.WriteLine(string.Format("<br>{0}", current2.sourceMapInfo.mapDescription)); } textWriter.WriteLine("<hr>"); } textWriter.WriteLine("</body></html>"); textWriter.Close(); }
public static void WriteKey(Mashup mashup, RenderOutputMethod renderOutput, string fileName) { TextWriter textWriter = new StreamWriter(renderOutput.CreateFile(fileName, "text/html")); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(mashup.GetFilename()); textWriter.WriteLine("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); textWriter.WriteLine(string.Format("<html><head><title>{0}</title></head>", fileNameWithoutExtension)); textWriter.WriteLine(string.Format("<body><h1>{0}</h1>", fileNameWithoutExtension)); foreach (Layer current in mashup.layerList) { textWriter.WriteLine(string.Format("<p><h2><a name=\"{0}\">{1}</a></h2>", SampleHTMLWriter.ReferenceName(current.displayName), current.displayName)); foreach (SourceMap current2 in current) { textWriter.WriteLine(string.Format("<p><h3>{0}</h3>", current2.displayName)); if (current2.sourceMapInfo.mapHomePage != "") { textWriter.WriteLine(string.Format("<a href=\"{0}\">Home page</a>", current2.sourceMapInfo.mapHomePage)); } if (current2.sourceMapInfo.mapFileURL != "") { textWriter.WriteLine(string.Format(" <a href=\"{0}\">Map URL</a>", current2.sourceMapInfo.mapFileURL)); } textWriter.WriteLine(string.Format("<br>{0}", current2.sourceMapInfo.mapDescription)); } textWriter.WriteLine("<hr>"); } textWriter.WriteLine("</body></html>"); textWriter.Close(); }
public static void SaveImage(ImageRef imageRef, RenderOutputMethod renderOutput, string relativeDestPath, ImageFormat imageFormat) { Stream stream = renderOutput.CreateFile(relativeDestPath, ImageTypeMapper.ByImageFormat(imageFormat).mimeType); using (stream) { imageRef.image.Save(stream, imageFormat); stream.Close(); } }
public static void SaveImage(ImageRef imageRef, RenderOutputMethod renderOutput, string relativeDestPath, ImageFormat imageFormat) { Stream stream = renderOutput.CreateFile(relativeDestPath, ImageTypeMapper.ByImageFormat(imageFormat).mimeType); using (stream) { imageRef.image.Save(stream, imageFormat); stream.Close(); } }
public void Write() { XmlTextWriter xmlTextWriter = new XmlTextWriter(renderOutputMethod.CreateFile("LayerMetadata.xml", "text/xml"), Encoding.UTF8); using (xmlTextWriter) { xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(true); WriteXML(xmlTextWriter); xmlTextWriter.Close(); } }
public void WriteXML() { Stream w = renderOutput.CreateFile(GetRelativeFilename(), "text/xml"); XmlTextWriter xmlTextWriter = new XmlTextWriter(w, Encoding.UTF8); using (xmlTextWriter) { xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(true); WriteXML(xmlTextWriter); xmlTextWriter.Close(); } }
private static void WriteMain(Mashup mashup, RenderOutputMethod renderOutput, string fileName) { TextWriter textWriter = new StreamWriter(renderOutput.CreateFile(fileName, "text/html")); string showDefaultLayerName = SampleHTMLWriter.ReferenceName(mashup.layerList.First.GetDisplayName()); string text = ""; string arg = " checked"; foreach (Layer current in mashup.layerList) { string arg2 = string.Format("<input type=\"checkbox\" id=\"checkbox:{0}\" onClick=\"javascript:ToggleLayer('{0}', this.checked);\"{1}>{0}", SampleHTMLWriter.ReferenceName(current.GetDisplayName()), arg); arg = ""; string arg3 = string.Format("<a href=\"javascript:crunchedLayerManager.layerList.find('{0}').SetDefaultView(map);\"><font size=\"-1\">center here</font></a>", SampleHTMLWriter.ReferenceName(current.GetDisplayName())); text += string.Format("{0} {1} |", arg2, arg3); } textWriter.Write(SampleHTMLWriterConstants.Body(showDefaultLayerName, text, CrunchedFile.CrunchedFilename)); textWriter.Close(); }
public static void CopyFile(string sourcePath, RenderOutputMethod renderOutput, string relativeDestPath, string mimeType) { FileIdentification fileIdentificationStatic = FileOutputMethod.GetFileIdentificationStatic(sourcePath); FileIdentification fileIdentification = renderOutput.GetFileIdentification(relativeDestPath); if (fileIdentificationStatic.CompareTo(fileIdentification) == 0) { return; } Stream stream = new FileStream(sourcePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); Stream stream2 = renderOutput.CreateFile(relativeDestPath, mimeType); byte[] buffer = new byte[65536]; while (true) { int num = stream.Read(buffer, 0, 65536); if (num == 0) { break; } stream2.Write(buffer, 0, num); } stream.Close(); stream2.Close(); }
public Stream CreateFile(string relativePath, string contentType) { Stream baseStream = baseMethod.CreateFile(relativePath, contentType); return(new CreateCompleteClosure(baseStream, this, GetPath(relativePath))); }