PutioFS.Windows.WinMounter.PurgeCache C# (CSharp) Méthode

PurgeCache() public méthode

public PurgeCache ( object Sender, EventArgs e ) : void
Sender object
e System.EventArgs
Résultat void
        public void PurgeCache(object Sender, EventArgs e)
        {
            if (MessageBox.Show("Do you really want to purge the cached data?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                bool problem = false;
                foreach (DirectoryInfo di in new DirectoryInfo(Constants.LocalStoragePath).GetDirectories())
                {
                    foreach (FileInfo fi in di.GetFiles("*.pcd"))
                    {
                        try
                        {
                            fi.Delete();
                        }
                        catch (Exception)
                        {
                            problem = true;
                        }
                    }

                    foreach (FileInfo fi in di.GetFiles("*.pci"))
                    {
                        try
                        {
                            fi.Delete();
                        }
                        catch (Exception)
                        {
                            problem = true;
                        }
                    }
                }
                RefreshCacheSize();
                if (problem)
                    MessageBox.Show("Unable to delete some of the files. Please restart the Put.io virtual drive and try again.");
                else
                    MessageBox.Show("Cache is empty.");
            }
        }