vendredi 10 juillet 2015

c# random imgur generator to use with Skypetool

im trying to create skype tool and im trying to make a command for it what would give the user a random imgur link, i tried first to just random generate string like so:

                var chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
                var stringChars = new char[8];
                var random = new Random();

                for (int i = 0; i < stringChars.Length; i++)
                {
                    stringChars[i] = chars[random.Next(chars.Length)];
                }

                var finalString = new String(stringChars);

                string imgur = "http://imgur.com/" + finalString;

but of course it just gave me random imgur links which dont work, how could i check if the link is valid and then give it to the user or how could i use imgurs own "http://ift.tt/1IQI0zO" and return the link from that?




Aucun commentaire:

Enregistrer un commentaire