/// <summary>
        /// Constructor.
        /// </summary>
        public CsvFileRepository(
            IConfigReader config,
            IFileSystemFacade fileSystemFacade)
        {
            _configReader     = config;
            _fileSystemFacade = fileSystemFacade;
            _logger           = LogManager.GetCurrentClassLogger();

            BaseDirectory = _configReader.Settings.WorkingDirectoryBase;
            if (string.IsNullOrWhiteSpace(BaseDirectory) || string.Equals(BaseDirectory.ToLower(), "desktop"))
            {
                BaseDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            WorkingDirectory = Path.Combine(BaseDirectory, _configReader.Settings.WorkingDirectory);
            BackupDirectory  = Path.Combine(WorkingDirectory, _configReader.Settings.BackupDirectory);

            _separator         = _configReader.Settings.CsvSeparator;
            _dateFormat        = _configReader.Settings.DateFormatForFileName;
            _fileNameExtension = _configReader.Settings.CsvFileNameExtension;
            _cultureInfo       = new CultureInfo(_configReader.Settings.CultureInfo);

            _logger.Debug($"Base directory is {BaseDirectory} from config file.");
            _logger.Debug($"Working directory is {WorkingDirectory} from config file.");
            _logger.Debug($"Backup directory is {BackupDirectory} from config file.");

            _logger.Debug($"File name for file writing is {_fileName} from config file.");
            _logger.Debug($"File name extension is {_fileNameExtension} from config file.");
            _logger.Debug($"Culture info for file writing is {_cultureInfo} from config file.");
            _logger.Debug($"CSV separator is {_separator} from config file.");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an instance of a DurableMemoryRepository
        /// </summary>
        /// <param name="path">The full path to the location where the JSON repository will be stored.</param>
        /// <param name="fileFacade">Helper facade that implements common file system operations</param>
        public DurableMemoryRepository(string path, IFileSystemFacade fileFacade)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            if (fileFacade == null)
            {
                throw new ArgumentNullException("fileFacade");
            }

            _path       = path;
            _fileFacade = fileFacade;

            _readWriteLock.EnterWriteLock();
            try
            {
                _fileFacade.CreateDirectoryIfNotExists(_path);
                InitializeNextAvailableId();
                InitializeDictionary();
            }
            finally
            {
                _readWriteLock.ExitWriteLock();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor for DI.
        /// </summary>
        /// <param name="fileSystemFacade"></param>
        public IsinsCsvFileRepository(
            IConfigReader config,
            IFileSystemFacade fileSystemFacade)
            : base(config, fileSystemFacade)
        {
            _fileName = _configReader.Settings.IsinFileName;
            _logger.Debug($"Isin filename is {_fileName} from config file.");

            _entities = new HashSet <INameToIsin>();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigProviderFactory"/> class.
 /// </summary>
 /// <param name="applicationAssemblyName">A string containing the assembly name of the application using the Factory</param>
 /// <param name="configServiceHttpClient">HTTP client implementation that will be used internally by the ConfigProvider to talk to Habitat Server</param>
 /// <param name="fileSystem">A wrapper for filesystem access.  This is used by the ConfigProvider to manage local storage of config data</param>
 internal ConfigProviderFactory(string applicationAssemblyName = null, HttpClient configServiceHttpClient = null, IFileSystemFacade fileSystem = null)
 {
     _applicationAssemblyName = applicationAssemblyName ?? GetType().Assembly.GetName().Name;
     _configServiceHttpClient = configServiceHttpClient;
     _fileSystem = fileSystem ?? new FileSystemFacade();
     if (_configServiceHttpClient == null)
     {
         _configServiceHttpClient             = new HttpClient();
         _configServiceHttpClient.BaseAddress = new Uri(DefaultServerUrl);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigProviderFactory"/> class.
 /// </summary>
 /// <param name="applicationAssemblyName">A string containing the assembly name of the application using the Factory</param>
 /// <param name="configServiceHttpClient">HTTP client implementation that will be used internally by the ConfigProvider to talk to Habitat Server</param>
 /// <param name="fileSystem">A wrapper for filesystem access.  This is used by the ConfigProvider to manage local storage of config data</param>
 internal ConfigProviderFactory(string applicationAssemblyName = null, HttpClient configServiceHttpClient = null, IFileSystemFacade fileSystem = null)
 {
     _applicationAssemblyName = applicationAssemblyName ?? GetType().Assembly.GetName().Name;
     _configServiceHttpClient = configServiceHttpClient;
     _fileSystem = fileSystem ?? new FileSystemFacade();
     if (_configServiceHttpClient == null)
     {
         _configServiceHttpClient = new HttpClient();
         _configServiceHttpClient.BaseAddress = new Uri(DefaultServerUrl);
     }
 }
        public AnalysesCsvFileRepository(
            IConfigReader config,
            IFileSystemFacade fileSystemFacade)
            : base(config, fileSystemFacade)
        {
            WorkingDirectory = Path.Combine(
                WorkingDirectory,
                _configReader.Settings.WorkingDirectoryAnalyses);
            _logger.Debug($"Working directory is {WorkingDirectory} from config file.");

            _entities = new Dictionary <string, IAnalysis>();
        }
Ejemplo n.º 7
0
        public static async ValueTask <IReadOnlyCollection <T> > ParseCsv <T>(IFileSystemFacade source, string path, int columnCount, Func <string[], T> selector, Encoding encoding = null, bool trimHeader = true)
        {
            var folder = source as IFolderFacade ?? throw new ArgumentException("Source must be a folder.");
            var paths  = path.Split('/');

            for (int i = 0; i < paths.Length - 1; i++)
            {
                folder = await folder.GetFolderAsync(paths[i]);
            }

            var file = await folder.GetFileAsync(paths[paths.Length - 1]);

            if (file == null)
            {
                return(Array.Empty <T>());
            }

            var table = new List <T>();

            using (var reader = new StreamReader(await file.OpenReadAsync(), encoding ?? Encoding.UTF8))
            {
                if (trimHeader)
                {
                    await reader.ReadLineAsync();
                }
                while (!reader.EndOfStream)
                {
                    string line = await reader.ReadLineAsync();

                    if (string.IsNullOrEmpty(line))
                    {
                        continue;
                    }

                    var s = line.Split(',');
                    if (s.Length != columnCount)
                    {
                        continue;
                    }

                    try
                    {
                        table.Add(selector(s.Select(x => x.Trim('\0')).ToArray()));
                    }
                    catch
                    {
                        // fail count ++
                    }
                }
            }
            return(table);
        }
Ejemplo n.º 8
0
        public MarketDataCsvFileRepository(
            IConfigReader config,
            IFileSystemFacade fileSystemFacade)
            : base(config, fileSystemFacade)
        {
            WorkingDirectory = Path.Combine(
                WorkingDirectory,
                _configReader.Settings.WorkingDirectoryRawDownloads);
            _logger.Debug($"Working directory is {WorkingDirectory} from config file.");

            _fileName = _configReader.Settings.MarketDataFileName;
            _logger.Debug($"Market data filename is {_fileName} from config file.");

            _entities = new HashSet <IMarketDataEntity>();
        }
Ejemplo n.º 9
0
        public RegistryCsvFileRepository(
            IConfigReader config,
            IFileSystemFacade fileSystemFacade)
            : base(config, fileSystemFacade)
        {
            WorkingDirectory = Path.Combine(
                WorkingDirectory,
                _configReader.Settings.WorkingDirectoryRegistry);
            _logger.Debug($"Working directory is {WorkingDirectory} from config file.");

            _fileName = _configReader.Settings.RegistryFileName;
            _logger.Debug($"Market data filename is {_fileName} from config file.");

            _entities = new HashSet <IRegistryEntry>();
        }
Ejemplo n.º 10
0
        public FileSystemStorage(IFileSystemFacade fileSystemFacade, IOptions <FileSystemStorageSettings> options)
        {
            this.fileSystemFacade = fileSystemFacade ?? throw new ArgumentNullException(nameof(fileSystemFacade));

            var settings = options?.Value ?? throw new ArgumentNullException(nameof(options));

            this.rootDirectory = settings.Root;
            if (String.IsNullOrWhiteSpace(rootDirectory))
            {
                throw new InvalidOperationException("Storage root is not configured");
            }

            this.excludePaths = (settings.ExcludePaths ?? Enumerable.Empty <string>())
                                .Select(GetFullPath)
                                .ToList();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="facade"></param>
        public ConfigReader(IFileSystemFacade facade)
        {
            _logger = LogManager.GetCurrentClassLogger();

            try
            {
                using (var stream = facade.Open("config.json"))
                {
                    Settings = JsonConvert.DeserializeObject <ConfigSettings>(stream.ReadToEnd());
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                throw;
            }
        }
Ejemplo n.º 12
0
Archivo: Player.cs Proyecto: silpheed/M
        public Player(IFileFinder fileFinder, IPlaylistReader playlistReader, IAudioStreamFactory audioStreamFactory, 
			IBackgroundWorkerFactory backgroundWorkerFactory, IFileSystemFacade fileSystem)
        {
            this.fileFinder = fileFinder;
            this.playlistReader = playlistReader;
            this.backgroundWorkerFactory = backgroundWorkerFactory;
            this.audioStreamFactory = audioStreamFactory;
            this.fileSystem = fileSystem;

            history = new List<string>();

            isStopped = true;
            isPlaying = false;
            isPaused = false;

            wasPausedBeforeBadSound = isPaused;
            loopType = LoopType.None;
            upto = 0;
        }
Ejemplo n.º 13
0
 public F1PerfViewTelemetryLapRepository(IFileSystemFacade fileSystemFacade)
 {
     fileSystem = fileSystemFacade;
 }
Ejemplo n.º 14
0
 public override void SetUp()
 {
     _fileSystem = CreateMock<IFileSystemFacade>();
     _configSettings = DynamicMock<IConfigSettingsFacade>();
     _searchQuery = CreateMock<ISearchQuery>();
     _fileFinder = new FileFinder(_fileSystem, _configSettings);
 }
 public F1PerfViewTelemetryLapRepository(IFileSystemFacade fileSystemFacade)
 {
     fileSystem = fileSystemFacade;
 }
Ejemplo n.º 16
0
 public override ValueTask <IReadOnlyCollection <ShipCreationEntity> > GetShipCreationAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Helper.ParseCsv(source, "createship.csv", 12,
                    s => new ShipCreationEntity
 {
     TimeStamp      = DateTime.SpecifyKind(DateTime.Parse(s[0]), DateTimeKind.Utc),
     SecretaryLevel = int.Parse(s[1]),
     Secretary      = (ShipInfoId)int.Parse(s[2]),
     Consumption    = new Materials
     {
         Fuel        = int.Parse(s[3]),
         Bullet      = int.Parse(s[4]),
         Steel       = int.Parse(s[5]),
         Bauxite     = int.Parse(s[6]),
         Development = int.Parse(s[7])
     },
     IsLSC          = bool.Parse(s[8]),
     ShipBuilt      = (ShipInfoId)int.Parse(s[9]),
     EmptyDockCount = int.Parse(s[10]),
     AdmiralLevel   = int.Parse(s[11])
 });
Ejemplo n.º 17
0
 async ValueTask <IReadOnlyCollection <EquipmentCreationEntity> > ILogProvider <EquipmentCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
 {
     using (var context = new INGLegacyContext(await(source as IFileFacade ?? throw new ArgumentException("Source must be a file.")).GetAccessPathAsync()))
         return((await context.DevelopmentTable.ToListAsync())
                .Select(x => new EquipmentCreationEntity
         {
             TimeStamp = DateTimeOffset.FromUnixTimeSeconds(x.time),
             IsSuccess = x.equipment != null,
             EquipmentCreated = (EquipmentInfoId)(x.equipment ?? 0),
             Consumption = new Materials
             {
                 Fuel = x.fuel,
                 Bullet = x.bullet,
                 Steel = x.steel,
                 Bauxite = x.bauxite
             },
             Secretary = (ShipInfoId)x.flagship,
             AdmiralLevel = x.hq_level
         }).ToList());
 }
Ejemplo n.º 18
0
 ValueTask <IReadOnlyCollection <ShipCreationEntity> > ILogProvider <ShipCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Helper.ParseCsv(source, "ConstructionRecord.csv", 13,
                    s => new ShipCreationEntity
 {
     TimeStamp   = DateTime.SpecifyKind(DateTime.Parse(s[2]), DateTimeKind.Local) - timeZone,
     ShipBuilt   = (ShipInfoId)int.Parse(s[0]),
     Consumption = new Materials
     {
         Fuel        = int.Parse(s[3]),
         Bullet      = int.Parse(s[4]),
         Steel       = int.Parse(s[5]),
         Bauxite     = int.Parse(s[6]),
         Development = int.Parse(s[7])
     },
     IsLSC          = int.Parse(s[8]) > 0,
     EmptyDockCount = int.Parse(s[9]),
     Secretary      = (ShipInfoId)int.Parse(s[10]),
     AdmiralLevel   = int.Parse(s[12])
 });
Ejemplo n.º 19
0
        ValueTask <IReadOnlyCollection <ShipCreationEntity> > ILogProvider <ShipCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
        {
            var ships = Compositor.Static <NavalBase>().MasterData.ShipInfos.ToDictionary(x => x.Name.Origin);

            return(Helper.ParseCsv(source, "建造報告書.csv", 12,
                                   s =>
            {
                var index = s[10].IndexOf('(');
                string secretaryName = s[10].Substring(0, index);
                string secretaryLevel = s[10].Substring(index + 3, s[10].Length - index - 4);
                if (secretaryLevel[0] == '.')
                {
                    secretaryLevel = secretaryLevel.Substring(1);
                }

                return new ShipCreationEntity
                {
                    TimeStamp = DateTime.SpecifyKind(DateTime.Parse(s[0]), DateTimeKind.Local) - timeZone,
                    SecretaryLevel = int.Parse(secretaryLevel),
                    Secretary = ships.TryGetOrDefault(secretaryName)?.Id ?? default,
                    ShipBuilt = ships.TryGetOrDefault(s[2])?.Id ?? default,
                    Consumption = new Materials
                    {
                        Fuel = int.Parse(s[4]),
                        Bullet = int.Parse(s[5]),
                        Steel = int.Parse(s[6]),
                        Bauxite = int.Parse(s[7]),
                        Development = int.Parse(s[8])
                    },
                    IsLSC = int.Parse(s[4]) >= 1000,
                    EmptyDockCount = int.Parse(s[9]),
                    AdmiralLevel = int.Parse(s[11])
                };
            }, shiftJIS));
Ejemplo n.º 20
0
 public FileFinder(IFileSystemFacade fileSystem, IConfigSettingsFacade configSettings)
 {
     this.fileSystem = fileSystem;
     this.configSettings = configSettings;
 }
Ejemplo n.º 21
0
 public virtual ValueTask <IReadOnlyCollection <BattleEntity> > GetBattleAndDropAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Empty <BattleEntity>();
Ejemplo n.º 22
0
 public ImageInfoProvider(IImageFacade imageFacade, IFileSystemFacade fileSystemFacade)
 {
     this.imageFacade      = imageFacade ?? throw new ArgumentNullException(nameof(imageFacade));
     this.fileSystemFacade = fileSystemFacade ?? throw new ArgumentNullException(nameof(fileSystemFacade));
 }
Ejemplo n.º 23
0
 public virtual ValueTask <IReadOnlyCollection <ExpeditionCompletionEntity> > GetExpeditionCompletionAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Empty <ExpeditionCompletionEntity>();
Ejemplo n.º 24
0
 public virtual ValueTask <IReadOnlyCollection <EquipmentCreationEntity> > GetEquipmentCreationAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Empty <EquipmentCreationEntity>();
Ejemplo n.º 25
0
 public override ValueTask <IReadOnlyCollection <EquipmentCreationEntity> > GetEquipmentCreationAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Helper.ParseCsv(source, "createitem.csv", 10,
                    s => new EquipmentCreationEntity
 {
     TimeStamp      = DateTime.SpecifyKind(DateTime.Parse(s[0]), DateTimeKind.Utc),
     SecretaryLevel = int.Parse(s[1]),
     Secretary      = (ShipInfoId)int.Parse(s[2]),
     Consumption    = new Materials
     {
         Fuel    = int.Parse(s[3]),
         Bullet  = int.Parse(s[4]),
         Steel   = int.Parse(s[5]),
         Bauxite = int.Parse(s[6])
     },
     IsSuccess        = bool.Parse(s[7]),
     EquipmentCreated = (EquipmentInfoId)int.Parse(s[8]),
     AdmiralLevel     = int.Parse(s[9])
 });
 public CsvTelemetryLapRepository(IFileSystemFacade fileSystemFacade)
 {
     fileSystem = fileSystemFacade;
 }
Ejemplo n.º 27
0
 public override void SetUp()
 {
     fileSystem = CreateMock<IFileSystemFacade>();
     playlistReader = new PlaylistReader(fileSystem);
 }
Ejemplo n.º 28
0
 public PlaylistReader(IFileSystemFacade fileSystem)
 {
     this.fileSystem = fileSystem;
 }
Ejemplo n.º 29
0
 public Crc32Calculator(IFileSystemFacade fileSystemFacade)
 {
     this.fileSystemFacade = fileSystemFacade ?? throw new ArgumentNullException(nameof(fileSystemFacade));
 }
Ejemplo n.º 30
0
 async ValueTask <IReadOnlyCollection <ShipCreationEntity> > ILogProvider <ShipCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
 {
     using (var context = new INGLegacyContext(await(source as IFileFacade ?? throw new ArgumentException("Source must be a file.")).GetAccessPathAsync()))
         return((await context.ConstructionTable.ToListAsync())
                .Select(x => new ShipCreationEntity
         {
             TimeStamp = DateTimeOffset.FromUnixTimeSeconds(x.time),
             ShipBuilt = (ShipInfoId)x.ship,
             Consumption = new Materials
             {
                 Fuel = x.fuel,
                 Bullet = x.bullet,
                 Steel = x.steel,
                 Bauxite = x.bauxite,
                 Development = x.dev_material
             },
             Secretary = (ShipInfoId)x.flagship,
             AdmiralLevel = x.hq_level,
             IsLSC = x.is_lsc,
             EmptyDockCount = x.empty_dock ?? 0
         }).ToList());
 }
Ejemplo n.º 31
0
 public CsvTelemetryLapRepository(IFileSystemFacade fileSystemFacade)
 {
     fileSystem = fileSystemFacade;
 }
Ejemplo n.º 32
0
        async ValueTask <IReadOnlyCollection <ExpeditionCompletionEntity> > ILogProvider <ExpeditionCompletionEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
        {
            var expeditions = Compositor.Static <NavalBase>().MasterData.Expeditions;

            using (var context = new INGLegacyContext(await(source as IFileFacade ?? throw new ArgumentException("Source must be a file.")).GetAccessPathAsync()))
                return((await context.ExpeditionTable.ToListAsync())
                       .Select(x => new ExpeditionCompletionEntity
                {
                    TimeStamp = DateTimeOffset.FromUnixTimeSeconds(x.time),
                    ExpeditionId = (ExpeditionId)x.expedition,
                    ExpeditionName = expeditions[(ExpeditionId)x.expedition].Name.Origin,
                    Result = (ExpeditionResult)x.result,
                    MaterialsAcquired = new Materials
                    {
                        Fuel = x.fuel ?? 0,
                        Bullet = x.bullet ?? 0,
                        Steel = x.steel ?? 0,
                        Bauxite = x.bauxite ?? 0
                    },
                    RewardItem1_ItemId = x.item1,
                    RewardItem1_Count = x.item1_count,
                    RewardItem2_ItemId = x.item2,
                    RewardItem2_Count = x.item2_count
                }).ToList());
        }
Ejemplo n.º 33
0
 public override void SetUp()
 {
     fileFinder = CreateMock<IFileFinder>();
     playlistReader = CreateMock<IPlaylistReader>();
     audioStreamFactory = CreateMock<IAudioStreamFactory>();
     backgroundWorkerFactory = CreateMock<IBackgroundWorkerFactory>();
     fileSystem = DynamicMock<IFileSystemFacade>();
     player = new Player(fileFinder, playlistReader, audioStreamFactory, backgroundWorkerFactory, fileSystem);
 }
Ejemplo n.º 34
0
 ValueTask <IReadOnlyCollection <EquipmentCreationEntity> > ILogProvider <EquipmentCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Helper.ParseCsv(source, "DevelopmentRecord.csv", 11,
                    s => new EquipmentCreationEntity
 {
     TimeStamp        = DateTime.SpecifyKind(DateTime.Parse(s[2]), DateTimeKind.Local) - timeZone,
     EquipmentCreated = (EquipmentInfoId)int.Parse(s[0]),
     Consumption      = new Materials
     {
         Fuel    = int.Parse(s[3]),
         Bullet  = int.Parse(s[4]),
         Steel   = int.Parse(s[5]),
         Bauxite = int.Parse(s[6])
     },
     Secretary    = (ShipInfoId)int.Parse(s[7]),
     AdmiralLevel = int.Parse(s[10])
 });
Ejemplo n.º 35
0
        ValueTask <IReadOnlyCollection <ExpeditionCompletionEntity> > ILogProvider <ExpeditionCompletionEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
        {
            var expeditionTable = Compositor.Static <NavalBase>().MasterData.Expeditions;

            return(Helper.ParseCsv(source, "mission.csv", 11,
                                   s => new ExpeditionCompletionEntity
            {
                TimeStamp = DateTime.SpecifyKind(DateTime.Parse(s[0]), DateTimeKind.Utc),
                ExpeditionName = s[1],
                ExpeditionId = expeditionTable.FirstOrDefault(e => e.Name.Origin == s[1])?.Id ?? default,
                Result = (ExpeditionResult)int.Parse(s[2]),
                MaterialsAcquired = new Materials
                {
                    Fuel = int.Parse(s[3]),
                    Bullet = int.Parse(s[4]),
                    Steel = int.Parse(s[5]),
                    Bauxite = int.Parse(s[6])
                },
                RewardItem1 = int.Parse(s[7]) > 0 ?
                              new ItemRecord
                {
                    ItemId = (UseItemId)int.Parse(s[7]),
                    Count = int.Parse(s[8])
                } : (ItemRecord?)null,
                RewardItem2 = int.Parse(s[9]) > 0 ?
                              new ItemRecord
                {
                    ItemId = (UseItemId)int.Parse(s[9]),
                    Count = int.Parse(s[10])
                } : (ItemRecord?)null
            }));
Ejemplo n.º 36
0
 public virtual ValueTask <IReadOnlyCollection <MaterialsChangeEntity> > GetMaterialsChangeAsync(IFileSystemFacade source, TimeSpan timeZone)
 => Empty <MaterialsChangeEntity>();
Ejemplo n.º 37
0
        ValueTask <IReadOnlyCollection <ShipCreationEntity> > ILogProvider <ShipCreationEntity> .GetLogsAsync(IFileSystemFacade source, TimeSpan timeZone)
        {
            var ships = Compositor.Static <NavalBase>().MasterData.ShipInfos.ToDictionary(x => x.Name.Origin);

            return(Helper.ParseCsv(source, "createship/data", 12,
                                   s =>
            {
                var index = s[10].IndexOf('(');
                string secretaryName = s[10].Substring(0, index);
                string secretaryLevel = s[10].Substring(index + 4, s[10].Length - index - 5);

                return new ShipCreationEntity
                {
                    TimeStamp = DateTimeOffset.FromUnixTimeMilliseconds(long.Parse(s[0])),
                    ShipBuilt = ships.TryGetOrDefault(s[2])?.Id ?? default,
                    Consumption = new Materials
                    {
                        Fuel = int.Parse(s[4]),
                        Bullet = int.Parse(s[5]),
                        Steel = int.Parse(s[6]),
                        Bauxite = int.Parse(s[7]),
                        Development = int.Parse(s[8])
                    },
                    EmptyDockCount = int.Parse(s[9]),
                    Secretary = ships.TryGetOrDefault(secretaryName)?.Id ?? default,
                    SecretaryLevel = int.Parse(secretaryLevel),
                    AdmiralLevel = int.Parse(s[11])
                };
            }, trimHeader: false));