Ejemplo n.º 1
0
        /// <summary>
        /// 取得系统目录下的图片文件
        /// </summary>
        /// <param name="dirEnum"></param>
        /// <returns></returns>
        public static List <FileInfo> GetImagFiles(SystemDirecotry dirEnum)
        {
            if (!Directory.Exists(Globals.GetPath(dirEnum)))
            {
                return(new List <FileInfo>());
            }

            List <FileInfo> Files = GetImagFiles(Globals.GetPath(dirEnum), SearchOption.TopDirectoryOnly);

            if (Files != null && Files.Count > 0)
            {
                FileInfo file;
                for (int i = 0; i < Files.Count - 1; i++)
                {
                    for (int j = i + 1; j < Files.Count; j++)
                    {
                        if (Files[i].CreationTime < Files[j].CreationTime)
                        {
                            file     = Files[j];
                            Files[j] = Files[i];
                            Files[i] = file;
                        }
                    }
                }
            }

            return(Files);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 返回指定系统目录的虚拟路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <returns></returns>
 public static string GetVirtualPath(SystemDirecotry systemDirecotry)
 {
     return GetPath(JoinType.Url, s_AppRoot, systemDirecotry);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 返回指定系统目录的虚拟路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <returns></returns>
 public static string GetVirtualPath(SystemDirecotry systemDirecotry, string addPath1, string addPath2)
 {
     string basePath = GetPath(JoinType.Url, s_AppRoot, systemDirecotry);
     return UrlUtil.JoinUrl(basePath, addPath1, addPath2);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 返回带~的虚拟路径
        /// </summary>
        /// <param name="direcotry"></param>
        /// <returns></returns>
        public static string GetRelativeUrl(SystemDirecotry direcotry)
        {
            return GetPath(JoinType.RelativeUrl, string.Empty, direcotry);

        }
Ejemplo n.º 5
0
 /// <summary>
 /// 返回带~的虚拟路径
 /// </summary>
 /// <param name="direcotry"></param>
 /// <returns></returns>
 public static string GetRelativeUrl(SystemDirecotry direcotry, string addPath1, string addPath2)
 {
     string basePath = GetPath(JoinType.RelativeUrl, string.Empty, direcotry);
     return UrlUtil.JoinUrl(basePath, addPath1, addPath2);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 返回指定系统目录的物理路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <returns></returns>
 public static string GetPath(SystemDirecotry systemDirecotry)
 {
     return GetPath(JoinType.Path, s_ApplicationPath, systemDirecotry);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 返回指定系统目录的物理路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <param name="addPath"></param>
 /// <returns></returns>
 public static string GetPath(SystemDirecotry systemDirecotry, string addPath1, string addPath2)
 {
     string basePath = GetPath(JoinType.Path, s_ApplicationPath, systemDirecotry);
     return IOUtil.JoinPath(basePath, addPath1, addPath2);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 返回指定系统目录的虚拟路径
        /// </summary>
        /// <param name="systemDirecotry"></param>
        /// <returns></returns>
        public static string GetVirtualPath(SystemDirecotry systemDirecotry, string addPath1, string addPath2)
        {
            string basePath = GetPath(JoinType.Url, s_AppRoot, systemDirecotry);

            return(UrlUtil.JoinUrl(basePath, addPath1, addPath2));
        }
Ejemplo n.º 9
0
        private static string GetPath(JoinType joinType, string root, SystemDirecotry systemDirecotry)
        {
            switch (systemDirecotry)
            {
                case SystemDirecotry.Root:
                    return root;

                case SystemDirecotry.Code:
                    return Join(joinType, root, SystemDirecotry_Code);

                case SystemDirecotry.Dialogs:
                    return Join(joinType, root, SystemDirecotry_Dialogs);

                case SystemDirecotry.Pages:
                    return Join(joinType, root, SystemDirecotry_Pages);

                case SystemDirecotry.Plugins:
                    return Join(joinType, root, SystemDirecotry_Plugins);

                case SystemDirecotry.Error:
                    return Join(joinType, root, SystemDirecotry_Error);

                case SystemDirecotry.Temp:
                    return Join(joinType, root, SystemDirecotry_Temp);

                case SystemDirecotry.Temp_Upload:
                    return Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_Upload);

                case SystemDirecotry.Temp_Avatar:
                    return Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_Avatar);

                case SystemDirecotry.Temp_ParsedTemplate:
                    return Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_ParsedTemplate);

                case SystemDirecotry.Upload:
                    //让用户上传目录支持虚拟目录的特殊处理
                    if (joinType == JoinType.Path)
                        return HostingEnvironment.MapPath("~/" + SystemDirecotry_Upload);
                    else
                        return Join(joinType, root, SystemDirecotry_Upload);

                case SystemDirecotry.Upload_Avatar:
                    //让用户上传目录支持虚拟目录的特殊处理
                    if (joinType == JoinType.Path)
                        return HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_Avatar));
                    else
                        return Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_Avatar);

                case SystemDirecotry.Upload_Emoticons:
                    //让用户上传目录支持虚拟目录的特殊处理
                    if (joinType == JoinType.Path)
                        return HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_Emoticon));
                    else
                        return Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_Emoticon);

                case SystemDirecotry.Upload_File:
                    //让用户上传目录支持虚拟目录的特殊处理
                    if (joinType == JoinType.Path)
                        return HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_File));
                    else
                        return Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_File);

                case SystemDirecotry.Album_Thumbs:
                    //让用户上传目录支持虚拟目录的特殊处理
                    if (joinType == JoinType.Path)
                        return HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirectory_Album_Thumbs));
                    else
                        return Join(joinType, root, SystemDirecotry_Upload, SystemDirectory_Album_Thumbs);

                    //return Join(joinType, root, SystemDirecotry_Upload, SystemDirectory_Album_Thumbs);

                case SystemDirecotry.Admin:
                    return Join(joinType, root, SystemDirecotry_Admin);

                case SystemDirecotry.Assets:
                    return Join(joinType, root, SystemDirecotry_Assets);

                case SystemDirecotry.Assets_Judgement:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_judgement);

                case SystemDirecotry.Assets_LinkIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_LinkIcon);

                case SystemDirecotry.Assets_OnlineIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_OnlineIcon);

                case SystemDirecotry.Assets_RoleIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_RoleIcon);

                case SystemDirecotry.Assets_ZodiacIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_ZodiacIcon);

                case SystemDirecotry.Assets_PostIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Post);

                case SystemDirecotry.Assets_Face:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Face);

                case SystemDirecotry.Assets_IconStar:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_IconStar);

                case SystemDirecotry.Assets_Icon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Icon);

                case SystemDirecotry.Skins:
                    return Join(joinType, root, SystemDirecotry_Themes);

                case SystemDirecotry.SpaceStyles:
                    return Join(joinType, root, SystemDirecotry_SpaceStyles);

                case SystemDirecotry.Assets_ForumLogo:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_ForumLogo);

                case SystemDirecotry.Assets_MedalIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_MedalIcon);

                case SystemDirecotry.Assets_PointIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_PointIcon);

                case SystemDirecotry.Assets_MissionIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_MissionIcon);

                case SystemDirecotry.Assets_FileIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirectory_Assets_FileIcon);

                case SystemDirecotry.Assets_Images:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Images);

                case SystemDirecotry.Assets_AdvertIcon:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_AdvertIcon);

                case SystemDirecotry.Assets_Sounds:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Sounds);
                case SystemDirecotry.Assets_Flash:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Flash);
                case SystemDirecotry.Assets_PropIcons:
                    return Join(joinType, root, SystemDirecotry_Assets, SystemDirectory_Assets_PropIcons);

                case SystemDirecotry.Js:
                    return Join(joinType, root, SystemDirectory_Js);

                case SystemDirecotry.Upload_IDCard:
                    return Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_IDCard);
                default:
                    return root;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 返回带~的虚拟路径
        /// </summary>
        /// <param name="direcotry"></param>
        /// <returns></returns>
        public static string GetRelativeUrl(SystemDirecotry direcotry, string addPath1, string addPath2)
        {
            string basePath = GetPath(JoinType.RelativeUrl, string.Empty, direcotry);

            return(UrlUtil.JoinUrl(basePath, addPath1, addPath2));
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 返回指定系统目录的虚拟路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <returns></returns>
 public static string GetVirtualPath(SystemDirecotry systemDirecotry)
 {
     return(GetPath(JoinType.Url, s_AppRoot, systemDirecotry));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 返回带~的虚拟路径
 /// </summary>
 /// <param name="direcotry"></param>
 /// <returns></returns>
 public static string GetRelativeUrl(SystemDirecotry direcotry)
 {
     return(GetPath(JoinType.RelativeUrl, string.Empty, direcotry));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 返回指定系统目录的物理路径
        /// </summary>
        /// <param name="systemDirecotry"></param>
        /// <param name="addPath"></param>
        /// <returns></returns>
        public static string GetPath(SystemDirecotry systemDirecotry, string addPath1, string addPath2)
        {
            string basePath = GetPath(JoinType.Path, s_ApplicationPath, systemDirecotry);

            return(IOUtil.JoinPath(basePath, addPath1, addPath2));
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 返回指定系统目录的物理路径
 /// </summary>
 /// <param name="systemDirecotry"></param>
 /// <returns></returns>
 public static string GetPath(SystemDirecotry systemDirecotry)
 {
     return(GetPath(JoinType.Path, s_ApplicationPath, systemDirecotry));
 }
Ejemplo n.º 15
0
        private static string GetPath(JoinType joinType, string root, SystemDirecotry systemDirecotry)
        {
            switch (systemDirecotry)
            {
            case SystemDirecotry.Root:
                return(root);

            case SystemDirecotry.Code:
                return(Join(joinType, root, SystemDirecotry_Code));

            case SystemDirecotry.Dialogs:
                return(Join(joinType, root, SystemDirecotry_Dialogs));

            case SystemDirecotry.Pages:
                return(Join(joinType, root, SystemDirecotry_Pages));

            case SystemDirecotry.Plugins:
                return(Join(joinType, root, SystemDirecotry_Plugins));

            case SystemDirecotry.Error:
                return(Join(joinType, root, SystemDirecotry_Error));

            case SystemDirecotry.Temp:
                return(Join(joinType, root, SystemDirecotry_Temp));

            case SystemDirecotry.Temp_Upload:
                return(Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_Upload));

            case SystemDirecotry.Temp_Avatar:
                return(Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_Avatar));

            case SystemDirecotry.Temp_ParsedTemplate:
                return(Join(joinType, root, SystemDirecotry_Temp, SystemDirecotry_Temp_ParsedTemplate));

            case SystemDirecotry.Upload:
                //让用户上传目录支持虚拟目录的特殊处理
                if (joinType == JoinType.Path)
                {
                    return(HostingEnvironment.MapPath("~/" + SystemDirecotry_Upload));
                }
                else
                {
                    return(Join(joinType, root, SystemDirecotry_Upload));
                }

            case SystemDirecotry.Upload_Avatar:
                //让用户上传目录支持虚拟目录的特殊处理
                if (joinType == JoinType.Path)
                {
                    return(HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_Avatar)));
                }
                else
                {
                    return(Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_Avatar));
                }

            case SystemDirecotry.Upload_Emoticons:
                //让用户上传目录支持虚拟目录的特殊处理
                if (joinType == JoinType.Path)
                {
                    return(HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_Emoticon)));
                }
                else
                {
                    return(Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_Emoticon));
                }

            case SystemDirecotry.Upload_File:
                //让用户上传目录支持虚拟目录的特殊处理
                if (joinType == JoinType.Path)
                {
                    return(HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirecotry_Upload_File)));
                }
                else
                {
                    return(Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_File));
                }

            case SystemDirecotry.Album_Thumbs:
                //让用户上传目录支持虚拟目录的特殊处理
                if (joinType == JoinType.Path)
                {
                    return(HostingEnvironment.MapPath(string.Concat("~/", SystemDirecotry_Upload, "/", SystemDirectory_Album_Thumbs)));
                }
                else
                {
                    return(Join(joinType, root, SystemDirecotry_Upload, SystemDirectory_Album_Thumbs));
                }

            //return Join(joinType, root, SystemDirecotry_Upload, SystemDirectory_Album_Thumbs);

            case SystemDirecotry.Admin:
                return(Join(joinType, root, SystemDirecotry_Admin));

            case SystemDirecotry.Assets:
                return(Join(joinType, root, SystemDirecotry_Assets));

            case SystemDirecotry.Assets_Judgement:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_judgement));

            case SystemDirecotry.Assets_LinkIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_LinkIcon));

            case SystemDirecotry.Assets_OnlineIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_OnlineIcon));

            case SystemDirecotry.Assets_RoleIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_RoleIcon));

            case SystemDirecotry.Assets_ZodiacIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_ZodiacIcon));

            case SystemDirecotry.Assets_PostIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Post));

            case SystemDirecotry.Assets_Face:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Face));

            case SystemDirecotry.Assets_IconStar:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_IconStar));

            case SystemDirecotry.Assets_Icon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Icon));

            case SystemDirecotry.Skins:
                return(Join(joinType, root, SystemDirecotry_Themes));

            case SystemDirecotry.SpaceStyles:
                return(Join(joinType, root, SystemDirecotry_SpaceStyles));

            case SystemDirecotry.Assets_ForumLogo:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_ForumLogo));

            case SystemDirecotry.Assets_MedalIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_MedalIcon));

            case SystemDirecotry.Assets_PointIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_PointIcon));

            case SystemDirecotry.Assets_MissionIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_MissionIcon));

            case SystemDirecotry.Assets_FileIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirectory_Assets_FileIcon));

            case SystemDirecotry.Assets_Images:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Images));

            case SystemDirecotry.Assets_AdvertIcon:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_AdvertIcon));

            case SystemDirecotry.Assets_Sounds:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Sounds));

            case SystemDirecotry.Assets_Flash:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirecotry_Assets_Flash));

            case SystemDirecotry.Assets_PropIcons:
                return(Join(joinType, root, SystemDirecotry_Assets, SystemDirectory_Assets_PropIcons));

            case SystemDirecotry.Js:
                return(Join(joinType, root, SystemDirectory_Js));

            case SystemDirecotry.Upload_IDCard:
                return(Join(joinType, root, SystemDirecotry_Upload, SystemDirecotry_Upload_IDCard));

            default:
                return(root);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 取得系统目录下的图片文件
        /// </summary>
        /// <param name="dirEnum"></param>
        /// <returns></returns>
        public static List<FileInfo> GetImagFiles(SystemDirecotry dirEnum)
        {

            if (!Directory.Exists(Globals.GetPath(dirEnum)))
                return new List<FileInfo>();

            List<FileInfo> Files = GetImagFiles(Globals.GetPath(dirEnum), SearchOption.TopDirectoryOnly);
            if (Files != null && Files.Count > 0)
            {
                FileInfo file;
                for ( int i=0;i<Files.Count-1;i++ )
                {
                    for (int j = i+1; j < Files.Count; j++)
                    {
                        if (Files[i].CreationTime < Files[j].CreationTime)
                        {
                            file = Files[j];
                            Files[j] = Files[i];
                            Files[i] = file;
                        }
                    }
                }
            }

            return Files;
        }