GameTableContextMenu.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. using Gtk;
  2. using LibHac;
  3. using LibHac.Account;
  4. using LibHac.Common;
  5. using LibHac.Fs;
  6. using LibHac.Fs.Fsa;
  7. using LibHac.Fs.Shim;
  8. using LibHac.FsSystem;
  9. using LibHac.FsSystem.NcaUtils;
  10. using LibHac.Ncm;
  11. using LibHac.Ns;
  12. using Ryujinx.Common.Configuration;
  13. using Ryujinx.Common.Logging;
  14. using Ryujinx.HLE.FileSystem;
  15. using Ryujinx.HLE.HOS;
  16. using Ryujinx.HLE.HOS.Services.Account.Acc;
  17. using Ryujinx.Ui.Helper;
  18. using Ryujinx.Ui.Windows;
  19. using System;
  20. using System.Buffers;
  21. using System.Collections.Generic;
  22. using System.Globalization;
  23. using System.IO;
  24. using System.Reflection;
  25. using System.Threading;
  26. using static LibHac.Fs.ApplicationSaveDataManagement;
  27. namespace Ryujinx.Ui.Widgets
  28. {
  29. public partial class GameTableContextMenu : Menu
  30. {
  31. private readonly MainWindow _parent;
  32. private readonly VirtualFileSystem _virtualFileSystem;
  33. private readonly AccountManager _accountManager;
  34. private readonly BlitStruct<ApplicationControlProperty> _controlData;
  35. private readonly string _titleFilePath;
  36. private readonly string _titleName;
  37. private readonly string _titleIdText;
  38. private readonly ulong _titleId;
  39. private MessageDialog _dialog;
  40. private bool _cancel;
  41. public GameTableContextMenu(MainWindow parent, VirtualFileSystem virtualFileSystem, AccountManager accountManager, string titleFilePath, string titleName, string titleId, BlitStruct<ApplicationControlProperty> controlData)
  42. {
  43. _parent = parent;
  44. InitializeComponent();
  45. _virtualFileSystem = virtualFileSystem;
  46. _accountManager = accountManager;
  47. _titleFilePath = titleFilePath;
  48. _titleName = titleName;
  49. _titleIdText = titleId;
  50. _controlData = controlData;
  51. if (!ulong.TryParse(_titleIdText, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out _titleId))
  52. {
  53. GtkDialog.CreateErrorDialog("The selected game did not have a valid Title Id");
  54. return;
  55. }
  56. _openSaveUserDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.UserAccountSaveDataSize > 0;
  57. _openSaveDeviceDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.DeviceSaveDataSize > 0;
  58. _openSaveBcatDirMenuItem.Sensitive = !Utilities.IsEmpty(controlData.ByteSpan) && controlData.Value.BcatDeliveryCacheStorageSize > 0;
  59. string fileExt = System.IO.Path.GetExtension(_titleFilePath).ToLower();
  60. bool hasNca = fileExt == ".nca" || fileExt == ".nsp" || fileExt == ".pfs0" || fileExt == ".xci";
  61. _extractRomFsMenuItem.Sensitive = hasNca;
  62. _extractExeFsMenuItem.Sensitive = hasNca;
  63. _extractLogoMenuItem.Sensitive = hasNca;
  64. PopupAtPointer(null);
  65. }
  66. private bool TryFindSaveData(string titleName, ulong titleId, BlitStruct<ApplicationControlProperty> controlHolder, SaveDataFilter filter, out ulong saveDataId)
  67. {
  68. saveDataId = default;
  69. Result result = _virtualFileSystem.FsClient.FindSaveDataWithFilter(out SaveDataInfo saveDataInfo, SaveDataSpaceId.User, ref filter);
  70. if (ResultFs.TargetNotFound.Includes(result))
  71. {
  72. // Savedata was not found. Ask the user if they want to create it
  73. using MessageDialog messageDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, null)
  74. {
  75. Title = "Ryujinx",
  76. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  77. Text = $"There is no savedata for {titleName} [{titleId:x16}]",
  78. SecondaryText = "Would you like to create savedata for this game?",
  79. WindowPosition = WindowPosition.Center
  80. };
  81. if (messageDialog.Run() != (int)ResponseType.Yes)
  82. {
  83. return false;
  84. }
  85. ref ApplicationControlProperty control = ref controlHolder.Value;
  86. if (Utilities.IsEmpty(controlHolder.ByteSpan))
  87. {
  88. // If the current application doesn't have a loaded control property, create a dummy one
  89. // and set the savedata sizes so a user savedata will be created.
  90. control = ref new BlitStruct<ApplicationControlProperty>(1).Value;
  91. // The set sizes don't actually matter as long as they're non-zero because we use directory savedata.
  92. control.UserAccountSaveDataSize = 0x4000;
  93. control.UserAccountSaveDataJournalSize = 0x4000;
  94. Logger.Warning?.Print(LogClass.Application, "No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
  95. }
  96. Uid user = new Uid((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low);
  97. result = EnsureApplicationSaveData(_virtualFileSystem.FsClient, out _, new LibHac.Ncm.ApplicationId(titleId), ref control, ref user);
  98. if (result.IsFailure())
  99. {
  100. GtkDialog.CreateErrorDialog($"There was an error creating the specified savedata: {result.ToStringWithName()}");
  101. return false;
  102. }
  103. // Try to find the savedata again after creating it
  104. result = _virtualFileSystem.FsClient.FindSaveDataWithFilter(out saveDataInfo, SaveDataSpaceId.User, ref filter);
  105. }
  106. if (result.IsSuccess())
  107. {
  108. saveDataId = saveDataInfo.SaveDataId;
  109. return true;
  110. }
  111. GtkDialog.CreateErrorDialog($"There was an error finding the specified savedata: {result.ToStringWithName()}");
  112. return false;
  113. }
  114. private void OpenSaveDir(SaveDataFilter saveDataFilter)
  115. {
  116. saveDataFilter.SetProgramId(new ProgramId(_titleId));
  117. if (!TryFindSaveData(_titleName, _titleId, _controlData, saveDataFilter, out ulong saveDataId))
  118. {
  119. return;
  120. }
  121. string saveRootPath = System.IO.Path.Combine(_virtualFileSystem.GetNandPath(), $"user/save/{saveDataId:x16}");
  122. if (!Directory.Exists(saveRootPath))
  123. {
  124. // Inconsistent state. Create the directory
  125. Directory.CreateDirectory(saveRootPath);
  126. }
  127. string committedPath = System.IO.Path.Combine(saveRootPath, "0");
  128. string workingPath = System.IO.Path.Combine(saveRootPath, "1");
  129. // If the committed directory exists, that path will be loaded the next time the savedata is mounted
  130. if (Directory.Exists(committedPath))
  131. {
  132. OpenHelper.OpenFolder(committedPath);
  133. }
  134. else
  135. {
  136. // If the working directory exists and the committed directory doesn't,
  137. // the working directory will be loaded the next time the savedata is mounted
  138. if (!Directory.Exists(workingPath))
  139. {
  140. Directory.CreateDirectory(workingPath);
  141. }
  142. OpenHelper.OpenFolder(workingPath);
  143. }
  144. }
  145. private void ExtractSection(NcaSectionType ncaSectionType, int programIndex = 0)
  146. {
  147. FileChooserDialog fileChooser = new FileChooserDialog("Choose the folder to extract into", null, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Extract", ResponseType.Accept);
  148. fileChooser.SetPosition(WindowPosition.Center);
  149. ResponseType response = (ResponseType)fileChooser.Run();
  150. string destination = fileChooser.Filename;
  151. fileChooser.Dispose();
  152. if (response == ResponseType.Accept)
  153. {
  154. Thread extractorThread = new Thread(() =>
  155. {
  156. Gtk.Application.Invoke(delegate
  157. {
  158. _dialog = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Cancel, null)
  159. {
  160. Title = "Ryujinx - NCA Section Extractor",
  161. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  162. SecondaryText = $"Extracting {ncaSectionType} section from {System.IO.Path.GetFileName(_titleFilePath)}...",
  163. WindowPosition = WindowPosition.Center
  164. };
  165. int dialogResponse = _dialog.Run();
  166. if (dialogResponse == (int)ResponseType.Cancel || dialogResponse == (int)ResponseType.DeleteEvent)
  167. {
  168. _cancel = true;
  169. _dialog.Dispose();
  170. }
  171. });
  172. using (FileStream file = new FileStream(_titleFilePath, FileMode.Open, FileAccess.Read))
  173. {
  174. Nca mainNca = null;
  175. Nca patchNca = null;
  176. if ((System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".nsp") ||
  177. (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".pfs0") ||
  178. (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".xci"))
  179. {
  180. PartitionFileSystem pfs;
  181. if (System.IO.Path.GetExtension(_titleFilePath) == ".xci")
  182. {
  183. Xci xci = new Xci(_virtualFileSystem.KeySet, file.AsStorage());
  184. pfs = xci.OpenPartition(XciPartitionType.Secure);
  185. }
  186. else
  187. {
  188. pfs = new PartitionFileSystem(file.AsStorage());
  189. }
  190. foreach (DirectoryEntryEx fileEntry in pfs.EnumerateEntries("/", "*.nca"))
  191. {
  192. pfs.OpenFile(out IFile ncaFile, fileEntry.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
  193. Nca nca = new Nca(_virtualFileSystem.KeySet, ncaFile.AsStorage());
  194. if (nca.Header.ContentType == NcaContentType.Program)
  195. {
  196. int dataIndex = Nca.GetSectionIndexFromType(NcaSectionType.Data, NcaContentType.Program);
  197. if (nca.Header.GetFsHeader(dataIndex).IsPatchSection())
  198. {
  199. patchNca = nca;
  200. }
  201. else
  202. {
  203. mainNca = nca;
  204. }
  205. }
  206. }
  207. }
  208. else if (System.IO.Path.GetExtension(_titleFilePath).ToLower() == ".nca")
  209. {
  210. mainNca = new Nca(_virtualFileSystem.KeySet, file.AsStorage());
  211. }
  212. if (mainNca == null)
  213. {
  214. Logger.Error?.Print(LogClass.Application, "Extraction failure. The main NCA is not present in the selected file.");
  215. Gtk.Application.Invoke(delegate
  216. {
  217. GtkDialog.CreateErrorDialog("Extraction failure. The main NCA is not present in the selected file.");
  218. });
  219. return;
  220. }
  221. (Nca updatePatchNca, _) = ApplicationLoader.GetGameUpdateData(_virtualFileSystem, mainNca.Header.TitleId.ToString("x16"), programIndex, out _);
  222. if (updatePatchNca != null)
  223. {
  224. patchNca = updatePatchNca;
  225. }
  226. int index = Nca.GetSectionIndexFromType(ncaSectionType, mainNca.Header.ContentType);
  227. IFileSystem ncaFileSystem = patchNca != null ? mainNca.OpenFileSystemWithPatch(patchNca, index, IntegrityCheckLevel.ErrorOnInvalid)
  228. : mainNca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid);
  229. FileSystemClient fsClient = _virtualFileSystem.FsClient;
  230. string source = DateTime.Now.ToFileTime().ToString()[10..];
  231. string output = DateTime.Now.ToFileTime().ToString()[10..];
  232. fsClient.Register(source.ToU8Span(), ncaFileSystem);
  233. fsClient.Register(output.ToU8Span(), new LocalFileSystem(destination));
  234. (Result? resultCode, bool canceled) = CopyDirectory(fsClient, $"{source}:/", $"{output}:/");
  235. if (!canceled)
  236. {
  237. if (resultCode.Value.IsFailure())
  238. {
  239. Logger.Error?.Print(LogClass.Application, $"LibHac returned error code: {resultCode.Value.ErrorCode}");
  240. Gtk.Application.Invoke(delegate
  241. {
  242. _dialog?.Dispose();
  243. GtkDialog.CreateErrorDialog("Extraction failed. Read the log file for further information.");
  244. });
  245. }
  246. else if (resultCode.Value.IsSuccess())
  247. {
  248. Gtk.Application.Invoke(delegate
  249. {
  250. _dialog?.Dispose();
  251. MessageDialog dialog = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, null)
  252. {
  253. Title = "Ryujinx - NCA Section Extractor",
  254. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"),
  255. SecondaryText = "Extraction completed successfully.",
  256. WindowPosition = WindowPosition.Center
  257. };
  258. dialog.Run();
  259. dialog.Dispose();
  260. });
  261. }
  262. }
  263. fsClient.Unmount(source.ToU8Span());
  264. fsClient.Unmount(output.ToU8Span());
  265. }
  266. });
  267. extractorThread.Name = "GUI.NcaSectionExtractorThread";
  268. extractorThread.IsBackground = true;
  269. extractorThread.Start();
  270. }
  271. }
  272. private (Result? result, bool canceled) CopyDirectory(FileSystemClient fs, string sourcePath, string destPath)
  273. {
  274. Result rc = fs.OpenDirectory(out DirectoryHandle sourceHandle, sourcePath.ToU8Span(), OpenDirectoryMode.All);
  275. if (rc.IsFailure()) return (rc, false);
  276. using (sourceHandle)
  277. {
  278. foreach (DirectoryEntryEx entry in fs.EnumerateEntries(sourcePath, "*", SearchOptions.Default))
  279. {
  280. if (_cancel)
  281. {
  282. return (null, true);
  283. }
  284. string subSrcPath = PathTools.Normalize(PathTools.Combine(sourcePath, entry.Name));
  285. string subDstPath = PathTools.Normalize(PathTools.Combine(destPath, entry.Name));
  286. if (entry.Type == DirectoryEntryType.Directory)
  287. {
  288. fs.EnsureDirectoryExists(subDstPath);
  289. (Result? result, bool canceled) = CopyDirectory(fs, subSrcPath, subDstPath);
  290. if (canceled || result.Value.IsFailure())
  291. {
  292. return (result, canceled);
  293. }
  294. }
  295. if (entry.Type == DirectoryEntryType.File)
  296. {
  297. fs.CreateOrOverwriteFile(subDstPath, entry.Size);
  298. rc = CopyFile(fs, subSrcPath, subDstPath);
  299. if (rc.IsFailure()) return (rc, false);
  300. }
  301. }
  302. }
  303. return (Result.Success, false);
  304. }
  305. public Result CopyFile(FileSystemClient fs, string sourcePath, string destPath)
  306. {
  307. Result rc = fs.OpenFile(out FileHandle sourceHandle, sourcePath.ToU8Span(), OpenMode.Read);
  308. if (rc.IsFailure()) return rc;
  309. using (sourceHandle)
  310. {
  311. rc = fs.OpenFile(out FileHandle destHandle, destPath.ToU8Span(), OpenMode.Write | OpenMode.AllowAppend);
  312. if (rc.IsFailure()) return rc;
  313. using (destHandle)
  314. {
  315. const int maxBufferSize = 1024 * 1024;
  316. rc = fs.GetFileSize(out long fileSize, sourceHandle);
  317. if (rc.IsFailure()) return rc;
  318. int bufferSize = (int)Math.Min(maxBufferSize, fileSize);
  319. byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
  320. try
  321. {
  322. for (long offset = 0; offset < fileSize; offset += bufferSize)
  323. {
  324. int toRead = (int)Math.Min(fileSize - offset, bufferSize);
  325. Span<byte> buf = buffer.AsSpan(0, toRead);
  326. rc = fs.ReadFile(out long _, sourceHandle, offset, buf);
  327. if (rc.IsFailure()) return rc;
  328. rc = fs.WriteFile(destHandle, offset, buf);
  329. if (rc.IsFailure()) return rc;
  330. }
  331. }
  332. finally
  333. {
  334. ArrayPool<byte>.Shared.Return(buffer);
  335. }
  336. rc = fs.FlushFile(destHandle);
  337. if (rc.IsFailure()) return rc;
  338. }
  339. }
  340. return Result.Success;
  341. }
  342. //
  343. // Events
  344. //
  345. private void OpenSaveUserDir_Clicked(object sender, EventArgs args)
  346. {
  347. SaveDataFilter saveDataFilter = new SaveDataFilter();
  348. saveDataFilter.SetUserId(new LibHac.Fs.UserId((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low));
  349. OpenSaveDir(saveDataFilter);
  350. }
  351. private void OpenSaveDeviceDir_Clicked(object sender, EventArgs args)
  352. {
  353. SaveDataFilter saveDataFilter = new SaveDataFilter();
  354. saveDataFilter.SetSaveDataType(SaveDataType.Device);
  355. OpenSaveDir(saveDataFilter);
  356. }
  357. private void OpenSaveBcatDir_Clicked(object sender, EventArgs args)
  358. {
  359. SaveDataFilter saveDataFilter = new SaveDataFilter();
  360. saveDataFilter.SetSaveDataType(SaveDataType.Bcat);
  361. OpenSaveDir(saveDataFilter);
  362. }
  363. private void ManageTitleUpdates_Clicked(object sender, EventArgs args)
  364. {
  365. new TitleUpdateWindow(_parent, _virtualFileSystem, _titleIdText, _titleName).Show();
  366. }
  367. private void ManageDlc_Clicked(object sender, EventArgs args)
  368. {
  369. new DlcWindow(_virtualFileSystem, _titleIdText, _titleName).Show();
  370. }
  371. private void OpenTitleModDir_Clicked(object sender, EventArgs args)
  372. {
  373. string modsBasePath = _virtualFileSystem.ModLoader.GetModsBasePath();
  374. string titleModsPath = _virtualFileSystem.ModLoader.GetTitleDir(modsBasePath, _titleIdText);
  375. OpenHelper.OpenFolder(titleModsPath);
  376. }
  377. private void ExtractRomFs_Clicked(object sender, EventArgs args)
  378. {
  379. ExtractSection(NcaSectionType.Data);
  380. }
  381. private void ExtractExeFs_Clicked(object sender, EventArgs args)
  382. {
  383. ExtractSection(NcaSectionType.Code);
  384. }
  385. private void ExtractLogo_Clicked(object sender, EventArgs args)
  386. {
  387. ExtractSection(NcaSectionType.Logo);
  388. }
  389. private void OpenPtcDir_Clicked(object sender, EventArgs args)
  390. {
  391. string ptcDir = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu");
  392. string mainPath = System.IO.Path.Combine(ptcDir, "0");
  393. string backupPath = System.IO.Path.Combine(ptcDir, "1");
  394. if (!Directory.Exists(ptcDir))
  395. {
  396. Directory.CreateDirectory(ptcDir);
  397. Directory.CreateDirectory(mainPath);
  398. Directory.CreateDirectory(backupPath);
  399. }
  400. OpenHelper.OpenFolder(ptcDir);
  401. }
  402. private void OpenShaderCacheDir_Clicked(object sender, EventArgs args)
  403. {
  404. string shaderCacheDir = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "shader");
  405. if (!Directory.Exists(shaderCacheDir))
  406. {
  407. Directory.CreateDirectory(shaderCacheDir);
  408. }
  409. OpenHelper.OpenFolder(shaderCacheDir);
  410. }
  411. private void PurgePtcCache_Clicked(object sender, EventArgs args)
  412. {
  413. DirectoryInfo mainDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu", "0"));
  414. DirectoryInfo backupDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "cpu", "1"));
  415. MessageDialog warningDialog = GtkDialog.CreateConfirmationDialog("Warning", $"You are about to delete the PPTC cache for :\n\n<b>{_titleName}</b>\n\nAre you sure you want to proceed?");
  416. List<FileInfo> cacheFiles = new List<FileInfo>();
  417. if (mainDir.Exists)
  418. {
  419. cacheFiles.AddRange(mainDir.EnumerateFiles("*.cache"));
  420. }
  421. if (backupDir.Exists)
  422. {
  423. cacheFiles.AddRange(backupDir.EnumerateFiles("*.cache"));
  424. }
  425. if (cacheFiles.Count > 0 && warningDialog.Run() == (int)ResponseType.Yes)
  426. {
  427. foreach (FileInfo file in cacheFiles)
  428. {
  429. try
  430. {
  431. file.Delete();
  432. }
  433. catch(Exception e)
  434. {
  435. GtkDialog.CreateErrorDialog($"Error purging PPTC cache {file.Name}: {e}");
  436. }
  437. }
  438. }
  439. warningDialog.Dispose();
  440. }
  441. private void PurgeShaderCache_Clicked(object sender, EventArgs args)
  442. {
  443. DirectoryInfo shaderCacheDir = new DirectoryInfo(System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleIdText, "cache", "shader"));
  444. MessageDialog warningDialog = GtkDialog.CreateConfirmationDialog("Warning", $"You are about to delete the shader cache for :\n\n<b>{_titleName}</b>\n\nAre you sure you want to proceed?");
  445. List<DirectoryInfo> cacheDirectory = new List<DirectoryInfo>();
  446. if (shaderCacheDir.Exists)
  447. {
  448. cacheDirectory.AddRange(shaderCacheDir.EnumerateDirectories("*"));
  449. }
  450. if (cacheDirectory.Count > 0 && warningDialog.Run() == (int)ResponseType.Yes)
  451. {
  452. foreach (DirectoryInfo directory in cacheDirectory)
  453. {
  454. try
  455. {
  456. directory.Delete(true);
  457. }
  458. catch (Exception e)
  459. {
  460. GtkDialog.CreateErrorDialog($"Error purging shader cache at {directory.Name}: {e}");
  461. }
  462. }
  463. }
  464. warningDialog.Dispose();
  465. }
  466. }
  467. }