本文整理汇总了C#中PropVariant.SetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# PropVariant.SetDateTime方法的具体用法?C# PropVariant.SetDateTime怎么用?C# PropVariant.SetDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropVariant
的用法示例。
在下文中一共展示了PropVariant.SetDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLeafCondition
/// <summary>
/// Creates a leaf condition node that represents a comparison of property value and constant value.
/// Overload method takes a DateTime parameter for the comparison value.
/// </summary>
/// <param name="propertyName">The name of a property to be compared, or null for an unspecified property.
/// The locale name of the leaf node is LOCALE_NAME_USER_DEFAULT.</param>
/// <param name="value">The DateTime value against which the property value should be compared.</param>
/// <param name="operation">Specific condition to be used when comparing the actual value and the expected value of the given property</param>
/// <returns>SearchCondition based on the given parameters</returns>
/// <remarks>
/// The search will only work for files that are indexed, as well as the specific properties are indexed. To find
/// the properties that are indexed, look for the specific property's property description and
/// <see cref="P:Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyDescription.TypeFlags"/> property for IsQueryable flag.
/// </remarks>
public static SearchCondition CreateLeafCondition(string propertyName, DateTime value, SearchConditionOperation operation)
{
PropVariant propVar = new PropVariant();
propVar.SetDateTime(value);
return CreateLeafCondition(propertyName, propVar, "System.StructuredQuery.CustomProperty.DateTime", operation);
}
示例2: GetProperty
public int GetProperty(ItemPropId propID, ref PropVariant value)
{
value.Clear();
if (_subArchiveMode)
{
if (propID == ItemPropId.Name)
{
value.SetBString(_subArchiveName);
}
}
else
{
switch (propID)
{
case ItemPropId.Name:
if (!_streamMode)
{
value.SetBString(Path.GetFileName(_fileName));
}
break;
case ItemPropId.IsDirectory:
value.SetBool(_streamMode ? false : (byte)(new FileInfo(_fileName).Attributes & FileAttributes.Directory) != 0);
break;
case ItemPropId.Size:
value.SetULong((ulong)_currentVolumeSize);
break;
case ItemPropId.Attributes:
value.SetUInt(_streamMode ? (uint)0 : (uint)new FileInfo(_fileName).Attributes);
break;
case ItemPropId.CreationTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).CreationTime);
}
break;
case ItemPropId.LastAccessTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).LastAccessTime);
}
break;
case ItemPropId.LastWriteTime:
if (!_streamMode)
{
value.SetDateTime(new FileInfo(_fileName).LastWriteTime);
}
break;
}
}
return HRESULT.S_OK;
}