public void WriteXml(XmlWriter w) { try { foreach (CacheEntry e in this.GetSchemas()) { string path = pfn.GetPersistentFileName(e.Location); if (path != null) { w.WriteStartElement("Schema"); string uri = e.TargetNamespace; if (uri == null) { uri = ""; } w.WriteAttributeString("nsuri", uri); if (e.Disabled) { w.WriteAttributeString("disabled", "true"); } w.WriteString(path); w.WriteEndElement(); } } } catch (Exception x) { Console.WriteLine(x.Message); } }
string ConvertToString(object value) { if (value is Uri) { return(pfn.GetPersistentFileName((Uri)value)); } else if (value is string) { return((string)value); } else { TypeConverter tc = TypeDescriptor.GetConverter(value.GetType()); if (tc != null) { string s = tc.ConvertToString(value); return(s); } throw new ApplicationException(string.Format(SR.TypeConvertError, value.GetType().FullName)); } }