public void ParseFileExampleTest() { using (var ms = new MemoryStream(GetFileExample())) { var target = ShellShortcut.Load(ms); // Assert.AreEqual(LinkFlags.HasLinkTargetIDList | LinkFlags.HasLinkInfo | LinkFlags.HasRelativePath | LinkFlags.HasWorkingDir | LinkFlags.IsUnicode | LinkFlags.EnableTargetMetadata,null); Assert.AreEqual(FileAttributesFlags.Archive, target.FileAttributes); Assert.IsTrue(Math.Abs((new DateTime(2008, 9, 12, 20, 27, 17) - target.CreationTime.Value).TotalSeconds) < 1); Assert.IsTrue(Math.Abs((new DateTime(2008, 9, 12, 20, 27, 17) - target.AccessTime.Value).TotalSeconds) < 1); Assert.IsTrue(Math.Abs((new DateTime(2008, 9, 12, 20, 27, 17) - target.WriteTime.Value).TotalSeconds) < 1); Assert.AreEqual(0, target.FileSize); Assert.AreEqual(0, target.IconIndex); Assert.AreEqual(ShowCommand.Normal, target.ShowCommand); Assert.AreEqual(Key.None, target.HotKey); Assert.AreEqual(Modifiers.None, target.HotKeyModifiers); Assert.AreEqual(4, target.LinkTargetIDList.Count); Assert.AreEqual(18, target.LinkTargetIDList[0].Length); Assert.AreEqual(23, target.LinkTargetIDList[1].Length); Assert.AreEqual(68, target.LinkTargetIDList[2].Length); Assert.AreEqual(70, target.LinkTargetIDList[3].Length); Assert.AreEqual(DriveType.Fixed, target.LinkInfo.VolumeID.DriveType); Assert.AreEqual(0x307A8A81, target.LinkInfo.VolumeID.SerialNumber); Assert.AreEqual("", target.LinkInfo.VolumeID.VolumeLabel); Assert.AreEqual(@"C:\test\a.txt", target.LinkInfo.LocalBasePath); Assert.AreEqual("", target.LinkInfo.CommonPathSuffix); Assert.AreEqual(@".\a.txt", target.RelativePath); Assert.AreEqual(@"C:\test", target.WorkingDir); Assert.AreEqual(1, target.ExtraData.Count); Assert.IsInstanceOfType(target.ExtraData[0], typeof(TrackerDataBlock)); var tbd = (TrackerDataBlock)target.ExtraData[0]; Assert.AreEqual("chris-xps", tbd.MachineID); Assert.AreEqual(new Guid(new byte[] { 0x40, 0x78, 0xC7, 0x94, 0x47, 0xFA, 0xC7, 0x46, 0xB3, 0x56, 0x5C, 0x2D, 0xC6, 0xB6, 0xD1, 0x15, }), tbd.Droid1); Assert.AreEqual(new Guid(new byte[] { 0xEC, 0x46, 0xCD, 0x7B, 0x22, 0x7F, 0xDD, 0x11, 0x94, 0x99, 0x00, 0x13, 0x72, 0x16, 0x87, 0x4A, }), tbd.Droid2); Assert.AreEqual(new Guid(new byte[] { 0x40, 0x78, 0xC7, 0x94, 0x47, 0xFA, 0xC7, 0x46, 0xB3, 0x56, 0x5C, 0x2D, 0xC6, 0xB6, 0xD1, 0x15, }), tbd.DroidBirth1); Assert.AreEqual(new Guid(new byte[] { 0xEC, 0x46, 0xCD, 0x7B, 0x22, 0x7F, 0xDD, 0x11, 0x94, 0x99, 0x00, 0x13, 0x72, 0x16, 0x87, 0x4A, }), tbd.DroidBirth2); } }
public void AnsiFileTest() { var target = ShellShortcut.Load("ansi_file.lnk"); Assert.IsNotNull(target); }
public void UnicodeFileTest() { var target = ShellShortcut.Load("unicode_file.lnk"); Assert.IsNotNull(target); }