Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ap"></param>
        /// <param name="isProtected"></param>
        /// <returns></returns>
        public bool SaveProfileXml(AccessPoint ap, bool isProtected = true)
        {
            if (CheckExistsPath(true))
            {
                string path = System.IO.Path.Combine(Path, ap.Name + ".xml");

                string xml = ap.GetProfileXML(isProtected);

                if (!string.IsNullOrEmpty(xml))
                {
                    try
                    {
                        File.WriteAllText(path, xml);
                        return(true);
                    }
                    catch
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Профиль соединения
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ProfileXML(object sender, EventArgs e)
        {
            if (listNet.SelectedIndices.Count == 1)
            {
                int number = listNet.SelectedIndices[0];

                AccessPoint selectedAP = accessPoints.ToList()[number];
                string      p          = selectedAP.GetProfileXML().ToString();
                string      profile    = string.IsNullOrWhiteSpace(p) ? "-> Отсутствует профиль к данной сети" : p;


                showRichTextBox2.Text += string.Format("\r\n{0}\r\n", selectedAP.Name + ":\n" + profile);
            }
        }
Ejemplo n.º 3
0
        static void ProfileXML()
        {
            var accessPoints = List();

            Console.Write("\r\nEnter the index of the network you wish to print XML for: ");

            int selectedIndex = int.Parse(Console.ReadLine());

            if (selectedIndex > accessPoints.ToArray().Length || accessPoints.ToArray().Length == 0)
            {
                Console.Write("\r\nIndex out of bounds");
                return;
            }
            AccessPoint selectedAP = accessPoints.ToList()[selectedIndex];

            Console.WriteLine("\r\n{0}\r\n", selectedAP.GetProfileXML());
        }