Example #1
0
        public string LoadCode(string path)
        {
            string code = "";

            if (XFileTools.Exists(path))
            {
                code = File.ReadAllText(path);
            }
            return(code);
        }
Example #2
0
        //遍历并获取一个唯一路径
        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);
        }
Example #3
0
 //
 private string GetFileMd5(string filePath)
 {
     return(XFileTools.GetMD5(filePath));
 }