public static MythicPackageBlock Read(BinaryReader reader, ref int found)
        {
            MythicPackageBlock block = new MythicPackageBlock();

            block.FileCount = reader.ReadInt32();
            block.NextBlock = reader.ReadInt64();

            int count = 0;
            int i;

            for (i = 0; i < block.FileCount; i++)
            {
                MythicPackageIndex index = MythicPackageIndex.Read(reader, ref count);

                if (index.DataBlockOffset == 0x0)
                {
                    continue;
                }

                index.Index = i;
                block.Add(index);
            }


            block.Complete = (count * 100) / (double)i;
            found         += count;

            return(block);
        }
		public MythicPackageIndex Add( MythicPackageIndex index )
		{
			if ( m_Files == null )
				m_Files = new List<MythicPackageIndex>();

			m_Files.Add( index );
			return index;
		}
        public MythicPackageIndex Add(MythicPackageIndex index)
        {
            if (m_Files == null)
            {
                m_Files = new List <MythicPackageIndex>();
            }

            m_Files.Add(index);
            return(index);
        }
Exemple #4
0
        public static MythicPackageIndex Read(BinaryReader reader, ref int found)
        {
            MythicPackageIndex index = new MythicPackageIndex();

            index.DataBlockOffset  = reader.ReadInt64();
            index.DataLength       = reader.ReadInt32();
            index.CompressedSize   = reader.ReadInt32();
            index.DecompressedSize = reader.ReadInt32();
            index.FileHash         = reader.ReadInt64();
            index.FileName         = HashDictionary.Get(index.FileHash);
            index.CRC = reader.ReadInt32();

            if (index.FileName != null)
            {
                found += 1;
            }

            short flag = reader.ReadInt16();

            switch (flag)
            {
            case 0x0: index.Compressed = false; break;

            case 0x1: index.Compressed = true; break;

            default: throw new Exception(String.Format("Invalid compressed flag: '{0}'!", flag));
            }

            if (index.DataBlockOffset != 0)
            {
                long position = reader.BaseStream.Position;
                reader.BaseStream.Seek(index.DataBlockOffset, SeekOrigin.Begin);
                index.DataBlock = MythicPackageData.Read(reader);
                reader.BaseStream.Seek(position, SeekOrigin.Begin);
            }

            return(index);
        }
Exemple #5
0
		public GuessFile( MythicPackageIndex file )
		{
			m_File = file;

			InitializeComponent();
		}
Exemple #6
0
		private void ChangeIndex( MythicPackageIndex idx )
		{
			FileFileNameInfo.Text = idx.FileName;
			FileHashInfo.Text = idx.FileHash.ToString( "X16" );
			FileUnknownInfo.Text = idx.CRC.ToString( "X8" );
			FileCompressedInfo.Text = ConvertSize( idx.CompressedSize );
			FileDecompressedInfo.Text = ConvertSize( idx.DecompressedSize );
			FileCompressed.Checked = idx.Compressed;

			FileFlagInfo.Text = idx.DataBlock.Flag.ToString( "X4" );
			FileDataOffsetInfo.Text = idx.DataBlock.DataOffset.ToString( "X4" );
			FileUnknown2Info.Text = idx.DataBlock.Unknown.ToString( "X16" );

			FileDetails.SelectedIndex = 2;			
		}
		public static MythicPackageIndex Read( BinaryReader reader, ref int found )
		{
			MythicPackageIndex index = new MythicPackageIndex();

			index.DataBlockOffset = reader.ReadInt64();
			index.DataLength = reader.ReadInt32();
			index.CompressedSize = reader.ReadInt32();
			index.DecompressedSize = reader.ReadInt32();
			index.FileHash = reader.ReadInt64();
			index.FileName = HashDictionary.Get( index.FileHash );			
			index.CRC = reader.ReadInt32();

			if ( index.FileName != null )
				found += 1;

			short flag = reader.ReadInt16();

			switch ( flag )
			{
				case 0x0: index.Compressed = false; break;
				case 0x1: index.Compressed = true; break;
				default: throw new Exception( String.Format( "Invalid compressed flag: '{0}'!", flag ) );
			}

			if ( index.DataBlockOffset != 0 )
			{
				long position = reader.BaseStream.Position;
				reader.BaseStream.Seek( index.DataBlockOffset, SeekOrigin.Begin );
				index.DataBlock = MythicPackageData.Read( reader );
				reader.BaseStream.Seek( position, SeekOrigin.Begin );
			}

			return index;
		}
		public UnpackArgs( MythicPackage p, MythicPackageBlock b, MythicPackageIndex idx )
		{
			m_Action = FILE;
			m_Package = p;
			m_Block = b;
			m_File = idx;
		}