Battle_Script_Pro.Form1.DownloadFile C# (CSharp) Метод

DownloadFile() приватный Метод

private DownloadFile ( string fileName, string fileType ) : void
fileName string
fileType string
Результат void
        private void DownloadFile(string fileName, string fileType)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (File.Exists(System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "." + fileType))
            {
                bool success = true;
                if (File.Exists(System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "_backup." + fileType))
                {
                    try
                    {
                        File.Delete(System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "_backup." + fileType);
                    }
                    catch
                    {
                        MessageBox.Show("Unable to remove existing backed up file. Please manually update your file.");
                        success = false;
                    }
                }
                if (success)
                {
                    try
                    {
                        File.Move(System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "." + fileType, System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "_backup." + fileType);
                    }
                    catch
                    {
                        MessageBox.Show("Unable to backup file.");
                        success = false;
                    }
                    if (success)
                    {
                        try
                        {
                            using (WebClient Client = new WebClient())
                            {
                                Client.DownloadFile("https://dl.dropboxusercontent.com/u/24219056/" + fileName + "." + fileType, System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "." + fileType);
                            }
                            MessageBox.Show("Success!");
                        }
                        catch
                        {
                            MessageBox.Show("Could not update file. Restoring backup...");
                            File.Move(System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "_backup." + fileType, System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "." + fileType);
                        }
                    }
                }
            }
            else
            {
                try
                {
                    using (WebClient Client = new WebClient())
                    {
                        Client.DownloadFile("https://dl.dropboxusercontent.com/u/24219056/" + fileName + "." + fileType, System.Windows.Forms.Application.StartupPath + @"/Data/" + fileName + "." + fileType);
                    }
                    MessageBox.Show("Success!");
                }
                catch
                {
                    MessageBox.Show("Unable to download file. Please manually update your file.");
                }
            }
            Cursor.Current = Cursors.Default;
        }
Form1