public static string GetRecycleByPath(string s) { string name = System.IO.File.Exists(s) ? System.IO.Path.GetFileName(s) : new System.IO.DirectoryInfo(s).Name; string dst = CfgPath.GetRecycleName(name); return(dst); }
} //{ get { return SubDir(DocBasePath, "Recycle"); } } public static void MoveToRecycle(string f) { if (File.Exists(f)) { File.Move(f, CfgPath.GetRecycleByPath(f)); } }
public static string GetTemplateFileByTag(GUTag tag, string dotPostfix) { string file = CfgPath.GetFileByTag(tag, "note" + dotPostfix, true);//这儿保证目录创建,并且file不为null string tmplateFile = TemplateHelper.GetTemplateByExtension(dotPostfix); if (!File.Exists(file) && File.Exists(tmplateFile)) { File.Copy(tmplateFile, file); } if (File.Exists(file)) { return(file); } else { return(null); } }
public static void MoveToRecycle(IEnumerable <string> Uris) { List <string> srcs = new List <string>(); srcs.AddRange(Uris); List <string> dstList = new List <string>(); List <string> srcList = new List <string>(); foreach (string s in srcs) { if (PathHelper.IsValidFS(s)) { string dst = CfgPath.GetRecycleByPath(s); dstList.Add(dst); srcList.Add(s); } } FileShell.SHMoveFiles(srcList.ToArray(), dstList.ToArray()); }