private void CopyFileNameCToolStripMenuItem_Click(object sender, EventArgs e) { if (_cmsRowIndex < 0 || _cmsRowIndex >= _listSelected.Count) { return; } NamePath np = _listSelected[_cmsRowIndex]; Clipboard.SetDataObject(np.Path); }
private void dgView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { NamePath np = _listSelected[e.RowIndex]; switch (e.ColumnIndex) { case 0: e.Value = np.Name; break; case 1: e.Value = np.Path; int index = np.Path.LastIndexOf(@"\"); e.Value = np.Path.Substring(0, index); break; case 2: if (np.Path.EndsWith(@"\")) { e.Value = string.Empty; break; } if (!File.Exists(np.Path)) { e.Value = string.Empty; break; } e.Value = new FileInfo(np.Path).Length; break; case 3: if (np.Path.EndsWith(@"\")) { e.Value = string.Empty; break; } if (!File.Exists(np.Path)) { e.Value = string.Empty; break; } e.Value = new FileInfo(np.Path).LastAccessTime; break; } }
private void OpenOToolStripMenuItem_Click(object sender, EventArgs e) { if (_cmsRowIndex < 0 || _cmsRowIndex >= _listSelected.Count) { return; } NamePath np = _listSelected[_cmsRowIndex]; if (np.Path.EndsWith(@"\")) { OpenPathPToolStripMenuItem_Click(sender, e); } else { Process.Start(np.Path); } }
private void OpenPathPToolStripMenuItem_Click(object sender, EventArgs e) { if (_cmsRowIndex < 0 || _cmsRowIndex >= _listSelected.Count) { return; } NamePath np = _listSelected[_cmsRowIndex]; if (np.Path.EndsWith(@"\")) { Process.Start(@"Explorer.exe", np.Path); } else { int length = np.Path.Length - np.Name.Length - 1; Process.Start(@"Explorer.exe", np.Path.Substring(0, length)); } }