/// <summary> /// Sets the value of the counter to the given value or zero. /// </summary> /// <param name="name">The counter.</param> /// <param name="value">The value being set, or zero.</param> /// <returns>An empty string or an error message.</returns> private string Set(string name, string value) { if (value == "") { value = "0"; } if (!GenUtilities.IsNumeric(value)) { return("<<<<< Set: Counter '" + value + "' is not numeric >>>>>"); } _map[name] = long.Parse(value); return(""); }
/// <summary> /// Subtracts the value or 1 from the named counter. /// </summary> /// <param name="name">The counter.</param> /// <param name="value">The amount being subtracted - 1 if blank.</param> /// <returns>An empty string or an error message.</returns> private string Sub(string name, string value) { if (!_map.ContainsKey(name)) { return("<<<<< Sub: Counter " + name + " not defined >>>>>"); } if (value == "") { value = "1"; } else if (!GenUtilities.IsNumeric(value)) { return("<<<<< Sub: Counter '" + value + "' is not numeric >>>>>"); } _map[name] = _map[name] - long.Parse(value); return(""); }