src/EasyFrameWork/Helper.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Easy.Extend;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Easy
{
    public static class Helper
    {
        public static class Url
        {
            static string[] schemes = new string[] {
                Uri.UriSchemeFile + ":", Uri.UriSchemeFtp + ":",Uri.UriSchemeGopher + ":",
                Uri.UriSchemeHttp + ":", Uri.UriSchemeHttps + ":",Uri.UriSchemeMailto + ":",
                Uri.UriSchemeNetPipe + ":",Uri.UriSchemeNetTcp + ":", Uri.UriSchemeNews + ":",
                Uri.UriSchemeNntp + ":"
            };
            public static string Combine(params string[] paths)
            {
                return "~/" + string.Join("/", paths);
            }

            public static bool ContainsScheme(string path)
            {
                if (path.IsNullOrEmpty())
                {
                    return false;
                }
                foreach (var item in schemes)
                {
                    if (path.StartsWith(item))
                    {
                        return true;
                    }
                }

                return false;
            }
            /// <summary>
            /// Convert path to start with "~/"
            /// </summary>
            /// <param name="path"></param>
            /// <returns></returns>
            public static string ToVirtualPath(string path)
            {
                if (path.IsNullOrEmpty())
                {
                    return "~/";
                }
                if (ContainsScheme(path))
                {
                    return path;
                }
                else if (path[0] == '~')
                {
后面还有 36 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。