public static IVirtualPath GetPath(this IVirtualFileSystem fs, IVirtualPath path) { if (path is IVirtualFile) { return(fs.GetFile(path.FullPath)); } if (path is IVirtualFolder) { return(fs.GetFolder(path.FullPath)); } return(null); }
public static void CopyPathTo(this IVirtualPath path, IVirtualFileSystem dstfs, string newname) { if (path is IVirtualFile) { var dstf = dstfs.GetFile(newname); ((IVirtualFile)path).CopyFileTo(dstf, CopyFileMode.Copy); } else { var dstf = dstfs.GetFolder(newname); if (!dstf.Exists()) { dstf.Create(); } } }
private void RenameAll() { foreach (var node in m_conflicts) { var row = (DataGridViewRow)node.Tag; string newname; for (int i = 2; ; i++) { string noext = Path.ChangeExtension(node.VirtualPath.FullPath, null); newname = Path.GetFileNameWithoutExtension(node.VirtualPath.FullPath) + "_" + i.ToString(); string newpath = noext + "_" + i.ToString() + node.VirtualPath.FullPath.Substring(noext.Length); if (!m_dstFs.GetFile(newpath).Exists()) { break; } } row.Cells[1].Value = newname; node.NewName = newname; } }