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); string [] files = Directory .GetFiles(path);
foreach (string file in files) foreach (string file in files)
if (!IsSymlink (file))
File.SetAttributes (file, FileAttributes.Normal); 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 // Converts a UNIX timestamp to a more usable time object
public static DateTime UnixTimestampToDateTime (int timestamp) public static DateTime UnixTimestampToDateTime (int timestamp)

View file

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