MessageBox.Show(string.Format("フォルダーパス\"{0}\"は存在しませんでした。", folderPath), "キャッシュフォルダー", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
+ \r
+ void CacheFolderClearLinkLabelLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)\r
+ {\r
+ string folderPath;\r
+ \r
+ if (cacheFolderCustomCheckBox.Checked) {\r
+ folderPath = cacheFolderTextBox.Text;\r
+ } else {\r
+ // デフォルトは AppDataFolderPath/Cache。\r
+ folderPath = System.IO.Path.Combine(NaGet.Env.AppDataFolderPath, "Cache");\r
+ }\r
+ \r
+ if (System.IO.Directory.Exists(folderPath)) {\r
+ DialogResult result = MessageBox.Show(string.Format("フォルダーパス\"{0}\"のファイルを削除して構いませんか?", folderPath), "キャッシュフォルダー", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);\r
+ if (result == DialogResult.OK) {\r
+ foreach (string targetDir in System.IO.Directory.GetDirectories(folderPath)) {\r
+ try {\r
+ NaGet.Utils.SetAttributeRecursive(targetDir, System.IO.FileAttributes.Normal);\r
+ System.IO.Directory.Delete(targetDir, true);\r
+ } catch {\r
+ // 何もせずに静かに先に進む\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ MessageBox.Show(string.Format("フォルダーパス\"{0}\"は存在しませんでした。", folderPath), "キャッシュフォルダー", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ }\r
+ }\r
}\r
}\r