public void TaggedDataHandling()
        {
            var      tagData = new NTTaggedData();
            DateTime modTime = tagData.LastModificationTime;

            byte[] rawData = tagData.GetData();
            tagData.LastModificationTime = tagData.LastModificationTime + TimeSpan.FromSeconds(40);
            Assert.AreNotEqual(tagData.LastModificationTime, modTime);
            tagData.SetData(rawData, 0, rawData.Length);
            Assert.AreEqual(10, tagData.TagID, "TagID mismatch");
            Assert.AreEqual(modTime, tagData.LastModificationTime, "NT Mod time incorrect");

            tagData.CreateTime     = DateTime.FromFileTimeUtc(0);
            tagData.LastAccessTime = new DateTime(9999, 12, 31, 23, 59, 59);
            rawData = tagData.GetData();

            var unixData = new ExtendedUnixData();

            modTime = unixData.ModificationTime;
            unixData.ModificationTime = modTime;             // Ensure flag is set.

            rawData = unixData.GetData();
            unixData.ModificationTime += TimeSpan.FromSeconds(100);
            Assert.AreNotEqual(unixData.ModificationTime, modTime);
            unixData.SetData(rawData, 0, rawData.Length);
            Assert.AreEqual(0x5455, unixData.TagID, "TagID mismatch");
            Assert.AreEqual(modTime, unixData.ModificationTime, "Unix mod time incorrect");
        }
Esempio n. 2
0
 ITaggedData Create(short tag, byte[] data, int offset, int count)
 {
     ITaggedData result = null;
     switch ( tag )
     {
         case 0x000A:
             result = new NTTaggedData();
             break;
         case 0x5455:
             result = new ExtendedUnixData();
             break;
         default:
             result = new RawTaggedData(tag);
             break;
     }
     result.SetData(data_, readValueStart_, readValueLength_);
     return result;
 }
Esempio n. 3
0
        public void TaggedDataHandling()
        {
            var tagData = new NTTaggedData();
            var modTime = tagData.LastModificationTime;
            var rawData = tagData.GetData();
            tagData.LastModificationTime = tagData.LastModificationTime + TimeSpan.FromSeconds(40);
            tagData.SetData(rawData, 0, rawData.Length);
            Assert.AreEqual(10, tagData.TagID, "TagID mismatch");
            Assert.AreEqual(modTime, tagData.LastModificationTime, "NT Mod time incorrect");

            tagData.CreateTime = DateTime.FromFileTimeUtc(0);
            tagData.LastAccessTime = new DateTime(9999, 12, 31, 23, 59, 59);
            rawData = tagData.GetData();

            var unixData = new ExtendedUnixData();
            modTime = unixData.ModificationTime;
            unixData.ModificationTime = modTime; // Ensure flag is set.

            rawData = unixData.GetData();
            unixData.ModificationTime += TimeSpan.FromSeconds(100);
            unixData.SetData(rawData, 0, rawData.Length);
            Assert.AreEqual(0x5455, unixData.TagID, "TagID mismatch");
            Assert.AreEqual(modTime, unixData.ModificationTime, "Unix mod time incorrect");
        }