protected override Status EnterDirectory(ref Component source, MString name) { if (source.GetFile(name) != null) { return(Status.Error_Path_Already_Exist); } VsDirectory child = source.GetDirectory(name); if (child == null) { child = new VsDirectory(name); source.Add(child); } source = child; return(Status.Succeed); }
public void CopyWithChangeNameAndExName(FileInfo[] sourceFileInfos, Component targetDir, string lastDestPath) { string result = ""; string exName = ""; if (lastDestPath.LastIndexOf('.') != -1) { exName = lastDestPath.Substring(lastDestPath.LastIndexOf('.'), lastDestPath.Length - lastDestPath.LastIndexOf('.')); } string name = lastDestPath.Remove(lastDestPath.Length - exName.Length, exName.Length); Component file = targetDir.GetChild(lastDestPath); if (file != null) { if (file.IsDirectory()) { Console.WriteLine("拒绝访问。"); return; } else { if (Logger.ChooseDialogYNA(ref result, "覆盖 {0} 吗?", name)) { file.Remove(); } else { return; } } } file = new VsFile(name, exName); foreach (FileInfo fi in sourceFileInfos) { Console.WriteLine(fi.FullName); (file as VsFile).Read(fi.FullName); } targetDir.Add(file); }