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 void _BuildShellLists(out List <JumpItem> successList, out List <_RejectedJumpItemPair> rejectedList, out List <_ShellObjectPair> removedList) { List <List <_ShellObjectPair> > list = null; removedList = null; Standard.ICustomDestinationList cdl = Standard.CLSID.CoCreateInstance <Standard.ICustomDestinationList>("77f10cf0-3db5-4966-b520-b7c54fd35ed6"); try { uint num; string str = _RuntimeId; if (!string.IsNullOrEmpty(str)) { cdl.SetAppID(str); } Guid riid = new Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9"); Standard.IObjectArray shellObjects = (Standard.IObjectArray)cdl.BeginList(out num, ref riid); removedList = GenerateJumpItems(shellObjects); successList = new List <JumpItem>(this.JumpItems.Count); rejectedList = new List <_RejectedJumpItemPair>(this.JumpItems.Count); list = new List <List <_ShellObjectPair> > { new List <_ShellObjectPair>() }; foreach (JumpItem item in this.JumpItems) { if (item == null) { _RejectedJumpItemPair pair = new _RejectedJumpItemPair { JumpItem = item, Reason = JumpItemRejectionReason.InvalidItem }; rejectedList.Add(pair); } else { object shellObject = null; try { shellObject = GetShellObjectForJumpItem(item); if (shellObject == null) { _RejectedJumpItemPair pair2 = new _RejectedJumpItemPair { Reason = JumpItemRejectionReason.InvalidItem, JumpItem = item }; rejectedList.Add(pair2); } else if (ListContainsShellObject(removedList, shellObject)) { _RejectedJumpItemPair pair3 = new _RejectedJumpItemPair { Reason = JumpItemRejectionReason.RemovedByUser, JumpItem = item }; rejectedList.Add(pair3); } else { _ShellObjectPair pair4 = new _ShellObjectPair { JumpItem = item, ShellObject = shellObject }; if (string.IsNullOrEmpty(item.CustomCategory)) { list[0].Add(pair4); } else { bool flag = false; foreach (List <_ShellObjectPair> list3 in list) { if ((list3.Count > 0) && (list3[0].JumpItem.CustomCategory == item.CustomCategory)) { list3.Add(pair4); flag = true; break; } } if (!flag) { list.Add(new List <_ShellObjectPair> { pair4 }); } } shellObject = null; } } finally { Standard.Utility.SafeRelease <object>(ref shellObject); } } } list.Reverse(); if (this.ShowFrequentCategory) { cdl.AppendKnownCategory(Standard.KDC.FREQUENT); } if (this.ShowRecentCategory) { cdl.AppendKnownCategory(Standard.KDC.RECENT); } foreach (List <_ShellObjectPair> list5 in list) { if (list5.Count > 0) { string customCategory = list5[0].JumpItem.CustomCategory; AddCategory(cdl, customCategory, list5, successList, rejectedList); } } cdl.CommitList(); successList.Reverse(); } finally { Standard.Utility.SafeRelease <Standard.ICustomDestinationList>(ref cdl); if (list != null) { foreach (List <_ShellObjectPair> list7 in list) { _ShellObjectPair.ReleaseShellObjects(list7); } } _ShellObjectPair.ReleaseShellObjects(removedList); } }