From d56e6cbb819d53684e591104ff9fb5050fd237fc Mon Sep 17 00:00:00 2001 From: luca Date: Thu, 10 Jul 2008 08:25:33 +0000 Subject: [PATCH] Patch level :nopatch Files correlati : Ricompilazione Demo : [ ] Commento :programma aggiornamento programmatori esterni git-svn-id: svn://10.65.10.50/trunk@16860 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- setup/Transfer.ico | Bin 0 -> 9662 bytes setup/update.cpp | 214 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 214 insertions(+) create mode 100755 setup/Transfer.ico create mode 100755 setup/update.cpp diff --git a/setup/Transfer.ico b/setup/Transfer.ico new file mode 100755 index 0000000000000000000000000000000000000000..cda115c8163dc911bbc1cf02835c8fbcadcb5d63 GIT binary patch literal 9662 zcmeHNd32oBbsv`!r{}b#;1K7K^dwLM2?v6UN#T&xrgZ}j5D3Ai6bK2#frLH4p`qA0 zGH|>AX0Z*nHfyuBjHS^&T4pqw(JYlTi)NqEXm-tLHjQTAx7&L^NuW3mTWckMbbOxf z_kHhu@7?A1?)|+PvsfGO-ZTR-ld_2_#OI(TxDM_* z-VQ%$;!Hktn)})>21VO0+RS@m(^Y5EU)#ZTU%pG~-97@>uD7n|TJJfT`GHsX(}~AA zN8rcRZLsb2Be3O}y>Qciy$!b>JPx4=e9{ zL7>{os;c^nbIrS6&)zh7TDlezP;2zS!AS!=&lST@PxZo`?=`~Bdk(`tK3@f2-O>*? zKG6ubz1skHeb5H?o#ep%r~2Tbj$wHC%qaZ4lTX*SUvPNFePToUS3{cT*GvDyvz{JN zq5|?1wqyy0d~vAOyWxOD2hR>pz(Xy4aLHFh@Xv^=?>xN+w!U}>ZrS@TY(MY;gENZH z9miVWM>QQ#qj$iAtz!7)fF{SPf^~_@9<_a+E>)_e%K)n_gV&3N3V6~55Lm)+-7QLZ znKuQGca6fopX_2{LpZzP`PX5~v#-JpFCK(nb9nHZfl0W#W*8pnQ^HGv*{jzh2KP%O zm%U?NFtmD;re=54*X)Xfsj>YDe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xq^6Bb0sTQa?$3V_Tc9n`b@VoR@owQRY9jm`>t!|(8n#(=1aeA!r zxOTFKn~E=qiEI*oqkJFm&*Q$g!UFPd+P{>8=p0RJXOm&XjT%g;|@36?niiKQ! zbzS13gq`IxUG_svFh0byQ^2h+8dZZkSJ!O7-{8Cs`D7XMbp>%9^jJWr;4Ww->^CX5 zP~2C?o)0-S+I)v%tfk#FGwjSHqaW%^dza35t9GqQ!Y`gr2Uc|n2c3QNED;TYd1fT( zFiyR=+P9vvx4!;w42nUH-85OMAf{IJB}w(y=bW(+z6s~Zhkii1Az!#Ymq}GDYJtzJ z?>3`yD7ktDShXXM+|XeZWr+)|eNQ}4yLD)&;Tvn8{i&}T8s7Ok z&2-;vJVI3Lqw_XhFZnHi-x>YqpIXOHTED7l{4W*br%q@QQU*XIP5V*z8~lF% zrDO*Hi-mt&Rg6@x$X8v<&siH*B>tpK<5;W`dSldbBFlOB~l10y1_}RW9zs_P+R_+;zEDv92u{M4rV|0(>TqG}G zv6%Y}A4w5C$MGW8zFU|3L4^N-3hzk+{6ADA>3##msNb~_N_4+(JHS4auahHDZbX^G V{zjA~yhj0~6G_;&B1J6L{{S-xhF1Up literal 0 HcmV?d00001 diff --git a/setup/update.cpp b/setup/update.cpp new file mode 100755 index 000000000..ac880beb6 --- /dev/null +++ b/setup/update.cpp @@ -0,0 +1,214 @@ +//Il sorgente va scritto in notazione ungherese. +//Le variabili seguono la seguente regola: 'acronimo tipo'+'nome variabile cammellata' +//Es. wxArrayString 'as' + 'AcceptRefuse' -> asAcceptRefuse +#include "wxinc.h" +#include "utils.h" + +/////////////////////////////////////////////////////////// +// UpdateFrame +/////////////////////////////////////////////////////////// + +class UpdateFrame : public wxFrame +{ +protected: + DECLARE_EVENT_TABLE(); + virtual void OnErase(wxEraseEvent& e); +public: + UpdateFrame(); +}; + +BEGIN_EVENT_TABLE(UpdateFrame, wxFrame) + EVT_ERASE_BACKGROUND(UpdateFrame::OnErase) +END_EVENT_TABLE() + +void UpdateFrame::OnErase(wxEraseEvent& e) +{ + //preparazione background + wxDC& dc = *e.GetDC(); + const wxRect rect = GetClientSize(); + wxColour c0 = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); + wxColour c1 = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); + wxColour c2 = wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW); + + wxRect rect1 = rect; rect1.SetBottom(rect.GetBottom() / 2); + dc.GradientFillLinear(rect1, c0, c1, wxSOUTH); + + wxRect rect2 = rect; rect2.SetTop(rect.GetBottom() / 2); + dc.GradientFillLinear(rect2, c1, c2, wxDOWN); + + const int nHeight = rect.GetHeight()/10; + wxFont* pFont = wxTheFontList->FindOrCreateFont(nHeight, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC, + wxFONTWEIGHT_BOLD); + dc.SetFont(*pFont); + dc.SetBackgroundMode(wxTRANSPARENT); + + const int k = nHeight / 16 + 1; + + dc.SetTextForeground(c2); + dc.DrawText(APPNAME, k, k); + dc.SetTextForeground(c1); + dc.DrawText(APPNAME, k/2, k/2); + + int w, h; + const wxString strSetup = wxT("Update"); + dc.GetTextExtent(strSetup, &w, &h); + + dc.SetTextForeground(c2); + dc.DrawText(strSetup, rect.GetRight()-w-k/2, rect.GetHeight()-h-k/2); + dc.SetTextForeground(c1); + dc.DrawText(strSetup, rect.GetRight()-w-k, rect.GetHeight()-h-k); +} + +UpdateFrame::UpdateFrame() + : wxFrame(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0) +{ + ShowFullScreen(true); +} + +/////////////////////////////////////////////////////////// +// UpdateExternal +/////////////////////////////////////////////////////////// +//classe principale, ovvero applicazione +class UpdateExternal : public wxApp +{ + UpdateFrame* m_pMainFrame; + wxLocale m_locale; + wxString m_strSetupPath; + +protected: + DECLARE_EVENT_TABLE() + + //metodi principali dell'applicazione + void OnTimer(wxTimerEvent& e); + + //metodi di utility per i vari modi di aggiornamento + void CopyDir(const wxString& strSourcePath, const wxString& strDestPath, const wxString strModule) const; + bool CheckAndCopyFile(const wxString& FilesListI, wxString strFileCurr) const; + +public: + virtual bool OnInit(); +}; + +IMPLEMENT_APP(UpdateExternal) + +BEGIN_EVENT_TABLE(UpdateExternal, wxApp) + EVT_TIMER(883, OnTimer) +END_EVENT_TABLE() + + + +//---------------------------------------------------------------- +// Metodi di utility per i vari tipi di aggiornamento +//---------------------------------------------------------------- +static int PatchCompare(const wxString& first, const wxString& second) +{ + const wxFileName fn1(first); + const wxFileName fn2(second); + const wxString strName1 = fn1.GetName().Lower(); + const wxString strName2 = fn2.GetName().Lower(); + if (strName1 == "syinst1") + return -1; + if (strName2 == "syinst1") + return 1; + + return strName1.CompareTo(strName2); +} + + +bool UpdateExternal::CheckAndCopyFile(const wxString& FilesListI, wxString strFileCurr) const +{ + bool ok = true; + strFileCurr.MakeLower(); //minuscolizzazione di sicurezza + const wxFileName strFileName(strFileCurr); + + //NON copiare i sorgenti cocco!! + const wxString strExt = strFileName.GetExt(); + if (strExt != "cpp" && strExt != "c" && strExt != "src" && strFileCurr.Find("\\cvs\\") < 0 ) + { + //eventuali sottodirectory le crea (solo se hanno un nome) + const wxString strDir = strFileName.GetPath(); + if (!strDir.IsEmpty() && !wxDirExists(strDir)) + { + for (size_t d = 0; d < strFileName.GetDirCount(); d++) + { + wxString strCartellina = strFileName.GetVolume() + ":"; + for (size_t e = 0; e <= d; e++) + { + strCartellina << "\\" << strFileName.GetDirs()[e]; + } + if (!wxDirExists(strCartellina)) + wxMkdir(strCartellina); + } + } + + //solo i files piu' nuovi vanno copiati + bool bCopia = !::wxFileName::FileExists(strFileCurr); + if (!bCopia) + { + time_t t_local = ::wxFileModificationTime(FilesListI); + time_t t_remote = ::wxFileModificationTime(strFileCurr); + bCopia = t_local > t_remote; + } + if (bCopia) + ok = CopiaFile(FilesListI, strFileCurr); + } + return ok; +} + +//metodo per copiare una directory e tutti i files che contiene +void UpdateExternal::CopyDir(const wxString& strSrc, const wxString& strDest, const wxString strModule) const +{ + wxArrayString asList; + const size_t uFilesToCopy = wxDir::GetAllFiles(strSrc + strModule, &asList); + wxString strFileCurr; + const size_t nPathLenght = strSrc.Len(); + CampoProgressDialog pi("Copia files...", (int)uFilesToCopy); + for (size_t i = 0; i < uFilesToCopy; i++) + { + if (!pi.Update((int)i, asList[i])) + break; + + asList[i].Lower(); + strFileCurr = strDest; + strFileCurr += asList[i].Mid(nPathLenght); + + if (!strFileCurr.IsEmpty()) + { + if (!CheckAndCopyFile(asList[i], strFileCurr)) + break; + } + } +} + + + +//metodo principale che sceglie la modalita' di lancio del programma +void UpdateExternal::OnTimer(wxTimerEvent& WXUNUSED(e)) +{ + //copia dei files sulla dir di destinazione + const wxString strDestPath = "Z:\\"; + const wxString strSrcPath = "C:\\U\\Luca\\R_10_00\\"; + + CopyDir(strSrcPath, strDestPath, "include"); + CopyDir(strSrcPath, strDestPath, "lib"); + CopyDir(strSrcPath, strDestPath, "ba"); + CopyDir(strSrcPath, strDestPath, "cg"); + CopyDir(strSrcPath, strDestPath, "ve"); + + m_pMainFrame->Destroy(); +} + + +bool UpdateExternal::OnInit() +{ + wxInitAllImageHandlers(); + m_locale.Init(); + + m_pMainFrame = new UpdateFrame; + SetTopWindow(m_pMainFrame); + + wxTimerEvent e(883); + AddPendingEvent(e); + + return true; +}