mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 20:32:34 +00:00
1b1a243983
- added function to find the first IWAD (needed for testing parameters) - removed the nodebuilder option for 3D mode, we don't need a nodebuilder for 3D mode anymore - removed test parameters information and increased parameter input field (the info will go in help files)
147 lines
4.9 KiB
C#
147 lines
4.9 KiB
C#
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
/*
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
* This program is released under GNU General Public License
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Text;
|
|
using CodeImp.DoomBuilder.IO;
|
|
using CodeImp.DoomBuilder.Data;
|
|
using System.IO;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Config
|
|
{
|
|
internal class ConfigurationInfo : IComparable<ConfigurationInfo>
|
|
{
|
|
#region ================== Variables
|
|
|
|
private string name;
|
|
private string filename;
|
|
private string settingskey;
|
|
private string defaultlumpname;
|
|
private string nodebuildersave;
|
|
private string nodebuildertest;
|
|
private DataLocationList resources;
|
|
private string testprogram;
|
|
private string testparameters;
|
|
|
|
#endregion
|
|
|
|
#region ================== Properties
|
|
|
|
public string Name { get { return name; } }
|
|
public string Filename { get { return filename; } }
|
|
public string DefaultLumpName { get { return defaultlumpname; } }
|
|
public string NodebuilderSave { get { return nodebuildersave; } set { nodebuildersave = value; } }
|
|
public string NodebuilderTest { get { return nodebuildertest; } set { nodebuildertest = value; } }
|
|
public DataLocationList Resources { get { return resources; } }
|
|
public string TestProgram { get { return testprogram; } set { testprogram = value; } }
|
|
public string TestParameters { get { return testparameters; } set { testparameters = value; } }
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
// Constructor
|
|
public ConfigurationInfo(Configuration cfg, string filename)
|
|
{
|
|
// Initialize
|
|
this.filename = filename;
|
|
this.settingskey = Path.GetFileNameWithoutExtension(filename).ToLower();
|
|
|
|
// Load settings from game configuration
|
|
this.name = cfg.ReadSetting("game", "<unnamed game>");
|
|
this.defaultlumpname = cfg.ReadSetting("defaultlumpname", "");
|
|
|
|
// Load settings from program configuration
|
|
this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", "");
|
|
this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", "");
|
|
this.testprogram = General.Settings.ReadSetting("configurations." + settingskey + ".testprogram", "");
|
|
this.testparameters = General.Settings.ReadSetting("configurations." + settingskey + ".testparameters", "");
|
|
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
|
|
}
|
|
|
|
// Constructor
|
|
private ConfigurationInfo()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
// This compares it to other ConfigurationInfo objects
|
|
public int CompareTo(ConfigurationInfo other)
|
|
{
|
|
// Compare
|
|
return name.CompareTo(other.name);
|
|
}
|
|
|
|
// This saves the settings to program configuration
|
|
public void SaveSettings()
|
|
{
|
|
// Write to configuration
|
|
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuildersave", nodebuildersave);
|
|
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuildertest", nodebuildertest);
|
|
General.Settings.WriteSetting("configurations." + settingskey + ".testprogram", testprogram);
|
|
General.Settings.WriteSetting("configurations." + settingskey + ".testparameters", testparameters);
|
|
resources.WriteToConfig(General.Settings.Config, "configurations." + settingskey + ".resources");
|
|
}
|
|
|
|
// String representation
|
|
public override string ToString()
|
|
{
|
|
return name;
|
|
}
|
|
|
|
// This clones the object
|
|
public ConfigurationInfo Clone()
|
|
{
|
|
ConfigurationInfo ci = new ConfigurationInfo();
|
|
ci.name = this.name;
|
|
ci.filename = this.filename;
|
|
ci.settingskey = this.settingskey;
|
|
ci.nodebuildersave = this.nodebuildersave;
|
|
ci.nodebuildertest = this.nodebuildertest;
|
|
ci.resources = new DataLocationList();
|
|
ci.resources.AddRange(this.resources);
|
|
ci.testprogram = this.testprogram;
|
|
ci.testparameters = this.testparameters;
|
|
return ci;
|
|
}
|
|
|
|
// This applies settings from an object
|
|
public void Apply(ConfigurationInfo ci)
|
|
{
|
|
this.name = ci.name;
|
|
this.filename = ci.filename;
|
|
this.settingskey = ci.settingskey;
|
|
this.nodebuildersave = ci.nodebuildersave;
|
|
this.nodebuildertest = ci.nodebuildertest;
|
|
this.resources = new DataLocationList();
|
|
this.resources.AddRange(ci.resources);
|
|
this.testprogram = ci.testprogram;
|
|
this.testparameters = ci.testparameters;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|