Fixed the spacing

This commit is contained in:
Konstantinos Vaggelakos 2011-10-10 01:43:33 +02:00
parent 940c5ae159
commit 7f4234a18d
2 changed files with 215 additions and 198 deletions

View file

@ -162,8 +162,10 @@ namespace SparkleShare {
}
public bool FirstRun {
get {
public bool FirstRun
{
get
{
return SparkleConfig.DefaultConfig.User.Email.Equals ("Unknown");
}
}
@ -188,8 +190,8 @@ namespace SparkleShare {
SparkleHelpers.DebugInfo ("WebRequest", url);
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create (url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
if (response.StatusCode == HttpStatusCode.OK) {
response.Close ();
@ -202,8 +204,10 @@ namespace SparkleShare {
}
public List<string> Folders {
get {
public List<string> Folders
{
get
{
List<string> folders = SparkleConfig.DefaultConfig.Folders;
folders.Sort ();
return folders;
@ -211,18 +215,22 @@ namespace SparkleShare {
}
public List<string> PreviousHosts {
get {
public List<string> PreviousHosts
{
get
{
List<string> hosts = SparkleConfig.DefaultConfig.HostsWithUsername;
hosts.AddRange(SparkleConfig.DefaultConfig.Hosts);
hosts.AddRange (SparkleConfig.DefaultConfig.Hosts);
hosts.Sort ();
return hosts;
}
}
public List<string> UnsyncedFolders {
get {
public List<string> UnsyncedFolders
{
get
{
List<string> unsynced_folders = new List<string> ();
foreach (SparkleRepoBase repo in Repositories) {
@ -263,7 +271,7 @@ namespace SparkleShare {
if (name == null)
return GetLog ();
string path = new string [] {SparkleConfig.DefaultConfig.FoldersPath, name}.Combine ();
string path = new string [] { SparkleConfig.DefaultConfig.FoldersPath, name }.Combine ();
int log_size = 50;
foreach (SparkleRepoBase repo in Repositories) {
@ -282,7 +290,7 @@ namespace SparkleShare {
public string GetHTMLLog (List<SparkleChangeSet> change_sets)
{
List <ActivityDay> activity_days = new List <ActivityDay> ();
List<ActivityDay> activity_days = new List<ActivityDay> ();
List<string> emails = new List<string> ();
change_sets.Sort ((x, y) => (x.Timestamp.CompareTo (y.Timestamp)));
@ -497,13 +505,13 @@ namespace SparkleShare {
// TRANSLATORS: This is the date in the event logs
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
activity_day.DateTime.ToString (_("dddd, MMMM d, yyyy")));
activity_day.DateTime.ToString (_ ("dddd, MMMM d, yyyy")));
} else {
// TRANSLATORS: This is the date in the event logs, without the year
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
activity_day.DateTime.ToString (_("dddd, MMMM d")));
activity_day.DateTime.ToString (_ ("dddd, MMMM d")));
}
}
@ -601,11 +609,11 @@ namespace SparkleShare {
};
repo.SyncStatusChanged += delegate (SyncStatus status) {
/* if (status == SyncStatus.SyncUp) {
/* if (status == SyncStatus.SyncUp) {
foreach (string path in repo.UnsyncedFilePaths)
Console.WriteLine (path);
}
*/
*/
if (status == SyncStatus.Idle ||
status == SyncStatus.SyncUp ||
status == SyncStatus.SyncDown ||
@ -669,8 +677,10 @@ namespace SparkleShare {
}
public bool NotificationsEnabled {
get {
public bool NotificationsEnabled
{
get
{
string notifications_enabled =
SparkleConfig.DefaultConfig.GetConfigOption ("notifications");
@ -685,7 +695,8 @@ namespace SparkleShare {
}
public void ToggleNotifications () {
public void ToggleNotifications ()
{
bool notifications_enabled =
SparkleConfig.DefaultConfig.GetConfigOption ("notifications")
.Equals (bool.TrueString);
@ -713,22 +724,22 @@ namespace SparkleShare {
if (change_set.Added.Count > 0) {
file_name = change_set.Added [0];
message = String.Format (_("added {0}"), file_name);
message = String.Format (_ ("added {0}"), file_name);
}
if (change_set.MovedFrom.Count > 0) {
file_name = change_set.MovedFrom [0];
message = String.Format (_("moved {0}"), file_name);
message = String.Format (_ ("moved {0}"), file_name);
}
if (change_set.Edited.Count > 0) {
file_name = change_set.Edited [0];
message = String.Format (_("edited {0}"), file_name);
message = String.Format (_ ("edited {0}"), file_name);
}
if (change_set.Deleted.Count > 0) {
file_name = change_set.Deleted [0];
message = String.Format (_("deleted {0}"), file_name);
message = String.Format (_ ("deleted {0}"), file_name);
}
int changes_count = (change_set.Added.Count +
@ -745,7 +756,7 @@ namespace SparkleShare {
#endif
} else if (changes_count < 0) {
message += _("did something magical");
message += _ ("did something magical");
}
return message;
@ -767,14 +778,14 @@ namespace SparkleShare {
return 0;
try {
foreach (FileInfo file in parent.GetFiles()) {
foreach (FileInfo file in parent.GetFiles ()) {
if (!file.Exists)
return 0;
size += file.Length;
}
foreach (DirectoryInfo directory in parent.GetDirectories())
foreach (DirectoryInfo directory in parent.GetDirectories ())
size += CalculateFolderSize (directory);
} catch (Exception) {
@ -825,8 +836,10 @@ namespace SparkleShare {
}
public bool BackendIsPresent {
get {
public bool BackendIsPresent
{
get
{
return SparkleBackend.DefaultBackend.IsPresent;
}
}
@ -835,11 +848,13 @@ namespace SparkleShare {
// Looks up the user's name from the global configuration
public string UserName
{
get {
get
{
return SparkleConfig.DefaultConfig.User.Name;
}
set {
set
{
SparkleConfig.DefaultConfig.User = new SparkleUser (value, UserEmail);
}
}
@ -848,11 +863,13 @@ namespace SparkleShare {
// Looks up the user's email from the global configuration
public string UserEmail
{
get {
get
{
return SparkleConfig.DefaultConfig.User.Email;
}
set {
set
{
SparkleConfig.DefaultConfig.User = new SparkleUser (UserName, value);
}
}
@ -996,7 +1013,7 @@ namespace SparkleShare {
string backend = null;
/* if (remote_folder.EndsWith (".hg")) {
/* if (remote_folder.EndsWith (".hg")) {
remote_folder = remote_folder.Substring (0, (remote_folder.Length - 3));
fetcher = new SparkleFetcherHg (server, remote_folder, tmp_folder);
backend = "Hg";
@ -1093,8 +1110,8 @@ namespace SparkleShare {
private string GetMD5 (string s)
{
MD5 md5 = new MD5CryptoServiceProvider ();
Byte[] bytes = ASCIIEncoding.Default.GetBytes (s);
Byte[] encoded_bytes = md5.ComputeHash (bytes);
Byte [] bytes = ASCIIEncoding.Default.GetBytes (s);
Byte [] encoded_bytes = md5.ComputeHash (bytes);
return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", "");
}
@ -1132,7 +1149,7 @@ namespace SparkleShare {
// Also kill the SSH_AGENT
try {
// Check if we created the process, if so bring it down. Else leave it running
if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals("unknown")) {
if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals ("unknown")) {
int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID"));
Process.GetProcessById (pid).Kill ();
}
@ -1180,8 +1197,7 @@ namespace SparkleShare {
// All change sets that happened on a day
public class ActivityDay : List <SparkleChangeSet>
{
public class ActivityDay : List<SparkleChangeSet> {
public DateTime DateTime;
public ActivityDay (DateTime date_time)

View file

@ -30,7 +30,8 @@ namespace SparkleShare {
public class SparkleController : SparkleControllerBase {
public SparkleController () : base ()
public SparkleController ()
: base ()
{
}
@ -52,7 +53,7 @@ namespace SparkleShare {
// Add msysgit to path, as we cannot asume it is added to the path
// Asume it is installed in @"C:\msysgit\bin" for now
string MSysGit=@"C:\msysgit";
string MSysGit = @"C:\msysgit";
string newPath = MSysGit + @"\bin" + ";"
+ MSysGit + @"\mingw\bin" + ";"
@ -64,7 +65,7 @@ namespace SparkleShare {
if (String.IsNullOrEmpty (System.Environment.GetEnvironmentVariable ("HOME")))
System.Environment.SetEnvironmentVariable ("HOME", Environment.ExpandEnvironmentVariables ("%HOMEDRIVE%%HOMEPATH%"));
StartSshAgent();
StartSshAgent ();
base.Initialize ();
}
@ -149,11 +150,11 @@ namespace SparkleShare {
public override void OpenSparkleShareFolder (string subfolder)
{
Process process = new Process();
process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore(SparklePaths.SparklePath, subfolder);
Process process = new Process ();
process.StartInfo.Arguments = ",/root," + SparkleHelpers.CombineMore (SparklePaths.SparklePath, subfolder);
process.StartInfo.FileName = "explorer";
process.Start();
process.Start ();
}
private void StartSshAgent ()