Example #1
0
 private void WS_GetPreviewImageCompleted(object sender, GetPreviewImageCompletedEventArgs e)
 {
     try
     {
         byte[] result = e.Result;
         if ((result != null) && (result.Length > 0))
         {
             using (MemoryStream stream = new MemoryStream(result))
             {
                 this.mPreviewImage50 = null;
                 this.mPreviewImage128 = Image.FromStream(stream);
             }
             if (PreviewImageLoaded != null)
             {
                 PreviewImageLoaded(this, EventArgs.Empty);
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
Example #2
0
 private void WS_GetPreviewImageCompleted(object sender, GetPreviewImageCompletedEventArgs e)
 {
     try
     {
         byte[] result = e.Result;
         if ((result != null) && (result.Length > 0))
         {
             using (MemoryStream stream = new MemoryStream(result))
             {
                 this.mPreviewImage50 = Image.FromStream(stream);
             }
             if (PreviewImageLoaded != null)
             {
                 PreviewImageLoaded(this, EventArgs.Empty);
             }
             if (Program.Settings.Content.Download.CachePreviewImages)
             {
                 string path = string.Format(@"{0}\vault preview images\mods\{1}.png", AppDomain.CurrentDomain.BaseDirectory, base.ID);
                 if (!Directory.Exists(Path.GetDirectoryName(path)))
                 {
                     Directory.CreateDirectory(Path.GetDirectoryName(path));
                 }
                 this.mPreviewImage50.Save(path, ImageFormat.Png);
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }