Example #1
0
 /// <summary>
 /// Generates a CipEntry from a given <see cref="EndPoint"/> and <see cref="CipNodeType"/>.
 /// </summary>
 /// <param name="ep"></param>
 /// <param name="type"></param>
 public static CipEntry GenerateFor(IPEndPoint ep, CipNodeType type = CipNodeType.AccessNode)
 {
     if (ep.Address == IPAddress.Any)
         return new CipEntry (webclient.DownloadString ("http://icanhazip.com").Trim ('\r', '\n'), type);
     return new CipEntry (ep.Address.ToString (), type);
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TheSilentNet.CipEntry"/> class.
 /// </summary>
 /// <param name="cip">cIP.</param>
 /// <param name="type">Type.</param>
 public CipEntry(string cip, CipNodeType type)
 {
     Value = cip;
     Type = type;
 }
Example #3
0
 /// <summary>
 /// Adds a node to the 'cips' table.
 /// </summary>
 /// <returns><c>true</c>, if the node was added, <c>false</c> otherwise.</returns>
 /// <param name="cip">cIP.</param>
 /// <param name="type">Type.</param>
 public bool AddNode (string cip, CipNodeType type) {
     var pcip = cip.ToSQLiteParam ("@cip");
     var ptype = ((int)type).ToSQLiteParam ("@type");
     return QUERY_INSERT_NODE.ExecNonQuery (pcip, ptype) > 0;
 }