Remove some duplication
This commit is contained in:
@@ -254,11 +254,8 @@ namespace OpenRA.Editor
|
||||
|
||||
void SaveAsClicked(object sender, EventArgs e)
|
||||
{
|
||||
using (var nms = new MapSelect())
|
||||
using (var nms = new MapSelect(currentMod))
|
||||
{
|
||||
nms.MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
|
||||
.Aggregate(Path.Combine);
|
||||
|
||||
nms.txtNew.ReadOnly = false;
|
||||
nms.btnOk.Text = "Save";
|
||||
nms.txtNew.Text = "unnamed";
|
||||
@@ -281,21 +278,14 @@ namespace OpenRA.Editor
|
||||
|
||||
void OpenClicked(object sender, EventArgs e)
|
||||
{
|
||||
using (var nms = new MapSelect())
|
||||
using (var nms = new MapSelect(currentMod))
|
||||
{
|
||||
nms.MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
|
||||
.Aggregate(Path.Combine);
|
||||
|
||||
nms.txtNew.ReadOnly = true;
|
||||
nms.txtPathOut.ReadOnly = true;
|
||||
nms.btnOk.Text = "Open";
|
||||
|
||||
if (DialogResult.OK == nms.ShowDialog())
|
||||
{
|
||||
var path = nms.txtNew.Tag as string;
|
||||
System.Console.WriteLine("OpenClicked: {0}", path);
|
||||
LoadMap(path);
|
||||
}
|
||||
LoadMap(nms.txtNew.Tag as string);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Editor
|
||||
{
|
||||
@@ -10,8 +11,11 @@ namespace OpenRA.Editor
|
||||
{
|
||||
public string MapFolderPath;
|
||||
|
||||
public MapSelect()
|
||||
public MapSelect(string currentMod)
|
||||
{
|
||||
MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
|
||||
.Aggregate(Path.Combine);
|
||||
|
||||
InitializeComponent();
|
||||
MapIconsList.Images.Add(pictureBox1.Image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user