2using System.Collections.Generic;
3using System.Reflection;
5using System.Threading.Tasks;
25 private readonly
string registryJid;
53 if (this.client.State !=
XmppState.Connected)
57 SortedDictionary<string, bool> AssembliesSorted =
new SortedDictionary<string, bool>();
61 foreach (Assembly A
in LoadedAssemblies)
66 if (AN.Version.Major == 0 && AN.Version.Minor == 0 && AN.Version.Revision == 0 && AN.Version.Build == 0)
69 AssembliesSorted[A.FullName] =
true;
77 string[] Assemblies =
new string[AssembliesSorted.Count];
78 AssembliesSorted.Keys.CopyTo(Assemblies, 0);
80 string BareJid = this.client.BareJID.ToLower();
87 Created = DateTime.Now
103 Registration.Updated = DateTime.Now;
122 TaskCompletionSource<bool> T =
new TaskCompletionSource<bool>();
123 StringBuilder Xml =
new StringBuilder();
140 w.WriteElementString(
"Feature", Feature);
145 foreach (Annotation Annotation
in Registration.
Annotations)
147 w.WriteStartElement(
"Annotation");
148 w.WriteAttributeString(
"tag", Annotation.Tag);
149 w.WriteValue(Annotation.Value);
156 foreach (
string QN
in Registration.
Assemblies)
157 w.WriteElementString(
"Assembly", QN);
163 await this.client.SendIqSet(this.registryJid, Xml.ToString(), (Sender, e) =>
165 T.TrySetResult(e.Ok);
166 return Task.CompletedTask;
172 private void SetValues(Registration Registration,
string[] Assemblies, Annotation[] Annotations)
174 Registration.Assemblies = Assemblies;
175 Registration.BareJid = this.client.BareJID;
176 Registration.Features = this.client.GetFeatures();
177 Registration.Annotations = Annotations;
178 Registration.ClientName = this.client.ClientName;
179 Registration.ClientVersion = this.client.ClientVersion;
180 Registration.ClientOS = this.client.ClientOS;
181 Registration.Language = this.client.Language;
182 Registration.Host = this.client.Host;
183 Registration.Domain = this.client.Domain;
195 if ((Array1 is
null) ^ (Array2 is
null))
201 int i, c = Array1.Length;
203 if (Array2.Length != c)
206 for (i = 0; i < c; i++)
208 if (!Array1[i].Equals(Array2[i]))
Helps with common XML-related tasks.
static string Encode(string s)
Encodes a string for use in XML.
static XmlWriterSettings WriterSettings(bool Indent, bool OmitXmlDeclaration)
Gets an XML writer settings object.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
Static class that dynamically manages types and interfaces available in the runtime environment.
static Assembly[] Assemblies
Assemblies in the inventory.
Local registration object.
string[] Assemblies
Registered assemblies
string ClientName
Registered Client Name
string ClientVersion
Registered Client Version
DateTime Created
When registration object was created
Annotation[] Annotations
Registered annotations
string ClientOS
Registered Client OS
DateTime Updated
When registration object was last updated
string Language
Registered Client Language
string Domain
Registered Domain
string Host
Registered Host
string[] Features
Registered features
string BareJid
Registered Bare JID
XMPP-based Service Registration Client.
async Task CheckRegistration(params Annotation[] Annotations)
Checks if the software needs to be registered.
string ServiceRegistryJID
JID of the Service Registry.
const string NamespaceServiceRegistration
http://waher.se/Schema/ServiceRegistration.xsd
static async Task< DateTime?> GetRegistrationTime()
Gets the original registration time.
XmppClient Client
XMPP Client
ServiceRegistrationClient(XmppClient Client, string ServiceRegistryJID)
XMPP-based Service Registration Client.
static bool Equals< T >(T[] Array1, T[] Array2)
Compares two arrays
XmppState
State of XMPP connection.