summaryrefslogtreecommitdiff
path: root/NW4RTools/ResFile.cs
blob: 4f4a1b819a0354be73835a144dadee816f8db2c6 (plain)
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 System;

namespace NW4RTools {
	public class ResFile : ResDict<object> {
		public const string ModelGroupName = "3DModels(NW4R)";
		public const string TextureGroupName = "Textures(NW4R)";


		public UInt16 Version;

		public ResDict<TValue> CreateGroup<TValue>(string name) {
			if (ContainsKey(name)) {
				return this[name] as ResDict<TValue>;
			} else {
				var newDict = new ResDict<TValue>();
				this[name] = newDict;
				return newDict;
			}
		}

		public ResDict<TValue> GetGroup<TValue>(string name) {
			return this[name] as ResDict<TValue>;
		}


		#region Specific Group Creators
		public ResDict<Models.Model> CreateModelGroup() {
			return CreateGroup<Models.Model>(ModelGroupName);
		}

		public ResDict<Texture> CreateTextureGroup() {
			return CreateGroup<Texture>(TextureGroupName);
		}
		#endregion

		#region Specific Group Getters
		public ResDict<Models.Model> GetModelGroup() {
			return GetGroup<Models.Model>(ModelGroupName);
		}

		public ResDict<Texture> GetTextureGroup() {
			return GetGroup<Texture>(TextureGroupName);
		}
		#endregion
	}
}