Beispiel #1
0
        public void MainLoop()
        {
            m_event = new System.Threading.ManualResetEvent(false);
            m_esmi = new CarverLab.Utility.EncodingServiceMonitorInfo();
            m_es = new CarverLab.Utility.EncodingService();
            //m_log = new CarverLabUtility.Logger("EncodingServiceMonitor");

            m_sESMIFile = @"c:\EncodingServiceMonitorInfo.xml";
            if (!File.Exists(m_sESMIFile))
            {
                SerializeESMI();
            }
            m_sESIFile = @"c:\EncodingServiceInfo.xml";
            if (!File.Exists(m_sESIFile))
            {
                SerializeES();
            }
            UpdateViews();
            m_watcher = new System.IO.FileSystemWatcher(@"c:\","EncodingServiceInfo.xml");
            m_watcher.NotifyFilter = System.IO.NotifyFilters.CreationTime |
                System.IO.NotifyFilters.LastWrite;
            m_watcher.Changed += new System.IO.FileSystemEventHandler(m_watcher_Changed);
            m_watcher.Created += new System.IO.FileSystemEventHandler(m_watcher_Changed);
            m_watcher.Deleted += new System.IO.FileSystemEventHandler(m_watcher_Changed);
            m_watcher.EnableRaisingEvents = true;

            int iCount = 0;
            while (!IsDone)
            {
                System.Threading.Thread.Sleep(1000);
                // just in case the file watcher doesn't get updated!
                if (++iCount > 300)
                {
                    UpdateViews();
                }
            }
        }
Beispiel #2
0
        public void Deserialize()
        {
            System.Xml.Serialization.XmlSerializer xmls = new System.Xml.Serialization.XmlSerializer(typeof(CarverLab.Utility.EncodingService));
            System.IO.FileStream fs = new System.IO.FileStream(m_sLogFile,System.IO.FileMode.OpenOrCreate,System.IO.FileAccess.ReadWrite,System.IO.FileShare.ReadWrite);

            m_esi = (CarverLab.Utility.EncodingService)xmls.Deserialize(fs);
            fs.Close();
        }
Beispiel #3
0
 public EncodingServiceInfo()
 {
     m_esi = new CarverLab.Utility.EncodingService();
 }
Beispiel #4
0
 public void Clear()
 {
     m_esi = null;
     m_esi = new CarverLab.Utility.EncodingService();
 }