コード例 #1
0
ファイル: Logger.cs プロジェクト: henrihein/Ceebeetle
 static public void InitLogging(CCBConfig mainConf)
 {
     m_logfilepath = mainConf.MakeLogFilePath(DateTime.Now.Ticks);
     m_logger      = new CCBLogger(m_logfilepath, mainConf.LogLevel);
     m_logger.LogTime("Ceebeetle Start of log\n-------------------------------------------");
     m_nulllogger = new CCBLogger();
 }
コード例 #2
0
ファイル: Store.cs プロジェクト: henrihein/Ceebeetle
        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);
        }
コード例 #3
0
ファイル: Store.cs プロジェクト: henrihein/Ceebeetle
        public bool SaveStores(CCBConfig conf)
        {
            XmlWriter xmlWriter = null;
            CCBLogger logger    = CCBLogConfig.GetLogger();

            lock (this)
            {
                try
                {
                    DataContractSerializer dsWriter = new DataContractSerializer(typeof(CCBStoreManager));

                    conf.MaybeBackup(conf.GetStoreTmpFilePath());
                    xmlWriter = XmlWriter.Create(conf.GetStoreTmpFilePath());
                    dsWriter.WriteObject(xmlWriter, this);
                    xmlWriter.Flush();
                    xmlWriter.Close();
                    m_dirty = false;
                    try
                    {
                        System.IO.File.Copy(conf.GetStoreTmpFilePath(), conf.GetStoreFilePath(), true);
                    }
                    catch (System.IO.IOException ioex)
                    {
                        logger.Error("Error copying file: " + ioex.ToString());
                    }
                    return(true);
                }
                catch (IOException ioex)
                {
                    logger.Error("IO Exception saving store definitions: " + ioex.ToString());
                }
                catch (XmlException xmlex)
                {
                    logger.Error("XML Exception saving store definitions: " + xmlex.ToString());
                }
                catch (Exception ex)
                {
                    logger.Error("Exception saving store definitions: " + ex.ToString());
                }
            }
            if (null != xmlWriter)
            {
                xmlWriter.Close();
            }
            return(false);
        }
コード例 #4
0
ファイル: WindowManager.cs プロジェクト: henrihein/Ceebeetle
 public CCBWindow()
     : base()
 {
     m_logger = CCBLogConfig.GetLogger();
 }