[invitation] add early logic
This commit is contained in:
parent
c89038e1c0
commit
ac3b9b8baf
|
@ -22,9 +22,17 @@ namespace SparkleShare {
|
|||
|
||||
class SparkleInvitation {
|
||||
|
||||
public string Server;
|
||||
public string Repository;
|
||||
public string Key;
|
||||
|
||||
|
||||
public SparkleInvitation (string file_path)
|
||||
{
|
||||
|
||||
if (!File.Exists (file_path))
|
||||
return;
|
||||
|
||||
XmlDocument xml_doc = new XmlDocument ();
|
||||
xml_doc.Load (file_path);
|
||||
|
||||
|
@ -32,9 +40,18 @@ namespace SparkleShare {
|
|||
XmlNodeList repository_xml = xml_doc.GetElementsByTagName ("repository");
|
||||
XmlNodeList key_xml = xml_doc.GetElementsByTagName ("key");
|
||||
|
||||
string server = server_xml [0].InnerText;
|
||||
string repository = repository_xml [0].InnerText;
|
||||
string key = key_xml [0].InnerText;
|
||||
Server = server_xml [0].InnerText;
|
||||
Repository = repository_xml [0].InnerText;
|
||||
Key = key_xml [0].InnerText;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Activate ()
|
||||
{
|
||||
|
||||
string url = "http://" + Server + "/repo=" + Repository + "&key=" + Key;
|
||||
Console.WriteLine (url);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,6 @@ namespace SparkleShare {
|
|||
BusG.Init ();
|
||||
Gtk.Application.Init ();
|
||||
|
||||
// SparkleInvitation i = new SparkleInvitation ("/home/hbons/SparkleShare/sparkleshare.invitation");
|
||||
|
||||
SetProcessName ("sparkleshare");
|
||||
|
||||
Repositories = new List <SparkleRepo> ();
|
||||
|
@ -89,8 +87,19 @@ namespace SparkleShare {
|
|||
|
||||
watcher.Created += delegate (object o, FileSystemEventArgs args) {
|
||||
|
||||
if (args.Name.EndsWith ("sparkleshare.invitation")) {
|
||||
|
||||
SparkleInvitation invitation;
|
||||
invitation = new SparkleInvitation (args.FullPath);
|
||||
|
||||
invitation.Activate ();
|
||||
|
||||
} else if (Directory.Exists (args.FullPath)) {
|
||||
|
||||
AddRepository (args.FullPath);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue