Example #1
0
 protected void Debug(string text)
 {
     if (null != m_logger)
     {
         m_logger.Debug(text);
     }
 }
Example #2
0
        public bool LoadStores(string docPath)
        {
            lock (this)
            {
                CCBLogger logger   = CCBLogConfig.GetLogger();
                XmlReader xsReader = null;

                try
                {
                    xsReader = XmlReader.Create(docPath);
                    DataContractSerializer dsReader = new DataContractSerializer(typeof(CCBStoreManager));
                    CCBStoreManager        stores   = (CCBStoreManager)dsReader.ReadObject(xsReader);

                    m_places.MergePlaces(stores.m_places);
                    MergeStores(stores.m_stores);
                    m_dirty = false;
                    xsReader.Close();
                    return(true);
                }
                catch (System.IO.FileNotFoundException nothere)
                {
                    logger.Debug(String.Format("No data file, not loading stores [{0}]", nothere.FileName));
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
                catch (System.Runtime.Serialization.SerializationException serex)
                {
                    logger.Error(String.Format("XML parsing error, not loading stores [{0}]", serex.ToString()));
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Exception reading store document: " + ex.ToString());
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
            }
            return(false);
        }