private static async Task<bool> IsV2Async(PackageSource source)
        {
            var url = new Uri(source.Url);
            if (url.IsFile || url.IsUnc)
            {
                return true;
            }

            using (var client = new Data.DataClient())
            {
                var result = await client.GetFile(url);
                if (result == null)
                {
                    return false;
                }

                var raw = result.Value<string>("raw");
                if (raw != null && raw.IndexOf("Packages", StringComparison.OrdinalIgnoreCase) != -1) 
                {
                    return true;
                }

                return false;
            }
        }
Beispiel #2
0
        public static async Task<bool> IsV2(PackageSource source)
        {
            var url = new Uri(source.Url);

            // If the url is a directory, then it's a V2 source
            if (url.IsFile || url.IsUnc) 
            {
                return !File.Exists(url.LocalPath);
            }

            using (var client = new Data.DataClient())
            {
                var result = await client.GetFile(url);
                if (result == null)
                {
                    return false;
                }

                var raw = result.Value<string>("raw");
                if (raw != null && raw.IndexOf("Packages", StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return true;
                }

                return false;
            }
        }
Beispiel #3
0
        public static async Task <bool> IsV2(PackageSource source)
        {
            var url = new Uri(source.Url);

            // If the url is a directory, then it's a V2 source
            if (url.IsFile || url.IsUnc)
            {
                return(!File.Exists(url.LocalPath));
            }

            using (var client = new Data.DataClient())
            {
                var result = await client.GetFile(url);

                if (result == null)
                {
                    return(false);
                }

                var raw = result.Value <string>("raw");
                if (raw != null && raw.IndexOf("Packages", StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return(true);
                }

                return(false);
            }
        }
        private static async Task <bool> IsV2Async(PackageSource source)
        {
            var url = new Uri(source.Url);

            if (url.IsFile || url.IsUnc)
            {
                return(true);
            }

            using (var client = new Data.DataClient())
            {
                var result = await client.GetFile(url);

                if (result == null)
                {
                    return(false);
                }

                var raw = result.Value <string>("raw");
                if (raw != null && raw.IndexOf("Packages", StringComparison.OrdinalIgnoreCase) != -1)
                {
                    return(true);
                }

                return(false);
            }
        }
Beispiel #5
0
        public static void КомпилироватьЗависимыеТипыДанных(string ТипДанных, string domain)
        {
            foreach (var item in new ConfigurationClient().СписокЗависимыхТипов(ТипДанных, domain))
            {
                try
                {
                    var query = new Query();
                    query.Типы.Add("ТипДанных");
                    query.УсловияПоиска.Add(new Query.УсловиеПоиска()
                    {
                        Атрибут = "ИмяТипаДанных", Значение = item.Name
                    });
                    query.МестаПоиска.Add(new Query.МестоПоиска()
                    {
                        id_node = Convert.ToDecimal(ConfigurationClient.СистемныеПапки.азделТипы), МаксимальнаяГлубина = 1
                    });
                    var node = new Data.DataClient().Поиск(query, Хранилище.Конфигурация, domain).AsEnumerable().SingleOrDefault();
                    if (node == null)
                    {
                        continue;
                    }

                    Компилятор.КомпилироватьТипДанных(node.Field <decimal>("id_node"), domain);
                    Cache.Remove(Cache.Key <КешСписокАтрибутов>(domain, item.Name));
                }
                catch (Exception ex)
                {
                    ConfigurationClient.WindowsLog(ex.ToString(), "", domain, "КомпилироватьЗависимыеТипыДанных", ТипДанных);
                    throw ex;
                }
            }
        }
        private static async Task <bool> IsV3Async(PackageSource source)
        {
            var url = new Uri(source.Url);

            if (url.IsFile || url.IsUnc)
            {
                return(File.Exists(url.LocalPath));
            }

            using (var client = new Data.DataClient())
            {
                var v3index = await client.GetFile(url);

                if (v3index == null)
                {
                    return(false);
                }

                var status = v3index.Value <string>("version");
                if (status != null && status.StartsWith("3.0"))
                {
                    return(true);
                }

                return(false);
            }
        }
Beispiel #7
0
        public async Task gRPC()
        {
            using var channel = GrpcChannel.ForAddress(HOST, new GrpcChannelOptions { MaxReceiveMessageSize = 100 * 1024 * 1024 });
            var client = new Data.DataClient(channel);
            var reply  = await client.EventLogDataAsync(new EventLogQuery { Number = TopN ?? 1, Source = EventLogQuery.Types.Source.Memory });

            Console.WriteLine($"{nameof(gRPC)} size [{reply.CalculateSize()}] items: {reply.Items?.Count}");
        }
Beispiel #8
0
        public async Task gRPCStreamFirst()
        {
            using var channel = GrpcChannel.ForAddress(HOST);
            var client = new Data.DataClient(channel);

            using var call = client.EventLogDataStream(new EventLogQuery { Number = TopN ?? 1, Source = EventLogQuery.Types.Source.Memory });
            var _items = 1;
            var _first = call?.ResponseStream?.Current;
            var _size  = _first?.CalculateSize();

            Console.WriteLine($"{nameof(gRPCStreamFirst)} size [{_size}] items: {_items}");
        }
Beispiel #9
0
        public async Task gRPCStream()
        {
            using var channel = GrpcChannel.ForAddress(HOST);
            var client = new Data.DataClient(channel);

            using var call = client.EventLogDataStream(new EventLogQuery { Number = TopN ?? 1, Source = EventLogQuery.Types.Source.Memory });

            var _size  = 0;
            var _items = 0;

            await foreach (var response in call?.ResponseStream?.ReadAllAsync())
            {
                _size += response.CalculateSize();
                _items++;
            }
            Console.WriteLine($"{nameof(gRPCStream)} size [{_size}] items: {_items}");
        }
        private static async Task<bool> IsV3Async(PackageSource source)
        {
            var url = new Uri(source.Url);
            if (url.IsFile || url.IsUnc)
            {
                return File.Exists(url.LocalPath);
            }

            using (var client = new Data.DataClient())
            {
                var v3index = await client.GetFile(url);
                if (v3index == null)
                {
                    return false;
                }

                var status = v3index.Value<string>("version");
                if (status != null && status.StartsWith("3.0"))
                {
                    return true;
                }

                return false;
            }
        }
 public QueryMusicController(Data.DataClient Dc)
 {
     _Dc = Dc;
 }