示例#1
0
        private void OpenStorageClick(object sender, RoutedEventArgs e)
        {
            CASCFiles.Clear();
            Storage?.Dispose();

            using (var folderDialog = new System.Windows.Forms.FolderBrowserDialog()
            {
                Description = "Open CASC Storage",
                ShowNewFolderButton = false
            })
            {
                if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        Storage = new CASCStorage(folderDialog.SelectedPath);

                        foreach (var file in Storage.Files)
                        {
                            CASCFiles.Add(new CASCFile(file.FileName, file.FileSize, file.IsLocal));
                        }
                    }
                    catch
                    {
                        Storage?.Dispose();
                        MessageBox.Show(
                            "Failed to open CASC Storage. Ensure that the storage is intact and exists at the given location.",
                            "CASCLib.NET.Example | ERROR",
                            MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }
        }
示例#2
0
 private void OpenStorage()
 {
     CASCFiles.Clear();
     storage?.Dispose();
     try {
         storage = new CASCStorage(selectedPath, listFilePath, csvFilePath);
     }
     catch (Exception e) {
         storage?.Dispose();
         Debug.Log(e);
         Debug.LogError("Failed to open CASC Storage. Ensure that the storage is intact and exists at the given location.");
     }
 }