예제 #1
0
		private static void DownloadInfoFile(object o)
		{
			UpdateDownloadInfo dl = (o as UpdateDownloadInfo);
			if(dl == null) { Debug.Assert(false); return; }

			dl.ComponentInfo = LoadInfoFile(dl.Url);
			lock(dl.SyncObj) { dl.Ready = true; }
		}
예제 #2
0
        DownloadInfoFiles(List <string> lUrls, IStatusLogger sl)
        {
            List <UpdateDownloadInfo> lDl = new List <UpdateDownloadInfo>();

            foreach (string strUrl in lUrls)
            {
                if (string.IsNullOrEmpty(strUrl))
                {
                    Debug.Assert(false); continue;
                }

                UpdateDownloadInfo dl = new UpdateDownloadInfo(strUrl);
                lDl.Add(dl);

                ThreadPool.QueueUserWorkItem(new WaitCallback(
                                                 UpdateCheckEx.DownloadInfoFile), dl);
            }

            while (true)
            {
                bool bReady = true;
                foreach (UpdateDownloadInfo dl in lDl)
                {
                    lock (dl.SyncObj) { bReady &= dl.Ready; }
                }

                if (bReady)
                {
                    break;
                }
                Thread.Sleep(40);

                if (sl != null)
                {
                    if (!sl.ContinueWork())
                    {
                        return(null);
                    }
                }
            }

            Dictionary <string, List <UpdateComponentInfo> > dict =
                new Dictionary <string, List <UpdateComponentInfo> >();

            foreach (UpdateDownloadInfo dl in lDl)
            {
                dict[dl.Url.ToLower()] = dl.ComponentInfo;
            }
            return(dict);
        }
예제 #3
0
        private static Dictionary<string, List<UpdateComponentInfo>> DownloadInfoFiles(List<string> lUrls, IStatusLogger sl)
        {
            List<UpdateDownloadInfo> lDl = new List<UpdateDownloadInfo>();
            foreach(string strUrl in lUrls)
            {
                if(string.IsNullOrEmpty(strUrl)) { Debug.Assert(false); continue; }

                UpdateDownloadInfo dl = new UpdateDownloadInfo(strUrl);
                lDl.Add(dl);

                ThreadPool.QueueUserWorkItem(new WaitCallback(
                    UpdateCheckEx.DownloadInfoFile), dl);
            }

            while(true)
            {
                bool bReady = true;
                foreach(UpdateDownloadInfo dl in lDl)
                {
                    lock(dl.SyncObj) { bReady &= dl.Ready; }
                }

                if(bReady) break;
                Thread.Sleep(40);

                if(sl != null)
                {
                    if(!sl.ContinueWork()) return null;
                }
            }

            Dictionary<string, List<UpdateComponentInfo>> dict =
                new Dictionary<string, List<UpdateComponentInfo>>();
            foreach(UpdateDownloadInfo dl in lDl)
            {
                dict[dl.Url.ToLower()] = dl.ComponentInfo;
            }
            return dict;
        }