aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Sdk/Ngc/Detail/Utf8ParseResult.cs
blob: 54a7e73ed18b6716c4b5b3915151691c80298df9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Ryujinx.Horizon.Common;

namespace Ryujinx.Horizon.Sdk.Ngc.Detail
{
    enum Utf8ParseResult
    {
        Success = 0,
        InvalidCharacter = 2,
        InvalidPointer = 0x16,
        InvalidSize = 0x22,
        InvalidString = 0x54,
    }

    static class Utf8ParseResultExtensions
    {
        public static Result ToHorizonResult(this Utf8ParseResult result)
        {
            return result switch
            {
                Utf8ParseResult.Success => Result.Success,
                Utf8ParseResult.InvalidSize => NgcResult.InvalidSize,
                Utf8ParseResult.InvalidString => NgcResult.InvalidUtf8Encoding,
                _ => NgcResult.InvalidPointer,
            };
        }
    }
}