Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            List <int> ls = new List <int>();

            foreach (Profiles user2 in worked.items)
            {
                ls.Add(user2.id);
            }
            List <Profiles> likes = wallPost.GetLikes();

            foreach (Profiles user in likes)
            {
                if (!ls.Contains(user.id))
                {
                    Balls ball = new Balls(user);
                    wallPost.CreateComment(user, ball);
                    if (likes.Count < 25)
                    {
                        Tree tree = new Tree(user);
                        wallPost.AddPhoto(tree);
                    }
                    else if (user.id == 88589595)
                    {
                        Tree tree = new Tree(user);
                        wallPost.AddPhoto(tree);
                    }
                    //Редачим Ёлку


                    worked.items.Add(user);
                    Serialize();
                    break;
                }
            }
        }
Example #2
0
 public void CreateComment(Profiles user, Balls ball)
 {
     using (WebClient wc = new WebClient())
     {
         UploadServer     uploadServer  = JsonConvert.DeserializeObject <UploadServer>(wc.DownloadString(String.Format("https://api.vk.com/method/photos.getUploadServer?album_id=239545490&access_token={0}&v=5.60", Resources.token)));
         UploadedPhoto    uploadedPhoto = JsonConvert.DeserializeObject <UploadedPhoto>(Encoding.ASCII.GetString(wc.UploadFile(uploadServer.response.upload_url, ball.SaveImage)));
         PhotoInformation image         = JsonConvert.DeserializeObject <PhotoInformation>(wc.DownloadString(string.Format("https://api.vk.com/method/photos.save?album_id=239545490&photos_list={1}&server={2}&hash={3}&v=5.37&access_token={0}", Resources.token, uploadedPhoto.photos_list, uploadedPhoto.server, uploadedPhoto.hash)));
         string           attachment    = String.Format("photo{0}_{1}", image.response[0].owner_id, image.response[0].id);
         string           messages      = String.Format("*id{0} ({1}), Этот шарик я сделал специально для тебя, я старался(не забывай, я всего лишь машина). Теперь и ты есть на моей елочке. Надеюсь тебе понравилось😌. С наступающим тебя!!!🍊🍷🍸🎁🎅🎄🌟", user.id, user.first_name);
         SendComment(messages, attachment);
     }
 }