Example #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);
        }
		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;
		}
Example #3
0
 public Stream ReadFile(string relativePath)
 {
     return(baseMethod.ReadFile(relativePath));
 }