protected static string GetStringValue(ShellProperties properties, PropertyKey key) { var result = properties.GetProperty <string>(key)?.Value; if (result == null) { var result2 = properties.GetProperty <string[]>(key)?.Value; result = result2?.First(); } return(result ?? string.Empty); }
protected static int GetIntegerValue(ShellProperties properties, PropertyKey key) { var result = properties.GetProperty <uint?>(key).Value; if (result == null) { return(0); } return((int)result.Value); }
} // private void ReadFileDetails(string path) { using (ShellObject shellObj = ShellObject.FromParsingName(path)) { using (ShellProperties props = shellObj.Properties) { this.WriteProperties(props); IShellProperty shellProp = props.GetProperty(SystemProperties.System.Category); ShellPropertyDescription desc = SystemProperties.GetPropertyDescription(SystemProperties.System.Category); Console.WriteLine("Prop value: " + desc.ValueType); } } }
protected static bool GetBoolValue(ShellProperties properties, PropertyKey key) { var result = properties.GetProperty <bool?>(key).Value; return(result != null && result.Value); }