示例#1
0
        /// <summary>
        /// Populate the text inputs with the values from the licence file.
        /// </summary>
        private void PopulateInputs()
        {
            if (File.Exists(AzureSettings.Default.LicenceFilePath))
            {
                Licence licence = new Licence(AzureSettings.Default.LicenceFilePath);

                batchAccountInput.Text   = licence.BatchAccount;
                batchUrlInput.Text       = licence.BatchUrl;
                batchKeyInput.Text       = licence.BatchKey;
                storageAccountInput.Text = licence.StorageAccount;
                storageKeyInput.Text     = licence.StorageKey;
                emailSenderInput.Text    = licence.EmailSender;
                emailPWInput.Text        = licence.EmailPW;
            }
        }
示例#2
0
        /// <summary>
        /// Checks if Azure credentials exist in AzureSettings.Default. This method does not check their validity.
        /// It also does not check to see if the path to the Azure licence file exists there.
        /// </summary>
        /// <returns>True if credentials exist, false otherwise.</returns>
        public static bool CredentialsExist()
        {
            if (!File.Exists(AzureSettings.Default.LicenceFilePath))
            {
                return(false);
            }

            try
            {
                Licence licence = new Licence(AzureSettings.Default.LicenceFilePath);
                if (string.IsNullOrEmpty(licence.BatchAccount))
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(licence.BatchUrl))
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(licence.BatchKey))
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(licence.StorageAccount))
                {
                    return(false);
                }
                if (string.IsNullOrEmpty(licence.StorageKey))
                {
                    return(false);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }