This commit is contained in:
Hylke Bons 2011-10-05 23:26:06 +02:00
commit 4021ef40c5
2 changed files with 29 additions and 5 deletions

View file

@ -65,10 +65,19 @@ namespace SparkleLib {
string [] files = Directory .GetFiles(path);
foreach (string file in files)
File.SetAttributes (file, FileAttributes.Normal);
if (!IsSymlink (file))
File.SetAttributes (file, FileAttributes.Normal);
}
}
// Check if a file is a symbolic link
public static bool IsSymlink (string file)
{
FileAttributes attr = File.GetAttributes (file);
return ((attr & FileAttributes.ReparsePoint) ==
FileAttributes.ReparsePoint);
}
// Converts a UNIX timestamp to a more usable time object
public static DateTime UnixTimestampToDateTime (int timestamp)

View file

@ -113,6 +113,8 @@ namespace SparkleLib {
} catch (SocketException e) {
SparkleHelpers.DebugInfo ("ListenerTcp", "Could not connect to " + Server + ": " + e.Message);
OnDisconnected ();
}
})
);
@ -132,8 +134,14 @@ namespace SparkleLib {
string to_send = "subscribe " + folder_identifier + "\n";
lock (this.mutex) {
this.socket.Send (Encoding.UTF8.GetBytes (to_send));
try {
lock (this.mutex) {
this.socket.Send (Encoding.UTF8.GetBytes (to_send));
}
} catch (SocketException e) {
SparkleHelpers.DebugInfo ("ListenerTcp", "Could not connect to " + Server + ": " + e.Message);
OnDisconnected ();
}
}
}
@ -145,8 +153,15 @@ namespace SparkleLib {
string to_send = "announce " + announcement.FolderIdentifier
+ " " + announcement.Message + "\n";
lock (this.mutex) {
this.socket.Send (Encoding.UTF8.GetBytes (to_send));
try {
lock (this.mutex) {
this.socket.Send (Encoding.UTF8.GetBytes (to_send));
}
} catch (SocketException e) {
SparkleHelpers.DebugInfo ("ListenerTcp", "Could not connect to " + Server + ": " + e.Message);
OnDisconnected ();
}
}