private void обновитьСписокФайловToolStripMenuItem_Click(object sender, EventArgs e) { this.spisok_aTableAdapter.Fill(this.anime_ArchiveDataSet.Spisok_a); this.files_aTableAdapter.Fill(this.anime_ArchiveDataSet.files_a); Form_add f_add = new Form_add(); f_add.Owner = this; DataTable dt = spisok_aTableAdapter.GetData(); for (int i = 0; i < dt.Rows.Count; i++) { int id = Convert.ToInt32(dt.Rows[i]["kod"]); DataTable dt_files = files_filter_aTableAdapter.GetData(id); List<string> spis_dir = new List<string>(); for (int j = 0; j < dt_files.Rows.Count; j++) { string res = dt_files.Rows[j]["Path_s"].ToString(); int pol = res.LastIndexOf(dt_files.Rows[j]["name_s"].ToString()); if (pol == -1) { MessageBox.Show("Ошибка"); return; } res = res.Remove(pol); spis_dir.Add(res); } string obs = ""; bool perebor = true; int p = 0; char c = ' '; while (perebor) { for (int j = 0; j < spis_dir.Count; j++) { if (p == spis_dir[j].Length) { perebor = false; break; } if (j == 0) { c = spis_dir[j][p]; } else { if (c != spis_dir[j][p]) { perebor = false; } } } if (perebor) { obs += c; } p++; } int pos = obs.LastIndexOf('\\'); obs = obs.Remove(pos); obs += "\\"; DirectoryInfo di = new DirectoryInfo(obs); FileInfo[] fi = di.GetFiles("*.*", SearchOption.AllDirectories); s_video = null; AddCatalog(fi); files_aTableAdapter.Delete(id); for (int j = 0; j < s_video.Length; j++) { files_aTableAdapter.Insert(id, s_video[j].seria, s_video[j].filename, s_video[j].filepath,null); } } }
private void изменитьToolStripMenuItem_Click(object sender, EventArgs e) { Form_add f_add = new Form_add(); f_add.Owner = this; Form_add.anim_inf a_i = new Form_add.anim_inf(); string ser = ((ListView)listView1).SelectedItems[0].SubItems[1].Text; string name = ((ListView)listView1).SelectedItems[0].Text; DataTable dt_anim = GetInfoAnime(name, ser); MemoryStream ms = new MemoryStream(); Image image = null; byte[] Img = (byte[])dt_anim.Rows[0]["img"]; if (pictureBox1.Image != null) pictureBox1.Image = null; ms = new MemoryStream(Img, true); image = Image.FromStream(ms); //pictureBox1.Load(str); a_i.name_a = dt_anim.Rows[0]["name"].ToString(); a_i.zhanr = dt_anim.Rows[0]["Zhanr"].ToString(); // = dt_anim.Rows[0]["season"].ToString(); a_i.tip = dt_anim.Rows[0]["series"].ToString(); a_i.opisanie = dt_anim.Rows[0]["opisanie"].ToString(); a_i.god = dt_anim.Rows[0]["god"].ToString(); a_i.zhanr = a_i.zhanr.Replace(", ", "|"); f_add.a_i = a_i; f_add.sezon = dt_anim.Rows[0]["season"].ToString(); //f_add.pict = str; f_add.img_stream = image; f_add.edit = true; DataTable dt_files = GetFilesList(name, ser); Files_List[] f_list = new Files_List[dt_files.Rows.Count]; for (int i = 0; i < dt_files.Rows.Count; i++) { f_list[i].name_s = dt_files.Rows[i]["name_s"].ToString(); f_list[i].path_s = dt_files.Rows[i]["path_s"].ToString(); f_list[i].nomer_s = dt_files.Rows[i]["nomer_s"].ToString(); } FileInfo[] f_i = new FileInfo[f_list.Length]; for (int i = 0; i < f_i.Length; i++) { f_i[i] = new FileInfo(f_list[i].path_s); } f_add.f_i = f_i; f_add.ShowDialog(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if ((e.ColumnIndex == 3) && (e.RowIndex != -1)) { dataGridView1.Rows.RemoveAt(e.RowIndex); } if ((e.ColumnIndex == 2) && (e.RowIndex != -1)) { Form_add f_add = new Form_add(); f_add.Owner = this; if (!roditel) f_add.name_anime = (string)dataGridView1.Rows[e.RowIndex].Cells["name"].Value; else f_add.name_anime = rod_cat; f_add.directory = (string)dataGridView1.Rows[e.RowIndex].Cells["fullPath"].Value; f_add.From_all = true; f_add.auto = false; f_add.next = false; f_add.ShowDialog(); if (progress) { dataGridView1.Rows[e.RowIndex].Cells["Prog"].Value = "Да"; dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Green; progress = false; } } if ((e.ColumnIndex == 5) && (e.RowIndex != -1)) { Form_add_all_catalog f_a = new Form_add_all_catalog(); f_a.Owner = this; f_a.button1.Visible = false; f_a.Width = 1069; f_a.AddToList((string)dataGridView1.Rows[e.RowIndex].Cells["fullPath"].Value); f_a.rod_cat = (string)dataGridView1.Rows[e.RowIndex].Cells["name"].Value; f_a.roditel = true; f_a.ShowDialog(); } }
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e) { Form_add f_add = new Form_add(); f_add.Owner = this; f_add.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { for(int i=0;i<dataGridView1.Rows.Count;i++) { if (dataGridView1.Rows[i].Cells["Prog"].Value == "Да") continue; Form_add f_add = new Form_add(); f_add.Owner = this; if (!roditel) f_add.name_anime = (string)dataGridView1.Rows[i].Cells["name"].Value; else f_add.name_anime = rod_cat; f_add.directory = (string)dataGridView1.Rows[i].Cells["fullPath"].Value; f_add.From_all = true; f_add.auto = true; f_add.next = true; f_add.ShowDialog(); if (progress) { dataGridView1.Rows[i].Cells["Prog"].Value = "Да"; dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green; progress = false; } } }