Example #1
0
 static public UserDefinedTagCollection FromString(string text)
 {
     try
     {
         var ser = new XmlSerializer(typeof(UserDefinedTagCollection));
         var sr  = new StringReader(text);
         var res = ser.Deserialize(sr) as UserDefinedTagCollection;
         return(res);
     }
     catch (Exception exp)
     {
         Traces.ConvertersTraceEvent(TraceEventType.Critical, 1, "Error while deserializing UserDefinedTagCollection: {0}\r\n{1}", text, NNTPServer.Traces.ExceptionToString(exp));
     }
     return(null);
 }
Example #2
0
 public string GetString()
 {
     try
     {
         var ser = new XmlSerializer(typeof(UserDefinedTagCollection));
         var sw  = new StringWriter();
         ser.Serialize(sw, this);
         // Remove linbreaks, so this string will be stored as a single line in the registry...
         return(sw.ToString().Replace("\n", string.Empty).Replace("\r", string.Empty));
     }
     catch (Exception exp)
     {
         Traces.ConvertersTraceEvent(TraceEventType.Critical, 1, "Error while serializing UserDefinedTagCollection: {0}", NNTPServer.Traces.ExceptionToString(exp));
     }
     return(string.Empty);
 }