-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModMetadata.cs
39 lines (34 loc) · 1.23 KB
/
ModMetadata.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
29
30
31
32
33
34
35
36
37
38
39
using System.IO;
namespace XCom2ModTool
{
internal class ModMetadata
{
public static readonly string Extension = ".XComMod";
public ModMetadata(ModProject project)
{
Title = project.Title;
Description = project.Description;
SteamPublishId = project.SteamPublishId;
RequiresExpansion = project.Edition.IsExpansion;
}
public string Title { get; set; }
public string Description { get; set; }
public ulong SteamPublishId { get; set; }
public bool RequiresExpansion { get; set; }
public void Save(string path)
{
using (var writer = new StreamWriter(path, append: false, Program.DefaultEncoding))
{
writer.WriteLine("[mod]");
writer.WriteLine($"publishedFileId={SteamPublishId}");
writer.WriteLine($"Title={Title}");
writer.WriteLine($"Description={Description}");
if (RequiresExpansion)
{
writer.WriteLine("RequiresXPACK=true");
}
}
}
public static void Save(ModProject project, string path) => new ModMetadata(project).Save(path);
}
}