public void OnCommand(EnsoCommand command, string postfix) { Guid guid = Guid.NewGuid(); String result; if (POSTFIX_NUMERIC.Equals(postfix)) { result = guid.ToString("N").ToUpper(); } else { result = POSTFIX_LOWER.Equals(postfix) ? guid.ToString() : guid.ToString().ToUpper(); } service.InsertUnicodeAtCursor(result, command); }
public void OnCommand(EnsoCommand command, String postfix) { Match m = boundsParser.Match(postfix); int from = 0; String s_from = m.Groups[1].Value; try { if (!"".Equals(s_from.Trim())) { from = Convert.ToInt32(s_from); } } catch (Exception) { service.DisplayMessage(new EnsoMessage(INVALID_BOUNDS_ERROR)); } int to = int.MaxValue; String s_to = m.Groups[2].Value; try { if (!"".Equals(s_to.Trim())) { to = Convert.ToInt32(s_to); } } catch (Exception) { service.DisplayMessage(new EnsoMessage(INVALID_BOUNDS_ERROR)); } int result = random.Next(from, to); service.InsertUnicodeAtCursor(result.ToString(), command); }