示例#1
0
 public static void Initialize()
 {
     if (instance == null)
     {
         instance = new ArchiverMain();
     }
 }
        private static void ChannelUpdaterThreadProc(object obj)
        {
            ArchiverMain self = (ArchiverMain)obj;

            try
            {
                for (; ;)
                {
                    foreach (Rule rule in self.channelSettings.Rules)
                    {
                        if (rule.Enable)
                        {
                            foreach (BaseCondition cond in rule.Conditions)
                            {
                                cond.Process();
                            }

                            if (rule.Archive)
                            {
                                self.dbWriter.WriteChannels(rule.Channels);
                            }
                        }
                    }


                    Thread.Sleep(100);
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (System.Data.Common.DbException e)
            {
                self.dbWriter.Close();
                self.Accessor.Close();
                throw e;
            }
            if (self.dbWriter != null)
            {
                self.dbWriter.Close();
            }
        }
示例#3
0
        private static void ChannelUpdaterThreadProc(object obj)
        {
            ArchiverMain self = (ArchiverMain)obj;

            try
            {
                for (; ;)
                {
                    //System.Console.WriteLine("{0} ChannelUpdaterThreadProc: Start loop", System.DateTime.Now);
                    foreach (Rule rule in self.channelSettings.Rules)
                    {
                        if (rule.Enable)
                        {
                            foreach (BaseCondition cond in rule.Conditions)
                            {
                                cond.Process();
                            }

                            if (rule.Archive)
                            {
                                self.dbWriter.WriteChannels(rule.Channels);
                            }
                        }
                    }
                    Thread.Sleep(100);
                }
            }
            catch (ThreadAbortException)
            {
            }

            if (self.dbWriter != null)
            {
                self.dbWriter.Close();
            }
        }
示例#4
0
 public static void Deinitialize()
 {
     instance = null;
 }
示例#5
0
 public ArchiverAccessor(ArchiverMain arch)
 {
     _archiver = arch;
 }