本文整理汇总了C#中System.Threading.Task.GetPort方法的典型用法代码示例。如果您正苦于以下问题:C# Task.GetPort方法的具体用法?C# Task.GetPort怎么用?C# Task.GetPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Task
的用法示例。
在下文中一共展示了Task.GetPort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ucinfo
public void ucinfo()
{
Utility utility = new Utility();
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Files = postedContext.Request.Files;
string serverKey = utility.Decode((string)postedContext.Request.Form["serverKey"]);
string direction = utility.Decode((string)postedContext.Request.Form["direction"]);
string mac = utility.Decode((string)postedContext.Request.Form["mac"]);
string imageID = utility.Decode((string)postedContext.Request.Form["imageID"]);
if (utility.GetSettings("On Demand") == "Enabled")
{
if (serverKey == utility.GetSettings("Server Key"))
{
Image image = new Image();
if (direction == "push")
{
if (!image.Check_Checksum(imageID))
{
HttpContext.Current.Response.Write("Client Error: This Image Has Not Been Confirmed And Cannot Be Deployed.");
return;
}
}
string storage = null;
string imageOS = null;
string hostName = null;
string hostScripts = null;
string hostArgs = null;
string serverIP = utility.GetSettings("Server IP");
string xferMode = utility.GetSettings("Image Transfer Mode");
string compAlg = utility.GetSettings("Compression Algorithm");
string compLevel = utility.GetSettings("Compression Level");
string imageProtected = null;
string imageName = null;
string result = null;
if (xferMode == "smb" || xferMode == "smb+http")
storage = utility.GetSettings("SMB Path");
else
{
if (direction == "pull")
storage = utility.GetSettings("Nfs Upload Path");
else
storage = utility.GetSettings("Nfs Deploy Path");
}
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("client_customunicastinfo", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@imageName", imageID));
cmd.Parameters.Add(new NpgsqlParameter("@hostMac", mac));
cmd.Parameters.Add(new NpgsqlParameter("@imageOSResult", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@imageOSResult"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("@hostNameResult", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@hostNameResult"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("@hostscripts", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@hostscripts"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("@hostargs", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@hostargs"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("@imageprotected", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@imageprotected"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("@imagename", NpgsqlDbType.Varchar, 100));
cmd.Parameters["@imagename"].Direction = ParameterDirection.Output;
conn.Open();
cmd.ExecuteNonQuery();
imageOS = (cmd.Parameters["@imageOSResult"].Value as string);
hostName = (cmd.Parameters["@hostNameResult"].Value as string);
hostScripts = (cmd.Parameters["@hostscripts"].Value as string);
hostArgs = (cmd.Parameters["@hostargs"].Value as string);
imageProtected = (cmd.Parameters["@imageprotected"].Value as string);
imageName = (cmd.Parameters["@imagename"].Value as string);
}
result = "imgOS=" + imageOS + " imgName=" + imageName + " hostName=" + hostName + " hostScripts=" + "\"" + hostScripts + "\" " + hostArgs + " storage=" +
storage + " serverIP=" + serverIP + " xferMode=" + xferMode + " compAlg=" + compAlg + " compLevel=-" + compLevel + " imageProtected=" + imageProtected;
if (direction == "pull" && utility.GetSettings("Image Transfer Mode") == "udp+http")
{
Task task = new Task();
int portBase = task.GetPort();
result = result + " portBase=" + portBase;
}
}
catch (Exception ex)
{
result = "Client Error: Could Not Read Custom Unicast Info. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
HttpContext.Current.Response.Write(result);
}
else
{
Logger.Log("An Incorrect Key Was Provided While Trying To List Images");
}
}
//.........这里部分代码省略.........