Esempio n. 1
0
        static void Main(string[] args)
        {
            try
            {
                //Get Settings
                bool   writetoeventfile     = bool.Parse(apr.GetValue("WriteToTextOutput", "".GetType()).ToString());
                bool   writetoeventlog      = bool.Parse(apr.GetValue("WriteToEventLogOutput", "".GetType()).ToString());
                string pathtooutputtext     = apr.GetValue("TextOutputPath", "".GetType()).ToString();
                bool   overwritetextiffound = bool.Parse(apr.GetValue("OverwriteTextIfFound", "".GetType()).ToString());
                string connectionstring     = apr.GetValue("DBConnectionString", "".GetType()).ToString();

                //Apply Settings
                logger.overwriteiffound = overwritetextiffound;
                logger.writeevents      = writetoeventlog;
                logger.writetext        = writetoeventfile;
                logger.wrtextdesc       = pathtooutputtext;
                connection = new SqlConnection(connectionstring);
                connection.Open();
                DBContext = new RSSListener.SQL.Management(connection, logger);
                //Operation
                logger.addEvent(new cEvent(Severity.Information, "RSS Feed Service Loaded"));
                //RunForXML("http://feeds.feedburner.com/dnbradioarchive?format=xml", "c:\\DNBTest\\", false);
                executeRefresh();
                //RunForXML(@"c:\temp\pressure.xml", @"C:\homeboy\DnbRadio.com - Fresh Jungle, DnB, Drum and Bass, and Dubstep (Drum&Bass)");             //Local XML
                //RunForXML(@"c:\temp\dnbradioarchive.XML", @"C:\homeboy\DnbRadio.com - Fresh Jungle, DnB, Drum and Bass, and Dubstep (Drum&Bass)");      //Local XML
                //End Of Application
                logger.addEvent(new cEvent(Severity.Information, "RSS Feed Service Ended"));
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("GrebiszDEVEventlog", ex.ToString() + "\n\n" + ex.StackTrace, EventLogEntryType.Error);
            }
        }
Esempio n. 2
0
        protected override void OnStart(string[] args)
        {
            try
            {
                //Get Settings
                bool   writetoeventfile     = bool.Parse(apr.GetValue("WriteToTextOutput", "".GetType()).ToString());
                bool   writetoeventlog      = bool.Parse(apr.GetValue("WriteToEventLogOutput", "".GetType()).ToString());
                string pathtooutputtext     = apr.GetValue("TextOutputPath", "".GetType()).ToString();
                bool   overwritetextiffound = bool.Parse(apr.GetValue("OverwriteTextIfFound", "".GetType()).ToString());
                string connectionstring     = apr.GetValue("DBConnectionString", "".GetType()).ToString();

                //Apply Settings
                logger.overwriteiffound = overwritetextiffound;
                logger.writeevents      = writetoeventlog;
                logger.writetext        = writetoeventfile;
                logger.wrtextdesc       = pathtooutputtext;
                //Database
                connection = new SqlConnection(connectionstring);
                connection.Open();
                DBContext = new RSSListener.SQL.Management(connection, logger);
                //timer
                //t.Interval = 3600000;
                t.Interval = 60000;
                t.Elapsed += t_Elapsed;

                //Operation
                logger.addEvent(new cEvent(Severity.Information, "RSS Feed Service Loaded"));
                try
                {
                    //executeRefresh();
                    t.Enabled = true;
                    t.Start();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog.WriteEntry("GrebiszDEVEventlog", ex.ToString() + "\n\n" + ex.StackTrace, EventLogEntryType.Error);
                }

                //End Of Application
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("GrebiszDEVEventlog", ex.ToString() + "\n\n" + ex.StackTrace, EventLogEntryType.Error);
                this.Stop();
            }
        }