private void ProcessObject(JObject obj) { Item item = null; try { item = Item.From(currentRecord, obj, currentConf); } catch (ArgumentException e) { // FIXME PatchFormatException.ThrowWhenInvalidToken(obj, currentConf, e); } var id = item?.Id ?? throw new Exception("Unreachable!"); if (current.ContainsKey(id)) { var existed = current[id]; Logger.Warn($"Conflict between " + $"Item1@({existed.Source})" + " & " + $"Item2@({item.Source})\n" + "Item1 will be overriden/merged."); existed.Merge(item); } else { current.Add(id, item); } }
private void ProcessArray(JArray array) { foreach (var token in array) { if (token.Type != JTokenType.Object) { PatchFormatException.ThrowWhenInvalidToken(token, currentConf); } // Checked token type above ProcessObject(token.Value <JObject>()); } }