Пример #1
0
        public static string GetNugetVersion()
        {
            string v = APIHelper.CallAPI("https://api.nuget.org/v3-flatcontainer/walkingtec.mvvm.mvc/index.json").Result;
            var    i = v.LastIndexOf("\"");

            v = v.Substring(0, i);
            i = v.LastIndexOf("\"");
            v = v.Substring(i + 1);
            return(v);
        }
Пример #2
0
        public static string GetNugetVersion(string start = null, bool pre = false)
        {
            NugetInfo v = APIHelper.CallAPI <NugetInfo>($"https://api-v2v3search-0.nuget.org/query?q=WalkingTec.Mvvm.Mvc&prerelease={pre.ToString().ToLower()}").Result;

            if (string.IsNullOrEmpty(start))
            {
                return(v.data[0]?.version);
            }
            else
            {
                return(v.data[0].versions.Select(x => x.version).Where(x => x.StartsWith(start)).Last());
            }
        }
Пример #3
0
Файл: Utils.cs Проект: zz110/WTM
        public static string GetNugetVersion(string start = null, bool pre = false)
        {
            var Cache = GlobalServices.GetRequiredService <IDistributedCache>() as IDistributedCache;

            if (Cache.TryGetValue("nugetversion", out NugetInfo rv) == false || rv == null)
            {
                NugetInfo v    = APIHelper.CallAPI <NugetInfo>($"https://api-v2v3search-0.nuget.org/query?q=WalkingTec.Mvvm.Mvc&prerelease={pre.ToString().ToLower()}").Result;
                var       data = v;
                Cache.Add("nugetversion", data, new DistributedCacheEntryOptions()
                {
                    SlidingExpiration = new TimeSpan(0, 0, 36000)
                });
                rv = data;
            }

            if (string.IsNullOrEmpty(start))
            {
                return(rv.data[0]?.version);
            }
            else
            {
                return(rv.data[0].versions.Select(x => x.version).Where(x => x.StartsWith(start)).Last());
            }
        }
Пример #4
0
        public static string GetNugetVersion()
        {
            NugetInfo v = APIHelper.CallAPI <NugetInfo>("https://api-v2v3search-0.nuget.org/query?q=WalkingTec.Mvvm.Mvc&prerelease=false").Result;

            return(v.data[0]?.version);
        }