aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs
blob: 0b3682627a42f149e91b59ba71f4b5471084bdab (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Ryujinx.Common;
using System;
using System.IO;

namespace Ryujinx.HLE.HOS.Applets.Browser
{
    class BrowserOutput
    {
        public BrowserOutputType Type { get; }
        public byte[] Value { get; }

        public BrowserOutput(BrowserOutputType type, byte[] value)
        {
            Type  = type;
            Value = value;
        }

        public BrowserOutput(BrowserOutputType type, uint value)
        {
            Type  = type;
            Value = BitConverter.GetBytes(value); 
        }

        public BrowserOutput(BrowserOutputType type, ulong value)
        {
            Type  = type;
            Value = BitConverter.GetBytes(value);
        }

        public BrowserOutput(BrowserOutputType type, bool value)
        {
            Type  = type;
            Value = BitConverter.GetBytes(value);
        }

        public void Write(BinaryWriter writer)
        {
            writer.WriteStruct(new WebArgTLV
            {
                Type = (ushort)Type,
                Size = (ushort)Value.Length
            });

            writer.Write(Value);
        }
    }
}