Exemplo n.º 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();
             }
         }
     }
 }
Exemplo n.º 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 (var ms = new MemoryStream(data, index, count, false))
                using (var 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 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 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 DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() +
                                       new TimeSpan(0, 0, 0, iTime, 0)).ToLocalTime();
                    }
                }
        }
Exemplo n.º 3
0
 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))
         {
             _flags = (Flags)zipHelperStream.ReadByte();
             if ((_flags & Flags.ModificationTime) != 0 && count >= 5)
             {
                 int seconds = zipHelperStream.ReadLEInt();
                 _modificationTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
             if ((_flags & Flags.AccessTime) != 0)
             {
                 int seconds2 = zipHelperStream.ReadLEInt();
                 _lastAccessTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds2, 0)).ToLocalTime();
             }
             if ((_flags & Flags.CreateTime) != 0)
             {
                 int seconds3 = zipHelperStream.ReadLEInt();
                 _createTime = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds3, 0)).ToLocalTime();
             }
         }
     }
 }
Exemplo n.º 4
0
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
         {
             this._flags = (ExtendedUnixData.Flags)zipHelperStream.ReadByte();
             if ((byte)(this._flags & ExtendedUnixData.Flags.ModificationTime) != 0)
             {
                 int seconds = zipHelperStream.ReadLEInt();
                 this._modificationTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds, 0);
                 if (count <= 5)
                 {
                     return;
                 }
             }
             if ((byte)(this._flags & ExtendedUnixData.Flags.AccessTime) != 0)
             {
                 int seconds2 = zipHelperStream.ReadLEInt();
                 this._lastAccessTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds2, 0);
             }
             if ((byte)(this._flags & ExtendedUnixData.Flags.CreateTime) != 0)
             {
                 int seconds3 = zipHelperStream.ReadLEInt();
                 this._createTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds3, 0);
             }
         }
     }
 }
Exemplo n.º 5
0
        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))
                {
                    _flags = (Flags)zipHelperStream.ReadByte();
                    if ((_flags & Flags.ModificationTime) == (Flags)0)
                    {
                        goto IL_005e;
                    }
                    int seconds = zipHelperStream.ReadLEInt();
                    _modificationTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds, 0);
                    if (count > 5)
                    {
                        goto IL_005e;
                    }
                    goto end_IL_0011;
IL_005e:
                    if ((_flags & Flags.AccessTime) != 0)
                    {
                        int seconds2 = zipHelperStream.ReadLEInt();
                        _lastAccessTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds2, 0);
                    }
                    if ((_flags & Flags.CreateTime) != 0)
                    {
                        int seconds3 = zipHelperStream.ReadLEInt();
                        _createTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) + new TimeSpan(0, 0, 0, seconds3, 0);
                    }
                    end_IL_0011 :;
                }
            }
        }
Exemplo n.º 6
0
        public void SetData(byte[] data, int index, int count)
        {
            using (MemoryStream ms = new MemoryStream(data, index, count, false))
                using (ZipHelperStream helperStream = new ZipHelperStream(ms))
                {
                    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();
                    }
                }
        }
Exemplo n.º 7
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 ((((int)(this._flags & Flags.ModificationTime)) != 0) && (count >= 5))
             {
                 int seconds = stream2.ReadLEInt();
                 this._modificationTime = (new DateTime(0x7b2, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
             if (((int)(this._flags & Flags.AccessTime)) != 0)
             {
                 int seconds = stream2.ReadLEInt();
                 this._lastAccessTime = (new DateTime(0x7b2, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
             if (((int)(this._flags & Flags.CreateTime)) != 0)
             {
                 int seconds = stream2.ReadLEInt();
                 this._createTime = (new DateTime(0x7b2, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
         }
     }
 }
Exemplo n.º 8
0
 public void SetData(byte[] data, int index, int count)
 {
     using (MemoryStream memoryStream = new MemoryStream(data, index, count, false))
     {
         using (ZipHelperStream zipHelperStream = new ZipHelperStream(memoryStream))
         {
             this.flags_ = (ExtendedUnixData.Flags)zipHelperStream.ReadByte();
             if ((byte)(this.flags_ & ExtendedUnixData.Flags.ModificationTime) != 0 && count >= 5)
             {
                 int seconds = zipHelperStream.ReadLEInt();
                 this.modificationTime_ = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
             }
             if ((byte)(this.flags_ & ExtendedUnixData.Flags.AccessTime) != 0)
             {
                 int seconds2 = zipHelperStream.ReadLEInt();
                 this.lastAccessTime_ = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds2, 0)).ToLocalTime();
             }
             if ((byte)(this.flags_ & ExtendedUnixData.Flags.CreateTime) != 0)
             {
                 int seconds3 = zipHelperStream.ReadLEInt();
                 this.createTime_ = (new DateTime(1970, 1, 1, 0, 0, 0).ToUniversalTime() + new TimeSpan(0, 0, 0, seconds3, 0)).ToLocalTime();
             }
         }
     }
 }
Exemplo n.º 9
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();
             }
         }
     }
 }
Exemplo n.º 10
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))
                {
                    // 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);
                    }
                }
        }
Exemplo n.º 11
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))
			{
				// 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();
				}
			}
		}