public void ReadFromXML(EStations sta) { try { XElement Info = XElement.Load("Info.xml", LoadOptions.None); IEnumerable <XElement> _station = from el in Info.Elements("Computer") where (string)el.Attribute("Station") == sta.ToString() select el; if (Info == null) { Console.WriteLine("{0} Not exist in Info.xml", sta.ToString()); Console.WriteLine("Using Setting First for {0}", sta.ToString()); return; } foreach (var Compu in _station) { this.Station = sta.ToString(); this.WorkDir = (string)Compu.Element("WorkDir"); this.SoftWareDir = (string)Compu.Element("SoftwartDir"); this.ForsDir = (string)Compu.Element("ForsDir"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public void Setting(EStations station) { this.Station = station.ToString(); Console.WriteLine("Choose WORK DIR\n"); this.WorkDir = Console.ReadLine(); Console.WriteLine("Choose SOFTWARE DIR\n"); SoftWareDir = Console.ReadLine(); Console.WriteLine("Choose FORS DIR\n"); ForsDir = Console.ReadLine(); //XElement el = new XElement(); }