Ejemplo n.º 1
0
        public bool CheckViewExists()
        {
            var client   = ClientLocator.Locate();
            var request  = client.CreateRequest(this.DesignDocument + "/");
            var response = request.GetResponse();

            using (var sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8, true))
                using (var jsonReader = new JsonTextReader(sr))
                {
                    while (jsonReader.Read())
                    {
                        if (jsonReader.TokenType == JsonToken.PropertyName &&
                            jsonReader.Depth == 1 &&
                            ((string)jsonReader.Value) == "views")
                        {
                            while (jsonReader.Read())
                            {
                                if (jsonReader.TokenType == JsonToken.PropertyName && (string)jsonReader.Value == IndexName)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                }

            return(false);
        }
Ejemplo n.º 2
0
        private async Task <bool> ValidateRequestWrapperAsync()
        {
            if (RequestWrapper != null)
            {
                if (await RequestWrapper.CheckAvaliableAsync())
                {
                    return(true);
                }
            }
            string lolPath = ClientLocator.GetLolPath();

            if (lolPath == null)
            {
                return(false);
            }
            RequestWrapper = new RequestWrapper(lolPath);
            return(await RequestWrapper.CheckAvaliableAsync());
        }