public static bool EraseOldProfileImageFromLocalData(string profileImgFileId) { string path = FileResources.ProfileImgFolderPath + profileImgFileId; string error = FileResources.EraseFile(path); return(error == null); }
public static bool SaveProfileImageToLocal(Image profileImg, string fileKey) { try { string path = FileResources.ProfileImgFolderPath + fileKey; FileResources.EraseFile(path); using (FileStream imgStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { profileImg.Save(imgStream, ImageFormat.Png); imgStream.Close(); profileImg.Dispose(); } return(true); } catch (Exception e) { Console.WriteLine("Saving profile image to folder failed due to: " + e.Message); return(false); } }
public static bool SaveNuntiasContentToLocal(MemoryStream sourceMemoryStream, string fileName) { try { string path = FileResources.NuntiasContentFolderPath + fileName; FileResources.EraseFile(path); using (FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) { sourceMemoryStream.Position = 0; sourceMemoryStream.CopyTo(fileStream); fileStream.Close(); } return(true); } catch (Exception e) { Console.WriteLine("Exception in SaveNuntiasContentToLocal() => : " + e.Message); return(false); } }
public static string EraseCurrentLoginCookie() { return(FileResources.EraseFile(LoginCookiePath)); }