Exemplo n.º 1
0
        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 static MythicPackage Read(string fileName)
        {
            using (FileStream stream = new FileStream(fileName, FileMode.Open))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    MythicPackage myp = new MythicPackage();

                    int found = 0;
                    int index = 0;

                    myp.Info   = new FileInfo(fileName);
                    myp.Header = MythicPackageHeader.Read(reader);

                    MythicPackageBlock block = myp.Add(MythicPackageBlock.Read(reader, ref found));
                    block.Index = 0;

                    while (stream.Seek(block.NextBlock, SeekOrigin.Begin) != 0)
                    {
                        block       = myp.Add(MythicPackageBlock.Read(reader, ref found));
                        block.Index = index + 1;
                        index      += 1;
                    }

                    myp.Complete = (found * 100) / (double)myp.Header.FileCount;

                    return(myp);
                }
            }
        }
Exemplo n.º 3
0
		public MythicPackageBlock Add( MythicPackageBlock block )
		{
			if ( m_Blocks == null )
				m_Blocks = new List<MythicPackageBlock>();

			m_Blocks.Add( block );
			return block;
		}
        public MythicPackageBlock Add(MythicPackageBlock block)
        {
            if (m_Blocks == null)
            {
                m_Blocks = new List <MythicPackageBlock>();
            }

            m_Blocks.Add(block);
            return(block);
        }
Exemplo n.º 5
0
		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;
		}
Exemplo n.º 6
0
		private void ChangeBlock( MythicPackageBlock b )
		{
			BlockFileCountInfo.Text = b.FileCount.ToString();
			BlockNextBlockInfo.Text = b.NextBlock.ToString( "X16" );
			BlockCompleteInfo.Text = String.Format( "{0} %", b.Complete.ToString( "F2" ) );

			ListBox.Items.Clear();
			ListBox.Items.AddRange( b.Files.ToArray() );

			FileDetails.SelectedIndex = 1;			
		}
Exemplo n.º 7
0
		public UnpackArgs( MythicPackage p, MythicPackageBlock b, MythicPackageIndex idx )
		{
			m_Action = FILE;
			m_Package = p;
			m_Block = b;
			m_File = idx;
		}
Exemplo n.º 8
0
		public UnpackArgs( MythicPackage p, MythicPackageBlock b )
		{
			m_Action = BLOCK;
			m_Package = p;
			m_Block = b;
		}