Esempio n. 1
0
        //////////////////////////////////////////////////////////////////////////
        public SpriteOptimizer(string projectFile, ILogConsumer logConsumer)
        {
            ProjectFile = projectFile;
            LogConsumer = logConsumer;

            LogConsumer.ClearLog();
            TotalSavedPixels = 0;
        }
Esempio n. 2
0
 public LogConsumerInfo(
     ILogConsumer consumer,
     LogLevel minLevel     = LogLevel.Trace,
     bool logSectionFinish = true)
 {
     Consumer         = consumer;
     LogSectionFinish = logSectionFinish;
     MinLevel         = minLevel;
 }
        public ILogReader Create(Stream data, ILogConsumer consumer)
        {
            byte[] guidBuffer = new byte[16];
            data.Read(guidBuffer, 0, guidBuffer.Length);

            if (new Guid(guidBuffer) != ExpendableListWriter.ID)
            {
                throw new CorruptedDataException();
            }

            return new ExpendableListLogReader(consumer, new ExpendableListReader(data));
        }
Esempio n. 4
0
 public void RemoveConsumer(ILogConsumer consumer)
 {
     try
     {
         _semaphoreSlim.Wait();
         _consumers.Remove(consumer);
     }
     finally
     {
         _semaphoreSlim.Release();
     }
 }
        public ExpendableListLogReader(ILogConsumer consumer,IListReader listWriter)
        {
            m_listWriter = listWriter;
            m_consumer = consumer;
            BinaryPackageDefinitionToGenericUnpackageDefinition packageDefinitionToGenericUnpackageDefinition = new BinaryPackageDefinitionToGenericUnpackageDefinition();
            m_dataUnpacker.AddPackageDefinition(packageDefinitionToGenericUnpackageDefinition);
            m_dataUnpacker.AddPackageDefinition(new GenericPropertyUnpackageDefinition());
            m_dataUnpacker.AddPackageDefinition(new ConstGenericPropertyUnpackageDefinition());
            var cacheStringUnpackageDefinition = new CacheStringUnpackageDefinition();
            m_dataUnpacker.AddPackageDefinition(cacheStringUnpackageDefinition);

            packageDefinitionToGenericUnpackageDefinition.PackageDefinitionRegistred += OnPackageDefinitionRegistred;
            cacheStringUnpackageDefinition.CacheStringDeserializer += OnCacheStringDeserializer;
        }
 public ILogReader GetLogReader(Stream data,ILogConsumer logConsumer,Stream otherData = null)
 {
     data.Position = 0;
     byte[] guidBuffer = new byte[16];
     data.Read(guidBuffer, 0, guidBuffer.Length);
     ILogReaderFactory logreader;
     if (!m_logReaderFactories.TryGetValue(new Guid(guidBuffer), out logreader))
     {
         throw new UnkownLogFileException();
     }
     else
     {
         return logreader.Create(data, logConsumer);
     }
 }
Esempio n. 7
0
 public void AddConsumer(ILogConsumer consumer)
 {
     try
     {
         _semaphoreSlim.Wait();
         if (!_consumers.Contains(consumer))
         {
             _logger.LogInformation("Add new consumer: {consumer}", consumer);
             _consumers.Add(consumer);
         }
     }
     finally
     {
         _semaphoreSlim.Release();
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Use the specified consumer for logging.
        /// </summary>
        /// <param name="consumer">The log consumer.</param>
        /// <param name="minLevel">The minimum level of the log message.</param>
        /// <param name="logSectionFinish">If set to <see langword="true"/> logs the section finish messages with elapsed time span.</param>
        /// <returns>
        /// The same <see cref="LogManager" /> instance.
        /// </returns>
        public LogManager Use(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true)
        {
            consumer.CheckNotNull(nameof(consumer));

            return(Use(new LogConsumerInfo(consumer, minLevel, logSectionFinish)));
        }
Esempio n. 9
0
        /// <summary>
        /// Adds the log consumer.
        /// </summary>
        /// <param name="typeNameOrAlias">The type name or alias of the log consumer.</param>
        /// <returns>The <see cref="AtataContextBuilder{TLogConsumer}"/> instance.</returns>
        public AtataContextBuilder <ILogConsumer> AddLogConsumer(string typeNameOrAlias)
        {
            ILogConsumer consumer = LogConsumerAliases.Resolve(typeNameOrAlias);

            return(AddLogConsumer(consumer));
        }
Esempio n. 10
0
        /// <summary>
        /// Use the specified consumer for logging.
        /// </summary>
        /// <param name="consumer">The log consumer.</param>
        /// <param name="minLevel">The minimum level of the log message.</param>
        /// <param name="logSectionFinish">If set to <c>true</c> logs the section finish messages with elapsed time span.</param>
        /// <returns>
        /// The same <see cref="LogManager" /> instance.
        /// </returns>
        public LogManager Use(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true)
        {
            consumer.CheckNotNull(nameof(consumer));

            return Use(new LogConsumerInfo(consumer, minLevel, logSectionFinish));
        }
Esempio n. 11
0
 public ZKConnection(string address, TimeSpan sessionTimeout, ILogConsumer logger)
 {
     this._address        = address;
     this._sessionTimeout = sessionTimeout;
     this._logWriter      = logger;
 }
Esempio n. 12
0
 public LogConsumerInfo(ILogConsumer consumer, LogLevel minLevel = LogLevel.Trace, bool logSectionFinish = true)
 {
     Consumer = consumer;
     LogSectionFinish = logSectionFinish;
     MinLevel = minLevel;
 }