UltimateZoneBuilder/Source/General/NodebuilderInfo.cs

119 lines
3.2 KiB
C#
Raw Normal View History

2007-09-28 08:56:18 +00:00
#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;
2007-10-01 20:53:10 +00:00
using CodeImp.DoomBuilder.Data;
2007-09-28 08:56:18 +00:00
using System.IO;
using System.Diagnostics;
#endregion
namespace CodeImp.DoomBuilder
{
internal class NodebuilderInfo : IComparable<NodebuilderInfo>
{
#region ================== Constants
#endregion
#region ================== Variables
private string name;
2007-09-29 15:43:59 +00:00
private string filename;
2007-09-28 08:56:18 +00:00
private ProcessStartInfo savemapprocess;
private ProcessStartInfo testmapprocess;
private ProcessStartInfo mode3dbuildprocess;
#endregion
#region ================== Properties
public string Name { get { return name; } }
2007-09-29 15:43:59 +00:00
public string Filename { get { return filename; } }
2007-09-28 08:56:18 +00:00
public ProcessStartInfo SaveMapProcess { get { return savemapprocess; } }
public ProcessStartInfo TestMapProcess { get { return testmapprocess; } }
public ProcessStartInfo Mode3DBuildProcess { get { return mode3dbuildprocess; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
2007-09-29 15:43:59 +00:00
public NodebuilderInfo(Configuration cfg, string filename)
2007-09-28 08:56:18 +00:00
{
// Initialize
2007-09-29 15:43:59 +00:00
this.filename = Path.GetFileName(filename);
2007-09-28 08:56:18 +00:00
this.name = cfg.ReadSetting("title", "");
2007-10-05 10:00:15 +00:00
General.WriteLogLine("Registered nodebuilder configuration '" + this.name + "' from '" + this.filename + "'");
2007-09-28 08:56:18 +00:00
// Setup save map process
SetupProcess(out savemapprocess,
cfg.ReadSetting("savemap.compiler", ""),
cfg.ReadSetting("savemap.parameters", ""));
// Setup test map process
SetupProcess(out testmapprocess,
cfg.ReadSetting("testmap.compiler", ""),
cfg.ReadSetting("testmap.parameters", ""));
// Setup 3d build process
SetupProcess(out mode3dbuildprocess,
cfg.ReadSetting("mode3dbuild.compiler", ""),
cfg.ReadSetting("mode3dbuild.parameters", ""));
}
// This sets up a process
private void SetupProcess(out ProcessStartInfo processinfo, string compiler, string parameters)
{
processinfo = new ProcessStartInfo();
processinfo.Arguments = parameters;
processinfo.FileName = Path.Combine(General.CompilersPath, compiler);
processinfo.CreateNoWindow = false;
processinfo.ErrorDialog = false;
processinfo.UseShellExecute = true;
processinfo.WindowStyle = ProcessWindowStyle.Hidden;
processinfo.WorkingDirectory = General.TempPath;
}
#endregion
#region ================== Methods
// This compares it to other ConfigurationInfo objects
public int CompareTo(NodebuilderInfo other)
{
// Compare
return name.CompareTo(other.name);
}
// String representation
public override string ToString()
{
return name;
}
#endregion
}
}