You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
897 B
35 lines
897 B
using MultiTerm.Core.Types;
|
|
|
|
namespace MultiTerm.Core.Model;
|
|
|
|
public class MultiFormatString
|
|
{
|
|
public List<Tuple<FormatType, string>> FormatValuePairs { get; private set; } = new();
|
|
|
|
public void Add(FormatType format, string value)
|
|
{
|
|
// TODO check if value is valid
|
|
this.FormatValuePairs.Add(Tuple.Create(format, value));
|
|
}
|
|
|
|
public void Remove(int amount)
|
|
{
|
|
// guard amount <= 0
|
|
if (amount <= 0) throw new ArgumentException($"{nameof(amount)} cannot be <= 0");
|
|
|
|
// limit amount to maximum
|
|
int listCount = this.FormatValuePairs.Count;
|
|
if (amount > listCount)
|
|
{
|
|
amount = listCount;
|
|
}
|
|
|
|
// remove range
|
|
this.FormatValuePairs.RemoveRange( (listCount - amount) , amount);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|