/// <summary>
        /// Send the reverse metadata from game server to the agent. This should be called when the game wants to update the metadata. Thread-safe.
        /// </summary>
        /// <param name="map">Current map.</param>
        /// <param name="mode">Current mode.</param>
        /// <param name="type">Current type.</param>
        public void SendReverseMetadata(string map,
                                        string mode,
                                        string type)
        {
            int code;

            using (var data = new OneArray())
                using (var mapObject = new OneObject())
                    using (var modeObject = new OneObject())
                        using (var typeObject = new OneObject())
                            using (var map1 = new Utf8ByteArray(map))
                                using (var mode1 = new Utf8ByteArray(mode))
                                    using (var type1 = new Utf8ByteArray(type))
                                    {
                                        mapObject.SetString("key", "map");
                                        mapObject.SetString("value", map1.ToString());
                                        modeObject.SetString("key", "mode");
                                        modeObject.SetString("value", mode1.ToString());
                                        typeObject.SetString("key", "type");
                                        typeObject.SetString("value", type1.ToString());
                                        data.PushObject(mapObject);
                                        data.PushObject(modeObject);
                                        data.PushObject(typeObject);
                                        code = one_server_send_reverse_metadata(_ptr, data.Ptr);
                                    }

            OneErrorValidator.Validate(code);
        }
        /// <summary>
        /// Retrieves the IPv6 <see cref="string"/> at the ip position in the ip list of the site at the given position.
        /// </summary>
        public string GetIPv6(uint position, uint ipPosition)
        {
            using (var result = new Utf8ByteArray((int)46))
            {
                int code = i3d_ping_sites_getter_list_site_ipv6_ip(_ptr, position, ipPosition, result);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
        /// <summary>
        /// Retrieves the hostname <see cref="string"/> value for the site at the given position.
        /// </summary>
        public string GetHostname(uint position)
        {
            using (var result = new Utf8ByteArray((int)64))
            {
                int code = i3d_ping_sites_getter_list_site_hostname(_ptr, position, result);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
Exemple #4
0
        IEnumerator GetPayload(IntPtr url, I3dSitesGetterWrapper.I3dHttpParsingCallback parsingCallback, IntPtr parsingUserdata, IntPtr userdata)
        {
            using (var url_string = new Utf8ByteArray(url)) {
                UnityWebRequest www = UnityWebRequest.Get(url_string.ToString());
                yield return(www.SendWebRequest());

                using (var json = new Utf8ByteArray(www.downloadHandler.text))
                {
                    parsingCallback(true, json, parsingUserdata);
                }
            }
        }
        /// <summary>
        /// Retrieves the <see cref="string"/> value from the array.
        /// </summary>
        public string GetString(uint position)
        {
            int size = GetStringSize(position);

            using (var result8 = new Utf8ByteArray(size))
            {
                int code = one_array_val_string(_ptr, position, result8, size);
                OneErrorValidator.Validate(code);

                result8.ReadPtr();
                return(result8.ToString());
            }
        }
Exemple #6
0
        /// <summary>
        /// Retrieves the IP <see cref="string"/> value from the ip list.
        /// </summary>
        public string GetIp(uint position)
        {
            uint size = GetStringSize(position);

            using (var result = new Utf8ByteArray((int)size))
            {
                int code = i3d_ping_ip_list_ip(_ptr, position, result, size);
                I3dErrorValidator.Validate(code);

                result.ReadPtr();
                return(result.ToString());
            }
        }
        /// <summary>
        /// Retrieves the <see cref="string"/> value from the object.
        /// </summary>
        public string GetString(string key)
        {
            int size = GetStringSize(key);

            using (var result8 = new Utf8ByteArray(size))
            {
                int code;

                using (var key8 = new Utf8ByteArray(key))
                {
                    code = one_object_val_string(_ptr, key8, result8, size);
                }

                OneErrorValidator.Validate(code);

                result8.ReadPtr();
                return(result8.ToString());
            }
        }