Multisession again

vbimport

#1

My problem is

1 I dont know what flags to import when calling drive.ImportIsoTrack;
2 What these flags are
3 And when i call drive.ImportIsoTrack drive.onDoneImport never hapens, whay?

i call
if(NumberTrack>0) //from cdinfo
{
for(int i=0;i {
try
{
drive.ImportIsoTrack(i+1,NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY);
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}

}
}

alexp:
When posting code, you should always use code tags… [ code ] [ / code ] like the following:
Code:
for (i = 0; i < 5; i ++) { } As for you problem… Why would you want to import all tracks in a single loop? Normally, you want to import only one track, usually the last one. Your code will not work for another reason… you should really wait for OnDoneImport[2] event before attempting another import, or you will get an error.

And another thing… imported tracks are zero based, so i + 1 (when i = 0) will actually import the second track.

For a definition of various flags, you should consult the docs. Besides, many of the names are already safe explanatory.

[B]gapilazo

I corrected all the mistakes, exept i still don’t know how the method onDonImport shuld work. Now program works but stil when i try tu burn cd i get error thet the disk is not emty[/B]


#2

Have you made sure the the disk is multisession when you do your first burn, i.e. ensure you have the NERO_BURN_FLAG_CLOSE_SESSION flage


#3

I corrected all the mistakes, exept i still don’t know how the method onDonImport shuld work. Now program works but stil when i try tu burn cd i get error thet the disk is not emty
After calling drive.ImportIsoTrack() you should wait for OnDoneImport or OnDoneImport2 event. It will give you the imported file/folder hierarchy which you need to merge with your own new content and then proceed with burning. There is no point in importing all tracks one by one. You normally want to import just one track and this is usually the last one.


#4

pleas help me

if i use these flags

	
drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CD);

it is ok for one session but not for on this media

if i use these flags

	
drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CD);

i get this error
Write error


#5

pleas help me

if i use these flags

	
drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CD);

it is ok for one session but not multi
if i use these flags

	
drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CD);

i get this error
Write error


#6

You need

NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE + NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION

Mike


#7

now it overwrites evreything with new file so i lose previous


#8

Well, you ARE doing something wrong and showing only bits and pieces of information. If you see only “new” files, you either did not import a previous session or you imported the wrong one. If the files from your previous session match the “new” ones by name and path, it could be that the “new” ones overwrote the “old” ones. It is hard to say anything without really knowing what you are attempting to do.


#9

i am traying to make incremental backups.
here is my code


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using NEROLib;

namespace MDocBeckup
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class fBeckup : System.Windows.Forms.Form
	{
		private System.ComponentModel.IContainer components;
		private Podatki dbPodatki = new Podatki();
		private System.Windows.Forms.Button button1;
		private UpDownload UpDown = new UpDownload();
		private string[] fajli ; 
		private xCabinet.xCabClass compressMe = new xCabinet.xCabClass();
		private dProgress progress = new dProgress();
		private dsDirektoriji dsDirekt = new dsDirektoriji(); 
		private string[] potBackup;
		private NEROLib.NeroClass nero = new NEROLib.NeroClass();
		private INeroDrives drives; 
		private NeroDrive drive;
		private int driveSpeed = 4;
 		string[] serverPotBackup;
		string ImeDrive;
		dsNastavitve myNast = new dsNastavitve();
		dsPodjetja dsPodjetje = new dsPodjetja();
		string imebaze; 
		dsNastavitve nas = new dsNastavitve();
		dsDirektoriji.DirektorijiRow[] vrste;
		private int stDirektorijev;
		private ArrayList arrList;
		private int SteviloSessionov;
		private NeroSpeeds MozneHitrosti;
		NeroFolderClass neroMapa = new NeroFolderClass();	
		NeroFolderClass neroMapa2 = new NeroFolderClass();
		
			
		
		
		private System.Windows.Forms.RichTextBox rtbObvestila;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		private System.Windows.Forms.ToolBarButton toolNastavitve;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBar toolBackup;
		private System.Windows.Forms.Timer timer1;   // v to spremenljivko bomo shranjevali podi mep za bekapiranje posamezne enote
		                                        // ki so predstavljene v XMLju		
				
		
		DateTime dtČasZadnjegaBeckupa;
		public fBeckup()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		    // Dogotki ki jih moramo lovit pri snemanju na cd
			nero.OnFileSelImage +=new _INeroEvents_OnFileSelImageEventHandler(nero_OnFileSelImage);
			nero.OnWaitCD +=new _INeroEvents_OnWaitCDEventHandler(nero_OnWaitCD);
			nero.OnWaitCDReminder +=new _INeroEvents_OnWaitCDReminderEventHandler(nero_OnWaitCDReminder);
			nero.OnNonEmptyCDRW +=new _INeroEvents_OnNonEmptyCDRWEventHandler(nero_OnNonEmptyCDRW);
			
            // Preberemo nastavitve 
			//nas.ReadXml(Application.StartupPath+"\
astavitve.xml");
			//serverBackup = nas.Nastavitve[0].BackupDirektori; 
			dsDirekt.ReadXml(Application.StartupPath+"\\poti.xml");
			stDirektorijev = dsDirekt.Direktoriji.Rows.Count;
			
			myNast.ReadXml(Application.StartupPath+"\
astavitve.xml");
			ImeDrive = myNast.Nastavitve[0].Driver;
			imebaze = dbPodatki.sqlConn.Database;
			
		
			

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.button1 = new System.Windows.Forms.Button();
			this.rtbObvestila = new System.Windows.Forms.RichTextBox();
			this.button2 = new System.Windows.Forms.Button();
			this.toolBackup = new System.Windows.Forms.ToolBar();
			this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
			this.toolNastavitve = new System.Windows.Forms.ToolBarButton();
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(480, 256);
			this.button1.Name = "button1";
			this.button1.TabIndex = 0;
			this.button1.Text = "Start";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// rtbObvestila
			// 
			this.rtbObvestila.Location = new System.Drawing.Point(336, 56);
			this.rtbObvestila.Name = "rtbObvestila";
			this.rtbObvestila.Size = new System.Drawing.Size(240, 56);
			this.rtbObvestila.TabIndex = 2;
			this.rtbObvestila.Text = "";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(200, 176);
			this.button2.Name = "button2";
			this.button2.TabIndex = 3;
			this.button2.Text = "naTest";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// toolBackup
			// 
			this.toolBackup.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																						  this.toolBarButton1,
																						  this.toolBarButton2,
																						  this.toolNastavitve});
			this.toolBackup.DropDownArrows = true;
			this.toolBackup.Location = new System.Drawing.Point(0, 0);
			this.toolBackup.Name = "toolBackup";
			this.toolBackup.ShowToolTips = true;
			this.toolBackup.Size = new System.Drawing.Size(592, 42);
			this.toolBackup.TabIndex = 4;
			this.toolBackup.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
			// 
			// toolBarButton1
			// 
			this.toolBarButton1.Text = "Izhod";
			// 
			// toolBarButton2
			// 
			this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
			// 
			// toolNastavitve
			// 
			this.toolNastavitve.Text = "Nastavitve";
			// 
			// timer1
			// 
			this.timer1.Interval = 2000;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// fBeckup
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(592, 302);
			this.Controls.Add(this.toolBackup);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.rtbObvestila);
			this.Controls.Add(this.button1);
			this.Name = "fBeckup";
			this.Text = "BACKUP";
			this.Load += new System.EventHandler(this.fBeckup_Load);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new fBeckup());
		}

		private void fBeckup_Load(object sender, System.EventArgs e)
		{			
			drives = nero.GetDrives(NERO_MEDIA_TYPE.NERO_MEDIA_NO_DVD_M_RW);	
		
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			dsPodjetje.ReadXml(Application.StartupPath+"\\BackupEnote.xml");
			string tmp;
			dsDirekt.Clear();
			dsDirekt.ReadXml(Application.StartupPath+"\\poti.xml");
			//Njprej preberemo datum zadnjega backupa
			
			for (int t=0;t<dsPodjetje.podjetja.Rows.Count;t++)
			{
				dbPodatki.sqlConn.ConnectionString=dsPodjetje.podjetja[t].povNiz;
				dbPodatki.sqlNajdiStevilkoBeckupa.Connection.Open();
				tmp = dbPodatki.sqlNajdiStevilkoBeckupa.ExecuteScalar().ToString();
				dbPodatki.sqlNajdiStevilkoBeckupa.Connection.Close();
				if(tmp!="")
				{
				////////////////POPRAVI  tmp = datetime
					dbPodatki.sqlNajdiStevilkoBeckupa.Connection.Open();
					dtČasZadnjegaBeckupa= (DateTime)dbPodatki.sqlNajdiStevilkoBeckupa.ExecuteScalar();
					dbPodatki.sqlNajdiStevilkoBeckupa.Connection.Close();
				//najdemo vse dokumente katerih datum spremembe je večji od datuma backupa		
				}
				else
				{						
					dtČasZadnjegaBeckupa=DateTime.MinValue;				
				}

			     arrList = new ArrayList();
				for(int i = 0;i<dsDirekt.Direktoriji.Rows.Count;i++)
				{
				///RAZMIÅ LJAJ O NOVEM LETU
				
				//	potBackup[i]=vrste[i].Pot.ToString();
					if(dsDirekt.Direktoriji[i].Direktori=="Dokumenti")
					{					
						dsDirekt.Direktoriji[i].Direktori="dokumenti\\"+DateTime.Today.Year.ToString();
					}
					try
					{
						fajli=UpDown.SpremenjeniPoDatumu(dsPodjetje.podjetja[t].arhiv+"\\"+dsDirekt.Direktoriji[i].Direktori,dtČasZadnjegaBeckupa);
						
					}
					catch(Exception f)
					{
						MessageBox.Show(f.Message);
					}
					arrList.AddRange(fajli);
					if(i==0)
					{
						backup_baze();						
						try
						{
							arrList.Add("f:\\Arhiv\\backup"+imebaze+".bak");
						
						}
						catch(Exception d)
						{
							MessageBox.Show(d.Message);
						}					
					}
					       			
				}
				pripraviPaket(arrList,dsPodjetje.podjetja[t].ime+".cab");  
				if(Directory.Exists(Application.StartupPath+"\\Pdfji"))
				Directory.Delete(Application.StartupPath+"\\Pdfji",true);
			}
			MessageBox.Show("Iskanje in zbiranje fajlov je uspeÅ¡no zaključeno","Backup",MessageBoxButtons.OK,MessageBoxIcon.Information);
            NaloziDrive();		
			//zapisiDatumBackupa();

		}
		private void NaloziDrive()
		{
			
			//Naložimo drive katerge ime imamo shranjeno v XMLju
			for(int t =0;t<drives.Count;t++)
			{
				if(drives.Item(t).DeviceName==ImeDrive)
				{
					drive = (NeroDrive)drives.Item(t);
				}
			}
			try
			{
				driveSpeed = drive.WriteSpeeds.BaseSpeedKBs;
			}
				
			catch(Exception e)
			{
				MessageBox.Show(e.Message);
			}
			drive.OnDoneWaitForMedia += new _INeroDriveEvents_OnDoneWaitForMediaEventHandler(drive_OnDoneWaitForMedia);
			drive.OnAddLogLine +=new _INeroDriveEvents_OnAddLogLineEventHandler(drive_OnAddLogLine);
			drive.OnDoneBurn +=new _INeroDriveEvents_OnDoneBurnEventHandler(drive_OnDoneBurn);
			drive.OnProgress +=new _INeroDriveEvents_OnProgressEventHandler(drive_OnProgress);
			drive.OnDoneCDInfo+=new _INeroDriveEvents_OnDoneCDInfoEventHandler(drive_OnDoneCDInfo);
			drive.OnDoneImport2+=new _INeroDriveEvents_OnDoneImport2EventHandler(drive_OnDoneImport2);
			
			//NERO_CDINFO_FLAGS f=new NERO_CDINFO_FLAGS();
			drive.CDInfo(NERO_CDINFO_FLAGS.NERO_READ_CD_TEXT);
			
		
		}
		private void ZapeciCD()
		{
			
			
			if(SteviloSessionov>0)
			{				
				drive.ImportIsoTrack(SteviloSessionov-1,NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY);
			}
			else
			{
				zapeci();
			}
		}
		private void zapeci()
		{
	
		
			NeroISOTrackClass ISOTrack = new NeroISOTrackClass();
			ISOTrack.Name="backup";
			ISOTrack.RootFolder=neroMapa;
			
			
			string[] cabFiles;   
		
				cabFiles = Directory.GetFiles(Application.StartupPath+"\\paket");
		 
			for(int i =0;i<cabFiles.Length;i++)
			{
				NeroFileClass neroFile = new NeroFileClass();

				neroFile.SourceFilePath=cabFiles[i];
				cabFiles[i]=cabFiles[i].Substring(cabFiles[i].LastIndexOf("\\")+1);
				neroFile.Name=cabFiles[i];
				try
				{
					neroMapa.Files.Add(neroFile);
				}
				catch(Exception e)
				{
					MessageBox.Show(e.Message);
				}	
				neroMapa.Folders.Add(neroMapa2);
				
			}
			ISOTrack.BurnOptions = NERO_BURN_OPTIONS.NERO_BURN_OPTION_CREATE_ISO_FS | NERO_BURN_OPTIONS.NERO_BURN_OPTION_USE_JOLIET;
   
			try
			{
				drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE | NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CDRW);
			}
			catch(Exception d)
			{
				MessageBox.Show(d.Message);
			}
			
			
			
	
		}
		private void Compress_Progress(int start, int konec)
		{
			progress.progStatus.Maximum = konec;
			progress.progStatus.Value = start;
		}                                                                                                                                                                   	
		private void drive_OnDoneWaitForMedia(ref bool ok)
		{
			rtbObvestila.Text="Done waiting for media.";
		}
		private void drive_OnAddLogLine(ref NERO_TEXT_TYPE sporocilo,ref string niz)
		{
			rtbObvestila.Text = niz.ToString();
		}
		private void drive_OnDoneBurn(ref NERO_BURN_ERROR error)
		{
			if (error != NERO_BURN_ERROR.NERO_BURN_OK)
			{
				MessageBox.Show(error.ToString());
				return;
			}	  
		}
		private void drive_OnProgress(ref int progres,ref bool abort)
		{
			//progresBar.Value = progres;
		}
		
		private void nero_OnFileSelImage(ref string fileName)
		{
			fileName = "C:\\image.nrg";
		}
		private void nero_OnWaitCD(ref NERO_WAITCD_TYPE neki,ref string text)
		{
			MessageBox.Show(neki.ToString());
				
			MessageBox.Show(text.ToString());
			if(neki != NERO_WAITCD_TYPE.NERO_WAITCD_EMPTYCD)
			{
				MessageBox.Show("V CDRW pogonu ni praznega cd medija! Prosim vstavite ga!","M.Doc Administrator",MessageBoxButtons.OK, MessageBoxIcon.Information);
			}
		}
		private void nero_OnWaitCDReminder()
		{
			MessageBox.Show("Prosim vstavite prazen cd!","M.Doc Administrator",MessageBoxButtons.OK, MessageBoxIcon.Information);
		}
		private void nero_OnNonEmptyCDRW(ref NERO_RESPONSE odgovor)
		{
			//odgovor = NERO_RESPONSE.NERO_RETURN_RESTART;
		}
		private void backup_baze()
		{
			imebaze = dbPodatki.sqlConn.Database;
			dbPodatki.sqlBackupBaze.CommandText= "BACKUP DATABASE ["+imebaze+"] TO DISK = 'f:\\Arhiv\\backup"+imebaze+".bak'"+ " WITH INIT, NOUNLOAD, NOSKIP, STATS = 10, NOFORMAT";
			try
			{
				dbPodatki.sqlBackupBaze.Connection.Open();
				dbPodatki.sqlBackupBaze.ExecuteNonQuery();
				dbPodatki.sqlBackupBaze.Connection.Close();
			}
			catch(Exception d)
			{
				MessageBox.Show(d.Message);
			}
		}
		private void pripraviPaket(ArrayList dokumenti2,string imeFajla)
		{      
			string[] dokumenti=new string[dokumenti2.Count];
			for(int h=0;h<dokumenti2.Count;h++)
			{
				dokumenti[h]=dokumenti2[h].ToString();
			}
			if(dokumenti.Length>0)
			{
				UpDownload upDown = new UpDownload();
				if (!Directory.Exists(Application.StartupPath+"\\Pdfji"))
					Directory.CreateDirectory(Application.StartupPath+"\\Pdfji");
				compressMe.CabName(Application.StartupPath+"\\paket\\"+imeFajla); 

				dProgress p = new dProgress();
				p.progStatus.Maximum = dokumenti.Length;
				int i = 0;
				p.progStatus.Value=i;
				p.Show();
				for(i=0;i<dokumenti.Length;i++)
				{	
					string direktorij="w";
					
					try
					{	
						dokumenti[i]=dokumenti[i].ToUpper();
						direktorij = dokumenti[i].Substring(dokumenti[i].IndexOf("ARHIV"));
					}
					catch(Exception d)
					{
						MessageBox.Show(d.Message);
					}
						direktorij=direktorij.Substring(0,direktorij.LastIndexOf("\\"));
						
					if (!Directory.Exists(Application.StartupPath+"\\paket"))
						Directory.CreateDirectory(Application.StartupPath+"\\paket");
					    
					upDown.Download(dokumenti[i],Application.StartupPath+"\\Pdfji\\"+dokumenti[i].Substring(dokumenti[i].LastIndexOf("\\")));
						
					compressMe.AddFile(Application.StartupPath+"\\Pdfji\\"+dokumenti[i].Substring(dokumenti[i].LastIndexOf("\\")),direktorij);
					p.progStatus.Value = i;
				}
				p.Close();
				compressMe.Compress();				
				compressMe.ClearContens();
			}
		}
		private void button2_Click(object sender, System.EventArgs e)
		{
			//ZapeciCD();
			NaloziDrive();
			//zapisiDatumBackupa();
			//fIndexNastavitev i = new fIndexNastavitev();
			//i.ShowDialog();
		}
		private void zapisiDatumBackupa()
		{
			for(int z =0;z<dsPodjetje.podjetja.Rows.Count;z++)
			{
				dbPodatki.sqlConn.ConnectionString=dsPodjetje.podjetja[z].povNiz;
				dbPodatki.sqlVstaviBackup.Parameters["@tip"].Value=0;
				dbPodatki.sqlVstaviBackup.Parameters["@datum"].Value=DateTime.Now;
				dbPodatki.sqlVstaviBackup.Parameters["@leto_arhiva"].Value=DateTime.Now.Year;
				try
				{
					dbPodatki.sqlVstaviBackup.Connection.Open();
					dbPodatki.sqlVstaviBackup.ExecuteNonQuery();
					dbPodatki.sqlVstaviBackup.Connection.Close();
				}
				catch(Exception e)
				{
					MessageBox.Show(e.Message);
				}
			}
		}
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch (toolBackup.Buttons.IndexOf(e.Button))
			{
				case 0:
				{
					this.Close();
					break;
				}
				case 2:
				{
					fMestoBackupa nastavi = new fMestoBackupa();
					try
					{
						nastavi.ShowDialog();
					}
					catch(Exception d)
					{
						MessageBox.Show(d.Message);
					}
				
					break;
				}
			}
		}

		private void drive_OnDoneCDInfo(NeroCDInfo pCDInfo)
		{			
			SteviloSessionov = pCDInfo.Tracks.Count;
	   
			ZapeciCD();
				
			//timer1.Enabled = true;
			//timer1.Start();
			//MessageBox.Show("ww");
			
		}

		

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			MessageBox.Show("www");
			timer1.Stop();
			ZapeciCD();

		}

		private void drive_OnDoneImport2(bool bOk, NeroFolder pFolder, NeroCDStamp pCDStamp, NeroImportDataTrackInfo pImportInfo, NERO_IMPORT_DATA_TRACK_RESULT importResult)
		{
			try
			{
			//	MessageBox.Show(pFolder.Name.ToString());
				MessageBox.Show(pFolder.Files.Count.ToString());
				MessageBox.Show(pImportInfo.VolumeName.ToString());
				neroMapa2.Folders.Add(pFolder);
				for(int i=0;i<pFolder.Files.Count;i++)
				{
					neroMapa.Files.Add(pFolder.Files.Item(i));
				}
				
			}
			catch(Exception e)
			{
				MessageBox.Show(e.Message);
			}
			
				
			
			zapeci();
		}
	}
}


#10

it looks like thet is to long


#11

You might want to attach it to the message instead…


#12

just some parts


	private void NaloziDrive()
		{
			
			//Naložimo drive katerge ime imamo shranjeno v XMLju
			for(int t =0;t&lt;drives.Count;t++)
			{
				if(drives.Item(t).DeviceName==ImeDrive)
				{
					drive = (NeroDrive)drives.Item(t);
				}
			}
			try
			{
				driveSpeed = drive.WriteSpeeds.BaseSpeedKBs;
			}
				
			catch(Exception e)
			{
				MessageBox.Show(e.Message);
			}
			drive.OnDoneWaitForMedia += new _INeroDriveEvents_OnDoneWaitForMediaEventHandler(drive_OnDoneWaitForMedia);
			drive.OnAddLogLine +=new _INeroDriveEvents_OnAddLogLineEventHandler(drive_OnAddLogLine);
			drive.OnDoneBurn +=new _INeroDriveEvents_OnDoneBurnEventHandler(drive_OnDoneBurn);
			drive.OnProgress +=new _INeroDriveEvents_OnProgressEventHandler(drive_OnProgress);
			drive.OnDoneCDInfo+=new _INeroDriveEvents_OnDoneCDInfoEventHandler(drive_OnDoneCDInfo);
			drive.OnDoneImport2+=new _INeroDriveEvents_OnDoneImport2EventHandler(drive_OnDoneImport2);
			
			//NERO_CDINFO_FLAGS f=new NERO_CDINFO_FLAGS();
			drive.CDInfo(NERO_CDINFO_FLAGS.NERO_READ_CD_TEXT);
			
		
		}
		private void ZapeciCD()
		{
			
			
			if(SteviloSessionov&gt;0)
			{				
				drive.ImportIsoTrack(SteviloSessionov-1,NERO_IMPORT_ISO_TRACK_FLAGS.NERO_IMPORT_ISO_ONLY);
			}
			else
			{
				zapeci();
			}
		}
		private void zapeci()
		{
	
		
			NeroISOTrackClass ISOTrack = new NeroISOTrackClass();
			ISOTrack.Name="backup";
			ISOTrack.RootFolder=neroMapa;
			
			
			string[] cabFiles;   
		
				cabFiles = Directory.GetFiles(Application.StartupPath+"\\paket");
		 
			for(int i =0;i&lt;cabFiles.Length;i++)
			{
				NeroFileClass neroFile = new NeroFileClass();

				neroFile.SourceFilePath=cabFiles[i];
				cabFiles[i]=cabFiles[i].Substring(cabFiles[i].LastIndexOf("\\")+1);
				neroFile.Name=cabFiles[i];
				try
				{
					neroMapa.Files.Add(neroFile);
				}
				catch(Exception e)
				{
					MessageBox.Show(e.Message);
				}	
				neroMapa.Folders.Add(neroMapa2);
				
			}
			ISOTrack.BurnOptions = NERO_BURN_OPTIONS.NERO_BURN_OPTION_CREATE_ISO_FS | NERO_BURN_OPTIONS.NERO_BURN_OPTION_USE_JOLIET;
   
			try
			{
				drive.BurnIsoAudioCD("","",false,ISOTrack,null,null,NERO_BURN_FLAGS.NERO_BURN_FLAG_WRITE | NERO_BURN_FLAGS.NERO_BURN_FLAG_CLOSE_SESSION,driveSpeed,NERO_MEDIA_TYPE.NERO_MEDIA_CDRW);
			}
			catch(Exception d)
			{
				MessageBox.Show(d.Message);
			}
			
			
			
	
		}
	private void drive_OnDoneCDInfo(NeroCDInfo pCDInfo)
		{			
			SteviloSessionov = pCDInfo.Tracks.Count;
			ZapeciCD();
						
		}

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			MessageBox.Show("www");
			timer1.Stop();
			ZapeciCD();

		}

		private void drive_OnDoneImport2(bool bOk, NeroFolder pFolder, NeroCDStamp pCDStamp, NeroImportDataTrackInfo pImportInfo, NERO_IMPORT_DATA_TRACK_RESULT importResult)
		{
			try
			{
			//	MessageBox.Show(pFolder.Name.ToString());
				MessageBox.Show(pFolder.Files.Count.ToString());
				MessageBox.Show(pImportInfo.VolumeName.ToString());
				neroMapa2.Folders.Add(pFolder);
				for(int i=0;i&lt;pFolder.Files.Count;i++)
				{
					neroMapa.Files.Add(pFolder.Files.Item(i));
				}
				
			}
			catch(Exception e)
			{
				MessageBox.Show(e.Message);
			}
			zapeci();
		}
	}
}

#13

ok


#14

how do i attach it to the message


#15

There is a “Manage Attachments” button right below the WYSIWYG editor that you use to type a message. You will probably need to ZIP it first as not all extensions are allowed.


#16

My problem is thet it overwrites previus files.

i guess i have problems with importing
becouse some times i get only new files or emty CD

i send my code in notepad and allso in c# Visual Studio File.

I start with button2_Click function.

I hope you can help me

if any one hes problems understanding becouse some things in code are not english i will gladly explain.

MyCode.zip (9.43 KB)


#17

It is rather simple. You are not doing anything in drive_OnDoneImport2!!! You only display two message boxes and proceed with burning. You are not using the supplied NeroFolder pFolder in any way! You should add files and folders from pFolder to your [size=2]ISOTrack.RootFolder. Only then will they be referenced during burning. Your current implementation makes importing the session a noop.

[/size]


#18

i already tried like this


private void drive_OnDoneImport2(bool bOk, NeroFolder pFolder, NeroCDStamp pCDStamp, NeroImportDataTrackInfo pImportInfo, NERO_IMPORT_DATA_TRACK_RESULT importResult)
		{
			try
			{
			//	MessageBox.Show(pFolder.Name.ToString());
				MessageBox.Show(pFolder.Files.Count.ToString());
				MessageBox.Show(pImportInfo.VolumeName.ToString());
				for(int i=0;i<pFolder.Files.Count;i++)
				{
					neroMapa.Files.Add(pFolder.Files.Item(i));
				}
					
				
			}
			catch(Exception e)
			{
				MessageBox.Show(e.Message);
			}
			zapeci();
		}
				}

but i get error

item already belongs to some collection


#19

private void drive_OnDoneImport2(bool bOk, NeroFolder pFolder, NeroCDStamp pCDStamp, NeroImportDataTrackInfo pImportInfo, NERO_IMPORT_DATA_TRACK_RESULT importResult)
{
try
{
// MessageBox.Show(pFolder.Name.ToString());
MessageBox.Show(pFolder.Files.Count.ToString());
MessageBox.Show(pImportInfo.VolumeName.ToString());
for(int i=0;i<pFolder.Files.Count;i++)
{
neroMapa.Files.Add(pFolder.Files.Item(i));
}

		}
		catch(Exception e)
		{
			MessageBox.Show(e.Message);
		}
		zapeci();
	}

}


#20

I cannot see the code but the error tells a lot. You can take two approaches. If you want to move items from pFolder to your other variable, you should first remove each item from pFolder and then add it to the other collection.

A simpler approach is to simply use pFolder as your root folder and add all of your new content to it. This way you can avoid doing more work than necessary.