Merge pull request #588 from serras/master
Add back sparkleshare-invite-open.cs
This commit is contained in:
commit
8f324eb140
|
@ -5,7 +5,7 @@
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<ProjectGuid>{728483AA-E34B-4441-BF2C-C8BC2901E4E0}</ProjectGuid>
|
<ProjectGuid>{728483AA-E34B-4441-BF2C-C8BC2901E4E0}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AssemblyName>SparkleShare</AssemblyName>
|
<AssemblyName>SparkleShare</AssemblyName>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<RootNamespace>SparkleShare</RootNamespace>
|
<RootNamespace>SparkleShare</RootNamespace>
|
||||||
|
|
|
@ -11,7 +11,7 @@ cd lib
|
||||||
copy * ..\..\..\bin
|
copy * ..\..\..\bin
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cp ..\..\data\icons\sparkleshare.ico ..\..\bin
|
copy ..\..\data\icons\sparkleshare.ico ..\..\bin
|
||||||
|
|
||||||
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="AnyCPU" %~dp0\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\Gettext.Cs.csproj
|
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="AnyCPU" %~dp0\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\Gettext.Cs.csproj
|
||||||
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln
|
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln
|
||||||
|
|
66
SparkleShare/sparkleshare-invite-open.cs
Normal file
66
SparkleShare/sparkleshare-invite-open.cs
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// SparkleShare, a collaboration and sharing tool.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
public class SparkleShare {
|
||||||
|
|
||||||
|
public static void Main (string [] args) {
|
||||||
|
|
||||||
|
new SparkleInviteOpen (args [0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class SparkleInviteOpen {
|
||||||
|
|
||||||
|
public SparkleInviteOpen (string url)
|
||||||
|
{
|
||||||
|
string safe_url = url.Replace ("sparkleshare://", "https://");
|
||||||
|
string unsafe_url = url.Replace ("sparkleshare://", "http://");
|
||||||
|
string xml = "";
|
||||||
|
|
||||||
|
WebClient web_client = new WebClient ();
|
||||||
|
|
||||||
|
try {
|
||||||
|
xml = web_client.DownloadString (safe_url);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Console.WriteLine ("Failed downloading invite: " + safe_url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
xml = web_client.DownloadString (safe_url);
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Console.WriteLine ("Failed downloading invite: " + unsafe_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
|
||||||
|
string target_path = Path.Combine (home_path, "SparkleShare");
|
||||||
|
|
||||||
|
if (xml.Contains ("<sparkleshare>")) {
|
||||||
|
File.WriteAllText (target_path, xml);
|
||||||
|
Console.WriteLine ("Downloaded invite: " + safe_url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue