コード例 #1
0
        public NbtData Load(WorldInfo world)
        {
            var data = _component.Load(world);

            var levelPath = Path.Combine(_config.ServerLocation.FullName, world.Name, LevelNbtFilename);

            if (!File.Exists(levelPath))
            {
                return(data);
            }

            var converter = new Process();

            converter.StartInfo.RedirectStandardOutput = true;
            converter.StartInfo.FileName  = _config.PythonLocation.FullName;
            converter.StartInfo.Arguments = $"{_config.NbtConverterLocation} {levelPath}";
            converter.Start();

            var nbt = converter.StandardOutput.ReadToEnd();

            converter.WaitForExit();

            data.Level = nbt;
            return(data);
        }
コード例 #2
0
        public RunImport Import(WorldInfo world)
        {
            _logger.LogInformation($"Import started for world {world.Name}.");

            var run = new RunImport(world);

            run.Dimensions   = _dimensionLoader.Load(world);
            run.Stats        = _statsLoader.Load(world);
            run.Achievements = _achievementLoader.Load(world);
            run.Logs         = _logLoader.Load(run);
            run.EndScreens   = _playerNbtLoader.Load(world);
            run.NbtData      = _nbtLoader.Load(world);

            _logger.LogInformation($"Import finished for world {world.Name}.");
            return(run);
        }
コード例 #3
0
        public NbtData Load(WorldInfo world)
        {
            var data = _component.Load(world);

            var playerPath = Path.Combine(_config.ServerLocation.FullName, world.Name, PlayerFolder);

            if (!Directory.Exists(playerPath))
            {
                return(data);
            }

            var playerFiles = Directory.GetFiles(playerPath, "*.dat");

            foreach (var filepath in playerFiles)
            {
                var file     = new FileInfo(filepath);
                var playerId = file.Name.Replace(".dat", string.Empty);
                var nbt      = loadNbt(filepath);
                data.Players.Add(playerId, nbt);
            }

            return(data);
        }