private void DataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 11)//upload { Open_File_Dialog.Filter = "Torrent Files|*.torrent"; if (Open_File_Dialog.ShowDialog() == DialogResult.OK) { try { ((DataGridView)sender).Rows[e.RowIndex].Cells[8].Value = Convert.ToBase64String(File.ReadAllBytes(Open_File_Dialog.FileName)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } else if (e.ColumnIndex == 12 && (((DataGridViewDisableButtonCell)((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex]).Enabled == true))//download { Save_File_Dialog.FileName = Text.Substring(0, Text.IndexOf("->") - 1) + " S" + Season.season_number?.ToString("D2") + "E" + ((decimal)((DataGridView)sender).Rows[e.RowIndex].Cells[2].Value).ToString("00") + ".torrent"; Save_File_Dialog.Filter = "Torrent File|*.torrent"; if (Save_File_Dialog.ShowDialog() == DialogResult.OK) { File.WriteAllBytes(Save_File_Dialog.FileName, Convert.FromBase64String((string)((DataGridView)sender).Rows[e.RowIndex].Cells[8].Value)); } } } catch (Exception) { } }
private void batchDownload_Click(object sender, EventArgs e) { try { if (Season.torrent_file != null && Season.torrent_file != "") { Save_File_Dialog.FileName = Text.Substring(0, Text.IndexOf("->") - 1) + Season.season_english_name + " (batch)" + ".torrent"; Save_File_Dialog.Filter = "Torrent File|*.torrent"; if (Save_File_Dialog.ShowDialog() == DialogResult.OK) { File.WriteAllBytes(Save_File_Dialog.FileName, Convert.FromBase64String(Season.torrent_file)); } batchDownload.BackColor = Properties.Settings.Default.green; } } catch (Exception) { batchDownload.BackColor = Properties.Settings.Default.red; } }