Exemplo n.º 1
0
        static void Main(string[] args)
        {
            string path    = ConfigurationManager.AppSettings["binarypath"];
            string exePath = Path.Combine(path, "Update.exe");

            string connection = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
            string localpath  = ConfigurationManager.AppSettings["localfolder"];
            bool   isEC2      = Convert.ToBoolean(ConfigurationManager.AppSettings["isEC2"]);

            /*
             * string ftpHost = ConfigurationManager.AppSettings["ftp-host"];
             * string ftpUsername = ConfigurationManager.AppSettings["ftp-username"];
             * string ftpPassword = ConfigurationManager.AppSettings["ftp-password"];
             */

            Settings settings = new Settings(5, connection, "", "", "", false, localpath);

            FeedUpdater updater = new FeedUpdater(settings);

            updater.ClearOldItems();
            updater.Update();

            // Shutdown the PC
            if (isEC2)
            {
                Process.Start("shutdown", "/s");
            }
        }
 public FeedUpdaterBackgroundService(
     FeedUpdater feedUpdater,
     ZipCastsContext context,
     ILogger logger)
 {
     _feedUpdater = feedUpdater;
     _context     = context;
     _logger      = logger;
 }
Exemplo n.º 3
0
        private static async Task Main(string[] args)
        {
            var vulnDict =
                new Dictionary <string, Dictionary <string, VulnerabilityEntry> >();

            await foreach (var feed in FeedUpdater.GetFeedsAsync())
            {
                FeedUpdater.AddFeedToVulnerabilityData(feed, vulnDict);
            }

            VulnerabilityData.SaveToBinFile(vulnDict, BinName);
        }
Exemplo n.º 4
0
        private void StartThread()
        {
            using (NSAutoreleasePool pool = new NSAutoreleasePool())
            {
                FeedUpdater updater = new FeedUpdater();
                updater.FeedSaved += new EventHandler(FeedSaved);

                try
                {
                    List <Item> newItems = updater.Update();

                    // Show the progress bar
                    InvokeOnMainThread(delegate
                    {
                        _activityIndicator.StopAnimating();
                        _progressView.Alpha = 1f;
                    });

                    // Save all the items to SQLite
                    if (newItems.Count > 0)
                    {
                        _newFeedCount = newItems.Count;
                        updater.SaveItems(newItems);
                    }

                    // Download images
                    if (_newFeedCount > 0 && Settings.Current.UserSettings.ImagesEnabled)
                    {
                        _saveCount = 0;

                        ImageDownloader.Current.ImageSaved += DownloaderImageSaved;
                        ImageDownloader.Current.PreDownloadForCategories();
                        UpdateProgressAmount(1);
                    }
                }
                catch (ThreadAbortException)
                {
                    // Stop downloads
                    ImageDownloader.Current.TryStop();
                }
                finally
                {
                    OnLoadingComplete(EventArgs.Empty);
                }
            }
        }