UltimateZoneBuilder/Source/Config/LinedefActivateInfo.cs

95 lines
2.1 KiB
C#
Raw Normal View History

2007-12-26 14:29:36 +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;
using CodeImp.DoomBuilder.Data;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Config
{
2008-05-31 19:31:45 +00:00
public class LinedefActivateInfo : IComparable<LinedefActivateInfo>
2007-12-26 14:29:36 +00:00
{
#region ================== Constants
#endregion
#region ================== Variables
// Properties
2008-05-31 19:31:45 +00:00
private int intkey;
private string key;
2007-12-26 14:29:36 +00:00
private string title;
#endregion
#region ================== Properties
2008-05-31 19:31:45 +00:00
public int Index { get { return intkey; } }
public string Key { get { return key; } }
2007-12-26 14:29:36 +00:00
public string Title { get { return title; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
2008-05-31 19:31:45 +00:00
internal LinedefActivateInfo(string key, string title)
2007-12-26 14:29:36 +00:00
{
// Initialize
2008-05-31 19:31:45 +00:00
this.key = key;
2007-12-26 14:29:36 +00:00
this.title = title;
2008-05-31 19:31:45 +00:00
// Try parsing key as int for comparison
if(!int.TryParse(key, out intkey)) intkey = 0;
2007-12-26 14:29:36 +00:00
// We have no destructor
GC.SuppressFinalize(this);
}
#endregion
#region ================== Methods
// This presents the item as string
public override string ToString()
{
return title;
}
// This compares against another activate info
public int CompareTo(LinedefActivateInfo other)
{
2008-05-31 19:31:45 +00:00
if(this.intkey < other.intkey) return -1;
else if(this.intkey > other.intkey) return 1;
2007-12-26 14:29:36 +00:00
else return 0;
}
#endregion
}
}