1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-12 06:15:45 +02:00

Ignore cached files for updates and viewed images if their contents are empty

This commit is contained in:
chylex 2018-08-23 20:08:34 +02:00
parent bb22c35221
commit 7a976edc82
3 changed files with 11 additions and 3 deletions

View File

@ -83,8 +83,8 @@ void ViewImageInternal(string path){
}
string file = Path.Combine(BrowserCache.CacheFolder, GetImageFileName(url) ?? Path.GetRandomFileName());
if (File.Exists(file)){
if (WindowsUtils.FileExistsAndNotEmpty(file)){
ViewImageInternal(file);
}
else{

View File

@ -66,6 +66,14 @@ public static bool CheckFolderWritePermission(string path){
}
}
public static bool FileExistsAndNotEmpty(string path){
try{
return new FileInfo(path).Length > 0;
}catch{
return false;
}
}
public static bool OpenAssociatedProgram(string file, string arguments = "", bool runElevated = false){
try{
using(Process.Start(new ProcessStartInfo{

View File

@ -26,7 +26,7 @@ public UpdateInfo(string versionTag, string releaseNotes, string downloadUrl, st
}
public void BeginSilentDownload(){
if (File.Exists(InstallerPath)){
if (WindowsUtils.FileExistsAndNotEmpty(InstallerPath)){
DownloadStatus = UpdateDownloadStatus.Done;
return;
}