Merge branch 'conflicts-fix'
This commit is contained in:
commit
d327948481
|
@ -13,7 +13,6 @@ SOURCES = \
|
||||||
SparkleListener.cs \
|
SparkleListener.cs \
|
||||||
SparkleOptions.cs \
|
SparkleOptions.cs \
|
||||||
SparklePaths.cs \
|
SparklePaths.cs \
|
||||||
SparklePlatform.cs \
|
|
||||||
SparkleRepo.cs
|
SparkleRepo.cs
|
||||||
|
|
||||||
SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file))
|
SMARTIRC4NET_FILES_EXPANDED = $(foreach file, $(SMARTIRC4NET_FILES), $(top_builddir)/$(file))
|
||||||
|
|
|
@ -14,39 +14,24 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
public class SparkleCommit
|
public class SparkleCommit {
|
||||||
{
|
|
||||||
|
|
||||||
public string UserName;
|
public string UserName;
|
||||||
public string UserEmail;
|
public string UserEmail;
|
||||||
public DateTime DateTime;
|
public string Hash;
|
||||||
public string Hash;
|
public DateTime DateTime;
|
||||||
public bool IsMerge;
|
public bool IsMerge = false;
|
||||||
|
public List<string> Added = new List<string> ();
|
||||||
public List <string> Added;
|
public List<string> Deleted = new List<string> ();
|
||||||
public List <string> Deleted;
|
public List<string> Edited = new List<string> ();
|
||||||
public List <string> Edited;
|
public List<string> MovedFrom = new List<string> ();
|
||||||
public List <string> MovedFrom;
|
public List<string> MovedTo = new List<string> ();
|
||||||
public List <string> MovedTo;
|
|
||||||
|
|
||||||
public SparkleCommit ()
|
|
||||||
{
|
|
||||||
|
|
||||||
Edited = new List <string> ();
|
|
||||||
Added = new List <string> ();
|
|
||||||
Deleted = new List <string> ();
|
|
||||||
MovedFrom = new List <string> ();
|
|
||||||
MovedTo = new List <string> ();
|
|
||||||
|
|
||||||
IsMerge = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,26 +19,21 @@ using System;
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
// Arguments for most events
|
// Arguments for most events
|
||||||
public class SparkleEventArgs : System.EventArgs {
|
public class SparkleEventArgs : EventArgs {
|
||||||
|
|
||||||
public string Type;
|
public string Type;
|
||||||
public string Message;
|
public string Message;
|
||||||
|
|
||||||
|
|
||||||
public SparkleEventArgs (string type)
|
public SparkleEventArgs (string type)
|
||||||
{
|
{
|
||||||
|
|
||||||
Type = type;
|
Type = type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Arguments for the NewCommit event
|
// Arguments for the NewCommit event
|
||||||
public class NewCommitArgs : System.EventArgs {
|
public class NewCommitArgs : EventArgs {
|
||||||
|
|
||||||
|
|
||||||
public string Author;
|
public string Author;
|
||||||
public string Email;
|
public string Email;
|
||||||
public string Message;
|
public string Message;
|
||||||
|
@ -46,14 +41,10 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public NewCommitArgs (string author, string email, string message, string repository_path)
|
public NewCommitArgs (string author, string email, string message, string repository_path)
|
||||||
{
|
{
|
||||||
|
|
||||||
Author = author;
|
Author = author;
|
||||||
Email = email;
|
Email = email;
|
||||||
Message = message;
|
Message = message;
|
||||||
RepositoryPath = repository_path;
|
RepositoryPath = repository_path;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,96 +18,86 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Timers;
|
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
// A helper class that fetches and configures
|
// A helper class that fetches and configures
|
||||||
// a remote repository
|
// a remote repository
|
||||||
public class SparkleFetcher {
|
public class SparkleFetcher {
|
||||||
|
|
||||||
public delegate void CloningStartedEventHandler (object o, SparkleEventArgs args);
|
// TODO: remove 'cloning' prefix
|
||||||
public delegate void CloningFinishedEventHandler (object o, SparkleEventArgs args);
|
public delegate void CloningStartedEventHandler (object o, SparkleEventArgs args);
|
||||||
public delegate void CloningFailedEventHandler (object o, SparkleEventArgs args);
|
public delegate void CloningFinishedEventHandler (object o, SparkleEventArgs args);
|
||||||
|
public delegate void CloningFailedEventHandler (object o, SparkleEventArgs args);
|
||||||
|
|
||||||
public event CloningStartedEventHandler CloningStarted;
|
public event CloningStartedEventHandler CloningStarted;
|
||||||
public event CloningFinishedEventHandler CloningFinished;
|
public event CloningFinishedEventHandler CloningFinished;
|
||||||
public event CloningFailedEventHandler CloningFailed;
|
public event CloningFailedEventHandler CloningFailed;
|
||||||
|
|
||||||
private string TargetFolder;
|
private string TargetFolder;
|
||||||
private string RemoteOriginUrl;
|
private string RemoteOriginUrl;
|
||||||
|
|
||||||
|
|
||||||
public SparkleFetcher (string url, string folder)
|
public SparkleFetcher (string url, string folder)
|
||||||
{
|
{
|
||||||
|
TargetFolder = folder;
|
||||||
TargetFolder = folder;
|
RemoteOriginUrl = url;
|
||||||
RemoteOriginUrl = url;
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Clones the remote repository
|
// Clones the remote repository
|
||||||
public void Start ()
|
public void Start ()
|
||||||
{
|
{
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Cloning Repository");
|
||||||
|
|
||||||
if (Directory.Exists (TargetFolder))
|
if (Directory.Exists (TargetFolder))
|
||||||
Directory.Delete (TargetFolder, true);
|
Directory.Delete (TargetFolder, true);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Cloning Repository");
|
|
||||||
|
|
||||||
if (CloningStarted != null)
|
|
||||||
CloningStarted (this, new SparkleEventArgs ("CloningStarted"));
|
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (SparklePaths.SparkleTmpPath,
|
|
||||||
|
if (CloningStarted != null)
|
||||||
|
CloningStarted (this, new SparkleEventArgs ("CloningStarted"));
|
||||||
|
|
||||||
|
SparkleGit git = new SparkleGit (SparklePaths.SparkleTmpPath,
|
||||||
"clone \"" + RemoteOriginUrl + "\" " + "\"" + TargetFolder + "\"");
|
"clone \"" + RemoteOriginUrl + "\" " + "\"" + TargetFolder + "\"");
|
||||||
|
|
||||||
git.Exited += delegate {
|
git.Exited += delegate {
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "Exit code " + git.ExitCode.ToString ());
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "Exit code " + git.ExitCode.ToString ());
|
if (git.ExitCode != 0) {
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Cloning failed");
|
||||||
|
|
||||||
if (git.ExitCode != 0) {
|
if (CloningFailed != null)
|
||||||
|
CloningFailed (this, new SparkleEventArgs ("CloningFailed"));
|
||||||
|
} else {
|
||||||
|
InstallConfiguration ();
|
||||||
|
InstallExcludeRules ();
|
||||||
|
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned");
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Cloning failed");
|
if (CloningFinished != null)
|
||||||
|
CloningFinished (this, new SparkleEventArgs ("CloningFinished"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (CloningFailed != null)
|
git.Start ();
|
||||||
CloningFailed (this, new SparkleEventArgs ("CloningFailed"));
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
InstallConfiguration ();
|
|
||||||
InstallExcludeRules ();
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + TargetFolder + "] Repository cloned");
|
|
||||||
|
|
||||||
if (CloningFinished != null)
|
|
||||||
CloningFinished (this, new SparkleEventArgs ("CloningFinished"));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
git.Start ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Install the user's name and email and some config into
|
// Install the user's name and email and some config into
|
||||||
// the newly cloned repository
|
// the newly cloned repository
|
||||||
private void InstallConfiguration ()
|
private void InstallConfiguration ()
|
||||||
{
|
{
|
||||||
|
string global_config_file_path = Path.Combine (SparklePaths.SparkleConfigPath, "config");
|
||||||
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
|
|
||||||
|
|
||||||
if (File.Exists (global_config_file_path)) {
|
if (File.Exists (global_config_file_path)) {
|
||||||
|
|
||||||
StreamReader reader = new StreamReader (global_config_file_path);
|
StreamReader reader = new StreamReader (global_config_file_path);
|
||||||
string user_info = reader.ReadToEnd ();
|
string user_info = reader.ReadToEnd ();
|
||||||
reader.Close ();
|
reader.Close ();
|
||||||
|
|
||||||
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
|
string repo_config_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "config");
|
||||||
|
|
||||||
string config = String.Join ("\n", File.ReadAllLines (repo_config_file_path));
|
string config = String.Join ("\n", File.ReadAllLines (repo_config_file_path));
|
||||||
|
|
||||||
|
// Be case sensitive explicitly to work on Mac
|
||||||
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
||||||
config += Environment.NewLine + user_info;
|
config += Environment.NewLine + user_info;
|
||||||
|
|
||||||
|
@ -116,60 +106,54 @@ namespace SparkleLib {
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Config", "Added configuration to '" + repo_config_file_path + "'");
|
SparkleHelpers.DebugInfo ("Config", "Added configuration to '" + repo_config_file_path + "'");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add a .gitignore file to the repo
|
// Add a .gitignore file to the repo
|
||||||
private void InstallExcludeRules ()
|
private void InstallExcludeRules ()
|
||||||
{
|
{
|
||||||
|
string exlude_rules_file_path = SparkleHelpers.CombineMore (
|
||||||
|
TargetFolder, ".git", "info", "exclude");
|
||||||
|
|
||||||
string exlude_rules_file_path = SparkleHelpers.CombineMore
|
TextWriter writer = new StreamWriter (exlude_rules_file_path);
|
||||||
(TargetFolder, ".git", "info", "exclude");
|
|
||||||
|
|
||||||
TextWriter writer = new StreamWriter (exlude_rules_file_path);
|
// gedit and emacs
|
||||||
|
writer.WriteLine ("*~");
|
||||||
|
|
||||||
// gedit and emacs
|
// vi(m)
|
||||||
writer.WriteLine ("*~");
|
writer.WriteLine (".*.sw[a-z]");
|
||||||
|
writer.WriteLine ("*.un~");
|
||||||
|
writer.WriteLine ("*.swp");
|
||||||
|
writer.WriteLine ("*.swo");
|
||||||
|
|
||||||
|
// KDE
|
||||||
|
writer.WriteLine (".directory");
|
||||||
|
|
||||||
|
// Mac OSX
|
||||||
|
writer.WriteLine (".DS_Store");
|
||||||
|
writer.WriteLine ("Icon?");
|
||||||
|
writer.WriteLine ("._*");
|
||||||
|
writer.WriteLine (".Spotlight-V100");
|
||||||
|
writer.WriteLine (".Trashes");
|
||||||
|
|
||||||
// vi(m)
|
// Mac OSX
|
||||||
writer.WriteLine (".*.sw[a-z]");
|
writer.WriteLine ("*(Autosaved).graffle");
|
||||||
writer.WriteLine ("*.un~");
|
|
||||||
writer.WriteLine ("*.swp");
|
// Windows
|
||||||
writer.WriteLine ("*.swo");
|
writer.WriteLine ("Thumbs.db");
|
||||||
|
writer.WriteLine ("Desktop.ini");
|
||||||
// KDE
|
|
||||||
writer.WriteLine (".directory");
|
|
||||||
|
|
||||||
// Mac OSX
|
|
||||||
writer.WriteLine (".DS_Store");
|
|
||||||
writer.WriteLine ("Icon?");
|
|
||||||
writer.WriteLine ("._*");
|
|
||||||
writer.WriteLine (".Spotlight-V100");
|
|
||||||
writer.WriteLine (".Trashes");
|
|
||||||
|
|
||||||
// Mac OSX
|
// CVS
|
||||||
writer.WriteLine ("*(Autosaved).graffle");
|
writer.WriteLine ("*/CVS/*");
|
||||||
|
writer.WriteLine (".cvsignore");
|
||||||
// Windows
|
writer.WriteLine ("*/.cvsignore");
|
||||||
writer.WriteLine ("Thumbs.db");
|
|
||||||
writer.WriteLine ("Desktop.ini");
|
// Subversion
|
||||||
|
writer.WriteLine ("/.svn/*");
|
||||||
|
writer.WriteLine ("*/.svn/*");
|
||||||
|
|
||||||
// CVS
|
writer.Close ();
|
||||||
writer.WriteLine ("*/CVS/*");
|
}
|
||||||
writer.WriteLine (".cvsignore");
|
}
|
||||||
writer.WriteLine ("*/.cvsignore");
|
|
||||||
|
|
||||||
// Subversion
|
|
||||||
writer.WriteLine ("/.svn/*");
|
|
||||||
writer.WriteLine ("*/.svn/*");
|
|
||||||
|
|
||||||
writer.Close ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,17 +20,17 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
public class SparkleGit : Process {
|
public class SparkleGit : Process {
|
||||||
|
|
||||||
public SparkleGit (string path, string args) : base ()
|
public SparkleGit (string path, string args) : base ()
|
||||||
{
|
{
|
||||||
EnableRaisingEvents = true;
|
EnableRaisingEvents = true;
|
||||||
StartInfo.FileName = SparklePaths.GitPath;
|
StartInfo.FileName = SparklePaths.GitPath;
|
||||||
StartInfo.Arguments = args;
|
StartInfo.Arguments = args;
|
||||||
StartInfo.RedirectStandardOutput = true;
|
StartInfo.RedirectStandardOutput = true;
|
||||||
StartInfo.UseShellExecute = false;
|
StartInfo.UseShellExecute = false;
|
||||||
StartInfo.WorkingDirectory = path;
|
StartInfo.WorkingDirectory = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
new public void Start ()
|
new public void Start ()
|
||||||
|
@ -38,5 +38,5 @@ namespace SparkleLib {
|
||||||
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments);
|
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments);
|
||||||
base.Start ();
|
base.Start ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,126 +25,105 @@ using Meebey.SmartIrc4net;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
|
||||||
public enum NotificationServerType
|
public enum NotificationServerType
|
||||||
{
|
{
|
||||||
|
Own,
|
||||||
Own,
|
Central
|
||||||
Central
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// A persistent connection to the server that
|
// A persistent connection to the server that
|
||||||
// listens for change notifications
|
// listens for change notifications
|
||||||
public class SparkleListener {
|
public class SparkleListener {
|
||||||
|
|
||||||
// FIXME: The IrcClient is a public property because
|
private Thread Thread;
|
||||||
// extending it causes crashes
|
|
||||||
public IrcClient Client;
|
// FIXME: The IrcClient is a public property because
|
||||||
private Thread Thread;
|
// extending it causes crashes
|
||||||
public readonly string Server;
|
public IrcClient Client;
|
||||||
public readonly string FallbackServer;
|
public readonly string Server;
|
||||||
public readonly string Channel;
|
public readonly string FallbackServer;
|
||||||
public readonly string Nick;
|
public readonly string Channel;
|
||||||
|
public readonly string Nick;
|
||||||
|
|
||||||
|
|
||||||
public SparkleListener (string server, string folder_name,
|
public SparkleListener (string server, string folder_name,
|
||||||
string user_email, NotificationServerType type)
|
string user_email, NotificationServerType type)
|
||||||
{
|
{
|
||||||
|
if (type == NotificationServerType.Own) {
|
||||||
|
Server = server;
|
||||||
|
} else {
|
||||||
|
|
||||||
if (type == NotificationServerType.Own) {
|
// This is SparkleShare's centralized notification service.
|
||||||
|
// Don't worry, we only use this server as a backup if you
|
||||||
|
// don't have your own. All data needed to connect is hashed and
|
||||||
|
// we don't store any personal information ever.
|
||||||
|
Server = "204.62.14.135";
|
||||||
|
}
|
||||||
|
|
||||||
Server = server;
|
if (!String.IsNullOrEmpty (user_email))
|
||||||
|
Nick = SHA1 (folder_name + user_email + "sparkles");
|
||||||
|
else
|
||||||
|
Nick = SHA1 (DateTime.Now.ToString () + "sparkles");
|
||||||
|
|
||||||
} else {
|
Nick = "s" + Nick.Substring (0, 7);
|
||||||
|
Channel = "#" + SHA1 (server + folder_name + "sparkles");
|
||||||
|
|
||||||
// This is SparkleShare's centralized notification service.
|
Client = new IrcClient () {
|
||||||
// Don't worry, we only use this server as a backup if you
|
PingTimeout = 180,
|
||||||
// don't have your own. All data needed to connect is hashed and
|
PingInterval = 90
|
||||||
// we don't store any personal information ever.
|
};
|
||||||
Server = "204.62.14.135";
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user_email.Equals ("") && user_email != null)
|
|
||||||
Nick = GetSHA1 (folder_name + user_email + "sparkles");
|
|
||||||
else
|
|
||||||
Nick = GetSHA1 (DateTime.Now.ToString () + "sparkles");
|
|
||||||
|
|
||||||
Nick = "s" + Nick.Substring (0, 7);
|
|
||||||
Channel = "#" + GetSHA1 (server + folder_name + "sparkles");
|
|
||||||
|
|
||||||
Client = new IrcClient () {
|
|
||||||
PingTimeout = 180,
|
|
||||||
PingInterval = 90
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Starts a new thread and listens to the channel
|
// Starts a new thread and listens to the channel
|
||||||
public void Listen ()
|
public void Listen ()
|
||||||
{
|
{
|
||||||
|
Thread = new Thread (
|
||||||
|
new ThreadStart (delegate {
|
||||||
|
try {
|
||||||
|
|
||||||
Thread = new Thread (
|
// Connect, login, and join the channel
|
||||||
new ThreadStart (delegate {
|
Client.Connect (new string [] {Server}, 6667);
|
||||||
|
Client.Login (Nick, Nick);
|
||||||
|
Client.RfcJoin (Channel);
|
||||||
|
|
||||||
try {
|
// List to the channel, this blocks the thread
|
||||||
|
Client.Listen ();
|
||||||
|
Client.Disconnect ();
|
||||||
|
} catch (Meebey.SmartIrc4net.ConnectionException e) {
|
||||||
|
Console.WriteLine ("Could not connect: " + e.Message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
// Connect to the server
|
Thread.Start ();
|
||||||
Client.Connect (new string [] {Server}, 6667);
|
}
|
||||||
|
|
||||||
// Login to the server
|
|
||||||
Client.Login (Nick, Nick);
|
|
||||||
|
|
||||||
// Join the channel
|
|
||||||
Client.RfcJoin (Channel);
|
|
||||||
|
|
||||||
Client.Listen ();
|
|
||||||
|
|
||||||
Client.Disconnect ();
|
|
||||||
|
|
||||||
} catch (Meebey.SmartIrc4net.ConnectionException e) {
|
|
||||||
|
|
||||||
Console.WriteLine ("Could not connect: " + e.Message);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
Thread.Start ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Announce (string message)
|
|
||||||
{
|
|
||||||
|
|
||||||
Client.SendMessage (SendType.Message, Channel, message);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Frees all resources for this Listener
|
public void Announce (string message)
|
||||||
public void Dispose ()
|
{
|
||||||
{
|
Client.SendMessage (SendType.Message, Channel, message);
|
||||||
|
}
|
||||||
|
|
||||||
Thread.Abort ();
|
|
||||||
Thread.Join ();
|
|
||||||
|
|
||||||
}
|
// Frees all resources for this Listener
|
||||||
|
public void Dispose ()
|
||||||
|
{
|
||||||
|
Thread.Abort ();
|
||||||
|
Thread.Join ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates an SHA-1 hash of input
|
// Creates an SHA-1 hash of input
|
||||||
private static string GetSHA1 (string s)
|
private string SHA1 (string s)
|
||||||
{
|
{
|
||||||
SHA1 sha1 = new SHA1CryptoServiceProvider ();
|
SHA1 sha1 = new SHA1CryptoServiceProvider ();
|
||||||
Byte[] bytes = ASCIIEncoding.Default.GetBytes (s);
|
Byte[] bytes = ASCIIEncoding.Default.GetBytes (s);
|
||||||
Byte[] encoded_bytes = sha1.ComputeHash (bytes);
|
Byte[] encoded_bytes = sha1.ComputeHash (bytes);
|
||||||
return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", "");
|
return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,7 @@ namespace SparkleLib {
|
||||||
public static string Name = "Git";
|
public static string Name = "Git";
|
||||||
|
|
||||||
public static string Path {
|
public static string Path {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
|
||||||
string [] possible_git_paths = {"/usr/bin/git",
|
string [] possible_git_paths = {"/usr/bin/git",
|
||||||
"/usr/local/git/bin/git",
|
"/usr/local/git/bin/git",
|
||||||
"/usr/local/bin/git"};
|
"/usr/local/bin/git"};
|
||||||
|
@ -38,37 +36,29 @@ namespace SparkleLib {
|
||||||
return git_path;
|
return git_path;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool IsPresent {
|
public static bool IsPresent {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
|
||||||
return (Path != null);
|
return (Path != null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class SparklePaths {
|
|
||||||
|
|
||||||
public static string GitPath = Backend.Path;
|
|
||||||
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;
|
|
||||||
public static string SparklePath = Path.Combine (HomePath ,"SparkleShare");
|
|
||||||
public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp");
|
|
||||||
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
|
||||||
public static string SparkleKeysPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
|
||||||
public static string SparkleInstallPath = Path.Combine (Defines.PREFIX, "sparkleshare");
|
|
||||||
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons");
|
|
||||||
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "icons");
|
|
||||||
|
|
||||||
}
|
public static class SparklePaths {
|
||||||
|
|
||||||
|
public static string GitPath = Backend.Path;
|
||||||
|
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;
|
||||||
|
public static string SparklePath = Path.Combine (HomePath ,"SparkleShare");
|
||||||
|
public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp");
|
||||||
|
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
||||||
|
public static string SparkleKeysPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
||||||
|
public static string SparkleInstallPath = Path.Combine (Defines.PREFIX, "sparkleshare");
|
||||||
|
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons");
|
||||||
|
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare", "icons");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
// SparkleShare, an instant update workflow to Git.
|
|
||||||
// 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 SparkleShare {
|
|
||||||
|
|
||||||
public static class SparklePlatform {
|
|
||||||
|
|
||||||
// Detect OSX, Windows, GNOME or KDE here
|
|
||||||
public static string Name = "GNOME";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -682,29 +682,23 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
public bool NotificationsEnabled {
|
public bool NotificationsEnabled {
|
||||||
|
|
||||||
get {
|
get {
|
||||||
|
string notify_setting_file_path = Path.Combine (SparklePaths.SparkleConfigPath,
|
||||||
string notify_setting_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
|
||||||
"sparkleshare.notify");
|
"sparkleshare.notify");
|
||||||
|
|
||||||
return File.Exists (notify_setting_file_path);
|
return File.Exists (notify_setting_file_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ToggleNotifications () {
|
public void ToggleNotifications () {
|
||||||
|
string notify_setting_file_path = Path.Combine (SparklePaths.SparkleConfigPath,
|
||||||
string notify_setting_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
|
||||||
"sparkleshare.notify");
|
"sparkleshare.notify");
|
||||||
|
|
||||||
if (File.Exists (notify_setting_file_path))
|
if (File.Exists (notify_setting_file_path))
|
||||||
File.Delete (notify_setting_file_path);
|
File.Delete (notify_setting_file_path);
|
||||||
else
|
else
|
||||||
File.Create (notify_setting_file_path);
|
File.Create (notify_setting_file_path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -645,6 +645,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Button button = new Button () {
|
Button button = new Button () {
|
||||||
Sensitive = false,
|
Sensitive = false,
|
||||||
Label = _("Finish")
|
Label = _("Finish")
|
||||||
|
@ -671,6 +672,16 @@ namespace SparkleShare {
|
||||||
|
|
||||||
box.PackStart (table, false, false, 0);
|
box.PackStart (table, false, false, 0);
|
||||||
|
|
||||||
|
Progressbar bar = new Progressbar ();
|
||||||
|
box.PackStart (bar, true, true, 0);
|
||||||
|
Timer timer = new Timer () {
|
||||||
|
Interval = 500
|
||||||
|
};
|
||||||
|
timer.Elapsed += delegate {
|
||||||
|
bar.Pulse ();
|
||||||
|
};
|
||||||
|
timer.Start ();
|
||||||
|
|
||||||
layout_vertical.PackStart (box, false, false, 0);
|
layout_vertical.PackStart (box, false, false, 0);
|
||||||
|
|
||||||
Add (layout_vertical);
|
Add (layout_vertical);
|
||||||
|
|
Loading…
Reference in a new issue