[chronojump] Networks: player image is downloaded if file missing on client



commit a9f0c111ffabd27d0c155ba1c24c0fd58ee4d647
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 15 13:44:58 2021 +0200

    Networks: player image is downloaded if file missing on client

 src/gui/networks.cs | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index bf3112fe..ee9328fd 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -773,7 +773,9 @@ public partial class ChronoJumpWindow
                        LogB.Information("RFID person exists locally!!");
 
                        //if image changed, download it
-                       if(pServer.UniqueID != -1 && pServer.LinkServerImage != pLocal.LinkServerImage)
+                       if( pServer.UniqueID != -1 &&
+                                       (pServer.LinkServerImage != pLocal.LinkServerImage ||
+                                       ! Util.FileExists(compujumpDownloadImageGetDest 
(pServer.LinkServerImage, pServer.UniqueID))) )
                                compujumpDownloadImage (json, pServer.LinkServerImage, pServer.UniqueID);
 
                        if(rfidIsDifferent || dialogPersonPopup == null || ! dialogPersonPopup.Visible)
@@ -867,9 +869,7 @@ public partial class ChronoJumpWindow
                if(url == null || url == "")
                        return;
 
-               string image_dest = Util.GetPhotoFileName(false, personID);
-               if(UtilMultimedia.GetImageType(url) == UtilMultimedia.ImageTypes.PNG)
-                       image_dest = Util.GetPhotoPngFileName(false, personID);
+               string image_dest = compujumpDownloadImageGetDest (url, personID);
 
                if(json.DownloadImage(url, personID))
                        File.Copy(
@@ -877,6 +877,15 @@ public partial class ChronoJumpWindow
                                        image_dest,
                                        true); //overwrite
        }
+       //get destination file of the image: multimedia/photos/uniqueID. (jpg or png)
+       private string compujumpDownloadImageGetDest (string linkServerImage, int personID)
+       {
+               string image_dest = Util.GetPhotoFileName(false, personID);
+               if(UtilMultimedia.GetImageType(linkServerImage) == UtilMultimedia.ImageTypes.PNG)
+                       image_dest = Util.GetPhotoPngFileName(false, personID);
+
+               return image_dest;
+       }
 
        //load current session if MONTHLY and current session is not current month and currentPerson is not 
compumpAdminID
        private void compujumpPersonChangedShouldChangeSession()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]