Пример #1
0
        public void MojangAPI()
        {
            string  mojang_json = HttpGet("https://api.mojang.com/users/profiles/minecraft/" + TextBox_ID.Text, "");
            JObject get_uuid    = (JObject)JsonConvert.DeserializeObject(mojang_json);

            mojang_json = HttpGet("https://sessionserver.mojang.com/session/minecraft/profile/" + get_uuid["id"].ToString(), "");
            JObject get_value = (JObject)JsonConvert.DeserializeObject(mojang_json);

            try
            {
                mojang_json = DecodeBase64("utf-8", get_value["properties"][0]["value"].ToString());
                JObject get_skin_url = (JObject)JsonConvert.DeserializeObject(mojang_json);

                PictureBox_Skins.Image    = null;
                PictureBox_Skins.SizeMode = PictureBoxSizeMode.Zoom;
                PictureBox_Skins.LoadAsync(get_skin_url["textures"]["SKIN"]["url"].ToString());

                PictureBox_Capes.Image    = null;
                PictureBox_Capes.SizeMode = PictureBoxSizeMode.Zoom;
                PictureBox_Capes.LoadAsync(get_skin_url["textures"]["CAPE"]["url"].ToString());
            }
            catch {
                PictureBox_Skins.Image = null;
                PictureBox_Capes.Image = null;
                MessageBox.Show("获取失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        public void CrafatarAPI()
        {
            string  crafatar_json = HttpGet("https://api.mojang.com/users/profiles/minecraft/" + TextBox_ID.Text, "");
            JObject get_uuid      = (JObject)JsonConvert.DeserializeObject(crafatar_json);

            PictureBox_Avatars.LoadAsync("https://crafatar.com/avatars/" + get_uuid["id"].ToString());
            PictureBox_Avatars.Image    = null;
            PictureBox_Avatars.SizeMode = PictureBoxSizeMode.Zoom;

            PictureBox_Skins.LoadAsync("https://crafatar.com/skins/" + get_uuid["id"].ToString());
            PictureBox_Skins.Image    = null;
            PictureBox_Skins.SizeMode = PictureBoxSizeMode.Zoom;

            PictureBox_Capes.LoadAsync("https://crafatar.com/capes/" + get_uuid["id"].ToString());
            PictureBox_Capes.Image    = null;
            PictureBox_Capes.SizeMode = PictureBoxSizeMode.Zoom;
        }