Little fix for "indian" code

Signed-off-by: katzsmile <katzsmile@lead-games.com>
This commit is contained in:
katzsmile
2010-09-15 23:55:05 +04:00
committed by Paul Chote
parent 810667abbc
commit ad00193a17
3 changed files with 12 additions and 22 deletions

View File

@@ -341,7 +341,7 @@ namespace OpenRA.Editor
{ {
using (var nms = new MapSelect()) using (var nms = new MapSelect())
{ {
nms.txtPath.Text = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" } nms.MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
.Aggregate(Path.Combine); .Aggregate(Path.Combine);
nms.lblNew.Visible = true; nms.lblNew.Visible = true;
@@ -353,14 +353,14 @@ namespace OpenRA.Editor
if (DialogResult.OK == nms.ShowDialog()) if (DialogResult.OK == nms.ShowDialog())
{ {
string mapfolderitem = nms.MapList.SelectedItems[0].Text; string mapfolderitem = nms.MapList.SelectedItems[0].Text;
string mapfoldername = nms.txtPath.Text + '\\' + mapfolderitem; string mapfoldername = nms.MapFolderPath + '\\' + mapfolderitem;
if (nms.txtNew.Text == "") if (nms.txtNew.Text == "")
{ {
mapfoldername = nms.txtPath.Text + '\\' + mapfolderitem; mapfoldername = nms.MapFolderPath + '\\' + mapfolderitem;
} }
else else
{ {
mapfoldername = nms.txtPath.Text + '\\' + nms.txtNew.Text; mapfoldername = nms.MapFolderPath + '\\' + nms.txtNew.Text;
} }
DirectoryInfo directory = new DirectoryInfo(mapfoldername); DirectoryInfo directory = new DirectoryInfo(mapfoldername);
loadedMapName = mapfoldername; loadedMapName = mapfoldername;
@@ -398,7 +398,7 @@ namespace OpenRA.Editor
using (var nms = new MapSelect()) using (var nms = new MapSelect())
{ {
nms.txtPath.Text = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" } nms.MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
.Aggregate(Path.Combine); .Aggregate(Path.Combine);
nms.lblNew.Visible = false; nms.lblNew.Visible = false;
@@ -408,8 +408,7 @@ namespace OpenRA.Editor
if (DialogResult.OK == nms.ShowDialog()) if (DialogResult.OK == nms.ShowDialog())
{ {
string mapfolderitem = nms.MapList.SelectedItems[0].Text; string mapfolderitem = nms.MapList.SelectedItems[0].Text;
string mapfoldername = nms.txtPath.Text + '\\'+ mapfolderitem; string mapfoldername = nms.MapFolderPath + '\\' + mapfolderitem;
// nms.txtPath.Text + '\\';
LoadMap(mapfoldername); LoadMap(mapfoldername);
} }
} }

View File

@@ -38,7 +38,6 @@
this.btnOk = new System.Windows.Forms.Button(); this.btnOk = new System.Windows.Forms.Button();
this.lblNew = new System.Windows.Forms.Label(); this.lblNew = new System.Windows.Forms.Label();
this.txtNew = new System.Windows.Forms.TextBox(); this.txtNew = new System.Windows.Forms.TextBox();
this.txtPath = new System.Windows.Forms.TextBox();
this.colTitle = new System.Windows.Forms.ColumnHeader(); this.colTitle = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -117,14 +116,6 @@
this.txtNew.TabIndex = 4; this.txtNew.TabIndex = 4;
this.txtNew.Visible = false; this.txtNew.Visible = false;
// //
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(12, 307);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(448, 20);
this.txtPath.TabIndex = 5;
this.txtPath.Visible = false;
//
// colTitle // colTitle
// //
this.colTitle.Text = "Title"; this.colTitle.Text = "Title";
@@ -134,8 +125,7 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(472, 303); this.ClientSize = new System.Drawing.Size(472, 299);
this.Controls.Add(this.txtPath);
this.Controls.Add(this.txtNew); this.Controls.Add(this.txtNew);
this.Controls.Add(this.lblNew); this.Controls.Add(this.lblNew);
this.Controls.Add(this.btnOk); this.Controls.Add(this.btnOk);
@@ -160,7 +150,6 @@
private System.Windows.Forms.ColumnHeader colMapName; private System.Windows.Forms.ColumnHeader colMapName;
private System.Windows.Forms.ColumnHeader colTheater; private System.Windows.Forms.ColumnHeader colTheater;
private System.Windows.Forms.ImageList MapIconsList; private System.Windows.Forms.ImageList MapIconsList;
public System.Windows.Forms.TextBox txtPath;
public System.Windows.Forms.ListView MapList; public System.Windows.Forms.ListView MapList;
public System.Windows.Forms.Button btnCancel; public System.Windows.Forms.Button btnCancel;
public System.Windows.Forms.Button btnOk; public System.Windows.Forms.Button btnOk;

View File

@@ -13,6 +13,8 @@ namespace OpenRA.Editor
{ {
public partial class MapSelect : Form public partial class MapSelect : Form
{ {
public string MapFolderPath;
public MapSelect() public MapSelect()
{ {
InitializeComponent(); InitializeComponent();
@@ -21,7 +23,7 @@ namespace OpenRA.Editor
private void MapSelect_Load(object sender, EventArgs e) private void MapSelect_Load(object sender, EventArgs e)
{ {
DirectoryInfo directory = new DirectoryInfo(txtPath.Text); DirectoryInfo directory = new DirectoryInfo(MapFolderPath);
DirectoryInfo[] directories = directory.GetDirectories(); DirectoryInfo[] directories = directory.GetDirectories();
MapList.Items.Clear(); MapList.Items.Clear();
foreach (DirectoryInfo subDirectory in directories) foreach (DirectoryInfo subDirectory in directories)
@@ -29,8 +31,8 @@ namespace OpenRA.Editor
ListViewItem map1 = new ListViewItem(subDirectory.Name); ListViewItem map1 = new ListViewItem(subDirectory.Name);
map1.ImageIndex = 0; map1.ImageIndex = 0;
MapList.Items.Add(map1); MapList.Items.Add(map1);
var map = new Map(new Folder(txtPath.Text + "\\" + subDirectory.Name)); var map = new Map(new Folder(MapFolderPath + "\\" + subDirectory.Name));
map1.SubItems.Add(map.Title); map1.SubItems.Add(map.Title);
map1.SubItems.Add(map.Theater); map1.SubItems.Add(map.Theater);
} }