public void Set(MessagePatternModel link) { Trace.Call(link); if (link == null) { throw new ArgumentNullException("link"); } link.Save(UserConfig); }
public int Add(MessagePatternModel link, int id) { Trace.Call(link, id); if (link == null) { throw new ArgumentNullException("link"); } string[] keys = PatternIDs; if (keys == null) { keys = new string[] {}; } int highestKey = 0; int newKey = id; if (id == -1) { foreach (string key in keys) { int parsedKey = Int32.Parse(key); if (parsedKey > highestKey) { highestKey = parsedKey; } } newKey = ++highestKey; } link.ID = newKey; link.Save(UserConfig); var keyList = new List <string>(keys); keyList.Add(link.ID.ToString()); PatternIDs = keyList.ToArray(); return(newKey); }
public int Add(MessagePatternModel link, int id) { Trace.Call(link, id); if (link == null) { throw new ArgumentNullException("link"); } string[] keys = PatternIDs; if (keys == null) { keys = new string[] {}; } int highestKey = 0; int newKey = id; if (id == -1) { foreach (string key in keys) { int parsedKey = Int32.Parse(key); if (parsedKey > highestKey) { highestKey = parsedKey; } } newKey = ++highestKey; } link.ID = newKey; link.Save(UserConfig); var keyList = new List<string>(keys); keyList.Add(link.ID.ToString()); PatternIDs = keyList.ToArray(); return newKey; }