예제 #1
0
        public BootList loadBootList(UInt32 id, int bitRecognized, MemoryStream memory1, BinaryReader reader)
        {
            reader.BaseStream.Position = 0;
            UInt16 Boots_id = 0;

            if (bitRecognized == 0)
            {
                for (int i = 0; i <= memory1.Length / block - 1; i++)
                {
                    if (id == reader.ReadUInt32())
                    {
                        Boots_id = reader.ReadUInt16();
                        BootList list = new BootList(id);
                        list.setBootId(Boots_id);
                        return(list);
                    }
                    else
                    {
                        reader.BaseStream.Position += 4;
                    }
                }
            }
            else if (bitRecognized == 1 || bitRecognized == 2)
            {
                for (int i = 0; i <= memory1.Length / block - 1; i++)
                {
                    if (id == UnzlibZlibConsole.swaps.swap32(reader.ReadUInt32()))
                    {
                        Boots_id = UnzlibZlibConsole.swaps.swap16(reader.ReadUInt16());
                        BootList list = new BootList(id);
                        list.setBootId(Boots_id);
                        return(list);
                    }
                    else
                    {
                        reader.BaseStream.Position += 4;
                    }
                }
            }

            return(null);
        }
예제 #2
0
 public void applyBootList(BinaryReader reader, int bitRecognized, MemoryStream unzlib, BootList boot, ref BinaryWriter writer)
 {
     reader.BaseStream.Position = 0;
     if (bitRecognized == 0)
     {
         for (int i = 0; (i <= ((unzlib.Length / block) - 1)); i++)
         {
             UInt32 Player_to_find = reader.ReadUInt32();
             if ((boot.getPlayerId() == Player_to_find))
             {
                 UInt16 Boot_to_save = boot.getBootId();
                 writer.Write(Boot_to_save);
                 break;
             }
             else
             {
                 writer.BaseStream.Position += 4;
             }
         }
     }
     else if (bitRecognized == 1 || bitRecognized == 2)
     {
         for (int i = 0; (i <= ((unzlib.Length / block) - 1)); i++)
         {
             UInt32 Player_to_find = UnzlibZlibConsole.swaps.swap32(reader.ReadUInt32());
             if ((boot.getPlayerId() == Player_to_find))
             {
                 UInt16 Boot_to_save = boot.getBootId();
                 writer.Write(UnzlibZlibConsole.swaps.swap16(Boot_to_save));
                 break;
             }
             else
             {
                 writer.BaseStream.Position += 4;
             }
         }
     }
     return;
 }