public void ApplyModification(StringModification mod, Sheet sheet) { switch (mod.modType) { default: throw new Exception("unhandled StringModificationType"); case StringModificationType.AddElement: throw new Exception("AddElement StringModificationType applied to string"); case StringModificationType.Prefix: string prefix = mod.GetValue(sheet); defaultStringStartIndex += prefix.Length; modifiedValue = prefix + modifiedValue; if (modType != StringModificationState.Replace) { modType = StringModificationState.Additive; } break; case StringModificationType.Suffix: modifiedValue += mod.GetValue(sheet); if (modType != StringModificationState.Replace) { modType = StringModificationState.Additive; } break; case StringModificationType.Replace: modifiedValue = mod.GetValue(sheet); modType = StringModificationState.Replace; break; } }
public void Reset() { modifiedValue = defaultValue; modType = StringModificationState.None; }