ba1500.cpp Gestione del nome del produttore del software
ba1500a.* Aggiornata maschera per gestire produttore ba1600.cpp Aggiunta 'marcatura' degli exe con anno e versione ba1600.h Aggiunto metodo version_info ba1700.cpp Tolta richiesta di conferma su installazione git-svn-id: svn://10.65.10.50/trunk@6043 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									c09ac8f7a7
								
							
						
					
					
						commit
						02858f2975
					
				@ -46,7 +46,7 @@ void TDongle::garble(word k[4]) const
 | 
				
			|||||||
  HL_OFF(_port);
 | 
					  HL_OFF(_port);
 | 
				
			||||||
  INT_ON();
 | 
					  INT_ON();
 | 
				
			||||||
#else                 
 | 
					#else                 
 | 
				
			||||||
  HL_CODE(EYECAST k, 1);
 | 
					  HL_CODE(EYECAST k, 1); // HLBLOCK = 1
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // _DEMO_
 | 
					#endif  // _DEMO_
 | 
				
			||||||
@ -133,7 +133,7 @@ bool TDongle::login(bool test_all_keys)
 | 
				
			|||||||
      if (data[0] == 0x3283) // chiave programmatori !!
 | 
					      if (data[0] == 0x3283) // chiave programmatori !!
 | 
				
			||||||
      {         
 | 
					      {         
 | 
				
			||||||
#ifdef DBG    
 | 
					#ifdef DBG    
 | 
				
			||||||
//        _type = _aga_key; // eliminato perché giudicato troppo pericoloso
 | 
					        _type = _aga_key; // eliminato perché giudicato troppo pericoloso
 | 
				
			||||||
                            // se la DBG version arriva nelle mani di qualcuno
 | 
					                            // se la DBG version arriva nelle mani di qualcuno
 | 
				
			||||||
                            // ci inchiappetta tutti i programmi senza darci una lira!
 | 
					                            // ci inchiappetta tutti i programmi senza darci una lira!
 | 
				
			||||||
                            
 | 
					                            
 | 
				
			||||||
@ -532,6 +532,7 @@ protected:
 | 
				
			|||||||
  static bool assist_handler(TMask_field& fld, KEY key);
 | 
					  static bool assist_handler(TMask_field& fld, KEY key);
 | 
				
			||||||
  static bool print_handler(TMask_field& fld, KEY key);
 | 
					  static bool print_handler(TMask_field& fld, KEY key);
 | 
				
			||||||
  static bool aggiorna_listino_handler(TMask_field& fld, KEY key);
 | 
					  static bool aggiorna_listino_handler(TMask_field& fld, KEY key);
 | 
				
			||||||
 | 
					  static bool aga_handler(TMask_field& fld, KEY key);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  void print_request();  
 | 
					  void print_request();  
 | 
				
			||||||
@ -846,6 +847,24 @@ bool TAttivazione_moduli::print_handler(TMask_field& fld, KEY key)
 | 
				
			|||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TAttivazione_moduli::aga_handler(TMask_field& fld, KEY key)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  if (key == K_SPACE)        
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TMask mask("Produttore", 1, 54, 5);
 | 
				
			||||||
 | 
					    mask.add_string(DLG_USER, 0, "", 1, 1, 50);
 | 
				
			||||||
 | 
					    mask.add_button(DLG_OK, 0, "", -12, -1, 10, 2);
 | 
				
			||||||
 | 
					    mask.add_button(DLG_CANCEL, 0, "", -22, -1, 10, 2);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    TConfig ini("install.ini", "Main");
 | 
				
			||||||
 | 
					    mask.set(DLG_USER, ::decode(ini.get("Producer")));
 | 
				
			||||||
 | 
					    if (mask.run() == K_ENTER)
 | 
				
			||||||
 | 
					      ini.set("Producer", ::encode(mask.get(DLG_USER)));
 | 
				
			||||||
 | 
					  }  
 | 
				
			||||||
 | 
					  return TRUE;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TAttivazione_moduli::generate_key()
 | 
					void TAttivazione_moduli::generate_key()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  word ud[4];
 | 
					  word ud[4];
 | 
				
			||||||
@ -1315,6 +1334,11 @@ bool TAttivazione_moduli::create()
 | 
				
			|||||||
  _msk->set_handler(F_CHANGEUSERS, change_users_handler);
 | 
					  _msk->set_handler(F_CHANGEUSERS, change_users_handler);
 | 
				
			||||||
  _msk->set_handler(F_CHANGEASSIST, change_assist_handler);
 | 
					  _msk->set_handler(F_CHANGEASSIST, change_assist_handler);
 | 
				
			||||||
  _msk->set_handler(F_PRINT, print_handler);
 | 
					  _msk->set_handler(F_PRINT, print_handler);
 | 
				
			||||||
 | 
					  if (_dongle.type() == TDongle::_aga_key)
 | 
				
			||||||
 | 
					  {                                  
 | 
				
			||||||
 | 
					    _msk->show(F_AGA);
 | 
				
			||||||
 | 
					    _msk->set_handler(F_AGA, aga_handler);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TSheet_field& sf = _msk->sfield(F_MODULI);
 | 
					  TSheet_field& sf = _msk->sfield(F_MODULI);
 | 
				
			||||||
  sf.set_notify(k_notify);
 | 
					  sf.set_notify(k_notify);
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@
 | 
				
			|||||||
#define F_ASSIST       216
 | 
					#define F_ASSIST       216
 | 
				
			||||||
#define F_CHANGEASSIST 217
 | 
					#define F_CHANGEASSIST 217
 | 
				
			||||||
#define F_PRINT        218
 | 
					#define F_PRINT        218
 | 
				
			||||||
 | 
					#define F_AGA          219
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define F_NOMEMOD 101
 | 
					#define F_NOMEMOD 101
 | 
				
			||||||
#define F_ENABLE  102
 | 
					#define F_ENABLE  102
 | 
				
			||||||
 | 
				
			|||||||
@ -79,6 +79,12 @@ BEGIN
 | 
				
			|||||||
  FLAGS "U"
 | 
					  FLAGS "U"
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BUTTON F_AGA 14
 | 
				
			||||||
 | 
					BEGID
 | 
				
			||||||
 | 
					  PROMPT 1 4 "Produttore"
 | 
				
			||||||
 | 
					  FLAGS "H"
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPREADSHEET F_MODULI 78
 | 
					SPREADSHEET F_MODULI 78
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  PROMPT 1 5 "Moduli"
 | 
					  PROMPT 1 5 "Moduli"
 | 
				
			||||||
 | 
				
			|||||||
@ -143,6 +143,26 @@ int TInstall_ini::patch(const char* module)
 | 
				
			|||||||
  return patch;
 | 
					  return patch;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TInstall_ini::version_info(const char* module, 
 | 
				
			||||||
 | 
					                                int& year, int& release,
 | 
				
			||||||
 | 
					                                int& tag, int& patchlevel)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TString ver = version(module);
 | 
				
			||||||
 | 
					  if (ver[0] == '9')
 | 
				
			||||||
 | 
					    ver.insert("19", 0);
 | 
				
			||||||
 | 
					  year = atoi(ver.left(4));   
 | 
				
			||||||
 | 
					  if (year == 0) 
 | 
				
			||||||
 | 
					    main_app().get_version_info(year, release, tag, patchlevel);
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					  {  
 | 
				
			||||||
 | 
					    release = atoi(ver.mid(4,2));  
 | 
				
			||||||
 | 
					    if (release == 0) 
 | 
				
			||||||
 | 
					      release++;
 | 
				
			||||||
 | 
					    tag = atoi(ver.mid(6,2));  
 | 
				
			||||||
 | 
					    patchlevel = patch(module);
 | 
				
			||||||
 | 
					  }  
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TInstall_ini::update_prices(const char* from)
 | 
					bool TInstall_ini::update_prices(const char* from)
 | 
				
			||||||
{   
 | 
					{   
 | 
				
			||||||
  CHECK(fexist(from), "Can't find listino prezzi");
 | 
					  CHECK(fexist(from), "Can't find listino prezzi");
 | 
				
			||||||
@ -684,6 +704,10 @@ protected:
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
  const TFilename& build_export_path(TFilename& path) const;
 | 
					  const TFilename& build_export_path(TFilename& path) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  long find_signature(const TFilename& filename, const char* signature) const;
 | 
				
			||||||
 | 
					  bool set_version_info(const TFilename& filename, 
 | 
				
			||||||
 | 
					                        TInstall_ini& ini, const char* module) const;
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void load();
 | 
					  void load();
 | 
				
			||||||
  void save();
 | 
					  void save();
 | 
				
			||||||
@ -1048,6 +1072,58 @@ int TFascicolator_mask::split_file(const TFilename& archive, long size) const
 | 
				
			|||||||
  return disks;  
 | 
					  return disks;  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					long TFascicolator_mask::find_signature(const TFilename& filename, const char* signature) const
 | 
				
			||||||
 | 
					{       
 | 
				
			||||||
 | 
					  bool found = FALSE;
 | 
				
			||||||
 | 
					  long position = -1;
 | 
				
			||||||
 | 
					  int compare = 0;
 | 
				
			||||||
 | 
					  ifstream infile(filename, ios::nocreate | ios::in | ios::binary);
 | 
				
			||||||
 | 
					  for (int car = infile.get(); car != EOF; car = infile.get())
 | 
				
			||||||
 | 
					  {                              
 | 
				
			||||||
 | 
					    if (car == signature[compare])
 | 
				
			||||||
 | 
					    {            
 | 
				
			||||||
 | 
					      if (compare == 0)
 | 
				
			||||||
 | 
					        position = infile.tellg()-1;
 | 
				
			||||||
 | 
					      compare++;
 | 
				
			||||||
 | 
					      if (signature[compare] == '\0')
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        found = TRUE;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					      }  
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      compare = 0;
 | 
				
			||||||
 | 
					      infile.seekg(position+1, ios::beg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }  
 | 
				
			||||||
 | 
					  return found ? position : -1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TFascicolator_mask::set_version_info(const TFilename& filename, 
 | 
				
			||||||
 | 
					                                          TInstall_ini& ini, const char* module) const
 | 
				
			||||||
 | 
					{           
 | 
				
			||||||
 | 
					  bool ok = FALSE;
 | 
				
			||||||
 | 
					  TString80 str = "Don't cry for me "; str << "Argentina.";
 | 
				
			||||||
 | 
					  long position = find_signature(filename, str);
 | 
				
			||||||
 | 
					  if (position > 0)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    ofstream outfile(filename, ios::out || ios::nocreate | ios::binary);
 | 
				
			||||||
 | 
					    position += str.len();
 | 
				
			||||||
 | 
					    outfile.seekp(position);
 | 
				
			||||||
 | 
					    if (outfile.good())
 | 
				
			||||||
 | 
					    {                    
 | 
				
			||||||
 | 
					      int year, release, tag, patch, checksum;
 | 
				
			||||||
 | 
					      ini.version_info(module, year, release, tag, patch);
 | 
				
			||||||
 | 
					      checksum = year + release + tag + patch;
 | 
				
			||||||
 | 
					      str.format("%04d.%02d.%02d.%03d.%04d", year, release, tag, patch, checksum);
 | 
				
			||||||
 | 
					      outfile.write(str, str.len());
 | 
				
			||||||
 | 
					      ok = outfile.good();
 | 
				
			||||||
 | 
					    }  
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return ok;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int patch_level) const
 | 
					bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int patch_level) const
 | 
				
			||||||
{  
 | 
					{  
 | 
				
			||||||
  TString_array arr;
 | 
					  TString_array arr;
 | 
				
			||||||
@ -1083,7 +1159,7 @@ bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int pa
 | 
				
			|||||||
  ofstream fileh(filelist);
 | 
					  ofstream fileh(filelist);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TProgind pi(arr.items(), msg, TRUE, TRUE); 
 | 
					  TProgind pi(arr.items(), msg, TRUE, TRUE); 
 | 
				
			||||||
  TString cmd(120);
 | 
					  TFilename cmd;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  FOR_EACH_ARRAY_ROW_BACK(arr, i, row)
 | 
					  FOR_EACH_ARRAY_ROW_BACK(arr, i, row)
 | 
				
			||||||
  {                    
 | 
					  {                    
 | 
				
			||||||
@ -1094,9 +1170,18 @@ bool TFascicolator_mask::zip_module(const TString& main_module, bool agg, int pa
 | 
				
			|||||||
      break;
 | 
					      break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    cmd = row->get(0);
 | 
					    cmd = row->get(0);
 | 
				
			||||||
    // Se non trovo anche uno solo dei files nella lista, è un casino
 | 
					    if (cmd.exist())
 | 
				
			||||||
    if (!fexist(cmd))
 | 
					 | 
				
			||||||
    {                   
 | 
					    {                   
 | 
				
			||||||
 | 
					      if (stricmp(cmd.ext(), "exe") == 0)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        TString16 submod = row->get(2);
 | 
				
			||||||
 | 
					        submod.cut(2);
 | 
				
			||||||
 | 
					        set_version_info(cmd, ini, submod);
 | 
				
			||||||
 | 
					      }  
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      // Se non trovo anche uno solo dei files nella lista, è un casino
 | 
				
			||||||
      TString msg(128);
 | 
					      TString msg(128);
 | 
				
			||||||
      msg << "Impossibile aprire il file " << cmd << ". Interrompere?";
 | 
					      msg << "Impossibile aprire il file " << cmd << ". Interrompere?";
 | 
				
			||||||
      if (yesno_box(msg))
 | 
					      if (yesno_box(msg))
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,8 @@ public:
 | 
				
			|||||||
  bool demo() { return get_bool("Demo", "Main"); }
 | 
					  bool demo() { return get_bool("Demo", "Main"); }
 | 
				
			||||||
  const TString& version(const char* module);
 | 
					  const TString& version(const char* module);
 | 
				
			||||||
  int patch(const char* module);
 | 
					  int patch(const char* module);
 | 
				
			||||||
  
 | 
					  void version_info(const char* module, 
 | 
				
			||||||
 | 
					                    int& year, int& release, int& tag, int& patch);
 | 
				
			||||||
  bool update_prices(const char* src_ini);
 | 
					  bool update_prices(const char* src_ini);
 | 
				
			||||||
  void prices(const char* module, word users, real& full, real& manut);
 | 
					  void prices(const char* module, word users, real& full, real& manut);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
				
			|||||||
@ -175,8 +175,8 @@ bool TInstaller_mask::autoload()
 | 
				
			|||||||
  if (fexist(ininame))
 | 
					  if (fexist(ininame))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TInstall_ini ini(ininame);
 | 
					    TInstall_ini ini(ininame);
 | 
				
			||||||
    ini.list_paragraphs(modules);
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    ini.list_paragraphs(modules);
 | 
				
			||||||
    FOR_EACH_ARRAY_ROW(modules, i, row)
 | 
					    FOR_EACH_ARRAY_ROW(modules, i, row)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const TString& module = *row;
 | 
					      const TString& module = *row;
 | 
				
			||||||
@ -614,8 +614,6 @@ void TInstaller_mask::install_selection()
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
    bool ok = TRUE;
 | 
					    bool ok = TRUE;
 | 
				
			||||||
    const int cmp = compare_version(oldver, oldpatch, newver, newpatch);
 | 
					    const int cmp = compare_version(oldver, oldpatch, newver, newpatch);
 | 
				
			||||||
    if (cmp < 0)
 | 
					 | 
				
			||||||
      ok = yesno_box("Si desidera installare la versione %s.%d?", (const char*)newver, newpatch);
 | 
					 | 
				
			||||||
    if (cmp == 0)
 | 
					    if (cmp == 0)
 | 
				
			||||||
      ok = yesno_box("Si desidera reinstallare la versione %s.%d?", (const char*)newver, newpatch);
 | 
					      ok = yesno_box("Si desidera reinstallare la versione %s.%d?", (const char*)newver, newpatch);
 | 
				
			||||||
    if (cmp > 0)
 | 
					    if (cmp > 0)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user