mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
- Fixed missing resources in testing parameters.
- Fixed disappearing temp file in testing parameters when "Use short paths" is checked. - Added option for resource to exclude them from the testing parameters (for example, you may want to exclude zdoom.pk3)
This commit is contained in:
parent
13a47b93df
commit
582b01ee9d
8 changed files with 79 additions and 26 deletions
|
@ -38,15 +38,17 @@ namespace CodeImp.DoomBuilder.Data
|
|||
public string location;
|
||||
public bool option1;
|
||||
public bool option2;
|
||||
public bool notfortesting;
|
||||
|
||||
// Constructor
|
||||
public DataLocation(int type, string location, bool option1, bool option2)
|
||||
public DataLocation(int type, string location, bool option1, bool option2, bool notfortesting)
|
||||
{
|
||||
// Initialize
|
||||
this.type = type;
|
||||
this.location = location;
|
||||
this.option1 = option1;
|
||||
this.option2 = option2;
|
||||
this.notfortesting = notfortesting;
|
||||
}
|
||||
|
||||
// This displays the struct as string
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
if(rlinfo.Contains("location") && (rlinfo["location"] is string)) res.location = (string)rlinfo["location"];
|
||||
if(rlinfo.Contains("option1") && (rlinfo["option1"] is int)) res.option1 = General.Int2Bool((int)rlinfo["option1"]);
|
||||
if(rlinfo.Contains("option2") && (rlinfo["option2"] is int)) res.option2 = General.Int2Bool((int)rlinfo["option2"]);
|
||||
if(rlinfo.Contains("notfortesting") && (rlinfo["notfortesting"] is int)) res.notfortesting = General.Int2Bool((int)rlinfo["notfortesting"]);
|
||||
|
||||
// Add resource
|
||||
Add(res);
|
||||
|
@ -94,6 +95,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
rlinfo.Add("location", this[i].location);
|
||||
rlinfo.Add("option1", General.Bool2Int(this[i].option1));
|
||||
rlinfo.Add("option2", General.Bool2Int(this[i].option2));
|
||||
rlinfo.Add("notfortesting", General.Bool2Int(this[i].notfortesting));
|
||||
|
||||
// Add structure
|
||||
resinfo.Add("resource" + i.ToString(CultureInfo.InvariantCulture), rlinfo);
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
foreach(string w in wadfiles)
|
||||
{
|
||||
string tempfile = CreateTempFile(w);
|
||||
DataLocation wdl = new DataLocation(DataLocation.RESOURCE_WAD, tempfile, false, false);
|
||||
DataLocation wdl = new DataLocation(DataLocation.RESOURCE_WAD, tempfile, false, false, true);
|
||||
wads.Add(new WADReader(wdl));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder
|
|||
public Launcher(MapManager manager)
|
||||
{
|
||||
// Initialize
|
||||
this.tempwad = General.MakeTempFilename(manager.TempPath, "wad");
|
||||
CleanTempFile(manager);
|
||||
|
||||
// Bind actions
|
||||
General.Actions.BindMethods(this);
|
||||
|
@ -75,6 +75,10 @@ namespace CodeImp.DoomBuilder
|
|||
// Unbind actions
|
||||
General.Actions.UnbindMethods(this);
|
||||
|
||||
// Remove temporary file
|
||||
try { File.Delete(tempwad); }
|
||||
catch(Exception) { }
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
|
@ -114,8 +118,9 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// Make a list of all data locations, including map location
|
||||
DataLocation maplocation = new DataLocation(DataLocation.RESOURCE_WAD, General.Map.FilePathName, false, false);
|
||||
DataLocation maplocation = new DataLocation(DataLocation.RESOURCE_WAD, General.Map.FilePathName, false, false, false);
|
||||
DataLocationList locations = new DataLocationList();
|
||||
locations.AddRange(General.Map.ConfigSettings.Resources);
|
||||
locations.AddRange(General.Map.Options.Resources);
|
||||
locations.Add(maplocation);
|
||||
|
||||
|
@ -123,18 +128,22 @@ namespace CodeImp.DoomBuilder
|
|||
foreach(DataLocation dl in locations)
|
||||
{
|
||||
// Location not the IWAD file?
|
||||
if((dl.type == DataLocation.RESOURCE_WAD) && (dl.location != iwadloc.location))
|
||||
if((dl.type != DataLocation.RESOURCE_WAD) || (dl.location != iwadloc.location))
|
||||
{
|
||||
// Add to string of files
|
||||
if(shortpaths)
|
||||
// Location not included?
|
||||
if(!dl.notfortesting)
|
||||
{
|
||||
p_ap += General.GetShortFilePath(dl.location) + " ";
|
||||
p_apq += "\"" + General.GetShortFilePath(dl.location) + "\" ";
|
||||
}
|
||||
else
|
||||
{
|
||||
p_ap += dl.location + " ";
|
||||
p_apq += "\"" + dl.location + "\" ";
|
||||
// Add to string of files
|
||||
if(shortpaths)
|
||||
{
|
||||
p_ap += General.GetShortFilePath(dl.location) + " ";
|
||||
p_apq += "\"" + General.GetShortFilePath(dl.location) + "\" ";
|
||||
}
|
||||
else
|
||||
{
|
||||
p_ap += dl.location + " ";
|
||||
p_apq += "\"" + dl.location + "\" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -256,7 +265,11 @@ namespace CodeImp.DoomBuilder
|
|||
General.Map.ConfigSettings.TestParameters = General.Map.Config.TestParameters;
|
||||
General.Map.ConfigSettings.TestShortPaths = General.Map.Config.TestShortPaths;
|
||||
}
|
||||
|
||||
|
||||
// Remove temporary file
|
||||
try { File.Delete(tempwad); }
|
||||
catch(Exception) { }
|
||||
|
||||
// Save map to temporary file
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
tempwad = General.MakeTempFilename(General.Map.TempPath, "wad");
|
||||
|
@ -315,14 +328,25 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
}
|
||||
|
||||
// Remove temporary file
|
||||
try { File.Delete(tempwad); }
|
||||
catch(Exception) { }
|
||||
// Clean up temp file
|
||||
CleanTempFile(General.Map);
|
||||
|
||||
// Done
|
||||
General.MainWindow.FocusDisplay();
|
||||
Cursor.Current = oldcursor;
|
||||
}
|
||||
|
||||
// This deletes the previous temp file and creates a new, empty temp file
|
||||
private void CleanTempFile(MapManager manager)
|
||||
{
|
||||
// Remove temporary file
|
||||
try { File.Delete(tempwad); }
|
||||
catch(Exception) { }
|
||||
|
||||
// Make new empty temp file
|
||||
tempwad = General.MakeTempFilename(manager.TempPath, "wad");
|
||||
File.WriteAllText(tempwad, "");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ namespace CodeImp.DoomBuilder
|
|||
// Load data manager
|
||||
General.WriteLogLine("Loading data resources...");
|
||||
data = new DataManager();
|
||||
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, options.StrictPatches, false);
|
||||
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, options.StrictPatches, false, false);
|
||||
data.Load(configinfo.Resources, options.Resources, maplocation);
|
||||
|
||||
// Remove unused sectors
|
||||
|
@ -1468,7 +1468,7 @@ namespace CodeImp.DoomBuilder
|
|||
data = new DataManager();
|
||||
if(!string.IsNullOrEmpty(filepathname))
|
||||
{
|
||||
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
|
||||
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false, false);
|
||||
data.Load(configinfo.Resources, options.Resources, maplocation);
|
||||
}
|
||||
else
|
||||
|
|
21
Source/Core/Windows/ResourceOptionsForm.Designer.cs
generated
21
Source/Core/Windows/ResourceOptionsForm.Designer.cs
generated
|
@ -55,6 +55,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.wadfiledialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.dirdialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.pk3filedialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.notfortesting = new System.Windows.Forms.CheckBox();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
label2 = new System.Windows.Forms.Label();
|
||||
label3 = new System.Windows.Forms.Label();
|
||||
|
@ -312,7 +313,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(266, 273);
|
||||
this.cancel.Location = new System.Drawing.Point(266, 306);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 2;
|
||||
|
@ -323,7 +324,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.apply.Location = new System.Drawing.Point(148, 273);
|
||||
this.apply.Location = new System.Drawing.Point(148, 306);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 1;
|
||||
|
@ -345,13 +346,25 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.pk3filedialog.Filter = "Doom PK3 Files (*.pk3)|*.pk3";
|
||||
this.pk3filedialog.Title = "Browse PK3 File";
|
||||
//
|
||||
// notfortesting
|
||||
//
|
||||
this.notfortesting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.notfortesting.AutoSize = true;
|
||||
this.notfortesting.Location = new System.Drawing.Point(12, 262);
|
||||
this.notfortesting.Name = "notfortesting";
|
||||
this.notfortesting.Size = new System.Drawing.Size(249, 18);
|
||||
this.notfortesting.TabIndex = 3;
|
||||
this.notfortesting.Text = "Exclude this resource from testing parameters";
|
||||
this.notfortesting.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ResourceOptionsForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(386, 307);
|
||||
this.ClientSize = new System.Drawing.Size(386, 340);
|
||||
this.Controls.Add(this.notfortesting);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.tabs);
|
||||
|
@ -374,6 +387,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.pk3filetab.ResumeLayout(false);
|
||||
this.pk3filetab.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -402,5 +416,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.CheckBox strictpatches;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.CheckBox notfortesting;
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -70,11 +71,14 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
pk3location.Text = res.location;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Select appropriate tab
|
||||
tabs.SelectedIndex = res.type;
|
||||
|
||||
// Checkbox
|
||||
notfortesting.Checked = res.notfortesting;
|
||||
}
|
||||
|
||||
|
||||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -98,6 +102,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
res.location = wadlocation.Text;
|
||||
res.option1 = strictpatches.Checked;
|
||||
res.option2 = false;
|
||||
res.notfortesting = notfortesting.Checked;
|
||||
|
||||
// Done
|
||||
this.DialogResult = DialogResult.OK;
|
||||
|
@ -122,6 +127,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
res.location = dirlocation.Text;
|
||||
res.option1 = dir_textures.Checked;
|
||||
res.option2 = dir_flats.Checked;
|
||||
res.notfortesting = notfortesting.Checked;
|
||||
|
||||
// Done
|
||||
this.DialogResult = DialogResult.OK;
|
||||
|
@ -146,6 +152,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
res.location = pk3location.Text;
|
||||
res.option1 = false;
|
||||
res.option2 = false;
|
||||
res.notfortesting = notfortesting.Checked;
|
||||
|
||||
// Done
|
||||
this.DialogResult = DialogResult.OK;
|
||||
|
@ -154,7 +161,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cancel clicked
|
||||
private void cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -207,6 +207,9 @@
|
|||
<metadata name="pk3filedialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>227, 17</value>
|
||||
</metadata>
|
||||
<metadata name="notfortesting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
Loading…
Reference in a new issue