SetData() public method

Set the data from the raw values provided.
public SetData ( byte data, int index, int count ) : void
data byte The raw data to extract values from.
index int The index to start extracting values from.
count int The number of bytes available.
return void
Ejemplo n.º 1
0
        public void TaggedDataHandling()
        {
            NTTaggedData 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();

            ExtendedUnixData 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");
        }