예제 #1
0
    /***
      Adivinha o formato de arquivo de acordo com seu conteúdo ou extensão
      Guess file type from its data content or extension
      ***/
    FILETYPE FileFormat::GuessType(QFile *fp)
    {
        for ( int tryes=0; tryes<2; tryes++ )
        {
            if ( (!tryes && (fp->fileName().endsWith( ".cbr", Qt::CaseInsensitive ) || fp->fileName().endsWith( ".rar", Qt::CaseInsensitive )) ) || tryes )
            {
                if ( IsRar(fp) )
                    return TYPE_RAR;
                fp->seek(0);
            }
            if ( ( !tryes && (fp->fileName().endsWith( ".cbz", Qt::CaseInsensitive ) || fp->fileName().endsWith( ".zip", Qt::CaseInsensitive )) ) || tryes )
            {
                if ( IsZip(fp) )
                    return TYPE_ZIP;
                fp->seek(0);
            }
            if ( ( !tryes && (fp->fileName().endsWith( ".pdf", Qt::CaseInsensitive ))) || tryes )
            {
                if ( IsPdf(fp) )
                    return TYPE_PDF;
                fp->seek(0);
            }

            //Para imagem levar em consideração apenas a extensão
            if (  ( !tryes && (fp->fileName().endsWith( ".png", Qt::CaseInsensitive ) || fp->fileName().endsWith( ".gif", Qt::CaseInsensitive ) || fp->fileName().endsWith( ".jpg", Qt::CaseInsensitive )) ) )
                return TYPE_IMG;

            //File with wrong Extension
        }

        return TYPE_UNKNOWN;
    }
예제 #2
0
파일: mime.cpp 프로젝트: billfm/billfm
int IsArchve(const char * fullname)
{
	if(IsTar(fullname)) return 1;
	if(IsZip(fullname)) return 1;
	if(IsRar(fullname)) return 1;
	if(IsDeb(fullname)) return 1;	
	return 0;
}
예제 #3
0
already_AddRefed<nsIFile>
FileLocation::GetBaseFile()
{
  if (IsZip() && mBaseZip) {
    nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
    if (handler)
      return handler->mFile.GetBaseFile();
    return NULL;
  }

  nsCOMPtr<nsIFile> file = mBaseFile;
  return file.forget();
}
예제 #4
0
void
FileLocation::GetURIString(nsACString &result) const
{
  if (mBaseFile) {
    net_GetURLSpecFromActualFile(mBaseFile, result);
  } else if (mBaseZip) {
    nsRefPtr<nsZipHandle> handler = mBaseZip->GetFD();
    handler->mFile.GetURIString(result);
  }
  if (IsZip()) {
    result.Insert("jar:", 0);
    result += "!/";
    result += mPath;
  }
}
예제 #5
0
nsresult
FileLocation::GetData(Data &data)
{
  if (!IsZip()) {
    return mBaseFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &data.mFd.rwget());
  }
  data.mZip = mBaseZip;
  if (!data.mZip) {
    data.mZip = new nsZipArchive();
    data.mZip->OpenArchive(mBaseFile);
  }
  data.mItem = data.mZip->GetItem(mPath.get());
  if (data.mItem)
    return NS_OK;
  return NS_ERROR_FILE_UNRECOGNIZED_PATH;
}
예제 #6
0
CSystem::CSystem(char* gamefile,char* romfile)
	:mCart(NULL),
	mRom(NULL),
	mMemMap(NULL),
	mRam(NULL),
	mCpu(NULL),
	mMikie(NULL),
	mSusie(NULL)
{

#ifdef _LYNXDBG
	mpDebugCallback=NULL;
	mDebugCallbackObject=0;
#endif

	// Select the default filetype
	UBYTE *filememory=NULL;
	UBYTE *howardmemory=NULL;
	ULONG filesize=0;
	ULONG howardsize=0;

	mFileType=HANDY_FILETYPE_LNX;
	if(strcmp(gamefile,"")==0)
	{
		// No file
		filesize=0;
		filememory=NULL;
	}
	else if(IsZip(gamefile))
	{
		// Try and find a file in the zip
		unzFile *fp;
		unz_file_info info;
		char filename_buf[0x100], *ptr;
		bool gotIt;
		
		if((fp=(unzFile*)unzOpen(gamefile))!=NULL)
		{
			if(unzGoToFirstFile(fp)!=UNZ_OK)
			{
				unzClose(fp);
				CLynxException lynxerr;
				lynxerr.Message() << "Handy Error: ZIP File select problems" ;
				lynxerr.Description()
					<< "The file you selected could not be read." << endl
					<< "(The ZIP file may be corrupted)." << endl ;
				throw(lynxerr);
			}
			
			gotIt = FALSE;
			for (;;)
			{
				// Get file descriptor and analyse
				if(unzGetCurrentFileInfo(fp, &info, filename_buf, 0x100, NULL, 0, NULL, 0) != UNZ_OK)
				{
					break;
				}
				else
				{
					ptr = strchr(filename_buf, '.');
					if (ptr != NULL)
					{
						char buf[4];
					
						ptr++; buf[0] = tolower(*ptr);
						ptr++; buf[1] = tolower(*ptr);
						ptr++; buf[2] = tolower(*ptr);
						buf[3] = 0;
						if (!strcmp(buf, "lnx") || !strcmp(buf, "com") || !strcmp(buf, "o"))
						{
							// Found a likely file so signal
							gotIt = TRUE;
							break;
						}
					}

					// No match so lets try the next file
					if(unzGoToNextFile(fp)!=UNZ_OK)	break;
				}
			}
			
			// Did we strike gold ?
			if(gotIt)
			{
				if(unzOpenCurrentFile(fp)==UNZ_OK)
				{
					// Allocate memory for the rom
					filesize=info.uncompressed_size;
					filememory=(UBYTE*) new UBYTE[filesize];

					// Read it into memory					
					if(unzReadCurrentFile(fp,filememory,filesize)!=(int)info.uncompressed_size)
					{
						unzCloseCurrentFile(fp);
						unzClose(fp);
						delete filememory;
						// Throw a wobbly
						CLynxException lynxerr;
						lynxerr.Message() << "Handy Error: ZIP File load problems" ;
						lynxerr.Description()
							<< "The zip file you selected could not be loaded." << endl
							<< "(The ZIP file may be corrupted)." << endl ;
						throw(lynxerr);
					}

					// Got it!
					unzCloseCurrentFile(fp);
					unzClose(fp);
				}
				
			}
			else
			{
				CLynxException lynxerr;
				lynxerr.Message() << "Handy Error: ZIP File load problems" ;
				lynxerr.Description()
					<< "The file you selected could not be loaded." << endl
					<< "Could not find a Lynx file in the ZIP archive." << endl ;
				throw(lynxerr);
			}
		}
		else
		{
			CLynxException lynxerr;
			lynxerr.Message() << "Handy Error: ZIP File open problems" ;
			lynxerr.Description()
				<< "The file you selected could not be opened." << endl
				<< "(The ZIP file may be corrupted)." << endl ;
			throw(lynxerr);
		}
	}
	else
	{
		// Open the file and load the file
		FILE	*fp;

		// Open the cartridge file for reading
		if((fp=fopen(gamefile,"rb"))==NULL)
		{
			CLynxException lynxerr;

			lynxerr.Message() << "Handy Error: File Open Error";
			lynxerr.Description()
				<< "The lynx emulator will not run without a cartridge image." << endl
				<< "\"" << gamefile << "\" was not found in the place you " << endl
				<< "specified. (see the Handy User Guide for more information).";
			throw(lynxerr);
		}

		// How big is the file ??
		fseek(fp,0,SEEK_END);
		filesize=ftell(fp);
		fseek(fp,0,SEEK_SET);
		filememory=(UBYTE*) new UBYTE[filesize];

		if(fread(filememory,sizeof(char),filesize,fp)!=filesize)
		{
			CLynxException lynxerr;
			delete filememory;

			lynxerr.Message() << "Handy Error: Unspecified Load error (Header)";
			lynxerr.Description()
				<< "The lynx emulator will not run without a cartridge image." << endl
				<< "It appears that your cartridge image may be corrupted or there is" << endl
				<< "some other error.(see the Handy User Guide for more information)";
			throw(lynxerr);
		}

		fclose(fp);
	}

	// Now try and determine the filetype we have opened
	if(filesize)
	{
		char clip[11];
		memcpy(clip,filememory,11);
		clip[4]=0;
		clip[10]=0;

		if(!strcmp(&clip[6],"BS93")) mFileType=HANDY_FILETYPE_HOMEBREW;
		else if(!strcmp(&clip[0],"LYNX")) mFileType=HANDY_FILETYPE_LNX;
		else if(!strcmp(&clip[0],LSS_VERSION_OLD)) mFileType=HANDY_FILETYPE_SNAPSHOT;
		else
		{
			CLynxException lynxerr;
			delete filememory;
			mFileType=HANDY_FILETYPE_ILLEGAL;
			lynxerr.Message() << "Handy Error: File format invalid!";
			lynxerr.Description()
				<< "The image you selected was not a recognised game cartridge format." << endl
				<< "(see the Handy User Guide for more information).";
			throw(lynxerr);
		}
	}
	
	mCycleCountBreakpoint=0xffffffff;

// Create the system objects that we'll use

	// Attempt to load the cartridge errors caught above here...

	mRom = new CRom(romfile);

	// An exception from this will be caught by the level above

	switch(mFileType)
	{
		case HANDY_FILETYPE_LNX:
			mCart = new CCart(filememory,filesize);
			if(mCart->CartHeaderLess())
			{
				FILE	*fp;
				char drive[3],dir[256],cartgo[256];
				mFileType=HANDY_FILETYPE_HOMEBREW;
				_splitpath(romfile,drive,dir,NULL,NULL);
				strcpy(cartgo,drive);
				strcat(cartgo,dir);
				strcat(cartgo,"howard.o");

				// Open the howard file for reading
				if((fp=fopen(cartgo,"rb"))==NULL)
				{
					CLynxException lynxerr;
					delete filememory;
					lynxerr.Message() << "Handy Error: Howard.o File Open Error";
					lynxerr.Description()
						<< "Headerless cartridges need howard.o bootfile to ." << endl
						<< "be able to run correctly, could not open file. " << endl;
					throw(lynxerr);
				}

				// How big is the file ??
				fseek(fp,0,SEEK_END);
				howardsize=ftell(fp);
				fseek(fp,0,SEEK_SET);
				howardmemory=(UBYTE*) new UBYTE[filesize];

				if(fread(howardmemory,sizeof(char),howardsize,fp)!=howardsize)
				{
					CLynxException lynxerr;
					delete filememory;
					delete howardmemory;
					lynxerr.Message() << "Handy Error: Howard.o load error (Header)";
					lynxerr.Description()
						<< "Howard.o could not be read????." << endl;
					throw(lynxerr);
				}

				fclose(fp);

				// Pass it to RAM to load
				mRam = new CRam(howardmemory,howardsize);
			}
			else
			{
				mRam = new CRam(0,0);
			}
			break;
		case HANDY_FILETYPE_HOMEBREW:
			mCart = new CCart(0,0);
			mRam = new CRam(filememory,filesize);
			break;
		case HANDY_FILETYPE_SNAPSHOT:
		case HANDY_FILETYPE_ILLEGAL:
		default:
			mCart = new CCart(0,0);
			mRam = new CRam(0,0);
			break;
	}

	// These can generate exceptions

	mMikie = new CMikie(*this);
	mSusie = new CSusie(*this);

// Instantiate the memory map handler

	mMemMap = new CMemMap(*this);

// Now the handlers are set we can instantiate the CPU as is will use handlers on reset

	mCpu = new C65C02(*this);

// Now init is complete do a reset, this will cause many things to be reset twice
// but what the hell, who cares, I don't.....

	Reset();

// If this is a snapshot type then restore the context

	if(mFileType==HANDY_FILETYPE_SNAPSHOT)
	{
		if(!ContextLoad(gamefile))
		{
			Reset();
			CLynxException lynxerr;
			lynxerr.Message() << "Handy Error: Snapshot load error" ;
			lynxerr.Description()
				<< "The snapshot you selected could not be loaded." << endl
				<< "(The file format was not recognised by Handy)." << endl ;
			throw(lynxerr);
		}
	}
	if(filesize) delete filememory;
	if(howardsize) delete howardmemory;
}
예제 #7
0
bool CSystem::ContextLoad(char *context)
{
	LSS_FILE *fp;
	bool status=1;
	UBYTE *filememory=NULL;
	ULONG filesize=0;

	// First check for ZIP file
	if(IsZip(context))
	{
		// Find the file and read into memory
		// Try and find a file in the zip
		unzFile *fp;
		unz_file_info info;
		char filename_buf[0x100], *ptr;
		bool gotIt;
		
		if((fp=(unzFile*)unzOpen(context))!=NULL)
		{
			if(unzGoToFirstFile(fp)!=UNZ_OK)
			{
				unzClose(fp);
				gError->Warning("ContextLoad(): ZIP File select problems, could not read zip file");
				return 1;
			}
			
			gotIt = FALSE;
			for (;;)
			{
				// Get file descriptor and analyse
				if(unzGetCurrentFileInfo(fp, &info, filename_buf, 0x100, NULL, 0, NULL, 0) != UNZ_OK)
				{
					break;
				}
				else
				{
					ptr = strchr(filename_buf, '.');
					if (ptr != NULL)
					{
						char buf[4];
					
						ptr++; buf[0] = tolower(*ptr);
						ptr++; buf[1] = tolower(*ptr);
						ptr++; buf[2] = tolower(*ptr);
						buf[3] = 0;
						if (!strcmp(buf, "lss"))
						{
							// Found a likely file so signal
							gotIt = TRUE;
							break;
						}
					}

					// No match so lets try the next file
					if(unzGoToNextFile(fp)!=UNZ_OK)	break;
				}
			}
			
			// Did we strike gold ?
			if(gotIt)
			{
				if(unzOpenCurrentFile(fp)==UNZ_OK)
				{
					// Allocate memory for the rom
					filesize=info.uncompressed_size;
					filememory=(UBYTE*) new UBYTE[filesize];

					// Read it into memory					
					if(unzReadCurrentFile(fp,filememory,filesize)!=(int)info.uncompressed_size)
					{
						unzCloseCurrentFile(fp);
						unzClose(fp);
						delete filememory;
						// Throw a wobbly
						gError->Warning("ContextLoad(): ZIP File load problems, could not read data from the zip file");
						return 1;
					}

					// Got it!
					unzCloseCurrentFile(fp);
					unzClose(fp);
				}
				
			}
			else
			{
				gError->Warning("ContextLoad(): ZIP File load problems, could not find an LSS file in the zip archive");
				return 1;
			}
		}
		else
		{
			gError->Warning("ContextLoad(): ZIP File load problems, could not open the zip archive");
			return 1;
		}

	}
	else
	{
		FILE *fp;
		// Just open an read into memory
		if((fp=fopen(context,"rb"))==NULL) status=0;

		fseek(fp,0,SEEK_END);
		filesize=ftell(fp);
		fseek(fp,0,SEEK_SET);
		filememory=(UBYTE*) new UBYTE[filesize];

		if(fread(filememory,sizeof(char),filesize,fp)!=filesize)
		{
			fclose(fp);
			return 1;
		}
		fclose(fp);
	}

	// Setup our read structure
	fp = new LSS_FILE;
	fp->memptr=filememory;
	fp->index=0;
	fp->index_limit=filesize;

	char teststr[100];
	// Check identifier
	if(!lss_read(teststr,sizeof(char),4,fp)) status=0;
	teststr[4]=0;

	if(strcmp(teststr,LSS_VERSION)==0 || strcmp(teststr,LSS_VERSION_OLD)==0)
	{
		bool legacy=FALSE;
		if(strcmp(teststr,LSS_VERSION_OLD)==0)
		{
			legacy=TRUE;
		}
		else
		{
			ULONG checksum;
			// Read CRC32 and check against the CART for a match
			lss_read(&checksum,sizeof(ULONG),1,fp);
			if(mCart->CRC32()!=checksum)
			{
				delete fp;
				delete filememory;
				gError->Warning("LSS Snapshot CRC does not match the loaded cartridge image, aborting load");
				return 0;
			}
		}

		// Check our block header
		if(!lss_read(teststr,sizeof(char),20,fp)) status=0;
		teststr[20]=0;
		if(strcmp(teststr,"CSystem::ContextSave")!=0) status=0;

		if(!lss_read(&mCycleCountBreakpoint,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemCycleCount,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gNextTimerEvent,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gCPUWakeupTime,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gCPUBootAddress,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gIRQEntryCycle,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gBreakpointHit,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSingleStepMode,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemIRQ,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemNMI,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemCPUSleep,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemCPUSleep_Saved,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gSystemHalt,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gThrottleMaxPercentage,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gThrottleLastTimerCount,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gThrottleNextCycleCheckpoint,sizeof(ULONG),1,fp)) status=0;

		ULONG tmp;
		if(!lss_read(&tmp,sizeof(ULONG),1,fp)) status=0;
		gTimerCount=tmp;

		if(!lss_read(gAudioBuffer,sizeof(UBYTE),HANDY_AUDIO_BUFFER_SIZE,fp)) status=0;
		if(!lss_read(&gAudioBufferPointer,sizeof(ULONG),1,fp)) status=0;
		if(!lss_read(&gAudioLastUpdateCycle,sizeof(ULONG),1,fp)) status=0;

		if(!mMemMap->ContextLoad(fp)) status=0;
		// Legacy support
		if(legacy)
		{
			if(!mCart->ContextLoadLegacy(fp)) status=0;
			if(!mRom->ContextLoad(fp)) status=0;
		}
		else
		{
			if(!mCart->ContextLoad(fp)) status=0;
		}
		if(!mRam->ContextLoad(fp)) status=0;
		if(!mMikie->ContextLoad(fp)) status=0;
		if(!mSusie->ContextLoad(fp)) status=0;
		if(!mCpu->ContextLoad(fp)) status=0;
	}
	else
	{
		gError->Warning("Not a recognised LSS file");
	}

	delete fp;
	delete filememory;

	return status;
}
예제 #8
0
파일: on_button.cpp 프로젝트: billfm/billfm
gchar * Untar(const char * name,const char * destdir)
{
	ClassString archve = GetArchivePath();

	const char mes[]="Не в архиве ";

	if(strncmp(name,archve.s,strlen(archve.s)))
	{
		printf("%s '%s' \n",mes,name);
		return 0;
	}

	struct stat file_stat;
	if(!lstat(name, &file_stat))
	{	
		if(S_ISLNK(file_stat.st_mode))
		{
			return  g_strdup(name);
		}	
	}

	ClassString zip=g_strdup(&name[strlen(archve.s)]);
	ClassString inzip=g_strdup(zip.s);
			
	int inside=0;
	if(lstat(zip.s, &file_stat))
	{	
		inside=1;
		while(lstat(zip.s, &file_stat))
		{
			zip=g_path_get_dirname(zip.s);
		}
		inzip=g_strdup(&inzip.s[strlen(zip.s)+1]);
	} else
	{	
		printf("%s\n%s",mes,name);
		return 0;
	}	

	ClassString	cache=g_build_filename(PATH_CACHE_ARCHIVE,zip.s,NULL);
	CreateDirInDir(cache.s);


	ClassString com;
	const char * unpack_dir;
	if(!destdir) unpack_dir=cache.s;  else unpack_dir=destdir;

	if(IsTar(zip.s))
	{	
//        ClassString base=g_path_get_dirname(inzip.s);
//		printf("`%s` base `%s`",inzip.s,base.s);
//		if(!strcmp(base.s,"."))
//		{
//			com=g_strdup_printf("cd '%s'; tar -x --file='%s' './%s'", unpack_dir,zip.s,inzip.s);
//		}	else 
		com=g_strdup_printf("cd '%s'; tar -x --file='%s' '%s'", unpack_dir,zip.s,inzip.s);
		Execute(com.s);
	}	else

	if(IsDeb(zip.s))
	{	
		com=g_strdup_printf("cd '%s'; ar x '%s' '%s'", unpack_dir,zip.s,inzip.s);
		Execute(com.s);
	}	else
		
	if(IsZip(zip.s))
	{	
		
		if(!lstat(name, &file_stat))
		{	
			if(S_ISDIR(file_stat.st_mode) ) 
				com=g_strdup_printf("cd '%s'; unzip -o '%s' '%s/*'", unpack_dir, zip.s, inzip.s);
			else com=g_strdup_printf("cd '%s'; unzip -o '%s' '%s'", unpack_dir, zip.s, inzip.s);
		}
		Execute(com.s);
		
	}	else
	if(IsRar(zip.s))
	{	
		if(inzip.s[0]=='*')
		{
			ClassString password=InputPassword();
			printf("Треба пассворд <%s>\n",password.s);
			com=g_strdup_printf("cd '%s'; unrar -p'%s' x '%s' '%s'", 
			                    unpack_dir,password.s,zip.s,&inzip.s[1]);
			printf("%s\n",com.s);
		} 	else com=g_strdup_printf("cd '%s'; unrar -p- x '%s' '%s'", unpack_dir,zip.s,inzip.s);			
		Execute(com.s);
	}	else return 0;
	
	cache=g_build_filename(unpack_dir,inzip.s,NULL);
	if(!destdir)
	{	
		if(!lstat(cache.s, &file_stat))
		{	
			unlink(name);
			symlink(cache.s,name);
			return g_strdup(name);
		} else printf("file not create - '%s'\n",cache.s);
	}	
	return g_strdup(cache.s);
}
예제 #9
0
파일: copy-gets.cpp 프로젝트: billfm/billfm
int main( int    argc, char **argv )
{
 app_path=g_path_get_dirname(argv[0]);
 int operation=TASK_COPY;
 gtk_init( &argc, &argv );
 
 ClassString uid=g_strdup_printf("%d",geteuid());
 InitListDisk(g_get_home_dir(),uid.s);


 f=fopen("/tmp/billfm.txt","rt"); 
 if(!f)
 {
  printf("Not open file /tmp/billfm.txt !\n");
  exit(0);
 }

 NexString();

 if(!strcmp(buffer,"MOVE"))
 {
   operation=TASK_MOVE;
 } else 
 if(!strcmp(buffer,"COPY"))
 {
   operation=TASK_COPY;
 } else 
 if(!strcmp(buffer,"CREATE_DIR"))
 {
   operation=TASK_CREATE_DIR;
 } else 
 if(!strcmp(buffer,"CLEAR_TRASH"))
 {
   operation=TASK_CLEAR_TRASH;
 } else 
 if(!strcmp(buffer,"FIND"))
 {
   operation=TASK_FIND;
 } else 
 if(!strcmp(buffer,"SMB_MOUNT"))
 {
   operation=TASK_SMB_MOUNT;
 } else 
 if(!strcmp(buffer,"READ_TAR"))
 {
   operation=TASK_READ_TAR;
 } else 
 {
  printf("Operation unknow\n");
  exit(0);
 }

 NexString();
 DestDir=g_strdup(buffer);
// printf("dest %s\n",PanelGetDestDir());

	const char * dest_dir=PanelGetDestDir();
	if(operation==TASK_COPY)
	{
		LoadList();
		DialogCopy(operation, dest_dir,list_source); 
	} else
	if(operation==TASK_MOVE)
	{
		LoadList();
		DialogCopy(operation, dest_dir,list_source); 
	} else
	if(operation==TASK_CREATE_DIR)
	{
		CreateNewDirDialog(dest_dir);
	} else
	if(operation==TASK_CLEAR_TRASH)
	{
		NexString();
		const char * homedir =g_strdup(buffer);
		NexString();
		const char * uid =g_strdup(buffer);
		InitListDisk(homedir,uid);
		UtilsClearTrash();
	} else
	if(operation==TASK_FIND)
	{
		NexString();
		const char * mask =g_strdup(buffer);
		NexString();
		const char * text =g_strdup(buffer);
		NexString();
		const char * mode =g_strdup(buffer);
		LoadSearch(mask,text,DestDir,mode);
	} else
	if(operation==TASK_SMB_MOUNT)
	{
		NexString();
		const char * source =g_strdup(buffer);
		NexString();
		const char * opt =g_strdup(buffer);
		if(!strcmp(opt,"rw")) opt=rw_opt; else opt=ro_opt;
		ClassString com=g_strdup_printf("mount -t cifs \"%s\" \"%s\" -o %s", source,DestDir,opt);
		printf("%s\n",com.s);
		system(com.s);
	} else
	if(operation==TASK_READ_TAR)
	{
		chdir(DestDir);
		NexString();
		SourceTar =g_strdup(buffer);
		ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
		if(IsTar(SourceTar))
		{
			ClassString com=g_strdup_printf("tar -tvf '%s' > .dir.lst",SourceTar);
			system(com.s); 
			LoadGets(outfile.s,PrintTar);
		} else
		if(IsZip(SourceTar))
		{
			ClassString com=g_strdup_printf("unzip -l  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			LoadGets(outfile.s,PrintZip);
		}
		if(IsRar(SourceTar))
		{
			ClassString com=g_strdup_printf("unrar vt  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			RarPassword=0;
			LoadGets(outfile.s,PrintRar);
		}

		if(IsDeb(SourceTar))
		{
			ClassString com=g_strdup_printf("ar vt  '%s' > .dir.lst",SourceTar);
			system(com.s); 
			ClassString outfile=g_build_filename(DestDir,".dir.lst",NULL);
			CountReadStrings=0;
			RarPassword=0;
			LoadGets(outfile.s,PrintDeb);
		}

	}
 fclose(f);
}