Exemple #1
0
 public bool Open(Stream fs)
 {
     Header = MarshalUtil.ReadStruct <CCIHeader>(fs);
     GetNCSDDetails(fs);
     if (Header.Flags[(int)NCSD_Flags.MEDIA_TYPE_INDEX] < 1 || Header.Flags[(int)NCSD_Flags.MEDIA_TYPE_INDEX] > 2) //Checking if CCI/CSU
     {
         _errorMessage = "NCSD Image is not CCI/CSU";
         return(false);
     }
     CXIContexts = new CXIContext[8];
     // Read the CXIs
     for (var i = 0; i < CXIContexts.Length; i++)
     {
         if (Header.CXIEntries[i].Length > 0)
         {
             CXIContexts[i] = new CXIContext();
             var offset = Header.CXIEntries[i].Offset * NcsdInfo.media_unit;
             if (!(fs is MemoryStream) || offset < fs.Length)  //fix for reading from memory streams (archived)
             {
                 fs.Seek(offset, SeekOrigin.Begin);
             }
             else
             {
                 fs.Seek(0, SeekOrigin.End);
             }
             CXIContexts[i].Open(fs);
         }
     }
     GetNCSDType();
     return(true);
 }
Exemple #2
0
 public bool Open(Stream fs)
 {
     Header      = MarshalUtil.ReadStruct <CCIHeader>(fs);
     _romSize    = Header.CCILength * 512;
     CXIContexts = new CXIContext[8];
     // Read the CXIs
     for (var i = 0; i < CXIContexts.Length; i++)
     {
         if (Header.CXIEntries[i].Length > 0)
         {
             CXIContexts[i] = new CXIContext();
             var offset = Header.CXIEntries[i].Offset * 0x200;
             if (!(fs is MemoryStream) || offset < fs.Length)  //fix for reading from memory streams (archived)
             {
                 fs.Seek(offset, SeekOrigin.Begin);
             }
             else
             {
                 fs.Seek(0, SeekOrigin.End);
             }
             CXIContexts[i].Open(fs);
         }
     }
     return(true);
 }
Exemple #3
0
 public bool Open(Stream fs)
 {
     Header = MarshalUtil.ReadStruct<CCIHeader>(fs);
     GetNCSDDetails(fs);
     if (Header.Flags[(int)NCSD_Flags.MEDIA_TYPE_INDEX] < 1 || Header.Flags[(int)NCSD_Flags.MEDIA_TYPE_INDEX] > 2) //Checking if CCI/CSU
     {
         _errorMessage = "NCSD Image is not CCI/CSU";
         return false;
     }
     CXIContexts = new CXIContext[8];
     // Read the CXIs
     for (var i = 0; i < CXIContexts.Length;i++ )
         if (Header.CXIEntries[i].Length > 0)
         {
             CXIContexts[i] = new CXIContext();
             var offset = Header.CXIEntries[i].Offset * NcsdInfo.media_unit; 
             if (!(fs is MemoryStream) ||  offset < fs.Length) //fix for reading from memory streams (archived)
                 fs.Seek(offset, SeekOrigin.Begin);
             else
                 fs.Seek(0, SeekOrigin.End);
             CXIContexts[i].Open(fs);
         }
     GetNCSDType();
     return true;
 }
Exemple #4
0
 public bool Open(Stream fs)
 {
     Header = MarshalUtil.ReadStruct<CCIHeader>(fs);
     _romSize = Header.CCILength * 512;
     CXIContexts = new CXIContext[8];
     // Read the CXIs
     for (var i = 0; i < CXIContexts.Length;i++ )
         if (Header.CXIEntries[i].Length > 0)
         {
             CXIContexts[i] = new CXIContext();
             var offset = Header.CXIEntries[i].Offset*0x200;
             if (!(fs is MemoryStream) ||  offset < fs.Length) //fix for reading from memory streams (archived)
                 fs.Seek(offset, SeekOrigin.Begin);
             else
                 fs.Seek(0, SeekOrigin.End);
             CXIContexts[i].Open(fs);
         }
     return true;
 }