//private string podPicOnePath = ""; //internal string PodPicPath = ""; public PodModel() { PodUtil.GenerateBuild(); DefaultPortalUrl = @"http://photography.nationalgeographic.com/photography/photo-of-the-day/"; string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string podFolder = docFolder + @"\OnePOD"; PodUtil.CreateDirIfNotAvailable(podFolder); podTempFolder = podFolder + @"\temp"; PodUtil.CreateDirIfNotAvailable(podTempFolder); podPagePath = podTempFolder + @"\current.pod"; acquireInfoFromLocalPage(); //podPicOnePath = podTempFolder + @"\one.png"; //PodUtil.CreateEmptyFileIfNotAvailable(podPicOnePath); //PodUtil.DownloadPicIfNotAvailable(PodPicOnePath); //PodPicPath = Properties.Settings.Default.LastPodPicPath; // clean temp folder DirectoryInfo tempDir = new DirectoryInfo(podTempFolder); List <FileInfo> filesToBeDeleted = new List <FileInfo>(); foreach (FileInfo f in tempDir.EnumerateFiles()) { //if (f.FullName == PodPicPath) // continue; string s = Path.GetFileNameWithoutExtension(f.FullName); try { Guid guid = new Guid(s); // if conversion is successful, then delete the temp file filesToBeDeleted.Add(f); } catch (Exception e) { // if conversion is NOT successful, then do nothing } } foreach (FileInfo f in filesToBeDeleted) { f.Delete(); } }