public string LoadCode(string path) { string code = ""; if (XFileTools.Exists(path)) { code = File.ReadAllText(path); } return(code); }
//遍历并获取一个唯一路径 public static string GetUniquePath(string savePath) { string fileNameNotEx = Path.GetFileNameWithoutExtension(savePath); string fileEx = Path.GetExtension(savePath); string fileRootPath = Path.GetDirectoryName(savePath); string finalPath = savePath; for (int i = 0; XFileTools.Exists(finalPath); i++) { finalPath = Combine(fileRootPath, string.Format("{0}({1}){2}", fileNameNotEx, i, fileEx)); } return(finalPath); }