Comparing files not working as intended

笑着哭i 提交于 2019-12-02 09:31:54

Your OP is confusing.

If I understood correctly:

You have 3 files Books, NewBooks and MyBooks. You download data from web, if that data is not located in Books, you add it to NewBooks, otherwise to MyBooks(duplicates).

Seeing that you are working with JSON i would do it the following way.

Load the Books, when downloading data check it and compare it with Books. Then write to proper file.

Imports System.Web.Script.Serialization ' for reading of JSON (+add the reference to System.Web.Extensions library)
Dim JSONBooks = New JavaScriptSerializer().DeserializeObject(Books_string)

Inspect JSONBooks with breakpoint. You will see how it looks. When downlaoding data you can simply check if book exist in it, by title, url or whatever you want.

Since you shown only one book

Debug.Print(JSONBooks("Title")) 'returns >>>My Title Here

When you have more

JSONBooks(x)("Title") 'where x is book number. 

So you can loop over all books and check what you need.

JSON array looks like this (if you need to construct it)

[{book1},{book2},...]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!