本文整理汇总了C#中XmlHelper类的典型用法代码示例。如果您正苦于以下问题:C# XmlHelper类的具体用法?C# XmlHelper怎么用?C# XmlHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlHelper类属于命名空间,在下文中一共展示了XmlHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
int count = _recElements.Count;
for (int batchNumber = 0; batchNumber < this.BatchCount; batchNumber++)
{
XmlHelper h = new XmlHelper(RequestContentElement);
int start = batchNumber * this.Size;
int end = start + this.Size;
if (end > count)
end = count;
for (int i = start; i < end; i++)
{
XmlElement rec = _recElements[i];
h.AddElement(".", rec);
}
Envelope env = new Envelope(h);
XmlHelper p = new XmlHelper("<Parameter/>");
p.AddElement(".", "BatchID", _batchID);
p.AddElement(".", "BatchNumber", batchNumber.ToString());
env.Headers.Add(p);
BackgroundWorker w = new BackgroundWorker();
w.DoWork += new DoWorkEventHandler(w_DoWork);
w.RunWorkerCompleted += new RunWorkerCompletedEventHandler(w_RunWorkerCompleted);
w.RunWorkerAsync(env);
}
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:31,代码来源:BatchHelper.cs
示例2: UDTHandler
internal UDTHandler(ProjectHandler project, XmlElement source)
{
Parent = project;
Tables = new List<UDTTable>();
AllUDTTables = new List<UDTTable>();
_allUDTs = new List<string>();
XmlHelper h = new XmlHelper(source);
XmlHelper ph = new XmlHelper(project.Preference);
List<string> list = new List<string>();
foreach (XmlElement e in ph.GetElements("Property/UDT"))
{
string name = e.GetAttribute("Name");
list.Add(name.ToLower());
_allUDTs.Add(name);
}
foreach (XmlElement tableElement in h.GetElements("TableName"))
{
UDTTable table = new UDTTable(tableElement.InnerText);
if (list.Contains(table.Name.ToLower()))
Tables.Add(table);
_allUDTs.Add(table.Name.ToLower());
AllUDTTables.Add(table);
}
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:28,代码来源:UDTHandler.cs
示例3: Field
internal Field(XmlElement fieldElement)
{
XmlHelper h = new XmlHelper(fieldElement);
this.Source = fieldElement.GetAttribute("Source");
this.Target = fieldElement.GetAttribute("Target");
this.InputConverter = ConverterType.Parse(fieldElement.GetAttribute("InputConverter"));
this.OutputConverter = ConverterType.Parse(fieldElement.GetAttribute("OutputConverter"));
this.Quote = h.TryGetBoolean("@Quote", true);
this.Mandatory = h.TryGetBoolean("@Mandatory", false);
this.Alias = fieldElement.GetAttribute("Alias");
this.Required = h.TryGetBoolean("@Required", false);
this.AutoNumber = h.TryGetBoolean("@AutoNumber", false);
SourceType sType = SourceType.Request;
if (!Enum.TryParse<SourceType>(fieldElement.GetAttribute("SourceType"), true, out sType))
sType = SourceType.Request;
this.SourceType = sType;
IOType iType = IOType.Element;
if (!Enum.TryParse<IOType>(fieldElement.GetAttribute("InputType"), true, out iType))
iType = IOType.Element;
this.InputType = iType;
IOType oType = IOType.Element;
if (!Enum.TryParse<IOType>(fieldElement.GetAttribute("OutputType"), true, out oType))
oType = IOType.Element;
this.OutputType = oType;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:30,代码来源:Field.cs
示例4: ReadXml
public void ReadXml(XmlReader reader)
{
var xml = new XmlHelper(reader);
PersonalContacts = xml.deserializeRowSet<Contact>("contactList");
CorporationContacts = xml.deserializeRowSet<Contact>("corporateContactList");
AllianceContacts = xml.deserializeRowSet<Contact>("allianceContactList");
}
开发者ID:nozzy83,项目名称:evelib,代码行数:7,代码来源:ContactList.cs
示例5: Save
public void Save()
{
if (!Valid)
return;
IContractEditor edit = Editor as IContractEditor;
edit.Save();
IResultGetter result = Editor as IResultGetter;
XmlElement authElement = result.GetAuthElement();
XmlHelper h = new XmlHelper("<Definition/>");
h.AddElement(".", authElement);
try
{
Contract.SetDefinition(h.GetElement("."), _owner);
MessageBox.Show("儲存完畢!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show("儲存失敗!" + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:25,代码来源:ContractEditor.cs
示例6: AddContract
internal ContractHandler AddContract(string ContractName, ExtendType extend)
{
XmlHelper req = new XmlHelper("<Request/>");
req.AddElement(".", "ContractName", ContractName);
req.AddElement(".", "Definition");
XmlElement authElement = req.AddElement("Definition", "Authentication");
if (extend == ExtendType.open)
{
XmlElement e = req.AddElement("Definition/Authentication", "Public");
e.SetAttribute("Enabled", "true");
}
else
{
if (extend != ExtendType.none && extend != ExtendType.open)
authElement.SetAttribute("Extends", extend.ToString());
}
Parent.SendRequest("UDSManagerService.CreateContract", new Envelope(req));
ContractHandler contract = ContractHandler.CreateNew(ContractName, extend);
JoinProject(contract);
return contract;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:25,代码来源:UDSHandler.cs
示例7: SetDefinition
public void SetDefinition(System.Xml.XmlElement definition)
{
XmlHelper h = new XmlHelper(definition);
_initialized = false;
//Check Basic Tab
chkBasic.Checked = CheckEnable(h.GetElement("Authentication/Basic"), true);
cbHashProvider.Text = h.GetText("Authentication/Basic/PasswordHashProvider/@DriverClass");
txtGetUserDataQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserDataQuery");
txtGetUserRoleQuery.Text = h.GetText("Authentication/Basic/UserInfoStorage/DBSchema/GetUserRolesQuery");
//Check Session Tab
chkSession.Checked = h.TryGetBoolean("Authentication/Session/@Enabled", true);
txtTimeout.Text = h.TryGetInteger("Authentication/Session/@Timeout", 20).ToString();
//Check Passport Tab
chkPassport.Checked = CheckEnable(h.GetElement("Authentication/Passport"), false);
txtIssuer.Text = h.GetText("Authentication/Passport/Issuer/@Name");
txtCertProvider.Text = h.GetText("Authentication/Passport/Issuer/CertificateProvider");
cbALTable.Text = h.GetText("Authentication/Passport/AccountLinking/TableName");
cboMappingField.Text = h.GetText("Authentication/Passport/AccountLinking/MappingField");
cbUserNameField.Text = h.GetText("Authentication/Passport/AccountLinking/UserNameField");
dgExtProp.Rows.Clear();
foreach (XmlElement pe in h.GetElements("Authentication/Passport/AccountLinking/Properties/Property"))
{
int index = dgExtProp.Rows.Add();
DataGridViewRow row = dgExtProp.Rows[index];
row.Cells[colAlias.Name].Value = pe.GetAttribute("Alias");
row.Cells[colDBField.Name].Value = pe.GetAttribute("Field");
}
CheckTabs();
_initialized = true;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:35,代码来源:AdvAuthEditor.cs
示例8: ListProjects
internal List<string> ListProjects()
{
if (_projects != null)
return _projects;
XmlHelper req = new XmlHelper("<Request/>");
req.AddElement(".", "Condition");
req.AddElement("Condition", "Name", PROJECT_LIST_PS_NAME);
Envelope evn = MainForm.LoginArgs.GreeningConnection.SendRequest("GetMySpace", new Envelope(req));
XmlHelper rsp = new XmlHelper(evn.Body);
_projects = new List<string>();
if (rsp.GetElement("Space") == null)
{
req = new XmlHelper("<Request/>");
req.AddElement(".", "Space");
req.AddElement("Space", "Name", PROJECT_LIST_PS_NAME);
XmlElement content = req.AddElement("Space", "Content");
XmlCDataSection section = content.OwnerDocument.CreateCDataSection("<ProjectList/>");
content.AppendChild(section);
MainForm.LoginArgs.GreeningConnection.SendRequest("CreateSpace", new Envelope(req));
}
else
{
string content = rsp.GetText("Space/Content");
XmlHelper h = new XmlHelper(content);
foreach (XmlElement projectElement in h.GetElements("Project"))
_projects.Add(projectElement.GetAttribute("Name"));
}
return _projects;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:33,代码来源:ProjectCollection.cs
示例9: UDSHandler
public UDSHandler(ProjectHandler project, XmlElement source)
{
Parent = project;
Contracts = new List<ContractHandler>();
AllContracts = new List<ContractHandler>();
XmlHelper ph = new XmlHelper(project.Preference);
List<string> list = new List<string>();
foreach (XmlElement e in ph.GetElements("Property/Contract"))
{
string name = e.GetAttribute("Name");
list.Add(name);
}
XmlHelper h = new XmlHelper(source);
foreach (XmlElement contractElement in h.GetElements("Contract"))
{
ContractHandler ch = new ContractHandler(contractElement);
if (list.Contains(ch.Name))
Contracts.Add(ch);
AllContracts.Add(ch);
}
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:25,代码来源:UDSHandler.cs
示例10: button1_Click
private void button1_Click(object sender, EventArgs e)
{
try
{
MainForm.DefaultDevSite.User = txtUser.Text;
MainForm.DefaultDevSite.Password = txtPassword.Text;
MainForm.DefaultDevSite.AccessPoint = txtAP.Text;
MainForm.DefaultDevSite.ContractName = cboContract.Text;
XmlHelper apXml = new XmlHelper("<AppContent/>");
apXml.AddElement(".", "AccessPoint", txtAP.Text);
apXml.AddElement(".", "ContractName", cboContract.Text);
apXml.AddElement(".", "User", txtUser.Text);
apXml.AddElement(".", "Password", txtPassword.Text);
MainForm.Storage.SetPropertyXml("DevLoginAP", txtAP.Text, apXml.GetElement("."));
MainForm.Storage.SetProperty("DevLastLoginAP", txtAP.Text);
MainForm.Storage.SetProperty("DevLastLoginContract", cboContract.Text);
MainForm.Storage.SetProperty("DevLastLoginName", txtUser.Text);
MainForm.Storage.SetProperty("DevLastLoginPassword", txtPassword.Text);
MainForm.Storage.SetProperty("DevAutoLogin", chkAutoLogin.Checked.ToString().ToLower());
MainForm.LoginArgs.StaticPreference = apXml.GetElement("."); ;
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:31,代码来源:DevSiteForm.cs
示例11: Generate
public XmlElement Generate(XmlElement serviceDefinition)
{
ServiceEntity service = ServiceEntity.Parse(serviceDefinition);
XmlHelper h = new XmlHelper("<Request/>");
XmlElement reqElement = h.GetElement(".");
XmlElement recElement = h.AddElement(".", service.RequestRecordElement);
XmlHelper recHelper = new XmlHelper(recElement);
XmlElement fieldElement = recHelper.GetElement(".");
if (!string.IsNullOrWhiteSpace(service.FieldList.Source))
fieldElement = recHelper.AddElement(".", service.FieldList.Source);
XmlHelper fieldHelper = new XmlHelper(fieldElement);
List<Field> _requires = new List<Field>();
List<Field> _notRequries = new List<Field>();
foreach (Field field in service.FieldList.Fields)
{
if (field.SourceType != SourceType.Request) continue;
if (field.AutoNumber) continue;
if (field.InputType == IOType.Attribute)
fieldElement.SetAttribute(field.Source, string.Empty);
else if (field.Required)
_requires.Add(field);
else
_notRequries.Add(field);
}
if (_requires.Count > 0)
{
XmlNode node = reqElement.OwnerDocument.CreateComment("以下為必要欄位");
fieldElement.AppendChild(node);
foreach (Field field in _requires)
{
string value = string.Empty;
if (field.InputType == IOType.Xml)
value = "xml";
fieldHelper.AddElement(".", field.Source, value);
}
}
if (_notRequries.Count > 0)
{
XmlNode node = reqElement.OwnerDocument.CreateComment("以下為非必要欄位");
fieldElement.AppendChild(node);
foreach (Field field in _notRequries)
{
string value = string.Empty;
if (field.InputType == IOType.Xml)
value = "xml";
fieldHelper.AddElement(".", field.Source, value);
}
}
return reqElement;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:60,代码来源:InsertTempGenerator.cs
示例12: btnDelete_Click
private void btnDelete_Click(object sender, EventArgs e)
{
if (rbAll.Checked)
{
XmlHelper sh = new XmlHelper();
XmlHelper th = new XmlHelper();
Parallel.ForEach(MainForm.CurrentUDS.Contracts, contract =>
{
sh.AddElement(".", "ContractName", contract.Name);
});
Parallel.ForEach(MainForm.CurrentUDT.Tables, table =>
{
th.AddElement(".", "TableName", table.Name);
});
try
{
_project.SendRequest("UDSManagerService.DeleteContracts", new Envelope(sh));
}
catch { }
try
{
_project.SendRequest("UDTService.DDL.DropTables", new Envelope(th));
}
catch { }
}
MainForm.Projects.RemoveProject(_project.Name);
this.Close();
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:32,代码来源:DeleteProjectForm.cs
示例13: ReadXml
public void ReadXml(XmlReader reader)
{
var xml = new XmlHelper(reader);
Totals = xml.deserialize<FactionWarfareTotals>("totals");
Factions = xml.deserializeRowSet<FactionWarfareEntry>("factions");
FactionWars = xml.deserializeRowSet<FactionWarfareEntry>("factionWars");
}
开发者ID:nozzy83,项目名称:evelib,代码行数:7,代码来源:FactionWarfareStats.cs
示例14: GetAuthElement
public System.Xml.XmlElement GetAuthElement()
{
XmlHelper h = new XmlHelper("<Authentication />");
h.AddElement(".", "Public");
h.SetAttribute("Public", "Enabled", "true");
return h.GetElement(".");
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:7,代码来源:PublicAuthEditor.cs
示例15: GetXml
internal XmlElement GetXml()
{
XmlHelper h = new XmlHelper("<Order/>");
h.SetAttribute(".", "Target", Target);
h.SetAttribute(".", "Source", Source);
return h.GetElement(".");
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:7,代码来源:Order.cs
示例16: SendRequest
private static Dictionary<string, ConfigurationRecord> SendRequest(DSXmlHelper request)
{
string srvname = "SmartSchool.Configuration.GetDetailList";
Dictionary<string, ConfigurationRecord> records = new Dictionary<string, ConfigurationRecord>();
DSXmlHelper response = DSAServices.CallService(srvname, new DSRequest(request)).GetContent();
foreach (XmlElement each in response.GetElements("Configuration"))
{
XmlHelper helper = new XmlHelper(each);
string name = helper.GetString("Name");
XmlElement configdata = null;
foreach (XmlNode content in helper.GetElement("Content").ChildNodes)
{
if (content.NodeType == XmlNodeType.Element) //內容可能是以「Configurations」為 Root,也可能是舊的格式。
configdata = content as XmlElement;
}
if (configdata == null)
configdata = XmlHelper.LoadXml("<" + ConfigurationRecord.RootName + "/>");
records.Add(name, new ConfigurationRecord(name, configdata as XmlElement));
}
return records;
}
开发者ID:ChunTaiChen,项目名称:K12.Data,代码行数:27,代码来源:ConfigProvider_App.cs
示例17: BindSiteToRow
private void BindSiteToRow(DataGridViewRow row, XmlElement siteElement)
{
XmlHelper h = new XmlHelper(siteElement);
row.Cells[colSiteName.Name].Value = siteElement.GetAttribute("Name");
row.Cells[colAccessPoint.Name].Value = h.GetText("AccessPoint");
row.Tag = siteElement;
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:7,代码来源:ProxyDeployForm.cs
示例18: ReadXml
public void ReadXml(XmlReader reader)
{
var xml = new XmlHelper(reader);
Agents = xml.deserializeRowSet<StandingEntry>("agents");
Corporations = xml.deserializeRowSet<StandingEntry>("NPCCorporations");
Factions = xml.deserializeRowSet<StandingEntry>("factions");
}
开发者ID:nozzy83,项目名称:evelib,代码行数:7,代码来源:StandingsList.cs
示例19: EmailService
public EmailService()
{
InitializeComponent();
string currentPath = GetType().Assembly.Location;
currentPath = currentPath.Substring(0, currentPath.LastIndexOf(@"\")) + "\\";
string actionConfig = currentPath + "ActionConfig.xml";
if (!File.Exists(actionConfig))
{
_log.Fatal(string.Format("配置文件:{0} 不存在", actionConfig));
}
_xmlHelper = new XmlHelper(actionConfig);
string hourMinute = _xmlHelper.GetAttrValue("DoTime", "Value");
_doDllStr = _xmlHelper.GetAttrValue("DoAction", "Dll");
_doDllActionStr = _xmlHelper.GetAttrValue("DoAction", "Action");
try
{
_intHour = Convert.ToInt32(hourMinute.Split(':')[0]);
_intMinute = Convert.ToInt32(hourMinute.Split(':')[1]);
}
catch (Exception ex)
{
_log.Fatal(ex.Message);
}
}
开发者ID:shakasi,项目名称:shakasi.github.com,代码行数:29,代码来源:EmailService.cs
示例20: btnSave_Click
private void btnSave_Click(object sender, EventArgs e)
{
if (txtModule.Text == _moduleURL && txtGreening.Text == _greeningURL)
{
this.Close();
return;
}
DialogResult dr = MessageBox.Show("設定已變更, 儲存後必須重新啟動程式以套用新設定。\n是否儲存?", "問題", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dr == System.Windows.Forms.DialogResult.Yes)
{
string path = Path.Combine(Environment.CurrentDirectory, "Setup.config");
//if (File.Exists(path))
// File.Delete(path);
XmlHelper h = new XmlHelper("<Setup/>");
h.AddElement(".", "GreeningAccessPoint", txtGreening.Text);
h.AddElement(".", "ModuleAccessPoint", txtModule.Text);
h.GetElement(".").OwnerDocument.Save(path);
if (SetupChanged != null)
SetupChanged.Invoke(this, e);
else
MessageBox.Show("儲存完畢", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
this.Close();
}
开发者ID:lidonghao1116,项目名称:ProjectManager,代码行数:27,代码来源:SetupConfigForm.cs
注:本文中的XmlHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论