mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-14 16:41:26 +00:00
18517b2257
Changed, Map Analysis mode: the view is now much more zoomed after clocking on a "Check very short linedefs" error check result. Removed single testing engine launchable by the editor at once limitation (it worked properly only when using Test map actions anyway). Fixed: re-did the fix for invalid geometry created when drawing very large grids from R2653, because it caused other issues.
113 lines
2.4 KiB
C#
113 lines
2.4 KiB
C#
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder.Data
|
|
{
|
|
public class EngineInfo : IDisposable
|
|
{
|
|
#region ================== Constants
|
|
|
|
public const string DEFAULT_ENGINE_NAME = "Engine with no name";
|
|
|
|
#endregion
|
|
|
|
#region ================== Variables
|
|
|
|
// Settings
|
|
private string testprogramname;
|
|
private string testprogram;
|
|
private Bitmap icon;
|
|
public string TestParameters;
|
|
public bool CustomParameters;
|
|
public int TestSkill;
|
|
public string TestSkin;
|
|
public int TestGametype;
|
|
public bool TestShortPaths;
|
|
|
|
// Disposing
|
|
private bool isdisposed;
|
|
|
|
#endregion
|
|
|
|
#region ================== Properties
|
|
|
|
public string TestProgramName { get { return testprogramname; } set { testprogramname = value; CheckProgramName(); } }
|
|
public string TestProgram { get { return testprogram; } set { testprogram = value; CheckProgramName(); } }
|
|
public Bitmap TestProgramIcon { get { if(icon == null) UpdateIcon(); return icon; } }
|
|
|
|
#endregion
|
|
|
|
#region ================== Constructors / Disposer
|
|
|
|
public EngineInfo()
|
|
{
|
|
testprogramname = DEFAULT_ENGINE_NAME;
|
|
}
|
|
|
|
public EngineInfo(EngineInfo other)
|
|
{
|
|
testprogramname = other.TestProgramName;
|
|
testprogram = other.testprogram;
|
|
TestParameters = other.TestParameters;
|
|
CustomParameters = other.CustomParameters;
|
|
TestSkill = other.TestSkill;
|
|
TestSkin = other.TestSkin;
|
|
TestGametype = other.TestGametype;
|
|
TestShortPaths = other.TestShortPaths;
|
|
|
|
UpdateIcon();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
// Not already disposed?
|
|
if(!isdisposed)
|
|
{
|
|
// Clean up
|
|
icon.Dispose();
|
|
|
|
// Done
|
|
isdisposed = true;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ================== Methods
|
|
|
|
private void CheckProgramName()
|
|
{
|
|
if(testprogramname == DEFAULT_ENGINE_NAME && !String.IsNullOrEmpty(testprogram))
|
|
{
|
|
// Get engine name from path
|
|
testprogramname = Path.GetFileNameWithoutExtension(testprogram);
|
|
}
|
|
}
|
|
|
|
private void UpdateIcon()
|
|
{
|
|
if(icon != null)
|
|
{
|
|
icon.Dispose();
|
|
icon = null;
|
|
}
|
|
|
|
if(File.Exists(testprogram))
|
|
{
|
|
Icon i = Icon.ExtractAssociatedIcon(testprogram);
|
|
icon = new Bitmap(i != null ? i.ToBitmap() : Properties.Resources.Question);
|
|
}
|
|
else
|
|
{
|
|
icon = new Bitmap(Properties.Resources.Warning);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|