Exemplo n.º 1
0
        public BMG(byte[] file)
        {
            EndianBinaryReader er = new EndianBinaryReader((Stream) new MemoryStream(file), Endianness.LittleEndian);
            bool OK;

            this.Header = new BMG.BMGHeader(er, "MESGbmg1", out OK);
            if (!OK)
            {
                int num1 = (int)MessageBox.Show("Error 1");
            }
            else
            {
                this.INF1 = new BMG.INF1Section(er, out OK);
                if (!OK)
                {
                    int num2 = (int)MessageBox.Show("Error 2");
                }
                else
                {
                    this.DAT1 = new BMG.DAT1Section(er, this.INF1, out OK);
                    if (!OK)
                    {
                        int num3 = (int)MessageBox.Show("Error 3");
                    }
                }
            }
            er.ClearMarkers();
            er.Close();
        }
Exemplo n.º 2
0
            public DAT1Section(EndianBinaryReader er, BMG.INF1Section Offsets, out bool OK)
            {
                bool OK1;

                this.Header = new DataBlockHeader(er, "DAT1", out OK1);
                if (!OK1)
                {
                    OK = false;
                }
                else
                {
                    er.SetMarkerOnCurrentOffset("DAT1");
                    this.Strings = new string[(int)Offsets.NrOffset];
                    for (int index = 0; index < (int)Offsets.NrOffset; ++index)
                    {
                        er.BaseStream.Position = er.GetMarker("DAT1") + (long)Offsets.Offsets[index];
                        string str1 = "";
                        while (true)
                        {
                            char ch = er.ReadChar(Encoding.Unicode);
                            switch (ch)
                            {
                            case char.MinValue:
                                goto label_8;

                            case '\n':
                                str1 += "\r\n";
                                continue;

                            case '\x001A':
                                string str2  = str1 + "[#";
                                int    count = (int)er.ReadByte() - 2;
                                --er.BaseStream.Position;
                                str1 = str2 + BitConverter.ToString(er.ReadBytes(count)).Replace("-", "") + "]";
                                continue;

                            default:
                                str1 += (string)(object)ch;
                                continue;
                            }
                        }
label_8:
                        this.Strings[index] = str1;
                    }
                    while (er.BaseStream.Position % 4L != 0L)
                    {
                        int num = (int)er.ReadByte();
                    }
                    OK = true;
                }
            }