Example #1
0
        /// <summary>
        /// Check if the latest update software version is downloaded and downloaded it otherwise
        /// </summary>
        public void DownloadSwUpdate()
        {
            stSwVersion currentSwVersion           = m_localData.GetSwInfo(); //obtener la informaciĆ³n de las versiones instaladas en la red local
            bool        bDownloadStationController = !File.Exists(Path.Combine(m_localData.GetSystemFilesFolderLocation(), currentSwVersion.stationControllerSwUrl));
            bool        bDownloadRemoteManager     = !File.Exists(Path.Combine(m_localData.GetSystemFilesFolderLocation(), currentSwVersion.remoteManagerSwUrl));
            bool        bDownloadHostController    = !File.Exists(Path.Combine(m_localData.GetSystemFilesFolderLocation(), currentSwVersion.hostControllerSwUrl));
            bool        bDownloadWebManager        = !File.Exists(Path.Combine(m_localData.GetSystemFilesFolderLocation(), currentSwVersion.webManagerSwUrl));

            if (bDownloadStationController || bDownloadRemoteManager || bDownloadHostController || bDownloadWebManager)
            {
                m_systemFilesManager.DownloadFile(System.Convert.ToString(My.Settings.Default.VersionFileName));

                if (bDownloadStationController)
                {
                    string stationControllerSwUrl = m_versionFileParser.GetStationControllerSwUrl(currentSwVersion.stationControllerSwVersion);
                    string sFilePath = m_systemFilesManager.DownloadFile(stationControllerSwUrl);
                    LoggerModule.logger.Info(System.Reflection.MethodInfo.GetCurrentMethod().Name + ". StationController downloaded software url:" + sFilePath);
                    m_localData.SetStationControllerSwUrl(stationControllerSwUrl);
                }

                if (bDownloadRemoteManager)
                {
                    string remoteManagerSwUrl = m_versionFileParser.GetRemoteManagerSwUrl(currentSwVersion.remoteManagerSwVersion);
                    string sFilePath          = m_systemFilesManager.DownloadFile(remoteManagerSwUrl);
                    LoggerModule.logger.Info(System.Reflection.MethodInfo.GetCurrentMethod().Name + ". RemoteManager downloaded software url:" + sFilePath);
                    m_localData.SetRemoteManagerSwUrl(remoteManagerSwUrl);
                }

                if (bDownloadHostController)
                {
                    string hostControllerSwUrl = m_versionFileParser.GetHostControllerSwUrl(currentSwVersion.hostControllerSwVersion);
                    string sFilePath           = m_systemFilesManager.DownloadFile(hostControllerSwUrl);
                    LoggerModule.logger.Info(System.Reflection.MethodInfo.GetCurrentMethod().Name + ". HostController downloaded software url:" + sFilePath);
                    m_localData.SetHostControllerSwUrl(hostControllerSwUrl);
                }

                if (bDownloadWebManager)
                {
                    string webManagerSwUrl = m_versionFileParser.GetWebManagerSwUrl(currentSwVersion.webManagerSwVersion);
                    string sFilePath       = m_systemFilesManager.DownloadFile(webManagerSwUrl);
                    LoggerModule.logger.Info(System.Reflection.MethodInfo.GetCurrentMethod().Name + ". WebManager downloaded software url:" + sFilePath);
                    m_localData.SetWebManagerSwUrl(webManagerSwUrl);
                }
            }
        }