Mother2GbaTranslation/ScriptTool/ScriptToolGui/MatchedGroup.cs

64 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ScriptTool;
namespace ScriptToolGui
{
class MatchedGroup
{
2015-03-27 14:13:01 +00:00
public IDictionary<Game, IndexLabel> Refs { get; private set; }
public MatchedGroup()
{
2015-03-27 14:13:01 +00:00
Refs = new Dictionary<Game, IndexLabel>();
}
2015-03-26 20:02:49 +00:00
public MatchedGroup(MainStringRef ebRef, MainStringRef m12Ref)
: this()
{
2015-03-27 14:13:01 +00:00
Refs.Add(Game.Eb, new IndexLabel(ebRef));
Refs.Add(Game.M12, new IndexLabel(m12Ref));
Refs.Add(Game.M12English, new IndexLabel(m12Ref));
}
2015-03-26 20:27:58 +00:00
public MatchedGroup(MainStringRef m12Ref)
: this()
{
2015-03-27 14:13:01 +00:00
Refs.Add(Game.M12, new IndexLabel(m12Ref));
Refs.Add(Game.M12English, new IndexLabel(m12Ref));
}
public MatchedGroup(int m12Index, string m12Label)
: this()
{
Refs.Add(Game.M12, new IndexLabel(m12Index, m12Label));
Refs.Add(Game.M12English, new IndexLabel(m12Index, m12Label));
}
public MatchedGroup(Game game, int index, string label)
: this()
{
Refs.Add(game, new IndexLabel(index, label));
2015-03-26 20:27:58 +00:00
}
public override string ToString()
{
2015-03-27 14:13:01 +00:00
var parts = new List<string>();
if (Refs.ContainsKey(Game.Eb))
{
parts.Add(String.Format("[{0:D4}] EB: {1}", Refs[Game.Eb].Index, Refs[Game.Eb].Label));
2015-03-27 14:13:01 +00:00
}
if (Refs.ContainsKey(Game.M12))
{
parts.Add(String.Format("[{0:D4}] M12: {1}", Refs[Game.M12].Index, Refs[Game.M12].Label));
2015-03-27 14:13:01 +00:00
}
return String.Join(" / ", parts.ToArray());
}
}
}