本文整理汇总了C#中Host.CheckActive方法的典型用法代码示例。如果您正苦于以下问题:C# Host.CheckActive方法的具体用法?C# Host.CheckActive怎么用?C# Host.CheckActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host.CheckActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetCustomBootMenu
public void SetCustomBootMenu(Host host, string filename)
{
Utility settings = new Utility();
Task task = new Task();
string mode = settings.GetSettings("PXE Mode");
string pxeHostMac = task.MacToPXE(host.Mac);
string isActive = host.CheckActive(host.Mac);
string path = null;
string proxyDHCP = settings.GetSettings("Proxy Dhcp");
if (isActive == "Inactive")
{
if (proxyDHCP == "Yes")
{
string biosFile = settings.GetSettings("Proxy Bios File");
string efi32File = settings.GetSettings("Proxy Efi32 File");
string efi64File = settings.GetSettings("Proxy Efi64 File");
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
}
else
{
if (mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
WritePath(path, filename);
}
}
else
{
if (proxyDHCP == "Yes")
{
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
WritePath(path, filename);
}
else
{
if(mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom";
WritePath(path, filename);
}
}
try
{
host.CustomBoot(host.Mac, true);
History history = new History();
history.Event = "Set Boot Menu";
history.Type = "Host";
history.Notes = host.Mac;
history.TypeID = host.ID;
history.CreateEvent(history);
Utility.Message ="Successfully Set Custom Boot Menu For This Host";
}
catch (Exception ex)
{
Utility.Message = "Could Not Set Custom Boot Menu. Check The Exception Log For More Info.";
Logger.Log(ex.Message);
}
}