示例#1
0
 public static IBitmap DownloadImage(XmlNode output, IWebProxy proxy)
 {
     if (output.Attributes["file"] != null)
     {
         try
         {
             FileInfo fi = new FileInfo(output.Attributes["file"].Value);
             if (fi.Exists)
             {
                 return(Current.Engine.CreateBitmap(fi.FullName));
             }
         }
         catch (Exception ex) { LastErrorMessage = ex.Message; throw ex; }
     }
     if (output.Attributes["url"] != null)
     {
         return(DownloadImage(
                    output.Attributes["url"].Value,
                    proxy,
                    WebCredentials.FromXmlNode(output.SelectSingleNode("credentials"))));
     }
     return(null);
 }
示例#2
0
 public static Bitmap DownloadImage(XmlNode output)
 {
     if (output.Attributes["file"] != null)
     {
         try
         {
             FileInfo fi = new FileInfo(output.Attributes["file"].Value);
             if (fi.Exists)
             {
                 return((Bitmap)Image.FromFile(fi.FullName));
             }
         }
         catch (Exception ex) { LastErrorMessage = ex.Message; throw ex; }
     }
     if (output.Attributes["url"] != null)
     {
         return(DownloadImage(
                    output.Attributes["url"].Value,
                    ProxySettings.Proxy(output.Attributes["url"].Value),
                    WebCredentials.FromXmlNode(output.SelectSingleNode("credentials"))));
     }
     return(null);
 }