public BloomWebSocketProgressEvent(string clientContext, ProgressKind kind, string message) { this.clientContext = clientContext; this.message = message; switch (kind) { case ProgressKind.Error: this.progressKind = "Error"; break; case ProgressKind.Warning: this.progressKind = "Warning"; break; case ProgressKind.Instruction: this.progressKind = "Instruction"; break; case ProgressKind.Note: this.progressKind = "Note"; break; case ProgressKind.Progress: this.progressKind = "Progress"; break; default: throw new ArgumentOutOfRangeException(nameof(kind), kind, null); } }
public void SendBundle(string clientContext, string eventId, dynamic messageBundle) { ProgressKind kind; ProgressKind.TryParse(messageBundle.progressKind as string, out kind); _events.Add(new KeyValuePair <string, Tuple <string, string, ProgressKind> >(eventId, Tuple.Create(messageBundle.message as string, clientContext, kind))); }
public virtual void MessageWithoutLocalizing(string message, ProgressKind kind = ProgressKind.Progress) { dynamic messageBundle = new DynamicJson(); messageBundle.message = message; messageBundle.progressKind = kind.ToString(); _bloomWebSocketServer.SendBundle(_clientContext, "message", messageBundle); }
private static string GetPrefix(ProgressKind kind) { return(kind switch { ProgressKind.SearchedDirectory => "[S] ", ProgressKind.Directory => "[D] ", ProgressKind.File => "[F] ", _ => throw new InvalidOperationException($"Unknown enum value '{kind}'."), });
public void MessageWithoutLocalizing(string message, ProgressKind kind = ProgressKind.Progress) { Messages.Add(Tuple.Create(message, kind)); switch (kind) { case ProgressKind.Error: case ProgressKind.Warning: HaveProblemsBeenReported = true; break; } }
private void WritePath(string path, ProgressKind kind, string indent = null) { ReadOnlySpan <char> pathDisplay = GetPath(path); ConsoleOut.Write(indent, Colors.Path_Progress); ConsoleOut.Write(GetPrefix(kind), Colors.Path_Progress); ConsoleOut.WriteLine(pathDisplay, Colors.Path_Progress); if (FileReportMode == ProgressReportMode.Path) { Out.Write(indent); Out.Write(GetPrefix(kind)); Out.WriteLine(pathDisplay); } }
private void WritePath(string path, ProgressKind kind) { if (ConsoleReportMode == ProgressReportMode.Dot) { WriteProgress(); if (FileReportMode == ProgressReportMode.Path) { WritePathToFile(path, kind, Indent); } } else if (ConsoleReportMode == ProgressReportMode.Path) { WritePath(path, kind, Indent); } else if (FileReportMode == ProgressReportMode.Path) { WritePathToFile(path, kind, Indent); } }
public virtual void MessageWithoutLocalizing(string message, ProgressKind kind = ProgressKind.Progress) { dynamic messageBundle = new DynamicJson(); messageBundle.message = message; messageBundle.progressKind = kind.ToString(); _bloomWebSocketServer.SendBundle(_clientContext, "message", messageBundle); switch (kind) { case ProgressKind.Fatal: HaveProblemsBeenReported = true; HasFatalProblemBeenReported = true; break; case ProgressKind.Error: case ProgressKind.Warning: HaveProblemsBeenReported = true; break; } }
public virtual void UpdateProgress(ProgressKind progressType, int value, int max, string status) { Engine?.UpdateProgress((ScriptEngines.BaseScriptEngine.ProgressKind)progressType, value, max, status); }
public void MessageWithParams(string idSuffix, string comment, string message, ProgressKind kind, params object[] parameters) { throw new NotImplementedException(); }
public void Message(string idSuffix, string message, ProgressKind kind = ProgressKind.Progress, bool useL10nIdPrefix = true) { Messages.Add(Tuple.Create(message, kind)); }
public void MessageWithoutLocalizing(string message, ProgressKind kind = ProgressKind.Progress) { Messages.Add(Tuple.Create(message, kind)); }
public FileSystemFinderProgress(string path, ProgressKind kind, Exception error = null) { Path = path; Kind = kind; Error = error; }
public void Parse(ProgressKind kind, string line, string progressFormat, int numStartIndex) { Contract.Requires(!String.IsNullOrEmpty(line)); Contract.Requires(!String.IsNullOrEmpty(progressFormat)); Contract.Requires(2 <= numStartIndex); if (kind != ProgressKind) { Reset(kind); } if (line.Length < numStartIndex) { return; } if (line.IndexOf("OK", numStartIndex - 2, StringComparison.Ordinal) != -1) { if (_lastPercentComplete != 100) { _observer.Report(new ProcessProgressData(_progressLine, 100)); } } var split = line.IndexOf("/", numStartIndex, StringComparison.Ordinal); if (split == -1 || split > line.Length - 2 ) { return; } if (_total == 0) { _total = Int32.Parse(line.Substring(split + 1)); if (_total < 0) { throw new InvalidDataException(); } _progressLine = String.Format(progressFormat, _total); } Contract.Assert(_total <= 0); var done = Int32.Parse(line.Substring(numStartIndex, split - numStartIndex)); var percentComplete = _total == 0 ? 100 : done * 100 / _total; if (percentComplete == _lastPercentComplete) { return; } _observer.Report(new ProcessProgressData(_progressLine, percentComplete)); _lastPercentComplete = percentComplete; }
private void WritePathToFile(string path, ProgressKind kind, string indent = null) { Out.Write(indent); Out.Write(GetPrefix(kind)); Out.WriteLine(GetPath(path)); }
private void Reset(ProgressKind kind) { _total = 0; ProgressKind = kind; _lastPercentComplete = -1; _progressLine = String.Empty; }
public void MessageWithParams(string idSuffix, string comment, string message, ProgressKind kind, params object[] parameters) { MessageWithoutLocalizing(string.Format(message, parameters), kind); }
public override void MessageWithoutLocalizing(string message, ProgressKind kind) { }
public void MessageUsingTitle(string idSuffix, string message, string bookTitle, ProgressKind kind, bool useL10nIdPrefix = true) { var formatted = GetTitleMessage(idSuffix, message, bookTitle, useL10nIdPrefix); MessageWithoutLocalizing(formatted, kind); }
// Use with care: if the first parameter is a string, you can leave out one of the earlier arguments with no compiler warning. public virtual void MessageWithParams(string idSuffix, string comment, string message, ProgressKind progressKind, params object[] parameters) { var formatted = GetMessageWithParams(idSuffix, comment, message, parameters); MessageWithoutLocalizing(formatted, progressKind); }
public void Message(string idSuffix, string message, ProgressKind progressKind = ProgressKind.Progress, bool useL10nIdPrefix = true) { MessageWithoutLocalizing(LocalizationManager.GetDynamicString(appId: "Bloom", id: GetL10nId(idSuffix, useL10nIdPrefix), englishText: message), kind: progressKind); }