internal static void SendMod(string modName, int toClient) {
var mod = ModLoader.GetMod(modName);
var path = mod.File.path;
var fs = new FileStream(path, FileMode.Open);
{//send file length
var p = new ModPacket(MessageID.ModFile);
p.Write(mod.DisplayName);
p.Write(fs.Length);
p.Send(toClient);
}
var buf = new byte[CHUNK_SIZE];
int count;
while ((count = fs.Read(buf, 0, buf.Length)) > 0)
{
var p = new ModPacket(MessageID.ModFile, CHUNK_SIZE + 3);
p.Write(buf, 0, count);
p.Send(toClient);
}
fs.Close();
}