예제 #1
0
 public static bool RefetchProfileImage(string profileImageId)
 {
     try
     {
         if (!LocalDataFileAccess.ProfileImgExistsInLocalData(profileImageId))
         {
             if (profileImageId == null || profileImageId.Length == 0)
             {
                 return(false);
             }
             string fileLink = "http://" + ConfigurationManager.AppSettings["serverIp"] + ":" + ConfigurationManager.AppSettings["xamppPort"] + "/ProfileImages/" + profileImageId;
             Console.WriteLine("ServerFileRequest.cs line 85: " + fileLink);
             string targetLocalPath = FileResources.ProfileImgFolderPath + profileImageId;
             using (WebClient webClient = new WebClient())
             {
                 webClient.DownloadFile(fileLink, targetLocalPath);
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine("ServerFileRequest:RefetchProfileImage() => Exception: " + ex.Message);
         return(false);
     }
 }
 public bool SetProfileImage(string profileImageId)
 {
     if (LocalDataFileAccess.ProfileImgExistsInLocalData(profileImageId))
     {
         this.profileImageId = profileImageId;
         this.profileImage   = LocalDataFileAccess.GetProfileImgFromLocalData(this.profileImageId);
         return(true);
     }
     return(false);
 }