private void Form1_FormClosed(object sender, FormClosedEventArgs e) { try { DownloadsDir.EnumerateFiles().ForEach(o => o.Delete()); DownloadsDir.EnumerateDirectories().ForEach(o => o.Delete()); } catch (IOException ex) { Log(ex.Message); } }
public Form1() { //AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; //DEBUG InitializeComponent(); listView1.LargeImageList = CoverArts; listView1.SmallImageList = CoverArts; var Update = CanUpdate(); IsLatestVersion = !Update.Item1; if (Update.Item1) { MessageBox.Show($"Version [{Update.Item2}] is available at http://Github.com/{GitHubLink}"); } AppDir.Create(); if (AppDir.GetDirectories().Any(o => o.Name == "Downloads")) { DownloadsDir = AppDir.GetDirectories().First(o => o.Name == "Downloads"); DownloadsDir.EnumerateFiles().ForEach(o => o.Delete()); DownloadsDir.EnumerateDirectories().ForEach(o => o.Delete()); } else { DownloadsDir = AppDir.CreateSubdirectory("Downloads"); } WorkerThread = new Thread(o => { GetObjects(); WorkerThread.Join(); }) { IsBackground = true }; OnDeserialize += onDeserialize; WorkerThread.Start(); }