本文整理汇总了C#中SecurityElement.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SecurityElement.ToString方法的具体用法?C# SecurityElement.ToString怎么用?C# SecurityElement.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityElement
的用法示例。
在下文中一共展示了SecurityElement.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString
public override string ToString ()
{
// MS "by design" behaviour (see FDBK14362)
ThrowOnInvalid (Directory);
SecurityElement element = new SecurityElement ("System.Security.Policy.ApplicationDirectory");
element.AddAttribute ("version", "1");
element.AddChild (new SecurityElement ("Directory", directory));
return element.ToString ();
}
示例2: ToString
public override string ToString ()
{
SecurityElement se = new SecurityElement ("System.Security.Policy.PermissionRequestEvidence");
se.AddAttribute ("version", "1");
if (requested != null) {
SecurityElement requestElement = new SecurityElement ("Request");
requestElement.AddChild (requested.ToXml ());
se.AddChild (requestElement);
}
if (optional != null) {
SecurityElement optionalElement = new SecurityElement ("Optional");
optionalElement.AddChild (optional.ToXml ());
se.AddChild (optionalElement);
}
if (denied != null) {
SecurityElement deniedElement = new SecurityElement ("Denied");
deniedElement.AddChild (denied.ToXml ());
se.AddChild (deniedElement);
}
return se.ToString ();
}
示例3: ToString
// Convert this object into a string.
public override String ToString()
{
SecurityElement element;
element = new SecurityElement("System.Security.Policy.Hash");
element.AddAttribute("version", "1");
byte[] rawData = RawData;
if(rawData != null && rawData.Length != 0)
{
element.AddChild(new SecurityElement
("RawData", StrongNamePublicKeyBlob.ToHex(rawData)));
}
return element.ToString();
}
示例4: ToString
public override string ToString ()
{
SecurityElement se = new SecurityElement (GetType ().FullName);
se.AddAttribute ("version", "1");
StringBuilder sb = new StringBuilder ();
byte[] raw = GetData ();
for (int i=0; i < raw.Length; i++)
sb.Append (raw [i].ToString ("X2"));
se.AddChild (new SecurityElement ("RawData", sb.ToString ()));
return se.ToString ();
}
示例5: ToString
public override string ToString ()
{
SecurityElement element = new SecurityElement (typeof (System.Security.Policy.StrongName).Name);
element.AddAttribute ("version", "1");
element.AddAttribute ("Key", publickey.ToString ());
element.AddAttribute ("Name", name);
element.AddAttribute ("Version", version.ToString ());
return element.ToString ();
}
示例6: ToString
public override string ToString ()
{
SecurityElement se = new SecurityElement (GetType ().FullName);
se.AddAttribute ("version", "1");
return se.ToString ();
}
示例7: SaveRecord
private Boolean SaveRecord()
{
SecurityElement xmlRoot = new SecurityElement("expansion_pack_record");
lock (m_lock)
{
foreach (var item in m_packRecordMap)
{
String packId = item.Key;
ExpansionPackRecord record = item.Value;
SecurityElement xmlItem = new SecurityElement("item");
xmlRoot.AddChild(xmlItem);
xmlItem.AddAttribute("id", packId);
xmlItem.AddAttribute("state", ((Int32)record.state).ToString());
}
}
try
{
CreateDirectoryForFile(GetRecordFilePath());
File.WriteAllText(GetRecordFilePath(), xmlRoot.ToString());
return true;
}
catch (IOException e)
{
Debug.LogException(e);
return false;
}
}
示例8: ToString
// Convert this object into a string.
public override String ToString()
{
SecurityElement element = new SecurityElement
("System.Security.Policy.Url");
SecurityElement child;
element.AddAttribute("version", "1");
child = new SecurityElement
("Url", SecurityElement.Escape(parser.URL));
element.AddChild(child);
return element.ToString();
}
示例9: MultipleAttributes
public void MultipleAttributes()
{
SecurityElement se = new SecurityElement("Multiple");
se.AddAttribute("Attribute1", "One");
se.AddAttribute("Attribute2", "Two");
string expected = string.Format("<Multiple Attribute1=\"One\"{0}Attribute2=\"Two\"/>{0}", Environment.NewLine);
Assert.Equal(expected, se.ToString());
}
示例10: Tag
public void Tag()
{
SecurityElement se = new SecurityElement("Values");
Assert.Equal("Values", se.Tag);
Assert.Equal(string.Format(CultureInfo.InvariantCulture,
"<Values/>{0}", Environment.NewLine),
se.ToString());
se.Tag = "abc:Name";
Assert.Equal("abc:Name", se.Tag);
Assert.Equal(string.Format(CultureInfo.InvariantCulture,
"<abc:Name/>{0}", Environment.NewLine),
se.ToString());
se.Tag = "Name&Address";
Assert.Equal("Name&Address", se.Tag);
Assert.Equal(string.Format(CultureInfo.InvariantCulture,
"<Name&Address/>{0}", Environment.NewLine),
se.ToString());
se.Tag = string.Empty;
Assert.Equal(string.Empty, se.Tag);
Assert.Equal(string.Format(CultureInfo.InvariantCulture,
"</>{0}", Environment.NewLine),
se.ToString());
}
示例11: ToString
// Convert this object into a string.
public override String ToString()
{
SecurityElement element = new SecurityElement
("System.Security.Policy.PermissionRequestEvidence");
SecurityElement child;
element.AddAttribute("version", "1");
if(request != null)
{
child = new SecurityElement("Request");
child.AddChild(request.ToXml());
element.AddChild(child);
}
if(optional != null)
{
child = new SecurityElement("Optional");
child.AddChild(optional.ToXml());
element.AddChild(child);
}
if(denied != null)
{
child = new SecurityElement("Denied");
child.AddChild(denied.ToXml());
element.AddChild(child);
}
return element.ToString();
}
示例12: ToString
// Convert this object into a string.
public override String ToString()
{
SecurityElement element = new SecurityElement
("System.Security.Policy.Site");
SecurityElement child;
element.AddAttribute("version", "1");
child = new SecurityElement
("Name", SecurityElement.Escape(name));
element.AddChild(child);
return element.ToString();
}
示例13: ToString
// Convert this object into a string.
public override String ToString()
{
SecurityElement element = new SecurityElement("StrongName");
element.AddAttribute("version", "1");
element.AddAttribute("Key", blob.ToString());
element.AddAttribute
("Name", SecurityElement.Escape(name));
element.AddAttribute("Version", version.ToString());
return element.ToString();
}
示例14: ToString
public override string ToString ()
{
SecurityElement se = new SecurityElement ("System.Security.Policy.Zone");
se.AddAttribute ("version", "1");
se.AddChild (new SecurityElement ("Zone", zone.ToString ()));
return se.ToString ();
}
示例15: ToString
public override string ToString ()
{
SecurityElement element = new SecurityElement ("System.Security.Policy.Site");
element.AddAttribute ("version", "1");
element.AddChild (new SecurityElement ("Name", origin_site));
return element.ToString ();
}