Example #1
0
        public LongActionResult FileLength(string fileName, string id, string scope)
        {
            var url = GetUrl(
                Action.size,
                fileName,
                id,
                scope);

            using (var response = SendHttpRequest(url))
            {
                var result = new LongActionResult(CheckResponseStatusCode(response));
                if (result.Status == ActionStatus.Error)
                {
                    return(result);
                }

                var responseData = ReadTextResponse(response);
                if (!long.TryParse(responseData, out result.Value))
                {
                    result.Status           = ActionStatus.Error;
                    result.ErrorDescription = "Can't parse response";
                }
                return(result);
            }
        }
Example #2
0
        public LongActionResult FileLength(string fileName, string id, string scope)
        {
            var url = GetUrl(
                Action.size,
                fileName,
                id,
                scope);
            using (var response = SendHttpRequest(url))
            {

                var result = new LongActionResult(CheckResponseStatusCode(response));
                if (result.Status == ActionStatus.Error)
                    return result;

                var responseData = ReadTextResponse(response);
                if (!long.TryParse(responseData, out result.Value))
                {
                    result.Status = ActionStatus.Error;
                    result.ErrorDescription = "Can't parse response";
                }
                return result;
            }
        }