using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace WOLAwaken.Helper
|
{
|
public class SendWOLPack
|
{
|
public byte[] SendData = new byte[102];
|
public int[] macAddress = new int[] { 0x50, 0xEB, 0xF6, 0x43, 0x50, 0x08 }; //50:EB:F6:43:50:08
|
|
public SendWOLPack()
|
{
|
var config = Helpers.Tool.GetSystemConfig().baseSysConfg;
|
if (config != null) {
|
if (config.mac != null && config.mac.Length > 0)
|
{
|
macAddress = config.mac;
|
}
|
}
|
int index = 0;
|
for (int i = 0; i < 6; i++)
|
{
|
SendData[index++] = Convert.ToByte(0xFF);
|
}
|
|
for (int i = 0; i < 16; i++)
|
{
|
foreach (var a in macAddress)
|
{
|
SendData[index++] = Convert.ToByte(a);
|
}
|
}
|
|
new SendUdpPack().SendMessage(SendData);
|
}
|
}
|
}
|