public void AutoTests() { // var r2 = File.ReadAllBytes(@"C:\Users\e\Desktop\ITA_JumpLists\PC2_Win10\AutomaticDestinations\5f7b5f1e01b83767.automaticDestinations-ms"); // var aa = new AutomaticDestination(r2, @"C:\Users\e\Desktop\ITA_JumpLists\PC2_Win10\AutomaticDestinations\5f7b5f1e01b83767.automaticDestinations-ms"); foreach (var allPath in _allPaths) { foreach ( var fname in Directory.GetFiles(allPath, "*.automaticDestinations-ms", SearchOption.AllDirectories)) { Debug.WriteLine(fname); var raw = File.ReadAllBytes(fname); var a = new AutomaticDestination(raw, fname); a.DestListCount.Should().Be(a.DestListEntries.Count); a.DestListCount.Should().Be(a.Directory.Count - 2); Debug.WriteLine(a); Debug.WriteLine("-----------------------------------------------------------------"); } } }
public void OneOff() { var f = @"C:\Users\eric\Desktop\469e4a7982cea4d4.automaticDestinations-ms"; var raw = File.ReadAllBytes(f); var aaaa = new AutomaticDestination(raw, f); Debug.WriteLine(aaaa); }
public void OneOff() { var f = @"D:\Temp\a52b0784bd667468.automaticDestinations-ms"; var raw = File.ReadAllBytes(f); var aaaa = new AutomaticDestination(raw, f); Debug.WriteLine(aaaa); }
public void OneOff() { var f = @"C:\Temp\f01b4d95cf55d32a.automaticDestinations-ms"; var raw = File.ReadAllBytes(f); var aaaa = new AutomaticDestination(raw, f); Debug.WriteLine(aaaa); }
public void AutoTests() { // var r2 = File.ReadAllBytes(@"C:\Users\e\Desktop\ITA_JumpLists\PC2_Win10\AutomaticDestinations\5f7b5f1e01b83767.automaticDestinations-ms"); // var aa = new AutomaticDestination(r2, @"C:\Users\e\Desktop\ITA_JumpLists\PC2_Win10\AutomaticDestinations\5f7b5f1e01b83767.automaticDestinations-ms"); var f = @"C:\Users\eric\Desktop\NewToAdd.txt"; var f1 = JumpList.AppIdList.LoadAppListFromFile(f); foreach (var allPath in _allPaths) { foreach ( var fname in Directory.GetFiles(allPath, "*.automaticDestinations-ms", SearchOption.AllDirectories)) { Debug.WriteLine(fname); var raw = File.ReadAllBytes(fname); var a = new AutomaticDestination(raw, fname); var foo = JumpList.AppIdList.GetDescriptionFromId(a.AppId.AppId); if (foo.Contains("Unknown AppId") == false) { Debug.WriteLine(foo); } a.DestListCount.Should().Be(a.DestListEntries.Count); a.DestListCount.Should().Be(a.Directory.Count - 2); // Debug.WriteLine(a); Debug.WriteLine("-----------------------------------------------------------------"); } } }
//private static AutomaticDestination GetJumpListDestination(string fileFullName) //{ // AutomaticDestination jumpListModel = null; // try // { // jumpListModel = JumpList.JumpList.LoadAutoJumplist(fileFullName); // } // catch (Exception) // { // throw; // } // return jumpListModel; //} public static List <JumpListModel> GetJumpListItems(string fileName) { string fileFullName = GetJumpListFileFullName(fileName); AutomaticDestination des = JumpList.JumpList.LoadAutoJumplist(fileFullName); if (des == null) { throw new Exception("can note read jumplist file"); } List <JumpListModel> resultList = new List <JumpListModel>(); foreach (var item in des.DestListEntries) { resultList.Add(new JumpListModel() { IsPinned = item.Pinned, SourceFileName = item.Path, MRUPosition = item.MRUPosition, }); } return(resultList); }
public static bool ClearJumpList(string fileName, bool pinned, out string msg) { bool result = false; msg = string.Empty; string fileFullName = GetJumpListFileFullName(fileName); if (!File.Exists(fileFullName)) { return(true); } try { byte[] rawBytes = File.ReadAllBytes(fileFullName); CompoundFile comFile = new CompoundFile(fileFullName, CFSUpdateMode.Update, CFSConfiguration.Default); try { AutomaticDestination des = new AutomaticDestination(rawBytes, fileFullName); int numberDirs = comFile.GetNumDirectories(); int sid = -1; for (int i = 0; i < numberDirs; i++) { string dirName = comFile.GetNameDirEntry(i); if (dirName.ToLowerInvariant() == "destlist") { sid = i; break; } } if (sid <= 0) { return(true); } byte[] bufferDesList = comFile.GetDataBySID(sid); DestList desList = new DestList(bufferDesList); if (pinned) { desList.Entries.RemoveAll(ele => ele.PinStatus != -1); } else { desList.Entries.RemoveAll(ele => ele.PinStatus == -1); } byte[] desListResultBuffer = desList.ToBuffer(); comFile.RootStorage.VisitEntries(cfItem => { if (cfItem is CFStream cfStream && cfItem.Name.ToLowerInvariant() == "destlist") { cfStream.SetData(desListResultBuffer); } }, true); comFile.Commit(); result = true; } catch (Exception e) { msg = e.Message; result = false; } finally { comFile.Close(); } } catch (Exception ex) { result = false; msg = ex.Message; } return(result); }