本文整理汇总了C#中agsXMPP.Xml.Dom.Node类的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于agsXMPP.Xml.Dom命名空间,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Parse
public override void Parse(Node e)
{
if (e is Challenge)
{
Challenge c = e as Challenge;
Response resp;
byte[] outBytes;
byte[] inBytes = Convert.FromBase64String(c.Value);
sspiHelper.Process(inBytes, out outBytes);
if (outBytes == null)
{
resp = new Response();
}
else
{
resp = new Response();
resp.Value = Convert.ToBase64String(outBytes);
}
XmppClientConnection.Send(resp);
}
}
开发者ID:don59,项目名称:agsXmpp,代码行数:25,代码来源:GssapiMechanism.cs
示例2: Add
public void Add(Node e)
{
// can't add a empty node, so return immediately
// Some people tried dthis which caused an error
if (e == null)
return;
List.Add(e);
}
开发者ID:don59,项目名称:agsXmpp,代码行数:9,代码来源:ElementList.cs
示例3: Parse
public override void Parse(Node e)
{
if (e is Challenge)
{
Challenge ch = e as Challenge;
string msg = ch.TextBase64;
string content = GenerateFinalClientMessage(msg);
XmppClientConnection.Send(new Response(content));
}
}
开发者ID:SightstoneOfficial,项目名称:agsxmpp,代码行数:10,代码来源:ScramSha1Mechanism.cs
示例4: Parse
/// <summary>
///
/// </summary>
/// <param name="e"></param>
public override void Parse(Node e)
{
if (e is Challenge)
{
var c = e as Challenge;
byte[] bytes = Convert.FromBase64String(c.Value);
string msg = Encoding.UTF8.GetString(bytes, 0, bytes.Length);
var pairs = ParseMessage(msg);
string res = BuildResponse(pairs);
XmppClientConnection.Send(new Response(res));
}
}
开发者ID:sjkp,项目名称:agsxmpp,代码行数:17,代码来源:FacebookMechanism.cs
示例5: Add
public void Add(Node e)
{
// can't add a empty node, so return immediately
// Some people tried this which caused an error
if (e == null)
return;
if (m_Owner != null)
{
e.Parent = m_Owner;
if (e.Namespace == null)
e.Namespace = m_Owner.Namespace;
}
e.m_Index = Count;
List.Add(e);
}
开发者ID:SightstoneOfficial,项目名称:agsxmpp,代码行数:18,代码来源:NodeList.cs
示例6: Parse
public override void Parse(Node e)
{
if (e is protocol.sasl.Challenge)
{
protocol.sasl.Challenge c = e as protocol.sasl.Challenge;
Step1 step1 = new Step1(c.TextBase64);
if (step1.Rspauth == null)
{
//response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImduYXVjayIscmVhbG09IiIsbm9uY2U9IjM4MDQzMjI1MSIsY25vbmNlPSIxNDE4N2MxMDUyODk3N2RiMjZjOWJhNDE2ZDgwNDI4MSIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC9qYWJiZXIucnUiLGNoYXJzZXQ9dXRmLTgscmVzcG9uc2U9NDcwMTI5NDU4Y2EwOGVjYjhhYTIxY2UzMDhhM2U5Nzc
Step2 s2 = new Step2(step1, base.Username, base.Password, base.Server);
protocol.sasl.Response r = new agsXMPP.protocol.sasl.Response(s2.ToString());
base.XmppClientConnection.Send(r);
}
else
{
// SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
base.XmppClientConnection.Send(new protocol.sasl.Response());
}
}
}
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:21,代码来源:DigestMD5Mechanism.cs
示例7: StreamParserOnStreamStart
public override void StreamParserOnStreamStart(object sender, Node e)
{
base.StreamParserOnStreamStart (sender, e);
m_StreamStarted = true;
Login();
}
开发者ID:SightstoneOfficial,项目名称:agsxmpp,代码行数:8,代码来源:XmppComponentConnection.cs
示例8: Parse
/// <summary>
///
/// </summary>
/// <param name="e"></param>
public override void Parse(Node e)
{
// *No Challenges* in SASL ANONYMOUS
}
开发者ID:phiree,项目名称:dzdocs,代码行数:8,代码来源:AnonymousMechanism.cs
示例9: Parse
/// <summary>
///
/// </summary>
/// <param name="e"></param>
public abstract void Parse(Node e);
开发者ID:jptoto,项目名称:argsxmpp,代码行数:5,代码来源:Mechanism.cs
示例10: StreamParserOnStreamEnd
public virtual void StreamParserOnStreamEnd(object sender, Node e)
{
Element tag = e as Element;
string qName;
if (tag.Prefix == null)
qName = tag.TagName;
else
qName = tag.Prefix + ":" + tag.TagName;
string xml = "</" + qName + ">";
this.FireOnReadXml(this, xml);
}
开发者ID:phiree,项目名称:dzdocs,代码行数:14,代码来源:XmppConnection.cs
示例11: WriteTree
private void WriteTree(Node e, XmlTextWriter tw, Node parent)
{
if (e.NodeType == NodeType.Document)
{
//Write the ProcessingInstruction node.
// <?xml version="1.0" encoding="windows-1252"?> ...
Document doc = e as Document;
string pi = null;
if (doc.Version != null)
pi += "version='" + doc.Version + "'";
if (doc.Encoding != null)
{
if (pi != null)
pi += " ";
pi += "encoding='" + doc.Encoding + "'";
}
if (pi != null)
tw.WriteProcessingInstruction("xml", pi);
foreach(Node n in e.ChildNodes)
{
WriteTree(n, tw, e);
}
}
else if (e.NodeType == NodeType.Text)
{
tw.WriteString(e.Value);
}
else if (e.NodeType == NodeType.Comment)
{
tw.WriteComment(e.Value);
}
else if (e.NodeType == NodeType.Cdata)
{
tw.WriteCData(e.Value);
}
else if (e.NodeType == NodeType.Element)
{
Element el = e as Element;
if (el.Prefix==null)
tw.WriteStartElement( el.TagName );
else
tw.WriteStartElement( el.Prefix + ":" + el.TagName );
// Write Namespace
if ( (parent == null || parent.Namespace != el.Namespace)
&& el.Namespace != null
&& el.Namespace.Length !=0
)
{
if (el.Prefix==null)
tw.WriteAttributeString("xmlns", el.Namespace);
else
tw.WriteAttributeString("xmlns:" + el.Prefix , el.Namespace);
}
foreach (string attName in el.Attributes.Keys)
{
tw.WriteAttributeString(attName, el.Attribute(attName));
}
//tw.WriteString(el.Value);
if (el.ChildNodes.Count > 0)
{
foreach(Node n in el.ChildNodes)
{
WriteTree(n, tw, e);
}
tw.WriteEndElement();
}
else
{
tw.WriteEndElement();
}
}
}
开发者ID:don59,项目名称:agsXmpp,代码行数:82,代码来源:Node.cs
示例12:
public virtual void StreamParserOnStreamStart (object sender, Node e)
{
string xml = e.ToString().Trim();
xml = xml.Substring(0, xml.Length - 2) + ">";
this.FireOnReadXml(this, xml);
protocol.Stream st = e as protocol.Stream; //fixed this because casting throws exceptions, whereas 'as' might simply return null, which was clearly ags's intention.
if (st != null)
{
m_StreamId = st.StreamId;
m_StreamVersion = st.Version;
}
}
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:14,代码来源:XmppConnection.cs
示例13: BuildXml
private string BuildXml(Node e, Formatting format, int indent, char indentchar)
{
if ( e != null )
{
System.IO.StringWriter tw = new StringWriter();
XmlTextWriter w = new XmlTextWriter(tw);
w.Formatting = format;
w.Indentation = indent;
w.IndentChar = indentchar;
WriteTree(this, w, null);
return tw.ToString();
}
else
{
return "";
}
}
开发者ID:phiree,项目名称:dzdocs,代码行数:19,代码来源:Node(2).cs
示例14: StreamParser_OnStreamElement
private void StreamParser_OnStreamElement(object sender, Node e)
{
Console.WriteLine("");
Console.WriteLine("=========================Received==========================");
Console.WriteLine(e.ToString());
if (this.OnOutput != null)
{
this.OnOutput(this, "Received", e.ToString());
}
Type type = e.GetType();
if (type == typeof(Presence))
{
// route presences here and handle all subscription stuff
ProcessPresence(e as Presence);
}
else if (type == typeof(Message))
{
// route the messages here
ProcessMessage(e as Message);
}
else if (type == typeof(IQ))
{
ProcessIQ(e as IQ);
}
else if (type == typeof(agsXMPP.protocol.sasl.Auth))
{
ProcessAuth(e as agsXMPP.protocol.sasl.Auth);
}
else if (type == typeof(agsXMPP.protocol.sasl.Response))
{
ProcessResponse(e as agsXMPP.protocol.sasl.Response);
}
else
{
}
}
开发者ID:SiteView,项目名称:ECC8.13,代码行数:39,代码来源:XmppServerConnection.cs
示例15: StreamParser_OnStreamEnd
private void StreamParser_OnStreamEnd(object sender, Node e)
{
Console.WriteLine("");
Console.WriteLine("=========================Received==========================");
Console.WriteLine("</stream:stream>");
if (this.OnOutput != null)
{
this.OnOutput(this, "Received", e.ToString());
}
EndClientConnection();
}
开发者ID:SiteView,项目名称:ECC8.13,代码行数:13,代码来源:XmppServerConnection.cs
示例16: StreamParser_OnStreamStart
private void StreamParser_OnStreamStart(object sender, Node e)
{
if (e.NodeType == NodeType.Element)
{
if (((Element)e).TagName == "Scan")
{
byte[] byteData = Encoding.UTF8.GetBytes(ConfigManager.Company.ID);
// Begin sending the data to the remote device.
m_Sock.Send(byteData);
m_Sock.Close();
return;
}
}
if (this.OnClientStart != null && !this.m_AuthenticatedClient)
{
this.OnClientStart(this);
}
if (this.OnOutput != null)
{
this.OnOutput(this, "Received", e.ToString());
}
Console.WriteLine("");
Console.WriteLine("=========================Received==========================");
Console.WriteLine(e.ToString());
this.strClientVersion = ((Element)e).GetAttribute("version");
string strClientLang = ((Element)e).GetAttribute("xml:lang");
if (strClientLang == null)
{
this.objClientlanguage = System.Globalization.CultureInfo.CurrentCulture;
}
else
{
this.objClientlanguage = System.Globalization.CultureInfo.GetCultureInfo(strClientLang.Replace('_', '-'));
}
if (this.strClientVersion != null)
{
if (float.Parse(ConfigManager.Version) < float.Parse(this.strClientVersion))
{
this.strClientVersion = ConfigManager.Version;
}
}
SendOpenStream();
}
开发者ID:SiteView,项目名称:ECC8.13,代码行数:51,代码来源:XmppServerConnection.cs
示例17: StreamParserOnStreamElement
public override void StreamParserOnStreamElement(object sender, Node e)
{
base.StreamParserOnStreamElement(sender, e);
if (e is IQ)
{
if (OnIq != null)
OnIq(this, e as IQ);
IQ iq = e as IQ;
if ( iq != null && iq.Query != null)
{
// Roster
if (iq.Query is Roster)
OnRosterIQ(iq);
}
}
else if (e is Message)
{
if (OnMessage != null)
OnMessage(this, e as Message);
}
else if (e is Presence)
{
if (OnPresence != null)
OnPresence(this, e as Presence);
}
else if (e is Features)
{
// Stream Features
// StartTLS stuff
Features f = e as Features;
#if SSL || BCCRYPTO || CF_2
if (f.SupportsStartTls && m_UseStartTLS)
{
DoChangeXmppConnectionState(XmppConnectionState.Securing);
Send(new StartTls());
}
else
#endif
if (m_UseCompression &&
f.SupportsCompression &&
f.Compression.SupportsMethod(CompressionMethod.zlib))
{
// Check for Stream Compression
// we support only ZLIB because its a free algorithm without patents
// yes ePatents suck
DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
Send(new Compress(CompressionMethod.zlib));
}
else if (m_RegisterAccount)
{
// Do registration after TLS when possible
if (f.SupportsRegistration)
GetRegistrationFields(e);
else
{
// registration is not enabled on this server
FireOnError(this, new RegisterException("Registration is not allowed on this server"));
Close();
// Close the stream
}
}
}
#if SSL || BCCRYPTO || CF_2
else if (e is Proceed)
{
StreamParser.Reset();
if (ClientSocket.StartTls())
{
SendStreamHeader(false);
DoChangeXmppConnectionState(XmppConnectionState.Authenticating);
}
}
#endif
else if (e is Compressed)
{
//DoChangeXmppConnectionState(XmppConnectionState.StartCompression);
StreamParser.Reset();
ClientSocket.StartCompression();
// Start new Stream Header compressed.
SendStreamHeader(false);
DoChangeXmppConnectionState(XmppConnectionState.Compressed);
}
else if (e is agsXMPP.protocol.Error)
{
if (OnStreamError != null)
OnStreamError(this, e as Element);
}
}
开发者ID:jptoto,项目名称:argsxmpp,代码行数:92,代码来源:XmppClientConnection.cs
示例18: AddChild
/// <summary>
/// Appends the given Element as child element
/// </summary>
/// <param name="e"></param>
public virtual void AddChild(Node e)
{
m_ChildNodes.Add(e);
}
开发者ID:don59,项目名称:agsXmpp,代码行数:8,代码来源:Node.cs
示例19: BuildXml
private string BuildXml(Node e, Formatting format, int indent, char indentchar)
{
if ( e != null )
{
using(var tw = new StringWriter())
{
using(var w = new XmlTextWriter(tw))
{
w.Formatting = format;
w.Indentation = indent;
w.IndentChar = indentchar;
WriteTree(this, w, null);
return tw.ToString();
}
}
}
return "";
}
开发者ID:don59,项目名称:agsXmpp,代码行数:20,代码来源:Node.cs
示例20: NodeList
public NodeList(Node owner)
{
m_Owner = owner;
}
开发者ID:SightstoneOfficial,项目名称:agsxmpp,代码行数:4,代码来源:NodeList.cs
注:本文中的agsXMPP.Xml.Dom.Node类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论