private void DisplayProperties(ShellObject selectedSO) { // Display some basic properties if (selectedSO != null) { // display properties for this folder, as well as a thumbnail image. selectedSO.Thumbnail.CurrentSize = new System.Windows.Size(128, 128); pictureBox1.Image = selectedSO.Thumbnail.Bitmap; // show the properties AddProperty("Name", selectedSO.Name); AddProperty("Path", selectedSO.ParsingName); AddProperty("Type of ShellObject", selectedSO.GetType().Name); foreach (IShellProperty prop in selectedSO.Properties.DefaultPropertyCollection) { if (prop.ValueAsObject != null) { try { if (prop.ValueType == typeof(string[])) { string[] arr = (string[])prop.ValueAsObject; string value = ""; if (arr != null && arr.Length > 0) { foreach (string s in arr) { value = value + s + "; "; } if (value.EndsWith("; ")) { value = value.Remove(value.Length - 2); } } AddProperty(prop.CanonicalName, value); } else { AddProperty(prop.CanonicalName, prop.ValueAsObject.ToString()); } } catch { // Ignore // Accessing some properties might throw exception. } } } } }
internal static void ShowObjectData(Window1 wnd, ShellObject shellObj) { wnd.PropertiesTextBox.Text = String.Format( "Name = {0}{1}Path/ParsingName = {2}{1}Type = {3}{4} ({5}File System)", shellObj.Name, Environment.NewLine, shellObj.ParsingName, shellObj.GetType().Name, shellObj.IsLink ? " (Shortcut)" : "", shellObj.IsFileSystemObject ? "" : "Non "); }
private void DisplayProperties(ShellObject selectedSO) { // Display some basic properties if (selectedSO != null) { // display properties for this folder, as well as a thumbnail image. selectedSO.Thumbnail.CurrentSize = new System.Windows.Size(128, 128); pictureBox1.Image = selectedSO.Thumbnail.Bitmap; // show the properties AddProperty("Name", selectedSO.Name); AddProperty("Path", selectedSO.ParsingName); AddProperty("Type of ShellObject", selectedSO.GetType().Name); foreach (IShellProperty prop in selectedSO.Properties.DefaultPropertyCollection) { if (prop.ValueAsObject != null) { try { if (prop.ValueType == typeof(string[])) { string[] arr = (string[])prop.ValueAsObject; string value = ""; if (arr != null && arr.Length > 0) { foreach (string s in arr) value = value + s + "; "; if (value.EndsWith("; ")) value = value.Remove(value.Length - 2); } AddProperty(prop.CanonicalName, value); } else AddProperty(prop.CanonicalName, prop.ValueAsObject.ToString()); } catch { // Ignore // Accessing some properties might throw exception. } } } } }