private void button1_Click(object sender, EventArgs e) { // check files we need to update _updateFile = new UpdateFile(); _updateFile.Message = textBox1.Text; _updateFile.Version = Assembly.LoadFile(Settings.Default.BaseFile).GetName().Version.ToString(); foreach (DataGridViewRow row in dataGridView1.Rows) { var f = new UpdateFileInfo(); f.SystemPath = row.Cells[0].Value.ToString(); f.Md5Hash = row.Cells[1].Value.ToString(); f.DownloadUri = "http://update.utopiarealms.com/files/" + f.SystemPath.Replace('\\', '/'); var fi = new FileInfo(Path.Combine(_baseFolderPath, f.SystemPath)); f.Length = fi.Length; f.LastWriteTime = fi.LastWriteTimeUtc; _updateFile.Files.Add(f); } var ms = new MemoryStream(); var writer = new BinaryWriter(ms); foreach (var fileInfo in _updateFile.Files) { fileInfo.Save(writer); } ms.Position = 0; var hash = Md5Hash.Calculate(ms); _updateFile.UpdateToken = hash.ToString(); if (_previousFile != null) { _newFiles = _updateFile.GetChangedFiles(_previousFile); } else { _newFiles = _updateFile.Files; } if (_newFiles.Count == 0) { MessageBox.Show("No changes found."); return; } // upload them _finished = false; var progressForm = new FrmProgress(); progressForm.Progress = _progress; progressForm.Label = _file; new ThreadStart(Publish).BeginInvoke(null, null); progressForm.Show(this); while (!_finished) { progressForm.Progress = _progress; progressForm.Label = _file; progressForm.Refresh(); Application.DoEvents(); Thread.Sleep(10); } progressForm.Close(); FrmMain_Load(null, null); MessageBox.Show("Autoupdate publish is complete", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); }