예제 #1
0
                static int ParseConflictingEntityPosition(StorageExtendedErrorInformation error)
                {
                    var lines = error.ErrorMessage.Trim().Split('\n');

                    if (lines.Length != 3)
                    {
                        throw UnexpectedStorageResponseException.ConflictExceptionMessageShouldHaveExactlyThreeLines(error);
                    }

                    var semicolonIndex = lines[0].IndexOf(":", StringComparison.Ordinal);

                    if (semicolonIndex == -1)
                    {
                        throw UnexpectedStorageResponseException.ConflictExceptionMessageShouldHaveSemicolonOnFirstLine(error);
                    }

                    int position;

                    if (!int.TryParse(lines[0].Substring(0, semicolonIndex), out position))
                    {
                        throw UnexpectedStorageResponseException.UnableToParseTextBeforeSemicolonToInteger(error);
                    }

                    return(position);
                }