Beispiel #1
0
 public static RebelImageToTransfer ImageToTransferById(int id)
 {
     Images.CreateImageCache();
     if (imgCache == null)
     {
         imgCache = new Dictionary <int, RebelImageToTransfer>();
     }
     if (imgCache.ContainsKey(id))
     {
         return(imgCache[id]);
     }
     else
     {
         RebelImageToTransfer tImage;
         var img = Images.imgCache.GetImageById(id);
         try
         {
             tImage = new RebelImageToTransfer(ref img);
             imgCache.Add(tImage.Id, tImage);
         }
         catch
         {
             tImage = null;
         }
         return(tImage);
     }
 }
Beispiel #2
0
 public RebelImage(ref RebelImageToTransfer tImg)
 {
     this.Id        = tImg.Id;
     this.Partition = tImg.Partition;
     this.Name      = tImg.Name;
     using (var ms = new MemoryStream(tImg.img))
     {
         this.Img = Image.FromStream(ms);
     }
 }