public static void DeletePhoto(int contactID) { if (contactID == 0) { throw new ArgumentException(); } lock (_synchronizedObj) { ResizeQueue.GetItems().Where(item => item.ContactID == contactID) .All(item => { ResizeQueue.Remove(item); return(true); }); var photoDirectory = BuildFileDirectory(contactID); if (Global.GetStore().IsDirectory(photoDirectory)) { Global.GetStore().DeleteFiles(photoDirectory, "*", true); } RemoveFromCache(contactID); } }
public static void DeletePhoto(int contactID, bool isTmpDir, string tmpDirName, bool recursive) { if (contactID == 0) { throw new ArgumentException(); } lock (_synchronizedObj) { ResizeQueue.GetItems().Where(item => item.ContactID == contactID) .All(item => { ResizeQueue.Remove(item); return(true); }); var photoDirectory = !isTmpDir ? BuildFileDirectory(contactID) : (String.IsNullOrEmpty(tmpDirName) ? BuildFileTmpDirectory(contactID) : BuildFileTmpDirectory(tmpDirName)); var store = Global.GetStore(); if (store.IsDirectory(photoDirectory)) { store.DeleteFiles(photoDirectory, "*", recursive); if (recursive) { store.DeleteDirectory(photoDirectory); } } if (!isTmpDir) { RemoveFromCache(contactID); } } }