diff --git a/ServerGridEditor.exe b/ServerGridEditor.exe index 5a08a08..19dc2bd 100644 Binary files a/ServerGridEditor.exe and b/ServerGridEditor.exe differ diff --git a/Src/ServerGridEditor/Forms/MainForm.cs b/Src/ServerGridEditor/Forms/MainForm.cs index 4bda336..29fb17b 100644 --- a/Src/ServerGridEditor/Forms/MainForm.cs +++ b/Src/ServerGridEditor/Forms/MainForm.cs @@ -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; } }