/*** Static Functions ***/ public static RCH2File CreateFromReader(ref BinaryReader br) { try { RCH2File file = new RCH2File(ref br); return(file); } catch (Exception e) { return(null); } }
/// <summary> /// Begins processing data from a currently open BinaryReader, be it /// from the Open() method, or SetBinaryReader(). /// /// An exception is thrown if something goes wrong. /// </summary> public void ProcessData() { // Clear the file list since we're starting afresh here. Files.Clear(); // Check magic number. if (!CheckMagicNumber(ref br)) { throw new Exception("Not an RCH2.0 file or bad magic number"); } // Start creating file entries from the rest. RCH2File file; while ((file = RCH2File.CreateFromReader(ref br)) != null) { Files.Add(file); } }