本文整理汇总了C#中Utility.GetSettings方法的典型用法代码示例。如果您正苦于以下问题:C# Utility.GetSettings方法的具体用法?C# Utility.GetSettings怎么用?C# Utility.GetSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility.GetSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: checkin
public void checkin()
{
Utility settings = new Utility();
HttpContext postedContext = HttpContext.Current;
HttpFileCollection Files = postedContext.Request.Files;
string serverKey = settings.Decode((string)postedContext.Request.Form["serverKey"]);
if (serverKey == settings.GetSettings("Server Key"))
{
string mac = settings.Decode((string)postedContext.Request.Form["mac"]);
string result = null;
try
{
using (NpgsqlConnection conn = new NpgsqlConnection(Utility.DBString))
{
NpgsqlCommand cmd = new NpgsqlCommand("client_checkin", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("@mac", mac));
conn.Open();
result = cmd.ExecuteScalar() as string;
}
}
catch (Exception ex)
{
result = "Could Not Check In. Check The Exception Log For More Info";
Logger.Log(ex.ToString());
}
HttpContext.Current.Response.Write(result);
}
else
{
Logger.Log("Incorrect Key For Client Checkin Was Provided");
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Master.IsInMembership("User"))
Response.Redirect("~/views/dashboard/dash.aspx?access=denied");
ddlGroupImage.DataSource = Utility.PopulateImagesDdl();
ddlGroupImage.DataBind();
ddlGroupImage.Items.Insert(0, "Select Image");
ddlGroupKernel.DataSource = Utility.GetKernels();
ddlGroupKernel.DataBind();
ListItem itemKernel = ddlGroupKernel.Items.FindByText("3.18.1-WDS");
if (itemKernel != null)
ddlGroupKernel.SelectedValue = "3.18.1-WDS";
else
ddlGroupKernel.Items.Insert(0, "Select Kernel");
ddlGroupBootImage.DataSource = Utility.GetBootImages();
ddlGroupBootImage.DataBind();
ListItem itemBootImage = ddlGroupBootImage.Items.FindByText("initrd.gz");
if (itemBootImage != null)
ddlGroupBootImage.SelectedValue = "initrd.gz";
else
ddlGroupBootImage.Items.Insert(0, "Select Boot Image");
lbScripts.DataSource = Utility.GetScripts();
lbScripts.DataBind();
Utility utility = new Utility();
if (utility.GetSettings("Default Host View") == "all")
PopulateGrid();
}
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Utility utility = new Utility();
WDSUser user = new WDSUser();
user.ID = user.GetID(HttpContext.Current.User.Identity.Name);
user = user.Read(user);
if (utility.GetSettings("On Demand") == "Disabled")
{
secure.Visible = false;
secureMsg.Text = "On Demand Mode Has Been Globally Disabled";
secureMsg.Visible = true;
}
else if (user.OndAccess == "0")
{
secure.Visible = false;
secureMsg.Text = "On Demand Mode Has Been Disabled For This Account";
secureMsg.Visible = true;
}
else
{
secure.Visible = true;
secureMsg.Visible = false;
}
if (!IsPostBack)
{
ddlImage.DataSource = Utility.PopulateImagesDdl();
ddlImage.DataBind();
ddlImage.Items.Insert(0, "Select Image");
}
}
示例4: CreateBootMenu
public void CreateBootMenu(Settings bootMenu, string kernel, string bootImage, string type)
{
Utility settings = new Utility();
string mode = settings.GetSettings("PXE Mode");
if (type == "noprox")
{
if (mode.Contains("ipxe"))
CreateIpxeMenu(bootMenu, kernel, bootImage, type);
else
CreateSyslinuxMenu(bootMenu, kernel, bootImage, type);
}
else
{
CreateIpxeMenu(bootMenu, kernel, bootImage, type);
CreateSyslinuxMenu(bootMenu, kernel, bootImage, type);
}
}
示例5: btnFixImage_Click
protected void btnFixImage_Click(object sender, EventArgs e)
{
bool needsFixed = false;
Utility utility = new Utility();
string currentName = (string)(ViewState["currentName"]);
if ((string)(ViewState["storeCheck"]) == "false")
{
needsFixed = true;
try
{
Directory.CreateDirectory(utility.GetSettings("Image Store Path") + currentName);
Utility.Message = "Successfully Created Directory In Image Store Path. ";
}
catch(Exception ex)
{
Logger.Log("Could Not Create Directory In Image Store Path. " + ex.Message);
Utility.Message = "Could Not Create Directory In Image Store Path. Check The Exception Log For More Info. ";
}
}
if ((string)(ViewState["holdCheck"]) == "false")
{
needsFixed = true;
try
{
Directory.CreateDirectory(utility.GetSettings("Image Hold Path") + currentName);
Utility.Message += "Successfully Created Directory In Image Hold Path. ";
}
catch (Exception ex)
{
Logger.Log("Could Not Create Directory In Image Hold Path. " + ex.Message);
Utility.Message += "Could Not Create Directory In Image Hold Path. Check The Exception Log For More Info. ";
}
}
if ((string)(ViewState["holdCheck"]) == "true" && (string)(ViewState["storeCheck"]) == "true")
{
if ((string)(ViewState["storeEmpty"]) == "true" && (string)(ViewState["holdEmpty"]) == "false")
{
needsFixed = true;
try
{
Utility.MoveFolder(utility.GetSettings("Image Hold Path") + currentName, utility.GetSettings("Image Store Path") + currentName);
try
{
Directory.CreateDirectory(utility.GetSettings("Image Hold Path") + currentName); // for next upload
Utility.Message = "Successfully Moved Image From Hold To Store";
}
catch (Exception ex)
{
Logger.Log("Could Not Recreate Directory " + ex.Message);
Utility.Message = "Could Not Recreate Directory, You Must Create It Before You Can Upload Again";
}
}
catch (Exception ex)
{
Logger.Log("Could Not Move Image From Hold Path To Store Path " + ex.Message);
Utility.Message = "Could Not Move Image From Hold Path To Store Path. Check The Exception Log For More Info.";
}
}
}
if (!needsFixed)
Utility.Message = "No Fixes Are Needed For This Image";
Master.Msgbox(Utility.Message);
}
示例6: getfilenames
public void getfilenames()
{
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 imageName = utility.Decode((string)postedContext.Request.Form["imgName"]);
List<string> dirs = new List<string>();
string result = null;
string path = utility.GetSettings("Image Store Path") + imageName;
dirs.Add(path);
for (int x = 2; true; x++)
{
string subdir = path + Path.DirectorySeparatorChar + "hd" + x;
if (Directory.Exists(subdir))
dirs.Add(subdir);
else
break;
}
foreach (string dirPath in dirs)
{
var files = Directory.GetFiles(dirPath, "*.*");
foreach (var file in files)
result += Path.GetFileName(file) + ";";
result += ",";
}
HttpContext.Current.Response.Write(result);
}
else
{
HttpContext.Current.Response.Write("false");
Logger.Log("Incorrect Key Provided for Client Getfilenames");
}
}
示例7: specs_page
protected void specs_page()
{
Utility utility = new Utility();
try
{
Image_Physical_Specs ips = new Image_Physical_Specs();
if (!string.IsNullOrEmpty(image.ClientSizeCustom))
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSizeCustom);
else
ips = JsonConvert.DeserializeObject<Image_Physical_Specs>(image.ClientSize);
List<HD_Physical_Specs> specslist = new List<HD_Physical_Specs>();
foreach (var hd in ips.hd)
{
long logical_block_size = Convert.ToInt64(hd.lbs);
hd.size = (Convert.ToInt64(hd.size) * logical_block_size / 1000f / 1000f / 1000f).ToString("#.##") + " GB" + " / " + (Convert.ToInt64(hd.size) * logical_block_size / 1024f / 1024f / 1024f).ToString("#.##") + " GB";
specslist.Add(hd);
}
gvHDs.DataSource = specslist;
gvHDs.DataBind();
foreach (GridViewRow row in gvHDs.Rows)
{
string isActive = ((HiddenField)row.FindControl("HiddenActive")).Value;
if (isActive == "1")
{
CheckBox box = row.FindControl("chkHDActive") as CheckBox;
box.Checked = true;
}
}
}
catch
{
lblSpecsUnavailable.Text = "Image Specifications Will Be Available After The Image Is Uploaded";
lblSpecsUnavailable.Visible = true;
}
if(utility.GetSettings("Image Checksum") == "On" && lblSpecsUnavailable.Visible != true)
{
try
{
List<HD_Checksum> listPhysicalImageChecksums = new List<HD_Checksum>();
string path = utility.GetSettings("Image Store Path") + image.Name;
HD_Checksum imageChecksum = new HD_Checksum();
imageChecksum.hdNumber = "hd1";
imageChecksum.path = path;
listPhysicalImageChecksums.Add(imageChecksum);
for (int x = 2; true; x++)
{
imageChecksum = new HD_Checksum();
string subdir = path + Path.DirectorySeparatorChar + "hd" + x;
if (Directory.Exists(subdir))
{
imageChecksum.hdNumber = "hd" + x;
imageChecksum.path = subdir;
listPhysicalImageChecksums.Add(imageChecksum);
}
else
break;
}
foreach (HD_Checksum hd in listPhysicalImageChecksums)
{
List<File_Checksum> listChecksums = new List<File_Checksum>();
var files = Directory.GetFiles(hd.path, "*.*");
foreach (var file in files)
{
File_Checksum fc = new File_Checksum();
fc.fileName = Path.GetFileName(file);
fc.checksum = image.Calculate_Hash(file);
listChecksums.Add(fc);
}
hd.path = string.Empty;
hd.fc = listChecksums.ToArray();
}
string physicalImageJson = JsonConvert.SerializeObject(listPhysicalImageChecksums);
if (physicalImageJson != image.Checksum)
{
incorrectChecksum.Visible = true;
ViewState["checkSum"] = physicalImageJson;
}
}
catch(Exception ex)
{
Logger.Log(ex.Message + " This can be safely ignored if the image has not been uploaded yet");
incorrectChecksum.Visible = false;
}
}
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Utility utility = new Utility();
Master.Msgbox(Utility.Message); //For Redirects
if(utility.GetSettings("Default Host View") == "all")
PopulateGrid();
}
}
示例9: 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")
//.........这里部分代码省略.........
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Master.IsInMembership("Administrator"))
Response.Redirect("~/views/dashboard/dash.aspx?access=denied");
string opendefault = Request.QueryString["defaultmenu"] as string;
if (!IsPostBack)
{
if (opendefault == "true")
{
bootEditor.Visible = false;
bootTemplates.Visible = true;
Utility utility = new Utility();
createNewTemplate.Visible = false;
modifyTemplate.Visible = false;
string proxyDHCP = utility.GetSettings("Proxy Dhcp");
if (proxyDHCP == "Yes")
{
divProxyDHCP.Visible = true;
string biosFile = utility.GetSettings("Proxy Bios File");
string efi32File = utility.GetSettings("Proxy Efi32 File");
string efi64File = utility.GetSettings("Proxy Efi64 File");
if (biosFile.Contains("linux") || efi32File.Contains("linux") || efi64File.Contains("linux"))
{
proxyPassBoxes.Visible = true;
}
try
{
ddlBiosKernel.DataSource = Utility.GetKernels();
ddlBiosKernel.DataBind();
ddlEfi32Kernel.DataSource = Utility.GetKernels();
ddlEfi32Kernel.DataBind();
ddlEfi64Kernel.DataSource = Utility.GetKernels();
ddlEfi64Kernel.DataBind();
ListItem itemKernel = ddlBiosKernel.Items.FindByText("3.18.1-WDS");
if (itemKernel != null)
{
ddlBiosKernel.SelectedValue = "3.18.1-WDS";
ddlEfi32Kernel.SelectedValue = "3.18.1-WDS";
}
else
{
ddlBiosKernel.Items.Insert(0, "Select Kernel");
ddlEfi32Kernel.Items.Insert(0, "Select Kernel");
}
ListItem itemKernel64 = ddlEfi64Kernel.Items.FindByText("3.18.1x64-WDS");
if (itemKernel64 != null)
ddlEfi64Kernel.SelectedValue = "3.18.1x64-WDS";
else
ddlEfi64Kernel.Items.Insert(0, "Select Kernel");
ddlBiosBootImage.DataSource = Utility.GetBootImages();
ddlBiosBootImage.DataBind();
ddlEfi32BootImage.DataSource = Utility.GetBootImages();
ddlEfi32BootImage.DataBind();
ddlEfi64BootImage.DataSource = Utility.GetBootImages();
ddlEfi64BootImage.DataBind();
ListItem itemBootImage = ddlBiosBootImage.Items.FindByText("initrd.gz");
if (itemBootImage != null)
{
ddlBiosBootImage.SelectedValue = "initrd.gz";
ddlEfi32BootImage.SelectedValue = "initrd.gz";
}
else
{
ddlBiosBootImage.Items.Insert(0, "Select Boot Image");
ddlEfi32BootImage.Items.Insert(0, "Select Boot Image");
}
ListItem itemBootImage64 = ddlEfi64BootImage.Items.FindByText("initrd64.gz");
if (itemBootImage != null)
ddlEfi64BootImage.SelectedValue = "initrd64.gz";
else
ddlEfi64BootImage.Items.Insert(0, "Select Boot Image");
}
catch { }
}
else
{
bootPasswords.Visible = true;
divPXEMode.Visible = true;
string pxeMode = utility.GetSettings("PXE Mode");
if (pxeMode.Contains("ipxe"))
{
passboxes.Visible = false;
btnSubmitDefault.Visible = false;
btnSubmitIPXE.Visible = true;
}
try
{
ddlHostKernel.DataSource = Utility.GetKernels();
//.........这里部分代码省略.........
示例11: showEditor_Click
protected void showEditor_Click(object sender, EventArgs e)
{
Utility settings = new Utility();
bootEditor.Visible = true;
bootTemplates.Visible = false;
string path = null;
string mode = settings.GetSettings("PXE Mode");
string proxyDHCP = settings.GetSettings("Proxy Dhcp");
if (proxyDHCP == "Yes")
{
string biosFile = settings.GetSettings("Proxy Bios File");
string efi32File = settings.GetSettings("Proxy Efi32 File");
string efi64File = settings.GetSettings("Proxy Efi64 File");
proxyEditor.Visible = true;
if (ddlEditProxyType.Text == "bios")
{
if (biosFile.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default.ipxe";
else
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default";
}
if (ddlEditProxyType.Text == "efi32")
{
if (efi32File.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default.ipxe";
else
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default";
}
if (ddlEditProxyType.Text == "efi64")
{
if (efi64File.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default.ipxe";
else
path = settings.GetSettings("Tftp Path") + "proxy" + Path.DirectorySeparatorChar + ddlEditProxyType.Text + Path.DirectorySeparatorChar + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default";
}
}
else
{
proxyEditor.Visible = false;
if (mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default.ipxe";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default";
}
lblFileName1.Text = path;
try
{
txtBootMenu.Text = File.ReadAllText(path);
}
catch (Exception ex)
{
Logger.Log(ex.Message);
path = path.Replace(@"\",@"\\");
Master.Msgbox("Could Not Find " + path);
}
}
示例12: edit_page
protected void edit_page()
{
Master.Msgbox(Utility.Message);
if (Master.IsInMembership("User"))
{
WDSUser user = new WDSUser();
user.ID = user.GetID(HttpContext.Current.User.Identity.Name);
user = user.Read(user);
List<string> listManagementGroups = user.GroupManagement.Split(' ').ToList<string>();
bool isAuthorized = false;
foreach (string id in listManagementGroups)
{
if (group.ID == id)
{
isAuthorized = true;
break;
}
}
if (!isAuthorized)
Response.Redirect("~/views/dashboard/dash.aspx?access=denied");
}
ddlGroupImage.DataSource = Utility.PopulateImagesDdl();
ddlGroupImage.DataBind();
ddlGroupImage.Items.Insert(0, "Select Image");
ddlGroupKernel.DataSource = Utility.GetKernels();
ddlGroupKernel.DataBind();
ListItem itemKernel = ddlGroupKernel.Items.FindByText("kernel");
if (itemKernel != null)
ddlGroupKernel.SelectedValue = "speed";
else
ddlGroupKernel.Items.Insert(0, "Select Kernel");
ddlGroupBootImage.DataSource = Utility.GetBootImages();
ddlGroupBootImage.DataBind();
ListItem itemBootImage = ddlGroupBootImage.Items.FindByText("initrd.gz");
if (itemBootImage != null)
ddlGroupBootImage.SelectedValue = "initrd.gz";
else
ddlGroupBootImage.Items.Insert(0, "Select Boot Image");
lbScripts.DataSource = Utility.GetScripts();
lbScripts.DataBind();
txtGroupName.Text = group.Name;
txtGroupDesc.Text = group.Description;
ddlGroupImage.Text = group.Image;
ddlGroupKernel.Text = group.Kernel;
ddlGroupBootImage.Text = group.BootImage;
txtGroupArguments.Text = group.Args;
txtGroupSenderArgs.Text = group.SenderArgs;
if (!string.IsNullOrEmpty(group.Scripts))
{
List<string> listhostScripts = group.Scripts.Split(',').ToList<string>();
foreach (ListItem item in lbScripts.Items)
foreach (var script in listhostScripts)
if (item.Value == script)
item.Selected = true;
}
gvRemove.DataSource = group.CurrentMembers(group.Name);
gvRemove.DataBind();
Utility utility = new Utility();
if (utility.GetSettings("Default Host View") == "all")
PopulateGrid();
}
示例13: CrucibleLogin_Authenticate
protected void CrucibleLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
Utility login = new Utility();
History history = new History();
WDSUser wdsuser = new WDSUser();
string loginDomain = login.GetSettings("AD Login Domain");
history.Type = "User";
history.IP = GetIP();
history.EventUser = CrucibleLogin.UserName;
wdsuser.ID = wdsuser.GetID(CrucibleLogin.UserName);
history.TypeID = wdsuser.ID;
if (string.IsNullOrEmpty(wdsuser.ID))
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
else
{
if (string.IsNullOrEmpty(loginDomain))
{
bool result = login.UserLogin(CrucibleLogin.UserName, CrucibleLogin.Password);
if ((result))
{
history.Event = "Successful Login";
e.Authenticated = true;
}
else
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
}
else
{
try
{
PrincipalContext context = new PrincipalContext(ContextType.Domain, loginDomain, CrucibleLogin.UserName, CrucibleLogin.Password);
UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, CrucibleLogin.UserName);
if (user != null)
{
history.Event = "Successful Login";
e.Authenticated = true;
}
}
catch (Exception ex)
{
Logger.Log(ex.Message);
bool result = login.UserLogin(CrucibleLogin.UserName, CrucibleLogin.Password);
if ((result))
{
history.Event = "Successful Login";
e.Authenticated = true;
}
else
{
history.Event = "Failed Login";
e.Authenticated = false;
lblError.Visible = true;
}
}
}
}
history.CreateEvent(history);
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Master.IsInMembership("Administrator"))
Response.Redirect("~/views/dashboard/dash.aspx?access=denied");
if (!IsPostBack)
{
Settings settings = new Settings();
Utility utility = new Utility();
txtIP.Text = utility.GetSettings("Server IP",true);
txtPort.Text = utility.GetSettings("Web Server Port", true);
txtImagePath.Text = utility.GetSettings("Image Store Path", true);
txtQSize.Text = utility.GetSettings("Queue Size", true);
txtSenderArgs.Text = utility.GetSettings("Sender Args", true);
txtNFSPath.Text = utility.GetSettings("Nfs Upload Path",true);
txtTFTPPath.Text = utility.GetSettings("Tftp Path", true);
txtWebService.Text = utility.GetSettings("Web Path", true);
ddlPXEMode.SelectedValue = utility.GetSettings("PXE Mode", true);
ddlProxyDHCP.SelectedValue = utility.GetSettings("Proxy Dhcp", true);
ddlProxyBios.SelectedValue = utility.GetSettings("Proxy Bios File", true);
ddlProxyEfi32.SelectedValue = utility.GetSettings("Proxy Efi32 File", true);
ddlProxyEfi64.SelectedValue = utility.GetSettings("Proxy Efi64 File", true);
ddlCompAlg.SelectedValue = utility.GetSettings("Compression Algorithm", true);
ddlCompLevel.SelectedValue = utility.GetSettings("Compression Level", true);
txtADLogin.Text = utility.GetSettings("AD Login Domain", true);
ddlImageXfer.SelectedValue = utility.GetSettings("Image Transfer Mode", true);
ddlImageChecksum.SelectedValue = utility.GetSettings("Image Checksum", true);
ddlHostView.SelectedValue = utility.GetSettings("Default Host View", true);
ddlOnd.SelectedValue = utility.GetSettings("On Demand", true);
txtRecArgs.Text = utility.GetSettings("Receiver Args", true);
txtStartPort.Text = utility.GetSettings("Udpcast Start Port", true);
txtEndPort.Text = utility.GetSettings("Udpcast End Port", true);
txtServerKey.Text = utility.GetSettings("Server Key", true);
ddlServerKeyMode.SelectedValue = utility.GetSettings("Server Key Mode", true);
txtImageHoldPath.Text = utility.GetSettings("Image Hold Path", true);
txtNFSDeploy.Text = utility.GetSettings("Nfs Deploy Path", true);
ddlSSL.SelectedValue = utility.GetSettings("Force SSL", true);
txtSMBPath.Text = utility.GetSettings("SMB Path", true);
txtSMBUser.Text = utility.GetSettings("SMB User Name", true);
txtSMBPass.Text = utility.GetSettings("SMB Password", true);
txtRecClientArgs.Text = utility.GetSettings("Client Receiver Args", true);
txtGlobalHostArgs.Text = utility.GetSettings("Global Host Args", true);
ViewState["startPort"] = txtStartPort.Text;
ViewState["endPort"] = txtEndPort.Text;
//These require pxe boot menu or client iso to be recreated
ViewState["serverIP"] = txtIP.Text;
ViewState["serverPort"] = txtPort.Text;
ViewState["serverKey"] = txtServerKey.Text;
ViewState["serverKeyMode"] = ddlServerKeyMode.Text;
ViewState["webService"] = txtWebService.Text;
ViewState["pxeMode"] = ddlPXEMode.Text;
ViewState["forceSSL"] = ddlSSL.Text;
ViewState["proxyDHCP"] = ddlProxyDHCP.SelectedValue;
ViewState["proxyBios"]= ddlProxyBios.SelectedValue;
ViewState["proxyEfi32"]=ddlProxyEfi32.SelectedValue;
ViewState["proxyEfi64"]=ddlProxyEfi64.SelectedValue;
ShowXferMode();
ShowProxyMode();
}
}
示例15: ddlTemplate_SelectedIndexChanged
protected void ddlTemplate_SelectedIndexChanged(object sender, EventArgs e)
{
Utility settings = new Utility();
string path = null;
string mode = settings.GetSettings("PXE Mode");
if (ddlTemplate.Text == "default")
{
if (mode.Contains("ipxe"))
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default.ipxe";
else
path = settings.GetSettings("Tftp Path") + "pxelinux.cfg" + Path.DirectorySeparatorChar + "default";
try
{
txtCustomBootMenu.Text = File.ReadAllText(path);
}
catch (Exception ex)
{
Master.Msgbox("Could Not Read Default Boot Menu. Check The Exception Log For More Info");
Logger.Log(ex.Message);
}
}
else if (ddlTemplate.Text == "select template")
{
txtCustomBootMenu.Text = "";
}
else
{
BootTemplate template = new BootTemplate().Read(ddlTemplate.Text);
txtCustomBootMenu.Text = template.templateContent;
}
}