diff --git a/SparkleLib/Makefile.am b/SparkleLib/Makefile.am index 9fd6908b..65bab6c3 100644 --- a/SparkleLib/Makefile.am +++ b/SparkleLib/Makefile.am @@ -8,6 +8,7 @@ SOURCES = \ Defines.cs \ SparkleBackend.cs \ SparkleChangeSet.cs \ + SparkleConfig.cs \ SparkleFetcherBase.cs \ SparkleHelpers.cs \ SparkleListenerBase.cs \ @@ -18,8 +19,9 @@ SOURCES = \ Git/SparkleRepoGit.cs \ Git/SparkleFetcherGit.cs \ Hg/SparkleRepoHg.cs \ - Hg/SparkleFetcherHg.cs - + Hg/SparkleFetcherHg.cs \ + Scp/SparkleFetcherScp.cs \ + Scp/SparkleRepoScp.cs SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file)) diff --git a/SparkleLib/SparkleConfig.cs b/SparkleLib/SparkleConfig.cs new file mode 100644 index 00000000..4bd1ea12 --- /dev/null +++ b/SparkleLib/SparkleConfig.cs @@ -0,0 +1,96 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +using System; +using System.Xml; + +namespace SparkleLib { + + public class SparkleConfig : XmlDocument { + + public string Path; + + + public SparkleConfig (string path) + { + Path = path; + Load (Path); + } + + + public string UserName { + get { + XmlNode node = SelectSingleNode ("//user/name/text()"); + return node.Value; + } + + set { + XmlNode node = SelectSingleNode ("//user/name/text()"); + node.InnerText = value; + + Save (Path); + + } + } + + + public string UserEmail { + get { + XmlNode node = SelectSingleNode ("//user/name/email()"); + return node.Value; + } + + set { + XmlNode node = SelectSingleNode ("//user/name/email()"); + node.InnerText = value; + + Save (Path); + } + } + + + public void AddFolder (string name, SparkleBackend backend) + { + XmlNode node_folder = CreateNode (XmlNodeType.Element, "folder", null); + + XmlNode node_name = CreateElement ("name"); + node_name.InnerText = name; + + XmlNode node_backend = CreateElement ("backend"); + node_backend.InnerText = backend.Name; + + node_folder.AppendChild (node_name); + node_folder.AppendChild (node_backend); + + XmlNode node_root = SelectSingleNode ("/"); + node_root.AppendChild (node_folder); + + Save (Path); + } + + + public void RemoveFolder (string name) + { + foreach (XmlNode node_folder in SelectNodes ("//folder")) { + if (node_folder ["name"].InnerText.Equals (name)) + SelectSingleNode ("/").RemoveChild (node_folder); + } + + Save (Path); + } + } +} diff --git a/SparkleLib/SparkleLib.csproj b/SparkleLib/SparkleLib.csproj index 451d31fd..1812f5a5 100644 --- a/SparkleLib/SparkleLib.csproj +++ b/SparkleLib/SparkleLib.csproj @@ -51,6 +51,7 @@ +