Esempio n. 1
0
 public static bool CheckIfEapConfigIsSupported(EapConfig eapConfig)
 {
     if (!EduroamNetwork.IsEapConfigSupported(eapConfig))
     {
         MessageBox.Show(
             "The profile you have selected is not supported by this application.",
             "No supported authentification method was found.",
             MessageBoxButton.OK, MessageBoxImage.Exclamation);
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
        /// <summary>
        /// Checks if an EAP-config file exists in the same folder as the executable.
        /// If the installed and a EAP-config was bundled in a EXE using 7z, then this case will trigger
        /// </summary>
        /// <returns>EapConfig or null</returns>
        public static EapConfig GetBundledEapConfig()
        {
            string exeLocation = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string[] files = Directory.GetFiles(exeLocation, "*.eap-config");

            if (!files.Any())
            {
                return(null);
            }
            try
            {
                string eapPath   = files.First();
                string eapString = File.ReadAllText(eapPath);
                var    eapconfig = EapConfig.FromXmlData(eapString);

                return(EduroamNetwork.IsEapConfigSupported(eapconfig)
                                        ? eapconfig
                                        : null);
            }
            catch (XmlException) { }
            return(null);
        }