Click here to Skip to main content
15,885,365 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.3K   8.1K   146  
Ever wonder how programs like Nero work? They make their own SCSI libraries... like this!
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Helper;

namespace Scsi.Multimedia
{
	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public class FormatDescriptorCDRW : FormatDescriptor
	{
		public FormatDescriptorCDRW() : base() { }

		public FormatDescriptorCDRW(bool session, bool grow, uint formatSize)
			: this()
		{
			this.Session = session;
			this.Grow = grow;
			this.FormatSize = formatSize;
			this.FormatOptionsValid = true;
		}

		public FormatDescriptorCDRW(bool session, bool grow, uint formatSize, bool immediate, bool tryOut, bool disablePrimary, bool disableCertification)
			: this(session, grow, formatSize)
		{
			this.Immediate = immediate;
			this.TryOut = tryOut;
			this.DisablePrimary = disablePrimary;
			this.DisableCertification = disableCertification;
		}

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte0;
		public bool Session { get { return Bits.GetBit(this.byte0, 7); } set { this.byte0 = Bits.SetBit(this.byte0, 7, value); } }
		public bool Grow { get { return Bits.GetBit(this.byte0, 6); } set { this.byte0 = Bits.SetBit(this.byte0, 6, value); } }
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte1;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte2;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private byte byte3;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private uint _FormatSize;
		/// <summary>The number of user data blocks. Must be divisible by the <see cref="WriteParametersPage.PacketSize"/> field.</summary>
		[Description("The number of user data blocks. Must be divisible by the PacketSize field.")]
		public uint FormatSize { get { return Bits.BigEndian(this._FormatSize); } set { this._FormatSize = Bits.BigEndian(value); } }


		public override FormatCode FormatCode { get { return FormatCode.CDRW; } }
	}
}

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