ReadLEInt() public method

Read an int in little endian byte order.
/// An i/o error occurs. /// /// The file ends prematurely ///
public ReadLEInt ( ) : int
return int
コード例 #1
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))
         {
             this._flags = (Flags) ((byte) stream2.ReadByte());
             if ((((byte) (this._flags & Flags.ModificationTime)) != 0) && (count >= 5))
             {
                 int seconds = stream2.ReadLEInt();
                 DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0);
                 this._modificationTime = (time.ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
             if (((byte) (this._flags & Flags.AccessTime)) != 0)
             {
                 int num2 = stream2.ReadLEInt();
                 DateTime time3 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
                 this._lastAccessTime = (time3.ToUniversalTime() + new TimeSpan(0, 0, 0, num2, 0)).ToLocalTime();
             }
             if (((byte) (this._flags & Flags.CreateTime)) != 0)
             {
                 int num3 = stream2.ReadLEInt();
                 DateTime time5 = new DateTime(0x7b2, 1, 1, 0, 0, 0);
                 this._createTime = (time5.ToUniversalTime() + new TimeSpan(0, 0, 0, num3, 0)).ToLocalTime();
             }
         }
     }
 }
コード例 #2
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);
                        }
                    }
                }
        }
コード例 #3
0
ファイル: NTTaggedData.cs プロジェクト: DevZhav/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);
             }
         }
     }
 }
コード例 #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
ファイル: ZipExtraData.cs プロジェクト: Thougaard02/SOSU-VR
        /// <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))
                {
                    // bit 0           if set, modification time is present
                    // bit 1           if set, access time is present
                    // bit 2           if set, creation time is present

                    _flags = (Flags)helperStream.ReadByte();
                    if (((_flags & Flags.ModificationTime) != 0))
                    {
                        int iTime = helperStream.ReadLEInt();

                        _modificationTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) +
                                            new TimeSpan(0, 0, 0, iTime, 0);

                        // Central-header version is truncated after modification time
                        if (count <= 5)
                        {
                            return;
                        }
                    }

                    if ((_flags & Flags.AccessTime) != 0)
                    {
                        int iTime = helperStream.ReadLEInt();

                        _lastAccessTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) +
                                          new TimeSpan(0, 0, 0, iTime, 0);
                    }

                    if ((_flags & Flags.CreateTime) != 0)
                    {
                        int iTime = helperStream.ReadLEInt();

                        _createTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) +
                                      new TimeSpan(0, 0, 0, iTime, 0);
                    }
                }
        }
コード例 #7
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
            //IL_0052: Unknown result type (might be due to invalid IL or missing references)
            //IL_009a: Unknown result type (might be due to invalid IL or missing references)
            //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
            MemoryStream val = new MemoryStream(data, index, count, false);

            try
            {
                ZipHelperStream zipHelperStream = new ZipHelperStream((Stream)(object)val);
                try
                {
                    _flags = (Flags)((Stream)zipHelperStream).ReadByte();
                    if ((_flags & Flags.ModificationTime) != 0 && count >= 5)
                    {
                        int num = zipHelperStream.ReadLEInt();
                        _modificationTime = (new global::System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num, 0)).ToLocalTime();
                    }
                    if ((_flags & Flags.AccessTime) != 0)
                    {
                        int num2 = zipHelperStream.ReadLEInt();
                        _lastAccessTime = (new global::System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num2, 0)).ToLocalTime();
                    }
                    if ((_flags & Flags.CreateTime) != 0)
                    {
                        int num3 = zipHelperStream.ReadLEInt();
                        _createTime = (new global::System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, num3, 0)).ToLocalTime();
                    }
                }
                finally
                {
                    ((global::System.IDisposable)zipHelperStream)?.Dispose();
                }
            }
            finally
            {
                ((global::System.IDisposable)val)?.Dispose();
            }
        }
コード例 #8
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();
            }
        }
コード例 #9
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);
					}
				}
			}
		}
コード例 #10
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))
			{
				// bit 0           if set, modification time is present
				// bit 1           if set, access time is present
				// bit 2           if set, creation time is present
				
				flags_ = (Flags)helperStream.ReadByte();
				if (((flags_ & Flags.ModificationTime) != 0) && (count >= 5))
				{
					int iTime = helperStream.ReadLEInt();

					modificationTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
						new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
				}

				if ((flags_ & Flags.AccessTime) != 0)
				{
					int iTime = helperStream.ReadLEInt();

					lastAccessTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
						new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
				}
				
				if ((flags_ & Flags.CreateTime) != 0)
				{
					int iTime = helperStream.ReadLEInt();

					createTime_ = (new System.DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
						new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
				}
			}
		}
コード例 #11
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);
             }
         }
     }
 }