Пример #1
0
        public static void RemoveFocusOffset(FocusOffset f)
        {
            XElement ElementToRemove = TCFSettingsDocument.Descendants().Single(i => i.Name == "TCFSettings").
                Descendants().Single(j => j.Name == "FocusOffsets").Descendants("Offset").Single(k => k.Value == f.OffsetName + f.OffsetSteps.ToString());

            ElementToRemove.Remove();
            TCFSettingsDocument.Save(xpath);
        }
Пример #2
0
        public static void AddFocusOffset(FocusOffset f)
        {
            XElement Name = new XElement("Name", f.OffsetName);
            XElement Steps = new XElement("Steps", f.OffsetSteps.ToString());

            XElement Offset = new XElement("Offset", new object[] { Name, Steps });
            // Add the offset to the offsets section of the file.
            XElement MainElement = TCFSettingsDocument.Descendants().Single(i => i.Name == "TCFSettings").
                Descendants().Single(j => j.Name == "FocusOffsets");
            MainElement.Add(Offset);
            TCFSettingsDocument.Save(xpath);
        }