| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | using ZeroC.Slice; |
| | | 4 | | |
| | | 5 | | namespace IceRpc.Internal; |
| | | 6 | | |
| | | 7 | | /// <summary>Provides an extension method for <see cref="SliceDecoder" /> to decode a fragment.</summary> |
| | | 8 | | internal static class FragmentSliceDecoderExtensions |
| | | 9 | | { |
| | | 10 | | internal static string DecodeFragment(this ref SliceDecoder decoder) => |
| | 2772 | 11 | | decoder.DecodeSize() switch |
| | 2772 | 12 | | { |
| | 2770 | 13 | | 0 => "", |
| | 2 | 14 | | 1 => Uri.EscapeDataString(decoder.DecodeString()), |
| | 0 | 15 | | _ => throw new InvalidDataException("Received a Fragment with too many sequence elements.") |
| | 2772 | 16 | | }; |
| | | 17 | | } |