Beispiel #1
0
        public static LayerMetadataFile Read(RenderOutputMethod outputMethod)
        {
            LayerMetadataFile  layerMetadataFile  = null;
            Stream             input              = outputMethod.ReadFile("LayerMetadata.xml");
            XmlTextReader      reader             = new XmlTextReader(input);
            MashupParseContext mashupParseContext = new MashupParseContext(reader);

            using (mashupParseContext)
            {
                while (mashupParseContext.reader.Read())
                {
                    if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                        mashupParseContext.reader.Name == LayerMetadataTag)
                    {
                        layerMetadataFile = new LayerMetadataFile(outputMethod, mashupParseContext);
                        break;
                    }
                }

                mashupParseContext.Dispose();
            }

            if (layerMetadataFile == null)
            {
                throw new InvalidMashupFile(mashupParseContext,
                                            string.Format("{0} doesn't appear to be a valid {1}",
                                                          outputMethod.GetUri("LayerMetadata.xml"),
                                                          LayerMetadataTag));
            }

            return(layerMetadataFile);
        }
Beispiel #2
0
 public static Uri Write(Mashup mashup, SampleHTMLWriter.PostMessageDelegate postMessage, RenderOutputMethod renderOutput)
 {
     string arg = "";
     try
     {
         SampleHTMLWriter.WriteMain(mashup, renderOutput, SampleHTMLWriter.SampleHTMLFilename);
         SampleHTMLWriter.WriteKey(mashup, renderOutput, SampleHTMLWriter.SampleKeyFilename);
         return renderOutput.GetUri(SampleHTMLWriter.SampleHTMLFilename);
     }
     catch (Exception ex)
     {
         postMessage(string.Format("Couldn't write {0}: {1}", arg, ex.ToString()));
     }
     return null;
 }
Beispiel #3
0
        public static Uri Write(Mashup mashup, SampleHTMLWriter.PostMessageDelegate postMessage, RenderOutputMethod renderOutput)
        {
            string arg = "";

            try
            {
                SampleHTMLWriter.WriteMain(mashup, renderOutput, SampleHTMLWriter.SampleHTMLFilename);
                SampleHTMLWriter.WriteKey(mashup, renderOutput, SampleHTMLWriter.SampleKeyFilename);
                return(renderOutput.GetUri(SampleHTMLWriter.SampleHTMLFilename));
            }
            catch (Exception ex)
            {
                postMessage(string.Format("Couldn't write {0}: {1}", arg, ex.ToString()));
            }
            return(null);
        }
		public static LayerMetadataFile Read(RenderOutputMethod outputMethod)
		{
			LayerMetadataFile layerMetadataFile = null;
			Stream input = outputMethod.ReadFile("LayerMetadata.xml");
			XmlTextReader reader = new XmlTextReader(input);
			MashupParseContext mashupParseContext = new MashupParseContext(reader);
			using (mashupParseContext)
			{
				while (mashupParseContext.reader.Read())
				{
					if (mashupParseContext.reader.NodeType == XmlNodeType.Element && mashupParseContext.reader.Name == LayerMetadataFile.LayerMetadataTag)
					{
						layerMetadataFile = new LayerMetadataFile(outputMethod, mashupParseContext);
						break;
					}
				}
				mashupParseContext.Dispose();
			}
			if (layerMetadataFile == null)
			{
				throw new InvalidMashupFile(mashupParseContext, string.Format("{0} doesn't appear to be a valid {1}", outputMethod.GetUri("LayerMetadata.xml"), LayerMetadataFile.LayerMetadataTag));
			}
			return layerMetadataFile;
		}
 public Uri GetUri(string relativePath)
 {
     return(baseMethod.GetUri(relativePath));
 }