windows invites: Fix file name. #758
This commit is contained in:
parent
804829cedc
commit
e4b9e0ee87
|
@ -34,28 +34,22 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleInviteOpen (string url)
|
public SparkleInviteOpen (string url)
|
||||||
{
|
{
|
||||||
string safe_url = url.Replace ("sparkleshare://", "https://");
|
string xml = "";
|
||||||
string unsafe_url = url.Replace ("sparkleshare://", "http://");
|
|
||||||
string xml = "";
|
|
||||||
|
|
||||||
WebClient web_client = new WebClient ();
|
WebClient web_client = new WebClient ();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
xml = web_client.DownloadString (safe_url);
|
xml = web_client.DownloadString (url);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
Console.WriteLine ("Failed downloading invite: " + safe_url);
|
Console.WriteLine ("Failed downloading invite: " + safe_url + ": " + e.Message);
|
||||||
|
Environment.Exit (-1);
|
||||||
try {
|
|
||||||
xml = web_client.DownloadString (safe_url);
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
Console.WriteLine ("Failed downloading invite: " + unsafe_url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string file_name = DateTime.UtcNow.Millisecond.ToString () + ".xml";
|
||||||
|
|
||||||
string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
||||||
string target_path = Path.Combine (home_path, "SparkleShare");
|
string target_path = Path.Combine (home_path, "SparkleShare", file_name);
|
||||||
|
|
||||||
if (xml.Contains ("<sparkleshare>")) {
|
if (xml.Contains ("<sparkleshare>")) {
|
||||||
File.WriteAllText (target_path, xml);
|
File.WriteAllText (target_path, xml);
|
||||||
|
|
Loading…
Reference in a new issue