예제 #1
0
 /// <summary>
 /// 逐层创建文件夹
 /// </summary>
 ///<param name="folderPath">文件夹相对路径</param>
 public static void CreateFolder(string folderPath)
 {
     try
     {
         folderPath = folderPath.Replace("\\", "/");
         folderPath = folderPath.Replace("//", "/");
         if (Utils2.RightStr(folderPath, 1) != "/")
         {
             folderPath += "/";
         }
         if (!Directory.Exists(GetMapPath(folderPath)))
         {
             string[] strFolderPath = folderPath.Split('/');
             string   aimFolder     = strFolderPath[0];
             string   CreatePath;
             for (int i = 1; i < strFolderPath.Length - 1; i++)
             {
                 aimFolder  = aimFolder + "/" + strFolderPath[i];
                 CreatePath = GetMapPath(aimFolder);
                 if (!Directory.Exists(CreatePath))
                 {
                     Directory.CreateDirectory(CreatePath);
                 }
             }
         }
     }
     catch
     {
         throw;
     }
 }
예제 #2
0
 /// <summary>
 /// 隐藏用户名,格式:a**b
 /// </summary>
 /// <param name="username"></param>
 /// <returns></returns>
 public static string HideUserName(string username)
 {
     if (!string.IsNullOrEmpty(username))
     {
         return(Utils2.LeftStr(username, 1) + "**" + Utils2.RightStr(username, 1));
     }
     else
     {
         return("");
     }
 }