forked from CadeEvs/FrostyToolsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRuntimeResources.cs
28 lines (23 loc) · 872 Bytes
/
RuntimeResources.cs
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
using System.Collections.Generic;
using System.IO;
namespace Frosty.Core.Mod
{
public sealed class RuntimeResources : IResourceContainer
{
public IEnumerable<BaseModResource> Resources => resources;
private List<BaseModResource> resources = new List<BaseModResource>();
private List<byte[]> data = new List<byte[]>();
public byte[] GetResourceData(BaseModResource resource)
{
int index = resources.IndexOf(resource);
return data[index];
}
public void AddResource(BaseModResource resource, byte[] inData)
{
if (!(resource is RuntimeEbxResource) && !(resource is RuntimeResResource) && !(resource is RuntimeChunkResource))
throw new InvalidDataException();
resources.Add(resource);
data.Add(inData);
}
}
}