getConfigSubDir() публичный статический Метод

public static getConfigSubDir ( String subDir ) : String
subDir String
Результат String
Пример #1
0
        public bool updatesAvailable(String sUpdatesFile)
        {
            // Make sure Templates directory exists
            bool bUpdateExists = false;

            if (0 == sUpdatesFile.Length)
            {
                try
                {
                    sUpdatesFile = getUpdatesFile();
                }
                catch (Exception)
                {
                    return(bUpdateExists);
                }
            }

            String sConfigPath = Configuration.getConfigSubDir("Templates");

            String sLocalFile = readLocalFile(sConfigPath + "_Manifest.txt");

            if (null == sLocalFile)
            {
                bUpdateExists = true;
            }
            if ((null != sLocalFile) && (!sLocalFile.Equals(sUpdatesFile)))
            {
                bUpdateExists = true;
            }

            return(bUpdateExists);
        }
Пример #2
0
        public bool checkForConfigUpdates(bool prompt, bool showstatus)
        {
            // Make sure Templates directory exists
            bool bUpdateExists = false;
            bool bUpdated      = false;

            try
            {
                // First look for software updates

                // Next look for configuration updates.

                String sConfigPath  = Configuration.getConfigSubDir("Templates");
                String sUpdatesFile = getUpdatesFile();
                bUpdateExists = updatesAvailable(sUpdatesFile);
                if (bUpdateExists)
                {
                    DialogResult dr = DialogResult.Yes;
                    if (prompt)
                    {
                        dr = MessageBox.Show("Configuration updates exist, would you like to download them?", "Configuration Updates Exist", MessageBoxButtons.YesNo);
                    }
                    if (System.Windows.Forms.DialogResult.Yes == dr)
                    {
                        m_mainForm.setStatus("Downloading Updates", m_mainForm.getStatusVisible());

                        System.IO.StringReader sr = new System.IO.StringReader(sUpdatesFile);

                        // read input
                        String strTemplate = null;
                        while (null != (strTemplate = sr.ReadLine()))
                        {
                            strTemplate = strTemplate.Trim();
                            String[] sSplit = strTemplate.Split(new char[] { ',' });
                            if (sSplit.Length == 2)
                            {
                                strTemplate = sSplit[0];
                            }

                            // Check for file size
                            String sTemplateUri = "http://devcentral.f5.com/apps/iRuler/Templates/" + strTemplate;
                            String sContents    = downloadFile(sTemplateUri);
                            if (null != sContents)
                            {
                                String localFile = sConfigPath + strTemplate;
                                saveLocalFile(localFile, sContents);
                                bUpdated = true;
                                m_mainForm.appendStatus(strTemplate + "...", m_mainForm.getStatusVisible());
                            }
                        }
                        sr.Close();
                        m_mainForm.appendStatus("Update Successful!", m_mainForm.getStatusVisible());
                    }
                }
                else
                {
                    if (showstatus)
                    {
                        MessageBox.Show("No configuration updates are available at this time.");
                    }
                }
            }
            catch (Exception)
            {
            }
            return(bUpdated);
        }