public List<Quest> compare(QuestContainer questContainer) { List<Quest> newQuests = new List<Quest>(); if (questContainer.listOfQuests.Count != this.listOfQuests.Count) { List<Quest> temp; List<Quest> temp1; if (questContainer.listOfQuests.Count > this.listOfQuests.Count) { temp = new List<Quest>(questContainer.listOfQuests); temp1 = new List<Quest>(this.listOfQuests); } else { temp = new List<Quest>(this.listOfQuests); temp1 = new List<Quest>(questContainer.listOfQuests); } foreach (Quest quest in temp) { bool flag = false; foreach (Quest quest1 in temp1) if (quest.Link.Equals(quest1.Link)) flag = true; if (!flag) newQuests.Add(quest); } return newQuests; } return null; }
public void getQuests() { QuestContainer savedQuestContainer = null; Object obj = Settings.Default["quests"]; if (obj != null) { savedQuestContainer = (QuestContainer)obj; } questContainer = new QuestContainer(httpClient, httpClient.SendHttpGetAndReturnResponseContent("http://parafia.biz/quests")); if (savedQuestContainer != null) newQuests = savedQuestContainer.compare(questContainer); if (questContainer != null) { Settings.Default["quests"] = questContainer; Settings.Default.Save(); } }