Пример #1
0
 public void SaveSettings()
 {
     new XDocument(
         new XElement(Tag_Root,
                      new XElement(Tag_NamedPipeAddress, NamedPipeAddress),
                      new XElement(Tag_AutoConnect, AutoConnect.ToString()),
                      new XElement(Tag_TimePaddingForLoop, TimePaddingForLoop.ToString()),
                      new XElement(Tag_LoopSelection, LoopSelection.ToString()),
                      new XElement(Tag_LoopNumber, LoopNumber.ToString()),
                      new XElement(Tag_PlayMode, PlayMode.ToString()),
                      new XElement(Tag_Volume,
                                   new XElement(Tag_VolumeValue, VolumeValue.ToString()),
                                   new XElement(Tag_VolumeMute, VolumeMute.ToString())),
                      new XElement(Tag_Documents, DocumentByDocumentGuid.Select(x =>
                                                                                new XElement(Tag_Document, new XAttribute(Att_Document_Id, x.Key), new XElement(Tag_Document_Name, x.Value.Name), new XElement(Tag_Media, x.Value.Media)))),
                      new XElement(Tag_MinimalSeverityToShowInLog, MinimalSeverityToShowInLog.ToString()),
                      new XElement(Tag_Window,
                                   new XElement(Tag_Top, WindowTop.ToString()),
                                   new XElement(Tag_Left, WindowLeft.ToString()),
                                   new XElement(Tag_Width, WindowWidth.ToString()),
                                   new XElement(Tag_Height, WindowHeight.ToString()),
                                   new XElement(Tag_Maximized, WindowMaximized.ToString()),
                                   new XElement(Tag_AlwaysOnTop, AlwaysOnTop.ToString())),
                      new XElement(Tag_VlcLibPath, VlcLibPath),
                      new XElement(Tag_DoNotAskAgain, FontMissingWindowDoNotAskAgain.ToString()))
         ).Save(SettingsPath);
 }
Пример #2
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("Description", Description);
     writer.WriteAttributeString("Url", Url);
     writer.WriteAttributeString("Ports", Ports);
     writer.WriteAttributeString("AutoConnect", AutoConnect.ToString());
 }
Пример #3
0
        public void Save(string path)
        {
            System.Xml.XmlDocument doc          = new System.Xml.XmlDocument();
            System.Xml.XmlElement  project_root = doc.CreateElement("Root");

            {
                var e = doc.CreateElement("Target");
                e.AppendChild(doc.CreateTextNode(Target.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("Port");
                e.AppendChild(doc.CreateTextNode(Port.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("AutoConnect");
                e.AppendChild(doc.CreateTextNode(AutoConnect.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnLoad");
                e.AppendChild(doc.CreateTextNode(SendOnLoad.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnEdit");
                e.AppendChild(doc.CreateTextNode(SendOnEdit.ToString()));
                project_root.AppendChild(e);
            }

            {
                var e = doc.CreateElement("SendOnSave");
                e.AppendChild(doc.CreateTextNode(SendOnSave.ToString()));
                project_root.AppendChild(e);
            }

            doc.AppendChild(project_root);

            var dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);

            doc.InsertBefore(dec, project_root);

            // For failing to save
            try
            {
                doc.Save(path);
            }
            catch
            {
            }
        }
Пример #4
0
 public void SaveSettings()
 {
     new XDocument(
         new XElement(Tag_Root,
                      new XElement(Tag_NamedPipeAddress, NamedPipeAddress),
                      new XElement(Tag_AutoConnect, AutoConnect.ToString()),
                      new XElement(Tag_MinimalSeverityToShowInLog, MinimalSeverityToShowInLog.ToString()),
                      new XElement(Tag_Window,
                                   new XElement(Tag_Top, WindowTop.ToString()),
                                   new XElement(Tag_Left, WindowLeft.ToString()),
                                   new XElement(Tag_Width, WindowWidth.ToString()),
                                   new XElement(Tag_Height, WindowHeight.ToString()),
                                   new XElement(Tag_Maximized, WindowMaximized.ToString()),
                                   new XElement(Tag_AlwaysOnTop, AlwaysOnTop.ToString())))
         ).Save(SettingsPath);
 }