private static List <JumpList._ShellObjectPair> GenerateJumpItems(IObjectArray shellObjects) { List <JumpList._ShellObjectPair> list = new List <JumpList._ShellObjectPair>(); Guid guid = new Guid("00000000-0000-0000-C000-000000000046"); uint count = shellObjects.GetCount(); for (uint num = 0u; num < count; num += 1u) { object at = shellObjects.GetAt(num, ref guid); JumpItem jumpItem = null; try { jumpItem = JumpList.GetJumpItemForShellObject(at); } catch (Exception ex) { if (ex is NullReferenceException || ex is SEHException) { throw; } } list.Add(new JumpList._ShellObjectPair { ShellObject = at, JumpItem = jumpItem }); } return(list); }
private static List <_ShellObjectPair> GenerateJumpItems(Standard.IObjectArray shellObjects) { List <_ShellObjectPair> list = new List <_ShellObjectPair>(); Guid riid = new Guid("00000000-0000-0000-C000-000000000046"); uint count = shellObjects.GetCount(); for (uint i = 0; i < count; i++) { object at = shellObjects.GetAt(i, ref riid); JumpItem jumpItemForShellObject = null; try { jumpItemForShellObject = GetJumpItemForShellObject(at); } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } } _ShellObjectPair pair = new _ShellObjectPair { ShellObject = at, JumpItem = jumpItemForShellObject }; list.Add(pair); } return(list); }
private static List <_ShellObjectPair> GenerateJumpItems(IObjectArray shellObjects) { Debug.Assert(shellObjects != null); var retList = new List <_ShellObjectPair>(); Guid unknownIid = new Guid(IID.Unknown); uint count = shellObjects.GetCount(); for (uint i = 0; i < count; ++i) { // This is potentially a heterogenous list, so get as an IUnknown and QI afterwards. object unk = shellObjects.GetAt(i, ref unknownIid); JumpItem item = null; try { item = GetJumpItemForShellObject(unk); } catch (Exception e) { if (e is NullReferenceException || e is System.Runtime.InteropServices.SEHException) { throw; } // If we failed the conversion we still want to keep the shell interface for comparision. // Just leave the JumpItem property as null. } retList.Add(new _ShellObjectPair { ShellObject = unk, JumpItem = item }); } return(retList); }
private static object GetShellObjectForJumpItem(JumpItem jumpItem) { JumpPath jumpPath = jumpItem as JumpPath; JumpTask jumpTask = jumpItem as JumpTask; if (jumpPath != null) { return(JumpList.CreateItemFromJumpPath(jumpPath)); } if (jumpTask != null) { return(JumpList.CreateLinkFromJumpTask(jumpTask, true)); } return(null); }
/// <summary> /// </summary> /// <remarks> /// This returns a native COM object that should be deterministically released by the caller, when possible. /// </remarks> private static object GetShellObjectForJumpItem(JumpItem jumpItem) { var jumpPath = jumpItem as JumpPath; var jumpTask = jumpItem as JumpTask; // Either of these create functions could return null if the item is invalid but they shouldn't throw. if (jumpPath != null) { return(CreateItemFromJumpPath(jumpPath)); } else if (jumpTask != null) { return(CreateLinkFromJumpTask(jumpTask, true)); } // Unsupported type? Debug.Assert(false); return(null); }
/// <summary> /// </summary> /// <remarks> /// This returns a native COM object that should be deterministically released by the caller, when possible. /// </remarks> private static object GetShellObjectForJumpItem(JumpItem jumpItem) { var jumpPath = jumpItem as JumpPath; var jumpTask = jumpItem as JumpTask; // Either of these create functions could return null if the item is invalid but they shouldn't throw. if (jumpPath != null) { return CreateItemFromJumpPath(jumpPath); } else if (jumpTask != null) { return CreateLinkFromJumpTask(jumpTask, true); } // Unsupported type? Debug.Assert(false); return null; }