Пример #1
0
 /// <summary>Initializes a new instance of the <see cref="Logger"/> class
 /// Log file will be created automatically if not yet exists, else it can be either a fresh new file or append to the existing file.
 /// Default is create a fresh new log file.</summary>
 /// <param name="conf">ConfigurationObj - configuration object</param>
 /// <param name="append">True to append to existing log file, False to overwrite and create new log file</param>
 public Logger(ConfigurationObj conf, bool append = false)
 {
     this.Conf           = conf;
     this.DateTimeFormat = DateTimeFormatString;
     this.LogFile        = this.GetLogFileName();
     this.LogItems       = new List <LogItem>();
     this.CreateLogFile(append);
 }
Пример #2
0
 /// <summary>Initializes a new instance of the <see cref="Logger"/> class
 /// Log file will be created automatically if not yet exists, else it can be either a fresh new file or append to the existing file.
 /// Default is create a fresh new log file.</summary>
 /// <param name="writeToGui">CallBack function</param>
 /// <param name="append">True to append to existing log file, False to overwrite and create new log file</param>
 public Logger(ConfigurationObj conf, Action <string> writeToGui, bool append = false)
 {
     this.Conf           = conf;
     this.DateTimeFormat = DateTimeFormatString;
     this.LogFile        = this.GetLogFileName();
     this.LogItems       = new List <LogItem>();
     this.TriggerLogLine = writeToGui;
     this.CreateLogFile(append);
 }
Пример #3
0
        public VGCore(string configFile = null)
        {
            this.preLogItems = new List <LogItem>();
            this.Conf        = new ConfigurationObj(configFile, this);

            this.Log = new Logger.Logger(this.Conf, false);

            // after logger is initialized we need to put the log Items from preLogItems to it
            foreach (LogItem item in preLogItems)
            {
                this.Log.LogItems.Add(item);
            }
            preLogItems.Clear();
        }
Пример #4
0
        public static ConfigurationObj MagicMapper(this TblConfiguration item)
        {
            if (item == null)
            {
                return(null);
            }

            ConfigurationObj obj = new ConfigurationObj
            {
                ApplicationName             = item.ApplicationName,
                HostAddress                 = item.HostAddress,
                MailServer                  = item.MailServer,
                BookImageFileExtension      = item.BookImageFileExtension,
                BookMediaImageFileExtension = item.BookMediaImageFileExtension,
                BookMediaMediaFileExtension = item.BookMediaMediaFileExtension
            };

            return(obj);
        }