Example #1
0
		private void ChangePackage( MythicPackage p )
		{
			PackageFullNameInfo.Text = p.Info.FullName;
			PackageAttributesInfo.Text = p.Info.Attributes.ToString();
			PackageCreationInfo.Text = p.Info.CreationTimeUtc.ToLocalTime().ToString();
			PackageSizeInfo.Text = ConvertSize( p.Info.Length );
			PackageCompleteInfo.Text = String.Format( "{0} %", p.Complete.ToString( "F2" ) );
			PackageVersionInfo.Text = p.Header.Version.ToString();
			PackageMiscInfo.Text = p.Header.Misc.ToString( "X8" );
			PackageHeaderSizeInfo.Text = ConvertSize( p.Header.HeaderSize );
			PackageBlockSizeInfo.Text = p.Header.BlockSize.ToString();
			PackageFileCountInfo.Text = p.Header.FileCount.ToString();
			
			FileDetails.SelectedIndex = 0;
		}
Example #2
0
		private void Worker_DoWork( object sender, DoWorkEventArgs e )
		{
			if ( e.Argument is DictionaryArgs )
			{
				DictionaryArgs args = (DictionaryArgs) e.Argument;

				if ( args.Load )
					HashDictionary.LoadDictionary( args.Name );
				else if ( args.Save )
					HashDictionary.SaveDictionary( args.Name );
				else if ( args.Merge )
					HashDictionary.MergeDictionary( args.Name );
			}
			else if ( e.Argument is MythicLoadArgs )
			{
				MythicLoadArgs args = (MythicLoadArgs) e.Argument;
				MythicPackage[] packs = new MythicPackage[ args.Names.Length ];

				for ( int i = 0; i < args.Names.Length; i ++ )
					packs[ i ] = MythicPackage.Read( args.Names[ i ] );

				args.Result = packs;
			}
			else if ( e.Argument is SpyProcessArgs )
			{
				SpyProcessArgs args = (SpyProcessArgs) e.Argument;

				m_Spy.Init( args.Process );
				m_Spy.MainLoop();
			}
			else if ( e.Argument is SpyPathArgs )
			{
				SpyPathArgs args = (SpyPathArgs) e.Argument;

				m_Spy.Init( args.Path );
				m_Spy.MainLoop();
			}
			else if ( e.Argument is UnpackArgs )
			{
				UnpackArgs args = (UnpackArgs) e.Argument;

				if ( args.IsPackage )
				{
					args.Package.Decompress( UnpackArgs.Path, args.Package.Info.Name );
				}
				else if ( args.IsBlock )
				{
					using ( FileStream stream = File.OpenRead( args.Package.Info.FullName ) )
					{
						using ( BinaryReader reader = new BinaryReader( stream ) )
							args.Block.Decompress( reader, UnpackArgs.Path, args.Package.Info.Name );
					}
				}
				else if ( args.IsFile )
				{
					using ( FileStream stream = File.OpenRead( args.Package.Info.FullName ) )
					{
						using ( BinaryReader reader = new BinaryReader( stream ) )
							args.File.Decompress( reader, UnpackArgs.Path, String.Format( "{0}_{1}", args.Package.Info.Name, args.Block.Index ) );
					}
				}
			}
			else if ( e.Argument is SearchArgs )
			{
				SearchArgs args = (SearchArgs) e.Argument;		
		
				args.Found = 0;

				for ( int i = args.From; i < args.To; i++ )
				{
					if ( SearchKeyword( String.Format( "{0}{1}{2}", args.Before, i.ToString( "D" + args.Length ), args.After ), true ) )
						args.Found += 1;
				}
			}
			
			e.Result = e.Argument;
		}
Example #3
0
		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;
                }
			}
		}
		public UnpackArgs( MythicPackage p, MythicPackageBlock b, MythicPackageIndex idx )
		{
			m_Action = FILE;
			m_Package = p;
			m_Block = b;
			m_File = idx;
		}
		public UnpackArgs( MythicPackage p, MythicPackageBlock b )
		{
			m_Action = BLOCK;
			m_Package = p;
			m_Block = b;
		}
		public UnpackArgs( MythicPackage p )
		{
			m_Action = PACKAGE;
			m_Package = p;
		}