Example #1
0
 private void BtnDownloadClick(object sender, EventArgs e)
 {
     if (ProfileList.SelectedRows[0] != null)
     {
         DataGridViewRow data = ProfileList.SelectedRows[0];
         var pro = new OnlineProfile(data.Cells[0].Value.ToString(), data.Cells[1].Value.ToString(),
                                     data.Cells[2].Value.ToString(), data.Cells[3].Value.ToString(),
                                     data.Cells[4].Value.ToString(), data.Cells[5].Value.ToString());
         var client = new WebClient();
         string dir = LazySettings.OurDirectory + @"\FlyingProfiles";
         string fileName = dir + @"\" + pro.Name + ".xml";
         if (!Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         if (File.Exists(fileName))
         {
             DialogResult dr = MessageBox.Show(pro.Name + " already exist - not saving. Overwrite?", "Overwrite",
                                               MessageBoxButtons.YesNo);
             switch (dr)
             {
                 case DialogResult.No:
                     return;
             }
         }
         try
         {
             string setDowunload =
                 string.Format("http://profiles.wow-lazybot.com/getflying.php?username={0}&password={1}&id={2}",
                               LazySettings.UserName, LazySettings.Password, pro.Id);
             WebRequest.Create(setDowunload).GetResponse();
             string url = string.Format("http://profiles.wow-lazybot.com/flyingprofiles/{0}.xml", pro.Id);
             client.DownloadFile(url, fileName);
             InvokeProfileDownload(new EProfileDownloaded(fileName));
             MessageBox.Show("Profile downloaded and loaded");
         }
         catch (Exception exception)
         {
             MessageBox.Show("Download error !\n" + exception.Message);
         }
     }
     else
     {
         MessageBox.Show("Selected a profile before downloading");
     }
 }
Example #2
0
 private void BtnDownloadClick(object sender, EventArgs e)
 {
     if (ProfileList.SelectedRows[0] != null)
     {
         DataGridViewRow data = ProfileList.SelectedRows[0];
         var             pro  = new OnlineProfile(data.Cells[0].Value.ToString(), data.Cells[1].Value.ToString(),
                                                  data.Cells[2].Value.ToString(), data.Cells[3].Value.ToString(),
                                                  data.Cells[4].Value.ToString(), data.Cells[5].Value.ToString());
         var    client   = new WebClient();
         string dir      = LazySettings.OurDirectory + @"\FlyingProfiles";
         string fileName = dir + @"\" + pro.Name + ".xml";
         if (!Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         if (File.Exists(fileName))
         {
             DialogResult dr = MessageBox.Show(pro.Name + " already exist - not saving. Overwrite?", "Overwrite",
                                               MessageBoxButtons.YesNo);
             switch (dr)
             {
             case DialogResult.No:
                 return;
             }
         }
         try
         {
             string setDowunload =
                 string.Format("http://profiles.wow-lazybot.com/getflying.php?username={0}&password={1}&id={2}",
                               LazySettings.UserName, LazySettings.Password, pro.Id);
             WebRequest.Create(setDowunload).GetResponse();
             string url = string.Format("http://profiles.wow-lazybot.com/flyingprofiles/{0}.xml", pro.Id);
             client.DownloadFile(url, fileName);
             InvokeProfileDownload(new EProfileDownloaded(fileName));
             MessageBox.Show("Profile downloaded and loaded");
         }
         catch (Exception exception)
         {
             MessageBox.Show("Download error !\n" + exception.Message);
         }
     }
     else
     {
         MessageBox.Show("Selected a profile before downloading");
     }
 }