Click here to Skip to main content
15,881,757 members
Articles / Programming Languages / C#

SCSI Library in C# - Burn CDs and DVDs, Access Hard Disks, etc.

Rate me:
Please Sign up or sign in to vote.
4.77/5 (48 votes)
19 Jun 2017Ms-PL6 min read 145.2K   8.1K   146  
Ever wonder how programs like Nero work? They make their own SCSI libraries... like this!
using System.Diagnostics;
using System.Runtime.InteropServices;
using Helper;

namespace Scsi.Multimedia
{
	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public struct OperationalChangeEvent
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private const byte EVENT_CODE_MASK = 0x0F;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private const byte OPERATIONAL_STATUS_MASK = 0x0F;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte0;
		public OperationalEventCode OperationalEventCode
		{
			get { return (OperationalEventCode)Bits.GetValueMask(this.byte0, 0, EVENT_CODE_MASK); }
			set { this.byte0 = Bits.PutValueMask(this.byte0, (byte)value, 0, EVENT_CODE_MASK); }
		}
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte1;
		public bool PersistentPrevented { get { return Bits.GetBit(this.byte1, 7); } set { this.byte1 = Bits.SetBit(this.byte1, 7, value); } }
		public OperationalStatusCode OperationalStatusCode
		{
			get { return (OperationalStatusCode)Bits.GetValueMask(this.byte1, 0, OPERATIONAL_STATUS_MASK); }
			set { this.byte1 = Bits.PutValueMask(this.byte1, (byte)value, 0, OPERATIONAL_STATUS_MASK); }
		}
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private OperationalChangeClass _OperationalChange;
		public OperationalChangeClass OperationalChangeClass { get { return Bits.BigEndian(this._OperationalChange); } set { this._OperationalChange = Bits.BigEndian(value); } }
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions