LynnaLab.Room.UpdateRoomData C# (CSharp) Method

UpdateRoomData() private method

private UpdateRoomData ( ) : void
return void
        void UpdateRoomData()
        {
            // Get the tileDataFile
            int layoutGroup = area.LayoutGroup;
            string label = "room" + ((layoutGroup<<8)+(Index&0xff)).ToString("X4").ToLower();
            FileParser parserFile = Project.GetFileWithLabel(label);
            Data data = parserFile.GetData(label);
            if (data.CommandLowerCase != "m_roomlayoutdata") {
                throw new Exception("Expected label \"" + label + "\" to be followed by the m_RoomLayoutData macro.");
            }
            string roomString = data.GetValue(0) + ".bin";
            try {
                tileDataFile = Project.GetBinaryFile("rooms/small/" + roomString);
            }
            catch (FileNotFoundException) {
                try {
                    tileDataFile = Project.GetBinaryFile("rooms/large/" + roomString);
                }
                catch (FileNotFoundException) {
                    throw new FileNotFoundException("Couldn't find \"" + roomString + "\" in \"rooms/small\" or \"rooms/large\".");
                }
            }

            if (tileDataFile.Length == 80) { // Small map
                width = fileWidth = 10;
                height = 8;
            }
            else if (tileDataFile.Length == 176) { // Large map
                width = 0xf;
                fileWidth = 0x10;
                height = 0xb;
            }
            else
                throw new Exception("Size of file \"" + tileDataFile.Name + "\" was invalid!");
        }