public FileSystemPreparedGiasRepository(string dataDirectory)
        {
            _dataDirectory = Path.Combine(dataDirectory, "gias");

            _establishmentIndex  = new VersionIndex <long>(_dataDirectory, "establishments-index");
            _groupIndex          = new VersionIndex <long>(_dataDirectory, "groups-index");
            _localAuthorityIndex = new VersionIndex <int>(_dataDirectory, "local-authorities-index");
        }
Exemple #2
0
        public static string GetAssetIndexName(VersionIndex versionIndex)
        {
            if (versionIndex.AssetIndex != null)
            {
                return($"{versionIndex.AssetIndex.Sha1}/{versionIndex.AssetIndex.Id}");
            }

            return(versionIndex.Assets);
        }
Exemple #3
0
        public static string[] GetMinecraftArguments(VersionIndex index)
        {
            if (index.Arguments?.Game == null)
            {
                return(index.MinecraftArguments.Split(' '));
            }

            var result = new List <string>();

            foreach (var argToken in index.Arguments.Game)
            {
                if (argToken.Type == JTokenType.String)
                {
                    result.Add(argToken.Value <string>());
                }
            }

            return(result.ToArray());
        }
Exemple #4
0
        private void AppendLibsInfo(VersionIndex vIndex, VersionDataIndex dIndex, List <DownloadTarget> list)
        {
            foreach (var libraryInfo in vIndex.Libraries)
            {
                if (!IndexTool.IsLibraryAllowed(libraryInfo))
                {
                    continue;
                }

                var relativePath = IndexTool.GetLibraryPath(libraryInfo);

                if (!dIndex.Libs.ContainsKey(relativePath))
                {
                    _log.Warn($"Data index does not contain library {libraryInfo.Name}");
                    continue;
                }

                var path     = Path.Combine(_librariesPath, relativePath);
                var url      = $"{_storeUrl}/libraries/{relativePath}";
                var fileInfo = dIndex.Libs[relativePath];

                list.Add(new DownloadTarget(path, url, fileInfo.Size, fileInfo.Hash));
            }
        }
 public CachedVersionInfo(VersionIndex version)
 {
     Id          = version.Id;
     ReleaseTime = version.ReleaseTime;
 }
Exemple #6
0
 public static string GetAssetIndexPath(VersionIndex versionIndex)
 {
     return($"{GetAssetIndexName(versionIndex)}.json");
 }
Exemple #7
0
        public FileSystemPreparedUkrlpRepository(string dataDirectory)
        {
            _dataDirectory = Path.Combine(dataDirectory, "ukrlp");

            _providerIndex = new VersionIndex <long>(_dataDirectory, "providers-index");
        }