public static string GetLoginAttribute(string file, LoginType Type, LogicInformation attribute) { XElement root = XElement.Load(file); XElement elem = root .Elements(LoginType.Accout.ToString()) .Single(itemName => itemName.Attribute(LoginType.LogicType.ToString()).Value == Type.ToString()); return(elem.Attribute(attribute.ToString()).Value); }
public static void SetLoginAttribute(string file, LoginType Type, LogicInformation attribute, string newValue) { XElement root = XElement.Load(file); XElement elem = root .Elements(LoginType.Accout.ToString()) .Single(itemName => itemName.Attribute(LoginType.LogicType.ToString()).Value == Type.ToString()); elem.Attribute(attribute.ToString()).Value = newValue; root.Save(file); }