AutoPuTTY.formMain.XmlConfigGet C# (CSharp) Метод

XmlConfigGet() публичный Метод

public XmlConfigGet ( string id ) : string
id string
Результат string
        public string XmlConfigGet(string id)
        {
            string file = Settings.Default.cfgpath;
            XmlDocument xmldoc = new XmlDocument();
            try
            {
                xmldoc.Load(file);
            }
            catch
            {
                Error("\"" + Settings.Default.cfgpath + "\" file is corrupt, delete it and try again.");
                Environment.Exit(-1);
            }

            XmlNodeList xmlnode = xmldoc.SelectNodes("//*[@ID=" + ParseXpathString(id) + "]");
            if (xmlnode != null)
            {
                if (xmlnode.Count > 0) return xmlnode[0].InnerText;
            }
            return "";
        }

Usage Example

Пример #1
0
        static void Main()
        {
            if (mutex.WaitOne(TimeSpan.Zero, true))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                formMain mainform = new formMain(false);
                string password = mainform.XmlConfigGet("password");

                if (password.Trim() != "")
                {
                    popupPassword passwordopup = new popupPassword(password);
                    Application.Run(passwordopup);
                    if (!passwordopup.auth) return;
                }

                Application.Run(new formMain(true));
            }
            else
            {
                // send our Win32 message to make the currently running instance
                // jump on top of all the other windows
                NativeMethods.PostMessage((IntPtr) NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
            }
        }
All Usage Examples Of AutoPuTTY.formMain::XmlConfigGet