Ejemplo n.º 1
0
Archivo: VkObject.cs Proyecto: vknet/vk
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static VkObject FromJson(VkResponse response)
        {
            var obj = new VkObject
            {
                Id = Utilities.GetNullableLongId(response["object_id"])
            };

            string type = response["type"];
            switch (type)
            {
                case "group":
                    {
                        obj.Type = VkObjectType.Group;
                        break;
                    }
                case "user":
                    {
                        obj.Type = VkObjectType.User;
                        break;
                    }
                case "application":
                    {
                        obj.Type = VkObjectType.Application;
                        break;
                    }
                default:
                {
                    return obj;
                }
            }
            return obj;
        }
Ejemplo n.º 2
0
Archivo: VkObject.cs Proyecto: ddfx/vk
        internal static VkObject FromJson(VkResponse response)
        {
            var obj = new VkObject();

            obj.Id = Utilities.GetNullableLongId(response["object_id"]);

            string type = response["type"];

            switch (type)
            {
            case "group":
                obj.Type = VkObjectType.Group;
                break;

            case "user":
                obj.Type = VkObjectType.User;
                break;

            case "application":
                obj.Type = VkObjectType.Application;
                break;
            }

            return(obj);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response"> Ответ сервера. </param>
        /// <returns> </returns>
        public static VkObject FromJson(VkResponse response)
        {
            var obj = new VkObject
            {
                Id = Utilities.GetNullableLongId(response: response[key: "object_id"])
            };

            string type = response[key : "type"];

            switch (type)
            {
            case "group":

            {
                obj.Type = VkObjectType.Group;

                break;
            }

            case "user":

            {
                obj.Type = VkObjectType.User;

                break;
            }

            case "application":

            {
                obj.Type = VkObjectType.Application;

                break;
            }

            default:

            {
                return(obj);
            }
            }

            return(obj);
        }
Ejemplo n.º 4
0
        internal static VkObject FromJson(VkResponse response)
        {
            var obj = new VkObject();

            obj.Id = Utilities.GetNullableLongId(response["object_id"]);

            string type = response["type"];
            switch (type)
            {
                case "group":
                    obj.Type = VkObjectType.Group;
                    break;

                case "user":
                    obj.Type = VkObjectType.User;
                    break;

                case "application":
                    obj.Type = VkObjectType.Application;
                    break;
            }

            return obj;
        }