aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Horizon/Sdk/Ngc/Detail/Utf8ParseResult.cs
blob: bf065f86ab1a3d986aa7d5d979020867d8ce82e9 (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,
            };
        }
    }
}