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


C# Task.CleanPxeBoot方法代码示例

本文整理汇总了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");
            }
        }
开发者ID:cocoon,项目名称:crucibleWDS,代码行数:68,代码来源:ClientSvc.asmx.cs


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