You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Represents a modular component loaded at runtime, with its own assemblies, resource packs, and data.
16
+
/// </summary>
17
+
[PublicAPI]
18
+
publicsealedrecordMod
19
+
{
20
+
/// <summary>
21
+
/// Initializes a new <see cref="Mod"/> using <paramref name="metadata"/>.
22
+
/// </summary>
23
+
/// <param name="metadata">The <see cref="Metadata"/> to use. Assemblies, resource packs, and data are all loaded according to the directory specified in the metadata.</param>
24
+
publicMod(Metadatametadata)
25
+
{
26
+
this.Meta=metadata;
27
+
this.Assemblies=this.LoadAssemblies();
28
+
this.Data=this.LoadData();
29
+
this.LoadResources();
30
+
}
31
+
32
+
/// <summary>
33
+
/// The metadata of the <see cref="Mod"/>, such as its ID, name, load order, etc.
34
+
/// </summary>
35
+
publicMetadataMeta
36
+
{
37
+
get;
38
+
}
39
+
40
+
/// <summary>
41
+
/// The assemblies of the <see cref="Mod"/>.
42
+
/// </summary>
43
+
publicIEnumerable<Assembly>Assemblies
44
+
{
45
+
get;
46
+
}
47
+
48
+
/// <summary>
49
+
/// The XML data of the <see cref="Mod"/>, combined into a single <see cref="XmlNode"/> as its children.
thrownewModLoadException(this.Meta.Directory,$"Error loading resource pack at {resourcePath}");
114
+
}
115
+
}
116
+
}
117
+
118
+
/// <summary>
119
+
/// Represents the metadata of a <see cref="Mod"/>, such as its unique ID, name, author, load order, etc.
120
+
/// </summary>
121
+
[PublicAPI]
122
+
publicsealedrecordMetadata
123
+
{
124
+
[UsedImplicitly]
125
+
privateMetadata()
126
+
{
127
+
}
128
+
129
+
/// <summary>
130
+
/// The directory where the <see cref="Metadata"/> was loaded from.
131
+
/// </summary>
132
+
[Serialize]
133
+
publicstringDirectory
134
+
{
135
+
get;
136
+
[UsedImplicitly]
137
+
privateset;
138
+
}=null!;
139
+
140
+
/// <summary>
141
+
/// The unique ID of the <see cref="Mod"/>.
142
+
/// </summary>
143
+
[Serialize]
144
+
publicstringId
145
+
{
146
+
get;
147
+
[UsedImplicitly]
148
+
privateset;
149
+
}=null!;
150
+
151
+
/// <summary>
152
+
/// The name of the <see cref="Mod"/>.
153
+
/// </summary>
154
+
[Serialize]
155
+
publicstringName
156
+
{
157
+
get;
158
+
[UsedImplicitly]
159
+
privateset;
160
+
}=null!;
161
+
162
+
/// <summary>
163
+
/// The individual or group that created the <see cref="Mod"/>.
164
+
/// </summary>
165
+
[Serialize]
166
+
publicstringAuthor
167
+
{
168
+
get;
169
+
[UsedImplicitly]
170
+
privateset;
171
+
}=null!;
172
+
173
+
/// <summary>
174
+
/// The unique IDs of all other <see cref="Mod"/>s that the <see cref="Mod"/> depends on.
175
+
/// </summary>
176
+
publicIEnumerable<string>Dependencies
177
+
{
178
+
get;
179
+
[UsedImplicitly]
180
+
privateset;
181
+
}=Enumerable.Empty<string>();
182
+
183
+
/// <summary>
184
+
/// The unique IDs of all other <see cref="Mod"/>s that should be loaded before the <see cref="Mod"/>.
185
+
/// </summary>
186
+
publicIEnumerable<string>Before
187
+
{
188
+
get;
189
+
[UsedImplicitly]
190
+
privateset;
191
+
}=Enumerable.Empty<string>();
192
+
193
+
/// <summary>
194
+
/// The unique IDs of all other <see cref="Mod"/>s that should be loaded after the <see cref="Mod"/>.
195
+
/// </summary>
196
+
publicIEnumerable<string>After
197
+
{
198
+
get;
199
+
[UsedImplicitly]
200
+
privateset;
201
+
}=Enumerable.Empty<string>();
202
+
203
+
/// <summary>
204
+
/// The unique IDs of all other <see cref="Mod"/>s that are incompatible with the <see cref="Mod"/>.
205
+
/// </summary>
206
+
publicIEnumerable<string>Incompatible
207
+
{
208
+
get;
209
+
[UsedImplicitly]
210
+
privateset;
211
+
}=Enumerable.Empty<string>();
212
+
213
+
/// <summary>
214
+
/// Loads a <see cref="Metadata"/> from <paramref name="directoryPath"/>.
215
+
/// </summary>
216
+
/// <param name="directoryPath">The directory path. It must contain a "Mod.xml" file inside it with valid metadata.</param>
217
+
/// <returns>A <see cref="Metadata"/> loaded from <paramref name="directoryPath"/>.</returns>
218
+
/// <exception cref="ModLoadException">Thrown if the metadata file does not exist, or the metadata is invalid, or if there is another unexpected issue while trying to load the metadata.</exception>
0 commit comments