Exemplo n.º 1
0
 public static bool TryParse(byte[] metadata, out Nuspec nuspec)
 {
     nuspec = null;
     if (metadata == null)
     {
         return(false);
     }
     using (var inputStream = new MemoryStream(metadata))
         return(TryParse(inputStream, out nuspec));
 }
Exemplo n.º 2
0
 public static bool TryParse(Stream stream, out Nuspec nuspec)
 {
     nuspec = null;
     if (stream == null)
     {
         return(false);
     }
     try
     {
         using (var xmlReader = new XmlTextReader(stream))
         {
             //annoying diff xmlns
             xmlReader.Namespaces = false;
             nuspec = (Nuspec)NuspecSerializer.Deserialize(xmlReader);
             return(true);
         }
     }
     catch
     {
     }
     return(false);
 }