mirror of
https://github.com/tribufu/ServerGridEditor
synced 2026-05-06 15:17:35 +00:00
Fix for foreground image selection crash
This commit is contained in:
parent
8b2900fa6b
commit
534c3a5abc
2 changed files with 8 additions and 5 deletions
|
|
@ -2343,19 +2343,22 @@ namespace ServerGridEditor
|
|||
|
||||
openFileDialog.Filter = "png files (*.png)|*.png";
|
||||
openFileDialog.InitialDirectory = GlobalSettings.Instance.BaseDir + foregroundTilesDir.Replace("./", "");
|
||||
openFileDialog.FileName = string.IsNullOrEmpty(currentProject.foregroundImgPath) ? "" : Path.GetFileName(currentProject.foregroundImgPath);
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string imgName = foregroundTilesDir;// + "/" + currentProject.SeamlessWorldId;
|
||||
|
||||
if (foregroundBrush != null)
|
||||
foregroundBrush.Dispose();
|
||||
if (foreground != null)
|
||||
foreground.Dispose();
|
||||
|
||||
File.Copy(openFileDialog.FileName, imgName, true);
|
||||
SetForegroundImage(openFileDialog.FileName);
|
||||
|
||||
string imgPath= Path.Combine(foregroundTilesDir, Path.GetFileName(openFileDialog.FileName));
|
||||
if (!openFileDialog.FileName.StartsWith(Path.GetFullPath(foregroundTilesDir)))
|
||||
File.Copy(openFileDialog.FileName, imgPath, true);
|
||||
|
||||
SetForegroundImage(imgPath);
|
||||
currentProject.showForeground = true;
|
||||
currentProject.foregroundImgPath = imgName;
|
||||
currentProject.foregroundImgPath = imgPath;
|
||||
showForegroundChckBox.Checked = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue