virtual public bool FromString(string value)
        {
            var tokens = value.Split(ContextSeparator);

            if (tokens.Length != 3)
            {
                return(false);
            }

            UploadId   = tokens[0];
            ContentMd5 = tokens[1];
            var partStr = tokens[2];

            var partTokens = partStr.Split(PartContextSeparator);

            if (partTokens.Length <= 1)
            {
                return(false);
            }

            PartContextList = PartContextList ?? new List <ResumablePartContext>();
            for (int i = 0; i < partTokens.Length; i++)
            {
                var partContext = new ResumablePartContext();
                if (!partContext.FromString(partTokens[i]))
                {
                    return(false);
                }

                PartContextList.Add(partContext);
            }
            return(true);
        }
Example #2
0
        public override bool FromString(string value)
        {
            var tokens = value.Split(ContextSeparator);

            if (tokens.Length != 4)
            {
                return(false);
            }

            ETag = tokens[0];
            if (!string.IsNullOrEmpty(tokens[1]))
            {
                ContentMd5 = tokens[1];
            }

            if (!string.IsNullOrEmpty(tokens[2]))
            {
                Crc64 = tokens[2];
            }

            var partStr    = tokens[3];
            var partTokens = partStr.Split(PartContextSeparator);

            if (partTokens.Length <= 1)
            {
                return(false);
            }

            PartContextList = PartContextList ?? new List <ResumablePartContext>();
            for (int i = 0; i < partTokens.Length; i++)
            {
                var partContext = new ResumablePartContext();
                if (!partContext.FromString(partTokens[i]))
                {
                    return(false);
                }

                PartContextList.Add(partContext);
            }
            return(true);
        }