-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathFilePacker.cs
More file actions
47 lines (44 loc) · 1.42 KB
/
FilePacker.cs
File metadata and controls
47 lines (44 loc) · 1.42 KB
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;
using System.IO;
using Serilog;
using System.Diagnostics;
using ModShardPackerReference;
namespace ModShardLauncher
{
public static class UtilsPacker
{
/// <summary>
/// Pack a mod located in <paramref name="path"/> using the packing method from <see cref="ModShardPackerReference"/>.
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static bool Pack(string path)
{
bool resultPacking = false;
try
{
resultPacking = FilePacker.Pack(
null,
path,
ModLoader.ModPath,
Path.GetDirectoryName(Path.GetDirectoryName(path)) ?? path,
Main.Instance.mslVersion,
new Type[2] {typeof(ModShardLauncher.Mods.Mod), typeof(UndertaleModLib.Models.UndertaleCode)}
);
}
catch(Exception ex)
{
if (ex is ArgumentNullException || ex is ArgumentException || ex is IOException || ex is DirectoryNotFoundException)
{
Log.Error(ex.ToString());
}
else
{
Log.Error(ex, "Unexpected error");
}
Console.WriteLine(ex.Message);
}
return resultPacking;
}
}
}