config: remove old and unused methods
This commit is contained in:
parent
effec778fa
commit
508092e0f1
|
@ -29,15 +29,14 @@ namespace SparkleLib {
|
||||||
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
|
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
|
||||||
"sparkleshare");
|
"sparkleshare");
|
||||||
|
|
||||||
// TODO: declare elsewhere
|
|
||||||
public static SparkleConfig DefaultConfig = new SparkleConfig (default_config_path, "config.xml");
|
public static SparkleConfig DefaultConfig = new SparkleConfig (default_config_path, "config.xml");
|
||||||
public static bool DebugMode = true;
|
public static bool DebugMode = true;
|
||||||
|
|
||||||
|
|
||||||
public string FullPath;
|
public string FullPath;
|
||||||
public string TmpPath;
|
public string TmpPath;
|
||||||
public string LogFilePath;
|
public string LogFilePath;
|
||||||
|
|
||||||
|
|
||||||
public string HomePath {
|
public string HomePath {
|
||||||
get {
|
get {
|
||||||
if (GetConfigOption ("home_path") != null) {
|
if (GetConfigOption ("home_path") != null) {
|
||||||
|
@ -60,6 +59,7 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string FoldersPath {
|
public string FoldersPath {
|
||||||
get {
|
get {
|
||||||
if (GetConfigOption ("folders_path") != null)
|
if (GetConfigOption ("folders_path") != null)
|
||||||
|
@ -69,6 +69,7 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SparkleConfig (string config_path, string config_file_name)
|
public SparkleConfig (string config_path, string config_file_name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -205,8 +206,6 @@ namespace SparkleLib {
|
||||||
email_node.InnerText = user.Email;
|
email_node.InnerText = user.Email;
|
||||||
|
|
||||||
Save ();
|
Save ();
|
||||||
|
|
||||||
// ConfigureSSH ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,44 +312,6 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<string> Hosts {
|
|
||||||
get {
|
|
||||||
List<string> hosts = new List<string> ();
|
|
||||||
|
|
||||||
foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) {
|
|
||||||
Uri uri = new Uri (node_folder ["url"].InnerText);
|
|
||||||
|
|
||||||
if (!hosts.Contains (uri.Host))
|
|
||||||
hosts.Add (uri.Host);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hosts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<string> HostsWithUsername {
|
|
||||||
get {
|
|
||||||
List<string> hosts = new List<string> ();
|
|
||||||
|
|
||||||
foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) {
|
|
||||||
try {
|
|
||||||
Uri uri = new Uri (node_folder ["url"].InnerText);
|
|
||||||
|
|
||||||
if (uri.UserInfo != "git" && !hosts.Contains (uri.UserInfo + "@" + uri.Host))
|
|
||||||
hosts.Add (uri.UserInfo + "@" + uri.Host);
|
|
||||||
|
|
||||||
} catch (UriFormatException) {
|
|
||||||
SparkleHelpers.DebugInfo ("Config",
|
|
||||||
"Ignoring badly formatted URI: " + node_folder ["url"].InnerText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hosts;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private XmlNode GetFolder (string name)
|
private XmlNode GetFolder (string name)
|
||||||
{
|
{
|
||||||
return SelectSingleNode (String.Format("/sparkleshare/folder[name='{0}']", name));
|
return SelectSingleNode (String.Format("/sparkleshare/folder[name='{0}']", name));
|
||||||
|
@ -408,23 +369,14 @@ namespace SparkleLib {
|
||||||
Save (FullPath);
|
Save (FullPath);
|
||||||
SparkleHelpers.DebugInfo ("Config", "Updated \"" + FullPath + "\"");
|
SparkleHelpers.DebugInfo ("Config", "Updated \"" + FullPath + "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Chmod644 (string file_path)
|
|
||||||
{
|
|
||||||
// Hack to be able to set the permissions on a file
|
|
||||||
// that OpenSSH still likes without resorting to Mono.Unix
|
|
||||||
FileInfo file_info = new FileInfo (file_path);
|
|
||||||
file_info.Attributes = FileAttributes.ReadOnly;
|
|
||||||
file_info.Attributes = FileAttributes.Normal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ConfigFileNotFoundException : Exception {
|
public class ConfigFileNotFoundException : Exception {
|
||||||
|
|
||||||
public ConfigFileNotFoundException (string message) :
|
public ConfigFileNotFoundException (string message) : base (message)
|
||||||
base (message) { }
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue