Beispiel #1
0
        public bool Load()
        {
            using (var file = FileManager.Instance.Provider.OpenFile(mFileName))
            {
                if (file == null)
                {
                    Log.Error("Unable to load WMO group. File not found: " + mFileName);
                    return(false);
                }

                var reader     = new BinaryReader(file);
                var readChunks = true;
                try
                {
                    while (readChunks)
                    {
                        var signature = reader.ReadUInt32();
                        var size      = reader.ReadInt32();

                        var oldPos = file.Position;
                        switch (signature)
                        {
                        case 0x4D4F4750:
                            mHeader  = reader.Read <Mogp>();
                            IsIndoor = (mHeader.flags & 0x2000) != 0 && (mHeader.flags & 0x8) == 0;
                            if (!LoadGroupChunks(reader, size - SizeCache <Mogp> .Size))
                            {
                                return(false);
                            }

                            readChunks = false;
                            break;
                        }

                        file.Position = oldPos + size;
                    }
                }
                catch (EndOfStreamException)
                {
                }
                catch (Exception e)
                {
                    Log.Error("Unable to load WMO group: " + e);
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        public bool Load()
        {
            using (var file = FileManager.Instance.Provider.OpenFile(mFileName))
            {
                if(file == null)
                {
                    Log.Error("Unable to load WMO group. File not found: " + mFileName);
                    return false;
                }

                var reader = new BinaryReader(file);
                var readChunks = true;
                try
                {
                    while (readChunks)
                    {
                        var signature = reader.ReadUInt32();
                        var size = reader.ReadInt32();

                        var oldPos = file.Position;
                        switch (signature)
                        {
                            case 0x4D4F4750:
                                mHeader = reader.Read<Mogp>();
                                IsIndoor = (mHeader.flags & 0x2000) != 0 && (mHeader.flags & 0x8) == 0;
                                if (!LoadGroupChunks(reader, size - SizeCache<Mogp>.Size))
                                    return false;

                                readChunks = false;
                                break;
                        }

                        file.Position = oldPos + size;
                    }
                }
                catch(EndOfStreamException)
                {

                }
                catch(Exception e)
                {
                    Log.Error("Unable to load WMO group: " + e);
                    return false;
                }
            }

            return true;
        }