aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Applets/Browser/BrowserOutput.cs
blob: b0e2d0e1ce509892122a51f60af8a8bf8cf873da (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);
        }
    }
}