Exemplo n.º 1
0
        /// <summary>
        /// 获取父级名称,没有父级则为字符空。
        /// </summary>
        public string GetParentName()
        {
            string idName = IdentityName.Replace("/", "\\");
            int    idx    = idName.LastIndexOf("\\");

            if (idx <= 0)
            {
                return(string.Empty);
            }
            else
            {
                return(idName.Substring(0, idx));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取名称(目录或文件名)
        /// </summary>
        public string GetName()
        {
            string idName = IdentityName.Replace("/", "\\");
            int    idx    = idName.LastIndexOf("\\");

            if (idx == -1)
            {
                return(idName);
            }
            else
            {
                return(idName.Substring(idx));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取项目标志的目录深度
        /// </summary>
        public int GetDeepth()
        {
            if (GetParentName() == string.Empty)
            {
                return(1);
            }
            string strID = IdentityName.Replace("/", "\\");

            if (!strID.StartsWith("\\"))
            {
                strID = "\\" + strID;
            }
            if (strID.EndsWith("\\"))
            {
                strID = strID.TrimEnd('\\');
            }
            return(strID.Split('\\').Length - 1);
        }