Пример #1
0
 public void Close()
 {
     UnLockCD();
     if (NotWnd != null)
     {
         NotWnd.DestroyHandle();
         NotWnd = null;
     }
     if (((int)cdHandle != -1) && ((int)cdHandle != 0))
     {
         NativeMethods.CloseHandle(cdHandle);
     }
     cdHandle = IntPtr.Zero;
     m_Drive  = '\0';
     TocValid = false;
 }
Пример #2
0
		public void Close()
		{
			UnLockCD();
			if (NotWnd != null)
			{
				NotWnd.DestroyHandle();
				NotWnd = null;
			}
			if (((int)cdHandle != -1) && ((int)cdHandle != 0))
			{
				NativeMethods.CloseHandle(cdHandle);
			}
			cdHandle = IntPtr.Zero;
			m_Drive = '\0';
			TocValid = false;
		}
Пример #3
0
 public bool Open(char Drive)
 {
     Close();
     if (NativeMethods.GetDriveType(Drive + ":\\") == DriveType.DRIVE_CDROM)
     {
         cdHandle = NativeMethods.CreateFile("\\\\.\\" + Drive + ':', NativeMethods.GENERIC_READ, NativeMethods.FILE_SHARE_READ, IntPtr.Zero, NativeMethods.OPEN_EXISTING, 0, IntPtr.Zero);
         if (((int)cdHandle != -1) && ((int)cdHandle != 0))
         {
             m_Drive              = Drive;
             NotWnd               = new DeviceChangeNotificationWindow();
             NotWnd.DeviceChange += new DeviceChangeEventHandler(NotWnd_DeviceChange);
             return(true);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #4
0
		public bool Open(char Drive)
		{
			Close();
			if (NativeMethods.GetDriveType(Drive + ":\\") == DriveType.DRIVE_CDROM)
			{
				cdHandle = NativeMethods.CreateFile("\\\\.\\" + Drive + ':', NativeMethods.GENERIC_READ, NativeMethods.FILE_SHARE_READ, IntPtr.Zero, NativeMethods.OPEN_EXISTING, 0, IntPtr.Zero);
				if (((int)cdHandle != -1) && ((int)cdHandle != 0))
				{
					m_Drive = Drive;
					NotWnd = new DeviceChangeNotificationWindow();
					NotWnd.DeviceChange += new DeviceChangeEventHandler(NotWnd_DeviceChange);
					return true;
				}
				else
				{
					return true;
				}
			}
			else
			{
				return false;
			}
		}