// public update public int Update(IOpinionMiner miner) { var opinions = miner.GetOpinions(_lastUpdate).ToList(); opinions.RemoveAll(o => Opinions.Contains(o)); if (opinions.Any()) { Opinion.Save(opinions.ToList(), _path + "/" + Guid.NewGuid().ToString() + ".xml"); _lastUpdate = opinions.Max(o => o.Date); File.WriteAllLines(_path + "/" + "config.txt", new string[] { _lastUpdate.ToString() }); } foreach(var o in opinions) Opinions.Add(o); return opinions.Count; }
// public update public int Update(IOpinionMiner miner) { var opinions = miner.GetOpinions(_lastUpdate, int.MaxValue).ToList(); opinions.RemoveAll(o => Opinions.Contains(o)); if (opinions.Any()) { Opinion.Save(opinions.ToList(), _path + "/" + Guid.NewGuid().ToString() + ".xml"); _lastUpdate = opinions.Max(o => o.Date); File.WriteAllLines(_path + "/" + "config.txt", new string[] { _lastUpdate.ToString() }); } foreach (var o in opinions) { Opinions.Add(o); } return(opinions.Count); }