Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
replace terrible FolderBrowserDialog with OpenFileDialog
  • Loading branch information
Nathan8489 committed Sep 25, 2020
1 parent 1b1adbe commit 705611f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions VisualBundle/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private int ExportDir(ICollection<ItemModel> fis, string path)
}
else // is file
{
File.WriteAllBytes(path + "\\" + fi.Path, fr.Read());
File.WriteAllBytes(path + "\\" + fi.Name, fr.Read());
count++;
}
}
Expand Down Expand Up @@ -318,14 +318,20 @@ private void OnButtonAddClick(object sender, RoutedEventArgs e)
var br = tvi.Record as BundleRecord;
if (br != null) //Selected Bundle File
{
var fbd = new System.Windows.Forms.FolderBrowserDialog();
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
var fbd = new OpenFileDialog() {
ValidateNames = false,
CheckFileExists = false,
CheckPathExists = true,
FileName = "(In Bundle2 Folder)"
};
if (fbd.ShowDialog() == true)
{
var fs = Directory.GetFiles(fbd.SelectedPath, "*", SearchOption.AllDirectories);
var Bundle2_path = Path.GetDirectoryName(fbd.FileName);
var fs = Directory.GetFiles(Bundle2_path, "*", SearchOption.AllDirectories);
var paths = ic.Hashes.Values;
foreach (var f in fs)
{
var path = f.Remove(0, fbd.SelectedPath.Length + 1).Replace("\\", "/");
var path = f.Remove(0, Bundle2_path.Length + 1).Replace("\\", "/");
if (!paths.Contains(path))
{
MessageBox.Show("The index didn't define the file:" + Environment.NewLine + path, "Error");
Expand All @@ -334,7 +340,7 @@ private void OnButtonAddClick(object sender, RoutedEventArgs e)
}
foreach (var f in fs)
{
var path = f.Remove(0, fbd.SelectedPath.Length + 1).Replace("\\", "/");
var path = f.Remove(0, Bundle2_path.Length + 1).Replace("\\", "/");
var fr = ic.FindFiles[IndexContainer.FNV1a64Hash(path)];
fr.Write(File.ReadAllBytes(f));
fr.Move(br);
Expand Down

0 comments on commit 705611f

Please sign in to comment.