本文整理汇总了C#中Image.GetImageID方法的典型用法代码示例。如果您正苦于以下问题:C# Image.GetImageID方法的具体用法?C# Image.GetImageID怎么用?C# Image.GetImageID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image.GetImageID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (Utility.NoSpaceNotEmpty(txtImageName.Text))
{
Image image = new Image();
image.Name = txtImageName.Text;
//OS no longer needed as of 2.3.0
image.OS = "";
image.Description = txtImageDesc.Text;
if (chkProtected.Checked)
image.Protected = 1;
else
image.Protected = 0;
if (chkVisible.Checked)
image.IsVisible = 1;
else
image.IsVisible = 0;
image.Create(image);
if (Utility.Message.Contains("Successfully"))
Response.Redirect("~/views/images/view.aspx?page=edit&imageid=" + image.GetImageID(image.Name));
else
Master.Msgbox(Utility.Message);
}
else
Master.Msgbox("Name Cannot Be Empty Or Contain Spaces");
}
示例2: btnConfirm_Click
protected void btnConfirm_Click(object sender, EventArgs e)
{
if ((string)Session["direction"] == "delete")
{
Session.Remove("direction");
List<int> delList = new List<int>();
delList.Add(Convert.ToInt32(group.ID));
group.Delete(delList);
if (Utility.Message.Contains("Successfully"))
Response.Redirect("~/views/groups/search.aspx");
else
Master.Msgbox(Utility.Message);
}
else
{
Image imageInfo = new Image();
imageInfo.ID = imageInfo.GetImageID(group.Image);
Session["imageID"] = imageInfo.ID;
if (imageInfo.Check_Checksum(imageInfo.ID))
{
int isUnicast = Convert.ToInt32(Session["isGroupUnicast"]);
if (isUnicast == 1)
{
Unicast unicast = new Unicast();
List<int> listHostID = new List<int>();
listHostID = unicast.UnicastFromGroup(Convert.ToInt32(group.ID));
for (int z = 0; z < listHostID.Count; z++)
unicast.CreateUnicast("push", listHostID[z]);
Utility.Message = "Started " + listHostID.Count + " Tasks";
History history = new History();
history.Event = "Unicast";
history.Type = "Group";
history.TypeID = group.ID;
history.CreateEvent(history);
}
else
{
Multicast multicast = new Multicast();
multicast.CreateMulticast(Convert.ToInt32(group.ID));
}
Session.Remove("isGroupUnicast");
Master.Msgbox(Utility.Message);
}
else
{
lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed. <br>Confirm It Now?";
ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() { var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
}
}
}
示例3: btnConfirm_Click
protected void btnConfirm_Click(object sender, EventArgs e)
{
int groupID = Convert.ToInt32((string)(Session["groupID"]));
int isUnicast = Convert.ToInt32(Session["isGroupUnicast"]);
Group groupInfo = new Group();
groupInfo.ID = groupID.ToString();
groupInfo.Read(groupInfo);
Image imageInfo = new Image();
imageInfo.ID = imageInfo.GetImageID(groupInfo.Image);
Session["imageID"] = imageInfo.ID;
if (imageInfo.Check_Checksum(imageInfo.ID))
{
if (isUnicast == 1)
{
Unicast unicast = new Unicast();
List<int> listHostID = new List<int>();
listHostID = unicast.UnicastFromGroup(groupID);
for (int z = 0; z < listHostID.Count; z++)
unicast.CreateUnicast("push", listHostID[z]);
Utility.Message = "Started " + listHostID.Count + " Tasks";
}
else
{
Multicast multicast = new Multicast();
multicast.CreateMulticast(groupID);
}
Session.Remove("groupID");
Session.Remove("isGroupUnicast");
Master.Msgbox(Utility.Message);
}
else
{
lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed. <br>Confirm It Now?";
ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() { var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
}
}
示例4: btnHds_Click
protected void btnHds_Click(object sender, EventArgs e)
{
Utility utility = new Utility();
GridViewRow row = (GridViewRow)(sender as Control).Parent.Parent;
Image image = new Image();
image.ID = image.GetImageID(row.Cells[4].Text);
image.Read(image);
GridView gvHDs = (GridView)row.FindControl("gvHDs");
List<HD_Physical_Specs> specslist = new List<HD_Physical_Specs>();
Image_Physical_Specs ips = new Image_Physical_Specs();
try
{
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSize);
}
catch
{ return; }
if(ips == null)
return;
foreach (var hd in ips.hd)
{
specslist.Add(hd);
}
LinkButton btn = (LinkButton)row.FindControl("btnHDs");
if (gvHDs.Visible == false)
{
var td = row.FindControl("tdHds");
td.Visible = true;
gvHDs.Visible = true;
gvHDs.DataSource = specslist;
gvHDs.DataBind();
btn.Text = "-";
}
else
{
var td = row.FindControl("tdHds");
td.Visible = false;
gvHDs.Visible = false;
btn.Text = "+";
}
foreach (GridViewRow hdrow in gvHDs.Rows)
{
string imagePath = null;
try
{
Label lbl = hdrow.FindControl("lblHDSize") as Label;
try
{
if (hdrow.RowIndex.ToString() == "0")
{
imagePath = utility.GetSettings("Image Store Path") + row.Cells[4].Text;
}
else
{
string selectedHD = (hdrow.RowIndex + 1).ToString();
imagePath = utility.GetSettings("Image Store Path") + row.Cells[4].Text + Path.DirectorySeparatorChar + "hd" + selectedHD;
}
}
catch
{
return;
}
float size = GetDirectorySize(new DirectoryInfo(imagePath)) / 1024f / 1024f / 1024f;
if (size == 0.0f)
lbl.Text = "N/A";
else
{
lbl.Text = size.ToString("#.##") + " GB";
if (lbl.Text == " GB")
lbl.Text = "< .01 GB";
}
}
catch
{
Label lbl = hdrow.FindControl("lblHDSize") as Label;
lbl.Text = "N/A";
Utility.Message = "";
}
try
{
Label lblClient = hdrow.FindControl("lblHDSizeClient") as Label;
float fltClientSize = image.CalculateMinSizeHD(image.Name, hdrow.RowIndex, "1") / 1024f / 1024f / 1024f;
if (fltClientSize == 0.0f)
lblClient.Text = "N/A";
else
{
lblClient.Text = fltClientSize.ToString("#.##") + " GB";
if (lblClient.Text == " GB")
//.........这里部分代码省略.........
示例5: OkButton_Click
protected void OkButton_Click(object sender, EventArgs e)
{
Unicast unicast = new Unicast();
int hostID = Convert.ToInt32((string)(Session["hostID"]));
Session.Remove("hostID");
string direction = (string)(Session["direction"]);
Session.Remove("direction");
if(direction == "push")
{
Image image = new Image();
unicast = unicast.Read(hostID,unicast);
string imageID = image.GetImageID(unicast.ImageName);
Session["imageID"] = imageID;
if (image.Check_Checksum(imageID))
unicast.CreateUnicast(direction, hostID);
else
{
lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed. <br>Confirm It Now?";
ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() { var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
}
}
else
unicast.CreateUnicast(direction, hostID);
Master.Msgbox(Utility.Message);
}
示例6: OkButton_Click
protected void OkButton_Click(object sender, EventArgs e)
{
string direction = (string)(Session["direction"]);
Session.Remove("direction");
if (direction == "delete")
{
List<int> delList = new List<int>();
delList.Add(Convert.ToInt32(host.ID));
host.Delete(delList);
if (Utility.Message.Contains("Successfully"))
Response.Redirect("~/views/hosts/search.aspx");
else
Master.Msgbox(Utility.Message);
}
else if (direction == "push")
{
Unicast unicast = new Unicast();
Image image = new Image();
unicast = unicast.Read(Convert.ToInt32(host.ID), unicast);
string imageID = image.GetImageID(unicast.ImageName);
Session["imageID"] = imageID;
if (image.Check_Checksum(imageID))
{
unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
Master.Msgbox(Utility.Message);
}
else
{
lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed. <br>Confirm It Now?";
ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() { var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
}
}
else
{
Unicast unicast = new Unicast();
unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
Master.Msgbox(Utility.Message);
}
}
示例7: CreateUnicast
public void CreateUnicast(string direction, int hostID)
{
Task task = new Task();
Unicast unicast = new Unicast();
unicast = unicast.Read(hostID, unicast);
if (unicast.HostName != null)
{
if (unicast.ImageName != null)
{
string taskID = unicast.Create(unicast);
if (taskID != "0")
{
if (CreatePxeBoot(unicast, direction, "false", taskID, hostID))
{
History history = new History();
history.Type = "Host";
history.Notes = unicast.HostMac;
history.TypeID = hostID.ToString();
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
Image image = new Image();
history.Type = "Image";
history.Notes = unicast.HostName;
history.TypeID = image.GetImageID(unicast.ImageName);
if (direction == "push")
history.Event = "Deploy";
else
history.Event = "Upload";
history.CreateEvent(history);
task.WakeUp(unicast.HostMac);
}
else
unicast.Rollback(unicast);
}
}
}
}
示例8: StartCustomMC
public bool StartCustomMC(string imageName)
{
string appPath = null;
string logPath = null;
string shell = null;
if (Environment.OSVersion.ToString().Contains("Unix"))
{
string dist = null;
ProcessStartInfo distInfo = new ProcessStartInfo();
distInfo.UseShellExecute = false;
distInfo.FileName = "uname";
distInfo.RedirectStandardOutput = true;
distInfo.RedirectStandardError = true;
using (Process process = Process.Start(distInfo))
{
dist = process.StandardOutput.ReadToEnd();
}
Logger.Log("Distro is " + dist);
if(dist.ToLower().Contains("bsd"))
shell = "/bin/csh";
else
shell = "/bin/bash";
logPath = HttpContext.Current.Server.MapPath("~") + @"/data/logs" + @"/";
}
else
{
appPath = HttpContext.Current.Server.MapPath("~") + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "apps" + Path.DirectorySeparatorChar;
logPath = HttpContext.Current.Server.MapPath("~") + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "logs" + Path.DirectorySeparatorChar;
shell = "cmd.exe";
}
Multicast multicast = new Multicast();
Utility settings = new Utility();
string fullImagePath = null;
Task task = new Task();
int portBase = task.GetPort();
string senderArgs = settings.GetSettings("Sender Args");
Process multiSender = null;
ProcessStartInfo senderInfo = new ProcessStartInfo();
senderInfo.FileName = (shell);
string udpFile = null;
String[] partFiles = null;
string compExt = null;
string compAlg = null;
string stdout = null;
//Multicasting currently only supports the first active hd
//Find First Active HD
Image image = new Image();
image.ID = image.GetImageID(imageName);
image.Read(image);
Image_Physical_Specs ips = new Image_Physical_Specs();
if (!string.IsNullOrEmpty(image.ClientSizeCustom))
{
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSizeCustom);
try
{
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSizeCustom);
}
catch { }
}
else
{
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSize);
try
{
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSize);
}
catch { }
}
string activeHD = null;
int activeCounter = 0;
foreach (var hd in ips.hd)
{
if (hd.active == "1")
{
activeHD = activeCounter.ToString();
break;
}
activeCounter++;
}
if (activeCounter == 0)
{
fullImagePath = settings.GetSettings("Image Store Path") + imageName;
}
else
{
fullImagePath = settings.GetSettings("Image Store Path") + imageName + Path.DirectorySeparatorChar + "hd" + (activeCounter + 1).ToString();
}
try
{
//.........这里部分代码省略.........
示例9: CreateMulticast
public void CreateMulticast(int groupID)
{
Multicast multicast = new Multicast();
Utility settings = new Utility();
Task task = new Task();
int portBase = task.GetPort();
if (portBase != 0)
{
multicast = multicast.Read(groupID);
if (multicast != null)
{
if (String.IsNullOrEmpty(multicast.GroupSenderArgs))
multicast.GroupSenderArgs = settings.GetSettings("Sender Args");
if (multicast.HostNames.Count > 0)
{
if (CheckAllHostsEqual(multicast))
{
if (CreateMulticastTask(multicast, "push", "true", portBase))
{
if (StartMulticastSender(multicast, portBase))
{
History history = new History();
history.Event = "Multicast";
history.Type = "Group";
history.TypeID = groupID.ToString();
history.CreateEvent(history);
Host host = new Host();
foreach (string mac in HostMacs)
{
history.Event = "Deploy";
history.Type = "Host";
history.Notes = "Via Group Multicast: " + multicast.GroupName;
history.TypeID = host.GetHostID(mac);
history.CreateEvent(history);
}
foreach (string name in HostNames)
{
Image image = new Image();
history.Event = "Deploy";
history.Type = "Image";
history.Notes = name;
history.TypeID = image.GetImageID(multicast.GroupImage);
history.CreateEvent(history);
}
}
else
RollBack(multicast, true, true, true);
}
}
}
else
Utility.Message = "The Group Does Not Have Any Hosts";
}
}
}