statusicon: fix progress not appearing sometimes
This commit is contained in:
parent
2e73338337
commit
8e1c79226e
|
@ -246,22 +246,14 @@ namespace SparkleLib.Git {
|
||||||
// "Writing objects" stage
|
// "Writing objects" stage
|
||||||
number = (number / 100 * 80 + 20);
|
number = (number / 100 * 80 + 20);
|
||||||
|
|
||||||
if (line.Contains ("|")) {
|
Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
||||||
string s = line.Substring (line.IndexOf ("|") + 1).Trim ();
|
Match speed_match = speed_regex.Match (line);
|
||||||
s = s.Replace (", done.", "").Trim ();
|
|
||||||
s = s.Replace ("KiB/s", "ᴋʙ/s");
|
|
||||||
s = s.Replace ("MiB/s", "ᴍʙ/s");
|
|
||||||
|
|
||||||
try {
|
if (speed_match.Success) {
|
||||||
if (line.Contains ("KiB/s"))
|
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
||||||
speed = double.Parse (s);
|
|
||||||
|
|
||||||
if (line.Contains ("MiB/s"))
|
if (speed_match.Groups [2].Value.Equals ("M"))
|
||||||
speed = double.Parse (s);
|
speed = speed * 1024;
|
||||||
|
|
||||||
} catch {
|
|
||||||
speed = 0.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,22 +331,14 @@ namespace SparkleLib.Git {
|
||||||
// "Writing objects" stage
|
// "Writing objects" stage
|
||||||
number = (number / 100 * 80 + 20);
|
number = (number / 100 * 80 + 20);
|
||||||
|
|
||||||
if (line.Contains ("|")) {
|
Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled);
|
||||||
string s = line.Substring (line.IndexOf ("|") + 1).Trim ();
|
Match speed_match = speed_regex.Match (line);
|
||||||
s = s.Replace (", done.", "").Trim ();
|
|
||||||
s = s.Replace ("KiB/s", "ᴋʙ/s");
|
|
||||||
s = s.Replace ("MiB/s", "ᴍʙ/s");
|
|
||||||
|
|
||||||
try {
|
if (speed_match.Success) {
|
||||||
if (line.Contains ("KiB/s"))
|
speed = double.Parse (speed_match.Groups [1].Value) * 1024;
|
||||||
speed = double.Parse (s);
|
|
||||||
|
|
||||||
if (line.Contains ("MiB/s"))
|
if (speed_match.Groups [2].Value.Equals ("M"))
|
||||||
speed = double.Parse (s);
|
speed = speed * 1024;
|
||||||
|
|
||||||
} catch {
|
|
||||||
speed = 0.0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,7 @@ namespace SparkleShare {
|
||||||
ProgressSpeedDown += rep.ProgressSpeed;
|
ProgressSpeedDown += rep.ProgressSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProgressPercentage = percentage / repo_count;
|
||||||
UpdateState ();
|
UpdateState ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue