Exemplo n.º 1
0
        public string GetUrl(Zongsoft.IO.Path path)
        {
            if (path == null)
            {
                return(null);
            }

            var url = HttpContext.Current.Request.Url;

            return(url.Scheme + "://" + url.Authority + path.FullPath);
        }
Exemplo n.º 2
0
		public PathInfo(Path path, DateTime? createdTime = null, DateTime? modifiedTime = null, string url = null)
		{
			if(path == null)
				throw new ArgumentNullException("path");

			_path = path;
			_url = url;

			if(createdTime.HasValue)
				_createdTime = createdTime.Value;

			if(modifiedTime.HasValue)
				_modifiedTime = modifiedTime.Value;
			else
				_modifiedTime = _createdTime;
		}
Exemplo n.º 3
0
		public PathInfo(string path, DateTime? createdTime = null, DateTime? modifiedTime = null, string url = null)
		{
			if(string.IsNullOrWhiteSpace(path))
				throw new ArgumentNullException("path");

			_path = Zongsoft.IO.Path.Parse(path);
			_url = url;

			if(createdTime.HasValue)
				_createdTime = createdTime.Value;

			if(modifiedTime.HasValue)
				_modifiedTime = modifiedTime.Value;
			else
				_modifiedTime = _createdTime;
		}
Exemplo n.º 4
0
        public string GetUrl(Zongsoft.IO.Path path)
        {
            if (path == null || path.Segments.Length == 0)
            {
                return(null);
            }

            //确认OSS对象存储配置
            var configuration = this.EnsureConfiguration();

            //获取当前路径对应的存储器配置项,注:BucketName即为路径中的第一节
            configuration.Buckets.TryGet(path.Segments[0], out var bucket);

            //获取当前路径对应的服务区域
            var region = this.GetRegion(bucket);

            return(StorageServiceCenter.GetInstance(region, false).GetRequestUrl(path.FullPath));
        }
		public DirectoryInfo(Path path, DateTime? createdTime = null, DateTime? modifiedTime = null, string url = null)
			: base(path, createdTime, modifiedTime, url)
		{
		}
Exemplo n.º 6
0
		public FileInfo(Path path, long size, byte[] checksum, DateTime? createdTime = null, DateTime? modifiedTime = null, string url = null)
			: base(path, createdTime, modifiedTime, url)
		{
			_size = size;
			_checksum = checksum;
		}
Exemplo n.º 7
0
		public FileInfo(Path path, long size, DateTime? createdTime = null, DateTime? modifiedTime = null, string url = null) : base(path, createdTime, modifiedTime, url)
		{
			_size = size;
		}
Exemplo n.º 8
0
		/// <summary>
		/// 尝试解析文本格式的路径。
		/// </summary>
		/// <param name="text">要解析的路径文本。</param>
		/// <param name="result">解析成功的<see cref="Path"/>路径对象。</param>
		/// <returns>如果解析成功则返回真(True),否则返回假(False)。</returns>
		public static bool TryParse(string text, out Path result)
		{
			result = null;
			string schema, path;

			if(TryParse(text, out schema, out path))
			{
				result = new Path(text, schema, path);
				return true;
			}

			return false;
		}