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