Example #1
0
		public DateWrapper( BinaryDateRecord dateRecord ) {
			m_binaryDateRecord = dateRecord;
			this.SetAsciiDateRecord( 1900+dateRecord.Year, dateRecord.Month, dateRecord.DayOfMonth, dateRecord.Hour, dateRecord.Minute, dateRecord.Second, 0, 8 );
			m_date = new DateTime( 1900+dateRecord.Year, dateRecord.Month, dateRecord.DayOfMonth, dateRecord.Hour, dateRecord.Minute, dateRecord.Second );
		}
Example #2
0
		private void SetBinaryDateRecord( byte year, byte month, byte dayOfMonth, byte hour, byte minute, byte second ) {
			if ( m_binaryDateRecord == null ) {
				m_binaryDateRecord = new BinaryDateRecord();
			}

			m_binaryDateRecord.Year = year;
			m_binaryDateRecord.Month = month;
			m_binaryDateRecord.DayOfMonth = dayOfMonth;
			m_binaryDateRecord.Hour = hour;
			m_binaryDateRecord.Minute = minute;
			m_binaryDateRecord.Second = second;
		}
		private void SetDirectoryRecord( UInt64 extentLocation, UInt64 dataLength, BinaryDateRecord date, sbyte timeZone, byte fileFlags, byte[] fileIdentifier ) {
			if ( m_record == null ) {
				m_record = new DirectoryRecord();
			}

			m_record.ExtentLocation = extentLocation;
			m_record.DataLength = dataLength;

			m_record.Date = date;

			m_record.TimeZone = timeZone;
			m_record.FileFlags = fileFlags;

			m_record.LengthOfFileIdentifier = (byte)fileIdentifier.Length;
			m_record.FileIdentifier = fileIdentifier;

			m_record.Length = (byte)( m_record.LengthOfFileIdentifier+33 );
			if ( m_record.Length%2 == 1 ) {
				m_record.Length++;
			}

			if ( fileIdentifier.Length > 255 ||
				m_record.LengthOfFileIdentifier+33 > 255 ) {

				throw new Exception( "Depasire!" );
			}

			if ( m_volumeDescriptorType == VolumeType.Suplementary && 
				( ( fileFlags & 2 ) == 0 || 
				  fileIdentifier.Length != 1 || fileIdentifier[0] > 1 ) ) {

				m_volumeDescriptorType = VolumeType.Primary;
				this.VolumeDescriptorType = VolumeType.Suplementary;
			}
		}