forked from Dual-Iron/NetEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetEasy.cs
38 lines (35 loc) · 954 Bytes
/
NetEasy.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
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Terraria.ModLoader;
namespace NetEasy
{
/// <summary>Use the static methods in this class to communicate with NetEasy.</summary>
public sealed class NetEasy : Mod
{
/// <summary>Loads your <see cref="Mod"/> for NetEasy. Call this in <see cref="Mod.PostSetupContent"/>.</summary>
public static void Register(Mod mod)
{
try
{
Module.Load(mod);
}
catch (ModuleLoadException) { throw; }
catch (Exception e)
{
throw new ModuleLoadException("There was an error registering a Module. " + e.Message, e);
}
}
/// <summary>Handles packets sent from your mod. Call this in <see cref="Mod.HandlePacket(BinaryReader, int)"/>.</summary>
public static void HandleModule(BinaryReader reader, int whoAmI)
{
Module.Receive(reader.BaseStream, whoAmI);
}
/// <inheritdoc/>
public override void Unload()
{
Module.Unload();
}
}
}