コード例 #1
0
ファイル: OpinionStore.cs プロジェクト: kylejw1/mcall
        //        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;
        }
コード例 #2
0
//        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);
        }