| |||||||
| Commercial message | |
| | |
|
![]() |
| | Thread Tools |
| | #1 (permalink) |
| CD Freaks Junior Member Join Date: Mar 2005
Posts: 55
| NeroCom with c# - what's wrong in my code? Hi everboby I try to use NeroCom in c# project to burn some file on CD. i handled events ant try to make it run but it's not runing and events not accoure. can someone tell me what wrong with my code ? using System; using System.IO; using System.Collections; using System.Threading; using System.Drawing; using System.Web; using NEROLib; class neroTest { private NeroClass neroClass; private NeroDrives drives; private INeroDrives drives1; private NeroDrive drive; private NeroFolder folder; private NeroISOTrack isoTrack; /**********************************************/ public neroTest() // constructor { neroClass = new NeroClass(); isoTrack = new NeroISOTrackClass(); folder = new NeroFolderClass(); } /**********************************************/ /** methods for events **/ private void OnDoneBurn(ref NERO_BURN_ERROR statusCode) { if(statusCode != NERO_BURN_ERROR.NERO_BURN_OK) { Console.WriteLine("bad"); } else { Console.WriteLine("OK"); } } private void OnProgress(ref int ProgressInPercent, ref bool Abort) { Console.WriteLine("OnProgress"); } private void nDrive_OnDoneWaitForMedia(ref bool Success) { Console.WriteLine("nDrive_OnDoneWaitForMedia: "); } private void nDrive_OnAddLogLine(ref NERO_TEXT_TYPE TextType, ref string Text) { Console.WriteLine("nDrive_OnAddLogLine"); } private void nDrive_OnSetPhase(ref string Text) { Console.WriteLine("nDrive_OnSetPhase " ); } private void nDrive_OnAborted(ref bool Abort) { Console.WriteLine("nDrive_OnAborted" ); } private void nDrive_OnDoneCDInfo(NeroCDInfo pCDInfo) { Console.WriteLine("nDrive_OnDoneCDInfo: "); } private void nDrive_OnDoneEstimateTrackSize(bool bOk, int BlockSize) { Console.WriteLine("nDrive_OnDoneEstimateTrackSize: "); } private void nDrive_OnDoneImport(ref bool Ok, ref NeroFolder Folder, ref NeroCDStamp CDStamp) { Console.WriteLine("nDrive_OnDoneImport: "); } private void OnFileSelImage(ref string target) { Console.WriteLine("OnFileSelImage: "); } private void nClass_OnMegaFatal() { Console.WriteLine("nClass_OnMegaFatal: " + "A mega fatal error has occurred."); } private void nClass_OnNonEmptyCDRW(ref NERO_RESPONSE Response) { Console.WriteLine("nClass_OnNonEmptyCDRW: NERO_RETURN_EXIT"); } private void nClass_OnWaitCD(ref NERO_WAITCD_TYPE WaitCD, ref string WaitCDLocalizedText) { Console.WriteLine("nClass_OnWaitCD: " + WaitCDLocalizedText); } private void nClass_OnWaitCDMediaInfo(ref NERO_MEDIA_TYPE LastDetectedMedia, ref string LastDetectedMediaName, ref NERO_MEDIA_TYPE RequestedMedia, ref string RequestedMediaName) { Console.WriteLine("nClass_OnWaitCDMediaInfo: Waiting for a particular media type: " + RequestedMediaName); } private void nClass_OnWaitCDReminder() { Console.WriteLine("nClass_OnWaitCDReminder: Waiting for CD"); } private void nClass_OnWaitCDDone() { Console.WriteLine("nClass_OnWaitCDDone"); } private void nClass_OnDriveStatusChanged(int hostID, int targetID, NERO_DRIVECHANGE_RESULT driveStatus) { Console.WriteLine("nClass_OnDriveStatusChanged: hostID:" + hostID + " targetID:" + targetID + " " + driveStatus); } /**********************************************/ public void burn() { // deff NeroFileClass file; // init file = new NeroFileClass(); isoTrack.Name = "TestTrack"; isoTrack.RootFolder = folder; // events init drive.OnDoneBurn += new _INeroDriveEvents_OnDoneBurnEventHandler(OnDoneBurn); drive.OnProgress += new _INeroDriveEvents_OnProgressEventHandler(OnProgress); drive.OnDoneWaitForMedia += new _INeroDriveEvents_OnDoneWaitForMediaEventHandler(nDrive_OnDoneWaitForMedia); drive.OnAddLogLine += new _INeroDriveEvents_OnAddLogLineEventHandler(nDrive_OnAddLogLine); drive.OnSetPhase += new _INeroDriveEvents_OnSetPhaseEventHandler(nDrive_OnSetPhase); drive.OnAborted += new _INeroDriveEvents_OnAbortedEventHandler(nDrive_OnAborted); drive.OnDoneCDInfo +=new _INeroDriveEvents_OnDoneCDInfoEventHandler(nDrive_OnDoneCDInfo); // drive.OnDoneEstimateTrackSize +=new _INeroDriveEvents_OnDoneEstimateTrackSizeEventHandler(nDrive_OnDoneEstimateTrackSize); drive.OnDoneImport += new _INeroDriveEvents_OnDoneImportEventHandler(nDrive_OnDoneImport); neroClass.OnFileSelImage += new _INeroEvents_OnFileSelImageEventHandler(OnFileSelImage); neroClass.OnMegaFatal += new _INeroEvents_OnMegaFatalEventHandler(nClass_OnMegaFatal); neroClass.OnNonEmptyCDRW += new _INeroEvents_OnNonEmptyCDRWEventHandler(nClass_OnNonEmptyCDRW); neroClass.OnWaitCD += new _INeroEvents_OnWaitCDEventHandler(nClass_OnWaitCD); neroClass.OnWaitCDMediaInfo += new _INeroEvents_OnWaitCDMediaInfoEventHandler(nClass_OnWaitCDMediaInfo); neroClass.OnWaitCDReminder += new _INeroEvents_OnWaitCDReminderEventHandler(nClass_OnWaitCDReminder); neroClass.OnWaitCDDone += new _INeroEvents_OnWaitCDDoneEventHandler(nClass_OnWaitCDDone); neroClass.OnDriveStatusChanged +=new _INeroEvents_OnDriveStatusChangedEventHandler(nClass_OnDriveStatusChanged); // exec folder.Files.Add(file); file.Name = "music.mp3.txt"; file.SourceFilePath = @"D:\Yossi\music.txt"; isoTrack.BurnOptions = (NEROLib.NERO_BURN_OPTIONS)((int)NEROLib.NERO_BURN_OPTIONS.NERO_BURN_OPTION_CREATE_ISO_FS + (int)NEROLib.NERO_BURN_OPTIONS.NERO_BURN_OPTION_USE_JOLIET); drive.BurnIsoAudioCD("", "", false, isoTrack, null, null, NEROLib.NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE, 3, NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CD); } /**********************************************/ public void getDrives() { string str; drives = neroClass.GetDrives(NEROLib.NERO_MEDIA_TYPE.NERO_MEDIA_CDRW); foreach(NeroDrive drive1 in drives) { str = drive1.DriveLetter; if(drive1.DriveLetter == "e") { drive = drive1; // Console.WriteLine(drive.DeviceName); // Console.WriteLine(drive.DevType); } } } } /**********************************************/ class TsstClass { public static void Main() { string p22; neroTest neroObj; neroObj = new neroTest(); neroObj.getDrives(); neroObj.burn(); } } |
| | |
| | #4 (permalink) |
| CD Freaks Junior Member Join Date: Jan 2005
Posts: 73
| Re: NeroCom with c# - what's wrong in my code? I tested your code. at the end put thred.sleep(100000) and you will se theat all events fire like creazy. all so drive.onAbord(); all so burn proces is started. Did not have time to figure it out whay but it my help you I think maybe something is wrong all so with declering drive_onDoneCDInfo() but i am not shore You shold maybe try to make windows application not consol it is easyer Sory for my mistakes in english i am from Slovenija |
| | |
| | #5 (permalink) |
| CD Freaks Junior Member Join Date: Mar 2005
Posts: 55
| Re: NeroCom with c# - what's wrong in my code? hello "gapilazo" thank you - it's working. I'm sure that it will work in windows application without a need of sleep method about your English - it's o.k . I have sometimes problem with my English too. |
| | |
| |
| |
![]() |
| If you can't find where you are looking for, then become a member and get an answer fast! We have thousands of people online every moment of the day to help you! Click here |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| When WEBCAM CYBERSEX Goes Wrong.. real wrong!!! | MERV SKILTON | CD Freaks Living Room | 16 | 16-11-2006 20:42 |
| Benq 1640 region came with region code 0,region code 1 disk won't play in Powercinema | writetime | BenQ / Philips Burner | 3 | 31-08-2005 05:18 |
| Code for Nerocom VB, Multissession | ciginfo | Nero SDK Discussion Forum | 2 | 24-03-2005 10:33 |
| Need NeroCom Error Code | keyvan | Nero SDK Discussion Forum | 1 | 27-08-2004 21:59 |
| Need VB6 code for nerocom (willing to pay) | arwb | Nero SDK Discussion Forum | 2 | 20-08-2003 11:16 |