This project is read-only.

Exception Message: Failed to read whole directory...

Nov 21, 2012 at 7:50 PM

I encountered this error while trying to read the content of a ISO created by CDBuilder():

 

Source: DiscUtils
Class defining member: DiscUtils.Iso9660.ReaderDirectory
Exception Message: Failed to read whole directory
StackTrace:    
   at DiscUtils.Iso9660.ReaderDirectory..ctor(IsoContext context, DirectoryRecord dirEntry)
   at DiscUtils.Iso9660.VfsCDReader..ctor(Stream data, Boolean joliet, Boolean hideVersions)
   at DiscUtils.Iso9660.CDReader..ctor(Stream data, Boolean joliet)
   at MyApplication.ProcessJolietCD(String fileWeNeed, String& loadThis, FileStream isoStream)

 

I was running on Windows XP Professional Version 2002 Service Pack 3.

Rick

Nov 21, 2012 at 8:55 PM

Rick,

Can you provide a sample ISO and/or code that provokes the problem?

 

Thanks,

Ken

Nov 21, 2012 at 9:57 PM

Here is the code:

                using (var isoStream = File.OpenRead(_isoReaderInputFile))
                {
                    bool detectJoliet = CDReader.Detect(isoStream);
                    bool detectUDF = UdfReader.Detect(isoStream);

                    #region Read content from ISO files...

                    if (detectJoliet) ProcessJolietCD(fileWeNeed, out loadThis, isoStream);
                    if (detectUDF) ProcessUdfCD(fileWeNeed, out loadThis, isoStream);

                    #endregion

                }


	/// <summary>
        /// Use the DiscUtils CDReader object
        /// for reading Joliet based ISO files...
        /// </summary>
        /// <param name="fileWeNeed"></param>
        /// <param name="loadThis"></param>
        /// <param name="isoStream"></param>
        /// <returns>Index file name or empty string</returns>
        private void ProcessJolietCD(string fileWeNeed, out string loadThis, FileStream isoStream)
        {
            var stopwatch = new Stopwatch(); stopwatch.Start();
            Log.LogWrite("Enter ProcessJolietCD()...");
            try
            {
                loadThis = string.Empty;
                try
                {
                    // for now only (joliet==true) is acceptable
                    using (var cdReader = new CDReader(isoStream, true))
                    {
                        // find leaf directory... 
                        var leafNode = string.Empty;
                        GetLeafDir(cdReader, string.Empty, ref leafNode);

                        // list all the files embedded in the iso...
                        var files = new List<string>(cdReader.GetFiles(leafNode));

			........
		    }
		}
	    }
        }


        /// <summary>
        /// find the leaf node on the Joliet ISO
        /// </summary>
        /// <param name="cd"></param>
        /// <param name="fileName"></param>
        /// <param name="leafNode"></param>
        /// <returns></returns>
        private static void GetLeafDir(CDReader cd, string fileName, ref string leafNode)
        {
            try
            {
                foreach (var d in cd.GetDirectories(fileName))
                {
                    GetLeafDir(cd, d, ref leafNode);
                }

                if (cd.GetDirectories(fileName).Length.Equals(0))
                    leafNode = fileName;
            }
            catch { }
        }

                

Rick

 

Nov 21, 2012 at 10:13 PM

Because the ISO file contains customer data, I would rather not upload it to this forum.

Rick