当前位置: 首页>>代码示例>>C#>>正文


C# Task.MacToPXE方法代码示例

本文整理汇总了C#中Task.MacToPXE方法的典型用法代码示例。如果您正苦于以下问题:C# Task.MacToPXE方法的具体用法?C# Task.MacToPXE怎么用?C# Task.MacToPXE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Task的用法示例。


在下文中一共展示了Task.MacToPXE方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
        }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:94,代码来源:Host.cs

示例2: Rollback

    public void Rollback(Unicast unicast)
    {
        try
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
            {
                NpgsqlCommand cmd = new NpgsqlCommand("unicast_rollback", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new NpgsqlParameter("@taskName", unicast.HostName));
                conn.Open();
                cmd.ExecuteNonQuery();
            }
        }
        catch (Exception ex)
        {
            Logger.Log(ex.ToString());
        }

        Utility settings = new Utility();
        Task task = new Task();
        string pxeHostMac = task.MacToPXE(unicast.HostMac);

        Host hostFunction = new Host();

        if (hostFunction.IsCustomBootEnabled(Task.PXEMacToMac(pxeHostMac)))
        {
            string mode = settings.GetSettings("PXE Mode");
            string proxyDHCP = settings.GetSettings("Proxy Dhcp");
            if (proxyDHCP == "Yes")
            {
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe");
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac);
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe");
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac);
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe");
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac);
                }
                catch { }
            }
            else
            {
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom", settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe");
                }
                catch { }
                try
                {
                    Utility.MoveFile(settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".custom", settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac);
                }
                catch { }
            }
        }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:76,代码来源:Unicast.cs

示例3: activebootmenu_page

    protected void activebootmenu_page()
    {
        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");

        try
        {
            if (isActive == "Active")
            {
                if (proxyDHCP == "Yes")
                {
                    divProxy.Visible = true;
                    string biosFile = settings.GetSettings("Proxy Bios File");
                    string efi32File = settings.GetSettings("Proxy Efi32 File");
                    string efi64File = settings.GetSettings("Proxy Efi64 File");

                    if (ddlEditProxyType.Text == "bios")
                    {
                        if (biosFile.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
                    }

                    if (ddlEditProxyType.Text == "efi32")
                    {
                        if (efi32File.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
                    }

                    if (ddlEditProxyType.Text == "efi64")
                    {
                        if (efi64File.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
                    }

                    lblFileName1.Text = path;
                    txtBootMenu.Text = File.ReadAllText(path);

                }
                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;
                    }

                    lblFileName1.Text = path;
                    txtBootMenu.Text = File.ReadAllText(path);

                }
                lblActiveBoot.Text = "Active Task Found <br> Displaying Task Boot Menu";

            }

            else if (host.IsCustomBootEnabled(host.Mac))
            {
                if (proxyDHCP == "Yes")
                {
                    divProxy.Visible = true;
                    string biosFile = settings.GetSettings("Proxy Bios File");
                    string efi32File = settings.GetSettings("Proxy Efi32 File");
                    string efi64File = settings.GetSettings("Proxy Efi64 File");

                    if (ddlEditProxyType.Text == "bios")
                    {
                        if (biosFile.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
                    }

                    if (ddlEditProxyType.Text == "efi32")
                    {
                        if (efi32File.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
                    }

                    if (ddlEditProxyType.Text == "efi64")
                    {
                        if (efi64File.Contains("ipxe"))
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
                        else
                            path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
//.........这里部分代码省略.........
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:101,代码来源:view.aspx.cs

示例4: CreatePxeBoot

    public bool CreatePxeBoot(Unicast unicast, string direction, string isMulticast, string taskID, int hostID)
    {
        Utility settings = new Utility();
        Task task = new Task();
        string pxeHostMac = task.MacToPXE(unicast.HostMac);
        string proxyDHCP = settings.GetSettings("Proxy Dhcp");
        string biosFile = settings.GetSettings("Proxy Bios File");
        string efi32File = settings.GetSettings("Proxy Efi32 File");
        string efi64File = settings.GetSettings("Proxy Efi64 File");
        string biosPath = null;
        string efi32Path = null;
        string efi64Path = null;
        string biosPathipxe = null;
        string efi32Pathipxe = null;
        string efi64Pathipxe = null;
        string path = null;
        string[] lines = null;
        string wds_key = null;
        if (settings.GetSettings("Server Key Mode") == "Automated")
            wds_key = settings.GetSettings("Server Key");
        else
            wds_key = "";

        string mode = settings.GetSettings("PXE Mode");

        if (proxyDHCP == "Yes")
        {
            biosPathipxe = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
            string[] biosLinesipxe = {@"#!ipxe",
                           @"kernel " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/kernels/" + unicast.HostKernel + ".krn" + " initrd=" + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments,
                           @"imgfetch " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/images/" + unicast.HostBootImage ,
                           @"boot"};

            biosPath = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
            string[] biosLines = { @"DEFAULT cruciblewds",
                           @"LABEL cruciblewds", @"KERNEL kernels" + Path.DirectorySeparatorChar + unicast.HostKernel ,
                           @"APPEND initrd=images" + Path.DirectorySeparatorChar + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments};

            efi32Pathipxe = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
            string[] efi32Linesipxe = {@"#!ipxe",
                           @"kernel " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/kernels/" + unicast.HostKernel + ".krn" + " initrd=" + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments,
                           @"imgfetch " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/images/" + unicast.HostBootImage ,
                           @"boot"};

            efi32Path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi32" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
            string[] efi32Lines = { @"DEFAULT cruciblewds",
                           @"LABEL cruciblewds", @"KERNEL kernels" + Path.DirectorySeparatorChar + unicast.HostKernel ,
                           @"APPEND initrd=images" + Path.DirectorySeparatorChar + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments};

            efi64Pathipxe = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe";
            string[] efi64Linesipxe = {@"#!ipxe",
                           @"kernel " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/kernels/" + unicast.HostKernel + ".krn" + " initrd=" + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments,
                           @"imgfetch " + "http://"+ settings.GetServerIP() +"/cruciblewds/data/boot/images/" + unicast.HostBootImage ,
                           @"boot"};

            efi64Path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "efi64" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac;
            string[] efi64Lines = { @"DEFAULT cruciblewds",
                           @"LABEL cruciblewds", @"KERNEL kernels" + Path.DirectorySeparatorChar + unicast.HostKernel ,
                           @"APPEND initrd=images" + Path.DirectorySeparatorChar + unicast.HostBootImage + " root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp imgDirection=" + direction + " consoleblank=0" + " web=" + settings.GetSettings("Web Path") + " WDS_KEY=" + wds_key + " " + settings.GetSettings("Global Host Args") + " " + unicast.HostArguments};

            if (File.Exists(biosPath))
            {
                Host hostFunction = new Host();
                if (hostFunction.IsCustomBootEnabled(Task.PXEMacToMac(pxeHostMac)))
                {
                     Utility.MoveFile(biosPath, biosPath + ".custom");
                }
                else
                {
                    Utility.Message = "The PXE File Already Exists";
                    return false;
                }
            }

            if (File.Exists(biosPathipxe))
            {
                Host hostFunction = new Host();
                if (hostFunction.IsCustomBootEnabled(Task.PXEMacToMac(pxeHostMac)))
                {
                        Utility.MoveFile(settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe", settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + "bios" + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + pxeHostMac + ".ipxe.custom");
                }
                else
                {
                    Utility.Message = "The PXE File Already Exists";
                    return false;
                }
            }

            if (File.Exists(efi32Path))
            {
                Host hostFunction = new Host();
                if (hostFunction.IsCustomBootEnabled(Task.PXEMacToMac(pxeHostMac)))
                {
                        Utility.MoveFile(efi32Path, efi32Path + ".custom");
                }
                else
                {
                    Utility.Message = "The PXE File Already Exists";
                    return false;
                }
//.........这里部分代码省略.........
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:101,代码来源:Unicast.cs

示例5: DeleteActiveTask

 public void DeleteActiveTask(int taskID)
 {
     Task task = new Task();
     string hostMac = task.DeleteActive(taskID);
     if (hostMac != "error")
     {
         string pxeHostMac = task.MacToPXE(hostMac);
         if (task.CleanPxeBoot(pxeHostMac))
             Utility.Message = "Successfully Deleted Task ";
     }
     else
         Utility.Message = "Could Not Delete Active Task.  Check Exception Log For More Info";
 }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:13,代码来源:Task.cs

示例6: DeleteActiveMcTask

    public void DeleteActiveMcTask(int mcTaskID, string groupName, string PID)
    {
        Task task = new Task();
        List<string> hostMacs = new List<string>();
        hostMacs = task.DeleteActiveMc(mcTaskID, groupName);

            for (int i = 0; i < hostMacs.Count; i++)
            {
                string pxeHostMac = task.MacToPXE(hostMacs[i]);
                task.CleanPxeBoot(pxeHostMac);
            }

            try
            {
                Process prs = Process.GetProcessById(Convert.ToInt32(PID));
                string processName = prs.ProcessName;
                if (Environment.OSVersion.ToString().Contains("Unix"))
                {
                    while (!prs.HasExited)
                    {
                        task.KillProcessLinux(Convert.ToInt32(PID));
                        Thread.Sleep(1000);

                    }
                }
                else
                {
                    if (processName == "cmd")
                        task.KillProcess(Convert.ToInt32(PID));
                }
                Utility.Message = "Successfully Deleted Task";
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Utility.Message = "Could Not Kill Process.  Check The Exception Log For More Info";
            }
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:38,代码来源:Task.cs

示例7: RollBack

    public void RollBack(Multicast multicast, bool mcTaskCreated, bool activeTaskCreated, bool pxeBootCreated)
    {
        Task task = new Task();
        if (pxeBootCreated)
        {
            string pxeHostMac;
            for (int i = 0; i < multicast.HostNames.Count; i++)
            {
                pxeHostMac = task.MacToPXE(multicast.HostMacs[i]);
                task.CleanPxeBoot(pxeHostMac);
            }
        }

        if (activeTaskCreated)
            multicast.RollBackActiveTasks(multicast);

        if (mcTaskCreated)
            multicast.RollBackActiveMCTask(multicast);
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:19,代码来源:Multicast.cs

示例8: CreatePXEFiles

    public bool CreatePXEFiles(Multicast multicast, int portBase)
    {
        Task task = new Task();

        for (int i = 0; i < multicast.HostMacs.Count; i++)
        {
            multicast.PXEHostMac = task.MacToPXE(multicast.HostMacs[i]);
            multicast.PXEBoot.Add(CreatePxeBootMC(multicast, "push", "true", portBase, i));
        }
        if (multicast.PXEBoot.Contains(false))
            return false;
        else
            return true;
    }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:14,代码来源:Multicast.cs


注:本文中的Task.MacToPXE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。