Exemplo n.º 1
0
            private Zongsoft.IO.DirectoryInfo GenerateInfo(string path, IDictionary <string, object> properties)
            {
                if (properties == null)
                {
                    return(null);
                }

                DateTimeOffset createdTimeOffset, modifiedTimeOffset;
                DateTime?      createdTime = null, modifiedTime = null;

                object value;

                if (properties.TryGetValue(StorageHeaders.ZFS_CREATEDTIME_PROPERTY, out value))
                {
                    if (Zongsoft.Common.Convert.TryConvertValue(value, out createdTimeOffset))
                    {
                        createdTime = createdTimeOffset.LocalDateTime;
                    }
                }

                if (properties.TryGetValue(StorageHeaders.HTTP_LAST_MODIFIED_PROPERTY, out value))
                {
                    if (Zongsoft.Common.Convert.TryConvertValue(value, out modifiedTimeOffset))
                    {
                        modifiedTime = modifiedTimeOffset.LocalDateTime;
                    }
                }

                var info = new Zongsoft.IO.DirectoryInfo(path, createdTime, modifiedTime, _fileSystem.GetUrl(path));

                foreach (var property in properties)
                {
                    info.Properties[property.Key] = property.Value;
                }

                return(info);
            }
			private Zongsoft.IO.DirectoryInfo GenerateInfo(string path, IDictionary<string, string> properties)
			{
				if(properties == null)
					return null;

				DateTimeOffset createdTimeOffset, modifiedTimeOffset;
				DateTime? createdTime = null, modifiedTime = null;

				string text;

				if(properties.TryGetValue(StorageHeaders.ZFS_CREATEDTIME_PROPERTY, out text))
				{
					if(Zongsoft.Common.Convert.TryConvertValue(text, out createdTimeOffset))
						createdTime = createdTimeOffset.LocalDateTime;
				}

				if(properties.TryGetValue(StorageHeaders.HTTP_LAST_MODIFIED_PROPERTY, out text))
				{
					if(Zongsoft.Common.Convert.TryConvertValue(text, out modifiedTimeOffset))
						modifiedTime = modifiedTimeOffset.LocalDateTime;
				}

				var info = new Zongsoft.IO.DirectoryInfo(path, createdTime, modifiedTime, _fileSystem.GetUrl(path));

				foreach(var property in properties)
				{
					info.Properties[property.Key] = property.Value;
				}

				return info;
			}