本文整理汇总了C#中System.Threading.Task.CleanPxeBoot方法的典型用法代码示例。如果您正苦于以下问题:C# Task.CleanPxeBoot方法的具体用法?C# Task.CleanPxeBoot怎么用?C# Task.CleanPxeBoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Task
的用法示例。
在下文中一共展示了Task.CleanPxeBoot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkout
public void checkout()
{
Utility utility = new Utility();
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Files = postedContext.Request.Files;
string serverKey = utility.Decode((string)postedContext.Request.Form["serverKey"]);
if (serverKey == utility.GetSettings("Server Key"))
{
string imgName = utility.Decode((string)postedContext.Request.Form["imgName"]);
string direction = utility.Decode((string)postedContext.Request.Form["direction"]);
string mac = utility.Decode((string)postedContext.Request.Form["mac"]);
string result = null;
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("client_checkout", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@mac", mac));
conn.Open();
result = cmd.ExecuteScalar() as string;
}
Task task = new Task();
string pxeHostMac = "01-" + mac.ToLower().Replace(':', '-');
task.CleanPxeBoot(pxeHostMac);
if (direction == "pull")
{
string xferMode = utility.GetSettings("Image Transfer Mode");
if (xferMode != "udp+http" && xferMode != "smb" && xferMode != "smb+http")
{
Utility.MoveFolder(utility.GetSettings("Image Hold Path") + imgName, utility.GetSettings("Image Store Path") + imgName);
if ((Directory.Exists(utility.GetSettings("Image Store Path") + imgName)) && (!Directory.Exists(utility.GetSettings("Image Hold Path") + imgName)))
{
try
{
Directory.CreateDirectory(utility.GetSettings("Image Hold Path") + imgName); // for next upload
result = "Success";
}
catch (Exception ex)
{
Logger.Log(ex.Message);
result = "Could Not Recreate Directory, You Must Create It Before You Can Upload Again";
}
}
else
result = "Could Not Move Image From Hold To Store. You Must Do It Manually.";
}
}
}
catch (Exception ex)
{
result = "Could Not Check Out. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
HttpContext.Current.Response.Write(result);
}
else
{
Logger.Log("Incorrect Key For Client Checkout Was Provided");
}
}