예제 #1
0
    private void UpdateGetTagsRequest(UnityWebRequest webRequest)
    {
        if (isGetTagsRequestDone ||
            !webRequest.isDone)
        {
            return;
        }

        isGetTagsRequestDone = true;
        if (webRequest.result is not UnityWebRequest.Result.Success)
        {
            Debug.LogError($"Getting tags from '{webRequest.url}'"
                           + $" has result {webRequest.result}.\n{webRequest.error}");
            return;
        }

        string getTagsResponse = webRequest.downloadHandler.text;
        List <RepositoryTagDto> repositoryTagDtos = JsonConverter.FromJson <List <RepositoryTagDto> >(getTagsResponse);

        if (repositoryTagDtos == null)
        {
            return;
        }

        RepositoryTagDto newestTagDto = FindNewestTagDto(repositoryTagDtos);

        if (newestTagDto == null)
        {
            return;
        }

        StartGetRemoteVersionFileRequest(newestTagDto.name);
    }
예제 #2
0
    private RepositoryTagDto FindNewestTagDto(IEnumerable <RepositoryTagDto> tagDtos)
    {
        RepositoryTagDto newestTagDto = null;

        foreach (RepositoryTagDto tagDto in tagDtos)
        {
            if (newestTagDto == null ||
                CompareVersionString(newestTagDto.name, tagDto.name) < 0)
            {
                newestTagDto = tagDto;
            }
        }

        return(newestTagDto);
    }