Fix whitespace for last commit
This commit is contained in:
parent
71f476e255
commit
38cb2499ea
|
@ -88,44 +88,44 @@ namespace SparkleLib {
|
||||||
{
|
{
|
||||||
this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath,
|
this.git = new SparkleGit (SparkleConfig.DefaultConfig.TmpPath,
|
||||||
"clone " +
|
"clone " +
|
||||||
"--progress " + // Redirects progress stats to standarderror
|
"--progress " + // Redirects progress stats to standarderror
|
||||||
"\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\"");
|
"\"" + base.remote_url + "\" " + "\"" + base.target_folder + "\"");
|
||||||
|
|
||||||
this.git.StartInfo.RedirectStandardError = true;
|
this.git.StartInfo.RedirectStandardError = true;
|
||||||
this.git.Start ();
|
this.git.Start ();
|
||||||
|
|
||||||
double percentage = 1.0;
|
double percentage = 1.0;
|
||||||
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||||
|
|
||||||
while (!this.git.StandardError.EndOfStream) {
|
while (!this.git.StandardError.EndOfStream) {
|
||||||
string line = this.git.StandardError.ReadLine ();
|
string line = this.git.StandardError.ReadLine ();
|
||||||
Match match = progress_regex.Match (line);
|
Match match = progress_regex.Match (line);
|
||||||
|
|
||||||
double number = 0.0;
|
double number = 0.0;
|
||||||
if (match.Success) {
|
if (match.Success) {
|
||||||
number = double.Parse (match.Groups [1].Value);
|
number = double.Parse (match.Groups [1].Value);
|
||||||
|
|
||||||
// The cloning progress consists of two stages: the "Compressing
|
// The cloning progress consists of two stages: the "Compressing
|
||||||
// objects" stage which we count as 20% of the total progress, and
|
// objects" stage which we count as 20% of the total progress, and
|
||||||
// the "Receiving objects" stage which we count as the last 80%
|
// the "Receiving objects" stage which we count as the last 80%
|
||||||
if (line.Contains ("|"))
|
if (line.Contains ("|"))
|
||||||
// "Receiving objects" stage
|
// "Receiving objects" stage
|
||||||
number = (number / 100 * 75 + 20);
|
number = (number / 100 * 75 + 20);
|
||||||
else
|
else
|
||||||
// "Compressing objects" stage
|
// "Compressing objects" stage
|
||||||
number = (number / 100 * 20);
|
number = (number / 100 * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number >= percentage) {
|
if (number >= percentage) {
|
||||||
percentage = number;
|
percentage = number;
|
||||||
|
|
||||||
// FIXME: for some reason it doesn't go above 95%
|
// FIXME: for some reason it doesn't go above 95%
|
||||||
base.OnProgressChanged (percentage);
|
base.OnProgressChanged (percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Threading.Thread.Sleep (100);
|
System.Threading.Thread.Sleep (100);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.git.WaitForExit ();
|
this.git.WaitForExit ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "Exit code " + this.git.ExitCode.ToString ());
|
SparkleHelpers.DebugInfo ("Git", "Exit code " + this.git.ExitCode.ToString ());
|
||||||
|
|
|
@ -31,12 +31,12 @@ namespace SparkleLib {
|
||||||
public delegate void StartedEventHandler ();
|
public delegate void StartedEventHandler ();
|
||||||
public delegate void FinishedEventHandler ();
|
public delegate void FinishedEventHandler ();
|
||||||
public delegate void FailedEventHandler ();
|
public delegate void FailedEventHandler ();
|
||||||
public delegate void ProgressChangedEventHandler (double percentage);
|
public delegate void ProgressChangedEventHandler (double percentage);
|
||||||
|
|
||||||
public event StartedEventHandler Started;
|
public event StartedEventHandler Started;
|
||||||
public event FinishedEventHandler Finished;
|
public event FinishedEventHandler Finished;
|
||||||
public event FailedEventHandler Failed;
|
public event FailedEventHandler Failed;
|
||||||
public event ProgressChangedEventHandler ProgressChanged;
|
public event ProgressChangedEventHandler ProgressChanged;
|
||||||
|
|
||||||
protected string target_folder;
|
protected string target_folder;
|
||||||
protected string remote_url;
|
protected string remote_url;
|
||||||
|
@ -119,13 +119,13 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void OnProgressChanged (double percentage) {
|
protected void OnProgressChanged (double percentage) {
|
||||||
if (ProgressChanged != null)
|
if (ProgressChanged != null)
|
||||||
ProgressChanged (percentage);
|
ProgressChanged (percentage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DisableHostKeyCheckingForHost (string host)
|
private void DisableHostKeyCheckingForHost (string host)
|
||||||
{
|
{
|
||||||
string path = SparkleConfig.DefaultConfig.HomePath;
|
string path = SparkleConfig.DefaultConfig.HomePath;
|
||||||
|
|
|
@ -28,32 +28,32 @@ using MonoMac.WebKit;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleSetup : SparkleSetupWindow {
|
public class SparkleSetup : SparkleSetupWindow {
|
||||||
|
|
||||||
public SparkleSetupController Controller = new SparkleSetupController ();
|
public SparkleSetupController Controller = new SparkleSetupController ();
|
||||||
|
|
||||||
private NSButton ContinueButton;
|
private NSButton ContinueButton;
|
||||||
private NSButton SyncButton;
|
private NSButton SyncButton;
|
||||||
private NSButton TryAgainButton;
|
private NSButton TryAgainButton;
|
||||||
private NSButton CancelButton;
|
private NSButton CancelButton;
|
||||||
private NSButton OpenFolderButton;
|
private NSButton OpenFolderButton;
|
||||||
private NSButton FinishButton;
|
private NSButton FinishButton;
|
||||||
private NSForm UserInfoForm;
|
private NSForm UserInfoForm;
|
||||||
private NSProgressIndicator ProgressIndicator;
|
private NSProgressIndicator ProgressIndicator;
|
||||||
private NSTextField AddressTextField;
|
private NSTextField AddressTextField;
|
||||||
private NSTextField FolderNameTextField;
|
private NSTextField FolderNameTextField;
|
||||||
private NSTextField ServerTypeLabel;
|
private NSTextField ServerTypeLabel;
|
||||||
private NSTextField AddressLabel;
|
private NSTextField AddressLabel;
|
||||||
private NSTextField FolderNameLabel;
|
private NSTextField FolderNameLabel;
|
||||||
private NSTextField FolderNameHelpLabel;
|
private NSTextField FolderNameHelpLabel;
|
||||||
private NSButtonCell ButtonCellProto;
|
private NSButtonCell ButtonCellProto;
|
||||||
private NSMatrix Matrix;
|
private NSMatrix Matrix;
|
||||||
private int ServerType;
|
private int ServerType;
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
|
|
||||||
|
|
||||||
public SparkleSetup () : base ()
|
public SparkleSetup () : base ()
|
||||||
{
|
{
|
||||||
Controller.ChangePageEvent += delegate (PageType type) {
|
Controller.ChangePageEvent += delegate (PageType type) {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
Reset ();
|
Reset ();
|
||||||
|
@ -297,18 +297,18 @@ namespace SparkleShare {
|
||||||
ProgressIndicator = new NSProgressIndicator () {
|
ProgressIndicator = new NSProgressIndicator () {
|
||||||
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20),
|
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20),
|
||||||
Style = NSProgressIndicatorStyle.Bar,
|
Style = NSProgressIndicatorStyle.Bar,
|
||||||
MinValue = 0.0,
|
MinValue = 0.0,
|
||||||
MaxValue = 100.0
|
MaxValue = 100.0
|
||||||
};
|
};
|
||||||
|
|
||||||
// ProgressIndicator.StartAnimation (this);
|
// ProgressIndicator.StartAnimation (this);
|
||||||
|
|
||||||
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
ProgressIndicator.DoubleValue = percentage;
|
ProgressIndicator.DoubleValue = percentage;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ContentView.AddSubview (ProgressIndicator);
|
ContentView.AddSubview (ProgressIndicator);
|
||||||
|
|
||||||
FinishButton = new NSButton () {
|
FinishButton = new NSButton () {
|
||||||
|
@ -317,12 +317,12 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
CancelButton = new NSButton () {
|
CancelButton = new NSButton () {
|
||||||
Title = "Cancel"
|
Title = "Cancel"
|
||||||
};
|
};
|
||||||
|
|
||||||
CancelButton.Activated += delegate {
|
CancelButton.Activated += delegate {
|
||||||
Controller.SyncingCancelled ();
|
Controller.SyncingCancelled ();
|
||||||
};
|
};
|
||||||
|
|
||||||
Buttons.Add (FinishButton);
|
Buttons.Add (FinishButton);
|
||||||
Buttons.Add (CancelButton);
|
Buttons.Add (CancelButton);
|
||||||
|
@ -387,5 +387,5 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public event FolderFetchErrorEventHandler FolderFetchError;
|
public event FolderFetchErrorEventHandler FolderFetchError;
|
||||||
public delegate void FolderFetchErrorEventHandler ();
|
public delegate void FolderFetchErrorEventHandler ();
|
||||||
|
|
||||||
public event FolderFetchingEventHandler FolderFetching;
|
public event FolderFetchingEventHandler FolderFetching;
|
||||||
public delegate void FolderFetchingEventHandler (double percentage);
|
public delegate void FolderFetchingEventHandler (double percentage);
|
||||||
|
|
||||||
public event FolderListChangedEventHandler FolderListChanged;
|
public event FolderListChangedEventHandler FolderListChanged;
|
||||||
|
@ -1058,12 +1058,12 @@ namespace SparkleShare {
|
||||||
if (Directory.Exists (tmp_path))
|
if (Directory.Exists (tmp_path))
|
||||||
Directory.Delete (tmp_path, true);
|
Directory.Delete (tmp_path, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.fetcher.ProgressChanged += delegate (double percentage) {
|
this.fetcher.ProgressChanged += delegate (double percentage) {
|
||||||
if (FolderFetching != null)
|
if (FolderFetching != null)
|
||||||
FolderFetching (percentage);
|
FolderFetching (percentage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.fetcher.Start ();
|
this.fetcher.Start ();
|
||||||
|
|
|
@ -313,10 +313,10 @@ namespace SparkleShare {
|
||||||
AddButton (finish_button);
|
AddButton (finish_button);
|
||||||
|
|
||||||
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
Controller.UpdateProgressBarEvent += delegate (double percentage) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
this.progress_bar.Fraction = percentage / 100;
|
this.progress_bar.Fraction = percentage / 100;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.progress_bar.Parent != null)
|
if (this.progress_bar.Parent != null)
|
||||||
(this.progress_bar.Parent as Container).Remove (this.progress_bar);
|
(this.progress_bar.Parent as Container).Remove (this.progress_bar);
|
||||||
|
|
|
@ -33,8 +33,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public event ChangePageEventHandler ChangePageEvent;
|
public event ChangePageEventHandler ChangePageEvent;
|
||||||
public delegate void ChangePageEventHandler (PageType page);
|
public delegate void ChangePageEventHandler (PageType page);
|
||||||
|
|
||||||
public event UpdateProgressBarEventHandler UpdateProgressBarEvent;
|
public event UpdateProgressBarEventHandler UpdateProgressBarEvent;
|
||||||
public delegate void UpdateProgressBarEventHandler (double percentage);
|
public delegate void UpdateProgressBarEventHandler (double percentage);
|
||||||
|
|
||||||
public string PreviousServer {
|
public string PreviousServer {
|
||||||
|
@ -123,11 +123,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
this.syncing_folder = "";
|
this.syncing_folder = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleShare.Controller.FolderFetching += delegate (double percentage) {
|
SparkleShare.Controller.FolderFetching += delegate (double percentage) {
|
||||||
if (UpdateProgressBarEvent != null)
|
if (UpdateProgressBarEvent != null)
|
||||||
UpdateProgressBarEvent (percentage);
|
UpdateProgressBarEvent (percentage);
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleShare.Controller.FetchFolder (server, folder_name);
|
SparkleShare.Controller.FetchFolder (server, folder_name);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue