Exemplo n.º 1
0
        /// <summary>
        /// Get a specified document from the database server
        /// </summary>
        /// <param name="log">The log that stores your document</param>
        /// <param name="file">The key of your document</param>
        /// <returns>A document</returns>
        public Document GetDocument(UuidObject log, UuidObject file)
        {
            string response = NetworkHandler.Get(this.NodeLocation.HttpAddress(), $"document/{log.Id}/{file.Id}");
            var    doc      = JsonConvert.DeserializeObject <Document>(response);

            return(doc);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get all the logs on this database server
        /// </summary>
        /// <returns>A list of all logs that are currently available on the database server</returns>
        public List <string> GetLogs()
        {
            string        response = NetworkHandler.Get(this.NodeLocation.HttpAddress(), $"meta/logs");
            List <string> logs     = response.Split('\n').ToList();

            logs.Remove(logs.First());
            return(logs);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get all the keys on a specified log on this database server
        /// </summary>
        /// <param name="log">The log you want the keys from</param>
        /// <returns>A list of all keys that are currently available on the specified log on the database server</returns>
        public List <string> GetKeys(UuidObject log)
        {
            string response = NetworkHandler.Get(this.NodeLocation.HttpAddress(), $"meta/log/{log.Id}/documents");

            Console.WriteLine(response);
            List <string> keys = JsonConvert.DeserializeObject <List <string> >(response);

            return(keys);
        }
Exemplo n.º 4
0
        public static Location Lookup(string ip, int port)
        {
            Location _return;
            string   json = NetworkHandler.Get("http://ip-api.com/json/", ip);

            _return          = JsonConvert.DeserializeObject <Location>(json);
            _return.HttpPort = port;
            _return.ip       = _return.query;
            return(_return);
        }