示例#1
0
 public void GetImage(WebData webData, long imageID, bool thumb = false)
 {
     try
     {
         MDBImage img  = mdb.Images.TryGetStruct(imageID);
         MDBFile  file = mdb.Files.TryGetStruct(img.FileID);
         if (file.ID > 0)
         {
             string fullPath = file.GetFullPath(mdb);
             if (thumb)
             {
                 if (TryGetThumb(webData, img, fullPath))
                 {
                     return;
                 }
             }
             webData.Answer = WebAnswer.Raw(webData.Request, WebMessage.Create(fullPath, "/mdb/image/get"), File.ReadAllBytes(fullPath), img.MimeType);
             webData.Answer.AllowCompression = false;
             webData.Answer.SetCacheTime(TimeSpan.FromHours(1));
             return;
         }
     }
     catch { }
     webData.Result.AddMessage(webData.Method, WebError.NotFound, "Image {0} cannot be found!", imageID);
 }