示例#1
0
 public bool Next()
 {
     if (_updater.countnum != 0 && !_updater.trieduseproxy)
     {
         _serverSubscribes.RemoveAt(0);
     }
     if (_serverSubscribes.Count == 0)
     {
         _config = null;
         return(false);
     }
     else
     {
         _URL = _serverSubscribes[0].URL;
         if ((!_use_proxy && _serverSubscribes[0].UseProxy) || _updater.trieduseproxy)
         {
             _updater.CheckUpdate(_config, _serverSubscribes[0], true, _noitify);
         }
         else
         {
             _updater.CheckUpdate(_config, _serverSubscribes[0], _use_proxy, _noitify);
         }
         //_serverSubscribes.RemoveAt(0);
         return(true);
     }
 }
        public bool Next()
        {
            if (_serverSubscribes.Count == 0)
            {
                _config = null;
                return(false);
            }

            CurrentServerSubscribe = _serverSubscribes[0];
            _updater.CheckUpdate(_config, _serverSubscribes[0], _useProxy, _notify);
            _serverSubscribes.RemoveAt(0);
            return(true);
        }
示例#3
0
 public bool Next()
 {
     if (_serverSubscribes.Count == 0)
     {
         _config = null;
         return(false);
     }
     else
     {
         _URL = _serverSubscribes[0].URL;
         _updater.CheckUpdate(_config, _URL, _use_proxy);
         _serverSubscribes.RemoveAt(0);
         return(true);
     }
 }
示例#4
0
        public void CreateTask(Configuration config, int[] indexes, bool _use_proxy, bool _notify)
        {
            if (!updater.InProcessing)
            {
                updater.InProcessing = true;


                List <ServerSubscribe> serverSubscribes = new List <ServerSubscribe>();
                List <string>          listRepeated     = new List <string>();
                List <string>          listFailed       = new List <string>();

                use_proxy = _use_proxy;
                notify    = _notify;
                UpdateAll = false;
                if (indexes == null || indexes.Length == 0)
                {
                    UpdateAll = true;
                    listSubscribeFailureLinks.Clear();
                    int ServerSubscribeCount = config.serverSubscribes.Count;
                    for (int i = 0; i < ServerSubscribeCount; ++i)
                    {
                        if (!config.serverSubscribes[i].JoinUpdate)
                        {
                            continue;
                        }
                        serverSubscribes.Add(config.serverSubscribes[i].Clone());
                        serverSubscribes[serverSubscribes.Count - 1].index = i;
                    }
                }
                else
                {
                    for (int i = 0; i < indexes.Length; i++)
                    {
                        serverSubscribes.Add(config.serverSubscribes[indexes[i]].Clone());
                        serverSubscribes[serverSubscribes.Count - 1].index = indexes[i];
                    }
                }

                for (int i = 0; i < serverSubscribes.Count;)
                {
                    if (serverSubscribes[i].URL == "")
                    {
                        if (!listFailed.Contains(serverSubscribes[i].id))
                        {
                            listFailed.Add(serverSubscribes[i].id);
                        }
                        serverSubscribes.RemoveAt(i);
                        continue;
                    }
                    if (Utils.IsServerSubscriptionRepeat(serverSubscribes, serverSubscribes[i].URL).Count > 0)
                    {
                        if (!listRepeated.Contains(serverSubscribes[i].id))
                        {
                            listRepeated.Add(serverSubscribes[i].id);
                        }
                        serverSubscribes.RemoveAt(i);
                        continue;
                    }
                    i++;
                }

                if (serverSubscribes.Count == 0)
                {
                    updater.InProcessing = false;
                    return;
                }


                updater.mtListControl.WaitOne();
                updater.listServerSubscribes = serverSubscribes;
                updater.listRepeated         = listRepeated;
                updater.listFailed           = listFailed;
                updater.mtListControl.ReleaseMutex();
                updater.CheckUpdate(config, use_proxy, notify);
            }
        }