Merge branch 'master' of https://github.com/hbons/SparkleShare
This commit is contained in:
commit
6296a78b26
|
@ -211,14 +211,7 @@ namespace SparkleLib.Git {
|
||||||
public override bool IsFetchedRepoEmpty {
|
public override bool IsFetchedRepoEmpty {
|
||||||
get {
|
get {
|
||||||
SparkleGit git = new SparkleGit (TargetFolder, "rev-parse HEAD");
|
SparkleGit git = new SparkleGit (TargetFolder, "rev-parse HEAD");
|
||||||
git.StartInfo.RedirectStandardError = true;
|
git.StartAndWaitForExit ();
|
||||||
git.Start ();
|
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
git.StandardOutput.ReadToEnd ();
|
|
||||||
git.StandardError.ReadToEnd ();
|
|
||||||
git.WaitForExit ();
|
|
||||||
|
|
||||||
return (git.ExitCode != 0);
|
return (git.ExitCode != 0);
|
||||||
}
|
}
|
||||||
|
@ -257,17 +250,12 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
if (!File.Exists (password_check_file_path)) {
|
if (!File.Exists (password_check_file_path)) {
|
||||||
SparkleGit git = new SparkleGit (TargetFolder, "show HEAD:.sparkleshare");
|
SparkleGit git = new SparkleGit (TargetFolder, "show HEAD:.sparkleshare");
|
||||||
git.Start ();
|
string output = git.StartAndReadStandardOutput ();
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
if (git.ExitCode == 0)
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
string output = git.StandardOutput.ReadToEnd ();
|
|
||||||
git.WaitForExit ();
|
|
||||||
|
|
||||||
if (git.ExitCode != 0)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
File.WriteAllText (password_check_file_path, output);
|
File.WriteAllText (password_check_file_path, output);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Process process = new Process () {
|
Process process = new Process () {
|
||||||
|
@ -306,7 +294,7 @@ namespace SparkleLib.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Fetcher", "Failed to dispose properly: " + e.Message);
|
SparkleLogger.LogInfo ("Fetcher", "Failed to dispose properly", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,27 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
private string cached_branch;
|
private string cached_branch;
|
||||||
|
|
||||||
|
private Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||||
|
private Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
private Regex log_regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
||||||
|
"Author: (.+) <(.+)>\n" +
|
||||||
|
"*" +
|
||||||
|
"Date: ([0-9]{4})-([0-9]{2})-([0-9]{2}) " +
|
||||||
|
"([0-9]{2}):([0-9]{2}):([0-9]{2}) (.[0-9]{4})\n" +
|
||||||
|
"*", RegexOptions.Compiled);
|
||||||
|
|
||||||
private string branch {
|
private string branch {
|
||||||
get {
|
get {
|
||||||
if (string.IsNullOrEmpty (this.cached_branch)) {
|
if (string.IsNullOrEmpty (this.cached_branch)) {
|
||||||
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
||||||
|
|
||||||
if (Directory.Exists (rebase_apply_path)) {
|
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
|
||||||
while (HasLocalChanges) {
|
try {
|
||||||
try {
|
ResolveConflict ();
|
||||||
ResolveConflict ();
|
|
||||||
|
} catch (IOException e) {
|
||||||
} catch (IOException e) {
|
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,11 +232,10 @@ namespace SparkleLib.Git {
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
||||||
double percentage = 1.0;
|
double percentage = 1.0;
|
||||||
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
|
||||||
|
|
||||||
while (!git.StandardError.EndOfStream) {
|
while (!git.StandardError.EndOfStream) {
|
||||||
string line = git.StandardError.ReadLine ();
|
string line = git.StandardError.ReadLine ();
|
||||||
Match match = progress_regex.Match (line);
|
Match match = this.progress_regex.Match (line);
|
||||||
double speed = 0.0;
|
double speed = 0.0;
|
||||||
double number = 0.0;
|
double number = 0.0;
|
||||||
|
|
||||||
|
@ -245,9 +252,7 @@ namespace SparkleLib.Git {
|
||||||
} else {
|
} else {
|
||||||
// "Writing objects" stage
|
// "Writing objects" stage
|
||||||
number = (number / 100 * 80 + 20);
|
number = (number / 100 * 80 + 20);
|
||||||
|
Match speed_match = this.speed_regex.Match (line);
|
||||||
Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
|
||||||
Match speed_match = speed_regex.Match (line);
|
|
||||||
|
|
||||||
if (speed_match.Success) {
|
if (speed_match.Success) {
|
||||||
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
||||||
|
@ -309,11 +314,10 @@ namespace SparkleLib.Git {
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
|
||||||
double percentage = 1.0;
|
double percentage = 1.0;
|
||||||
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
|
||||||
|
|
||||||
while (!git.StandardError.EndOfStream) {
|
while (!git.StandardError.EndOfStream) {
|
||||||
string line = git.StandardError.ReadLine ();
|
string line = git.StandardError.ReadLine ();
|
||||||
Match match = progress_regex.Match (line);
|
Match match = this.progress_regex.Match (line);
|
||||||
double speed = 0.0;
|
double speed = 0.0;
|
||||||
double number = 0.0;
|
double number = 0.0;
|
||||||
|
|
||||||
|
@ -330,9 +334,7 @@ namespace SparkleLib.Git {
|
||||||
} else {
|
} else {
|
||||||
// "Writing objects" stage
|
// "Writing objects" stage
|
||||||
number = (number / 100 * 80 + 20);
|
number = (number / 100 * 80 + 20);
|
||||||
|
Match speed_match = this.speed_regex.Match (line);
|
||||||
Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
|
||||||
Match speed_match = speed_regex.Match (line);
|
|
||||||
|
|
||||||
if (speed_match.Success) {
|
if (speed_match.Success) {
|
||||||
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
||||||
|
@ -409,8 +411,6 @@ namespace SparkleLib.Git {
|
||||||
{
|
{
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "add --all");
|
SparkleGit git = new SparkleGit (LocalPath, "add --all");
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Changes staged");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -470,21 +470,23 @@ namespace SparkleLib.Git {
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
} else {
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
|
||||||
|
string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine ();
|
||||||
|
|
||||||
|
while (Directory.Exists (rebase_apply_path) && HasLocalChanges) {
|
||||||
|
try {
|
||||||
|
ResolveConflict ();
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
|
} catch (IOException e) {
|
||||||
|
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
||||||
while (HasLocalChanges) {
|
}
|
||||||
try {
|
|
||||||
ResolveConflict ();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again... (" + e.Message + ")");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Conflict resolved");
|
SparkleLogger.LogInfo ("Git", Name + " | Conflict resolved");
|
||||||
OnConflictResolved ();
|
OnConflictResolved ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git = new SparkleGit (LocalPath, "config core.ignorecase false");
|
git = new SparkleGit (LocalPath, "config core.ignorecase false");
|
||||||
|
@ -529,9 +531,7 @@ namespace SparkleLib.Git {
|
||||||
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
SparkleLogger.LogInfo ("Git", Name + " | Conflict type: " + line);
|
||||||
|
|
||||||
// Ignore conflicts in the .sparkleshare file and use the local version
|
// Ignore conflicts in the .sparkleshare file and use the local version
|
||||||
if (conflicting_path.EndsWith (".sparkleshare") ||
|
if (conflicting_path.EndsWith (".sparkleshare") || conflicting_path.EndsWith (".empty")) {
|
||||||
conflicting_path.EndsWith (".empty")) {
|
|
||||||
|
|
||||||
// Recover local version
|
// Recover local version
|
||||||
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
SparkleGit git_theirs = new SparkleGit (LocalPath, "checkout --theirs \"" + conflicting_path + "\"");
|
||||||
git_theirs.StartAndWaitForExit ();
|
git_theirs.StartAndWaitForExit ();
|
||||||
|
@ -570,12 +570,8 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
// The local version has been modified, but the server version was removed
|
// The local version has been modified, but the server version was removed
|
||||||
} else if (line.StartsWith ("DU")) {
|
} else if (line.StartsWith ("DU")) {
|
||||||
|
// The modified local version is already in the checkout, so it just needs to be added.
|
||||||
// The modified local version is already in the
|
// We need to specifically mention the file, so we can't reuse the Add () method
|
||||||
// checkout, so it just needs to be added.
|
|
||||||
//
|
|
||||||
// We need to specifically mention the file, so
|
|
||||||
// we can't reuse the Add () method
|
|
||||||
SparkleGit git_add = new SparkleGit (LocalPath, "add \"" + conflicting_path + "\"");
|
SparkleGit git_add = new SparkleGit (LocalPath, "add \"" + conflicting_path + "\"");
|
||||||
git_add.StartAndWaitForExit ();
|
git_add.StartAndWaitForExit ();
|
||||||
|
|
||||||
|
@ -663,8 +659,8 @@ namespace SparkleLib.Git {
|
||||||
{
|
{
|
||||||
Error = ErrorStatus.None;
|
Error = ErrorStatus.None;
|
||||||
|
|
||||||
if (line.StartsWith ("WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!") ||
|
if (line.Contains ("WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!") ||
|
||||||
line.StartsWith ("WARNING: POSSIBLE DNS SPOOFING DETECTED!")) {
|
line.Contains ("WARNING: POSSIBLE DNS SPOOFING DETECTED!")) {
|
||||||
|
|
||||||
Error = ErrorStatus.HostIdentityChanged;
|
Error = ErrorStatus.HostIdentityChanged;
|
||||||
|
|
||||||
|
@ -732,15 +728,9 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
entries.Add (last_entry);
|
entries.Add (last_entry);
|
||||||
|
|
||||||
Regex regex = new Regex (@"commit ([a-z0-9]{40})\n" +
|
|
||||||
"Author: (.+) <(.+)>\n" +
|
|
||||||
"*" +
|
|
||||||
"Date: ([0-9]{4})-([0-9]{2})-([0-9]{2}) " +
|
|
||||||
"([0-9]{2}):([0-9]{2}):([0-9]{2}) (.[0-9]{4})\n" +
|
|
||||||
"*", RegexOptions.Compiled);
|
|
||||||
|
|
||||||
foreach (string log_entry in entries) {
|
foreach (string log_entry in entries) {
|
||||||
Match match = regex.Match (log_entry);
|
Match match = this.log_regex.Match (log_entry);
|
||||||
|
|
||||||
if (match.Success) {
|
if (match.Success) {
|
||||||
SparkleChangeSet change_set = new SparkleChangeSet ();
|
SparkleChangeSet change_set = new SparkleChangeSet ();
|
||||||
|
|
|
@ -6,7 +6,6 @@ ASSEMBLY_INFO_SOURCE = Defines.cs
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
SparkleBackend.cs \
|
SparkleBackend.cs \
|
||||||
SparkleConfig.cs \
|
SparkleConfig.cs \
|
||||||
SparkleExceptions.cs \
|
|
||||||
SparkleExtensions.cs \
|
SparkleExtensions.cs \
|
||||||
SparkleFetcherBase.cs \
|
SparkleFetcherBase.cs \
|
||||||
SparkleListenerBase.cs \
|
SparkleListenerBase.cs \
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
// 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;
|
|
||||||
|
|
||||||
namespace SparkleLib {
|
|
||||||
|
|
||||||
public class QuotaExceededException : Exception {
|
|
||||||
|
|
||||||
public readonly int QuotaLimit = -1;
|
|
||||||
|
|
||||||
|
|
||||||
public QuotaExceededException ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public QuotaExceededException (string message, int quota_limit) : base (message)
|
|
||||||
{
|
|
||||||
QuotaLimit = quota_limit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -68,7 +68,7 @@ namespace SparkleLib {
|
||||||
else if (byte_count >= 1024)
|
else if (byte_count >= 1024)
|
||||||
return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 0));
|
return String.Format ("{0:##.##} ᴋʙ", Math.Round (byte_count / 1024, 0));
|
||||||
else
|
else
|
||||||
return byte_count.ToString () + " bytes";
|
return byte_count.ToString () + " ʙ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,8 +162,8 @@ namespace SparkleLib {
|
||||||
|
|
||||||
IsActive = false;
|
IsActive = false;
|
||||||
|
|
||||||
bool repo_is_encrypted =
|
bool repo_is_encrypted = (RemoteUrl.AbsolutePath.Contains ("-crypto") ||
|
||||||
(RemoteUrl.AbsolutePath.Contains ("-crypto") || RemoteUrl.Host.Equals ("sparkleshare.net"));
|
RemoteUrl.Host.Equals ("sparkleshare.net"));
|
||||||
|
|
||||||
Finished (repo_is_encrypted, IsFetchedRepoEmpty, Warnings);
|
Finished (repo_is_encrypted, IsFetchedRepoEmpty, Warnings);
|
||||||
|
|
||||||
|
@ -257,29 +257,22 @@ namespace SparkleLib {
|
||||||
|
|
||||||
private string FetchHostKey ()
|
private string FetchHostKey ()
|
||||||
{
|
{
|
||||||
string host = RemoteUrl.Host;
|
SparkleLogger.LogInfo ("Auth", "Fetching host key for " + RemoteUrl.Host);
|
||||||
int port = RemoteUrl.Port;
|
|
||||||
|
|
||||||
if (port < 1)
|
|
||||||
port = 22;
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Auth", "Fetching host key for " + host);
|
|
||||||
|
|
||||||
Process process = new Process () {
|
|
||||||
EnableRaisingEvents = true
|
|
||||||
};
|
|
||||||
|
|
||||||
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "ssh-keyscan";
|
process.StartInfo.FileName = "ssh-keyscan";
|
||||||
process.StartInfo.Arguments = "-t rsa -p " + port + " " + host;
|
|
||||||
process.StartInfo.WorkingDirectory = SparkleConfig.DefaultConfig.TmpPath;
|
process.StartInfo.WorkingDirectory = SparkleConfig.DefaultConfig.TmpPath;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.CreateNoWindow = true;
|
process.StartInfo.CreateNoWindow = true;
|
||||||
|
process.EnableRaisingEvents = true;
|
||||||
|
|
||||||
|
if (RemoteUrl.Port < 1)
|
||||||
|
process.StartInfo.Arguments = "-t rsa -p 22 " + RemoteUrl.Host;
|
||||||
|
else
|
||||||
|
process.StartInfo.Arguments = "-t rsa -p " + RemoteUrl.Port + " " + RemoteUrl.Host;
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
string host_key = process.StandardOutput.ReadToEnd ().Trim ();
|
string host_key = process.StandardOutput.ReadToEnd ().Trim ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
|
@ -302,7 +295,7 @@ namespace SparkleLib {
|
||||||
return fingerprint.ToLower ().Replace ("-", ":");
|
return fingerprint.ToLower ().Replace ("-", ":");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Fetcher", "Failed creating fingerprint: " + e.Message + e.StackTrace);
|
SparkleLogger.LogInfo ("Fetcher", "Failed creating fingerprint: " + e.Message + " " + e.StackTrace);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>False</Optimize>
|
||||||
<OutputPath>..\bin</OutputPath>
|
<OutputPath>..\bin</OutputPath>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<ConsolePause>false</ConsolePause>
|
<ConsolePause>False</ConsolePause>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>False</Optimize>
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -40,17 +40,15 @@
|
||||||
<Compile Include="SparkleConfig.cs" />
|
<Compile Include="SparkleConfig.cs" />
|
||||||
<Compile Include="SparkleWatcher.cs" />
|
<Compile Include="SparkleWatcher.cs" />
|
||||||
<Compile Include="SparkleExtensions.cs" />
|
<Compile Include="SparkleExtensions.cs" />
|
||||||
<Compile Include="SparkleExceptions.cs" />
|
|
||||||
<Compile Include="SparkleUser.cs" />
|
<Compile Include="SparkleUser.cs" />
|
||||||
<Compile Include="SparkleLogger.cs" />
|
<Compile Include="SparkleLogger.cs" />
|
||||||
<Compile Include="Defines.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<MonoDevelop>
|
<MonoDevelop>
|
||||||
<Properties>
|
<Properties>
|
||||||
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am">
|
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">
|
||||||
<BuildFilesVar Sync="true" Name="SOURCES" />
|
<BuildFilesVar Sync="True" Name="SOURCES" />
|
||||||
<DeployFilesVar />
|
<DeployFilesVar />
|
||||||
<ResourcesVar />
|
<ResourcesVar />
|
||||||
<OthersVar />
|
<OthersVar />
|
||||||
|
|
|
@ -26,10 +26,19 @@ namespace SparkleLib {
|
||||||
private static int log_size = 0;
|
private static int log_size = 0;
|
||||||
|
|
||||||
public static void LogInfo (string type, string message)
|
public static void LogInfo (string type, string message)
|
||||||
|
{
|
||||||
|
LogInfo (type, message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void LogInfo (string type, string message, Exception exception)
|
||||||
{
|
{
|
||||||
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
||||||
string line = timestamp + " | " + type + " | " + message;
|
string line = timestamp + " | " + type + " | " + message;
|
||||||
|
|
||||||
|
if (exception != null)
|
||||||
|
line += ": " + exception.Message + " " + exception.StackTrace;
|
||||||
|
|
||||||
if (SparkleConfig.DebugMode)
|
if (SparkleConfig.DebugMode)
|
||||||
Console.WriteLine (line);
|
Console.WriteLine (line);
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,3 @@
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</plugin>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,3 @@
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</plugin>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,3 @@
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</plugin>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,3 @@
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</plugin>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
||||||
|
|
|
@ -17,4 +17,3 @@
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</plugin>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ $ export PKG_CONFIG=/Library/Frameworks/Mono.framework/Versions/Current/bin/pkg-
|
||||||
$ export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
|
$ export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
|
||||||
```
|
```
|
||||||
|
|
||||||
Install <tt>git</tt>, <tt>automake</tt>, <tt>libtool</tt> and <tt>intltool</tt> using <tt>MacPorts</tt>:
|
Install <tt>git</tt>, <tt>automake</tt>, <tt>libtool</tt>, <tt>pkgconfig</tt> and <tt>intltool</tt> using <tt>MacPorts</tt>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo port install git-core automake intltool libtool
|
$ sudo port install git-core automake intltool pkgconfig libtool
|
||||||
```
|
```
|
||||||
|
|
||||||
Get a Git install, and place both the `bin` and `libexec` directories in `SparkleShare/Mac/git`.
|
Get a Git install, and place both the `bin` and `libexec` directories in `SparkleShare/Mac/git`.
|
||||||
|
@ -43,6 +43,16 @@ $ ./autogen.sh
|
||||||
Now that you have compiled the libraries, open `SparkleShare/Mac/SparkleShare.sln` in
|
Now that you have compiled the libraries, open `SparkleShare/Mac/SparkleShare.sln` in
|
||||||
MonoDevelop and start the build (Build > Build All).
|
MonoDevelop and start the build (Build > Build All).
|
||||||
|
|
||||||
|
If you get `Are you missing a using directive or an assembly reference?` errors related to MacOS objects, then run:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/mono/monomac
|
||||||
|
git clone https://github.com/mono/maccore
|
||||||
|
cd monomac
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
It should generate `MonoMac.dll`. Copy it over any `MonoMac.dll` you might have on your system, then restart Monodevelop, and the project should now build fine.
|
||||||
|
|
||||||
### Creating a Mac bundle
|
### Creating a Mac bundle
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ using System.IO;
|
||||||
using MonoMac.AppKit;
|
using MonoMac.AppKit;
|
||||||
using MonoMac.Foundation;
|
using MonoMac.Foundation;
|
||||||
using MonoMac.ObjCRuntime;
|
using MonoMac.ObjCRuntime;
|
||||||
using MonoMac.WebKit;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
// 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.Drawing;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using MonoMac.AppKit;
|
|
||||||
using MonoMac.Foundation;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
|
||||||
|
|
||||||
public class SparkleBadger {
|
|
||||||
|
|
||||||
private Dictionary<string, NSImage> icons = new Dictionary<string, NSImage> ();
|
|
||||||
private int [] sizes = new int [] {16, 32, 48, 128, 256, 512};
|
|
||||||
private string [] paths;
|
|
||||||
|
|
||||||
|
|
||||||
public SparkleBadger (string [] paths)
|
|
||||||
{
|
|
||||||
this.paths = paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Badge ()
|
|
||||||
{
|
|
||||||
using (NSAutoreleasePool a = new NSAutoreleasePool ()) {
|
|
||||||
foreach (string path in this.paths) {
|
|
||||||
string extension = Path.GetExtension (path.ToLower ());
|
|
||||||
NSImage new_icon = new NSImage ();
|
|
||||||
|
|
||||||
if (!this.icons.ContainsKey (extension)) {
|
|
||||||
foreach (int size in this.sizes) {
|
|
||||||
NSImage file_icon = NSWorkspace.SharedWorkspace.IconForFileType (extension);
|
|
||||||
file_icon.Size = new SizeF (size, size);
|
|
||||||
|
|
||||||
// TODO: replace this with the sync icon
|
|
||||||
NSImage overlay_icon = NSWorkspace.SharedWorkspace.IconForFileType ("sln");
|
|
||||||
overlay_icon.Size = new SizeF (size / 2, size / 2);
|
|
||||||
|
|
||||||
file_icon.LockFocus ();
|
|
||||||
NSGraphicsContext.CurrentContext.ImageInterpolation = NSImageInterpolation.High;
|
|
||||||
overlay_icon.Draw (
|
|
||||||
new RectangleF (0, 0, file_icon.Size.Width / 3, file_icon.Size.Width / 3),
|
|
||||||
new RectangleF (), NSCompositingOperation.SourceOver, 1.0f);
|
|
||||||
file_icon.UnlockFocus ();
|
|
||||||
|
|
||||||
new_icon.AddRepresentation (file_icon.Representations () [0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.icons.Add (extension, new_icon);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
new_icon = this.icons [extension];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSWorkspace.SharedWorkspace.SetIconforFile (new_icon, path, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Clear ()
|
|
||||||
{
|
|
||||||
foreach (string path in this.paths) {
|
|
||||||
string extension = Path.GetExtension (path.ToLower ());
|
|
||||||
|
|
||||||
NSImage original_icon = NSWorkspace.SharedWorkspace.IconForFileType (extension);
|
|
||||||
NSWorkspace.SharedWorkspace.SetIconforFile (original_icon, path, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,7 +23,6 @@ using System.IO;
|
||||||
using MonoMac.Foundation;
|
using MonoMac.Foundation;
|
||||||
using MonoMac.AppKit;
|
using MonoMac.AppKit;
|
||||||
using MonoMac.ObjCRuntime;
|
using MonoMac.ObjCRuntime;
|
||||||
using MonoMac.WebKit;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="SparkleMacWatcher.cs" />
|
<Compile Include="SparkleMacWatcher.cs" />
|
||||||
<Compile Include="SparkleEventLog.cs" />
|
<Compile Include="SparkleEventLog.cs" />
|
||||||
<Compile Include="SparkleBadger.cs" />
|
|
||||||
<Compile Include="SparkleBubbles.cs" />
|
<Compile Include="SparkleBubbles.cs" />
|
||||||
<Compile Include="SparkleSetup.cs" />
|
<Compile Include="SparkleSetup.cs" />
|
||||||
<Compile Include="SparkleSetupWindow.cs" />
|
<Compile Include="SparkleSetupWindow.cs" />
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace SparkleShare {
|
||||||
public SparkleStatusIconController Controller = new SparkleStatusIconController ();
|
public SparkleStatusIconController Controller = new SparkleStatusIconController ();
|
||||||
|
|
||||||
private NSMenu menu;
|
private NSMenu menu;
|
||||||
|
private NSMenu submenu;
|
||||||
|
|
||||||
private NSStatusItem status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
|
private NSStatusItem status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
|
||||||
private NSMenuItem state_item;
|
private NSMenuItem state_item;
|
||||||
|
@ -207,6 +208,15 @@ namespace SparkleShare {
|
||||||
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
this.menu.AddItem (this.folder_item);
|
this.menu.AddItem (this.folder_item);
|
||||||
|
|
||||||
|
this.submenu = new NSMenu ();
|
||||||
|
|
||||||
|
this.submenu.AddItem (this.recent_events_item);
|
||||||
|
this.submenu.AddItem (this.add_item);
|
||||||
|
this.submenu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
|
this.submenu.AddItem (this.about_item);
|
||||||
|
|
||||||
|
this.folder_item.Submenu = this.submenu;
|
||||||
|
|
||||||
this.folder_menu_items = new NSMenuItem [Controller.Folders.Length];
|
this.folder_menu_items = new NSMenuItem [Controller.Folders.Length];
|
||||||
this.error_menu_items = new NSMenuItem [Controller.Folders.Length];
|
this.error_menu_items = new NSMenuItem [Controller.Folders.Length];
|
||||||
this.try_again_menu_items = new NSMenuItem [Controller.Folders.Length];
|
this.try_again_menu_items = new NSMenuItem [Controller.Folders.Length];
|
||||||
|
@ -252,13 +262,7 @@ namespace SparkleShare {
|
||||||
foreach (NSMenuItem item in this.folder_menu_items)
|
foreach (NSMenuItem item in this.folder_menu_items)
|
||||||
this.menu.AddItem (item);
|
this.menu.AddItem (item);
|
||||||
|
|
||||||
|
|
||||||
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
||||||
this.menu.AddItem (this.recent_events_item);
|
|
||||||
this.menu.AddItem (this.add_item);
|
|
||||||
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
|
||||||
this.menu.AddItem (this.about_item);
|
|
||||||
this.menu.AddItem (NSMenuItem.SeparatorItem);
|
|
||||||
this.menu.AddItem (this.quit_item);
|
this.menu.AddItem (this.quit_item);
|
||||||
|
|
||||||
this.menu.Delegate = new SparkleStatusIconMenuDelegate ();
|
this.menu.Delegate = new SparkleStatusIconMenuDelegate ();
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private void HideDockIcon ()
|
private void HideDockIcon ()
|
||||||
{
|
{
|
||||||
// Currently not supported, here for completeness sake (see Apple's docs)
|
// Currently not supported by Apple's API
|
||||||
// NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.None;
|
// NSApplication.SharedApplication.ActivationPolicy = NSApplicationActivationPolicy.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,7 @@ using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Security;
|
using System.Net.Security;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Security.Cryptography;
|
|
||||||
|
|
||||||
using SparkleLib;
|
using SparkleLib;
|
||||||
|
|
||||||
|
@ -40,8 +38,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RepositoriesLoaded { get; private set;}
|
public bool RepositoriesLoaded { get; private set;}
|
||||||
|
|
||||||
private List<SparkleRepoBase> repositories = new List<SparkleRepoBase> ();
|
|
||||||
public string FoldersPath { get; private set; }
|
public string FoldersPath { get; private set; }
|
||||||
|
|
||||||
public double ProgressPercentage = 0.0;
|
public double ProgressPercentage = 0.0;
|
||||||
|
@ -63,10 +59,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public event FolderFetchingHandler FolderFetching = delegate { };
|
public event FolderFetchingHandler FolderFetching = delegate { };
|
||||||
public delegate void FolderFetchingHandler (double percentage);
|
public delegate void FolderFetchingHandler (double percentage);
|
||||||
|
|
||||||
|
|
||||||
public event Action FolderListChanged = delegate { };
|
public event Action FolderListChanged = delegate { };
|
||||||
|
|
||||||
|
|
||||||
public event Action OnIdle = delegate { };
|
public event Action OnIdle = delegate { };
|
||||||
public event Action OnSyncing = delegate { };
|
public event Action OnSyncing = delegate { };
|
||||||
public event Action OnError = delegate { };
|
public event Action OnError = delegate { };
|
||||||
|
@ -126,10 +121,6 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public abstract string EventLogHTML { get; }
|
|
||||||
public abstract string DayEntryHTML { get; }
|
|
||||||
public abstract string EventEntryHTML { get; }
|
|
||||||
|
|
||||||
// Path where the plugins are kept
|
// Path where the plugins are kept
|
||||||
public abstract string PluginsPath { get; }
|
public abstract string PluginsPath { get; }
|
||||||
|
|
||||||
|
@ -155,13 +146,18 @@ namespace SparkleShare {
|
||||||
// Opens a file with the appropriate application
|
// Opens a file with the appropriate application
|
||||||
public abstract void OpenWebsite (string url);
|
public abstract void OpenWebsite (string url);
|
||||||
|
|
||||||
|
public abstract string EventLogHTML { get; }
|
||||||
|
public abstract string DayEntryHTML { get; }
|
||||||
|
public abstract string EventEntryHTML { get; }
|
||||||
|
|
||||||
|
|
||||||
private SparkleConfig config;
|
private SparkleConfig config;
|
||||||
private SparkleFetcherBase fetcher;
|
private SparkleFetcherBase fetcher;
|
||||||
private FileSystemWatcher watcher;
|
private FileSystemWatcher watcher;
|
||||||
private Object repo_lock = new Object ();
|
private Object repo_lock = new Object ();
|
||||||
private Object check_repos_lock = new Object ();
|
private Object check_repos_lock = new Object ();
|
||||||
|
private List<string> skipped_avatars = new List<string> ();
|
||||||
|
private List<SparkleRepoBase> repositories = new List<SparkleRepoBase> ();
|
||||||
private bool lost_folders_path = false;
|
private bool lost_folders_path = false;
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +243,7 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
if (this.lost_folders_path) {
|
if (this.lost_folders_path) {
|
||||||
Program.UI.Bubbles.Controller.ShowBubble ("Where's your SparkleShare folder?",
|
Program.UI.Bubbles.Controller.ShowBubble ("Where's your SparkleShare folder?",
|
||||||
"Did you put it on a disattached drive?", null);
|
"Did you put it on a detached drive?", null);
|
||||||
|
|
||||||
Environment.Exit (-1);
|
Environment.Exit (-1);
|
||||||
}
|
}
|
||||||
|
@ -282,6 +278,105 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ShowSetupWindow (PageType page_type)
|
||||||
|
{
|
||||||
|
ShowSetupWindowEvent (page_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ShowAboutWindow ()
|
||||||
|
{
|
||||||
|
ShowAboutWindowEvent ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ShowEventLogWindow ()
|
||||||
|
{
|
||||||
|
ShowEventLogWindowEvent ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OpenSparkleShareFolder ()
|
||||||
|
{
|
||||||
|
OpenFolder (this.config.FoldersPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void OpenSparkleShareFolder (string name)
|
||||||
|
{
|
||||||
|
OpenFolder (new SparkleFolder (name).FullPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ToggleNotifications ()
|
||||||
|
{
|
||||||
|
bool notifications_enabled = this.config.GetConfigOption ("notifications").Equals (bool.TrueString);
|
||||||
|
this.config.SetConfigOption ("notifications", (!notifications_enabled).ToString ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CheckRepositories ()
|
||||||
|
{
|
||||||
|
lock (this.check_repos_lock) {
|
||||||
|
string path = this.config.FoldersPath;
|
||||||
|
|
||||||
|
// Detect any renames
|
||||||
|
foreach (string folder_path in Directory.GetDirectories (path)) {
|
||||||
|
string folder_name = Path.GetFileName (folder_path);
|
||||||
|
|
||||||
|
if (folder_name.Equals (".tmp"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (this.config.GetIdentifierForFolder (folder_name) == null) {
|
||||||
|
string identifier_file_path = Path.Combine (folder_path, ".sparkleshare");
|
||||||
|
|
||||||
|
if (!File.Exists (identifier_file_path))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string identifier = File.ReadAllText (identifier_file_path).Trim ();
|
||||||
|
|
||||||
|
if (this.config.IdentifierExists (identifier)) {
|
||||||
|
RemoveRepository (folder_path);
|
||||||
|
this.config.RenameFolder (identifier, folder_name);
|
||||||
|
|
||||||
|
string new_folder_path = Path.Combine (path, folder_name);
|
||||||
|
AddRepository (new_folder_path);
|
||||||
|
|
||||||
|
SparkleLogger.LogInfo ("Controller",
|
||||||
|
"Renamed folder with identifier " + identifier + " to '" + folder_name + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any deleted folders
|
||||||
|
foreach (string folder_name in this.config.Folders) {
|
||||||
|
string folder_path = new SparkleFolder (folder_name).FullPath;
|
||||||
|
|
||||||
|
if (!Directory.Exists (folder_path)) {
|
||||||
|
this.config.RemoveFolder (folder_name);
|
||||||
|
RemoveRepository (folder_path);
|
||||||
|
|
||||||
|
SparkleLogger.LogInfo ("Controller", "Removed folder '" + folder_name + "' from config");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
AddRepository (folder_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any duplicate folders
|
||||||
|
string previous_name = "";
|
||||||
|
foreach (string folder_name in this.config.Folders) {
|
||||||
|
if (!string.IsNullOrEmpty (previous_name) && folder_name.Equals (previous_name))
|
||||||
|
this.config.RemoveFolder (folder_name);
|
||||||
|
else
|
||||||
|
previous_name = folder_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
FolderListChanged ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AddRepository (string folder_path)
|
private void AddRepository (string folder_path)
|
||||||
{
|
{
|
||||||
SparkleRepoBase repo = null;
|
SparkleRepoBase repo = null;
|
||||||
|
@ -349,8 +444,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
repo.ConflictResolved += delegate {
|
repo.ConflictResolved += delegate {
|
||||||
if (NotificationsEnabled)
|
if (NotificationsEnabled)
|
||||||
AlertNotificationRaised ("Conflict detected",
|
AlertNotificationRaised ("Conflict happened", "Don't worry, we've made a copy of each conflicting file.");
|
||||||
"Don't worry, SparkleShare made a copy of each conflicting file.");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.repositories.Add (repo);
|
this.repositories.Add (repo);
|
||||||
|
@ -364,123 +458,13 @@ namespace SparkleShare {
|
||||||
if (repo.LocalPath.Equals (folder_path)) {
|
if (repo.LocalPath.Equals (folder_path)) {
|
||||||
this.repositories.Remove (repo);
|
this.repositories.Remove (repo);
|
||||||
repo.Dispose ();
|
repo.Dispose ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CheckRepositories ()
|
private void OnFolderActivity (object o, FileSystemEventArgs args)
|
||||||
{
|
|
||||||
lock (this.check_repos_lock) {
|
|
||||||
string path = this.config.FoldersPath;
|
|
||||||
|
|
||||||
// Detect any renames
|
|
||||||
foreach (string folder_path in Directory.GetDirectories (path)) {
|
|
||||||
string folder_name = Path.GetFileName (folder_path);
|
|
||||||
|
|
||||||
if (folder_name.Equals (".tmp"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (this.config.GetIdentifierForFolder (folder_name) == null) {
|
|
||||||
string identifier_file_path = Path.Combine (folder_path, ".sparkleshare");
|
|
||||||
|
|
||||||
if (!File.Exists (identifier_file_path))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string identifier = File.ReadAllText (identifier_file_path).Trim ();
|
|
||||||
|
|
||||||
if (this.config.IdentifierExists (identifier)) {
|
|
||||||
RemoveRepository (folder_path);
|
|
||||||
this.config.RenameFolder (identifier, folder_name);
|
|
||||||
|
|
||||||
string new_folder_path = Path.Combine (path, folder_name);
|
|
||||||
AddRepository (new_folder_path);
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Controller",
|
|
||||||
"Renamed folder with identifier " + identifier + " to '" + folder_name + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove any deleted folders
|
|
||||||
foreach (string folder_name in this.config.Folders) {
|
|
||||||
string folder_path = new SparkleFolder (folder_name).FullPath;
|
|
||||||
|
|
||||||
if (!Directory.Exists (folder_path)) {
|
|
||||||
this.config.RemoveFolder (folder_name);
|
|
||||||
RemoveRepository (folder_path);
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Controller", "Removed folder '" + folder_name + "' from config");
|
|
||||||
|
|
||||||
} else {
|
|
||||||
AddRepository (folder_path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove any duplicate folders
|
|
||||||
string previous_name = "";
|
|
||||||
foreach (string folder_name in this.config.Folders) {
|
|
||||||
if (!string.IsNullOrEmpty (previous_name) && folder_name.Equals (previous_name))
|
|
||||||
this.config.RemoveFolder (folder_name);
|
|
||||||
else
|
|
||||||
previous_name = folder_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderListChanged ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Fires events for the current syncing state
|
|
||||||
private void UpdateState ()
|
|
||||||
{
|
|
||||||
bool has_unsynced_repos = false;
|
|
||||||
|
|
||||||
foreach (SparkleRepoBase repo in Repositories) {
|
|
||||||
if (repo.Status == SyncStatus.SyncDown || repo.Status == SyncStatus.SyncUp || repo.IsBuffering) {
|
|
||||||
OnSyncing ();
|
|
||||||
return;
|
|
||||||
|
|
||||||
} else if (repo.HasUnsyncedChanges) {
|
|
||||||
has_unsynced_repos = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (has_unsynced_repos)
|
|
||||||
OnError ();
|
|
||||||
else
|
|
||||||
OnIdle ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void ClearFolderAttributes (string path)
|
|
||||||
{
|
|
||||||
if (!Directory.Exists (path))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string [] folders = Directory.GetDirectories (path);
|
|
||||||
|
|
||||||
foreach (string folder in folders)
|
|
||||||
ClearFolderAttributes (folder);
|
|
||||||
|
|
||||||
string [] files = Directory.GetFiles(path);
|
|
||||||
|
|
||||||
foreach (string file in files)
|
|
||||||
if (!IsSymlink (file))
|
|
||||||
File.SetAttributes (file, FileAttributes.Normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private bool IsSymlink (string file)
|
|
||||||
{
|
|
||||||
FileAttributes attributes = File.GetAttributes (file);
|
|
||||||
return ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void OnFolderActivity (object o, FileSystemEventArgs args)
|
|
||||||
{
|
{
|
||||||
if (args != null && args.FullPath.EndsWith (".xml") &&
|
if (args != null && args.FullPath.EndsWith (".xml") &&
|
||||||
args.ChangeType == WatcherChangeTypes.Created) {
|
args.ChangeType == WatcherChangeTypes.Created) {
|
||||||
|
@ -499,7 +483,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void HandleInvite (FileSystemEventArgs args)
|
private void HandleInvite (FileSystemEventArgs args)
|
||||||
{
|
{
|
||||||
if (this.fetcher != null &&
|
if (this.fetcher != null &&
|
||||||
this.fetcher.IsActive) {
|
this.fetcher.IsActive) {
|
||||||
|
@ -531,6 +515,28 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Fires events for the current syncing state
|
||||||
|
private void UpdateState ()
|
||||||
|
{
|
||||||
|
bool has_unsynced_repos = false;
|
||||||
|
|
||||||
|
foreach (SparkleRepoBase repo in Repositories) {
|
||||||
|
if (repo.Status == SyncStatus.SyncDown || repo.Status == SyncStatus.SyncUp || repo.IsBuffering) {
|
||||||
|
OnSyncing ();
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if (repo.HasUnsyncedChanges) {
|
||||||
|
has_unsynced_repos = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (has_unsynced_repos)
|
||||||
|
OnError ();
|
||||||
|
else
|
||||||
|
OnIdle ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void StartFetcher (string address, string required_fingerprint,
|
public void StartFetcher (string address, string required_fingerprint,
|
||||||
string remote_path, string announcements_url, bool fetch_prior_history)
|
string remote_path, string announcements_url, bool fetch_prior_history)
|
||||||
{
|
{
|
||||||
|
@ -567,7 +573,6 @@ namespace SparkleShare {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.fetcher.Finished += delegate (bool repo_is_encrypted, bool repo_is_empty, string [] warnings) {
|
this.fetcher.Finished += delegate (bool repo_is_encrypted, bool repo_is_empty, string [] warnings) {
|
||||||
if (repo_is_encrypted && repo_is_empty) {
|
if (repo_is_encrypted && repo_is_empty) {
|
||||||
ShowSetupWindowEvent (PageType.CryptoSetup);
|
ShowSetupWindowEvent (PageType.CryptoSetup);
|
||||||
|
@ -615,6 +620,12 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool CheckPassword (string password)
|
||||||
|
{
|
||||||
|
return this.fetcher.IsFetchedRepoPasswordCorrect (password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void FinishFetcher (string password)
|
public void FinishFetcher (string password)
|
||||||
{
|
{
|
||||||
this.fetcher.EnableFetchedRepoCrypto (password);
|
this.fetcher.EnableFetchedRepoCrypto (password);
|
||||||
|
@ -652,13 +663,20 @@ namespace SparkleShare {
|
||||||
string target_folder_path = Path.Combine (this.config.FoldersPath, target_folder_name);
|
string target_folder_path = Path.Combine (this.config.FoldersPath, target_folder_name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ClearFolderAttributes (this.fetcher.TargetFolder);
|
|
||||||
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Controller", "Error moving directory: " + e.Message);
|
SparkleLogger.LogInfo ("Controller", "Error moving directory: \"" + e.Message + "\", trying again...");
|
||||||
this.watcher.EnableRaisingEvents = true;
|
|
||||||
return;
|
try {
|
||||||
|
ClearDirectoryAttributes (this.fetcher.TargetFolder);
|
||||||
|
Directory.Move (this.fetcher.TargetFolder, target_folder_path);
|
||||||
|
|
||||||
|
} catch (Exception x) {
|
||||||
|
SparkleLogger.LogInfo ("Controller", "Error moving directory: " + x.Message);
|
||||||
|
this.watcher.EnableRaisingEvents = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string backend = SparkleFetcherBase.GetBackend (this.fetcher.RemoteUrl.AbsolutePath);
|
string backend = SparkleFetcherBase.GetBackend (this.fetcher.RemoteUrl.AbsolutePath);
|
||||||
|
@ -678,61 +696,13 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public bool CheckPassword (string password)
|
|
||||||
{
|
|
||||||
return this.fetcher.IsFetchedRepoPasswordCorrect (password);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ShowSetupWindow (PageType page_type)
|
|
||||||
{
|
|
||||||
ShowSetupWindowEvent (page_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ShowAboutWindow ()
|
|
||||||
{
|
|
||||||
ShowAboutWindowEvent ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ShowEventLogWindow ()
|
|
||||||
{
|
|
||||||
ShowEventLogWindowEvent ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void OpenSparkleShareFolder ()
|
|
||||||
{
|
|
||||||
OpenFolder (this.config.FoldersPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void OpenSparkleShareFolder (string name)
|
|
||||||
{
|
|
||||||
OpenFolder (new SparkleFolder (name).FullPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ToggleNotifications () {
|
|
||||||
bool notifications_enabled = this.config.GetConfigOption ("notifications").Equals (bool.TrueString);
|
|
||||||
this.config.SetConfigOption ("notifications", (!notifications_enabled).ToString ());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<string> skipped_avatars = new List<string> ();
|
|
||||||
|
|
||||||
public string GetAvatar (string email, int size)
|
public string GetAvatar (string email, int size)
|
||||||
{
|
{
|
||||||
ServicePointManager.ServerCertificateValidationCallback = GetAvatarValidationCallBack;
|
ServicePointManager.ServerCertificateValidationCallback = GetAvatarValidationCallBack;
|
||||||
|
|
||||||
string fetch_avatars_option = this.config.GetConfigOption ("fetch_avatars");
|
string fetch_avatars_option = this.config.GetConfigOption ("fetch_avatars");
|
||||||
|
|
||||||
if (fetch_avatars_option != null &&
|
if (fetch_avatars_option != null && fetch_avatars_option.Equals (bool.FalseString))
|
||||||
fetch_avatars_option.Equals (bool.FalseString)) {
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
email = email.ToLower ();
|
email = email.ToLower ();
|
||||||
|
|
||||||
|
@ -781,16 +751,24 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool GetAvatarValidationCallBack (Object sender, X509Certificate certificate,
|
public virtual void Quit ()
|
||||||
X509Chain chain, SslPolicyErrors errors)
|
{
|
||||||
|
foreach (SparkleRepoBase repo in Repositories)
|
||||||
|
repo.Dispose ();
|
||||||
|
|
||||||
|
Environment.Exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool GetAvatarValidationCallBack (Object sender,
|
||||||
|
X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
|
||||||
{
|
{
|
||||||
X509Certificate2 certificate2 = new X509Certificate2 (certificate.GetRawCertData ());
|
X509Certificate2 certificate2 = new X509Certificate2 (certificate.GetRawCertData ());
|
||||||
|
|
||||||
// On some systems (mostly Linux) we can't assume the needed certificates are
|
// On some systems (mostly Linux) we can't assume the needed certificates are
|
||||||
// available, so we have to check the certificate's SHA-1 fingerprint manually.
|
// available, so we have to check the certificate's SHA-1 fingerprint manually.
|
||||||
//
|
//
|
||||||
// Obtained from https://www.gravatar.com/ on Aug 18 2012 and
|
// Obtained from https://www.gravatar.com/ on Aug 18 2012 and expires on Oct 24 2015.
|
||||||
// expires on Oct 24 2015.
|
|
||||||
string gravatar_cert_fingerprint = "217ACB08C0A1ACC23A21B6ECDE82CD45E14DEC19";
|
string gravatar_cert_fingerprint = "217ACB08C0A1ACC23A21B6ECDE82CD45E14DEC19";
|
||||||
|
|
||||||
if (certificate2.Thumbprint.Equals (gravatar_cert_fingerprint)) {
|
if (certificate2.Thumbprint.Equals (gravatar_cert_fingerprint)) {
|
||||||
|
@ -803,12 +781,28 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Quit ()
|
private void ClearDirectoryAttributes (string path)
|
||||||
{
|
{
|
||||||
foreach (SparkleRepoBase repo in Repositories)
|
if (!Directory.Exists (path))
|
||||||
repo.Dispose ();
|
return;
|
||||||
|
|
||||||
Environment.Exit (0);
|
string [] folders = Directory.GetDirectories (path);
|
||||||
|
|
||||||
|
foreach (string folder in folders)
|
||||||
|
ClearDirectoryAttributes (folder);
|
||||||
|
|
||||||
|
string [] files = Directory.GetFiles(path);
|
||||||
|
|
||||||
|
foreach (string file in files)
|
||||||
|
if (!IsSymlink (file))
|
||||||
|
File.SetAttributes (file, FileAttributes.Normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool IsSymlink (string file)
|
||||||
|
{
|
||||||
|
FileAttributes attributes = File.GetAttributes (file);
|
||||||
|
return ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace SparkleShare {
|
||||||
Program.Controller.OpenWebsite (url);
|
Program.Controller.OpenWebsite (url);
|
||||||
|
|
||||||
} else if (url.StartsWith ("restore://") && this.restore_revision_info == null) {
|
} else if (url.StartsWith ("restore://") && this.restore_revision_info == null) {
|
||||||
Regex regex = new Regex ("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)", RegexOptions.Compiled);
|
Regex regex = new Regex ("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)");
|
||||||
Match match = regex.Match (url);
|
Match match = regex.Match (url);
|
||||||
|
|
||||||
if (match.Success) {
|
if (match.Success) {
|
||||||
|
|
|
@ -33,29 +33,20 @@ namespace SparkleShare {
|
||||||
if (File.Exists (key_file_path)) {
|
if (File.Exists (key_file_path)) {
|
||||||
SparkleLogger.LogInfo ("Auth", "A key pair exists ('" + key_name + "'), leaving it untouched");
|
SparkleLogger.LogInfo ("Auth", "A key pair exists ('" + key_name + "'), leaving it untouched");
|
||||||
return new string [] { key_file_path, key_file_path + ".pub" };
|
return new string [] { key_file_path, key_file_path + ".pub" };
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!Directory.Exists (output_path))
|
|
||||||
Directory.CreateDirectory (output_path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Process process = new Process ();
|
|
||||||
|
|
||||||
process.StartInfo.FileName = "ssh-keygen";
|
|
||||||
process.StartInfo.WorkingDirectory = output_path;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.CreateNoWindow = true;
|
|
||||||
|
|
||||||
string computer_name = System.Net.Dns.GetHostName ();
|
string computer_name = System.Net.Dns.GetHostName ();
|
||||||
|
|
||||||
if (computer_name.EndsWith (".local"))
|
if (computer_name.EndsWith (".local"))
|
||||||
computer_name = computer_name.Substring (0, computer_name.Length - 6);
|
computer_name = computer_name.Substring (0, computer_name.Length - 6);
|
||||||
|
|
||||||
process.StartInfo.Arguments = "-t rsa " + // crypto type
|
string arguments = "-t rsa " + // crypto type
|
||||||
"-P \"\" " + // empty password
|
"-P \"\" " + // empty password
|
||||||
"-C \"" + computer_name + "\" " + // key comment
|
"-C \"" + computer_name + "\" " + // key comment
|
||||||
"-f \"" + key_name + "\""; // file name
|
"-f \"" + key_name + "\""; // file name
|
||||||
|
|
||||||
|
SparkleKeyProcess process = new SparkleKeyProcess ("ssh-keygen", arguments);
|
||||||
|
process.StartInfo.WorkingDirectory = output_path;
|
||||||
process.Start ();
|
process.Start ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
|
@ -70,14 +61,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public static void ImportPrivateKey (string key_file_path)
|
public static void ImportPrivateKey (string key_file_path)
|
||||||
{
|
{
|
||||||
Process process = new Process ();
|
SparkleKeyProcess process = new SparkleKeyProcess ("ssh-add", "\"" + key_file_path + "\"");
|
||||||
|
|
||||||
process.StartInfo.FileName = "ssh-add";
|
|
||||||
process.StartInfo.Arguments = "\"" + key_file_path + "\"";
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.CreateNoWindow = true;
|
|
||||||
process.StartInfo.RedirectStandardError = true;
|
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
|
@ -90,23 +74,26 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public static void ListPrivateKeys ()
|
public static void ListPrivateKeys ()
|
||||||
{
|
{
|
||||||
Process process = new Process ();
|
SparkleKeyProcess process = new SparkleKeyProcess ("ssh-add", "-l");
|
||||||
|
|
||||||
process.StartInfo.FileName = "ssh-add";
|
|
||||||
process.StartInfo.Arguments = "-l";
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.CreateNoWindow = true;
|
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
// Reading the standard output HAS to go before
|
|
||||||
// WaitForExit, or it will hang forever on output > 4096 bytes
|
|
||||||
string keys_in_use = process.StandardOutput.ReadToEnd ();
|
string keys_in_use = process.StandardOutput.ReadToEnd ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Auth", "The following keys may be used: " +
|
SparkleLogger.LogInfo ("Auth", "The following keys may be used:\n" + keys_in_use.Trim ());
|
||||||
Environment.NewLine + keys_in_use.Trim ());
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class SparkleKeyProcess : Process {
|
||||||
|
|
||||||
|
public SparkleKeyProcess (string command, string arguments) : base ()
|
||||||
|
{
|
||||||
|
StartInfo.FileName = command;
|
||||||
|
StartInfo.Arguments = arguments;
|
||||||
|
StartInfo.UseShellExecute = false;
|
||||||
|
StartInfo.RedirectStandardOutput = true;
|
||||||
|
StartInfo.RedirectStandardError = true;
|
||||||
|
StartInfo.CreateNoWindow = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty (auth_agent_pid)) {
|
if (!string.IsNullOrEmpty (auth_agent_pid)) {
|
||||||
SparkleLogger.LogInfo ("Controller", "Trying to use existing ssh-agent with PID=" + auth_agent_pid + "...");
|
SparkleLogger.LogInfo ("Controller", "Trying to use existing ssh-agent with PID=" + auth_agent_pid + "...");
|
||||||
this.ssh_agent_pid = Convert.ToInt32(auth_agent_pid);
|
this.ssh_agent_pid = Convert.ToInt32 (auth_agent_pid);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Process ssh_agent = Process.GetProcessById (this.ssh_agent_pid);
|
Process ssh_agent = Process.GetProcessById (this.ssh_agent_pid);
|
||||||
|
@ -230,15 +230,13 @@ namespace SparkleShare {
|
||||||
Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", auth_sock_match.Groups [1].Value);
|
Environment.SetEnvironmentVariable ("SSH_AUTH_SOCK", auth_sock_match.Groups [1].Value);
|
||||||
|
|
||||||
if (ssh_pid_match.Success) {
|
if (ssh_pid_match.Success) {
|
||||||
string ssh_pid = ssh_pid_match.Groups [1].Value;
|
Int32.TryParse (ssh_pid_match.Groups [1].Value, out this.ssh_agent_pid);
|
||||||
|
Environment.SetEnvironmentVariable ("SSH_AGENT_PID", this.ssh_agent_pid);
|
||||||
|
|
||||||
Int32.TryParse (ssh_pid, out this.ssh_agent_pid);
|
SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=" + this.ssh_agent_pid);
|
||||||
Environment.SetEnvironmentVariable ("SSH_AGENT_PID", ssh_pid);
|
|
||||||
|
|
||||||
SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=" + ssh_pid);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
SparkleLogger.LogInfo ("Controller", "ssh-agent started, PID=Unknown");
|
SparkleLogger.LogInfo ("Controller", "Could not start ssh-agent:" + output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue