示例#1
0
            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);
                }
            }
示例#2
0
            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>());
                }
            }