Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Callbacks and Timers » how to do to stop progress zip file ?
how to do to stop progress zip file ? [message #57076] Fri, 21 May 2021 01:59 Go to next message
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member

HI,

when i produce the code, how to do to stop progress writing zip file ?

Thanks!


#include <plugin/zip/zip.h>
using namespace Upp;

Gate2<int, int> WhenProgress; //tipo definido
int fx(int a,int b){
  float f= static_cast<double>(a) / b * 100;
  Cout() <<"avaliando " << a << " " << b << " % " << Format("%.1f%%", f ) << EOL;
  return WhenProgress(a,b); 
}
  		
CONSOLE_APP_MAIN   
{
        FileZip zip("c:\\tempFolder\\compress.zip");  
	FindFile fff("C:\\Users\\myFolder\\Videos\\file.mp4");
	while(fff) {
	       if(fff.IsFile()) {
                   String s=fff.GetPath();//+fff.GetName();
                   Cout()<< "indo/going " << s << EOL;				
		   zip.WriteFile(LoadFile(s), fff.GetName(),fx); 
			}
		fff.Next();
	}
	zip.Finish();

   Cout() << "ended!" << EOL;
   
}

Re: how to do to stop progress zip file ? [message #57079 is a reply to message #57076] Fri, 21 May 2021 09:31 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello BetoValle,

You don't have to call WhenProgress. Your fx() function IS the WhenProgress callback:

bool fx(int a,int b){                                                                  <- Gate variants should return boolean value, not integer.
  float f= static_cast<double>(a) / b * 100;
  Cout() <<"avaliando " << a << " " << b << " % " << Format("%.1f%%", f ) << EOL;
  return boolean_condition;                                                           // <---- boolean_condition is up to you to define. If it is true, it will stop progressing. If false (default) it will continue the progress. 
}



Best regards,
Obilvion


[Updated on: Fri, 21 May 2021 10:12]

Report message to a moderator

Re: how to do to stop progress zip file ? [message #57081 is a reply to message #57079] Fri, 21 May 2021 14:24 Go to previous message
BetoValle is currently offline  BetoValle
Messages: 203
Registered: September 2020
Location: Brasil Valinhos SP
Experienced Member
Tks Oblivion!

(until he saw his answer, he had tested it with the return of "Null" which apparently worked!)
Previous Topic: Setting a timer to call Ctrl::Refresh in Ctrl::Paint()
Next Topic: TimerCallBack interval resolution
Goto Forum:
  


Current Time: Sun Jun 16 19:54:46 CEST 2024

Total time taken to generate the page: 0.02266 seconds