public void UpStation(string ssid, string password) { CmdHelper.ConvertStringToHex(ssid); string xmlPath = AppDomain.CurrentDomain.BaseDirectory + "wireless.xml"; XElement xe = XElement.Load(xmlPath); foreach (var item in xe.Descendants(xe.Name.Namespace + "name")) { item.Value = ssid; } XElement hexElement = xe.Descendants(xe.Name.Namespace + "hex").FirstOrDefault(); hexElement.Value = CmdHelper.ConvertStringToHex(ssid); XElement keyElement = xe.Descendants(xe.Name.Namespace + "keyMaterial").FirstOrDefault(); keyElement.Value = password; xe.Save(xmlPath); CmdHelper.ConnectAp(ssid, password); }