AK.F1.Timing.Utility.Tms.Operations.WriteStatisticsOperation.Run C# (CSharp) Method

Run() public method

public Run ( ) : void
return void
        public override void Run()
        {
            object obj;
            var numberOfObjects = 0L;
            var numberOfObjectByType = new Dictionary<Type, long>();

            using(var input = File.OpenRead(_path))
            using(var reader = new DecoratedObjectReader(input))
            {
                while((obj = reader.Read<object>()) != null)
                {
                    ++numberOfObjects;
                    if(numberOfObjectByType.ContainsKey(obj.GetType()))
                    {
                        ++numberOfObjectByType[obj.GetType()];
                    }
                    else
                    {
                        numberOfObjectByType[obj.GetType()] = 1;
                    }
                }
            }

            var fileInfo = new FileInfo(_path);

            WriteStatistics(new Statistics
            {
                FileName = fileInfo.Name,
                FileLength = fileInfo.Length,
                NumberOfObjects = numberOfObjects,
                NumberOfObjectByType = numberOfObjectByType
            });
        }