ReadLEShort() public method

Read an unsigned short in little endian byte order.
/// An i/o error occurs. /// /// The file ends prematurely ///
public ReadLEShort ( ) : int
return int
コード例 #1
0
        /// <summary>
        /// Set the data from the raw values provided.
        /// </summary>
        /// <param name="data">The raw data to extract values from.</param>
        /// <param name="index">The index to start extracting values from.</param>
        /// <param name="count">The number of bytes available.</param>
        public void SetData(byte[] data, int index, int count)
        {
            using (MemoryStream ms = new MemoryStream(data, index, count, false))
                using (ZipHelperStream helperStream = new ZipHelperStream(ms)) {
                    helperStream.ReadLEInt();             // Reserved
                    while (helperStream.Position < helperStream.Length)
                    {
                        int ntfsTag    = helperStream.ReadLEShort();
                        int ntfsLength = helperStream.ReadLEShort();
                        if (ntfsTag == 1)
                        {
                            if (ntfsLength >= 24)
                            {
                                long lastModificationTicks = helperStream.ReadLELong();
                                _lastModificationTime = DateTime.FromFileTimeUtc(lastModificationTicks);

                                long lastAccessTicks = helperStream.ReadLELong();
                                _lastAccessTime = DateTime.FromFileTimeUtc(lastAccessTicks);

                                long createTimeTicks = helperStream.ReadLELong();
                                _createTime = DateTime.FromFileTimeUtc(createTimeTicks);
                            }
                            break;
                        }
                        else
                        {
                            // An unknown NTFS tag so simply skip it.
                            helperStream.Seek(ntfsLength, SeekOrigin.Current);
                        }
                    }
                }
        }
コード例 #2
0
ファイル: NTTaggedData.cs プロジェクト: K07H/The-Forest
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
         {
             zipHelperStream.ReadLEInt();
             while (zipHelperStream.Position < zipHelperStream.Length)
             {
                 int num  = zipHelperStream.ReadLEShort();
                 int num2 = zipHelperStream.ReadLEShort();
                 if (num == 1)
                 {
                     if (num2 >= 24)
                     {
                         long fileTime = zipHelperStream.ReadLELong();
                         this._lastModificationTime = DateTime.FromFileTime(fileTime);
                         long fileTime2 = zipHelperStream.ReadLELong();
                         this._lastAccessTime = DateTime.FromFileTime(fileTime2);
                         long fileTime3 = zipHelperStream.ReadLELong();
                         this._createTime = DateTime.FromFileTime(fileTime3);
                     }
                     break;
                 }
                 zipHelperStream.Seek((long)num2, SeekOrigin.Current);
             }
         }
     }
 }
コード例 #3
0
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream stream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream stream2 = new ZipHelperStream(stream))
         {
             stream2.ReadLEInt();
             while (stream2.Position < stream2.Length)
             {
                 int num  = stream2.ReadLEShort();
                 int num2 = stream2.ReadLEShort();
                 if (num == 1)
                 {
                     if (num2 >= 0x18)
                     {
                         long fileTime = stream2.ReadLELong();
                         this.lastModificationTime_ = DateTime.FromFileTime(fileTime);
                         long num4 = stream2.ReadLELong();
                         this.lastAccessTime_ = DateTime.FromFileTime(num4);
                         long num5 = stream2.ReadLELong();
                         this.createTime_ = DateTime.FromFileTime(num5);
                     }
                     return;
                 }
                 stream2.Seek((long)num2, SeekOrigin.Current);
             }
         }
     }
 }
コード例 #4
0
ファイル: NTTaggedData.cs プロジェクト: ramon1984/word_reader
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream stream = new MemoryStream(data, index, count, writable: false))
     {
         using (ZipHelperStream zipHelperStream = new ZipHelperStream(stream))
         {
             zipHelperStream.ReadLEInt();
             int num2;
             while (true)
             {
                 if (zipHelperStream.Position >= zipHelperStream.Length)
                 {
                     return;
                 }
                 int num = zipHelperStream.ReadLEShort();
                 num2 = zipHelperStream.ReadLEShort();
                 if (num == 1)
                 {
                     break;
                 }
                 zipHelperStream.Seek(num2, SeekOrigin.Current);
             }
             if (num2 >= 24)
             {
                 long fileTime = zipHelperStream.ReadLELong();
                 _lastModificationTime = DateTime.FromFileTime(fileTime);
                 long fileTime2 = zipHelperStream.ReadLELong();
                 _lastAccessTime = DateTime.FromFileTime(fileTime2);
                 long fileTime3 = zipHelperStream.ReadLELong();
                 _createTime = DateTime.FromFileTime(fileTime3);
             }
         }
     }
 }
コード例 #5
0
ファイル: NTTaggedData.cs プロジェクト: huaminglee/myyyyshop
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream stream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream stream2 = new ZipHelperStream(stream))
         {
             stream2.ReadLEInt();
             while (stream2.Position < stream2.Length)
             {
                 int num = stream2.ReadLEShort();
                 int num2 = stream2.ReadLEShort();
                 if (num == 1)
                 {
                     if (num2 >= 0x18)
                     {
                         long fileTime = stream2.ReadLELong();
                         this._lastModificationTime = DateTime.FromFileTime(fileTime);
                         long num4 = stream2.ReadLELong();
                         this._lastAccessTime = DateTime.FromFileTime(num4);
                         long num5 = stream2.ReadLELong();
                         this._createTime = DateTime.FromFileTime(num5);
                     }
                     return;
                 }
                 stream2.Seek((long) num2, SeekOrigin.Current);
             }
         }
     }
 }
コード例 #6
0
        public void SetData(byte[] data, int index, int count)
        {
            //IL_0004: Unknown result type (might be due to invalid IL or missing references)
            //IL_000a: Expected O, but got Unknown
            MemoryStream val = new MemoryStream(data, index, count, false);

            try
            {
                ZipHelperStream zipHelperStream = new ZipHelperStream((Stream)(object)val);
                try
                {
                    zipHelperStream.ReadLEInt();
                    while (((Stream)zipHelperStream).get_Position() < ((Stream)zipHelperStream).get_Length())
                    {
                        int num  = zipHelperStream.ReadLEShort();
                        int num2 = zipHelperStream.ReadLEShort();
                        if (num == 1)
                        {
                            if (num2 >= 24)
                            {
                                long num3 = zipHelperStream.ReadLELong();
                                _lastModificationTime = global::System.DateTime.FromFileTime(num3);
                                long num4 = zipHelperStream.ReadLELong();
                                _lastAccessTime = global::System.DateTime.FromFileTime(num4);
                                long num5 = zipHelperStream.ReadLELong();
                                _createTime = global::System.DateTime.FromFileTime(num5);
                            }
                            break;
                        }
                        ((Stream)zipHelperStream).Seek((long)num2, (SeekOrigin)1);
                    }
                }
                finally
                {
                    ((global::System.IDisposable)zipHelperStream)?.Dispose();
                }
            }
            finally
            {
                ((global::System.IDisposable)val)?.Dispose();
            }
        }
コード例 #7
0
ファイル: ZipExtraData.cs プロジェクト: nagyist/SparkleDotNET
		/// <summary>
		/// Set the data from the raw values provided.
		/// </summary>
		/// <param name="data">The raw data to extract values from.</param>
		/// <param name="index">The index to start extracting values from.</param>
		/// <param name="count">The number of bytes available.</param>
		public void SetData(byte[] data, int index, int count)
		{
			using (MemoryStream ms = new MemoryStream(data, index, count, false)) 
			using (ZipHelperStream helperStream = new ZipHelperStream(ms))
			{
				helperStream.ReadLEInt(); // Reserved
				while (helperStream.Position < helperStream.Length)
				{
					int ntfsTag = helperStream.ReadLEShort();
					int ntfsLength = helperStream.ReadLEShort();
					if (ntfsTag == 1)
					{
						if (ntfsLength >= 24)
						{
							long lastModificationTicks = helperStream.ReadLELong();
							lastModificationTime_ = DateTime.FromFileTime(lastModificationTicks);

							long lastAccessTicks = helperStream.ReadLELong();
							lastAccessTime_ = DateTime.FromFileTime(lastAccessTicks);

							long createTimeTicks = helperStream.ReadLELong();
							createTime_ = DateTime.FromFileTime(createTimeTicks);
						}
						break;
					}
					else
					{
						// An unknown NTFS tag so simply skip it.
						helperStream.Seek(ntfsLength, SeekOrigin.Current);
					}
				}
			}
		}
コード例 #8
0
ファイル: NTTaggedData.cs プロジェクト: GameDiffs/TheForest
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
         {
             zipHelperStream.ReadLEInt();
             while (zipHelperStream.Position < zipHelperStream.Length)
             {
                 int num = zipHelperStream.ReadLEShort();
                 int num2 = zipHelperStream.ReadLEShort();
                 if (num == 1)
                 {
                     if (num2 >= 24)
                     {
                         long fileTime = zipHelperStream.ReadLELong();
                         this._lastModificationTime = DateTime.FromFileTime(fileTime);
                         long fileTime2 = zipHelperStream.ReadLELong();
                         this._lastAccessTime = DateTime.FromFileTime(fileTime2);
                         long fileTime3 = zipHelperStream.ReadLELong();
                         this._createTime = DateTime.FromFileTime(fileTime3);
                     }
                     break;
                 }
                 zipHelperStream.Seek((long)num2, SeekOrigin.Current);
             }
         }
     }
 }