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.
27 lines
656 B
27 lines
656 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace FLocal.Common.actions {
|
|
class IncrementFieldValue : AbstractFieldValue {
|
|
|
|
private readonly Func<string, string> incrementor;
|
|
|
|
public IncrementFieldValue(Func<string, string> incrementor) {
|
|
this.incrementor = incrementor;
|
|
}
|
|
|
|
public IncrementFieldValue()
|
|
: this(str => (int.Parse(str)+1).ToString()) {
|
|
}
|
|
|
|
public override string getStringRepresentation() {
|
|
throw new NotSupportedException();
|
|
}
|
|
public override string getStringRepresentation(string oldInfo) {
|
|
return this.incrementor(oldInfo);
|
|
}
|
|
|
|
}
|
|
}
|
|
|